How to get rid of segfault when using assemble()

If you assemble on a subdomain using the full mesh, but with a MeshFunction as input to the integration measure:

dx_ = Measure("dx", domain=mesh, subdomain_data=mesh_function)
a = ...*dx_(cell_marker)
A = assemble(a)
A.ident_zeros()

as shown in for instance:

or

2 Likes