Hello, I need to put Dirichlet BCs on subdomain boundaries, see the following example code and figure, the domain is simply broken down into 2 subdomains, I need to put a fixed BC of 0 on the the boundaries. Of course for this example, we could easily define 0 on the boundary of the square and on the straight line inside, but I needed a more efficient way for the cases where I have many subdomain defined. Any help is appreciated! Thank you!
from dolfin import *
from mshr import *
domain = Rectangle(Point(0., 0.), Point(1., 1.))
domain.set_subdomain(1, Polygon( [Point(0., 0.), Point(0.8,0.), Point(0.2,1.), Point(0.,1.)] ))
domain.set_subdomain(2, Polygon( [Point(0.8,0.), Point(1., 0.), Point(1.,1.), Point(0.2,1.)] ))
mesh = generate_mesh(domain, 20)
mf = MeshFunction("size_t", mesh, 2, mesh.domains())
import matplotlib.pyplot as plt
plot(mesh, "2D mesh")
plot(mf, "Subdomains")
plt.show()