This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Subdomains in 3D

+3 votes

I'm trying to create a 3D mesh with subdomains. Following what was done in the post http://fenicsproject.org/qa/3981/creating-a-rectangular-domain-with-a-circular-hole dealing with 2D, I tried:

from dolfin import *

domain = Box(0., 0., 0., 1., 1., 1.)
domain.set_subdomain(1, Box(0., 0., 0., 1., 1., 1.))
domain.set_subdomain(2, Box(0.5, 0., 0., 1., 1., 1.))

mesh3d = Mesh(domain, 25)
plot(mesh3d, "3D mesh")
interactive()

but the resulting mesh shows no indication of the subdomains. Is there something different that has to be done to create subdomains in 3D?

asked Sep 25, 2014 by bseguin FEniCS Novice (650 points)

1 Answer

+1 vote

Hi, set_subdomain works in 2D only.

answered Sep 25, 2014 by MiroK FEniCS Expert (80,920 points)

Thanks for the quick answer. Is there anyway to make subdomains in 3D?

The CSG functionality is not part of DOLFIN 1.4.0 and has now become a separate package called mshr. Supporting subdomains in 3D is on the TODO list of the developers, see here. So you can either upvote the issue or try to contribute to the development. In the meantime, you should use some external mesh generator.

Ok. Thanks for the info.

Hey, I am using mshr right now for making 3D meshes, and still it seems making subdomains inside the mesh (i.e. setting interior mesh edges) is not possible. Has there been any progress in this?

...