mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
added output for areas of cyclic halves
This commit is contained in:
@ -31,6 +31,7 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
|
#include "cyclicPolyPatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// Main program:
|
// Main program:
|
||||||
@ -75,26 +76,54 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Give patch area
|
// Give patch area
|
||||||
Info<< " Patch area = " << gSum(mesh.Sf().boundaryField()[patchi]) << endl;
|
if (isType<cyclicPolyPatch>(mesh.boundaryMesh()[patchi]))
|
||||||
|
|
||||||
if (fieldHeader.headerClassName() == "volScalarField")
|
|
||||||
{
|
{
|
||||||
Info<< " Reading volScalarField " << fieldName << endl;
|
Info<< " Cyclic patch area: " << nl;
|
||||||
volScalarField field(fieldHeader, mesh);
|
label nFaces = mesh.boundaryMesh()[patchi].size();
|
||||||
|
vector sum1 = vector::zero;
|
||||||
|
vector sum2 = vector::zero;
|
||||||
|
for (label i=0; i<nFaces/2; i++)
|
||||||
|
{
|
||||||
|
sum1 += mesh.Sf().boundaryField()[patchi][i];
|
||||||
|
sum2 += mesh.Sf().boundaryField()[patchi][i+nFaces/2];
|
||||||
|
}
|
||||||
|
reduce(sum1, sumOp<vector>());
|
||||||
|
reduce(sum2, sumOp<vector>());
|
||||||
|
Info<< " - half 1 = " << sum1 << ", " << mag(sum1) << nl
|
||||||
|
<< " - half 2 = " << sum2 << ", " << mag(sum2) << nl
|
||||||
|
<< " - total = " << (sum1 + sum2) << ", "
|
||||||
|
<< mag(sum1 + sum2) << endl;;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< " Patch area = "
|
||||||
|
<< gSum(mesh.Sf().boundaryField()[patchi]) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read field and calc integral
|
||||||
|
if (fieldHeader.headerClassName() == volScalarField::typeName)
|
||||||
|
{
|
||||||
|
Info<< " Reading " << volScalarField::typeName << " "
|
||||||
|
<< fieldName << endl;
|
||||||
|
|
||||||
|
volScalarField field(fieldHeader, mesh);
|
||||||
vector sumField = gSum
|
vector sumField = gSum
|
||||||
(
|
(
|
||||||
mesh.Sf().boundaryField()[patchi]
|
mesh.Sf().boundaryField()[patchi]
|
||||||
* field.boundaryField()[patchi]
|
*field.boundaryField()[patchi]
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Integral of " << fieldName << " over patch "
|
Info<< " Integral of " << fieldName << " over patch "
|
||||||
<< patchName << '[' << patchi << ']' << " = "
|
<< patchName << '[' << patchi << ']' << " = "
|
||||||
<< sumField << nl;
|
<< sumField << nl;
|
||||||
}
|
}
|
||||||
else if (fieldHeader.headerClassName() == "surfaceScalarField")
|
else if
|
||||||
|
(
|
||||||
|
fieldHeader.headerClassName() == surfaceScalarField::typeName
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Info<< " Reading surfaceScalarField " << fieldName << endl;
|
Info<< " Reading " << surfaceScalarField::typeName << " "
|
||||||
|
<< fieldName << endl;
|
||||||
|
|
||||||
surfaceScalarField field(fieldHeader, mesh);
|
surfaceScalarField field(fieldHeader, mesh);
|
||||||
scalar sumField = gSum(field.boundaryField()[patchi]);
|
scalar sumField = gSum(field.boundaryField()[patchi]);
|
||||||
@ -106,8 +135,10 @@ int main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalError
|
FatalError
|
||||||
<< "Only possible to integrate volScalarFields "
|
<< "Only possible to integrate "
|
||||||
<< "and surfaceScalarFields" << nl << exit(FatalError);
|
<< volScalarField::typeName << "s "
|
||||||
|
<< "and " << surfaceScalarField::typeName << "s"
|
||||||
|
<< nl << exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user