Skip to content

MPConstraintManager

MPConstraintManager

MPConstraintManager(owner: 'ConstraintManager')

Create kinematic couplings through model.constraint.mp.

Unlike SP fixity flags, dofs here lists one-based DOF numbers to couple. Explicit factories accept solver node tags. Geometry-derived helpers require final assembly and register constraints using its current node numbering. Rebuild those constraints if assembly or exported node origins change.

Example
from femora import Model

model = Model()
coupling = model.constraint.mp.equal_dof(1, [2], [1, 2, 3])
assert model.constraint.mp.get(coupling.tag) is coupling
assert "equalDOF" in coupling.to_tcl()
Note

Registration does not verify node existence or prevent conflicting coupling chains. Select an appropriate analysis constraint handler.

Methods:

Name Description
equal_dof

Register equal-DOF coupling between explicit solver nodes.

rigid_link

Register rigid-link coupling between explicit solver nodes.

rigid_diaphragm

Register a rigid diaphragm using explicit retained/constrained nodes.

laminar_boundary

Register equal-DOF couplings on boundary coordinate layers.

equal_dof_between_meshparts

Couple near-coincident assembled nodes from two registered parts.

add

Register an MP object and return it with a manager-assigned tag.

get

Return an MP definition by integer-convertible registry tag, or None.

get_all

Return a shallow tag-to-constraint snapshot with shared object values.

remove

Detach one MP definition and compact surviving registry tags.

clear

Detach all MP definitions and clear their registry tags.

set_tag_start

Set the positive MP registry origin and retag existing definitions.

to_tcl

Concatenate registered coupling commands in registry insertion order.

Methods:

equal_dof

equal_dof(master_node: int, slave_nodes: List[int], dofs: List[int]) -> EqualDOF

Register equal-DOF coupling between explicit solver nodes.

Parameters:

Name Type Description Default
master_node int

Retained solver node tag.

required
slave_nodes list[int]

Constrained solver node tags.

required
dofs list[int]

One-based DOF numbers, not fixity flags.

required

Returns:

Name Type Description
constraint EqualDOF

Registered coupling definition.

rigid_link(type_str: str, master_node: int, slave_nodes: List[int]) -> RigidLink

Register rigid-link coupling between explicit solver nodes.

Parameters:

Name Type Description Default
type_str str

Link type accepted by RigidLink, such as bar or beam.

required
master_node int

Retained solver node tag.

required
slave_nodes list[int]

Constrained solver node tags.

required

Returns:

Name Type Description
constraint RigidLink

Registered definition. Constructor validation errors propagate; geometric and solver compatibility remain required.

rigid_diaphragm

rigid_diaphragm(direction: int, master_node: int, slave_nodes: List[int]) -> RigidDiaphragm

Register a rigid diaphragm using explicit retained/constrained nodes.

Parameters:

Name Type Description Default
direction int

Direction perpendicular to the diaphragm plane.

required
master_node int

Retained solver node tag.

required
slave_nodes list[int]

Constrained solver node tags.

required

Returns:

Name Type Description
constraint RigidDiaphragm

Registered definition. The factory does not select floors or add a retained node/mass automatically.

laminar_boundary

laminar_boundary(dofs: List[int], bounds: Tuple[float, float], direction: int = 3, tol: float = 0.01) -> None

Register equal-DOF couplings on boundary coordinate layers.

Parameters:

Name Type Description Default
dofs list[int]

One-based DOF numbers to couple.

required
bounds tuple[float, float]

Included coordinate interval along direction.

required
direction int

Layer-coordinate axis: 1=x, 2=y, or 3=z.

3
tol float

Surface selection and layer-rounding tolerance in length units.

0.01

Returns:

Name Type Description
result None

Couplings are added to this registry, not returned.

Raises:

Type Description
ValueError

No assembled mesh exists or direction is invalid.

Note

This helper groups selected surface points by rounded coordinates. It is not a general soil-boundary generator; inspect the resulting constraints and use a positive tolerance.

equal_dof_between_meshparts

equal_dof_between_meshparts(meshpart_master: str, meshpart_slave: str, dofs: List[int], tol: float = 1e-05) -> None

Couple near-coincident assembled nodes from two registered parts.

Parameters:

Name Type Description Default
meshpart_master str

Retained mesh-part name.

required
meshpart_slave str

Constrained mesh-part name.

required
dofs list[int]

One-based DOF numbers valid for both definitions.

required
tol float

Maximum nearest-neighbor distance in model length units.

1e-05

Returns:

Name Type Description
result None

Matching pairs are registered as EqualDOF objects.

Raises:

Type Description
ValueError

Assembly/parts/points are missing or requested DOFs are invalid.

Note

Each retained point searches its nearest constrained point. This is not a one-to-one matching guarantee or interpolated nonconforming interface. Unmatched points are skipped. Keep component nodes distinct when they are intended to be connected by these constraints.

add

add(constraint: MPConstraint) -> MPConstraint

Register an MP object and return it with a manager-assigned tag.

Parameters:

Name Type Description Default
constraint MPConstraint

Unmanaged object or one already owned here.

required

Raises:

Type Description
TypeError

Input is not an MPConstraint.

ValueError

Ownership or registry-tag conflict.

get

get(tag: int) -> Optional[MPConstraint]

Return an MP definition by integer-convertible registry tag, or None.

Parameters:

Name Type Description Default
tag int

Constraint registry key, not a retained/constrained node tag.

required

get_all

get_all() -> Dict[int, MPConstraint]

Return a shallow tag-to-constraint snapshot with shared object values.

remove

remove(tag: int) -> None

Detach one MP definition and compact surviving registry tags.

Parameters:

Name Type Description Default
tag int

Current constraint key; absent entries are ignored.

required

Node tags inside definitions are unchanged; process references are not repaired.

clear

clear() -> None

Detach all MP definitions and clear their registry tags.

SP supports, mesh connectivity, and files remain unchanged. No command is sent to an existing solver domain.

set_tag_start

set_tag_start(start_tag: int) -> None

Set the positive MP registry origin and retag existing definitions.

Parameters:

Name Type Description Default
start_tag int

Origin validated by the tagging policy.

required

Raises:

Type Description
ValueError

Invalid origin. Solver node references are not renumbered.

to_tcl

to_tcl() -> str

Concatenate registered coupling commands in registry insertion order.

Returns:

Name Type Description
commands str

Tcl text, or an empty string for an empty registry. Rendering does not enforce constraints or run the solver.