https://linen.dev logo
Join Discord
Powered by
# meshing
  • l

    lennygo

    10/13/2025, 1:37 PM
    Copy code
    refinementSurfaces
        {
            wing
            {
                // Surface-wise min and max refinement level
                level (6 7);
            }
        }
    
        // Resolve sharp angles on fridges
        resolveFeatureAngle 30;
    
    
        // Region-wise refinement
        // ~~~~~~~~~~~~~~~~~~~~~~
    
        // Specifies refinement level for cells in relation to a surface. One of
        // three modes
        // - distance. 'levels' specifies per distance to the surface the
        //   wanted refinement level. The distances need to be specified in
        //   descending order.
        // - inside. 'levels' is only one entry and only the level is used. All
        //   cells inside the surface get refined up to the level. The surface
        //   needs to be closed for this to be possible.
        // - outside. Same but cells outside.
    
        refinementRegions
        {
            refinementBox
            {
                mode inside;
                levels ((1e15 2));
            }
            refinementBox2
            {
                mode inside;
                levels ((1e15 3));
            }
    //        refinementSphere
    //        {
    //            mode inside;
    //            levels ((1e15 7));
    //        }
        }
  • y

    Yann

    10/13/2025, 1:37 PM
    Alright, now that's snappy!
  • l

    lennygo

    10/13/2025, 1:38 PM
    Yeah i dont quite understand the need to keep the boundary layer the same thickness with 2 whole cells
  • y

    Yann

    10/13/2025, 1:38 PM
    Alright, you need to define refinement surface for TE, if not it will just not be meshed
  • l

    lennygo

    10/13/2025, 1:38 PM
    Copy code
    refinementSurfaces
        {
            wing
            {
                // Surface-wise min and max refinement level
                level (6 7);
            }
            TE
            {
                level (7 7);
            }
        }
    ?
  • y

    Yann

    10/13/2025, 1:39 PM
    yep
  • l

    lennygo

    10/13/2025, 1:39 PM
    levels are so high because of a big outside mesh btw
  • y

    Yann

    10/13/2025, 1:41 PM
    I'm not shocked! 😄
  • l

    lennygo

    10/13/2025, 1:46 PM
    also in hindsight it mighve been better to do only one mesh for all the different angles of attack and just vary the boundary conditions to match the flow angle, but I saw that theres no easy way to just define the forces on a surface for their own coordinate system to align lift and drag with the flow, unless I have overseen something?
  • l

    lennygo

    10/13/2025, 1:46 PM
    still sucks with the refinement, I'll try the feature angle again https://cdn.discordapp.com/attachments/796072568385568808/1427291519613931520/image.png?ex=68ee5450&is=68ed02d0&hm=df413b779b8ab8a7db49dfb5e097d02d7de243d59cc8a9bfd4ff1d9cdba791a5&
  • y

    Yann

    10/13/2025, 1:50 PM
    You can totally define the coordinate system you want for the force function object
  • l

    lennygo

    10/13/2025, 1:53 PM
    really? Where was this documented?
  • y

    Yann

    10/13/2025, 1:55 PM
    https://develop.openfoam.com/Development/openfoam/-/blob/OpenFOAM-v2506/src/functionObjects/forces/forces/forces.H
  • y

    Yann

    10/13/2025, 1:55 PM
    (if you are using the .com branch)
  • l

    lennygo

    10/13/2025, 1:56 PM
    i think i am
  • t

    tkeskita

    10/13/2025, 3:02 PM
    There's `layerTerminationAngle`option in .com Snappy which you can use to cause layer collapse at the trailing edge
  • y

    Yann

    10/14/2025, 3:08 PM
    if there are people wondering how to add layers on multiregion meshes on the .org branch, this topic is pretty nice: https://www.cfd-online.com/Forums/openfoam-meshing/261347-problem-layer-generation-cht-shm-mesh-coupled-boundary-issue.html#post885554
  • s

    Snail With a Shotgun

    10/16/2025, 1:03 PM
    Hey, @tkeskita , I've been playing around with your mesh smoother on a mesh created by Snappy and while I see the potential, I'm struggling to get actually useful results out of it, so I was hoping you could give me a hand or explain some things. First, boundary point smoothing doesn't wanna play ball. Giving it 'targetSurfaces' and 'initEdges' files almost always results in a crash:
    Copy code
    --> FOAM FATAL ERROR: (openfoam-2206 patch=221104)
     Did not find surface intersection for pointI 6 at (0.14999999 6.3515077e-05 0.05) pointNormal (0 1 0) searchDistance 423.43385
    (It should be noted that the point (0.15, 0, 0.05) is quite far from any geometry, and isn't even a boundary point in the first place) Second, it appears to insist on messing with the boundary layers, even with -layerMaxBlendingFraction 0 applied. Although, it seems to only do it selectively, i.e. only with some boundary cells? See attached images (before -> after, note the 4 boundary layer cells in lower right that remain almost untouched). This particular case is "pseudo-2d" (prior to extrusion), but I've tried it on a proper 3d case as well with similar results. Right now, using it after the snapping step and before adding the boundary layer appears to be the best use, but I'm hoping to get more use out of it than that. Edit: I appear to have figured out the boundary point smoothing - didn't realize I had to include the domain itself in the targetSurfaces file for external cases, at least if no smoothingPatch is specified. It appears to be working now. https://cdn.discordapp.com/attachments/796072568385568808/1428367726442971227/pre.png?ex=68f23e9b&is=68f0ed1b&hm=ccad43024fb1b843af07f2c7e3c6dd88e7e835f99d19510d1c867ae18bb2b540& https://cdn.discordapp.com/attachments/796072568385568808/1428367726925053982/post.png?ex=68f23e9b&is=68f0ed1b&hm=7187e5d6319d8b09569547aa58f22e3861c3d3e252873c8e18d9111f1cd9df5f&
  • s

    Snail With a Shotgun

    10/16/2025, 1:05 PM
    I also decided to try and use it to thicken an already existing BL, something that would be very useful for the workflow I'm trying out, and it actually did a good job on the boundary layer cells it recognized, but it's clear which ones it doesn't. (going from BL thickness 0.007 to 0.008)
    -centroidalIters 100 -writeInterval 10 -layerPatches '( duct )' -layerEdgeLength 0.008 -minLayers 1 -maxLayers 1 -layerMaxBlendingFraction 0.4
    https://cdn.discordapp.com/attachments/796072568385568808/1428368242237243464/thickening.png?ex=68f23f16&is=68f0ed96&hm=1920984f89ce94684bba63f10650aac4efdac34703dd3601efb8da4ff4c69a8e&
  • o

    otaolafr

    10/16/2025, 1:39 PM
    This is the intended use, before layer addition 👍🏻
  • t

    tkeskita

    10/17/2025, 6:00 AM
    The uneven smoothing here is due to point freezing by quality checks, which doesn't allow centroidal smoothing to decrease quality beyond given angle limits. You can try with e.g.
    -minAngle 15
    to allow more points to move. But the main problem here is that your initial mesh with high aspect ratio cells is hard bite for isotropic centroidal smoothing.
  • o

    otaolafr

    10/17/2025, 6:06 AM
    tkeskita, now tat it looks like the contrainst part (which i would say it is the hardest part) is 'finished' are you planning to add a possibility for different 'solvers' i mean that adding a flag to select if centroidal or laplacian smoothing (or others? have you came across others?)
  • t

    tkeskita

    10/17/2025, 6:08 AM
    That's idea for far far future
  • o

    otaolafr

    10/17/2025, 6:08 AM
    i mean 'decide how to calculate new position part'
  • o

    otaolafr

    10/17/2025, 6:08 AM
    and have you came across other approaches than centroidal/laplacian?
  • o

    otaolafr

    10/17/2025, 6:09 AM
    i mean direct ways. like average sum of points and blablabla
  • t

    tkeskita

    10/17/2025, 6:12 AM
    For smoothMesh development, first I want to fix bugs. Then I want to document the current version. Then I want to test out the procedure to make it produce nice results and create boundary layers (by pulling points towards boundaries), given roughly isotropic (no large aspect ratio cells) initial mesh cases. Then maybe I try to look into how to improve behavior for meshes which already has boundary layers.
  • t

    tkeskita

    10/17/2025, 6:14 AM
    Not really looked into it, but there is always the option of making it (the choice of smoothing direction) an optimization problem. That would require understanding what is a good objective function to optimize.
  • o

    otaolafr

    10/17/2025, 6:24 AM
    yeah, the thing with optimization is that it has a high cost. thats why i was asking if you came to cross any other 'direct' methods.
  • t

    tkeskita

    10/21/2025, 10:57 AM
    I'm trying to build a 360 deg rotor stator mesh by extruding rotor and stator profiles separately with extrudeMesh. Does anyone know a good template for building such a NCC coupled case?