In the Fenics documentation, it is mentionned that
DirichletBC takes three arguments, the first one is our function space V, the next is the boundary condition value and the third is the subdomain indicator which is information stored in the mesh.
Where is the subdomain indicator in the mesh file? How do I change it's value?
Context: I am solving on a domain that has multiple boundary parts, with a constant Dirichlet condition on each part.
The mesh file I'm using was generated using Triangle, and dolfin-convert
to get an xml file.
It is my understanding that meshing tools such as GMSH natively provide the option to mark boundaries, but I would rather not resort to another mesher, since I am used to Triangle.
I didn't figure out how to modify the mesh to add boundary markers, but I did find a workaround to part of the problem in page 9 of this document.
The idea is to define a boundary condition for each boundary
u_1 = Constant(0.0)
def b_1(x, on_boundary):
return on_boundary and \
near(x[0]*x[0]+x[1]*x[1], 1, 1e-2)
then defining a list of boundary conditions that can be passed to the solve
function
bcs = [DirichletBC(V, u_1, b_1), ...]
However, this will only work if each boundary can be described by an equation. So this is not a general solution to the problem