Loads¶
Every load has the same system-independent interface. Pass axes directly for an explicit, reusable call:
history = load.generate(time=time, positions=positions, seed=42)
history.time # caller-supplied time axis
history.positions # caller-supplied position axis
history.values # shape: (n_positions, n_times)
Fixed loads use one position argument for both MDOF systems and beams:
history.values places each point force at the nearest point on positions
for plotting and storage. The exact coordinates are retained in
history.point_forces; simulation uses those coordinates instead of the
nearest-grid approximation. Consequently, a two-wheel diagnostic field
contains at most two nonzero spatial samples in each time column without
making the physical response depend on grid resolution.
vehicle = loads.TwoWheelLoad(
front_load=-4000.0,
rear_load=-3500.0,
speed=2.5,
wheel_spacing=1.25,
)
time = np.arange(600) / 200
positions = np.linspace(0.0, 5.0, 101)
history = vehicle.generate(time, positions)
Moving, two-wheel, and runner trajectories require a system with a continuous
position domain, currently Beam. MDOF systems use discrete integer DOF
indices; apply fixed-position loads to those indices instead of interpolating
a moving trajectory between them.
Available loads are WhiteNoise, Harmonic, Impulse, Chirp,
TimeSeries, MovingLoad, TwoWheelLoad, RunnerLoad, and FunctionLoad.
Loads can be added; their fields are summed on the same axes.
Custom functions receive the axes and a random generator:
def force(inputs: loads.ForceInput) -> np.ndarray:
spatial = np.sin(np.pi * inputs.positions / inputs.positions[-1])
temporal = np.sin(2 * np.pi * 2.0 * inputs.time)
return spatial[:, None] * temporal[None, :]
custom = loads.FunctionLoad(force)
Function loads are distributed grid fields and are projected from the supplied
positions. Custom exact forces can instead return a LoadHistory with
PointForceComponent entries. Set distributed_values to the independently
projectable grid field, or to a zero field when the history contains point
forces only. values is derived as the complete nearest-grid diagnostic shown
to users and stored in datasets.