warp.fem.make_constrained_basis_space#

warp.fem.make_constrained_basis_space(
base_basis,
prolongation,
independent_raw_nodes=None,
max_nodes_per_element=_DEFAULT_MAX_NODES_PER_ELEMENT,
)[source]#

Build a basis whose nodes are linear combinations of the nodes of base_basis.

prolongation is a sparse matrix P with one row per node of base_basis and one column per independent degree of freedom of the new basis: base nodal values are u_base = P @ u. Each new basis function is the matching combination of base functions, so forms assemble directly on the independent degrees of freedom, and fields evaluate through P. Use it for multi-point constraints such as periodic boundary conditions (see periodic_prolongation()) or hanging nodes (see hanging_node_prolongation()).

Each independent node j needs an anchor: a base node whose row of P is exactly the unit vector e_j. Anchors give the node its position and its at_node() samples. By default, the anchor is the smallest base node with that unit row. Rows need not sum to one.

If base_basis is itself a constrained basis, P is composed with its prolongation and the result is built on its raw basis, so constrained spaces do not nest.

Construction runs on the device of prolongation; only sizes and error status are read back. The constrained basis must be rebuilt after the geometry changes. Nodal assembly is not available on it; use the raw basis and the reduce_dirichlet_projector() method of the result for strong boundary conditions.

Parameters:
  • base_basis (BasisSpace) – Scalar shape-function basis, such as one returned by make_polynomial_basis_space(), or a constrained basis.

  • prolongation (BsrMatrix) – Matrix P with 1x1 floating-point blocks and one row of blocks per node of base_basis.

  • independent_raw_nodes (array | None) – Anchor of each column of P, as node indices of base_basis. None picks the smallest node with a unit row.

  • max_nodes_per_element (int) – Largest number of independent nodes allowed to act on one cell. Assembly kernels are sized by this number, so very wide constraints must be allowed explicitly.

Returns:

A constrained basis whose raw_basis is base_basis, or the raw basis of base_basis if it is constrained.

Raises:
  • NotImplementedError – If the raw basis is not a scalar shape-function basis.

  • TypeError – If prolongation is not a floating-point BSR matrix.

  • ValueError – If prolongation does not have scalar blocks or one row per base node, refers to out-of-range columns, has an empty column or a column without an anchor, if independent_raw_nodes names a node without the matching unit row, or if a cell depends on more than max_nodes_per_element independent nodes.

Return type:

ConstrainedBasisSpace