45 highAspectRatioFvGeometryScheme,
190 if (
delta < ROOTVSMALL)
203 faceWeight[facei] =
max(cellWeight[own], cellWeight[nei]);
221 faceWeight[facei] =
max(cellWeight[own], nbrCellWeight[bFacei]);
228 const polyMesh&
mesh,
238 Pout<<
"highAspectRatioFvGeometryScheme::makeAverageCentres() : " 239 <<
"calculating weighted average face/cell centre" <<
endl;
258 solveScalar sumA = 0.0;
267 const solveVector eMid = 0.5*(thisPoint+nextPoint);
268 const solveScalar a =
mag(nextPoint-thisPoint);
275 if (sumA >= ROOTVSMALL)
277 faceCentres[facei] = sumAc/sumA;
287 faceCentres[facei] = sumAc/
nPoints;
302 const solveScalar magfA(magFaceAreas[facei]);
303 const vector weightedFc(magfA*faceCentres[facei]);
306 cellCentres[own[facei]] += weightedFc;
307 cellCentres[nei[facei]] += weightedFc;
310 cellWeights[own[facei]] += magfA;
311 cellWeights[nei[facei]] += magfA;
315 for (
const polyPatch&
pp :
pbm)
317 if (!isA<emptyPolyPatch>(
pp) && !isA<wedgePolyPatch>(
pp))
321 label facei =
pp.start();
322 facei <
pp.start()+
pp.size();
326 const solveScalar magfA(magFaceAreas[facei]);
327 const vector weightedFc(magfA*faceCentres[facei]);
329 cellCentres[own[facei]] += weightedFc;
330 cellWeights[own[facei]] += magfA;
335 forAll(cellCentres, celli)
337 if (
mag(cellWeights[celli]) > VSMALL)
339 cellCentres[celli] /= cellWeights[celli];
348 Foam::highAspectRatioFvGeometryScheme::highAspectRatioFvGeometryScheme
351 const dictionary&
dict 355 minAspect_(
dict.
get<scalar>(
"minAspect")),
356 maxAspect_(
dict.
get<scalar>(
"maxAspect"))
362 <<
" has to be less than maxAspect " <<
maxAspect_ 368 <<
"Illegal aspect ratio : minAspect:" <<
minAspect_ 387 Pout<<
"highAspectRatioFvGeometryScheme::movePoints() : " 388 <<
"recalculating primitiveMesh centres" <<
endl;
393 !mesh_.hasCellCentres()
394 && !mesh_.hasFaceCentres()
395 && !mesh_.hasCellVolumes()
396 && !mesh_.hasFaceAreas()
409 mag(mesh_.faceAreas()),
419 calcAspectRatioWeights(cellWeight, faceWeight);
425 (1.0-faceWeight)*mesh_.faceCentres()
426 + faceWeight*avgFaceCentres
430 (1.0-cellWeight)*mesh_.cellCentres()
431 + cellWeight*avgCellCentres
437 Pout<<
"highAspectRatioFvGeometryScheme::movePoints() :" 438 <<
" highAspectRatio weight" 439 <<
" max:" <<
gMax(cellWeight) <<
" min:" <<
gMin(cellWeight)
450 std::move(faceCentres),
451 std::move(faceAreas),
452 std::move(cellCentres),
453 std::move(cellVolumes)
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
const fvMesh & mesh_
Hold reference to mesh.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Type gMin(const FieldField< Field, Type > &f)
virtual const labelList & faceNeighbour() const
Return face neighbour.
(Rough approximation of) cell aspect ratio
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void makeAverageCentres(const polyMesh &mesh, const pointField &points, const pointField &faceAreas, const scalarField &magFaceAreas, pointField &faceCentres, pointField &cellCentres)
Helper : calculate (weighted) average face and cell centres.
label nFaces() const noexcept
Number of mesh faces.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
Vector< solveScalar > solveVector
List< face > faceList
List of faces.
void resetGeometry(pointField &&faceCentres, pointField &&faceAreas, pointField &&cellCentres, scalarField &&cellVolumes)
Reset the local geometry.
vectorField pointField
pointField is a vectorField.
virtual void movePoints()
Do what is necessary if the mesh has moved.
void setSize(const label n)
Alias for resize()
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual const labelList & faceOwner() const
Return face owner.
Point centre() const
Return centre (centroid)
virtual void updateGeom()
Update all geometric data.
constexpr scalar pi(M_PI)
label nInternalFaces() const noexcept
Number of internal faces.
virtual const faceList & faces() const
Return raw faces.
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
defineTypeNameAndDebug(combustionModel, 0)
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
void calcAspectRatioWeights(scalarField &cellWeight, scalarField &faceWeight) const
Calculate cell and face weight. Is 0 for cell < minAspect, 1 for.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
label nCells() const noexcept
Number of mesh cells.
Type gAverage(const FieldField< Field, Type > &f)
virtual void movePoints()
Update basic geometric properties from provided points.
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< label > labelList
A List of labels.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)