snappyHexMeshConfig: added '-firstLayerThickness' and '-layerExpansionRatio' options

This commit is contained in:
Chris Greenshields
2023-07-21 17:55:22 +01:00
parent 2d39211826
commit 6d36c53788
3 changed files with 75 additions and 8 deletions

View File

@ -140,6 +140,12 @@ Usage
- \par -layers \<int\> - \par -layers \<int\>
Specify <int> surface layers at wall boundaries, default 0 Specify <int> surface layers at wall boundaries, default 0
- \par -firstLayerThickness \<value\>
Specify the thickness of the near wall cells for layer addition
- \par -layerExpansionRatio \<value\>
Specify the expansion ratio between layers, default 1.2
- \par -cellZones \<list\> - \par -cellZones \<list\>
Surfaces that form cellZones, e.g. '(porousZone heatSource)' Surfaces that form cellZones, e.g. '(porousZone heatSource)'
@ -197,7 +203,7 @@ void readPatchOption
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::usageMin = 30; argList::usageMin = 32;
argList::usageMax = 105; argList::usageMax = 105;
argList::addNote argList::addNote
@ -320,6 +326,20 @@ int main(int argc, char *argv[])
"specify <int> surface layers at wall boundaries, default 0" "specify <int> surface layers at wall boundaries, default 0"
); );
argList::addOption
(
"firstLayerThickness",
"value",
"specify the thickness of the near wall cells for layer addition"
);
argList::addOption
(
"layerExpansionRatio",
"value",
"specify the expansion ratio between layers, default 1.2"
);
argList::addOption argList::addOption
( (
"cellZones", "cellZones",
@ -574,6 +594,16 @@ int main(int argc, char *argv[])
const label layers(args.optionLookupOrDefault<label>("layers", 0)); const label layers(args.optionLookupOrDefault<label>("layers", 0));
const scalar firstLayerThickness
(
args.optionLookupOrDefault<scalar>("firstLayerThickness", 0)
);
const scalar layerExpansionRatio
(
args.optionLookupOrDefault<scalar>("layerExpansionRatio", 1.2)
);
const point insidePoint const point insidePoint
( (
args.optionLookupOrDefault<point>("insidePoint", point::zero) args.optionLookupOrDefault<point>("insidePoint", point::zero)
@ -610,6 +640,8 @@ int main(int argc, char *argv[])
refinementDists, refinementDists,
explicitFeatures, explicitFeatures,
layers, layers,
firstLayerThickness,
layerExpansionRatio,
insidePoint, insidePoint,
nCellsBetweenLevels nCellsBetweenLevels
); );

View File

@ -459,13 +459,36 @@ void Foam::snappyHexMeshConfiguration::writeAddLayersControls()
endDict(os_); endDict(os_);
os_ << indent << "relativeSizes on; " bool relativeSizes(firstLayerThickness_ == 0);
<< "// off, usually with firstLayerThickness" << nl
<< indent << "expansionRatio 1.2;" << nl // relativeSizes
<< indent << "finalLayerThickness 0.5;" << nl os_ << indent << "relativeSizes "
<< indent << "minThickness 1e-3;" << nl << (
<< indent << "firstLayerThickness-disabled 0.01;" << nl << nl relativeSizes
<< indent << "maxThicknessToMedialRatio-disabled 0.3;" << endl; ? "on; // off, usually with firstLayerThickness"
: "off; // on, usually with finalLayerThickness"
) << endl;
// expansionRatio
os_ << indent << "expansionRatio "<< layerExpansionRatio_
<< ";" << endl;
// finalLayerThickness
os_ << indent << "finalLayerThickness"
<< (relativeSizes ? " " : "-disabled ") << "0.5;" << endl;
// minimumThickness
os_ << indent << "minThickness "
<< (relativeSizes ? scalar(0.001) : 0.5*firstLayerThickness_)
<< ";" << endl;
// firstLayerThickness
os_ << indent << "firstLayerThickness"
<< (relativeSizes ? "-disabled " : " ")
<< firstLayerThickness_ << ";" << endl;
// maxThicknessToMedialRatio
os_ << indent << "maxThicknessToMedialRatio-disabled 0.3;" << endl;
endDict(os_); endDict(os_);
} }
@ -499,6 +522,8 @@ Foam::snappyHexMeshConfiguration::snappyHexMeshConfiguration
const List<Tuple3<word, scalar, label>>& refinementDists, const List<Tuple3<word, scalar, label>>& refinementDists,
const bool explicitFeatures, const bool explicitFeatures,
const label layers, const label layers,
const scalar firstLayerThickness,
const scalar layerExpansionRatio,
const point& insidePoint, const point& insidePoint,
const label nCellsBetweenLevels const label nCellsBetweenLevels
) )
@ -512,6 +537,8 @@ Foam::snappyHexMeshConfiguration::snappyHexMeshConfiguration
refinementDists_(refinementDists), refinementDists_(refinementDists),
explicitFeatures_(explicitFeatures), explicitFeatures_(explicitFeatures),
layers_(layers), layers_(layers),
firstLayerThickness_(firstLayerThickness),
layerExpansionRatio_(layerExpansionRatio),
insidePoint_(insidePoint), insidePoint_(insidePoint),
nCellsBetweenLevels_(nCellsBetweenLevels) nCellsBetweenLevels_(nCellsBetweenLevels)
{} {}

View File

@ -86,6 +86,12 @@ class snappyHexMeshConfiguration
//- Number of layers at wall patches, default 0 //- Number of layers at wall patches, default 0
const label layers_; const label layers_;
//- Thickness of the near wall cells with layer addition
const scalar firstLayerThickness_;
//- Expansion ratio used with layer addition
const scalar layerExpansionRatio_;
//- insidePoint parameter //- insidePoint parameter
point insidePoint_; point insidePoint_;
@ -175,6 +181,8 @@ public:
const List<Tuple3<word, scalar, label>>& refinementDists, const List<Tuple3<word, scalar, label>>& refinementDists,
const bool explicitFeatures, const bool explicitFeatures,
const label layers, const label layers,
const scalar firstLayerThickness,
const scalar layerExpansionRatio,
const point& insidePoint, const point& insidePoint,
const label nCellsBetweenLevels const label nCellsBetweenLevels
); );