Dear FENICS community.
I am trying to enforce a Dirichlet boundary condition only on a component of a tensor element in a Raviart-Thomas tensor Space. Below is what I have tried:
from dolfin import *
L = 10
nx = 50
ny = 50
mesh = RectangleMesh(Point(0.0, 0.0), Point(L, L), nx, ny)
degree = 1
rt_tensor = VectorElement('RT', mesh.ufl_cell(), degree)
H = FunctionSpace(mesh, rt_tensor)
def boundary(x, on_boundary):
return on_boundary
zero_2d = Constant((0.0, 0.0))
bc_1 = DirichletBC(H.sub(0), zero_2d, boundary)
bc_2 = DirichletBC(H.sub(1), zero_2d, boundary)
What I have read:
https://fenicsproject.org/qa/5236/setting-boundary-condition-vector-component-dirichletbc/
https://fenicsproject.org/qa/12290/how-to-constraint-only-one-component-in-dg-method/
What I want:
For U(x,y) in H, with
I need to enforce only u_{12}(x,y)=u_{21}(x,y)=0 on some domain boundary \partial\Omega. But running H.sub(0).sub(i)
, i=0,... does not work. Moreover, running
bc_1 = DirichletBC(H.sub(0), zero_2d, boundary) # will enforce u_11=u_12=0
and
bc_2 = DirichletBC(H.sub(1), zero_2d, boundary) # will enforce u21=u_22=0
Any clue is appreciated.
Thanks!!