CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Extract patch coordinates (

batta31 November 27, 2012 10:42

Extract patch coordinates
Hi guys I've got a simple question about the mesh:

I would like to extract the point coordinates of a patch and save them on a file. Is it possible?

Any help is really appreciated

Thanks in advance

batta31 November 28, 2012 06:38

Hi it's me again!

I found how to solve my problem by myself. Besides I write my solution, just in case someone wants to have a look; hope it can help :)

pointField meshPoints(mesh.points());

word patchName = "foil";
label patchID = mesh.boundary().findPatchID(patchName);
const polyPatch& patchFound = mesh.boundaryMesh()[patchID];
labelList labelPatchFound( patchFound.meshPoints() );
std::ofstream naca_x;
std::ofstream naca_y;"naca_x.txt");"naca_y.txt");

forAll(labelPatchFound , label)
vector coord = meshPoints[labelPatchFound[label]];
naca_x << coordTop[0];
naca_x << "\n";
naca_y << coordTop[1];
naca_y << "\n";


All times are GMT -4. The time now is 22:40.