### I have AssertionError when I try to use jump

30
views
-1
22 days ago by
Hello. I try to implement something like termal contact resistance. This is my complit code:

from fenics import *
from mshr import *
subdomain1=Circle(Point(0,0),5)
subdomain2=Circle(Point(0,0),15)-Circle(Point(0,0),5)
domain=Circle(Point(0,0),15)
domain.set_subdomain(1,subdomain1)
domain.set_subdomain(2,subdomain2)
mesh=generate_mesh(domain,16)
markers=MeshFunction("size_t",mesh,mesh.topology().dim(),mesh.domains())
dx=Measure("dx",domain=mesh,subdomain_data=markers)
boundary_mark=MeshFunction("size_t",mesh,mesh.topology().dim()-1)
boundary_mark.set_all(0)
class Inside_bound(SubDomain):
def inside(self,x,on_boundary):
return on_boundary and x[0]>-5.5 and x[0]<5.5 and x[1]>-5.5 and x[1]<5.5
boundary1=Inside_bound()
boundary1.mark(boundary_mark,1)
ds=Measure("ds",domain=mesh,subdomain_data=boundary_mark)
P=FunctionSpace(mesh,"CG",2)
def left_boundary(x,on_boundary):
return on_boundary and (x[0]<-5.5 or x[0]>5.5 or x[1]<-5.5 or x[1]>5.5)
bc=DirichletBC(P,Constant(0.0),left_boundary)
p=TrialFunction(P)
q=TestFunction(P)
alfa=Constant(3.0)
f=Constant(2.0)
n=FacetNormal(mesh)
h=CellDiameter(mesh)
L=f*q*dx()
A=assemble(a,)
b=assemble(L)
bc.apply(A,b)
p=Function(P)
solve(A,p.vector(),b)
xdmffile=XDMFFile("solve_test.xdmf")
xdmffile.write(p)​

And its follow AssertionError when compiler try to assemble this ds integral. What wrong with this code?

Community: FEniCS Project