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

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

4 Likes