DynaResp¶
Reproducible structural-dynamics simulation and synthetic dataset generation, with explicit control over which measurements and physical truth are retained.
DynaResp connects a structural model, a load, and a sensor layout through one simulation contract. The result includes measured signals, clean signals, state histories, matrices, modes, forces, configuration, and random seeds.
flowchart LR
S[Structural system] --> E[Simulation engine]
L[Load definition] --> E
M[Sensor layout] --> E
E --> R[SimulationResult]
R --> D[StructuralDataset]
D --> Z[Zarr]
D --> T[PyTorch]
D --> X[xarray / pandas]
First simulation¶
import numpy as np
import dynaresp as dr
time = np.arange(1000) / 100.0
positions = np.arange(3)
system = dr.systems.ShearBuilding(
masses=[1000.0, 900.0, 800.0],
stiffnesses=[1.0e6, 8.0e5, 6.0e5],
damping_ratio=0.02,
)
spec = dr.SimulationSpec(
system=system,
load=dr.loads.WhiteNoise(position=0, rms=10.0),
sensors=(
dr.sensors.Accelerometer(position=0),
dr.sensors.Accelerometer(
position=2,
noise=dr.sensors.GaussianNoise(snr_db=30.0),
),
),
time=time,
positions=positions,
)
result = dr.run_simulation(spec, seed=42)
result.signal
(2 sensors, 1000 samples)
result.displacement
(3 DOFs, 1000 samples)
result.force
(3 DOFs, 1000 samples)
result.mode_shapes
(3 modes, 3 positions)
The same workflow applies to matrix-defined MDOF systems and the simply supported finite-element beam. Loads generate a complete field on the supplied axes; the solver projects it into generalized coordinates.
Choose a path¶
-
Run your first response
Install the package, build a shear model, add sensors, and inspect every output array.
-
Model a structure
Choose assembled masses, direct matrices, a shear building, or the finite-element beam.
-
Generate ML-ready data
Sample physical parameters deterministically and write large datasets incrementally to Zarr.
-
Understand the architecture
Learn the coordinate conventions, array shapes, projection boundary, and reproducibility model.
Design commitments¶
- Physics stays inspectable. Simulations expose matrices, modes, state histories, forces, and clean signals; datasets retain the selected parts.
- Components stay composable. Systems, loads, sensors, and measurement effects have separate responsibilities.
- Randomness stays reproducible. Dataset samples derive their random state from the dataset seed and sample index, independent of worker count.
- Variability stays controllable. Exact cases and parameter grids support designed experiments without imposing a probability distribution.
- Storage stays scalable. Selected arrays are written incrementally to Zarr instead of accumulating the dataset in memory.
Physical scope
DynaResp currently models linear time-invariant dynamics. Beam models use two-node bending elements followed by modal reduction. Review the physical scope before using generated data as a model of a real structure.