# Problem witch boundary conditions

Hello to all,

is there any way to enable the boundary conditions of gluing between bodies?

For example, if there are two boundaries, then the displacements u | [sub]Г[sub]1[/sub][/sub] = u | [sub]Г[sub]2[/sub][/sub] should be equal at these boundaries. Tell me please.

Hi LilBeng,

if you have for example two Poisson equations decoupled like this

[code]fes1 = H1(mesh, order=2, definedon= “left_dom”, dirichlet=“left|top|bottom”)
fes2 = H1(mesh, order=2, definedon= “right_dom”, dirichlet=“right|top|bottom”)
fes = FESpace( [fes1,fes2] )

(u1,u2),(v1,v2) = fes.TnT()

a = BilinearForm(fes)
a += 0.15
a.Assemble()

f = LinearForm(fes)
f += 1v1dx(definedon=mesh.Materials(“left_dom”))
f += 1v2dx(definedon=mesh.Materials(“right_dom”))
f.Assemble()[/code]

then you can either use a penalty formulation by adding

a += 1e5*(u1-u2)*(v1-v2)*ds(definedon=mesh.Boundaries("interface"))

or introduce a hybrid facet variable (one additional FESpace).

Attached you’ll find the full example.

Best,
Michael

https://ngsolve.org/media/kunena/attachments/889/gluing.py

Attachment: gluing.py

Thanks for the quick response!
But what about in theory, when we have such a situation?

[code]eo = SplineGeometry()
pnts = [(0, 0), (0.4999, 0), (0.4999, 1), (0, 1), (0.5, 0), (1, 0), (1, 1), (0.5, 1)]
pind = [ geo.AppendPoint(*pnt) for pnt in pnts ]

geo.Append([‘line’,pind[0],pind[1]],leftdomain=1,rightdomain=0,bc=“bottom”)
geo.Append([‘line’,pind[1],pind[2]],leftdomain=1,rightdomain=0,bc=“interface”)
geo.Append([‘line’,pind[2],pind[3]],leftdomain=1,rightdomain=0,bc=“top”)
geo.Append([‘line’,pind[3],pind[0]],leftdomain=1,rightdomain=0,bc=“left”)
geo.Append([‘line’,pind[4],pind[5]],leftdomain=2,rightdomain=0,bc=“bottom”)
geo.Append([‘line’,pind[5],pind[6]],leftdomain=2,rightdomain=0,bc=“right”)
geo.Append([‘line’,pind[6],pind[7]],leftdomain=2,rightdomain=0,bc=“top”)
geo.Append([‘line’,pind[7],pind[4]],leftdomain=2,rightdomain=0,bc=“interface”)[/code]

https://ngsolve.org/media/kunena/attachments/1238/gluing.py

Attachment: gluing.py