Real ocean tides are a sum of periodic gravitational forcing terms ("constituents"). The two dominant ones give this model its sea level:
h_sea(t) = A_M2 cos(ω_M2 t) + A_S2 cos(ω_S2 t)
ω_M2 = 2π / 12.42h (principal lunar)
ω_S2 = 2π / 12.00h (principal solar)
Because M2 and S2 drift in and out of phase, their sum beats with a ≈14.77-day period — the real spring–neap cycle. The "S2/M2" slider sets the solar constituent's relative strength; the phase tag reads the instantaneous envelope amplitude off that beat.
The lagoon exchanges water with the sea through a turbine/sluice, modelled as compressible-free orifice flow:
Q = K √|Δh| · sign(Δh) (flow rate, m³/s)
P = ρ g Q Δh η (hydro power, W)
dh_lagoon/dt = ∓Q / A_basin (mass balance)
with ρ = 1025 kg/m³ (seawater), g = 9.81 m/s², η ≈ 0.87 (turbine efficiency). A minimum head (1 m) must build up before the turbine gates open — this is why the basin level "holds" flat for a while near each slack tide.
- Ebb generation — gates stay shut while the sea rises, letting the basin fill for free; once the sea falls below the basin by more than the minimum head, the turbine opens and drains the basin, generating on the outflow only.
- Flood generation — the mirror strategy: generate while the incoming tide fills the basin, then sluice it back out for free on the ebb.
- Two-way — the turbine generates on both the fill and the drain, at the cost of a smaller average head per stroke (less power per unit flow, but power on every half-cycle).
Real-world relevance: this is the same head/flow/power accounting used to design and schedule actual tidal barrages — France's La Rance (240 MW, ebb-generating since 1966) and South Korea's Sihwa Lake (254 MW) both operate on exactly this logic.