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)
98 Foam::layerParameters::layerParameters
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),
123 maxFaceThicknessRatio_
127 nBufferCellsNoExtrude_
133 additionalReporting_(dict.
lookupOrDefault(
"additionalReporting",
false)),
139 medialAxisMeshMover::typeName
147 bool haveFirst = dict.
found(
"firstLayerThickness");
157 bool haveFinal = dict.
found(
"finalLayerThickness");
167 bool haveTotal = dict.
found(
"thickness");
177 bool haveExp = dict.
found(
"expansionRatio");
189 if (haveFirst && haveTotal)
192 Info<<
"Layer thickness specified as first layer and overall thickness." 195 else if (haveFirst && haveExp)
198 Info<<
"Layer thickness specified as first layer and expansion ratio." 201 else if (haveFinal && haveTotal)
204 Info<<
"Layer thickness specified as final layer and overall thickness." 207 else if (haveFinal && haveExp)
210 Info<<
"Layer thickness specified as final layer and expansion ratio." 213 else if (haveTotal && haveExp)
216 Info<<
"Layer thickness specified as overall thickness" 217 <<
" and expansion ratio." <<
endl;
221 if (layerSpec_ ==
ILLEGAL || nSpec != 2)
226 ) <<
"Over- or underspecified layer thickness." 227 <<
" Please specify" <<
nl 228 <<
" first layer thickness ('firstLayerThickness')" 229 <<
" and overall thickness ('thickness') or" <<
nl 230 <<
" first layer thickness ('firstLayerThickness')" 231 <<
" and expansion ratio ('expansionRatio') or" <<
nl 232 <<
" final layer thickness ('finalLayerThickness')" 233 <<
" and expansion ratio ('expansionRatio') or" <<
nl 234 <<
" final layer thickness ('finalLayerThickness')" 235 <<
" and overall thickness ('thickness') or" <<
nl 236 <<
" overall thickness ('thickness')" 237 <<
" and expansion ratio ('expansionRatio'" 244 if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
247 <<
"Layer iterations should be >= 0." <<
endl 248 <<
"nLayerIter:" << nLayerIter_
249 <<
" nRelaxedIter:" << nRelaxedIter_
260 const keyType& key = iter().keyword();
266 if (patchIDs.size() == 0)
269 <<
"Layer specification for " << key
270 <<
" does not match any patch." <<
endl 271 <<
"Valid patches are " << boundaryMesh.
names() <<
endl;
289 "firstLayerThickness",
290 firstLayerThickness_[patchi]
302 "firstLayerThickness",
303 firstLayerThickness_[patchi]
308 expansionRatio_[patchi]
315 "finalLayerThickness",
316 finalLayerThickness_[patchi]
328 "finalLayerThickness",
329 finalLayerThickness_[patchi]
334 expansionRatio_[patchi]
347 expansionRatio_[patchi]
362 minThickness_[patchi]
376 const scalar firstLayerThickess,
377 const scalar finalLayerThickess,
378 const scalar totalThickness,
379 const scalar expansionRatio
388 return totalThickness;
394 if (
mag(expansionRatio-1) < small)
396 return firstLayerThickess * nLayers;
400 return firstLayerThickess
401 *(1 -
pow(expansionRatio, nLayers))
402 /(1 - expansionRatio);
409 if (
mag(expansionRatio-1) < small)
411 return finalLayerThickess * nLayers;
417 return finalLayerThickess
418 *(1 -
pow(invExpansion, nLayers))
434 Foam::scalar Foam::layerParameters::layerExpansionRatio
437 const scalar firstLayerThickess,
438 const scalar finalLayerThickess,
439 const scalar totalThickness,
440 const scalar expansionRatio
455 return layerExpansionRatio
458 totalThickness/firstLayerThickess
470 totalThickness/finalLayerThickess
488 const scalar firstLayerThickess,
489 const scalar finalLayerThickess,
490 const scalar totalThickness,
491 const scalar expansionRatio
499 return firstLayerThickess;
504 return finalLayerThickess*
pow(1.0/expansionRatio, nLayers-1);
510 const scalar r = layerExpansionRatio
519 return finalLayerThickess/
pow(r, nLayers-1);
531 const scalar finalThickness = r*totalThickness;
533 return finalThickness/
pow(expansionRatio, nLayers-1);
550 const scalar expansionRatio
555 if (
mag(expansionRatio-1) < small)
562 pow(expansionRatio, nLayers - 1)
564 /(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
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
label readLabel(Istream &is)
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.