CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

faceNormals

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By ngj

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 2, 2010, 05:44
Default faceNormals
  #1
Member
 
Join Date: Aug 2010
Posts: 31
Rep Power: 15
Martin80 is on a distinguished road
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.
Martin80 is offline   Reply With Quote

Old   November 2, 2010, 06:09
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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
ngj is offline   Reply With Quote

Old   November 2, 2010, 06:25
Default
  #3
Member
 
Join Date: Aug 2010
Posts: 31
Rep Power: 15
Martin80 is on a distinguished road
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.
Martin80 is offline   Reply With Quote

Old   November 2, 2010, 07:47
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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
fedvasu and belier1988 like this.
ngj is offline   Reply With Quote

Old   November 2, 2010, 08:57
Default
  #5
Member
 
Join Date: Aug 2010
Posts: 31
Rep Power: 15
Martin80 is on a distinguished road
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.
Martin80 is offline   Reply With Quote

Old   November 2, 2010, 11:49
Default
  #6
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Quote:
Originally Posted by Martin80 View Post
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.
ngj is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 17:27


All times are GMT -4. The time now is 00:14.