|
[Sponsors] | |||||
[snappyHexMesh] Boundary layers fail to project near Inlet/Outlet in snappyHexMesh |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|
|
#1 |
|
New Member
Robin Louis
Join Date: Apr 2025
Posts: 2
Rep Power: 0 ![]() |
Hi everyone
My name is Robin, and I’m a beginner in CFD, especially when it comes to meshing with snappyHexMesh. I’m currently working on a study of pressure losses in a suction orifice, and I’m trying to build a clean, consistent mesh of the fluid domain before running any CFD calculations. At this stage, I’m not yet trying to achieve y+ ≈ 1. I’m simply trying to generate boundary layers (inflations) along all Wall surfaces, and make sure they project correctly near the Inlet and Outlet intersections. Once this works properly, I’ll focus on getting a mesh that respects wall-resolved turbulence requirements and mesh quality controls, so any advice for that next step is welcome too! Current situation I can generate layers on the Wall surfaces. However, they don’t project correctly near the Inlet and Outlet boundaries — they stop or collapse at the sharp connection between Wall and Inlet/Outlet (see screenshots). The only way I can currently get layers to appear at all is by setting: nLayerIter = 1; nRelaxIter = 1; which disables the meshQualityControls. With normal values, no many layers are generated. Geometry setup The fluid domain is defined by three STL surfaces: Wall.stl Inlet.stl Outlet.stl Each surface is defined separately as a triSurfaceMesh in the geometry block. What I’m trying to understand How to make the boundary layers project smoothly up to the Inlet and Outlet faces, without being deleted near the junctions. Later, how to re-enable proper mesh quality controls while keeping layer generation stable. And finally, once the layers behave correctly, how to adjust them to reach y+ ≈ 1. Attached My current snappyHexMeshDict A few screenshots of the Wall–Inlet and Wall–Outlet transitions where the layers fail to project Any help or advice on how to correctly set up snappy for this kind of geometry (closed pipe domain built from separate Wall/Inlet/Outlet STL surfaces) would be greatly appreciated. Thanks a lot in advance for your time and guidance, Robin snappyHexMeshDict : Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v2012 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object topoSetDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // castellatedMesh false; snap false; addLayers true; mergeTolerance 1e-6; geometry { Inlet { type triSurfaceMesh; file "Inlet.stl"; // dans constant/triSurface } Outlet { type triSurfaceMesh; file "Outlet.stl"; // dans constant/triSurface } Wall { type triSurfaceMesh; file "Wall.stl"; // dans constant/triSurface } } castellatedMeshControls { // bornes pour contenir la taille tout en autorisant un raffinement poussé maxLocalCells 2000000; maxGlobalCells 10000000; minRefinementCells 10; nCellsBetweenLevels 1; // transitions serrées → suit mieux les détails maxLoadUnbalance 0.1; // Utilise l’eMesh pour forcer les arêtes features ( { file "Inlet.eMesh"; level 3; } { file "Outlet.eMesh"; level 3; } { file "Wall.eMesh"; level 3; } ); // angle à partir duquel une arête du STL est “résolue” par raffinement resolveFeatureAngle 1; // 30–40 pour bien accrocher les arêtes // Raffinement surfacique par région STL refinementSurfaces { Inlet { level (0 2);} Outlet { level (0 2);} Wall { level (0 2);} } refinementRegions { Wall {mode distance; levels ( (0.003 3) );} } insidePoint (-0.03 0 0.03); allowFreeStandingZoneFaces true; } snapControls { nSmoothPatch 5; nSmoothInternal $nSmoothPatch; tolerance 3; // plus strict → colle mieux (1.5–2.0) nSolveIter 50; nRelaxIter 6; nFeatureSnapIter 10; nFaceSplitInterval 5; implicitFeatureSnap false; explicitFeatureSnap true; multiRegionFeatureSnap false; } addLayersControls { relativeSizes false; expansionRatio 1.1; firstLayerThickness 0.00017; minThickness 0.00003; layers { Wall { nSurfaceLayers 5; projectToPatch (Wall); } Inlet { nSurfaceLayers 0; } Outlet { nSurfaceLayers 0; } } nGrow 0; featureAngle 179; slipFeatureAngle 179; nBufferCellsNoExtrude 0; nLayerIter 1; //50 nRelaxIter 1; //30 // nRelaxedIter 30; additionalReparting true; maxFaceThicknessRatio 1; mergePatchFacesAngle 179; nSmoothSurfaceNormals 10; nSmoothThickness 10; minMedianAxisAngle 179; maxThicknessToMedialRatio 1; nSmoothNormals 15; mergePatchFaces true; mergeAcrossPatches false; // projectToSurface true; correctLayers true; } meshQualityControls { maxNonOrtho 180; maxBoundarySkewness 20; maxInternalSkewness 4; maxConcave 90; minVol -1e30; minTetQuality -1e30; // minArea -1; minTwist 0.02; minDeterminant 0.001; minFaceWeight 0.05; minVolRatio 0.01; // minTriangleTwist 1e-15; nSmoothScale 4; errorReduction 0.75; } debug 0; // (Facultatif) encore moins de sorties writeFlags (); // ************************************************************************* // Last edited by robincfd; November 3, 2025 at 04:23. |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
M
Join Date: Dec 2017
Posts: 724
Rep Power: 13 ![]() |
It seems you messed quite alot with the settings in the addLayers part. Here are the documented keywords https://www.openfoam.com/documentati...sh-layers.html and I fail to find some stuff you specified there and some settings seem to be off of the "recommended" settings, e.g. slipFeatureAngle should be half the featureAngle, whereas it is the same in your case. I recommend you set the default stuff for all the weird angles and iterations etc.
The reason why it collapses the layers toward the inlet/outlet is, that you specified 0 layers for these patches. It freezes the cells on the surface and dis-allows to move according the the growth of the adjacent walls. Completely delete these entries with 0 layers from the dict, and it should work. |
|
|
|
|
|
|
|
|
#3 | |
|
New Member
Robin Louis
Join Date: Apr 2025
Posts: 2
Rep Power: 0 ![]() |
Thanks for your reply!
Quote:
http://https://www.youtube.com/watch...z8YxC&index=34 Now, I’m struggling to generate inflations on all the walls due to the geometric complexity. I’ve been tweaking the different parameters, but I can’t seem to get anything close to uniform layers. If anyone has advice on which key parameters are most relevant to improve this, I’d really appreciate it. Thanks in advance, Robin |
||
|
|
|
||
|
|
|
#4 |
|
Senior Member
M
Join Date: Dec 2017
Posts: 724
Rep Power: 13 ![]() |
... and welcome to the world of pain that is adding layers with sHM
Jokes aside, snappyHexMesh does not shine for adding layers to complex geometries. Settings that work for one case might worsen it in another. You will find hundreds of threads here in the OF-Meshing subforum talking about strategies to resolve it ... and many without a resolution. In order to give more hints, we would need the settings you currently use. |
|
|
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Dec 2021
Posts: 292
Rep Power: 6 ![]() |
Hey,
It is a pain, but it is getting better! I am sharing tkeskita's work on this, hope they won't mind ![]() https://github.com/tkeskita/snappyLa...nappy.template These settings work quite well for layer coverage. I would just increase the featureAngle up to 180 (or even 350), I have found it worked better for most of my geometries. The other setting that really improves coverage is nOuterIter. Last edited by Alczem; November 13, 2025 at 12:23. |
|
|
|
|
|
![]() |
| Tags |
| layers, openfoam, snappyhexmesh |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Artificial wall error in fluent | aiden_1995 | Main CFD Forum | 0 | January 9, 2023 15:06 |
| y+ = 1 boundary layer mesh with snappyHexMesh | Arzed23 | OpenFOAM Running, Solving & CFD | 6 | November 23, 2022 16:15 |
| Radiation interface | hinca | CFX | 15 | January 26, 2014 18:11 |
| [snappyHexMesh] Boundary layers on an inlet/outlet for a pipe | eysteinn | OpenFOAM Meshing & Mesh Conversion | 13 | April 11, 2013 02:58 |
| [snappyHexMesh] no boundary layers using snappyHexMesh | thorsten | OpenFOAM Meshing & Mesh Conversion | 1 | October 22, 2009 07:01 |