View Issue Details

IDProjectCategoryView StatusLast Update
0001918OpenFOAMBugpublic2015-11-25 08:19
Reporterole Assigned Tohenry  
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version14.04
Summary0001918: snappyHexMesh Layer size calculation fails when giving per patch overall thickness
DescriptionI am defining Layers with a (global) firstLayerThickness and an overall thickness (keyword thickness), the latter is defined per patch.

When trying to insert many layers and thus a large overall thickness, I obtain bad layer coverage.

When switching off some mesh quality controls snappyHexMesh generates layers. It becomes visible that the bad cells were not in the distorted background mesh but the layers themselves. The reason is that the first layer closest to the wall gets far too thin (factor at least ~10).
Steps To ReproduceI have created a simple test case based on the motor bike tutorial to reproduce the behavior. The geometry included has five patches for which different thicknesses are defined.
To run the case just run blockMesh and snappyHexMesh.
In attached image (y.png) the patches are coloured by wall distance y (cell centre).
Overall thickness was set to 0.02, 0.04, 0.06, 0.08 and 0.1 from left to right. firstLayerThickness was set to 0.1, so y (cell centre) should be 0.05.
It is 0.05 for the two leftmost patches, but significantly smaller for the other three patches.
In case expansion ratios are given instead of overall thicknesses, the first layer is fine.
TagsNo tags attached.



2015-11-19 12:35


layerProblem.tgz (35,319 bytes)


2015-11-23 07:10


before.png (8,078 bytes)   
before.png (8,078 bytes)   


2015-11-23 07:11


after.png (7,573 bytes)   
after.png (7,573 bytes)   


2015-11-23 07:16

reporter   ~0005665

Last edited: 2015-11-23 08:08

Hi Ole,

Confirmed. The problem is in Foam::layerParameters::layerExpansionRatio

When using overall thickness and first layer mode (FIRST_AND_TOTAL) the expansion ratio must be estimated in the code. The algorithm for this is iterative and if the overall thickness to first layer thickness ratio is high then it does not converge.

Changing line 53 of layerParameters.C to set the maxIters to 20 (up from 10) fixes the problem.

To see the change, look at before.png and after.png showing the addedCells from the layer step across the boundary between BOX_patch5 and BOX_patch6. Note the first layer thickness stays constant across the patches in the after image.


2015-11-23 16:55

manager   ~0005666

Thanks Richard, I have updated maxIters to 20 in OpenFOAM-dev. If this is not generally sufficient it could be made an optional input in snappyHexMeshDict.

@Ole: please let us know if this change solves your problem and I wil close this report.


2015-11-25 07:36

reporter   ~0005674

Hi Richard, Henry,
Many thanks for that change, it should work for me!


2015-11-25 08:19

manager   ~0005677

Resolved in OpenFOAM-dev by commit 05adeb46be931627bb820029e30f5f602d24a9ec

Issue History

Date Modified Username Field Change
2015-11-19 12:35 ole New Issue
2015-11-19 12:35 ole File Added: layerProblem.tgz
2015-11-23 07:10 richard File Added: before.png
2015-11-23 07:11 richard File Added: after.png
2015-11-23 07:16 richard Note Added: 0005665
2015-11-23 08:08 richard Note Edited: 0005665
2015-11-23 16:55 henry Note Added: 0005666
2015-11-25 07:36 ole Note Added: 0005674
2015-11-25 08:19 henry Note Added: 0005677
2015-11-25 08:19 henry Status new => resolved
2015-11-25 08:19 henry Resolution open => fixed
2015-11-25 08:19 henry Assigned To => henry