DMPlex rotated periodicity and slip for vector quantities
We would like to implement periodic boundary conditions with vector-valued functions on faces that are not parallel. For example, consider this mesh of a partial cylindrical annulus.
Finite element residual evaluation con be implemented as follows. Create a Givens rotation R
at each image node of the periodic boundary. Then:
DMGlobalToLocal(..., Qloc)
DMPlexInsertBoundaryValues(Qloc) // boundary conditions
- Apply
R
in-place inQloc
to vector quantities (such as velocity), such that the normal velocity at the true node becomes normal to the rotated periodic surface at the image node. - Apply internal finite element action to
Qloc
, placing result inFloc
. - Apply
R^T
in-place toFloc
(expressing the residual at the image point in a basis aligned with the periodic boundary). DMLocalToGlobal
Much the same pattern applies for slip boundary conditions. In that case, one can use DMAddBoundary
to constrain one component of the vector field and the rotation matrix R
can be used to transform from that normal-aligned basis to the standard basis. In that case, you don't care about sign of the tangential components as stored in the global vector, and thus can implement R
as an elementary reflector (in which case R^T = R
).
In both cases, we need to apply steps 1-3 as part of visualization too. I'd like to ask @knepley (and others who may be interested, @stefanozampini @dalcinl @tisaac) to weigh in on a preference for merging in this functionality. We could add this to DMPlexInsertBoundaryValues
, but still need the R^T
on the residual. We could use INSERT_BC_VALUES
in more places, such that DMGlobalToLocal(dm, Q, INSERT_BC_VALUES, Qloc)
does steps 1-3 and DMLocalToGlobal(dm, Floc, ADD_BC_VALUES, F)
does steps 5-6.
Whatever we do for visualization, there's a question of how to represent the rotations to DMAddBoundary
. Opinions about that are also welcome.
Cc: @LeilaGhaffari