190 if (
delta < ROOTVSMALL)
199 for (label facei = 0; facei <
mesh_.nInternalFaces(); facei++)
201 const label own =
mesh_.faceOwner()[facei];
202 const label nei =
mesh_.faceNeighbour()[facei];
203 faceWeight[facei] =
max(cellWeight[own], cellWeight[nei]);
214 label facei =
mesh_.nInternalFaces();
215 facei <
mesh_.nFaces();
219 const label own =
mesh_.faceOwner()[facei];
220 const label bFacei = facei-
mesh_.nInternalFaces();
221 faceWeight[facei] =
max(cellWeight[own], nbrCellWeight[bFacei]);
228 const polyMesh&
mesh,
238 Pout<<
"highAspectRatioFvGeometryScheme::makeAverageCentres() : "
239 <<
"calculating weighted average face/cell centre" <<
endl;
249 const auto&
f = fs[facei];
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;
321 label facei =
pp.start();
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];
348Foam::highAspectRatioFvGeometryScheme::highAspectRatioFvGeometryScheme
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
440 Pout<<
"highAspectRatioFvGeometryScheme::movePoints() :"
441 <<
" highAspectRatio weight"
443 <<
" average:" << avg <<
endl;
453 std::move(faceCentres),
454 std::move(faceAreas),
455 std::move(cellCentres),
456 std::move(cellVolumes)
465 const refPtr<pointField>& oldPoints,
496 faceCentres = std::move(avgFaceCentres);
497 cellCentres = std::move(avgCellCentres);
constexpr scalar pi(M_PI)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
label size() const noexcept
The number of elements in the list.
void setSize(label n)
Alias for resize().
void size(const label n)
Older name for setAddressableSize.
Default geometry calculation scheme. Slight stabilisation for bad meshes.
virtual bool updateGeom(const pointField &points, const refPtr< pointField > &oldPoints, pointField &faceCentres, vectorField &faceAreas, pointField &cellCentres, scalarField &cellVolumes) const
Calculate geometry quantities using mesh topology and provided points. If oldPoints provided only doe...
(Rough approximation of) cell aspect ratio
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base class for geometry calculation schemes.
const fvMesh & mesh_
Hold reference to mesh.
virtual void movePoints()
Update basic geometric properties from provided points.
const fvMesh & mesh() const
Return mesh reference.
Mesh data needed to do the Finite Volume discretisation.
Geometry calculation scheme with automatic stabilisation for high-aspect ratio cells.
virtual bool updateGeom(const pointField &points, const refPtr< pointField > &oldPoints, pointField &faceCentres, vectorField &faceAreas, pointField &cellCentres, scalarField &cellVolumes) const
Calculate geometry quantities using mesh topology and provided points. If oldPoints provided only doe...
virtual void movePoints()
Do what is necessary if the mesh has moved.
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.
void calcAspectRatioWeights(scalarField &cellWeight, scalarField &faceWeight) const
Calculate cell and face weight. Is 0 for cell < minAspect, 1 for.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
virtual const labelList & faceNeighbour() const
Return face neighbour.
A patch is a list of labels that address the faces in the global face list.
label nInternalFaces() const noexcept
Number of internal faces.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
virtual void updateGeom()
Update all geometric data.
void resetGeometry(pointField &&faceCentres, pointField &&faceAreas, pointField &&cellCentres, scalarField &&cellVolumes)
Reset the local geometry.
A class for managing references or pointers (no reference counting).
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
Namespace for handling debugging switches.
Type gAverage(const FieldField< Field, Type > &f, const label comm)
The global arithmetic average of a FieldField.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
List< face > faceList
List of faces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
static constexpr const zero Zero
Global zero (0).
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Vector< solveScalar > solveVector
#define forAll(list, i)
Loop across all elements in list.