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

[snappyHexMesh] snappyHesMesh boundary layer addition phase removes edges

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes
  • 1 Post By Yann
  • 1 Post By Yann
  • 2 Post By tkeskita
  • 1 Post By Yann
  • 1 Post By tkeskita
  • 2 Post By tkeskita

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 9, 2023, 02:23
Smile snappyHesMesh boundary layer addition phase removes edges
  #1
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 52
Rep Power: 15
tkeskita is on a distinguished road
Hi,

I think I've managed to find a nice layer addition procedure for SnappyHexMesh. Otherwise the result looks fine, but the layer addition seems to remove some edges at sharp features, see the top part of this figure:

with_layers.jpg

The top edges were fine after snapping phase, before layer addition:

without_layers.jpg

Does anyone know why this happens? It's possible to fix this issue by separating the surfaces into different patches, but it's a cumbersome workaround..

BR,
Tuomo
tkeskita is offline   Reply With Quote

Old   December 9, 2023, 04:45
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,085
Rep Power: 26
Yann will become famous soon enough
Hello,

If you are using the OpenCFD branch (openfoam.com), try using the mergePatchFacesAngle parameter in addLayersControls:

Code:
// When to merge patch faces. Default is featureAngle. Useful when featureAngle is large.
mergePatchFacesAngle 45;
source: https://develop.openfoam.com/Develop...ref_type=heads
lourencosm likes this.
Yann is offline   Reply With Quote

Old   December 9, 2023, 09:16
Default
  #3
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 52
Rep Power: 15
tkeskita is on a distinguished road
Hi,

Quote:
Originally Posted by Yann View Post
If you are using the OpenCFD branch (openfoam.com), try using the mergePatchFacesAngle parameter in addLayersControls:
thanks, that helped (when using openfoam.com v2306)!

I've been testing the layer addition, and so far the best results I've got when I've used the settings below, and then grown layers incrementally by rerunning snappyHexMesh with only the layer addition option enabled, adding only 2 layers at a time. Between the runs I only decrease finalLayerThickness and minThickness. This approach seems to produce layers almost everywhere nicely, but I have no idea why this stepwise growing approach seems to work, but growing all layers in one go does not.. any insights?

Code:
addLayersControls
{
    // Layer sizing
    relativeSizes   true;
    expansionRatio  1.3;
    finalLayerThickness 0.3; // 0.15;
    minThickness    0.1; // 0.05;
    nGrow           0;

    // Mesh dependencies
    featureAngle    130;
    mergePatchFacesAngle 45; // OpenFOAM.com option
    layerTerminationAngle -180; // OpenFOAM.com option
    maxFaceThicknessRatio 0.5;

    // Patch displacement
    nSmoothSurfaceNormals 1;
    nSmoothThickness 10;

    // Medial axis analysis
    minMedialAxisAngle 90;
    maxThicknessToMedialRatio 0.3;
    nSmoothNormals  3;
    slipFeatureAngle 30;

    // Mesh shrinking
    nRelaxIter      3;
    nBufferCellsNoExtrude 0;
    nLayerIter      50;
    nRelaxedIter    0;
    nOuterIter      3; // OpenFOAM.com option

    layers
    {
        inlet
        {
             nSurfaceLayers 0;
        }
        outlet
        {
             nSurfaceLayers 0;
        }
        walls
        {
             nSurfaceLayers 2;
        }
    }
 }

meshQualityControls
{
    maxNonOrtho     35;
    relaxed { maxNonOrtho 75; } // for layer addition
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave      80;
    minVol          1e-15;
    minTetQuality   1e-15;
    minArea         -1;
    minTwist        0.02;
    minDeterminant  0.001;
    minFaceWeight   0.05;
    minVolRatio     0.01;
    minTriangleTwist -1;
    nSmoothScale    4;
    errorReduction  0.75;
}
tkeskita is offline   Reply With Quote

Old   December 9, 2023, 17:09
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,085
Rep Power: 26
Yann will become famous soon enough
Have you tried the multi pass layer addition feature implemented since v2206 release? It looks like you're doing the same thing manually.
https://www.openfoam.com/news/main-n...hexmesh-layers

