CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   faceNormals (https://www.cfd-online.com/Forums/openfoam-programming-development/81635-facenormals.html)

Martin80 November 2, 2010 05:44

faceNormals
 
Hi,

I need the normal vector of a special Face (with label faceI).
I have tried

mesh.faceNormals()[faceI]

but got the following:
error: ‘class Foam::fvMesh’ has no member named ‘faceNormals’.

Maybe someone can give me a hint how to use faceNormals.

B.r., M.

ngj November 2, 2010 06:09

The functionality is called Sf() and not faceNormals().

So do:

vector N = mesh.Sf()[faceI];

The length of N, i.e. Foam::mag(N) is the area of the face.

Best regards,

Niels

Martin80 November 2, 2010 06:25

Hello Niels,


thank you for your answer, but I have not used .Sf() because I am worried about the fact that the number of faces is not equal to the number of vectors of mesh.Sf().



s1=mesh.nFaces();
s2=mesh.Sf().size();


s2<s1;



My faceI is in [0...s1]


B.r.,M.

ngj November 2, 2010 07:47

Hi Martin

This is because mesh.Sf() returns the internal faces, hence mesh.Sf().size() = mesh.nInternalFaces(). If you are working on all the faces, the additional faces on the boundaries needs to be accessed using mesh.Sf().boundaryField()[patchi].

Best regards,

Niels

Martin80 November 2, 2010 08:57

Thanks a lot, Niels,
do you know how OpenFoam is counting the faces?
To clarify my question: let's assume a field consists of 800 internal faces and 200 boundary faces.
I'm using "mesh.edgeFaces()[edgeI]" and get a list of face numbers between 0 and 999.
Is it true that if the number is less than 800 the corresponding face is an internal face?

If not how is the counting of the "internal faces" connected to the counting of "all faces"?

B.r.,M.

ngj November 2, 2010 11:49

Quote:

Originally Posted by Martin80 (Post 281823)
Thanks a lot, Niels,
do you know how OpenFoam is counting the faces?
To clarify my question: let's assume a field consists of 800 internal faces and 200 boundary faces.
I'm using "mesh.edgeFaces()[edgeI]" and get a list of face numbers between 0 and 999.
Is it true that if the number is less than 800 the corresponding face is an internal face?
B.r.,M.

Yes, you are right.


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