The strong condition \nabla v\cdot n = g is quite tricky in FEM, for typical elements. These do not have normal gradients as degrees of freedom, so setting them manually is difficult. You have two options:
- You use a mixed form of the PDE. You already imply this is something you’re considering in your other post Issues with Biharmonic Equation Decomposition in FEniCS If you do that, the condition actually becomes a natural condition, and merely requires integration over the boundary. I believe that the old fenics versions had some demos on that. Those might help you on your way.
- You leverage the ‘DG’-type technology that is already in the biharmonic example. In that example, these terms are added that integrate over the internal facets:
- inner(avg(div(grad(u))), jump(grad(v), n))*dS \
- inner(jump(grad(u), n), avg(div(grad(v))))*dS \
+ alpha/h_avg*inner(jump(grad(u),n), jump(grad(v),n))*dS
Those terms effectively enforce continuity of \nabla v\cdot n from element to element (i.e, (\nabla v\cdot n)^{left} = -(\nabla v\cdot n)^{right}. You can do the same on the domain boundary, to enforce \nabla v\cdot n = 0 there:
- inner(div(grad(u)), dot(grad(v), n))*ds \
- inner(dot(grad(u), n), div(grad(v)))*ds \
+ alpha/h_avg*inner(dot(grad(u),n), dot(grad(v),n))*ds
Note the small letter ds
as opposed to dS
, changing the domain of integration from interior facets to domain boundary.
That is called Nitsche’s method, which may give you a handle on further search.