This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

normal direction to a face of a tetrahedral

+1 vote

Hello everyone,

I am trying to find which is the normal direction to a face of a tetrahedral cell or which is the tangential direction to the same cell in C++ code. I want to know this direction because i want to vanish the tangential components of the electric field. I tried the following commands:

dolfin::Face face(const Mesh& mesh, std::size_t index);
std::cout<<face.normal(std::size_t i);

The problem is that i do not understand the result that i take and i think that i do not follow the right direction. Does anyone have any idea what to do??

I am looking forward to anyone's reply,
Kostas

asked Sep 10, 2015 by paschal91 FEniCS Novice (240 points)

Do you want the normal to point outward of a tetrahedron or which orientation is desired? In the code you use, the information to which tet the face belongs is lost, since you iterate over faces of the mesh. It should be possible to iterate over tets and then over tet faces, though. If that is not the case, computing the normals is not so hard.

The exact expression i use is the following:

dolfin::Face face(mesh,*(cell->entities(2)+k))

where the cell is the pointer of a CellIterator and k takes values from 0-3 and refers to the four different faces of the tetrahedral. I look for the normal to point outward of the tetrahedron. To be more specific, assume you have a square and the two sides of it are parallel to the x-plane and the others parallel to the y-plane. I want to find the normal directions to all four sides. If i find them, in the sides which are parallel to the x-plane, the y-component of the electric field is perpendicular to those sides and has some value, but the x-component is tangential and vanishes.

...