MPAS-Dev / MPAS-Model

Repository for MPAS models and shared framework releases.
238 stars 317 forks source link

Implement new tendency diagnostics package and significant revisions to PV diagnostics package in MPAS-A #1211

Open theweathermanda opened 2 months ago

theweathermanda commented 2 months ago

This PR includes a series of commits that progressively lead to the implementation of a new tendencies diagnostics package and a significantly revised PV diagnostics package for MPAS-Atmosphere, as described further in issue #1201.

The new tendency diagnostics package was created by May Wong (@maywswong) and tracks model tendencies throughout the integration in order to evaluate budgets of variables such as potential temperature and momentum. The revised PV tendency diagnostics package is now largely dependent on the tendency diagnostics package for calculations of tendencies that are used in the PV tendency and budget calculations. Additionally, the revised PV package includes several new features, including accumulating the PV tendencies throughout the model integration and calculating the PV tendencies from individual processes in the Thompson microphysics scheme. The revised PV tendency package is described in more detailed here.

Collectively, both of these packages require a large number of new model variables and calculations. To address this, we have added several namelist config_* flags that are connected to variable packages to (1) make it easy for the user community to toggle on/off these diagnostic calculations at run-time and (2) reduce the memory and computational resources required to run the model when these packages are disabled: – config_tend: calculations and variables associated with tendency diagnostics package – config_pv_diag: calculation of ertel_pv and DT interpolation of model state variables – config_pv_tend: calculation of instantaneous and accumulated PV tendencies – config_pv_microphys: calculation of PV tendencies from individual microphysical processes – config_pv_scalar: transport of PV passive scalar variable – config_pv_isobaric: interpolation of PV diagnostic variables to isobaric levels

Due to the dependence of later features on earlier commits, I think it's best to keep these code changes under the umbrella of a single pull request to avoid multiple PRs containing the same set of commits. However, the commits will still follow the proposed ordering of (1) adding the framework for the tendency and PV diagnostics packages, (2) implementing the tendency diagnostics package, and (3) implementing the revised PV tendency diagnostics package, with possible bug fixes interspersed. For the PV diagnostics package portion, the commits will be ordered such that earlier commits will primarily revise the capabilities that already exist in mpas_pv_diagnostics.F, while later commits will add new features that aren't already in the code. Comments will be provided to further indicate whether the commits pertain to (1), (2), or (3).

theweathermanda commented 2 months ago

The above commits a6eeee, 47d1203, and 7622e5d establish the framework for the two diagnostics packages [objective (1)]. Commit 022000f contains the code implementation of May Wong's tendency diagnostics package, with a needed reordering of the timer calls (bug fix) in 7622e5d [objective (2)].

theweathermanda commented 2 months ago

Commit ae664a1 begins of the implementation of the revised PV diagnostics package [objective (3)] by recreating mpas_pv_diagnostics.F from scratch and including subroutines to calculate ertel_pv, identify the dynamic tropopause, and interpolate static fields to the dynamic tropopause. This commit does not include calculations of PV tendencies, which were in the original mpas_pv_diagnostics.F code. These will be included in the next commits.

theweathermanda commented 2 months ago

Commits 64b09cd through 6796b74 contain code changes and additions for the implementation of PV tendency calculations in the PV diagnostics package [objective (3)]. These calculations use different process tendency variables than in the original PV diagnostics code and now rely heavily on tendencies calculated as part of May Wong's tendency diagnostic package that was implemented in prior commits.

theweathermanda commented 2 months ago

Commits 522452f through 4c8ce89 correspond to the implementation of potential temperature tendencies from specific microphysical processes in the Thompson scheme, which are used to calculate the corresponding PV tendencies in mpas_pv_diagnostics.F.

The microphysical PV tendencies are only computed when config_pv_microphys = True, which is disabled for microphysics other than Thompson or Thompson aerosol. The additional calculations in module_mp_thompson.F are only enabled for MPAS, but there is currently no dependence on user settings. Ideally all tend_theta_* and tend_temp_* variables and calculations would be set as optional and connected to the config_pv_microphys namelist runtime option.

theweathermanda commented 2 months ago

Commits c3fb0f8 and 5f53d23 contain the same code changes as PR #1184, which restructures the isobaric diagnostics code to make it cleaner, easier to modify, and less reliant on hard-coding. This also includes the definition of an isobaric diagnostics variable package, which is connected to a new config_isobaric namelist option.

These modifications to the isobaric diagnostics package will be extended to include the isobaric interpolation of PV diagnostics variables in later commits.

theweathermanda commented 2 months ago

Commit bfddf5e contains code to initialize an optional pv_scalar variable as ertel_pv at model initialization time and transport it as a passive scalar throughout the integration. This feature is tied to namelist runtime option config_pv_scalar.

theweathermanda commented 2 months ago

Commit 08b417c contains code to interpolate the PV variables to isobaric surfaces and accumulate the PV tendencies after interpolation. This is the final primary feature to be implemented as part of objective (3).

theweathermanda commented 2 months ago

Commits bea55b6 and e1157f3 contain important bug fixes that go along with the code changes and additions first introduced in commit ae664a1.

Commit b9c3ec4 contains a bug fix that corresponds to the introduction of PV tendency calculations in commit 64b09cd.