Dear all,
I wonder if there is a specific way for defining Dirichlet BC's when working with mesh subdomains. I use the following script to generate a 2D mesh with mshr (file meshgen.py):
import dolfin
from mshr import *
def set_mesh(ref,h,w):
p1 = dolfin.Point(0.,0.)
p2 = dolfin.Point(w,h)
p3 = dolfin.Point(w,1/2.0*h)
domain = Rectangle(p1,p2)
domain.set_subdomain(1, Rectangle(p1, p3))
mesh2d = generate_mesh(domain, ref)
return (mesh2d)
And I noticed some difficulties when I apply Dirichlet BC's with the "standard" procedure :
from meshgen import set_mesh
from dolfin import *
mesh= set_mesh(10,1.,1.2)
V = VectorFunctionSpace(mesh, "Lagrange", 1)
class Corner(SubDomain):
def inside(self, x, on_boundary):
return x[0]==0.0 and x[1]==0.0
class Border(SubDomain):
def inside(self, x, on_boundary):
return x[1]==0.0
border = Border()
corner = Corner()
bc1 = DirichletBC(V, Constant((0.,0.)),corner,method="pointwise")
bc2 = DirichletBC(V.sub(1), 0., border)
bcs = [bc1, bc2]
Is there a specific way to define BC's when working with mesh subdomains ?
thank you in advance,