9.5. Nonlinear Time-History Animation

plotter.animate_nrha(control_nodes, acc, dts, nrha_disps, nrha_accels, drift_thresholds=None, export_path=None, frame_step=5, dpi=100, collapse_time=None, true_peak_drift=None, true_peak_accel=None)[source]

Animate the seismic response for a nonlinear time-history analysis (NRHA).

Four-panel layout (self.figsize_anim):

  • Panel 1: floor displacement profile [m] vs. elevation.

  • Panel 2: storey drift profile [%] vs. elevation (staircase style, matching plot_demand_profiles).

  • Panel 3: floor acceleration profile [g] vs. elevation.

  • Panel 4: input ground motion time-history with elapsed portion highlighted. If collapse_time is provided, an ‘X’ marker is drawn at that instant to indicate when the MinMax material limit was exceeded.

Line colours update cumulatively based on worst damage state reached so far (blue -> green -> yellow -> orange -> red) when drift_thresholds given.

Parameters:
  • control_nodes (array-like of int)

  • acc (array-like of float [g])

  • dts (array-like of float [s])

  • nrha_disps (ndarray (n_steps, n_nodes) [m])

  • nrha_accels (ndarray (n_steps, n_nodes) [m/s^2])

  • drift_thresholds (list of float or None)

  • export_path (str or None)

  • frame_step (int, optional) – Render every N-th timestep. Default 5.

  • dpi (int, optional) – Export resolution. Default 100.

  • collapse_time (float or None, optional) – Time [s] at which the MinMax material limit was exceeded (i.e. the last recorded timestep when conv_index turned -1). When provided, a red ‘X’ marker is drawn on the ground-motion panel at that instant.

  • true_peak_drift (ndarray (n_storeys,) or None, optional) – True peak IDR per storey [ratio] from the full-resolution time-step loop (peak_drift[:,0] from do_nrha_analysis). When provided the peak drift annotation shows this value instead of the subsampled max.

  • true_peak_accel (ndarray (n_nodes,) or None, optional) – True peak absolute floor acceleration per node [g] from the full- resolution loop (peak_accel[:,0] from do_nrha_analysis). When provided the peak accel annotation shows this value instead of the subsampled max.

Returns:

ani

Return type:

FuncAnimation

Example

from openquake.vmtk.plotter import plotter

# Usual route: ``do_nrha_analysis`` (and ``do_nrha_analysis_sequences``)
# call this method when ``save_animation_path`` is given
m.do_nrha_analysis(
    fnames, dt_gm, sf, t_max, dt_ansys,
    save_animation_path="nrha_animation.gif",
    drift_thresholds=[0.0015, 0.0030, 0.0045, 0.0135],
)

# Direct call, from arrays recorded during an NRHA
pl = plotter()
pl.animate_nrha(
    control_nodes=control_nodes,   # node tags, base first
    acc=acc,                       # input motion [g], one per frame
    dts=dts,                       # time of each frame [s]
    nrha_disps=nrha_disps,         # (n_frames, n_nodes) [m]
    nrha_accels=nrha_accels,       # (n_frames, n_nodes) [m/s2]
    drift_thresholds=[0.0015, 0.0030, 0.0045, 0.0135],
    export_path="nrha_animation.gif",
)