Skip to content

About

Combined preview of in-progress Oceananigans OBC/tides features (ObliqueRadiation, TracerReservoir, tides, LowPassFilter) with NumericalEarth.jl, before each PR merges individually

Resources

Stars

5 stars

Watchers

0 watching

Forks

Repository files navigation

NumericalEarthSandbox

A single environment that combines in-progress Oceananigans.jl and NumericalEarth.jl changes — tides, open-boundary fixes, restart fixes and a CATKE fix — with NumericalEarth.jl's realistic regional-ocean machinery (ETOPO bathymetry, GLORYS, ERA5, sea ice), so they can be tried together before each lands upstream on its own.

None of this is meant for upstream merge. It exists to let a colleague clone one thing and get the whole combined feature set, while the individual pieces work their way through review:

feature PR status
ObliqueRadiation CliMA/Oceananigans.jl#5962 merged
TracerReservoir CliMA/Oceananigans.jl#5964 merged
FilteredTimeInterval CliMA/Oceananigans.jl#5971 merged
TidalHarmonics (planet-agnostic), tidal_forcing, tidal_boundary_conditions CliMA/Oceananigans.jl#5970 open
Split-explicit barotropic substep clock fix CliMA/Oceananigans.jl#5982 open
Split Runge-Kutta momentum tendencies at each substep (exact restarts) CliMA/Oceananigans.jl#6090 open
ObliqueRadiation: tangential velocities radiated with the normal velocity's phase speed CliMA/Oceananigans.jl#6091 open
CATKE bottom mixing length coefficient Cᵇ CliMA/Oceananigans.jl#6024 open
Anchor open boundary schemes at most once per iteration CliMA/Oceananigans.jl#6092 open
Open boundary scheme state in checkpoints fork branch checkpoint-boundary-state no PR yet
TPXO10Atlas, earth_tidal_harmonics (Earth's tidal astronomy) NumericalEarth/NumericalEarth.jl#681 open
Each prescribed atmosphere field interpolated on its own time axis NumericalEarth/NumericalEarth.jl#711 open

The open Oceananigans branches are merged on top of upstream main at enri66/Oceananigans.jl#everything. enri66/NumericalEarth.jl#everything adds TPXO10Atlas and #711 on top of NumericalEarth main, and points its own Oceananigans dependency at that branch.

#711 matters for every ERA5-forced run: without it, ERA5 precipitation (whose samples sit at the centres of their hourly windows, half an hour off the other fields) is read from outside its loaded window once that window reloads, and script 04 crashes within the first simulated day (negative salinity, a DomainError in TEOS-10 inside CATKE). Specific humidity is also read at the wrong time, which breaks exact restarts.

Running

using Pkg
Pkg.activate(".")
Pkg.instantiate()

This environment's own [sources] already point at the right branches, so no manual Pkg.develop is needed.

Scripts

script what it does
03_mab_m2_tide_smoke.jl Mid-Atlantic Bight, M2 tide only: astronomical body force + TPXO10 boundary forcing from one TidalHarmonics, so they can't drift out of phase. Harmonically analyses the model's free surface and reports skill against TPXO and against NOAA tide gauges. MAB_TANGENTIAL=oblique swaps ObliqueRadiation in on the tangential velocity component.
02_mab_glorys_obc.jl Same MAB box, GLORYS-driven open boundaries (Flather/Chapman fed real exterior data instead of zero). Copied from NumericalEarth/scripts/02_mab_glorys_obc.jl — keep in sync there, see that repo's CLAUDE.md for the fix history. Unlike 03, this one doesn't need any of the five bundled branches (it only uses mainline NumericalEarth); it's here because this environment is the easiest way to run it without hand-assembling the package combo, not because it's testing an in-progress feature. MAB_UEXT=native|masked|legacy selects how the Flather barotropic exterior is computed (native, the default, is the most precise).
04_mab_glorys_tides_reservoirs.jl 02's GLORYS boundaries, but now WITH the M2..Mm tide added on top (additively — see the script's header for why tidal_boundary_conditions isn't used directly), TracerReservoir on T/S instead of NormalRadiation, and FilteredTimeInterval de-tided daily/pentad output alongside raw hourly. This one DOES need three of the five bundled branches (TracerReservoir, tides, FilteredTimeInterval) plus TPXO10Atlas, so unlike 02 it can only run here. First validated 2026-09-20 on a 14-day run — see NumericalEarth/CLAUDE.md's session log for the results and the known east-edge spike still worth another look. Also supports checkpoint/restart (MAB_CHECKPOINT_EVERY, MAB_PICKUP) — see the script's own comment above the Checkpointer for the offset needed to keep the de-tided output continuous across a restart (validated on a 30-day run, mab_1month_continuous, 2026-09-21). Saves full-depth u/v/w/T/S daily (:volume_daily, same de-tided cadence as :surface_daily) in addition to the top-level-only fields, for transects and anything else that needs more than the surface.
plot_temperature_transects.jl Longitude-depth (x-z) temperature transects at three fixed latitudes (south/middle/north of the domain), from a run's final checkpoint (MAB_TAG, optionally MAB_CHECKPOINT for a specific one) rather than a JLD2Writer file — the checkpoint has the complete model state, which is what a full-depth snapshot needs. Saves both a full-depth PNG and a top-500m zoom. Older runs without :volume_daily (see 04, above) have no other way to get a full-depth snapshot; newer runs could read {TAG}_volume_daily.jld2 directly instead.

Its includes (tidal_harmonics.jl, tpxo.jl, tpxo_boundaries.jl, noaa_harcon_mab.jl, variable_bottom_drag.jl, kepsilon_tuple_closure_patch.jl, glorys_profiles.jl, glorys_bathymetry.jl) are local helpers, not part of either package — the skill-analysis machinery in particular (harmonic analysis, atlas readers) is deliberately not something the package provides.

Four animation scripts, all reading a run's saved .jld2 output via MAB_TAG: animate_ssh.jl (raw hourly SSH — will visibly carry the tide if 04 produced it), animate_ssh_detided.jl, animate_sst_detided.jl, and animate_velocity_detided.jl (filled contours + arrows2d for surface speed and direction) — the latter three are filled-contour/vector plots from 04's FilteredTimeInterval daily output ({TAG}_eta_daily.jld2/ {TAG}_surface_daily.jld2), so they only cover the days the daily filter actually produced valid output for. That span depends on whether/how the run was restarted: a single unbroken run only trims ~3 days off each end (a 14-day run gets days 3–11); a checkpoint/restart run gets a real gap unless the restart checkpoint was taken far enough before the split (see 04's comment on this — a 30-day run restarted at day 9 for a day-15 split covers the full days 3–27 with no gap, mab_1month_continuous).

Plus snapshot_fields.jl, a static SST/SSH/surface-speed three-panel PNG at a few chosen days (MAB_SNAPSHOT_DAYS=34,60,87, default first/middle/last of the de-tided record) — faster than scrubbing an animation when spot-checking a run. Extended mab_1month_continuous to 90 days as mab_3months (resuming from its day-30 checkpoint, since that's the one with the validated-continuous offset — mab_1month_restart's day-12.5 checkpoint predates that fix and has a real gap); snapshots at days 34/60/87 show a coherent Gulf Stream meandering and shedding rings the whole way, and the restart seam checks out clean against the raw hourly record.

Run with julia -t 8 --project=. scripts/03_mab_m2_tide_smoke.jl, scripts/02_mab_glorys_obc.jl, or scripts/04_mab_glorys_tides_reservoirs.jl; see each script's own comment block for its environment-variable knobs (03: MAB_DAYS, MAB_NZ, MAB_CLOSURE, MAB_TANGENTIAL, ...; 02/04: MAB_DAYS, MAB_UEXT, MAB_TANGENTIAL, MAB_TAU_IN, MAB_MATCH_BATHY, ...; 04 additionally: MAB_TIDE_CONSTITUENTS, MAB_TIDE_RAMP, MAB_RESERVOIR_L_IN, MAB_RESERVOIR_L_OUT, MAB_START_DATE, MAB_DT_MINUTES, MAB_SPONGE_SHAPE).

04 also has debugging knobs: MAB_FLUXDUMP=file (min/max/mean and location of every interpolated atmospheric field and air-sea flux, every MAB_FLUXDUMP_MINUTES), MAB_STATEDUMP=file (full-precision ocean-state checksums, to compare repeats bit for bit, and the location of each field's extremes, every MAB_STATEDUMP_MINUTES), MAB_UNIFORM_P=1 (uniform atmospheric pressure), and for exact-restart work MAB_STOP_ITERATION, MAB_CHECKPOINT_ITERATIONS, MAB_SNAPSHOT and MAB_DUMP_RESTORE.

Data

TPXO10-atlas-v2 is licensed and cannot be redistributed here: request it at tpxo.net, then point ENV["TPXO_DIR"] at the unpacked files (default ~/Data/TPXO10_atlas_v2_nc). Nothing else script 03's default smoke test needs requires a download — the NOAA gauge constants are inlined, and the optional GLORYS stratification profiles (MAB_STRAT=deep/shelf) are off by default. 04 needs TPXO too, for its tidal boundary constants.

02_mab_glorys_obc.jl and 04_mab_glorys_tides_reservoirs.jl default DATA_DIR to ~/Data/NumericalEarth (override with MAB_DATA_DIR) — the same out-of-Dropbox cache the NumericalEarth repo's own scripts use (moved there 2026-09-21; it used to live under that repo's data/, synced through Dropbox), so this doesn't re-download the several-GB GLORYS/ETOPO/ERA5 data that's already sitting there.

About

Combined preview of in-progress Oceananigans OBC/tides features (ObliqueRadiation, TracerReservoir, tides, LowPassFilter) with NumericalEarth.jl, before each PR merges individually

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages