Configuration

Two APIs

Use CaseAPI
Quick startcreate_simple_config()run_simple_simulation()
Full controldefault_params()setup_model() → manual stepping
Different Defaults
FlagSimple APIFull API
inviscidtruefalse
no_wave_feedbackfalsetrue

Simple API

config = create_simple_config(
    # Domain (REQUIRED)
    Lx=500e3, Ly=500e3, Lz=4000.0,
    # Grid
    nx=64, ny=64, nz=32,
    # Time
    dt=0.001, total_time=1.0,
    # Physics
    ybj_plus=true, inviscid=true, linear=false,
    # Output
    output_interval=100
)
result = run_simple_simulation(config)

Full API

par = default_params(
    Lx=500e3, Ly=500e3, Lz=4000.0,
    nx=64, ny=64, nz=32,
    dt=0.001, nt=1000,
    f₀=1.0, N²=1.0,
    ybj_plus=true, inviscid=false
)

G, S, plans, a_ell = setup_model(par)
init_random_psi!(S, G; amplitude=0.1)
compute_q_from_psi!(S, G, plans, a_ell)

first_projection_step!(S, G, par, plans, a_ell)
for step = 2:par.nt
    leapfrog_step!(S, G, par, plans, a_ell)
end
IMEX

Use imex_cn_step!() instead of leapfrog_step!() for ~10× faster wave-dominated problems.

Parameter Reference

Domain (REQUIRED)

ParameterDescription
Lx, LyHorizontal domain size [m]
LzVertical depth [m]
nx, ny, nzGrid points (default: 64)

Physics

ParameterDefaultDescription
f₀1.0Coriolis parameter
1.0Buoyancy frequency squared
γ1e-3Robert-Asselin filter

Unicode: type f\_0<tab>f₀, \nu<tab>ν

Model Flags

FlagDefaultEffect
ybj_plustrueUse YBJ+ formulation
inviscidfalseDisable dissipation
linearfalseDisable nonlinear terms
no_wave_feedbacktrueDisable qʷ term
no_dispersionfalseDisable wave dispersion
fixed_flowfalseKeep ψ constant

Dissipation

Two hyperdiffusion operators: ν₁(-∇²)^ilap1 + ν₂(-∇²)^ilap2

ParameterDefaultDescription
νₕ₁, νₕ₂0.01, 10.0Hyperviscosity (flow)
ilap1, ilap22, 6Laplacian power
νₕ₁ʷ, νₕ₂ʷ0.0, 10.0Hyperviscosity (waves)

Higher ilap = more scale-selective: 1 (∇²), 2 (∇⁴), 4 (∇⁸)

Examples

QG-Only (No Waves)

par = default_params(Lx=500e3, Ly=500e3, Lz=4000.0, no_dispersion=true)

Linear Wave Propagation

config = create_simple_config(
    Lx=500e3, Ly=500e3, Lz=4000.0,
    linear=true, inviscid=true, no_wave_feedback=true
)

Save/Load

using JLD2
@save "config.jld2" par
@load "config.jld2" par

See Also