mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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
|
const Foam::labelUList& Foam::polyPatch::faceCells() const
|
||||||
{
|
{
|
||||||
if (!faceCellsPtr_)
|
if (!faceCellsPtr_)
|
||||||
|
|||||||
@ -372,6 +372,10 @@ public:
|
|||||||
//- Return face cell centres
|
//- Return face cell centres
|
||||||
tmp<vectorField> faceCellCentres() const;
|
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
|
// Addressing into mesh
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user