From 5f9a16557c7987a2c21a6bc32e5b149fe75aab6f Mon Sep 17 00:00:00 2001 From: henry Date: Fri, 29 May 2009 09:34:55 +0100 Subject: [PATCH] Added output of the patch area magnitude and the integral over the patch area magnitude. --- .../patch/patchIntegrate/patchIntegrate.C | 80 +++++++++++++++++----- 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C index c4eb708..54acae0 100644 --- a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C +++ b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "cyclicPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: @@ -75,26 +76,71 @@ int main(int argc, char *argv[]) } // Give patch area - Info<< " Patch area = " << gSum(mesh.Sf().boundaryField()[patchi]) << endl; + if (isType(mesh.boundaryMesh()[patchi])) + { + Info<< " Cyclic patch vector area: " << nl; + label nFaces = mesh.boundaryMesh()[patchi].size(); + vector sum1 = vector::zero; + vector sum2 = vector::zero; + for (label i=0; i()); + reduce(sum2, sumOp()); + Info<< " - half 1 = " << sum1 << ", " << mag(sum1) << nl + << " - half 2 = " << sum2 << ", " << mag(sum2) << nl + << " - total = " << (sum1 + sum2) << ", " + << mag(sum1 + sum2) << endl; + Info<< " Cyclic patch area magnitude = " + << gSum(mesh.magSf().boundaryField()[patchi])/2.0 << endl; + } + else + { + Info<< " Area vector of patch " + << patchName << '[' << patchi << ']' << " = " + << gSum(mesh.Sf().boundaryField()[patchi]) << endl; + Info<< " Area magnitude of patch " + << patchName << '[' << patchi << ']' << " = " + << gSum(mesh.magSf().boundaryField()[patchi]) << endl; + } - if (fieldHeader.headerClassName() == "volScalarField") + // Read field and calc integral + if (fieldHeader.headerClassName() == volScalarField::typeName) { - Info<< " Reading volScalarField " << fieldName << endl; - volScalarField field(fieldHeader, mesh); + Info<< " Reading " << volScalarField::typeName << " " + << fieldName << endl; - vector sumField = gSum - ( - mesh.Sf().boundaryField()[patchi] - * field.boundaryField()[patchi] - ); + volScalarField field(fieldHeader, mesh); - Info<< " Integral of " << fieldName << " over patch " + Info<< " Integral of " << fieldName + << " over vector area of patch " << patchName << '[' << patchi << ']' << " = " - << sumField << nl; + << gSum + ( + mesh.Sf().boundaryField()[patchi] + *field.boundaryField()[patchi] + ) + << nl; + + Info<< " Integral of " << fieldName + << " over area magnitude of patch " + << patchName << '[' << patchi << ']' << " = " + << gSum + ( + mesh.magSf().boundaryField()[patchi] + *field.boundaryField()[patchi] + ) + << 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); scalar sumField = gSum(field.boundaryField()[patchi]); @@ -106,8 +152,10 @@ int main(int argc, char *argv[]) else { FatalError - << "Only possible to integrate volScalarFields " - << "and surfaceScalarFields" << nl << exit(FatalError); + << "Only possible to integrate " + << volScalarField::typeName << "s " + << "and " << surfaceScalarField::typeName << "s" + << nl << exit(FatalError); } } else -- 2.11.4.GIT