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

The face normal vectors extracted by nf() and Sf()/magSf() are not unit vectors

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 9, 2019, 22:30
Default The face normal vectors extracted by nf() and Sf()/magSf() are not unit vectors
  #1
Member
 
Wenming Yang
Join Date: Jun 2018
Posts: 42
Rep Power: 8
ywem is on a distinguished road
Dear Foamers,

I am trying to extract face normal vectors of each cell face on a boundary patch. I used function nf() and the calculation Sf()/magSf(). The codes are listed as follows,


forAll(meshedRegions.boundaryMesh(), patchI)
{
if (meshedRegions.boundary()[patchI].name().match("sym"))
{
for(label patchFaceI(meshedRegions.boundary()[patchI].start()); patchFaceI <= meshedRegions.boundary()[patchI].start()+meshedRegions.boundary()[patchI].Cf().size()-1; patchFaceI++)
{
vector faceINormal1 = meshedRegions.boundary()[patchI].Sf()[patchFaceI]/meshedRegions.boundary()[patchI].magSf()[patchFaceI];
vector faceINormal2 = meshedRegions[i].boundary()[patchI].nf()()[patchFaceI];
}
}
}


I found some problems:

1. The vectors obtained by these two methods are both not unit vectors.

2. The vectors obtained by these two methods are not same, but with large difference.

3. The boundary patch "sym" was a plane perpendicular to the z-axis, but the obtained "faceINormals" vectors did not point to z-axis.


I donot know if there are some problems in my codes.
ywem is offline   Reply With Quote

Reply

Tags
nf(), sf()/magsf()


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



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