CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Pre-Processing (
-   -   area of a patch (

mediode March 7, 2011 17:01

area of a patch

I would appreciate if anybody could give me a hint how to determine the area of an existing patch? (I would like to investigate the geometrical error produced by using snappyhexmesh.)


gwierink March 8, 2011 07:00

Hi mediode,

If you know the name of the patch (or the patchID straight away), then you can do the following. Here, the name of the patch is "movingWall", from the icoFoam cavity case.


// Find the patchID of the patch by name
label patchID = mesh.boundaryMesh().findPatchID("movingWall");

// Create a polyPatch for looping
const polyPatch& myPatch = mesh.boundaryMesh()[patchID];

// Initialize patchArea
scalar patchArea = 0.0;

// Loop trhough all faces on the polyPatch, adding their magnitude surface
// area vectors
forAll(myPatch, faceI)
    patchArea += mesh.magSf().boundaryField()[patchID][faceI];

mediode April 6, 2011 10:16

Thanks a lot for the answer. Sorry for the delay.
Best regards

All times are GMT -4. The time now is 09:02.