CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[snappyHexMesh] Prism layer collapsing in refinement transition

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By hiaselhans

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 14, 2021, 09:44
Default Prism layer collapsing in refinement transition
  #1
New Member
 
rubenparedes's Avatar
 
Ruben Paredes
Join Date: Mar 2009
Location: Guayaquil, Ecuador
Posts: 21
Rep Power: 17
rubenparedes is on a distinguished road
Send a message via MSN to rubenparedes
Dear all,

I am trying to generate 8 prism layers around a 60 m long submarine with a refinement region at the bow. However, SHM is not able to generate a prism layer along the transition between bow a midbody region, see attached figures. The nSurfaceLayer distribution on the hull shows a 'scar' in this transition.

I have played with settings in the SHMdict without success.

Any help will be appreciated,


Ruben


Code:
// Settings for the snapping.
snapControls
{
    //- Number of patch smoothing iterations before finding correspondence
    //  to surface
    nSmoothPatch 3;

    //- Relative distance for points to be attracted by surface feature point
    //  or edge. True distance is this factor times local
    //  maximum edge length.
    //    tolerance 4.0;
    tolerance 2.0;

    //- Number of mesh displacement relaxation iterations.
    nSolveIter 100;

    //- Maximum number of snapping relaxation iterations. Should stop
    //  before upon reaching a correct mesh.
    nRelaxIter 10;

    nFeatureSnapIter 20;

    explicitFeatureSnap    true;  //false
    multiRegionFeatureSnap true;  //- Detect features between multiple surfaces
                                  // (only for explicitFeatureSnap, default = false)
    implicitFeatureSnap    false; //true
}



// Settings for the layer addition.
addLayersControls
{
    // Are the thickness parameters below relative to the undistorted
    // size of the refined cell outside layer (true) or absolute sizes (false).
    relativeSizes true;

    // Per final patch (so not geometry!) the layer information
    layers
    {
        hull
        {
            nSurfaceLayers 8;

        }
    }

    // Expansion factor for layer mesh
    expansionRatio 1.5;


    // Wanted thickness of final added cell layer. If multiple layers
    // is the thickness of the layer furthest away from the wall.
    // Relative to undistorted size of cell outside layer.
    // See relativeSizes parameter.
    finalLayerThickness 0.60;

    // Minimum thickness of cell layer. If for any reason layer
    // cannot be above minThickness do not add layer.
    // See relativeSizes parameter.
    minThickness 1.0e-10;

    // If points get not extruded do nGrow layers of connected faces that are
    // also not grown. This helps convergence of the layer addition process
    // close to features.
    // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
    nGrow 0;


    // Advanced settings

    // When not to extrude surface. 0 is flat surface, 90 is when two faces
    // are perpendicular
    featureAngle 180; //60;

    // Maximum number of snapping relaxation iterations. Should stop
    // before upon reaching a correct mesh.
    nRelaxIter 5;

    // Number of smoothing iterations of surface normals
    nSmoothSurfaceNormals 50;

    // Number of smoothing iterations of interior mesh movement direction
    nSmoothNormals 50;

    // Smooth layer thickness over surface patches
    nSmoothThickness 10;

    // Stop layer growth on highly warped cells
    maxFaceThicknessRatio 0.8;

    // Reduce layer growth where ratio thickness to medial
    // distance is large
    maxThicknessToMedialRatio 0.9;

    // Angle used to pick up medial axis points
    // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
    minMedianAxisAngle 90;

    // Create buffer region for new layer terminations
    nBufferCellsNoExtrude 0;


    // Overall max number of layer addition iterations. The mesher will exit
    // if it reaches this number of iterations; possibly with an illegal
    // mesh.
    nLayerIter 50;

    // Max number of iterations after which relaxed meshQuality controls
    // get used. Up to nRelaxIter it uses the settings in meshQualityControls,
    // after nRelaxIter it uses the values in meshQualityControls::relaxed.
    nRelaxedIter 20;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    #include "meshQualityDict"
}


// Advanced

// Flags for optional output
// 0 : only write final meshes
// 1 : write intermediate meshes
// 2 : write volScalarField with cellLevel for postprocessing
// 4 : write current intersections as .obj files
debug 0;

// Write flags
writeFlags
(
    scalarLevels // write volScalarField with cellLevel for postprocessing
    layerSets    // write cellSets, faceSets of faces in layer
    layerFields  // write volScalarField for layer coverage
);


// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1E-6;
Attached Images
File Type: png nSurfaceLayersDistribution.png (96.5 KB, 86 views)
File Type: jpg prismLayerDistribution.jpg (81.8 KB, 97 views)
File Type: jpg refinementSurfaceRegionnDistribution.jpg (85.1 KB, 68 views)
__________________
R.
rubenparedes is offline   Reply With Quote

Old   January 14, 2021, 13:05
Default
  #2
New Member
 
Join Date: Feb 2016
Posts: 23
Rep Power: 10
37269 is on a distinguished road
What does the rest of your shmDict look like (specificially the castellatedMeshControls section)?
37269 is offline   Reply With Quote

Old   January 14, 2021, 13:50
Default
  #3
New Member
 
rubenparedes's Avatar
 
Ruben Paredes
Join Date: Mar 2009
Location: Guayaquil, Ecuador
Posts: 21
Rep Power: 17
rubenparedes is on a distinguished road
Send a message via MSN to rubenparedes
Dear 37269,

Thank you for your reply. I am using the following settings:

