I am trying to impose an Impermeable boundary condition on my 3D simulation which would be easy if the normal vector of my outer faces coincided with the directions of the cartesian coordinate. But for my complex geometry that’s not the case…
Is there a way to impose DirichletBC relative to the normal vector of the faces?
I don’t know of a straightforward way to apply the BC strongly, i.e., using the DirichletBC functionality in FEniCS. It is relatively easy to impose the BC weakly, by building it into the variational form as a boundary (i.e., ds) term, using, e.g., an approach analogous to Nitsche’s method. However, the precise boundary term would depend on what PDE system you’re solving. This is not mathematically-equivalent to strong enforcement, but should converge to the correct solution under refinement.
If your system is linear, imposition of the no-penetration condition using Nitsche’s method should be somewhat straightforward, and there is a wealth of literature.
In the case of nonlinear problems, I have not read any succinct text offering explanation nor analysis. If someone else could link to a resource, that would be fantastic.
Nonetheless, borrowing from the DG literature, I’ve written automatic formulation of Nitsche boundary conditions for nonlinear problems in a simple nonlinear Poisson example here. Original paper here.