CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [snappyHexMesh] Mesh does not follow feature edges (https://www.cfd-online.com/Forums/openfoam-meshing/244525-mesh-does-not-follow-feature-edges.html)

michael3000 August 12, 2022 12:08

Mesh does not follow feature edges
 
1 Attachment(s)
Hi all,

I'm relatively new to OpenFOAM, so unfortunately I feel completely lost with the following problem and have no idea which knobs to turn:

The case:
  • windAroundBuildings tutorial.
  • I only use a different OBJ file and adjust the dimensions of
    Code:

    backgroundMesh
    and
    Code:

    refinementBox
    in the
    Quote:

    blockMeshDict
    and
    Code:

    snappyHexMeshDict
    , respectively.

What you see in the screenshot:
  • The grey solid volume is from the OBJ and represents the building.
  • The white lines on the building are the feature edges as extracted by
    Code:

    surfaceFeatureExtract
    .
  • The pink lines come from rendering the VTM file as "Feature Edges" in ParaView.

The problem is that the pink feature edges do not follow the actual features of the building nicely. I suspect that
Code:

snappyHexMesh
needs better refinement, but I don't know which parameter to adjust or whether this is even the correct assessment of the problem.

kandelabr August 14, 2022 01:47

It does seem that some more refinement could help. You have the following options:
- make a finer background mesh by changing the number of cells in blockMeshDict
- volume refinement (the 'box' you're talking about)
- Refine cells on buildings' surfaces
- Refine cells on edges.

Those options are sorted by number of additional cells they will generate.
I'd recommend the 'surfaces' option, just add refinementSurfaces to castellatedMeshControls, then increase level step by step.

https://www.openfoam.comu/documentat...nementSurfaces

If you share your snappy dict, I can show you more precisely. :)

michael3000 August 15, 2022 08:53

Quote:

Originally Posted by kandelabr (Post 833782)
If you share your snappy dict, I can show you more precisely. :)

Thanks a lot for the help! :) I inserted the snappy dict below. It's directly taken from the
Code:

windAroundBuildings
example.

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  v2112                                |
|  \\  /    A nd          | Website:  www.openfoam.com                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#includeEtc "caseDicts/mesh/generation/snappyHexMeshDict.cfg"

castellatedMesh on;
snap            on;
addLayers      off;

geometry
{
    buildings.obj
    {
        type triSurfaceMesh;
        name buildings;
    }

    refinementBox
    {
        type box;
        min  (-97.1975 -110.911 0.0);
        max  (137.1975 150.911 78.0);
    }
}

castellatedMeshControls
{
    features
    (
      { file  "buildings.eMesh"; level 1; }
    );

    refinementSurfaces
    {
        buildings
        {
            level (3 3);
            patchInfo { type wall; }
        }
    }

    refinementRegions
    {
        refinementBox
        {
            mode inside;
            levels ((1E15 2));
        }
    }

    locationInMesh (1 1 1);
}

snapControls
{
    explicitFeatureSnap    true;
    implicitFeatureSnap    false;
}

addLayersControls
{
    layers
    {
        "CAD.*"
        {
            nSurfaceLayers 2;
        }
    }

    relativeSizes      true;
    expansionRatio      1.2;
    finalLayerThickness 0.5;
    minThickness        1e-3;
}

meshQualityControls
{}

writeFlags
(
    noRefinement
    // scalarLevels
    // layerSets
    // layerFields
);

mergeTolerance 1e-6;


// ************************************************************************* //


kandelabr August 15, 2022 14:42

Code:

    features
    (
      { file  "buildings.eMesh"; level 1; }
    );

    refinementSurfaces
    {
        buildings
        {
            level (3 3);
            patchInfo { type wall; }
        }
    }

Increase the bold numbers and see what happens. First try to set level 4; in features, then also level (4 4); also in surfaces.

michael3000 August 30, 2022 07:52

Thanks, that helped and was also a good starting point to learn more about SnappyHexMesh. :)


All times are GMT -4. The time now is 09:38.