Go to the documentation of this file.
44 highAspectRatioFvGeometryScheme,
188 scalar
delta(maxAspect_-minAspect_);
189 if (
delta < ROOTVSMALL)
201 (aratio-minAspect_)/
delta
205 faceWeight.setSize(mesh_.nFaces());
207 for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
209 const label own = mesh_.faceOwner()[facei];
210 const label nei = mesh_.faceNeighbour()[facei];
211 faceWeight[facei] =
max(cellWeight[own], cellWeight[nei]);
214 syncTools::swapBoundaryCellList
222 label facei = mesh_.nInternalFaces();
223 facei < mesh_.nFaces();
227 const label own = mesh_.faceOwner()[facei];
228 const label bFacei = facei-mesh_.nInternalFaces();
229 faceWeight[facei] =
max(cellWeight[own], nbrCellWeight[bFacei]);
246 Pout<<
"highAspectRatioFvGeometryScheme::makeAverageCentres() : "
247 <<
"calculating weighted average face/cell centre" <<
endl;
255 faceCentres.setSize(
mesh.nFaces());
264 faceCentres[facei] = (1.0/3.0)*(
p[
f[0]] +
p[
f[1]] +
p[
f[2]]);
268 solveScalar sumA = 0.0;
269 solveVector sumAc =
Zero;
274 const solveVector nextPoint(
p[
f[nextPi]]);
275 const solveVector thisPoint(
p[
f[
pi]]);
277 const solveVector eMid = 0.5*(thisPoint+nextPoint);
278 const solveScalar a =
mag(nextPoint-thisPoint);
285 if (sumA >= ROOTVSMALL)
287 faceCentres[facei] = sumAc/sumA;
295 sumAc +=
static_cast<solveVector
>(
p[
f[
pi]]);
297 faceCentres[facei] = sumAc/
nPoints;
303 cellCentres.setSize(
mesh.nCells());
310 for (label facei = 0; facei <
mesh.nInternalFaces(); facei++)
312 const solveScalar magfA(magFaceAreas[facei]);
313 const vector weightedFc(magfA*faceCentres[facei]);
316 cellCentres[own[facei]] += weightedFc;
317 cellCentres[nei[facei]] += weightedFc;
320 cellWeights[own[facei]] += magfA;
321 cellWeights[nei[facei]] += magfA;
327 if (!isA<emptyPolyPatch>(pp) && !isA<wedgePolyPatch>(pp))
331 label facei = pp.start();
332 facei < pp.start()+pp.size();
336 const solveScalar magfA(magFaceAreas[facei]);
337 const vector weightedFc(magfA*faceCentres[facei]);
339 cellCentres[own[facei]] += weightedFc;
340 cellWeights[own[facei]] += magfA;
345 forAll(cellCentres, celli)
347 if (
mag(cellWeights[celli]) > VSMALL)
349 cellCentres[celli] /= cellWeights[celli];
358 Foam::highAspectRatioFvGeometryScheme::highAspectRatioFvGeometryScheme
365 minAspect_(
dict.get<scalar>(
"minAspect")),
366 maxAspect_(
dict.get<scalar>(
"maxAspect"))
368 if (maxAspect_ < minAspect_)
371 <<
"minAspect " << minAspect_
372 <<
" has to be less than maxAspect " << maxAspect_
375 if (minAspect_ < 0 || maxAspect_ < 0)
378 <<
"Illegal aspect ratio : minAspect:" << minAspect_
379 <<
" maxAspect:" << maxAspect_
394 Pout<<
"highAspectRatioFvGeometryScheme::movePoints() : "
395 <<
"recalculating primitiveMesh centres" <<
endl;
433 + faceWeight*avgFaceCentres
438 + cellWeight*avgCellCentres
444 Pout<<
"highAspectRatioFvGeometryScheme::movePoints() :"
445 <<
" highAspectRatio weight"
446 <<
" max:" <<
gMax(cellWeight) <<
" min:" <<
gMin(cellWeight)
457 std::move(faceCentres),
458 std::move(faceAreas),
459 std::move(cellCentres),
460 std::move(cellVolumes)
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
virtual const pointField & points() const
Return raw points.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
static constexpr const zero Zero
Global zero (0)
Type gAverage(const FieldField< Field, Type > &f)
Default geometry calculation scheme. Slight stabilisation for bad meshes.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
virtual void movePoints()
Do what is necessary if the mesh has moved.
bool hasCellVolumes() const noexcept
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
A patch is a list of labels that address the faces in the global face list.
void calcAspectRatioWeights(scalarField &cellWeight, scalarField &faceWeight) const
Calculate cell and face weight. Is 0 for cell < minAspect, 1 for.
bool hasCellCentres() const noexcept
bool hasFaceAreas() const noexcept
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
Mesh data needed to do the Finite Volume discretisation.
const scalarField & cellVolumes() const
(Rough approximation of) cell aspect ratio
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
const vectorField & cellCentres() const
constexpr scalar pi(M_PI)
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
void resetGeometry(pointField &&faceCentres, pointField &&faceAreas, pointField &&cellCentres, scalarField &&cellVolumes)
Reset the local geometry.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const vectorField & faceCentres() const
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
bool hasFaceCentres() const noexcept
Type gMin(const FieldField< Field, Type > &f)
virtual void updateGeom()
Update all geometric data.
defineTypeNameAndDebug(combustionModel, 0)
const fvMesh & mesh_
Hold reference to mesh.
Type gMax(const FieldField< Field, Type > &f)
const vectorField & faceAreas() const