Normal unit vector in variational formulation

Hi everybody,
I need to define two subdomains, each of which has its own governing PDE, and an interface coupling condition between the two. The variational formulation resembles

... + \int_{\Gamma_s} (\mathbf{n}_1 \cdot \mathbf{u}) \overline{q} ds + \int_{\Gamma_s} \mathbf{n}_1 \cdot \mathbf{\overline{v}} ds = \int_{\Gamma}(\partial_{\mathbf{n}_2} p) \overline{q} ds + ...

Here, \overline{q} and \mathbf{\overline{v}} are test functions, p and \mathbf{u} are trial functions, \mathbf{n}_1 is the outward surface-normal unit vector on \Gamma_s (interface), and \mathbf{n}_2 is the outward surface-normal unit vector on \Gamma (external boundaries).

My question is, what is the proper way of defining \mathbf{n}_1 and \partial_{\mathbf{n}_2}?

I thought of using

n_1 = FacetNormal(mesh)
n_2 = FacetNormal(mesh)

a = ... + inner(n_1, u)*q*ds(1) + inner(n_1, v)*ds(1)
L = inner(grad(p),n_2)*q*ds(0) + ...

but Iā€™m not sure if the ā€œFacetNormal()ā€ function was designed for this. Can someone explain it?
Thanks!

FacetNormal is exactly what you are looking for. And the terms you implemented are correct for the variational form above.

But as you said that Gamma_s is an interface, I would expect it to be a interior surface measure dS which you integrate over, and in this case you have to restrict the quantities using, e.g.,

inner(n_1('+'), u('+'))*q('+')*dS(1)

as described here Integrating over an interior surface

Also, no need to define n_1 and n_2 here, you can just use one object for these (it is the same anyway, and is restricted by the appropriate (surface) measures)

3 Likes