# FEniCS: separate boundary conditions in normal and tangential direction of mesh boundary

Given a vector-valued PDE, I'd like to enforce the boundary conditions $$\vec{n}\cdot u = g\\ \vec{n}\cdot \nabla (\vec{t}\cdot u) = 0$$ on the solution $\vec{u}$. If the boundary happens to align with one of the coordinate axes, I could use

bcs = DirichletBC(V.sub(0), g, 'on_boundary')


as Dirichlet condition. What to do for other geometries though?

## 1 Answer

You can use a Nitsche-type method for this. See the following reference:

J. Freund, R. Stenberg. On weakly imposed boundary conditions for second order problems. Proceedings of the Ninth Int. Conf. Finite Elements in Fluids, Venice 1995. M. Morandi Cecchi et al., Eds. pp. 327-336.

I have implemented this a while ago in some simple FEniCS-Code to deal with free-slip boundaries in general 2d geometries. Find the demo code here and the mesh here (tested with FEniCS 1.3).

Update: Meanwhile, others have made similar implementations available. See for instance this github repository.

• The link to the demo code is out of date. – Nico Schlömer Apr 7 '18 at 20:37
• @NicoSchlömer: thanks. The file was still up, but Dropbox seems to have forgotten that it was supposed to be shared. Hope pastebin lasts longer. – Christian Waluga Apr 11 '18 at 3:08