This is my first time using FEniCS. I am trying to solve an elliptic PDE, fairly similar to the Laplace equation, on a rectangle with two holes in it. The holes are level sets of an energy function, so I am not completely in control over their geometry. For a first approximation I can use ellipses, but I would like to still use an extensible technique so that the potential can be varied flexibly. The tutorial mentions that mesh preprocessors are usually required to initialize problems with complex geometry, but I was unable to find an actual example of how to do this. Can anyone suggest a method for building the mesh?
Take a look at the CSG (Constructive Solid Geometry) demos in DOLFIN. You should be able to generate a rectangle with two holes with something like
mesh = Mesh(Rectangle(...) - Ellipse(...) - Ellipse(...), resolution)
If your mesh depends on solution you can do fixed-point iteration:
- compute solution,
- move mesh,
- if mesh is deformed to much, create new one and project solution on it.
If you use CSG in DOLFIN, then you can handle all three steps within DOLFIN. If using external mesh generator third step requires instructing mesh generator by DOLFIN. One way to do it is:
- prepare input for mesh generator parametrized by few
- read in new mesh
Triangle can generate triangulations of domain with holes in 2D.
meshconvert handles also facet and cell markers produced Triangle.