Faces of a cell
Posted September 20, 2014 at 11: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:
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...:
...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?
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 ; }
Quote:
Quote:
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.
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.
Total Comments 0