CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Technical] Order of points in a boundary patch (https://www.cfd-online.com/Forums/openfoam-meshing/75108-order-points-boundary-patch.html)

camille.yvin April 16, 2010 07:43

Order of points in a boundary patch
 
Hello,

I try to get the order of points (whitout redundancy) in a boundary field to correctly apply a pointVectorField to modify a mesh. I precise that I use an external software to evaluate this field.

I tried with a polyPatch :

label PatchId = mesh.boundaryMesh().findPatchID("name");

const polypatch& namePolyPatch = mesh.boundaryMesh()[PatchID];

But after that I don't know what to do. How extract ID of points or they coordinates in the right order that OpenFOAM use ?

Thanks for helping.

Camille

camille.yvin April 16, 2010 08:35

Hello, it's me again.

I think I am not far away. I use :

label PatchId = mesh.boundaryMesh().findPatchID("name");

const polypatch& namePolyPatch = mesh.boundaryMesh()[PatchID];

labelList test(namePolyPatch.boundaryPoints());

forAll( test , pos)
{
Info << test[pos] << endl;
}

But the number of label given is not enought so I thing it's not a good method.

I keep searching.



Quote:

Originally Posted by camille.yvin (Post 254932)
Hello,

I try to get the order of points (whitout redundancy) in a boundary field to correctly apply a pointVectorField to modify a mesh. I precise that I use an external software to evaluate this field.

I tried with a polyPatch :

label PatchId = mesh.boundaryMesh().findPatchID("name");

const polypatch& namePolyPatch = mesh.boundaryMesh()[PatchID];

But after that I don't know what to do. How extract ID of points or they coordinates in the right order that OpenFOAM use ?

Thanks for helping.

Camille


camille.yvin April 16, 2010 09:02

Hello, It's me again :).

I think I succeed in having what I want (only the position). It's not a pretty solution but it could help. My code :


#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

label PatchID = mesh.boundaryMesh().findPatchID("tuyau");

const polyPatch& patchFound = mesh.boundaryMesh()[PatchID];

labelList labelPatchFound( patchFound.meshPoints() );

pointField meshPoints(mesh.points());

long nombre = 0;

forAll(labelPatchFound , label)
{
vector coord = meshPoints[labelPatchFound[label]];
Info << coord[0] << " " << coord[1] << " " << coord[2] << endl;
nombre++;
}

Info << nombre << endl;





Any comment will be appreciated.


Quote:

Originally Posted by camille.yvin (Post 254937)
Hello, it's me again.

I think I am not far away. I use :

label PatchId = mesh.boundaryMesh().findPatchID("name");

const polypatch& namePolyPatch = mesh.boundaryMesh()[PatchID];

labelList test(namePolyPatch.boundaryPoints());

forAll( test , pos)
{
Info << test[pos] << endl;
}

But the number of label given is not enought so I thing it's not a good method.

I keep searching.


gascortado September 12, 2011 10:18

Hi Camille,

I need to find coordinate points of the mesh also so this here helps a lot.

I am very interested, however, in finding out how do you know for example that by typing .meshPoints() you will get the mesh points. Is there a list of classes somewhere where I can read about the name of the different classes and what they do?

I will appreciate any help. Thanks

Mehran September 30, 2011 05:15

Hi Camille,

Thanks for your hints on finding the coordinates, it was much of help.

styleworker October 30, 2013 09:01

you can use the localPoints function, too.

this code does the same:
Code:

const List<vector>& patchFound = mesh.boundaryMesh()[patchID].localPoints();
Info << "### localPoints" << patchFound << endl;


Fanfei May 24, 2015 08:00

Quote:

Originally Posted by styleworker (Post 459878)
you can use the localPoints function, too.

this code does the same:
Code:

const List<vector>& patchFound = mesh.boundaryMesh()[patchID].localPoints();
Info << "### localPoints" << patchFound << endl;


Hi i have a problem to access the coordinate of points as assign face cell. i used localPoints() funtion. when I use the mesh.boundaryMesh()[patchWallID].localPoints, it works, while i use for loop to access the coordinate of points, errors occured, it hints 'const class Foam::face' has no member named 'localPoints'. if I want to access the coorinate of points of boundaryface[i] what should i do? Thanks.
************code******************
for(int ii=0; ii<mesh.boundaryMesh().size();ii++)
Info<<mesh.boundaryMesh()[patchWallID][ii].localPoints<<endl;
**************************************

kind regards
Fan Fei

wouter August 5, 2015 17:14

hello Fanfei,

I do not know much about this, but I think you need to add parentasis () at the end so: .localPoints()

Hope this helps
Wouter

nitishanand1989 November 11, 2015 10:31

Hello,

I need to log the position and velocity of a time dependent problem. I know this piece of code will be really helpful for me. However, since I am now to OF am not able to figure out where to add.

Any help will be appreciated.!!


All times are GMT -4. The time now is 06:43.