CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Patch mesh export (

ariorus March 6, 2006 12:40

Hi everybody, I hope that s
Hi everybody,

I hope that somebody could help to cope with
this problem...

I need to export a patch mesh from a OpenFoam
case. I'd like to have the mesh points of the patch, the surface area of the patch faces and
the connectivity.

I'm writing some code which performs the task and it would be nice to expolit
the tools in the OpenFoam library.

So far I tried to use fvMesh. I can get
the faces centre of the mesh patch
and the faces area vectors but I am not able
to get the patch points positions;

Then I tried to use polyMesh and pointMesh classes, in this way I can get the points
of the patch mesh but not the connectivity
of them i.e. the patch faces;

Finally I tried using faMesh class but I'm not able to select only the patch mesh I'm interested in.

BTW I saw also a class called boundaryMesh
which maybe fits my needs but I don't know
how to construct an object...

Thank you for any hint.

hartinger March 6, 2006 13:47

Hi, if you read in a mesh w

if you read in a mesh with

# include "createMesh.H"

it will give you a fvMesh, which is derived from
polyMesh and surfaceInterpolation. You can access all public member functions from which fvMesh is derived. Have a look at the Programmers C++ doxygen.
So, fvMesh contains all mesh information


hjasak March 6, 2006 13:52

Get the patch from polyMesh:
Get the patch from polyMesh:

const polyPatch& p mesh.boundaryMesh()[patchI];

You can now get the local points, faces etc directly - have a look at the PrimitivePatch.H


So, for local points use:

//- Return pointField of points in patch
const pointField& localPoints() const;

For faces in terms of local points use:

//- Return patch faces addressing into local point list
const List<face>& localFaces() const;

and you've got all the associated connectivity and addressing there as well.



ariorus March 7, 2006 06:41

Thank you Hrvoje. Your sugg
Thank you Hrvoje.

Your suggestion was very precious to me. I would never have found out that way by myself.

In the Doxygen documentation I didn't find any link between polyMesh and polyPatch and it seemed to me the function boundaryMesh in polyMesh could only construct object of polyBoundaryMesh class.

The only drawback is that deeper I look, and deeper I have to look... :-)

Thanks again.

All times are GMT -4. The time now is 18:58.