Skip to content

load_base

load_base

Attributes

__all__ module-attribute

__all__ = ['Load', 'LoadManager']

Classes

Load

Load()

Bases: ABC

Base class for OpenSees load commands emitted inside a pattern Plain block.

Load instances do not self-register. A :class:LoadManager owns tag assignment and lifecycle for a single model context.

Methods:
to_tcl abstractmethod
to_tcl() -> str

Render a command intended for the containing Plain pattern block.

Returns:

Name Type Description
command str

Concrete load syntax. This abstract contract neither supplies a time series nor opens a pattern or runs the solver.

LoadManager

LoadManager(mesh_maker: Model)

Create load commands through model.load for attachment to Plain patterns.

A load describes nodal forces, element loading, or prescribed motion. Its time variation comes from the containing pattern's time series. Registering a load alone neither attaches it to a pattern nor applies it to the solver.

Example
from femora import Model

model = Model()
load = model.load.node(node_tag=1, values=[0.0, 0.0, -10.0])
series = model.time_series.constant()
gravity = model.pattern.plain(series)
gravity.add_load_instance(load)
model.process.add_step(gravity, "Apply gravity")
assert "pattern Plain" in model.process.to_tcl()

The example demonstrates definitions and command ordering; node 1 must exist with a compatible DOF layout in a real assembled model. Mass is not created by a force load, and assigning mass does not automatically create weight.

Methods:
add
add(load: Load) -> Load

Register a load and return the same object with a local registry tag.

Parameters:

Name Type Description Default
load Load

Unmanaged object or one already owned here.

required

Raises:

Type Description
TypeError

Input is not a Load.

ValueError

Foreign ownership or tag conflict.

A registry tag is not the loaded node/element tag or the pattern tag.

node
node(*, values: list[float], node_tag: int | None = None, node_mask: object | None = None, pids: list[int] | None = None) -> NodeLoad

Create a nodal load component.

Parameters:

Name Type Description Default
values list[float]

Nodal force or moment values corresponding to the active degrees of freedom (DOFs) at the node.

required
node_tag int | None

Optional explicit tag of the target node.

None
node_mask object | None

Optional NodeMask object to apply the load to multiple nodes.

None
pids list[int] | None

Optional processor partition IDs for parallel executions.

None

Raises:

Type Description
ValueError

If neither node_tag nor node_mask is specified, if node_mask is not a NodeMask instance, or if any input parameter fails validation.

Returns:

Name Type Description
component NodeLoad

Registered definition; no solver is launched.

element
element(*, kind: str, params: dict[str, float], ele_tags: list[int] | None = None, ele_range: tuple[int, int] | None = None, element_mask: object | None = None, pid: int | None = None) -> ElementLoad

Create an element load component.

Parameters:

Name Type Description Default
kind str

Type of element load. Must be either 'beamUniform' or 'beamPoint'.

required
params dict[str, float]

Dictionary of load parameters. For 'beamUniform': Wy (required), Wz (optional), Wx (optional). For 'beamPoint': Py (required), xL (required, relative distance from node I), Pz (optional), Px (optional).

required
ele_tags list[int] | None

Optional list of explicit element tags.

None
ele_range tuple[int, int] | None

Optional tuple of (start, end) element tags defining a range.

None
element_mask object | None

Optional ElementMask object to apply the load to.

None
pid int | None

Optional processor partition ID for parallel execution.

None

Raises:

Type Description
ValueError

If constructor arguments are invalid or conflict.

Returns:

Name Type Description
component ElementLoad

Registered definition; no solver is launched.

sp
sp(*, dof: int, value: float, node_tag: int | None = None, node_mask: object | None = None, pids: list[int] | None = None) -> SpLoad

Create a single-point load component.

Parameters:

Name Type Description Default
dof int

1-indexed degree of freedom (DOF) to apply the value to.

required
value float

Numerical value of the applied single-point excitation.

required
node_tag int | None

Optional explicit tag of the target node.

None
node_mask object | None

Optional NodeMask object to apply this load to multiple nodes.

None
pids list[int] | None

Optional processor partition IDs for parallel execution.

None

Raises:

Type Description
ValueError

If neither node_tag nor node_mask is specified, if node_mask is not a NodeMask, or if input validation fails.

Returns:

Name Type Description
component SpLoad

Registered definition; no solver is launched.

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

Return a load by integer-convertible registry tag, or None if absent.

get_all
get_all() -> Dict[int, Load]

Return a shallow tag-to-load snapshot; load objects remain shared.

remove
remove(tag: int) -> None

Detach a load, clear its pattern tag, and retag remaining loads.

Parameters:

Name Type Description Default
tag int

Current registry tag; absent entries are ignored.

required

This does not remove an existing object's reference from a PlainPattern or edit exported Tcl. Rebuild affected patterns after registry changes.

clear
clear() -> None

Detach all loads and clear their registry and pattern tags.

Patterns themselves remain registered and may still reference the old objects. This is not a coordinated whole-model or solver-domain reset.

set_tag_start
set_tag_start(start_tag: int) -> None

Set the positive load registry origin and retag existing loads.

Parameters:

Name Type Description Default
start_tag int

Origin validated by the tagging policy.

required

Raises:

Type Description
ValueError

Invalid origin. Loaded node/element tags are unchanged.