jcm.dycore.base.DynamicalCore¶
- class jcm.dycore.base.DynamicalCore¶
Protocol for a swappable dynamical-core backend.
Concrete backends subclass this and register themselves with
jcm.dycore.registry.register_dycore(). The user-facingModelconstructs a backend (or accepts one) and delegates every state-touching operation to it.- A backend is responsible for:
Carrying its own native state representation across
stepcalls.Projecting that state to and from
PhysicsStateso that physics packages can run on a common gridpoint layout (no spectral coefficients leak into physics).Applying its own hyperdiffusion / filters as part of
step. The physics-dynamics seam is purely operator-split (Lie a): the gridpointphysics_tendencyis forward-Euler-added to the state and the dycore then takes onedtof dynamics.Building its own terrain (orography is smoothed against the dycore’s own basis — spectral truncation for dinosaur, SE projection for pyses, …).
Converting a trajectory to xarray for output (the cubed-sphere → lat/lon regrid for SE backends lives here, not in the physics path).
- Instance attributes:
- coords: Coordinate system carrying horizontal lat/lon arrays (in the
dycore’s native shape) and the vertical level definitions. For the v2 dinosaur backend this is the dinosaur
CoordinateSystem; SE backends provide a compatible adapter.- dt_seconds: The integration timestep this dycore was built for. Concrete
backends may sub-cycle internally but
stepadvances by exactlydt_seconds(or the override passed tostep).- terrain: Boundary conditions (orography, land/sea mask, SSO descriptors).
Built via
build_terrain()or passed in at construction.- tracer_specs: Public mapping
name -> TracerSpecdeclaring every tracer the dycore should carry.
Modelwrites this every time it is constructed (so callers who pass a pre-built dycore still get the right specs); backends read it frominitial_state(),to_physics_state(), andstep().
- __init__()¶
Methods
__init__()build_terrain(*[, source_file])Construct a
TerrainDataagainst this dycore's basis.initial_state(physics_state, *[, sim_time, ...])Build the dycore's native initial state.
required_tracers_ok(specs)Verify the dycore can carry the requested tracers.
sim_time(state)Return the simulation-time (seconds) carried by
state.step(state, physics_tendency)Advance the state by one
dt.to_physics_state(state)Project the dycore's native state into a gridpoint
PhysicsState.to_xarray(predictions, times, *[, ...])Convert a saved trajectory to an
xarray.Dataset.with_sim_time(state, sim_time)Return a copy of
statewhose sim-time has been replaced.