Skip to content

node_load

node_load

Attributes

__all__ module-attribute

__all__ = ['NodeLoad']

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.

NodeLoad

NodeLoad(*, values: List[float], node_tag: Optional[int] = None, node_mask: Optional[object] = None, pids: Optional[List[int]] = None)

Bases: Load

Nodal load component for applying forces or moments to nodes.

NodeLoad represents a node-based load applied directly to a node's degrees of freedom. It is typically registered under a Plain pattern to represent external static or dynamic excitations.

Tcl form

load <nodeTag> <value1> <value2> ...

Note
  • The number of specified load values should match the number of degrees of freedom (NDF) at the target node.
  • If a node_mask is provided, the load will be automatically expanded and applied to all selected nodes.
  • In parallel computing contexts, partition IDs (pids) specify which processor core(s) should execute the command.
Example
from femora.core.model import Model

model = Model()
ts = model.time_series.constant(factor=1.0)
pattern = model.pattern.plain(time_series=ts)

# Apply a force of 5.0 in X and -10.0 in Y to node 1
load = pattern.add_load.node(
    node_tag=1,
    values=[5.0, -10.0],
)

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 Optional[int]

Optional explicit tag of the target node.

None
node_mask Optional[object]

Optional NodeMask object to apply the load to multiple nodes.

None
pids Optional[List[int]]

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.

Methods:
to_tcl
to_tcl() -> str

Render this load component as OpenSees Tcl commands.

Returns:

Type Description
str

The OpenSees load command string(s) for the node(s).

Functions:

_coerce_positive_int

_coerce_positive_int(value: Any, field: str) -> int

Coerce a value to a positive integer.

Parameters:

Name Type Description Default
value Any

The value to be converted.

required
field str

The name of the field being validated (for error messages).

required

Returns:

Type Description
int

The validated positive integer.

Raises:

Type Description
ValueError

If the value cannot be converted to a positive integer or is less than 1.

_coerce_load_values

_coerce_load_values(values: Any) -> List[float]

Coerce input load values to a list of floats.

Parameters:

Name Type Description Default
values Any

The load values (list or tuple) to be validated.

required

Returns:

Type Description
List[float]

A list of validated float values.

Raises:

Type Description
ValueError

If the input is not a non-empty list or tuple of numeric values.

_coerce_pids

_coerce_pids(pids: Any) -> List[int]

Coerce partition IDs to a sorted list of unique integers.

Parameters:

Name Type Description Default
pids Any

The partition IDs (list or tuple) to be validated.

required

Returns:

Type Description
List[int]

A sorted list of unique validated integers.

Raises:

Type Description
ValueError

If the input is not a list or tuple of integer values.