jcm.model.Model¶
- class jcm.model.Model(dycore: DynamicalCore | None = None, *, coords=None, time_step: float = 30.0, terrain: TerrainData = None, physics: Physics = None, start_date: Datetime = jax_datetime.Datetime(delta=jax_datetime.Timedelta(days=10957, seconds=0)), calendar: str = '365_day', radiation_chunk_size: int | None = None, log_level=50)¶
Top level class for a JAX-GCM simulation.
The Model orchestrates the run (timestep, forcing, op-split scan, post-processing). Dynamics-specific work (state init, the per-
dtstep, the spectral↔gridpoint bridge) is delegated to aDynamicalCore; physics-specific work to aPhysics.- __init__(dycore: DynamicalCore | None = None, *, coords=None, time_step: float = 30.0, terrain: TerrainData = None, physics: Physics = None, start_date: Datetime = jax_datetime.Datetime(delta=jax_datetime.Timedelta(days=10957, seconds=0)), calendar: str = '365_day', radiation_chunk_size: int | None = None, log_level=50) None¶
Initialise the model.
- Args:
- dycore: The
DynamicalCoredriving the integration. When None, a defaultDinosaurDycoreis constructed fromcoordsandterrainfor convenience. Backend- specific knobs (diffusion, nudging-as-PhysicsTerm targets, IMEX stepper details) belong to the dycore’s own constructor — wire them there, then pass the dycore in.- coords: CoordinateSystem. Required when
dycoreisNone. To enable SPMD parallelization, pass
spmd_meshto the coords helper (e.g.get_speedy_coords()).
time_step: Model time step in minutes. terrain:
TerrainData(orography, land-sea mask, etc.).Defaults to an aquaplanet when building the default dycore.
- physics:
Physicsdescribing the model physics. Defaults to
speedy_physics(). Add nudging via thejcm.nudging.NudgingTermPhysicsTerm.- start_date:
jax_datetime.Datetimefor the start of the run. Used to convert
state.sim_timeto aDateDatathat’s threaded into the physics-step diagnostics dict (so forcing-driven and date-aware terms can read it).- calendar: Calendar string (
"365_day"or"gregorian") for the same date conversion.
- radiation_chunk_size: Override the RRTMGP chunked-vmap chunk size
(cells per chunk). Default
Noneauto-detects from the JAX device’s HBM. No-op when the active radiation scheme is not RRTMGP.
log_level: Logging verbosity level.
- dycore: The
Methods
__init__([dycore, coords, time_step, ...])Initialise the model.
bootstrap_state([initial_state])Populate
_final_dycore_stateand_final_physics_statewithout integrating.resume([forcing, save_interval, total_time, ...])Continue from end of previous
run/resume.run([initial_state, forcing, save_interval, ...])Set the initial state and run the full simulation forward in time.
run_from_state(initial_state, forcing[, ...])Run the simulation forward from a given dycore-native initial state.
run_from_state_with_carry(initial_state, forcing)Lower-level
run_from_statethat exposes the cross-step physics carry.