189 if (
delta < ROOTVSMALL)
211 faceWeight[facei] =
max(cellWeight[own], cellWeight[nei]);
229 faceWeight[facei] =
max(cellWeight[own], nbrCellWeight[bFacei]);
246 Pout<<
"highAspectRatioFvGeometryScheme::makeAverageCentres() : "
247 <<
"calculating weighted average face/cell centre" <<
endl;
262 faceCentres[facei] = (1.0/3.0)*(
p[
f[0]] +
p[
f[1]] +
p[
f[2]]);
266 solveScalar sumA = 0.0;
269 for (label pi = 0; pi <
nPoints; pi++)
271 const label nextPi(pi ==
nPoints-1 ? 0 : pi+1);
275 const solveVector eMid = 0.5*(thisPoint+nextPoint);
276 const solveScalar a =
mag(nextPoint-thisPoint);
283 if (sumA >= ROOTVSMALL)
285 faceCentres[facei] = sumAc/sumA;
291 for (label pi = 0; pi <
nPoints; pi++)
295 faceCentres[facei] = sumAc/
nPoints;
310 const solveScalar magfA(magFaceAreas[facei]);
311 const vector weightedFc(magfA*faceCentres[facei]);
314 cellCentres[own[facei]] += weightedFc;
315 cellCentres[nei[facei]] += weightedFc;
318 cellWeights[own[facei]] += magfA;
319 cellWeights[nei[facei]] += magfA;
325 if (!isA<emptyPolyPatch>(pp) && !isA<wedgePolyPatch>(pp))
329 label facei = pp.start();
330 facei < pp.start()+pp.size();
334 const solveScalar magfA(magFaceAreas[facei]);
335 const vector weightedFc(magfA*faceCentres[facei]);
337 cellCentres[own[facei]] += weightedFc;
338 cellWeights[own[facei]] += magfA;
343 forAll(cellCentres, celli)
345 if (
mag(cellWeights[celli]) > VSMALL)
347 cellCentres[celli] /= cellWeights[celli];
363 minAspect_(
dict.get<scalar>(
"minAspect")),
364 maxAspect_(
dict.get<scalar>(
"maxAspect"))
370 <<
" has to be less than maxAspect " <<
maxAspect_
376 <<
"Illegal aspect ratio : minAspect:" <<
minAspect_
395 Pout<<
"highAspectRatioFvGeometryScheme::movePoints() : "
396 <<
"recalculating primitiveMesh centres" <<
endl;
401 !mesh_.hasCellCentres()
402 && !mesh_.hasFaceCentres()
403 && !mesh_.hasCellVolumes()
404 && !mesh_.hasFaceAreas()
417 mag(mesh_.faceAreas()),
427 calcAspectRatioWeights(cellWeight, faceWeight);
433 (1.0-faceWeight)*mesh_.faceCentres()
434 + faceWeight*avgFaceCentres
438 (1.0-cellWeight)*mesh_.cellCentres()
439 + cellWeight*avgCellCentres
445 Pout<<
"highAspectRatioFvGeometryScheme::movePoints() :"
446 <<
" highAspectRatio weight"
447 <<
" max:" <<
gMax(cellWeight) <<
" min:" <<
gMin(cellWeight)
458 std::move(faceCentres),
459 std::move(faceAreas),
460 std::move(cellCentres),
461 std::move(cellVolumes)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
void setSize(const label n)
Alias for resize()
void size(const label n)
Older name for setAddressableSize.
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Default geometry calculation scheme. Slight stabilisation for bad meshes.
(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.
Mesh data needed to do the Finite Volume discretisation.
Geometry calculation scheme with automatic stabilisation for high-aspect ratio cells.
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 additional search methods and registered IO.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
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.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Type gAverage(const FieldField< Field, Type > &f)
static constexpr const zero Zero
Global zero (0)
Type gMin(const FieldField< Field, Type > &f)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type gMax(const FieldField< Field, Type > &f)
#define forAll(list, i)
Loop across all elements in list.