35 const Foam::scalar Foam::layerParameters::defaultConcaveAngle = 90;
40 Foam::scalar Foam::layerParameters::layerExpansionRatio
43 const scalar totalOverFirst
51 const scalar tol = 1
e-8;
53 if (
mag(n - totalOverFirst) < tol)
58 const label maxIters = 100;
64 if (totalOverFirst < n)
67 maxR =
pow(totalOverFirst/n, 1/(n-1));
71 minR =
pow(totalOverFirst/n, 1/(n-1));
72 maxR = totalOverFirst/(n - 1);
76 scalar r = 0.5*(minR + maxR);
78 for (
label i = 0; i < maxIters; ++i)
80 const scalar prevr = r;
81 const scalar fx =
pow(r, n) - totalOverFirst*r - (1 - totalOverFirst);
82 const scalar dfx = n*
pow(r, n - 1) - totalOverFirst;
86 if (
mag(r - prevr) < tol)
105 numLayers_(boundaryMesh.
size(), -1),
106 relativeSizes_(dict.
lookup(
"relativeSizes")),
108 firstLayerThickness_(boundaryMesh.
size(), -123),
109 finalLayerThickness_(boundaryMesh.
size(), -123),
110 thickness_(boundaryMesh.
size(), -123),
111 expansionRatio_(boundaryMesh.
size(), -123),
115 dict.
lookup<scalar>(
"minThickness")
120 dict.
found(
"mergeFaces")
122 dict.
lookup<
bool>(
"mergeFaces")
128 featureAngle_(dict.
lookup<scalar>(
"featureAngle")),
134 maxFaceThicknessRatio_
136 dict.
lookup<scalar>(
"maxFaceThicknessRatio")
138 nBufferCellsNoExtrude_
144 additionalReporting_(dict.
lookupOrDefault(
"additionalReporting",
false)),
150 medialAxisMeshMover::typeName
158 bool haveFirst = dict.
found(
"firstLayerThickness");
164 dict.
lookup<scalar>(
"firstLayerThickness")
168 bool haveFinal = dict.
found(
"finalLayerThickness");
174 dict.
lookup<scalar>(
"finalLayerThickness")
178 bool haveTotal = dict.
found(
"thickness");
184 dict.
lookup<scalar>(
"thickness")
188 bool haveExp = dict.
found(
"expansionRatio");
194 dict.
lookup<scalar>(
"expansionRatio")
200 if (haveFirst && haveTotal)
203 Info<<
"Layer thickness specified as first layer and overall thickness." 206 else if (haveFirst && haveExp)
209 Info<<
"Layer thickness specified as first layer and expansion ratio." 212 else if (haveFinal && haveTotal)
215 Info<<
"Layer thickness specified as final layer and overall thickness." 218 else if (haveFinal && haveExp)
221 Info<<
"Layer thickness specified as final layer and expansion ratio." 224 else if (haveTotal && haveExp)
227 Info<<
"Layer thickness specified as overall thickness" 228 <<
" and expansion ratio." <<
endl;
232 if (layerSpec_ ==
ILLEGAL || nSpec != 2)
237 ) <<
"Over- or underspecified layer thickness." 238 <<
" Please specify" <<
nl 239 <<
" first layer thickness ('firstLayerThickness')" 240 <<
" and overall thickness ('thickness') or" <<
nl 241 <<
" first layer thickness ('firstLayerThickness')" 242 <<
" and expansion ratio ('expansionRatio') or" <<
nl 243 <<
" final layer thickness ('finalLayerThickness')" 244 <<
" and expansion ratio ('expansionRatio') or" <<
nl 245 <<
" final layer thickness ('finalLayerThickness')" 246 <<
" and overall thickness ('thickness') or" <<
nl 247 <<
" overall thickness ('thickness')" 248 <<
" and expansion ratio ('expansionRatio'" 255 if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
258 <<
"Layer iterations should be >= 0." <<
endl 259 <<
"nLayerIter:" << nLayerIter_
260 <<
" nRelaxedIter:" << nRelaxedIter_
271 const keyType& key = iter().keyword();
277 if (patchIDs.size() == 0)
280 <<
"Layer specification for " << key
281 <<
" does not match any patch." <<
endl 282 <<
"Valid patches are " << boundaryMesh.
names() <<
endl;
300 "firstLayerThickness",
301 firstLayerThickness_[patchi]
313 "firstLayerThickness",
314 firstLayerThickness_[patchi]
319 expansionRatio_[patchi]
326 "finalLayerThickness",
327 finalLayerThickness_[patchi]
339 "finalLayerThickness",
340 finalLayerThickness_[patchi]
345 expansionRatio_[patchi]
358 expansionRatio_[patchi]
373 minThickness_[patchi]
376 if (layerDict.
found(
"mergeFaces"))
379 layerDict.
lookup<
bool>(
"mergeFaces")
395 const scalar firstLayerThickness,
396 const scalar finalLayerThickness,
397 const scalar totalThickness,
398 const scalar expansionRatio
407 return totalThickness;
413 if (
mag(expansionRatio-1) < small)
415 return firstLayerThickness * nLayers;
419 return firstLayerThickness
420 *(1 -
pow(expansionRatio, nLayers))
421 /(1 - expansionRatio);
428 if (
mag(expansionRatio-1) < small)
430 return finalLayerThickness * nLayers;
436 return finalLayerThickness
437 *(1 -
pow(invExpansion, nLayers))
453 Foam::scalar Foam::layerParameters::layerExpansionRatio
456 const scalar firstLayerThickness,
457 const scalar finalLayerThickness,
458 const scalar totalThickness,
459 const scalar expansionRatio
474 return layerExpansionRatio
477 totalThickness/firstLayerThickness
489 totalThickness/finalLayerThickness
507 const scalar firstLayerThickness,
508 const scalar finalLayerThickness,
509 const scalar totalThickness,
510 const scalar expansionRatio
523 return finalLayerThickness*
pow(1.0/expansionRatio, nLayers-1);
529 const scalar r = layerExpansionRatio
538 return finalLayerThickness/
pow(r, nLayers-1);
550 const scalar finalThickness = r*totalThickness;
552 return finalThickness/
pow(expansionRatio, nLayers-1);
569 const scalar expansionRatio
574 if (
mag(expansionRatio-1) < small)
581 pow(expansionRatio, nLayers - 1)
583 /(1 -
pow(expansionRatio, nLayers));
A class for handling keywords in dictionaries.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Unit conversion functions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelHashSet patchSet(const UList< wordRe > &patchNames, const bool warnNotFound=true, const bool usePatchGroups=true) const
Return the set of patch IDs corresponding to the given names.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
scalar finalLayerThicknessRatio(const label nLayers, const scalar expansionRatio) const
Determine ratio of final layer thickness to.
scalar layerThickness(const label nLayers, const scalar firstLayerThickess, const scalar finalLayerThickess, const scalar totalThickness, const scalar expansionRatio) const
Determine overall thickness. Uses two of the four parameters.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
wordList names() const
Return a list of patch names.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
const scalarField & firstLayerThickness() const
Wanted thickness of the layer nearest to the wall.
static const label labelMax
layerParameters(const dictionary &dict, const polyBoundaryMesh &)
Construct from dictionary.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
A wordRe is a word, but can also have a regular expression for matching words.
const scalarField & expansionRatio() const
label size() const
Return the number of elements in the UPtrList.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
dimensioned< scalar > mag(const dimensioned< Type > &)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
const doubleScalar e
Elementary charge.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.