snappyHexMeshConfig: layers can be specified for individual surfaces

This commit is contained in:
Chris Greenshields
2023-08-22 16:48:11 +01:00
parent be88a99ecd
commit 075c358fb9
3 changed files with 42 additions and 23 deletions

View File

@ -86,8 +86,8 @@ Description
'-refinementBoxes' for quick, box-shaped refinement regions specified by min
and max bounds; '-refinementDists' for distance-based refinement; and
'-nCellsBetweenLevels' to control the transition between refinement
levels. A '-layers' option specifies additional layers of cells at wall
boundaries. The insidePoint parameter is set to '(0 0 0)' by default but can
levels. A '-layers' option controls additional layers of cells at specified
surfaces. The insidePoint parameter is set to '(0 0 0)' by default but can
be overridden using the '-insidePoint' option.
Usage
@ -137,8 +137,8 @@ Usage
- \par -explicitFeatures,
Use explicit feature capturing, default is implicit
- \par -layers \<int\>
Specify <int> surface layers at wall boundaries, default 0
- \par -layers \<entry\>
Number of layers on specified surfaces, e.g. '((car 3) (ground 4))'
- \par -firstLayerThickness \<value\>
Specify the thickness of the near wall cells for layer addition
@ -322,8 +322,8 @@ int main(int argc, char *argv[])
argList::addOption
(
"layers",
"int",
"specify <int> surface layers at wall boundaries, default 0"
"entry",
"number of layers on specified surfaces, e.g. '((car 3) (ground 4))'"
);
argList::addOption
@ -592,7 +592,14 @@ int main(int argc, char *argv[])
const bool explicitFeatures(args.optionFound("explicitFeatures"));
const label layers(args.optionLookupOrDefault<label>("layers", 0));
List<Tuple2<word, label>> layers;
if (args.optionFound("layers"))
{
layers.append
(
args.optionReadList<Tuple2<word, label>>("layers")
);
}
const scalar firstLayerThickness
(

View File

@ -37,7 +37,7 @@ void Foam::snappyHexMeshConfiguration::writeSnappySwitches()
dict.add
(
"addLayers",
layers_ == 0 ? "off" : "on",
layers_.empty() ? "off" : "on",
true
);
@ -439,6 +439,9 @@ void Foam::snappyHexMeshConfiguration::writeAddLayersControls()
beginDict(os_, "layers");
if (layers_.empty())
{
// Add convenient entries with zero layers if layers are switched off.
forAll(surfaces_, i)
{
switch (surfaces_[i].type())
@ -448,14 +451,23 @@ void Foam::snappyHexMeshConfiguration::writeAddLayersControls()
case surfaceType::baffle:
{
os_ << indent << "\"" << surfaces_[i].name()
<< ".*\" { nSurfaceLayers "
<< layers_ << "; }" << endl;
<< ".*\" { nSurfaceLayers 0; }" << endl;
break;
}
default: break;
}
}
}
else
{
// Add entries for specified surfaces.
forAll(layers_, i)
{
os_ << indent << "\"" << layers_[i].first()
<< ".*\" { nSurfaceLayers "
<< layers_[i].second() << "; }" << endl;
}
}
endDict(os_);
@ -521,7 +533,7 @@ Foam::snappyHexMeshConfiguration::snappyHexMeshConfiguration
const List<Tuple3<vector, vector, label>>& refinementBoxes,
const List<Tuple3<word, scalar, label>>& refinementDists,
const bool explicitFeatures,
const label layers,
const List<Tuple2<word, label>>& layers,
const scalar firstLayerThickness,
const scalar layerExpansionRatio,
const point& insidePoint,

View File

@ -83,8 +83,8 @@ class snappyHexMeshConfiguration
//- Using explicit feature capturing?
const bool explicitFeatures_;
//- Number of layers at wall patches, default 0
const label layers_;
//- Number of layers on specified surfaces
const List<Tuple2<word, label>> layers_;
//- Thickness of the near wall cells with layer addition
const scalar firstLayerThickness_;
@ -180,7 +180,7 @@ public:
const List<Tuple3<vector, vector, label>>& refinementBoxes,
const List<Tuple3<word, scalar, label>>& refinementDists,
const bool explicitFeatures,
const label layers,
const List<Tuple2<word, label>>& layers,
const scalar firstLayerThickness,
const scalar layerExpansionRatio,
const point& insidePoint,