7. Water Waves#
Core ideas
Most waves that matter to civil engineers are gravity waves: gravity pulls the displaced surface back to its rest level. A regular wave is described by its height \(H\), period \(T\) and the water depth \(h\).
Linear (Airy) wave theory links period, wavelength and depth through the dispersion relation \(\omega^2 = g k \tanh(kh)\). Long-period waves travel faster, and in shallow water every wave travels at \(\sqrt{gh}\).
Wave energy per unit surface area is \(\rho g H^2/8\). It travels at the group velocity \(c_g = n c\), not at the speed of the crests.
Approaching the coast, waves change height by shoaling and direction by refraction, and they bend around structures by diffraction. Conservation of energy flux predicts these changes.
Waves break when they become too steep (\(H/L \approx 1/7\)) or too high for the depth (\(H_b \approx 0.78\,h_b\)). In shallow water, breaking often limits the design wave.
A small surface wave in a channel travels at \(\sqrt{gy}\). The Froude number of Chapter 6 compares the flow velocity with this speed, which is why disturbances cannot travel upstream in supercritical flow.
7.1 Types of water waves#
Water waves are disturbances of the free surface. They are classified by what creates them, what pulls the surface back (the restoring force), and their period:
Capillary waves (ripples), with wavelengths below about 1.7 cm and periods below 0.1 s. Surface tension (Chapter 1) is the restoring force. They are important for how wind starts to grow waves, but not for structures.
Wind waves, with periods of about 1 to 25 s, generated by wind blowing over a stretch of water called the fetch. While still under the wind they are short-crested and irregular and are called sea. After they leave the storm area they become longer, more regular swell, which can cross whole oceans.
Long waves: seiches (standing oscillations in harbors and lakes, minutes to hours), tsunamis (generated by earthquakes or landslides, periods of about 5 to 60 minutes), storm surges (a rise of sea level under a storm, hours to days) and tides (generated by the moon and sun, with periods of about half a day or one day).
For all except capillary waves the restoring force is gravity, so they are gravity waves. Wind waves load breakwaters, seawalls and offshore platforms; long waves set water levels, cause harbor resonance and flood low coasts. In a channel or river, a surge produced by a gate opening or closing is also a long wave (§7.9).
7.2 Describing a wave#
Consider a regular train of waves traveling in the \(x\) direction over a horizontal bed. In this chapter \(h\) is the still water depth, the depth from the still water level (SWL) to the bed, and \(z\) is measured upward from the SWL, so \(z = -h\) at the bed. (In Chapter 6 we used \(y\) for depth; we return to \(y\) in §7.9.) The quantities used to describe the wave are:
the wave height \(H\), the vertical distance from trough to crest, and the amplitude \(a = H/2\);
the wavelength \(L\), the horizontal distance between two successive crests;
the period \(T\), the time between two successive crests passing a fixed point;
the wave number \(k = 2\pi/L\) (rad m⁻¹) and the angular frequency \(\omega = 2\pi/T\) (rad s⁻¹);
the celerity (phase speed) \(c = L/T = \omega/k\), the speed at which the crests move;
the wave steepness \(H/L\) and the relative depth \(h/L\).
For a linear wave the surface elevation above the SWL is
Figure 7.1. A linear (sinusoidal) wave of height \(H = 2a\) and wavelength \(L\) traveling over still water depth \(h\). The crest is as far above the still water level (SWL) as the trough is below it. Vertical scale exaggerated.
7.3 Linear wave theory and the dispersion relation#
The simplest useful description of water waves is linear wave theory, also called small-amplitude or Airy wave theory after G. B. Airy (1845). It assumes that:
water is incompressible and inviscid, and the flow is irrotational;
the bed is horizontal and impermeable, and there is no current;
the wave height is small compared with both the wavelength and the depth (\(H/L \ll 1\), \(H/h \ll 1\)), so the boundary conditions can be applied at the SWL instead of at the moving surface.
With these assumptions the problem becomes linear and can be solved exactly. The solution gives the velocity, pressure and surface elevation everywhere, and one key condition linking \(\omega\), \(k\) and \(h\), the dispersion relation:
With \(c = \omega/k\), the celerity and wavelength are
The relation is called “dispersion” because waves of different periods travel at different speeds: a storm far away sends its long-period swell ahead of the shorter waves, so the waves arrive sorted by period.
Solving for \(L\). For a given \(T\) and \(h\), \(L\) appears on both sides, so we must solve numerically. Newton’s method on \(f(k) = g k \tanh(kh) - \omega^2\) converges in a few steps. A good starting value is the explicit approximation of Fenton and McKee (1990), \(L \approx L_0 \left[\tanh\left((2\pi h/L_0)^{3/4}\right)\right]^{2/3}\), which on its own is accurate to better than 2%. Here \(L_0 = gT^2/2\pi\) is the deep-water wavelength (§7.4).
def wavelength(T, h):
"""Wavelength (m) from linear wave theory, by Newton's method on k."""
w = 2 * np.pi / T
k0 = w**2 / g # deep-water wave number
k = k0 / np.tanh((k0 * h) ** 0.75) ** (2 / 3) # Fenton and McKee (1990) start
for _ in range(20):
f = g * k * np.tanh(k * h) - w**2
df = g * np.tanh(k * h) + g * k * h / np.cosh(k * h) ** 2
k = k - f / df
return 2 * np.pi / k
print(f"T = 8 s, h = 10 m: L = {wavelength(8.0, 10.0):.1f} m")
T = 8 s, h = 10 m: L = 70.9 m
Figure 7.2 shows the result for several depths. In deep water \(L\) grows with \(T^2\); in shallow water it grows only in proportion to \(T\), because all waves travel at the same speed.
Figure 7.2. Wavelength against period from the linear dispersion relation for four water depths. The dashed line is the deep-water wavelength \(L_0 = gT^2/2\pi\). Long waves in shallow water are much shorter than the same waves in deep water.
7.4 Deep, intermediate and shallow water#
The function \(\tanh(kh)\) has two simple limits, and they define three depth regimes.
Deep water, \(h/L > 1/2\). Then \(kh > \pi\) and \(\tanh(kh) > 0.996 \approx 1\). The wave does not feel the bed, and
with \(L_0\) in m, \(c_0\) in m s⁻¹ and \(T\) in s. The subscript 0 denotes deep water. A 10 s swell in the open ocean is 156 m long and travels at 15.6 m s⁻¹.
Shallow water, \(h/L < 1/20\). Then \(kh < \pi/10\) and \(\tanh(kh) \approx kh\), so
The speed depends only on depth, not on period: shallow-water waves are non-dispersive. Tides and tsunamis are shallow-water waves even in the deep ocean, because their wavelengths are hundreds of kilometers. At an ocean depth of 4000 m a tsunami travels at \(\sqrt{9.81 \times 4000} \approx 198\) m s⁻¹, about 710 km h⁻¹.
Intermediate depth, \(1/20 < h/L < 1/2\). The full expression must be used. Most wind waves near the coast, where engineers build, are in this range.
Quantity |
Shallow, \(h/L < 1/20\) |
Intermediate |
Deep, \(h/L > 1/2\) |
|---|---|---|---|
Celerity \(c\) |
\(\sqrt{gh}\) |
\(\dfrac{gT}{2\pi}\tanh kh\) |
\(\dfrac{gT}{2\pi}\) |
Wavelength \(L\) |
\(T\sqrt{gh}\) |
\(\dfrac{gT^2}{2\pi}\tanh kh\) |
\(\dfrac{gT^2}{2\pi}\) |
Group velocity \(c_g\) |
\(\sqrt{gh}\) |
\(n c\) |
\(c/2\) |
Ratio \(n\) |
1 |
\(\dfrac{1}{2}\left(1 + \dfrac{2kh}{\sinh 2kh}\right)\) |
1/2 |
Table 7.1. Linear wave theory in the three depth regimes. The limits \(h/L\) = 1/20 and 1/2 keep the error of the simple formulas for \(c\) and \(L\) below about 2% and 0.4%.
Table 7.1 summarizes the formulas; the group velocity \(c_g\) and the ratio \(n\) are explained in §7.6. Table 7.2 applies the full theory to an 8 s wave traveling from deep water toward the shore.
\(h\) (m) |
\(L\) (m) |
\(h/L\) |
\(c\) (m s⁻¹) |
\(c_g\) (m s⁻¹) |
Regime |
|---|---|---|---|---|---|
100 |
99.9 |
1.001 |
12.49 |
6.25 |
deep |
50 |
99.6 |
0.502 |
12.45 |
6.37 |
deep |
20 |
88.8 |
0.225 |
11.10 |
7.41 |
intermediate |
10 |
70.9 |
0.141 |
8.86 |
7.18 |
intermediate |
5 |
53.1 |
0.094 |
6.64 |
5.97 |
intermediate |
2 |
34.7 |
0.058 |
4.34 |
4.16 |
intermediate |
1 |
24.8 |
0.040 |
3.10 |
3.03 |
shallow |
Table 7.2. Wavelength, celerity and group velocity of a wave with period 8 s at several depths, from linear theory. The wave shortens and slows as the depth decreases, while the period stays the same. The group velocity first rises slightly and then falls.
7.5 Particle motion and pressure under a wave#
Water particles under a wave do not travel with the wave. In linear theory each particle moves around a closed orbit and returns to where it started; only the wave form and its energy travel. The horizontal and vertical velocities are
Particles move forward under the crest and backward under the trough. Integrating the velocities gives elliptical orbits with horizontal and vertical semi-axes
In deep water both reduce to \((H/2)\,e^{kz}\): the orbits are circles that shrink rapidly with depth. At \(z = -L/2\) the radius is only \(e^{-\pi} \approx 4\%\) of its surface value, which is why deep-water waves do not feel the bed. In intermediate and shallow water the orbits are ellipses that flatten with depth, and at the bed (\(z = -h\)) the motion is purely horizontal, a to-and-fro sliding. This near-bed velocity is what stirs up sediment on beaches and around structures (Chapter 8).
Figure 7.3. Water particle orbits (orange) at several depths under half a wavelength of a wave with steepness \(H/L\) = 0.08, drawn to scale. In deep water (left, \(h/L\) = 0.6) the orbits are circles that shrink rapidly with depth. In intermediate depth (right, \(h/L\) = 0.15) they are ellipses that become flat at the bed.
Pressure. The pressure under a wave is the hydrostatic pressure plus a dynamic part caused by the wave:
The pressure response factor \(K_p\) is 1 at the SWL and decreases with depth. A pressure sensor on the sea bed therefore records a damped version of the surface wave, and the measured pressure fluctuation must be divided by \(\rho g K_p\) to recover \(\eta\). Short waves are damped more than long ones, which limits how deep such a sensor can be placed.
7.6 Wave energy and group velocity#
A wave carries potential energy (water lifted into the crest from the trough) and kinetic energy (orbital motion). In linear theory the two are equal, and the total energy per unit surface area, averaged over a wavelength, is
Energy grows with the square of the height: doubling \(H\) quadruples \(E\). For a 2 m wave in sea water (\(\rho\) = 1025 kg m⁻³), \(E \approx\) 5.0 kJ m⁻².
The energy does not travel at the celerity \(c\). A group of waves moves at the group velocity
In deep water \(n = 1/2\), so a wave group moves at half the speed of its crests: individual crests appear at the back of the group, move through it and vanish at the front. In shallow water \(n = 1\) and the two speeds are equal. The rate at which energy is carried forward per unit length of crest is the energy flux or wave power
A deep-water swell with \(H\) = 2 m and \(T\) = 10 s carries about 39 kW per meter of crest. This energy flux is the starting point for shoaling (§7.7) and for wave energy converters.
7.7 Waves approaching the coast#
As waves move from deep water toward the shore, the period stays the same, but the depth changes, so \(L\), \(c\) and \(c_g\) change. Four processes alter the height and direction.
Shoaling. For waves approaching straight, parallel depth contours at right angles, and with no breaking or friction, the energy flux between two wave crests is constant:
With \(E \propto H^2\) this gives
where \(K_s\) is the shoaling coefficient and \(c_{g0} = c_0/2\). As the wave enters intermediate depth, \(c_g\) first increases slightly, so \(K_s\) drops to a minimum of about 0.91 near \(h/L_0 \approx 0.16\). In shallower water \(c_g\) falls, and the wave grows quickly until it breaks (Figure 7.4).
Figure 7.4. Shoaling coefficient \(K_s = H/H_0\) from linear theory as a function of depth relative to the deep-water wavelength. Shaded bands mark shallow water (\(h/L < 1/20\), left) and deep water (\(h/L > 1/2\), right). Close to the shore linear theory underestimates the growth, and the wave soon breaks.
Refraction. When waves approach the depth contours at an angle, the part of the crest in shallower water travels more slowly, and the crest turns to become more nearly parallel to the contours. For straight, parallel contours this follows Snell’s law, as for light:
where \(\alpha\) is the angle between the wave crest and the depth contours. The lines drawn perpendicular to the crests, in the direction of travel, are called wave rays (or orthogonals). As the rays turn, their spacing \(b\) changes, and the energy flux between two rays is conserved, \(E c_g b\) = constant. The height then becomes
where \(K_r\) is the refraction coefficient. Over real sea beds, rays converge on headlands, concentrating energy there, and diverge in bays, which is why bays are sheltered and headlands are eroded. Refraction over a complex sea bed is computed with numerical models.
Diffraction. Behind the tip of a breakwater there is a geometric shadow, but waves still enter it: energy spreads sideways along the crests. This is diffraction. Wave heights in the shadow fall smoothly from about half the incident height on the shadow line to small values deep in the shelter. Engineers use diffraction diagrams or numerical models to find the diffraction coefficient \(K_d = H/H_i\) inside harbors.
Reflection. A structure reflects part of the incident wave. The reflection coefficient \(K_R = H_r/H_i\) is close to 1 for a smooth vertical wall, which creates a standing wave up to twice the incident height in front of it. Rubble-mound breakwaters and beaches absorb much of the energy, with \(K_R\) often 0.3–0.5 or less. Strong reflection makes harbor basins rough and scours the bed in front of seawalls.
7.8 Wave breaking#
A wave cannot grow without limit. It breaks when the water particles at the crest move faster than the crest itself. Two limits are useful in practice.
Steepness limit. In deep water a wave breaks when its steepness reaches about
the theoretical limit found by Michell (1893). Real wind waves usually break well before this, as whitecaps. In finite depth, Miche (1944) extended the limit to \(H/L = 0.142\,\tanh(kh)\).
Depth limit. In shallow water a wave breaks when its height reaches a fixed fraction of the depth. The classical value, from the solitary wave theory of McCowan (1894), is
where the subscript \(b\) means “at breaking.” On real beaches the ratio varies from about 0.6 to over 1, depending on the beach slope and the wave steepness, but 0.78 is the usual first estimate. The depth limit has a direct design consequence: a structure standing in shallow water cannot be hit by an unbroken wave much higher than about 0.8 times the local depth (including tide and surge), however severe the storm offshore.
Breaker types. The form of breaking depends on the surf similarity (Iribarren) number \(\xi_0 = \tan\beta / \sqrt{H_0/L_0}\), where \(\tan\beta\) is the beach slope. Following Battjes (1974): spilling breakers (\(\xi_0 < 0.5\)), in which foam spills gently down the front, occur on flat beaches; plunging breakers (\(0.5 < \xi_0 < 3.3\)), in which the crest curls over and plunges, occur on steeper beaches; surging or collapsing breakers (\(\xi_0 > 3.3\)) occur on steep slopes and structures, where the wave runs up the slope with little breaking.
7.9 Long waves in channels and the Froude number#
Now return to a channel of depth \(y\) (Chapter 6). Suppose a gate is moved slightly and a small step in the water surface, of height \(\delta y\), travels at speed \(c\) into still water. Observed by someone moving with the wave, the flow is steady: water approaches at speed \(c\) with depth \(y\), and leaves at speed \(c - \delta V\) with depth \(y + \delta y\). Per unit width, continuity and momentum (Chapter 3) give, for a small step,
Eliminating \(\delta V\) gives the celerity of a small surge,
the same as the shallow-water wave speed of §7.4. In a channel of any shape, \(y\) is replaced by the hydraulic depth \(D\), so \(c = \sqrt{gD}\).
In flowing water with velocity \(V\), the wave is carried along by the flow. Relative to the bank, a disturbance travels downstream at \(V + c\) and upstream at \(c - V\). Dividing by \(c\) shows the role of the Froude number of Chapter 6:
If \(Fr < 1\) (subcritical), \(c - V > 0\) and a disturbance can travel upstream. Information from a gate or weir reaches the water upstream, so subcritical flow is controlled from downstream.
If \(Fr > 1\) (supercritical), \(c - V < 0\) and every disturbance is swept downstream. The water upstream cannot “know” about an obstacle ahead, so supercritical flow is controlled from upstream, and the adjustment to downstream conditions has to happen suddenly, in a hydraulic jump.
At \(Fr = 1\) (critical) a disturbance traveling upstream stands still. A hydraulic jump is exactly such a wave held stationary by the flow.
This is the physical reason behind the computation directions for water surface profiles in §6.7. A large surge, such as a tidal bore in a river estuary or the front of a dam-break wave, is a moving hydraulic jump. Its speed relative to the water ahead of it, of depth \(y_1\), follows from the momentum equation of §6.6:
where \(y_2\) is the depth behind the front. It is faster than \(\sqrt{g y_1}\), and it reduces to \(\sqrt{gy}\) as \(y_2 \to y_1\).
7.10 Real sea states#
Real wind waves are irregular: each wave has a different height and period. Engineers describe a sea state with statistical parameters. The most used is the significant wave height \(H_s\), the mean height of the highest one-third of the waves (often written \(H_{1/3}\)); a trained observer’s visual estimate of wave height is close to \(H_s\). In deep water wave heights follow approximately a Rayleigh distribution, so \(H_s \approx 1.42\,H_{rms}\), and the largest of about 1000 waves is about \(1.86\,H_s\). Design calculations use \(H_s\) with the peak period \(T_p\) of the wave spectrum. Going further: spectral methods describe the sea as a sum of many linear waves of different periods and directions, each obeying the theory of this chapter.
7.11 Worked examples#
Sea water (\(\rho\) = 1025 kg m⁻³) is assumed in the coastal examples.
Example 7.1 — Wavelength and celerity. A wave with period 10 s travels over water 12 m deep. Find its wavelength, celerity and group velocity, and compare the wavelength with the deep- and shallow-water approximations.
T, h = 10.0, 12.0
L, c, n, cg = wave_props(T, h)
L0 = g * T**2 / (2 * np.pi)
L_shallow = T * np.sqrt(g * h)
print(f"L = {L:.1f} m, h/L = {h/L:.3f}, c = {c:.2f} m/s, cg = {cg:.2f} m/s")
print(f"Deep-water formula: L0 = {L0:.1f} m ({100*(L0/L - 1):.0f}% too long)")
print(f"Shallow-water formula: {L_shallow:.1f} m ({100*(L_shallow/L - 1):.0f}% too long)")
L = 99.7 m, h/L = 0.120, c = 9.97 m/s, cg = 8.48 m/s
Deep-water formula: L0 = 156.1 m (57% too long)
Shallow-water formula: 108.5 m (9% too long)
The wavelength is 99.7 m and \(h/L\) = 0.12, so the wave is in intermediate depth. The deep-water formula overestimates \(L\) by 57%; the shallow-water formula is closer but still 9% too long. Near the coast, always solve the full dispersion relation.
Example 7.2 — Shoaling and refraction. A swell with \(H_0\) = 2.0 m and \(T\) = 10 s approaches a straight coast with parallel depth contours. In deep water the crests make an angle of 30° with the contours. Find the wave height and direction at a depth of 8 m.
H0, T, alpha0, h = 2.0, 10.0, np.radians(30), 8.0
L, c, n, cg = wave_props(T, h)
c0, cg0 = g * T / (2 * np.pi), g * T / (4 * np.pi)
Ks = np.sqrt(cg0 / cg)
alpha = np.arcsin(c / c0 * np.sin(alpha0)) # Snell's law
Kr = np.sqrt(np.cos(alpha0) / np.cos(alpha))
H = Ks * Kr * H0
print(f"Ks = {Ks:.3f}, angle = {np.degrees(alpha):.1f} deg, Kr = {Kr:.3f}")
print(f"H = {H:.2f} m, H/h = {H/h:.2f} (breaks at about 0.78)")
Ks = 1.019, angle = 15.6 deg, Kr = 0.948
H = 1.93 m, H/h = 0.24 (breaks at about 0.78)
The crests turn from 30° to about 16°, more nearly parallel to the shore. Shoaling raises the height by 2% and refraction lowers it by 5%, so the wave arrives at 8 m depth with \(H\) = 1.93 m. With \(H/h\) = 0.24 it is far from breaking.
Example 7.3 — Where does the wave break? The same swell approaches a beach of slope 1:30 at normal incidence. Estimate the breaking depth and breaker height with \(H_b = 0.78\,h_b\), and the breaker type.
H0, T, slope = 2.0, 10.0, 1 / 30
L0 = g * T**2 / (2 * np.pi)
depths = np.arange(20.0, 0.5, -0.01)
heights = np.array([shoaling_coefficient(T, d) * H0 for d in depths])
ib = np.argmax(heights >= 0.78 * depths) # first depth where H >= 0.78 h
xi0 = slope / np.sqrt(H0 / L0)
print(f"Deep-water steepness H0/L0 = {H0/L0:.4f}")
print(f"Breaking depth hb = {depths[ib]:.2f} m, breaker height Hb = {heights[ib]:.2f} m")
print(f"Iribarren number = {xi0:.2f}")
Deep-water steepness H0/L0 = 0.0128
Breaking depth hb = 3.13 m, breaker height Hb = 2.45 m
Iribarren number = 0.29
The wave breaks in about 3.1 m of water with a height of about 2.45 m, more than 20% higher than in deep water. The Iribarren number of 0.29 indicates spilling breakers. Linear theory underestimates shoaling just before breaking, so these values are first estimates.
Example 7.4 — Can a disturbance travel upstream? (a) A wide river flows at 1.2 m s⁻¹ with a depth of 2.0 m. (b) A steep concrete chute flows at 6.0 m s⁻¹ with a depth of 0.40 m. In each case a small surge is created by a sudden change at a gate. Find the speeds of the upstream- and downstream-facing fronts relative to the bank.
for name, V, y in [("river", 1.2, 2.0), ("chute", 6.0, 0.40)]:
c = np.sqrt(g * y)
print(f"{name}: c = {c:.2f} m/s, Fr = {V/c:.2f}, "
f"front speeds: {V - c:+.2f} and {V + c:+.2f} m/s (positive = downstream)")
river: c = 4.43 m/s, Fr = 0.27, front speeds: -3.23 and +5.63 m/s (positive = downstream)
chute: c = 1.98 m/s, Fr = 3.03, front speeds: +4.02 and +7.98 m/s (positive = downstream)
In the river (\(Fr\) = 0.27) one front moves upstream at 3.23 m s⁻¹, so a gate operation is felt upstream. In the chute (\(Fr\) = 3.03) both fronts move downstream, at 4.02 and 7.98 m s⁻¹, so nothing that happens at the gate can affect the flow upstream of it.
7.12 Common mistakes#
Using the deep-water wavelength in shallow water. \(L_0 = 1.56\,T^2\) holds only for \(h/L > 1/2\). Near the coast, solve the dispersion relation.
Classifying depth by \(h\) alone. Deep or shallow depends on \(h/L\): a 2 km deep ocean is shallow for a tsunami, and a 30 m deep bay is deep for a 3 s wind wave.
Confusing phase and group velocity. Crests move at \(c\), but energy moves at \(c_g\). Shoaling uses \(c_g\).
Thinking that water travels with the wave. In linear theory particles move in closed orbits; only the energy and the wave form travel.
Forgetting that the period is constant. As a wave shoals, \(L\), \(c\) and \(H\) change, but \(T\) does not.
Applying the 0.78 breaking limit to the still water depth without tide and surge. The breaking limit applies to the actual local depth during the storm.
7.13 Exercises#
Show that the wave energy \(E = \rho g H^2/8\) has units of J m⁻², and that \(E c_g\) has units of W m⁻¹.
A pressure sensor on the sea bed in 10 m of water records a pressure fluctuation of ±9 kPa for waves of period 8 s. Estimate the wave height at the surface.
Find the wavelength and celerity of a 6 s wave in water 3, 10 and 40 m deep. In which depth regime is each case?
A wave of height 1.5 m and period 12 s is measured at a depth of 20 m. Find its deep-water height, assuming normal incidence and no losses.
A breakwater stands in 6 m of water at high tide. What is the largest unbroken wave height that can reach it? How does your answer change if a storm surge adds 1.5 m to the water level?
A canal 3 m deep carries water at 0.8 m s⁻¹. A downstream gate is closed suddenly and a surge 0.5 m high travels upstream. Use the bore celerity of §7.9 to estimate its speed relative to the bank.
Figures and tables in this chapter are generated by the Python code shown. Text and figures: © Daeha Kim, CC BY-NC 4.0.