Error integrating when going from 2D to 3D problem


Dear all,

for postprocessing in a coupled mechanical, I defined the following forms corresponding to the average displacement and the force on a boundary:

class dOr(SubDomain): #boundary, where force has to be calculated
   def inside(self,x,on_boundary):
   	return x[0]>=1-tol and on_boundary
bdmarker = MeshFunction("size_t",mesh,1)
dOr1.mark(bdmarker,1) #boundary part to be considered for post processing
n = FacetNormal(mesh)
e_x = Constant((1.0,0.0,0.0)) #x unity vector
e_y = Constant((0.0,1.0,0.0)) #y unity vector
ds=Measure("ds",domain=mesh,subdomain_data=bdmarker) #redefinied integration operator
l_x = 1.0 #calculation domain height
t = 0.05 #calculation domain thickness
uxmifu = (1.0/l_x/t)*dot(e_x,u)*ds(1)
uymifu = (1.0/l_x/t)*dot(e_y,u)*ds(1)
frfu_x = dot(e_x,dot(sigma(u,c),n))*ds(1)
frfu_y = dot(e_y,dot(sigma(u,c),n))*ds(1)

Where sigma(u,c) is the stress tensor, a second order tensor.
I am using the following function definitions:

# function space definition
rd = 3
uel = VectorElement("P",tetrahedron,pd,dim=rd)	
cel = FiniteElement("P",tetrahedron,pd)
Vc = FunctionSpace(mesh,cel)
c = Function(Vc)
u = Function(Vu)

So far, everything worked fine, when doing this in 2D, e.g. when using triangle elements instead of tetrahedrons.
However, having switched to 3D, Fenics is throwing an error concerning the assembly of one of the forms defined above:

File “/sw/installed/DOLFIN/2018.1.0.post1-foss-2018a-Python-3.6.4/lib/python3.6/site-packages/dolfin/fem/”, line 213, in assemble
assembler.assemble(tensor, dolfin_form)

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at


*** Remember to include the error message listed below and, if possible,
*** include a minimal running example to reproduce the error.

*** -------------------------------------------------------------------------
*** Error: Unable to complete call to function operator.
*** Reason: Assertion entity.dim() == _dim failed.
*** Where: This error was encountered inside /dev/shm/easybuild-build/DOLFIN/2018.1.0.post1/foss-2018a-Python-3.6.4/dolfin-2018.1.0.post1/dolfin/mesh/MeshFunction.h (line 542).
*** Process: 5

*** DOLFIN version: 2018.1.0
*** Git changeset:
*** -------------------------------------------------------------------------

Thanks in advance for your ideas!


If bdrmarker should be a facet function then its degree should be tied to the topological degree of entities of the mesh, i.e.

bdrmarker = MeshFunction('size_t', mesh, mesh.topology().dim()-1)