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,
Build a basis whose nodes are linear combinations of the nodes of
base_basis.prolongationis a sparse matrixPwith one row per node ofbase_basisand one column per independent degree of freedom of the new basis: base nodal values areu_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 throughP. Use it for multi-point constraints such as periodic boundary conditions (seeperiodic_prolongation()) or hanging nodes (seehanging_node_prolongation()).Each independent node
jneeds an anchor: a base node whose row ofPis exactly the unit vectore_j. Anchors give the node its position and itsat_node()samples. By default, the anchor is the smallest base node with that unit row. Rows need not sum to one.If
base_basisis itself a constrained basis,Pis 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 thereduce_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
Pwith1x1floating-point blocks and one row of blocks per node ofbase_basis.independent_raw_nodes (array | None) – Anchor of each column of
P, as node indices ofbase_basis.Nonepicks 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_basisisbase_basis, or the raw basis ofbase_basisif it is constrained.- Raises:
NotImplementedError – If the raw basis is not a scalar shape-function basis.
TypeError – If
prolongationis not a floating-point BSR matrix.ValueError – If
prolongationdoes 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, ifindependent_raw_nodesnames a node without the matching unit row, or if a cell depends on more thanmax_nodes_per_elementindependent nodes.
- Return type:
ConstrainedBasisSpace