NOAA-GFDL / pace

Re-write of FV3GFS weather/climate model in Python
Apache License 2.0
12 stars 11 forks source link

Refactor of tracers #45

Open FlorianDeconinck opened 7 months ago

FlorianDeconinck commented 7 months ago

Right now the tracers are organized as an hardcoded list of strings, e.g.

tracer_variables = [
    "qvapor",
    "qliquid",
    "qrain",
    "qice",
    "qsnow",
    "qgraupel",
    "qo3mr",
    "qsgs_tke",
    "qcld",
]

The amount of species to work on is known via constants.NQ, which is then used throughout the code (including in loop boundaries). Later in the code, some configuration is down via kord to reflect strategy of remapping for each Tracers e.g.

kord_tracer = [kord] * self._nq
[...]
MapSingle(
    stencil_factory,
    quantity_factory,
    kord_tracer[i],
    0,
    dims=[X_DIM, Y_DIM, Z_DIM],
)

The list continues, but the point remains: tracers semantic is hardcoded and dispersed in many variables.

We need a semantically strong Tracers object that know to:

Basically break the organization in two: