Skip to content

Offshore Hydrodynamic Visualisation

Fluidmec provides engineering visualisation tools for fixed offshore jacket structures subjected to regular waves and prescribed steady currents.

Installation

pip install "fluidmec[visualization]"

Quick start

import numpy as np

from fluidmec.hydrodynamics import (
    generate_jacket,
    jacket_load_history,
)

from fluidmec.visualization import (
    plot_jacket_loading,
    plot_hydrodynamic_dashboard,
)

jacket = generate_jacket(
    depth=40,
    base_width=30,
    base_length=30,
)

result = jacket_load_history(
    jacket,
    time=np.linspace(0, 8, 256, endpoint=False),
    wave_height=2,
    period=8,
    current_velocity=1,
    wave_direction=30,
)

fig, ax = plot_jacket_loading(jacket, result)

fig.savefig("jacket_loading.png", dpi=300)

Available functionality

  • Three-dimensional jacket geometry.
  • Member force magnitude calculations.
  • Member overturning moment calculations.
  • Structural loading colour maps.
  • Member resultant force vectors.
  • Global structural load histories.
  • Signed structural group contributions.
  • Directional loading envelopes.
  • Spatial and temporal convergence studies.
  • Combined engineering dashboards.
  • Animated offshore hydrodynamic loading.

Physical conventions

Quantity Unit
Length m
Time s
Velocity m/s
Acceleration m/s²
Force N
Moment N m
Density kg/m³
Wave direction degrees
Phase offset radians

The vertical coordinate is positive upwards, with the mean water surface at z = 0.

Wave direction is measured from positive x towards positive y.

Plots may display forces in kN or MN and moments in MN m.

Member force magnitude

The resultant member force is

\[ F = \sqrt{F_x^2 + F_y^2 + F_z^2}. \]

Member loading plots use a fixed colour scale based on the maximum member force across the supplied time history.

Overturning moment

The horizontal overturning moment magnitude is

\[ M_{\mathrm{OT}} = \sqrt{M_x^2 + M_y^2}. \]

Structural group contributions are projected onto the global horizontal moment direction at the critical loading time.

Negative contributions represent opposing moments.

Numerical convergence

Spatial quadrature and temporal sampling are varied independently against a highly resolved numerical reference.

The relative percentage error is

\[ \epsilon_N = 100\frac{|Q_N-Q_{\mathrm{ref}}|} {|Q_{\mathrm{ref}}|}. \]

Numerical convergence does not establish experimental accuracy.

Assumptions and limitations

  • Fixed rigid structural members.
  • Linear regular-wave kinematics.
  • Morison-equation hydrodynamic loading.
  • Prescribed steady current interaction.
  • No structural deformation or dynamic response.
  • No wake shielding or diffraction modelling.
  • Force arrows originate at illustrative member midpoints.
  • Structural centre lines do not represent cylinder surfaces.
  • Directional envelopes depend on angular sampling resolution.
  • Closed polar plots assume a complete directional sweep.
  • Animations display precomputed numerical results.
  • Numerical convergence is not experimental validation.

API reference

Numerical data processing

fluidmec.visualization.hydrodynamic_data

Numerical data processing for hydrodynamic visualisation.

member_force_magnitudes

member_force_magnitudes(forces: ArrayLike) -> np.ndarray

Calculate resultant member force magnitudes in N.

Source code in src/fluidmec/visualization/hydrodynamic_data.py
25
26
27
28
29
30
31
32
33
34
def member_force_magnitudes(
    forces: ArrayLike,
) -> np.ndarray:
    """Calculate resultant member force magnitudes in N."""
    vectors = _vector_history(forces, "Forces")

    return np.hypot(
        np.hypot(vectors[..., 0], vectors[..., 1]),
        vectors[..., 2],
    )

member_moment_magnitudes

member_moment_magnitudes(moments: ArrayLike) -> np.ndarray

Calculate horizontal overturning magnitudes in N m.

Source code in src/fluidmec/visualization/hydrodynamic_data.py
37
38
39
40
41
42
43
44
45
46
def member_moment_magnitudes(
    moments: ArrayLike,
) -> np.ndarray:
    """Calculate horizontal overturning magnitudes in N m."""
    vectors = _vector_history(moments, "Moments")

    return np.hypot(
        vectors[..., 0],
        vectors[..., 1],
    )

hydrodynamic_convergence_data

hydrodynamic_convergence_data(jacket, *, wave_height, period, spatial_points=(4, 8, 16, 32, 64), temporal_samples=(16, 32, 64, 128, 256, 512), reference_points=128, reference_samples=1024, **parameters)

Evaluate spatial and temporal load convergence.

Spatial and temporal resolutions are varied independently against a highly resolved numerical reference solution.

Source code in src/fluidmec/visualization/hydrodynamic_data.py
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
def hydrodynamic_convergence_data(
    jacket,
    *,
    wave_height,
    period,
    spatial_points=(4, 8, 16, 32, 64),
    temporal_samples=(16, 32, 64, 128, 256, 512),
    reference_points=128,
    reference_samples=1024,
    **parameters,
):
    """Evaluate spatial and temporal load convergence.

    Spatial and temporal resolutions are varied independently
    against a highly resolved numerical reference solution.
    """
    from fluidmec.hydrodynamics import jacket_load_history

    def validate_resolution(values):
        array = np.asarray(values, dtype=float)

        if (
            array.ndim != 1
            or array.size == 0
            or not np.all(np.isfinite(array))
            or np.any(array < 2)
            or np.any(array != np.floor(array))
        ):
            raise ValueError("Resolutions must be integers of at least two.")

        return array.astype(int)

    spatial = validate_resolution(spatial_points)
    temporal = validate_resolution(temporal_samples)

    reference_points, reference_samples = validate_resolution(
        [reference_points, reference_samples]
    )

    if reference_points < spatial.max():
        raise ValueError("Insufficient spatial reference resolution.")

    if reference_samples < temporal.max():
        raise ValueError("Insufficient temporal reference resolution.")

    if not np.isfinite(period) or period <= 0:
        raise ValueError("Period must be positive and finite.")

    def evaluate(points, samples):
        time = np.linspace(
            0,
            period,
            samples,
            endpoint=False,
        )

        result = jacket_load_history(
            jacket,
            wave_height=wave_height,
            period=period,
            time=time,
            points=int(points),
            **parameters,
        )

        return np.array(
            [
                np.max(result["base_shear"]),
                np.max(result["overturning"]),
            ]
        )

    reference = evaluate(
        reference_points,
        reference_samples,
    )

    spatial_loads = np.array(
        [evaluate(points, reference_samples) for points in spatial]
    )

    temporal_loads = np.array(
        [evaluate(reference_points, samples) for samples in temporal]
    )

    def relative_error(values):
        difference = np.abs(values - reference)

        error = np.full_like(difference, np.nan)

        np.divide(
            difference * 100,
            np.abs(reference),
            out=error,
            where=reference != 0,
        )

        return np.where(
            (reference == 0) & (difference == 0),
            0,
            error,
        )

    return {
        "reference": {
            "points": int(reference_points),
            "samples": int(reference_samples),
            "base_shear": reference[0],
            "overturning": reference[1],
        },
        "spatial": {
            "resolution": spatial,
            "base_shear": spatial_loads[:, 0],
            "overturning": spatial_loads[:, 1],
            "error_percent": relative_error(spatial_loads),
        },
        "temporal": {
            "resolution": temporal,
            "base_shear": temporal_loads[:, 0],
            "overturning": temporal_loads[:, 1],
            "error_percent": relative_error(temporal_loads),
        },
    }

Engineering plots

fluidmec.visualization.hydrodynamic_plots

Engineering plots for offshore hydrodynamic loading.

plot_jacket_geometry

plot_jacket_geometry(jacket, *, ax=None)

Plot jacket centre lines by structural group.

Source code in src/fluidmec/visualization/hydrodynamic_plots.py
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
def plot_jacket_geometry(jacket, *, ax=None):
    """Plot jacket centre lines by structural group."""
    from matplotlib.lines import Line2D

    fig, ax = _setup_3d(jacket, ax)

    members, segments = _geometry(jacket)

    groups = {}

    for member, segment in zip(members, segments):
        group = member["group"]

        colour = _GROUP_COLOURS.get(group, "#777777")

        ax.plot(
            *segment.T,
            color=colour,
            linewidth=1.5 + member["diameter"] * 0.6,
        )

        groups[group] = colour

    handles = [
        Line2D(
            [0],
            [0],
            color=colour,
            linewidth=3,
            label=group,
        )
        for group, colour in groups.items()
    ]

    ax.legend(handles=handles, loc="upper left")
    ax.set_title("Offshore jacket geometry")

    return fig, ax

plot_jacket_loading

plot_jacket_loading(jacket, result, *, frame=None, cmap='viridis', ax=None, colorbar=True)

Colour members by resultant force magnitude in kN.

