Question about snappyHexMesh and cellZone generation in OpenFOAM v2012
- Post By jiaming liu
- 3 months ago
- Post Type Public
Hi contributors,
I sincerely appreciate your team's efforts in making your work publicly available online—it has been immensely helpful for OpenFOAM users and developers alike. After reading your article (Node266 - CFD SUPPORT), I followed the provided instructions to configure OpenFOAM to generate a cellZone
using snappyHexMesh
.
Unfortunately, the attempt was unsuccessful. The number of cells in both the cellZone
and faceZones
files turned out to be zero, and checkMesh.log
confirms this issue. When I check the result via paraFoam
, I also find that net0 ~ net4 contain no mesh—they are empty. This is not only contrary to my expectations, but also differs from the result described in the article.
I am using OpenFOAM v2012, and the net0
section in my snappyHexMeshDict
was set up following the example from your webpage.
I’ve uploaded the relevant case below. I would greatly appreciate any guidance.
--------------------------------------------------------------------------------------------------
snappyhexmeshdict:
/*--------------------------------*- 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 snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "../varsSettings" //Include global variables
castellatedMesh true;
snap true;
addLayers false;//true;
geometry
{
floater
{
type triSurfaceMesh;
file "DeepCwindPlatform_heave.stl";
}
net1
{
type triSurfaceMesh;
file "Net1_improved_heave.stl";
}
net2
{
type triSurfaceMesh;
file "Net2_improved_heave.stl";
}
net3
{
type triSurfaceMesh;
file "Net3_improved_heave.stl";
}
net4
{
type triSurfaceMesh;
file "Net4_improved_heave.stl";
}
net0
{
type searchableBox;
min (-100 -50 -120);
max (100 50 -80);
}
refineFreeSurface_L1
{
type searchableBox;
min ($minX $minY -10);
max ($maxX $maxY 10);
}
refineFreeSurface_L2
{
type searchableBox;
min (#calc "$minX+$inLen+20" -70 -8);
max (#calc "$maxX-$outLen-20" 70 8);
}
refineFloater_L1
{
type searchableBox;
min (-51 -49 #calc "-30 + $decay_z + $offset_z");
max ( 37 49 #calc "22 + $decay_z + $offset_z");
}
};
castellatedMeshControls
{
maxLocalCells 100000;
maxGlobalCells 2000000;
minRefinementCells 0;
maxLoadUnbalance 0.10;
nCellsBetweenLevels 1;
features
(
{
file "DeepCwindPlatform_heave.eMesh";
level 4;
}
{
file "Net1_improved_heave.eMesh";
level 4;
}
{
file "Net2_improved_heave.eMesh";
level 4;
}
{
file "Net3_improved_heave.eMesh";
level 4;
}
{
file "Net4_improved_heave.eMesh";
level 4;
}
);
refinementSurfaces
{
floater
{
level (4 4);//(5 5);
patchInfo
{
type wall;
// Optional group
// inGroups (meshedWalls);
}
}
net1
{
level (4 4);
cellZone net1Zone;
/* cellZoneInside inside;*/
faceZones net1fZone;
}
net2
{
level (4 4);
cellZone net2Zone;
/* cellZoneInside inside;*/
faceZones net2fZone;
}
net3
{
level (4 4);
cellZone net3Zone;
/* cellZoneInside inside;*/
faceZones net3fZone;
}
net4
{
level (4 4);
cellZone net4Zone;
/* cellZoneInside inside;*/
faceZones net4fZone;
}
net0
{
level (4 4);
cellZone net0Zone;
/* cellZoneInside inside;*/
faceZones net0fZone;
}
}
resolveFeatureAngle 45;//30;
planarAngle 30;
refinementRegions
{
refineFreeSurface_L1
{
mode inside;
levels ((1e-5 1)); //First entry here is distance, which will be ignored unless mode = distance
}
refineFreeSurface_L2
{
mode inside;
levels ((1e-5 2)); //First entry here is distance, which will be ignored unless mode = distance
}
refineFloater_L1
{
mode inside;
levels ((1e-5 2)); //First entry here is distance, which will be ignored unless mode = distance
}
/* net1*/
/* {*/
/* mode inside;*/
/* levels ((1e-5 3)); // STL 内部 refinement 到 level 4*/
/* }*/
/* net2*/
/* {*/
/* mode inside;*/
/* levels ((1e-5 3));*/
/* }*/
/* net3*/
/* {*/
/* mode inside;*/
/* levels ((1e-5 3));*/
/* }*/
/* net4*/
/* {*/
/* mode inside;*/
/* levels ((1e-5 3));*/
/* }*/
}
limitRegions
{
}
locationInMesh (-150 0 0);
allowFreeStandingZoneFaces true;//false;
faceZoneControls
{
}
locationsOutsideMesh ((100 100 100));
}
snapControls
{
nSmoothPatch 5;//3
tolerance 2.0;
nSolveIter 50;//30;
nRelaxIter 10;//5;
nFeatureSnapIter 20;//10;
implicitFeatureSnap false;//true;
explicitFeatureSnap true;//false;
multiRegionFeatureSnap false;
}
addLayersControls
{
relativeSizes true;
expansionRatio 1.25;
finalLayerThickness 0.64;
minThickness 0.1;
layers
{
floater
{
nSurfaceLayers 2;//3;
}
}
nGrow 0;
featureAngle 180;//180;
maxFaceThicknessRatio 0.5;//0.5;
nSmoothSurfaceNormals 1;
nSmoothThickness 10;
minMedialAxisAngle 90;
maxThicknessToMedialRatio 0.3;
nSmoothNormals 3;
slipFeatureAngle 30;
nRelaxIter 5;
nBufferCellsNoExtrude 0;
nLayerIter 50;
nRelaxedIter 20;
}
meshQualityControls
{
#include "meshQualityDict"
relaxed
{
maxNonOrtho 75;
}
nSmoothScale 4;
errorReduction 0.75;
}
mergeTolerance 1e-6;
// ************************************************************************* //
| ========= | |
| \\ / 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 snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "../varsSettings" //Include global variables
castellatedMesh true;
snap true;
addLayers false;//true;
geometry
{
floater
{
type triSurfaceMesh;
file "DeepCwindPlatform_heave.stl";
}
net1
{
type triSurfaceMesh;
file "Net1_improved_heave.stl";
}
net2
{
type triSurfaceMesh;
file "Net2_improved_heave.stl";
}
net3
{
type triSurfaceMesh;
file "Net3_improved_heave.stl";
}
net4
{
type triSurfaceMesh;
file "Net4_improved_heave.stl";
}
net0
{
type searchableBox;
min (-100 -50 -120);
max (100 50 -80);
}
refineFreeSurface_L1
{
type searchableBox;
min ($minX $minY -10);
max ($maxX $maxY 10);
}
refineFreeSurface_L2
{
type searchableBox;
min (#calc "$minX+$inLen+20" -70 -8);
max (#calc "$maxX-$outLen-20" 70 8);
}
refineFloater_L1
{
type searchableBox;
min (-51 -49 #calc "-30 + $decay_z + $offset_z");
max ( 37 49 #calc "22 + $decay_z + $offset_z");
}
};
castellatedMeshControls
{
maxLocalCells 100000;
maxGlobalCells 2000000;
minRefinementCells 0;
maxLoadUnbalance 0.10;
nCellsBetweenLevels 1;
features
(
{
file "DeepCwindPlatform_heave.eMesh";
level 4;
}
{
file "Net1_improved_heave.eMesh";
level 4;
}
{
file "Net2_improved_heave.eMesh";
level 4;
}
{
file "Net3_improved_heave.eMesh";
level 4;
}{
file "Net4_improved_heave.eMesh";
level 4;
}
);
refinementSurfaces
{
floater
{
level (4 4);//(5 5);
patchInfo
{
type wall;
// Optional group
// inGroups (meshedWalls);
}
}
net1
{
level (4 4);
cellZone net1Zone;
/* cellZoneInside inside;*/
faceZones net1fZone;
}
net2
{
level (4 4);
cellZone net2Zone;
/* cellZoneInside inside;*/
faceZones net2fZone;
}
net3
{
level (4 4);
cellZone net3Zone;
/* cellZoneInside inside;*/
faceZones net3fZone;
}
net4
{
level (4 4);
cellZone net4Zone;
/* cellZoneInside inside;*/
faceZones net4fZone;
}
net0
{
level (4 4);
cellZone net0Zone;
/* cellZoneInside inside;*/
faceZones net0fZone;
}
}
resolveFeatureAngle 45;//30;
planarAngle 30;
refinementRegions
{
refineFreeSurface_L1
{
mode inside;
levels ((1e-5 1)); //First entry here is distance, which will be ignored unless mode = distance
}
refineFreeSurface_L2
{
mode inside;
levels ((1e-5 2)); //First entry here is distance, which will be ignored unless mode = distance
}
refineFloater_L1
{
mode inside;
levels ((1e-5 2)); //First entry here is distance, which will be ignored unless mode = distance
}
/* net1*/
/* {*/
/* mode inside;*/
/* levels ((1e-5 3)); // STL 内部 refinement 到 level 4*/
/* }*/
/* net2*/
/* {*/
/* mode inside;*/
/* levels ((1e-5 3));*/
/* }*/
/* net3*/
/* {*/
/* mode inside;*/
/* levels ((1e-5 3));*/
/* }*/
/* net4*/
/* {*/
/* mode inside;*/
/* levels ((1e-5 3));*/
/* }*/
}
limitRegions
{
}
locationInMesh (-150 0 0);
allowFreeStandingZoneFaces true;//false;
faceZoneControls
{
}
locationsOutsideMesh ((100 100 100));
}
snapControls
{
nSmoothPatch 5;//3
tolerance 2.0;
nSolveIter 50;//30;
nRelaxIter 10;//5;
nFeatureSnapIter 20;//10;
implicitFeatureSnap false;//true;
explicitFeatureSnap true;//false;
multiRegionFeatureSnap false;
}
addLayersControls
{
relativeSizes true;
expansionRatio 1.25;
finalLayerThickness 0.64;
minThickness 0.1;
layers
{
floater
{
nSurfaceLayers 2;//3;
}
}
nGrow 0;
featureAngle 180;//180;
maxFaceThicknessRatio 0.5;//0.5;
nSmoothSurfaceNormals 1;
nSmoothThickness 10;
minMedialAxisAngle 90;
maxThicknessToMedialRatio 0.3;
nSmoothNormals 3;
slipFeatureAngle 30;
nRelaxIter 5;
nBufferCellsNoExtrude 0;
nLayerIter 50;
nRelaxedIter 20;
}
meshQualityControls
{
#include "meshQualityDict"
relaxed
{
maxNonOrtho 75;
}
nSmoothScale 4;
errorReduction 0.75;
}
mergeTolerance 1e-6;
// ************************************************************************* //
Thank you very much in advance!
Best regards,
Liu Jiaming