4.1.1.3.1.2. pyfem.fem.Constrainer module
- class Constrainer(nDofs: int, name: str = 'Main')[source]
Bases:
objectContainer for handling multi-point constraints (ties/prescribed dofs).
The class records constraint relations and can build a sparse constraint matrix as a
scipy.sparse.coo_matrix. It also manages groups of constrained DOFs, their prescribed values and scaling factors per load-case or name.- addConstraint(dofID: int, val: Any, label: str) None[source]
Register a constraint on a DOF.
The
valargument may be a scalar or a triplet [value, masterID, factor] representing a tied DOF. The method updates internal structures that are later used to build the constraint matrix.
- checkConstraints(dofspace: Any, nodeTables: Any) None[source]
Resolve chained tying relations and expand slave prescriptions.
This method processes entries in
self.constrainDatathat indicate tied DOFs using the [value, master, factor] convention and flattens recursive ties so that slaves with masters that are themselves slaves are resolved to base values.
- flush() None[source]
Build and store the sparse constraint matrix
self.C.The returned matrix maps the full DOF vector to the reduced set of free DOFs. Slave entries are added to the matrix based on previously recorded master/slave relations.
- addConstrainedValues(a: Any) None[source]
Add the constrained values into array
a(incremental).The method loops over named constraint groups and increments the entries in
aby scaled prescribed values.
- setConstrainFactor(fac: float, loadCase: str = 'All_') None[source]
Set the constraint scaling factor for all or a specific load case.
- setPrescribedDofs(a: Any, val: float = 0.0) None[source]
Set prescribed DOFs in array
ato a scalar value.