Source code in src/fluidmec/visualization/hydrodynamic_plots.py
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
def plot_jacket_loading(
    jacket,
    result,
    *,
    frame=None,
    cmap="viridis",
    ax=None,
    colorbar=True,
):
    """Colour members by resultant force magnitude in kN."""
    from matplotlib.cm import ScalarMappable
    from matplotlib.colors import Normalize

    plt = get_pyplot()

    fig, ax = _setup_3d(jacket, ax)

    members, segments = _geometry(jacket)

    forces = _member_forces(jacket, result)
    magnitudes = member_force_magnitudes(forces) / 1000

    frame = _frame_index(result, frame)

    maximum = float(np.max(magnitudes))
    norm = Normalize(0, maximum if maximum > 0 else 1)

    colourmap = plt.get_cmap(cmap)

    for member, segment, value in zip(
        members,
        segments,
        magnitudes[:, frame],
    ):
        ax.plot(
            *segment.T,
            color=colourmap(norm(value)),
            linewidth=2 + member["diameter"] * 0.7,
        )

    if colorbar:
        mapper = ScalarMappable(
            norm=norm,
            cmap=colourmap,
        )

        mapper.set_array([])

        fig.colorbar(
            mapper,
            ax=ax,
            shrink=0.65,
            pad=0.10,
            label="Member resultant force (kN)",
        )

    ax.set_title(f"Member loading at t = {result['time'][frame]:.3f} s")

    return fig, ax

plot_member_force_vectors

plot_member_force_vectors(jacket, result, *, frame=None, arrow_fraction=0.18, ax=None)

Plot scaled member resultant force vectors.

Arrows originate at member midpoints for illustration. They do not represent exact centres of pressure.

Source code in src/fluidmec/visualization/hydrodynamic_plots.py
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
def plot_member_force_vectors(
    jacket,
    result,
    *,
    frame=None,
    arrow_fraction=0.18,
    ax=None,
):
    """Plot scaled member resultant force vectors.

    Arrows originate at member midpoints for illustration.
    They do not represent exact centres of pressure.
    """
    if not np.isfinite(arrow_fraction) or arrow_fraction <= 0:
        raise ValueError("Arrow fraction must be positive.")

    fig, ax = plot_jacket_geometry(jacket, ax=ax)

    _, segments = _geometry(jacket)

    forces = _member_forces(jacket, result)
    frame = _frame_index(result, frame)

    centres = segments.mean(axis=1)

    maximum = np.max(member_force_magnitudes(forces))

    extent = np.ptp(segments.reshape(-1, 3), axis=0)
    length = float(np.max(extent))

    if maximum > 0:
        vectors = forces[:, frame, :] / maximum * length * arrow_fraction

        ax.quiver(
            *centres.T,
            *vectors.T,
            color="#D1495B",
            normalize=False,
            arrow_length_ratio=0.22,
            linewidth=1.4,
        )

    ax.set_title(f"Resultant force vectors | t = {result['time'][frame]:.3f} s")

    return fig, ax

plot_structure_load_history

plot_structure_load_history(result, *, quantity='overturning', ax=None)

Plot a global structural loading history.

Source code in src/fluidmec/visualization/hydrodynamic_plots.py
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
def plot_structure_load_history(
    result,
    *,
    quantity="overturning",
    ax=None,
):
    """Plot a global structural loading history."""
    quantities = {
        "base_shear": ("Base shear", "MN", 1e6),
        "overturning": ("Overturning moment", "MN m", 1e6),
        "vertical_force": ("Vertical force", "MN", 1e6),
        "torsion": ("Torsional moment", "MN m", 1e6),
    }

    if quantity not in quantities:
        raise ValueError("Unknown load quantity.")

    fig, ax = _setup_2d(ax)

    title, unit, scale = quantities[quantity]

    time = np.asarray(result["time"])
    values = np.asarray(result[quantity]) / scale

    index = int(np.argmax(np.abs(values)))

    ax.plot(time, values, linewidth=1.8)

    ax.scatter(
        time[index],
        values[index],
        color="#D1495B",
        zorder=4,
        label=f"Peak |Q| = {abs(values[index]):.3f} {unit}",
    )

    ax.axhline(0, color="grey", linewidth=0.7)

    ax.set_xlabel("Time (s)")
    ax.set_ylabel(f"{title} ({unit})")
    ax.set_title(title)
    ax.grid(alpha=0.25)
    ax.legend()

    return fig, ax

plot_group_contributions

plot_group_contributions(result, *, ax=None)

Plot signed group contributions at peak overturning.

Source code in src/fluidmec/visualization/hydrodynamic_plots.py
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
def plot_group_contributions(result, *, ax=None):
    """Plot signed group contributions at peak overturning."""
    fig, ax = _setup_2d(ax)

    index = int(np.argmax(result["overturning"]))

    total = np.asarray(result["total"]["total_moment"])[index, :2]

    magnitude = np.hypot(*total)

    direction = total / magnitude if magnitude > 0 else np.zeros(2)

    names = list(result["groups"])

    contributions = (
        np.array(
            [
                np.dot(
                    result["groups"][name]["total_moment"][index, :2],
                    direction,
                )
                for name in names
            ]
        )
        / 1e6
    )

    bars = ax.bar(
        names,
        contributions,
        color=[_GROUP_COLOURS.get(name, "#777777") for name in names],
    )

    ax.bar_label(bars, fmt="%.3f", padding=3)
    ax.axhline(0, color="grey", linewidth=0.8)

    ax.set_ylabel("Projected moment (MN m)")
    ax.set_title("Group contributions at global peak")
    ax.grid(axis="y", alpha=0.25)

    return fig, ax

plot_directional_envelope

plot_directional_envelope(envelope, *, quantity='overturning', close=True, ax=None)

Plot a directional peak-load envelope.

Source code in src/fluidmec/visualization/hydrodynamic_plots.py
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
def plot_directional_envelope(
    envelope,
    *,
    quantity="overturning",
    close=True,
    ax=None,
):
    """Plot a directional peak-load envelope."""
    plt = get_pyplot()

    if quantity not in ("base_shear", "overturning"):
        raise ValueError("Unknown envelope quantity.")

    directions = np.asarray(
        envelope["directions"],
        dtype=float,
    )

    values = (
        np.asarray(
            envelope["peaks"][quantity],
            dtype=float,
        )
        / 1e6
    )

    if (
        directions.ndim != 1
        or directions.size == 0
        or directions.shape != values.shape
        or not np.all(np.isfinite(directions))
        or not np.all(np.isfinite(values))
        or np.any(values < 0)
    ):
        raise ValueError("Invalid directional envelope.")

    order = np.argsort(directions % 360)

    angles = np.deg2rad(directions[order] % 360)
    values = values[order]

    critical = int(np.argmax(values))

    if ax is None:
        fig, ax = plt.subplots(
            figsize=(8, 8),
            subplot_kw={"projection": "polar"},
        )
    else:
        fig = ax.figure

    if close:
        plot_angles = np.r_[angles, angles[0] + 2 * np.pi]
        plot_values = np.r_[values, values[0]]
    else:
        plot_angles = angles
        plot_values = values

    ax.plot(plot_angles, plot_values, linewidth=2)

    ax.scatter(
        angles[critical],
        values[critical],
        color="#D1495B",
        label=f"Critical: {np.rad2deg(angles[critical]):.1f}°",
        zorder=4,
    )

    ax.set_theta_zero_location("E")
    ax.set_theta_direction(1)

    unit = "MN" if quantity == "base_shear" else "MN m"

    ax.set_title(
        f"Directional {quantity.replace('_', ' ')} ({unit})",
        pad=20,
    )

    ax.legend(loc="lower center", bbox_to_anchor=(0.5, -0.2))

    return fig, ax

plot_load_convergence

plot_load_convergence(data, *, study='spatial', ax=None)

Plot numerical convergence errors.

Source code in src/fluidmec/visualization/hydrodynamic_plots.py
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
def plot_load_convergence(
    data,
    *,
    study="spatial",
    ax=None,
):
    """Plot numerical convergence errors."""
    if study not in ("spatial", "temporal"):
        raise ValueError("Unknown convergence study.")

    fig, ax = _setup_2d(ax)

    resolution = data[study]["resolution"]
    errors = data[study]["error_percent"]

    ax.plot(
        resolution,
        errors[:, 0],
        "o-",
        label="Base shear",
    )

    ax.plot(
        resolution,
        errors[:, 1],
        "s-",
        label="Overturning moment",
    )

    ax.set_xscale("log", base=2)

    # Retain genuine zero errors without inventing a floor.
    ax.set_yscale("symlog", linthresh=1e-8)

    ax.set_xlabel("Quadrature points" if study == "spatial" else "Samples per period")

    ax.set_ylabel("Relative error (%)")
    ax.set_title(f"{study.capitalize()} convergence")
    ax.grid(True, which="both", alpha=0.25)
    ax.legend()

    return fig, ax

