- changed milestone to 1.4
-
assigned issue to
integration over subdomain broken
Issue #240
invalid
When using the new dx(...)
integration, integrating over a subdomain is no longer working.
MWE:
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)
dx = Measure('dx')[subdomains]
submesh = SubMesh(mesh, subdomains, 1)
# This works:
# r = Expression('x[0]', domain=mesh)
# This fails:
r = Expression('x[0]', domain=submesh)
a = assemble(r * dx(1))
Error message:
*** 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.
Comments (4)
-
-
- marked as critical
-
- changed status to invalid
This never worked. You are integrating on non-matching domain. See
#85and#88. You need to to dofrom 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) submesh = SubMesh(mesh, subdomains, 1) subdomains_sub = CellFunction('size_t', submesh) obstacle.mark(subdomains_sub, 1) dx_sub = Measure('dx')[subdomains_sub] r = Expression('x[0]', domain=submesh) a = assemble(r * dx_sub(1))
-
- removed milestone
Removing milestone: 1.4 (automated comment)
- Log in to comment