Code:
castellatedMeshControls
{
    maxLocalCells 10000000;
    maxGlobalCells 100000000;
    minRefinementCells 0;
    nCellsBetweenLevels 1;

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

    refinementSurfaces
    {
        hull
        {
            level (1 1);
        }
    }

  resolveFeatureAngle 45;

    refinementRegions
    {
        hull    // Name of region created in geometry section
        {
            mode distance;  
            levels ((0.60 1)); 
        }

        refinement_bow
        {
            mode            inside;
            levels          ((1.0 2));
        }
    }

    allowFreeStandingZoneFaces true;
}

snapControls
{
    nSmoothPatch 3;
    tolerance 2.0;
    nSolveIter 100;
    nRelaxIter 10;
    nFeatureSnapIter 20;

    explicitFeatureSnap    true;  
    multiRegionFeatureSnap true;  
    implicitFeatureSnap    false; 
}
__________________
R.
rubenparedes is offline   Reply With Quote

Old   May 11, 2021, 04:44
Default
  #4
New Member
 
Join Date: Jan 2014
Posts: 9
Rep Power: 12
hiaselhans is on a distinguished road
Quote:
Originally Posted by rubenparedes View Post
Dear 37269,

Thank you for your reply. I am using the following settings:



Hi @rubenparades,


how did you visualize the surfacelayers? I was looking for a so-named filter in paraFoam but couldn't find it.
hiaselhans is offline   Reply With Quote

Old   May 12, 2021, 10:21
Default
  #5
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hi hiaselhans,

You have to activate some writeFlags before running snappyHexMesh in order to visualize layer coverage in ParaView. Check Ruben's snappyHexMeshDict, this is the part you need to use:

Code:
// Write flags
writeFlags
(
    scalarLevels // write volScalarField with cellLevel for postprocessing
    layerSets    // write cellSets, faceSets of faces in layer
    layerFields  // write volScalarField for layer coverage
);
Cheers,
Yann
Yann is offline   Reply With Quote

Old   May 12, 2021, 13:16
Default
  #6
New Member
 
Join Date: Jan 2014
Posts: 9
Rep Power: 12
hiaselhans is on a distinguished road
Hi Yann,


Thanks a lot for your answer, i had these writeflags on, but couldn't find the fields on my patch. Are they maybe dropped after a simpleFoam run?


Thanks
Simon



Quote:
Originally Posted by Yann View Post
Hi hiaselhans,

You have to activate some writeFlags before running snappyHexMesh in order to visualize layer coverage in ParaView. Check Ruben's snappyHexMeshDict, this is the part you need to use:

Code:
// Write flags
writeFlags
(
    scalarLevels // write volScalarField with cellLevel for postprocessing
    layerSets    // write cellSets, faceSets of faces in layer
    layerFields  // write volScalarField for layer coverage
);
Cheers,
Yann
hiaselhans is offline   Reply With Quote

Old   May 13, 2021, 04:44
Default
  #7
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hi Simon,

If you ran snappyHexMesh with the -overwrite option, the fields created by these writeFlags should be in the 0 directory. You will need to load the time step 0 in paraView to be able to see it.
(If you use the paraview native reader for OpenFOAM, you might need to untick the "Skip Zero Time" before loading your case)

What is your workflow on this case?

Yann
Yann is offline   Reply With Quote

Old   May 13, 2021, 09:28
Default
  #8
New Member
 
Join Date: Jan 2014
Posts: 9
Rep Power: 12
hiaselhans is on a distinguished road
Hi Yann,


thanks for the hint! I already tried the "skip 0" checkbox but didn't work.
Now, the problem was that i was doing a reconstructPar -latesttime.


with -withZero added it does work fine. Thanks!


https://www.openfoam.com/documentati...structPar.html


now to my real problem i was playing around a lot with shM to get rid of those holes in the boundary layer but it seems like an immanent problem many people are facing...
Attached Images
File Type: png Bildschirmfoto-20210513142604-815x542.png (167.9 KB, 42 views)
Yann likes this.
hiaselhans is offline   Reply With Quote

Old   May 13, 2021, 11:55
Default
  #9
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hi Simon,


Glad to know you have solved your problem. For your information, if you are using ParaView's builtin reader for OpenFOAM, you can change the "Case Type" from "Reconstructed Case" to "Decomposed Case" in order to directly read the decomposed case and avoid the reconstructPar step.
It can be useful for large cases when reconstructPar can take a while to reconstruct the whole case.


Now, as you said, the real deal is to manage a good layer coverage with snappyHexMesh. As you have already seen, this is not an easy task.

Try to have the same surface refinement level on the whole surface, as snappy can struggle with transitions zones betwen refinement levels.
You can also play with the meshQualityControls parameters. Most of the time snappy kills the layer addition because the result cannot satisfy mesh quality criteria.


Cheers,
Yann
Yann is offline   Reply With Quote

Reply

Tags
prism layers, refinement, snappyhesmesh


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
y+ = 1 boundary layer mesh with snappyHexMesh Arzed23 OpenFOAM Running, Solving & CFD 6 November 23, 2022 16:15
[snappyHexMesh] Holes in internal mesh when adding boundary layer snappyHex otaolafr OpenFOAM Meshing & Mesh Conversion 3 February 8, 2021 09:19
[snappyHexMesh] snappyHexMesh Boundary Layer at Corner panpanzhong OpenFOAM Meshing & Mesh Conversion 5 July 3, 2018 06:53
[snappyHexMesh] sHM layer process keeps getting killed MBttR OpenFOAM Meshing & Mesh Conversion 4 August 15, 2016 04:21
errors Fahad Main CFD Forum 0 March 23, 2004 14:20


All times are GMT -4. The time now is 11:05.