plot_hydrodynamic_dashboard

plot_hydrodynamic_dashboard(jacket, result, *, envelope=None, convergence=None)

Create a coordinated six-panel engineering dashboard.

Source code in src/fluidmec/visualization/hydrodynamic_plots.py
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
def plot_hydrodynamic_dashboard(
    jacket,
    result,
    *,
    envelope=None,
    convergence=None,
):
    """Create a coordinated six-panel engineering dashboard."""
    plt = get_pyplot()

    fig = plt.figure(
        figsize=(20, 15),
        layout="constrained",
    )

    axes = [
        fig.add_subplot(231, projection="3d"),
        fig.add_subplot(232, projection="polar"),
        fig.add_subplot(233),
        fig.add_subplot(234),
        fig.add_subplot(235),
        fig.add_subplot(236),
    ]

    plot_jacket_loading(
        jacket,
        result,
        ax=axes[0],
    )

    if envelope is not None:
        plot_directional_envelope(
            envelope,
            ax=axes[1],
        )
    else:
        axes[1].set_axis_off()
        axes[1].text(
            0.5,
            0.5,
            "Directional envelope not supplied",
            transform=axes[1].transAxes,
            ha="center",
        )

    plot_structure_load_history(
        result,
        quantity="base_shear",
        ax=axes[2],
    )

    plot_structure_load_history(
        result,
        quantity="overturning",
        ax=axes[3],
    )

    plot_group_contributions(
        result,
        ax=axes[4],
    )

    if convergence is not None:
        plot_load_convergence(
            convergence,
            ax=axes[5],
        )
    else:
        axes[5].set_axis_off()
        axes[5].text(
            0.5,
            0.5,
            "Convergence data not supplied",
            transform=axes[5].transAxes,
            ha="center",
        )

    fig.suptitle(
        "FLUIDMEC | OFFSHORE HYDRODYNAMICS\n"
        f"{len(jacket['members'])} members | "
        f"Water depth: {jacket['depth']:.1f} m | "
        f"Peak shear: {np.max(result['base_shear']) / 1e6:.3f} MN | "
        f"Peak moment: {np.max(result['overturning']) / 1e6:.3f} MN m",
        fontsize=17,
        fontweight="bold",
    )

    return fig, axes

Animation

fluidmec.visualization.hydrodynamic_animation

Animated offshore hydrodynamic visualisations.

animate_jacket_loading

animate_jacket_loading(jacket, result, *, wave_height, period, wave_direction=0.0, phase_offset=0.0, gravity=9.81, frames=120, fps=20, cmap='turbo', rotate=True)

Animate jacket loading and simultaneous load histories.

Wave direction is measured in degrees from positive x towards positive y. Phase offset is in radians.

The animation displays precomputed hydrodynamic results. The wave surface is illustrative linear wave kinematics.

