I’d like to consider a coupling term between p1 (existing on region 1) and p2 (existing on region 2) on the interface of the region 1 and 2 of the form int(p1_ grad(p2) * n2 ds , where p1_ is the test function and n2 the normal vector on the interface of region 2.
However, when using the trace-operator, the integral vanishes. I think, that’s because due to the trace-operator the tangential derivative is computed on the surface and thus the product with the normal vector is zero.
Here a minimal working example of how I am trying to achieve that:
from netgen.geom2d import *
from ngsolve import *
geo = SplineGeometry()
geo.SetMaterial (1, “outer”)
geo.SetMaterial (2, “inner”)
mesh = Mesh(geo.GenerateMesh(maxh=0.25))
n = specialcf.normal(mesh.dim)
fes1 = H1(mesh, definedon=“inner”)
fes2 = H1(mesh, definedon=“outer”)
fes = fes1 * fes2
(p1_, p2_), (p1, p2) = fes.TnT()
K = BilinearForm(fes)
K += p1_.Trace() * 1 * grad(p2).Trace() * n * ds(definedon=mesh.Boundaries(“b2|r2”))
import matplotlib.pyplot as plt
import scipy.sparse as sp
A = sp.csr_matrix(K.mat.CSR())
plt.rcParams[‘figure.figsize’] = (4,4)
What is the correct way to define the surface integral?