jcm.dycore.base¶
The DynamicalCore protocol.
A dynamical core is anything that integrates the primitive equations forward by one
dt given an optional gridpoint-space physics tendency. The protocol fixes the
contract; the implementation details (spectral / finite-element / finite-volume,
hydrostatic / non-hydrostatic, sigma / hybrid / height coordinates) are entirely
internal to each backend.
The contract is gridpoint-on-both-sides on the dycore’s native horizontal layout.
That is: DynamicalCore.to_physics_state() returns a
PhysicsState whose 3-D fields are shaped
(nlev, *horizontal_shape) where horizontal_shape is whatever the dycore
exposes; DynamicalCore.step() takes a
PhysicsTendency shaped identically. There is no
horizontal regrid at the physics-dynamics seam — physics packages run column-local
(or vectorised across columns), and the small number of horizontally non-local
schemes (solar zenith, MACv2-SP, SST forcing) cache against the dycore-supplied
coords.horizontal.latitudes / longitudes arrays, which are shaped to match
horizontal_shape.
The protocol permits any horizontal_shape. The current
ComposablePhysics(vectorize_columns=True) implementation still expects
exactly two horizontal dimensions, so a backend with an element-plus-GLL
layout must flatten or adapt that layout before using the shipped
column-vectorized physics packages.
This protocol is the only sanctioned bridge between the dycore’s internal state and
the rest of jax-gcm. Model never reaches past it; physics packages never see
spectral coefficients (or whatever the dycore’s native representation happens to be).
Classes
Protocol for a swappable dynamical-core backend. |
|
|