CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums

Faces of a cell

Register Blogs Community New Posts Updated Threads Search

Rate this Entry

Faces of a cell

Posted September 20, 2014 at 10:31 by pfhan

openfoam loop cell faces of a cell and get the corresponding cell face normal, noting that the normal vector direction points from low cell ID to the higher one

Quote:
Originally Posted by kuczmas View Post
Dear forumers,

I decided to post my question inside this thread, as it is also somehow connected with looping over faces in a given cell. What I try to achieve is to get the face normal vector at every face in the cell, regardless it is a boundary cell or internal.
I produced the following code...:

Code:
    const cell& faces = mesh_.cells()[cellI];

    forAll( faces, i )        // loop over all faces in cellID
    {
        vector faceINormal = mesh_.Sf()[i] / mesh_.magSf()[i] ; 
        Info << " i = " << i << ", faceINormal = " << faceINormal << endl ;
    }
...but the values of normal vectors I received are all of positive sign, all the components are of positive sign (on hexahedral mesh). I think in three normal vectors there should be at least one component of negative sign... Do you have any ideas?
Quote:
Originally Posted by Lieven View Post
Just a small note, I think

Code:
vector faceINormal = mesh_.Sf()[i] / mesh_.magSf()[i];
should be
Code:
 
vector faceINormal = mesh_.Sf()[faces[i]] / mesh_.magSf()[faces[i]] ;
Cheers,

L
Quote:
Originally Posted by kuczmas View Post
Yes, I solved the problem. The solution I got was correct. I.e. the components of normal vectors for an arbitrary cell can be in general of the same sign.

The reason for this are the normal vector direction rules. In OpenFoam mesh normal vectors:
- at boundary faces point out of the domain
- at internal faces they point from the cell of lower global ID number to higher.

Hope this helps,

Best regards,
kuczmas.
Posted in Uncategorized
Views 1784 Comments 0 Edit Tags Email Blog Entry
« Prev     Main     Next »
Total Comments 0

Comments

 

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