assembling with different submeshes: misleading error message
Issue #244
resolved
When a form is assembled that contains functions from different meshes, e.g.,
from dolfin import *
mesh = RectangleMesh(0.0, 0.0, 1.0, 1.0, 100, 100)
class Obstacle(SubDomain):
def inside(self, x, on_boundary):
return (between(x[1], (0.5, 0.7)) and between(x[0], (0.2, 1.0)))
obstacle = Obstacle()
subdomains = CellFunction('size_t', mesh)
subdomains.set_all(0)
obstacle.mark(subdomains, 1)
r = Expression('x[0]', domain=mesh)
V = FunctionSpace(mesh, 'CG', 1)
f = project(Constant(1.0), V)
submesh = SubMesh(mesh, subdomains, 1)
Vsub = FunctionSpace(submesh, 'CG', 1)
v = TestFunction(Vsub)
print assemble(f * v * dx)
the error message
AssertionError: Expecting a completed form with domains at this point.
is thrown. It should rather be
*** Error: Unable to extract mesh from form.
*** Reason: Non-matching meshes for function spaces and/or measures.
*** Where: This error was encountered inside Form.cpp.
(Also, I'm not sure how to actually compile a RHS with a function f
that lives on a supermesh.)
Comments (5)
-
-
reporter Thanks for the quick answer! Unfortunately, I'm getting
ufl.log.UFLException: Label mismatch.
for all three of your suggestions.
-
Hm. That's from a recent check in ufl. Maybe it's too strict. I'll check.
-
It was a bug in the domain compatibility check, fixed now in ufl next.
-
reporter - changed status to resolved
Confirmed working.
- Log in to comment
It should not be that message, but I'll look into improving it.
assemble(f * v * dx) is ambiguous, since f and v don't live on the same mesh.
Try