# How to compute tangent vectors on facets (2D surface parametrization)

Hi,
I have a 3d mesh with two domains and an interface. I would like to do surface parametrization on the interface. For this I need to compute tangent vectors on the interface facets.
That is,$$\partial x / ‘\partial X’$$
x = physical coordinates,
X = reference coordinates.

I think I can compute this just using the Jacobian function for 3D tetrahedra, but i couldn’t calculate it for facet.

Can someone help me how i can do this?
Just FYI, I have tagged the domains, boundaries and interface using GMSH, and I can successfully read them in fenics.

Thanks!

Hi deshik,

Since there is no detailed specification of what programming language/package you are using to attempt this I went ahead and assumed that an implementation based on dolfinx is fine for you.

In this gist you can find a code for approximating facet vectors on all facets or a subset of facets on a dolfinx mesh. The function has a flag tangent. When this flag is set to False the facet normal vectors will be approximated, whereas the facet tangent vectors are approximated when the flag is set to True.

The code also has a flag interior. Set this to True if the facet vectors you are approximating are on interior facets, such as in your case for the interface between two domains. Set the flag to False if you want to approximate facet vectors on the boundary of the mesh.

The facet tags of the facets you want to approximate the facet vectors on are passed in as the argument mt, with the corresponding tag value mt_id of those meshtags.

Note that the approximated vectors are defined in a DG1 finite element space. Resultingly, visualizing output files written in the script will display several vectors in each vertex since there are facet vectors defined on facets of all neighboring cells of the vertex. In practice however when e.g. integrating over a facet that facet’s normal/tangent vector is uniquely determined.

Hope this is of help!

Cheers,
Halvor

1 Like