DirichletBC set to boundary normal

Hello,
I want to perform some shape optimization procedure with Fenics. For this purpose, I need to define a vector field u inside a domain \Omega such that if n is the outward-pointing normal of the boundary of \Omega i have : \Delta u = 0 in \Omega and u|_{\partial \Omega} = n.

However, I don’t know how to set the normal in the DirichletBC in Fenics and the thread I read were either pretty old or difficult for me. Could you guide me a little ? I would be of great help !
Have a good day :slight_smile:
Eloi.

You can project the FacetNormal to be Function, as shown in:

and use it directly in your Dirichlet boundary condition