Commit 0f4c6572 authored by Andrew Heather's avatar Andrew Heather
Browse files

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.
parent b23375ab
......@@ -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_)
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment