NOAA-GFDL/pace

Refactor of tracers

Opened this issue · 0 comments

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:

  • load from configuration
  • name tracers
  • know how many tracers are advected or/and know how to iterate over tracers
  • index tracers in state (or even hold the memory, TBD)
  • carries the configurations related to the Tracers (kord, etc.)

Basically break the organization in two:

  • out of critical path: make a global object
  • critical path: keep the Field-based SOA-like system for performance.