ENH: polyPatch - added areaFraction method

Helper function to calculate the current face area vs the area returned
from the current point locations.  Useful for ACMI-type baffles where we
scale the face areas without moving points.
This commit is contained in:
Andrew Heather
2018-09-27 12:46:48 +01:00
parent b23375ab3d
commit 0f4c6572bc
2 changed files with 23 additions and 0 deletions

View File

@ -330,6 +330,25 @@ Foam::tmp<Foam::vectorField> Foam::polyPatch::faceCellCentres() const
}
Foam::tmp<Foam::scalarField> Foam::polyPatch::areaFraction() const
{
tmp<scalarField> tfraction(new scalarField(size()));
scalarField& fraction = tfraction.ref();
const vectorField::subField faceAreas = this->faceAreas();
const pointField& points = this->points();
forAll(*this, facei)
{
const face& curFace = this->operator[](facei);
fraction[facei] =
mag(faceAreas[facei])/(curFace.mag(points) + ROOTVSMALL);
}
return tfraction;
}
const Foam::labelUList& Foam::polyPatch::faceCells() const
{
if (!faceCellsPtr_)

View File

@ -372,6 +372,10 @@ public:
//- Return face cell centres
tmp<vectorField> faceCellCentres() const;
//- Return the area fraction as the ratio of the stored face area
//- and the area given by the face points
tmp<scalarField> areaFraction() const;
// Addressing into mesh