diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C index d48d7e30ca..324203cf26 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C @@ -330,6 +330,25 @@ Foam::tmp Foam::polyPatch::faceCellCentres() const } +Foam::tmp Foam::polyPatch::areaFraction() const +{ + tmp 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_) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index a43c9e9844..0a185878d4 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -372,6 +372,10 @@ public: //- Return face cell centres tmp faceCellCentres() const; + //- Return the area fraction as the ratio of the stored face area + //- and the area given by the face points + tmp areaFraction() const; + // Addressing into mesh