Source code in src/fluidmec/visualization/hydrodynamic_animation.py
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
def animate_jacket_loading(
    jacket,
    result,
    *,
    wave_height,
    period,
    wave_direction=0.0,
    phase_offset=0.0,
    gravity=9.81,
    frames=120,
    fps=20,
    cmap="turbo",
    rotate=True,
):
    """Animate jacket loading and simultaneous load histories.

    Wave direction is measured in degrees from positive x
    towards positive y. Phase offset is in radians.

    The animation displays precomputed hydrodynamic results.
    The wave surface is illustrative linear wave kinematics.
    """
    from matplotlib.cm import ScalarMappable
    from matplotlib.colors import Normalize

    plt = get_pyplot()
    animation = get_animation()

    if not isinstance(frames, int) or frames < 2 or not np.isfinite(fps) or fps <= 0:
        raise ValueError("Invalid animation resolution.")

    if (
        not np.isfinite(wave_height)
        or wave_height < 0
        or not np.isfinite(period)
        or period <= 0
        or not np.isfinite(wave_direction)
        or not np.isfinite(phase_offset)
    ):
        raise ValueError("Invalid wave parameters.")

    members, segments = _geometry(jacket)

    forces = _member_forces(jacket, result)

    magnitudes = member_force_magnitudes(forces) / 1000

    time = np.asarray(result["time"], dtype=float)

    if (
        time.ndim != 1
        or time.size < 2
        or not np.all(np.isfinite(time))
        or np.any(np.diff(time) <= 0)
    ):
        raise ValueError("Invalid animation time history.")

    indices = np.unique(np.linspace(0, len(time) - 1, frames).astype(int))

    maximum = float(np.max(magnitudes))

    norm = Normalize(
        0,
        maximum if maximum > 0 else 1,
    )

    colourmap = plt.get_cmap(cmap)

    fig = plt.figure(
        figsize=(16, 9),
        layout="constrained",
    )

    grid = fig.add_gridspec(2, 3)

    ax3d = fig.add_subplot(
        grid[:, :2],
        projection="3d",
    )

    ax_shear = fig.add_subplot(grid[0, 2])
    ax_moment = fig.add_subplot(grid[1, 2])

    shear = np.asarray(result["base_shear"]) / 1e6
    moment = np.asarray(result["overturning"]) / 1e6

    ax_shear.plot(time, shear, color="#2878B5")
    ax_moment.plot(time, moment, color="#D1495B")

    shear_cursor = ax_shear.axvline(time[0], color="black")
    moment_cursor = ax_moment.axvline(time[0], color="black")

    (shear_point,) = ax_shear.plot([time[0]], [shear[0]], "o", color="#2878B5")

    (moment_point,) = ax_moment.plot([time[0]], [moment[0]], "o", color="#D1495B")

    ax_shear.set_ylabel("Base shear (MN)")
    ax_moment.set_ylabel("Overturning moment (MN m)")

    for axis in (ax_shear, ax_moment):
        axis.set_xlabel("Time (s)")
        axis.grid(alpha=0.25)

    coordinates = segments.reshape(-1, 3)

    extent = max(
        float(np.max(np.ptp(coordinates, axis=0))),
        1.0,
    )

    x = np.linspace(
        coordinates[:, 0].min() - extent * 0.15,
        coordinates[:, 0].max() + extent * 0.15,
        35,
    )

    y = np.linspace(
        coordinates[:, 1].min() - extent * 0.15,
        coordinates[:, 1].max() + extent * 0.15,
        35,
    )

    X, Y = np.meshgrid(x, y)

    k = solve_wave_number(
        period,
        jacket["depth"],
        gravity,
    )

    omega = 2 * np.pi / period
    direction = np.deg2rad(wave_direction)

    spatial_phase = k * (X * np.cos(direction) + Y * np.sin(direction))

    centres = segments.mean(axis=1)

    mapper = ScalarMappable(
        norm=norm,
        cmap=colourmap,
    )

    mapper.set_array([])

    fig.colorbar(
        mapper,
        ax=ax3d,
        shrink=0.65,
        label="Member resultant force (kN)",
    )

    def update(frame):
        index = int(indices[frame])
        t = time[index]

        ax3d.clear()

        _setup_3d(jacket, ax3d)

        for member, segment, value in zip(
            members,
            segments,
            magnitudes[:, index],
        ):
            ax3d.plot(
                *segment.T,
                color=colourmap(norm(value)),
                linewidth=2 + member["diameter"] * 0.7,
            )

        surface = wave_height / 2 * np.cos(spatial_phase - omega * t + phase_offset)

        ax3d.plot_surface(
            X,
            Y,
            surface,
            color="#329BC2",
            alpha=0.20,
            linewidth=0,
            shade=False,
        )

        ax3d.plot_surface(
            X,
            Y,
            np.full_like(X, -jacket["depth"]),
            color="#B5A68B",
            alpha=0.15,
            linewidth=0,
        )

        if maximum > 0:
            vectors = forces[:, index, :] / (maximum * 1000) * extent * 0.14

            ax3d.quiver(
                *centres.T,
                *vectors.T,
                color="#D1495B",
                normalize=False,
                arrow_length_ratio=0.22,
                linewidth=1.1,
            )

        azimuth = -55 + 360 * frame / len(indices) if rotate else -55

        ax3d.view_init(
            elev=22,
            azim=azimuth,
        )

        shear_cursor.set_xdata([t, t])
        moment_cursor.set_xdata([t, t])

        shear_point.set_data([t], [shear[index]])
        moment_point.set_data([t], [moment[index]])

        ax3d.set_title(
            f"Time: {t:.2f} s | "
            f"Shear: {shear[index]:.3f} MN\n"
            f"Overturning: {moment[index]:.3f} MN m"
        )

        fig.suptitle(
            "FLUIDMEC | DYNAMIC OFFSHORE LOADING",
            fontsize=16,
            fontweight="bold",
        )

        return ()

    movie = animation.FuncAnimation(
        fig,
        update,
        frames=len(indices),
        interval=1000 / fps,
        blit=False,
        cache_frame_data=False,
    )

    return fig, movie