This page was generated from unit-2.13-interfaces/interfaceresistivity.ipynb.

2.13 Interface resistivity

We model a problem with resistivity interface conditions \begin{eqnarray*} \lambda_l \frac{\partial u_l}{\partial n_l} + \lambda_r \frac{\partial u_r}{\partial n_r} & = & 0 \\ \alpha (u_l - u_r) + \lambda_l \frac{\partial u_l}{\partial n_l} & = & 0 \end{eqnarray*}

This is easily modeled by an additional Robin-like term on the interface:

\[\int_\Omega \lambda \nabla u \nabla v \, dx + \int_\gamma \alpha [u][v] \, ds,\]

where \([u] = u_l - u_r\) denotes the jump across the interface.

[1]:
from ngsolve import *
from netgen.occ import *
from ngsolve.webgui import Draw
[2]:
inner = Rectangle(1,1).Face()
inner.edges.name="interface"
inner.edges.Max(X).name="interface_right"

outer = MoveTo(-1,-1).Rectangle(3,3).Face()
outer.edges.name="dir"
outer = outer-inner

inner.faces.name="inner"
outer.faces.name="outer"
geo = Glue ([inner,outer])
mesh = geo.GenerateMesh(dim=2, maxh=0.2)

Draw (mesh);
[3]:
print (mesh.GetMaterials(), mesh.GetBoundaries())
('inner', 'outer') ('interface', 'interface_right', 'interface', 'interface', 'dir', 'dir', 'dir', 'dir')

Interfaces without boundaries

In the first case, we assume that the interface is the boundary of the inner domain. For this case, we define spaces on both sides separately, and link them via the Robin term.

In our problem we choose zero conductivity across the right edge of the interface.

[4]:
fesi = H1(mesh, order=3, definedon="inner")
feso = H1(mesh, order=3, definedon="outer")
fes = fesi*feso

(ui,uo), (vi,vo) = fes.TnT()
[5]:
alpha = 10

lhs = grad(ui)*grad(vi)*dx("inner") + grad(uo)*grad(vo)*dx("outer") \
    + alpha * (ui-uo) * (vi-vo) * ds("interface")
rhs = 1*vi*dx("inner")

gfu = Solve(lhs==rhs, uo[BND("dir")] == 0)

sol = mesh.MaterialCF({"inner":gfu[ui], "outer":gfu[uo]})
Draw (sol, mesh);

Interfaces with boundaries

Now we model an interface resistivity only at the right edge. For this we need a space which is discontinuous only at that edge. We obtain it by enriching an \(H^1\) space with functions defined by values on the interface, and supported only on one side. The jump is exactly the enrichment function.

We define the enrichment space first on one domain, and then restrict the degrees of freedom to the interior of the right interface edge.

[6]:
fes1 = H1(mesh, order=3)

fesext = H1(mesh, order=3, definedon="outer")
actdofs = fesext.GetDofs(mesh.Boundaries("interface_right")) & \
    ~fesext.GetDofs(mesh.Boundaries("interface"))
fesext = Compress (fesext, active_dofs=actdofs)
print ("enrichment dofs:", fesext.ndof)
enrichment dofs: 14

A typical enrichment function looks like

[7]:
gfext = GridFunction(fesext)
gfext.Set(sin(10*y))
Draw (gfext);
[8]:
fes = fes1 * fesext
(u,uext), (v,vext) = fes.TnT()

alpha = 3

lhs = grad(u)*grad(v)*dx("inner") \
    + (grad(u)+grad(uext))* (grad(v)+grad(vext))*dx("outer") \
    + alpha * uext*vext * ds("interface_right")
rhs = 1*v*dx("inner")

gfu = Solve(lhs==rhs, u[BND("dir")] == 0)

sol = mesh.MaterialCF({"inner":gfu[u], "outer":gfu[u]+gfu[uext]})
Draw (sol, mesh);