FacetNormal vector components and director vector


I have a quad mesh over 3 dimensions. I want normal vector for each element. I tried FacetNormal and CellNormal but doesn’t find how to output the normal vector.

from dolfinx import *
mesh = UnitSquareMesh(4,4)  # consider 2D mesh for this case
n = CellNormal(mesh)
  1. get_local doesn’t work here to find vector components information.
  2. Where is normal vector defined? is it at all guass points or is it average of nodal normal vectors.
  3. Since, it is a 2-dimension element. How can I find the initial curvature of mesh element. Is here a way a function in ufl like director_vector() to find normal and curvatures?

Any help is greatly appreciated!

Is a symbolic expression, which can be evaluated at any point in the cell. It is not in a function space. You could project it into a function space (for linear grids I would use DG-0).

Usually curvature is better to import from a mesh generator if you are using linear meshes.
You could have a look at How to compute curvature of a boundary - #2 by dokken