femlabpy.loads#

Load-vector utilities for nodal force tables.

Workflow role#

The functions in this module are intentionally small. They take the compact FemLab-style load matrix P and map it into the global right-hand side vector used by static, modal, and dynamic workflows.

Public entry points#

  • setload writes the supplied nodal loads into the target vector.

  • addload accumulates additional nodal loads without clearing previous entries.

Functions#

addload(p, P)

Add nodal loads from a load matrix P (accumulates, doesn't replace).

setload(p, P)

Set nodal loads from a load matrix P.

Function Reference#

femlabpy.loads.addload(p, P)[source]#

Add nodal loads from a load matrix P (accumulates, doesn’t replace).

Parameters:
pndarray, shape (ndof, 1)

Load vector (modified in place).

Parray_like, shape (nloads, dof+1)

Load matrix. Each row: [node, Fx, Fy, …].

Returns:
pndarray

Updated load vector.

See also

setload

Set loads (replaces existing values).

Examples

>>> p = addload(p, P)  # Adds to existing loads
femlabpy.loads.setload(p, P)[source]#

Set nodal loads from a load matrix P.

Replaces existing values in the load vector at specified nodes.

Parameters:
pndarray, shape (ndof, 1)

Load vector (modified in place).

Parray_like, shape (nloads, dof+1)

Load matrix. Each row: [node, Fx, Fy] for 2D or [node, Fx, Fy, Fz] for 3D. Node indices are 1-based.

Returns:
pndarray

Updated load vector.

Examples

>>> from femlabpy import init, setload
>>> K, p, q = init(nn=10, dof=2)
>>> # Apply forces: node 5 gets Fx=-100, Fy=0; node 10 gets Fx=0, Fy=-200
>>> P = np.array([
...     [5, -100, 0],
...     [10, 0, -200],
... ])
>>> p = setload(p, P)