# DirichletBC definition on boundary subdomain for component of vector valued function in FEniCS

I am trying to impose a no-outflow condition for a velocity-field over a boundary sub-boundary domain in FEniCS. What I have find challenging is imposing the condition on a component of a vector-valued function on a boundary with curvature.

First, I will demonstrate what I have for a dl.Boxmesh

import dolfin as dl
# define mesh
Length = 1.
Width  = 1.
Height = 1.
nx = 10
ny = 10
nz = 10
mesh = dl.BoxMesh(dl.Point(0.,0.,0.), dl.Point(Length, Width, Height))

# define class to define boundary subdomain
class Bottom(dl.SubDomain):
def inside(self, x, on_boundary):
return dl.near(x, 0.)
bottom = Bottom()

# define vector element space
P2 = dl.VectorElement("Lagrange", mesh.ufl_cell(), 2)
Vh = dl.FunctionSpace(mesh, P2)
# specify that the last component of the vector field is 0 on the bottom
# boundary subdomain
bc = [dl.DirichletBC(Vh.sub(2), dl.Constant(0.0), bottom)]



I then define the weak form of a partial differential equation and can then pass that into the dl.assemble_system method

a = # lhs of the PDE weak form
L = # rhs of the PDE weak form
A, b = dl.assemble_system(a, L, bc)


I would now like to be able to extend this for a mesh that is not flat. Suppose that I can define a boundary subdomain of this new mesh, I will reuse the notation bottom to describe this boundary subdomain as I did before for the flat mesh.

I have tried using the facet normal function

normal = dl.FacetNormal(mesh)


and then replaced

bc = [dl.DirichletBC(Vh.sub(2), dl.Constant(0.0), bottom)]


with

bc = [dl.DirichletBC(dl.dot(Vh, normal), dl.Constant(0.0), bottom)]


unfortunately this does not work and maybe this should be expected, since I am taking the dot product of the function space Vh and a vector normal.

Let me know if you know of a way to define a dirichlet boundary condition for a component of a vector-valued function on a boundary subdomain. Thanks.

• This question is related to using a software and should be asked on the fenics forum. – cfdlab Nov 28 '19 at 4:09