Snappy computes the total layer thickness and then moves the mesh away from the surface in order to insert the layers. When doing so, it has to morph the existing mesh and it sometimes results in bad cell quality which prevent it to add layers (to maintain mesh quality).
The stepwise approach might help thanks to the smaller mesh motion it requires. Just my feeling about it though.
lourencosm likes this.
Yann is offline   Reply With Quote

Old   December 10, 2023, 03:54
Default
  #5
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 52
Rep Power: 15
tkeskita is on a distinguished road
Hi,

thanks again @Yann! Turned out that the problem was in openfoam.org version of snappyHexMesh. Openfoam.com version seems to work nicely! Yes, the multi pass layer addition of openfoam.com is very useful, I could get all the layers in one go! I ended up using nOuterIter = maximum number of layers divided by 2. Here is an example:

sharp_edge.png

I'm wondering about the layers near 90 degree corners like this one below, would it be better not to have layers here? I mean, might there be some numerical trouble when the flow is in right to left direction..? Openfoam.org version of Snappy does not make layers in this area, maybe there is still some parameter to be tuned for openfoam.com?

corners.png

BR,
Tuomo
Yann and lourencosm like this.
tkeskita is offline   Reply With Quote

Old   December 10, 2023, 04:23
Default
  #6
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,085
Rep Power: 26
Yann will become famous soon enough
Quote:
Originally Posted by tkeskita View Post
I'm wondering about the layers near 90 degree corners like this one below, would it be better not to have layers here? I mean, might there be some numerical trouble when the flow is in right to left direction..? Openfoam.org version of Snappy does not make layers in this area, maybe there is still some parameter to be tuned for openfoam.com?

Attachment 97651
I don't know about numerical trouble, it really depends on your flow. Probably you should try and see how it behaves.

To avoid getting layers here, you could set the featureAngle below 90°, but it will not add layers in any sharp angle on your geometry. The only way to avoid adding layers in this specific place would be to have a separate patch for it so you can control the layers parameters for this patch.

Regards,
Yann
tkeskita likes this.
Yann is offline   Reply With Quote

Old   December 10, 2023, 06:43
Default
  #7
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 52
Rep Power: 15
tkeskita is on a distinguished road
FYI I've now added what I've learned about snappyHexMesh boundary layer addtion to my Blender SnappyHexMesh GUI add-on (see the discussion thread) for ease of use!
Yann likes this.
tkeskita is offline   Reply With Quote

Old   December 16, 2023, 13:00
Default
  #8
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 52
Rep Power: 15
tkeskita is on a distinguished road
Hi,

optimized layer parameters further, here is the result when using Feature Angle 130. Turned out that nSmoothDisplacement iterations are really important!

Screenshot_2023-12-16_19-45-13.png

and this one using Feature Angle 45. For some reason collapsing happens at second edge and not the first from the corner.

Screenshot_2023-12-16_19-51-29.png

This one is with Feature Angle 95, seems like something in between..

Screenshot_2023-12-16_20-19-07.png
Yann and lourencosm like this.
tkeskita is offline   Reply With Quote

Old   December 17, 2023, 09:38
Default
  #9
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,085
Rep Power: 26
Yann will become famous soon enough
Hello Tuomo,

I like the first one
Out of curiosity, have you tried to use your settings on another geometry?
Yann is offline   Reply With Quote

Old   December 18, 2023, 11:14
Default
  #10
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 52
Rep Power: 15
tkeskita is on a distinguished road
Hi Yann,

Quote:
Originally Posted by Yann View Post
I like the first one
Ok, but the real question is, does your solver like it too?

Quote:
Originally Posted by Yann View Post
Out of curiosity, have you tried to use your settings on another geometry?
Well I tried a few other ones, including the OF flange geometry. Maybe try the motorBike geo at some point, that might pose a challenge..

BR,
Tuomo
tkeskita is offline   Reply With Quote

Reply


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
SimpleFoam & Theater jipai OpenFOAM Running, Solving & CFD 3 June 18, 2019 10:11
Basic Nozzle-Expander Design karmavatar CFX 20 March 20, 2016 08:44
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 04:05
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 15:55
errors Fahad Main CFD Forum 0 March 23, 2004 13:20


All times are GMT -4. The time now is 15:59.