warp.fem.project_system_matrix#

warp.fem.project_system_matrix(
system_matrix,
projector_matrix,
projector_structure='general',
)[source]#

Projects the left-hand-side of a linear system to enforce Dirichlet boundary conditions

system = (I - projector) * system * (I - projector) + projector

By default, the projection uses general sparse matrix products, which support any projector but allocate temporary storage and read back block counts. Dirichlet projectors assembled with assembly="nodal" are block-diagonal: every block of the result then only depends on the matching block of system_matrix and on the projector’s diagonal blocks, and passing projector_structure="block_diagonal" projects system_matrix in place with a single kernel, keeping its sparsity pattern.

Parameters:
  • system_matrix (BsrMatrix) – Square system matrix, modified in place.

  • projector_matrix (BsrMatrix) – Square projector matrix with the same block shape as system_matrix.

  • projector_structure (Literal['general', 'block_diagonal']) –

    How to project the system matrix.

    • "general" uses general sparse matrix products, which also support projectors with off-diagonal blocks.

    • "block_diagonal" uses the single-kernel projection. It does not allocate or read back, so it can be used during graph capture. The projector must be block-diagonal, and system_matrix must store a diagonal block in every row where the projector is nonzero: off-diagonal projector blocks are ignored, and a row where the projector is nonzero but system_matrix has no diagonal block does not get its projector block added.