Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture all tropopause and PBL height changes in budget diagnostics #2103

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

lizziel
Copy link
Contributor

@lizziel lizziel commented Jan 4, 2024

Name and Institution (Required)

Names: Lizzie Lundgren (Harvard University) and Chris Holmes (FSU)

Describe the update

This PR is based on updates for version 12.9.3 provided by Chris Holmes (@cdholmes) in #2079, and additional updates submitted in #2215. Budget diagnostics now include mass tendency due to changes in:

  • Tropopause height (TransportTrop budget)
  • PBL height (MixingPBL budget)

All budget diagnostic arrays are now accumulated across the timestep after initializing to zero at the start of the timestep. Chemistry, emissions, and dry deposition budget diagnostic arrays are only set to zero at the start of the chemistry timestep.

Species mass change in the troposphere due to changes in the tropopause heights are now accumulated over the timestep in GC-Classic when AirQnt is called outside of an existing budget diagnostic block. This specifically includes one call in main.F90 (when meteorology is updated due to new timestep) and all calls from Set_H2O_Trac (when meteorology is updated due to a change in moisture). By default calling AirQnt will not result in updating the transport trop budget array; it must be explicitly specified in the arguments list that this should be done.

Turning on GEOS-Chem verbose will enable a budget check when computing budget diagnostics. Column mass per species from the end of the last budget calculation is compared to the column mass at the start of a new budget calculation. If values differ then warning messages are printed to log. This is done for each of the 3 primary vertical regions (fixed level budget is ignored). The check is only done on the root thread if running with MPI.

To avoid dependency issues during build this PR also introduces State_Diag object logicals isPOA and isOPOA. These are used in diagnostics_mod to replace dependency on aerosol_mod.

Expected changes

The PBL mixing budget diagnostic values will change for both GC-Classic and GCHP. The transport trop budget diagnostic values will change for GC-Classic only (we do not use transport budget diagnostics in GCHP since tpcore is not used). No changes are needed to HISTORY.rc for this update.

Species mass changes in the PBL and troposphere due to mixing and transport respectively will now include fluctuations in species mass at the top due to changing definition of the vertical region top level. For example, if the PBL top level changes from 26 to 25 in timestep A in the call to Compute_PBL_Height which happens before mixing, then the mixing budget for timestep A will be the change in species mass due to mixing for levels 1 to 25 minus the species grid cell mass in level 26. This is because level 26 is no longer included in the PBL, representing a mass loss for the mixing diagnostic. If PBL top level increases rather than decreases then the species mass in the top grid cell is added.

Note that the fluctuation due to changing vertical region is total species mass in the grid cell at the top. The base values of the budget, in contrast, are the change in species mass across a single component, in this example mixing. PBL mixing and trop transport budget mass changes may therefore be dominated by changes in the top-level and this should be taken into account when interpreting these diagnostics.

Users who do not want to include the changes in the total grid cell mass at the top boundary will be able to use a new diagnostic for fixed levels that will be included in GEOS-Chem 14.3.1. See #2127. This diagnostic can be used to examine mass change due to mixing or transport within a fixed vertical region (defined by level index not pressure).

Reference(s)

See also #2002 for initial discussion.

Related Github Issue(s)

None

@lizziel lizziel changed the base branch from main to dev/no-diff-to-benchmark January 4, 2024 21:40
@lizziel
Copy link
Contributor Author

lizziel commented Jan 4, 2024

@cdholmes, please review my updates and read through my description above.

@yantosca yantosca added category: Feature Request New feature or request topic: Diagnostics Related to output diagnostic data labels Jan 16, 2024
@lizziel
Copy link
Contributor Author

lizziel commented Feb 6, 2024

This update will impact GCPy operations budget tables which use the current Trop budget to compute budget in the stratosphere.

@cdholmes
Copy link
Contributor

I verified that the budget diagnostics work in this branch. I suggest some improvements in PR #2215.

@lizziel lizziel force-pushed the feature/capture_all_trop_pbl_ht_changes_in_budget_diags branch from 6dca8fd to 59cce65 Compare March 25, 2024 18:54
@lizziel
Copy link
Contributor Author

lizziel commented Mar 25, 2024

@cdholmes, please see the updated changes. I also updated the description at the start of the PR. Please read through to make sure it is comprehensive and what you have in mind.

@cdholmes
Copy link
Contributor

@lizziel, The PR description is fine with me and I see no issues with the latest code changes. Thanks!

@lizziel lizziel force-pushed the feature/capture_all_trop_pbl_ht_changes_in_budget_diags branch 3 times, most recently from 0965512 to f52a65a Compare March 26, 2024 20:59
@lizziel
Copy link
Contributor Author

lizziel commented Mar 26, 2024

I pushed updates to print out location of computing budget either before ("(1)") or after ("(2)"). These messages, along with the budget check messages, are only printed if verbose is turned on in geoschem_config.yml. In the benchmark simulation I am seeing budget check messages here:

Compute budget diag (2) -> at Compute_PBL_Height (in module GeosCore/pbl_mix_mod.F90)
...
Compute budget diag (1) -> at DO_PBL_MIX_2 (in module GeosCore/vdiff_mod.F90)
 Budget Diagnostic Warning: PBL-column tracer mass changed  unexpectedly, rerr=   23.340161208090429
Compute budget diag (2) -> at DO_PBL_MIX_2 (in module GeosCore/vdiff_mod.F90)
Compute budget diag (1) -> at DO_TEND (in module GeosCore/mixing_mod.F90)
Budget Diagnostic Warning: PBL-column tracer mass changed  unexpectedly, rerr=   23.350433455198768
Compute budget diag (2) -> at DO_TEND (in module GeosCore/mixing_mod.F90)
     ### MAIN: a TURBDAY:2
 Compute budget diag (1) -> at Do_Convection (in module GeosCore/convection_mod.F)
 Budget Diagnostic Warning: PBL-column tracer mass changed  unexpectedly, rerr=   23.350433455198768
Compute budget diag (2) -> at AIRQNT (in module GeosCore/dao_mod.F)
 Compute budget diag (1) -> at Do_Chemistry  (in module GeosCore/chemistry_mod.F90)
 Budget Diagnostic Warning: PBL-column tracer mass changed  unexpectedly, rerr=   23.335973409283902

The budgets computed are only for ozone.

@lizziel
Copy link
Contributor Author

lizziel commented Mar 27, 2024

All integration tests for GC-Classic and GCHP pass. However, we need to figure out why there are warning messages when the budget check is on before bringing in this PR.

@lizziel lizziel added this to the 14.4.0 milestone Mar 29, 2024
@lizziel lizziel removed this from the 14.4.0 milestone Apr 30, 2024
@lizziel
Copy link
Contributor Author

lizziel commented Apr 30, 2024

@cdholmes, we are wrapping up 14.4.0 now. I can take a look at this after the version release. Have you had a chance to look?

@lizziel
Copy link
Contributor Author

lizziel commented Jul 9, 2024

@cdholmes I will rebase this PR on 14.4.1 this week to remove the conflicts.

lizziel and others added 10 commits July 11, 2024 13:34
…nges

BudgetTransportTropHeight and BudgetMixingPBLHeight are only allocated
if BudgetTransportTrop and BudgetMixingPBL are in HISTORY.rc. They are
not registered and do not have use a separate mapping from the transport
trop and mixing PBL budget diagnostics. This commit creates the arrays
but does not populate or use them.

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
Accumulation is off by default, meaning the budget diagnostic arrays
are zeroed out prior to setting them within compute_budget_diagnostics.
The accumulation option will prevent setting them to zero, effectively
allowing the array to accumulation every time compute_budget_diagnostics
are called. All budget diagnostics that use this option should be added
to Zero_Diagnostics_StartofTimestep (assuming dynamic timestep diag)
so that accumulation is over one timestep only.

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
This update includes passing state_diag to compute_pbl_height and adding
the budget mixing PBL height array to budget mixing PBL diagnostics in
diagnostics_mod.

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
Updates in this commit include:
 - Pass State_Diag to AirQnt and all subroutines that call it
 - Add optional input logical Update_Budget_TropHt to AirQnt
 - Update budget trop ht diagnostic array when AirQnt is called within
   Set_H2o_Trac and within GC-Classic main.F
 - Accumulate the budget transport trop ht array since it is updated in
   multiple locations across one timestep
 - Add Budget transport trop ht array to budget transport trop diagnostic
   at the end of each timestep
 - Reset the state_diag budget transport trop ht array to zero at the start
   of each timestep (since accumulated)

NOTE: Do not compute the budget transport trop ht array when AirQnt is
called within mixing, GC-Classic advection, GC-Classic met-field initial
read, or GCHP main (gchp_chunk_mod). Species mass changes due to changes
in tropopause level during mixing and GC-Classic advection are already
captured within other budget diagnostics. GCHP transport budget diagnostics
are not used. And initial GC-Classic met-field read would have zero mass
for initial since species concentrations not yet read (tropopause ht would
also be zero initially).

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
Budget diagnostics all accumulate so these variables are
no longer needed.
Raise an error message when the tracer mass changes in code sections not expected by budget diagnostics.
The budget diagnostics currently do not track all changes in H2O or CLOCK, so messages will be raised when these species are simulated.
…tart

There is now the option to zero out diagnostics only at the start of
chemistry timesteps.

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
…steps

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
The budget check computation and warning prints will only occur on the
root thread when running GCHP or other MPI models.
This update removes diagnostics_mod dependency on aerosol_mod because of
circular dependency preventing successful build.

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
This feature is not currently used.

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
@lizziel lizziel force-pushed the feature/capture_all_trop_pbl_ht_changes_in_budget_diags branch from 5336750 to b03f08e Compare July 11, 2024 19:55
@lizziel lizziel changed the base branch from dev/no-diff-to-benchmark to main July 11, 2024 19:56
@lizziel
Copy link
Contributor Author

lizziel commented Jul 11, 2024

This PR is now rebased on 14.4.1. It should only be used with super-project repo version 14.4.1. I will run integration tests and check if I still get the same result as before.

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
@lizziel
Copy link
Contributor Author

lizziel commented Jul 31, 2024

I am testing this PR again. In a benchmark simulation I see the following warnings in the first timestep.

Between Do_Transport and Compute_PBL_Height

 Compute budget diag (2) -> at Do_Transport (in module GeosCore/transport_mod.F90)
     ### MAIN: a DO_TRANSPORT
     ### MAIN: a SETUP_WETSCAV
 Compute budget diag (1) -> at Compute_PBL_Height (in module GeosCore/pbl_mix_mod.F90)
 Budget Diagnostic Warning: PBL-column tracer mass changed  unexpectedly, rerr=   3.7220334051713988E-002
 Tracer mass changed outside code sections monitored by Compute_Budget_Diagnostics!!! This could indicate a bug or additional calls to Compute_Budget_Diagnostics are needed. 

Between Compute_PBL_Height and DO_PBL_MIX_2

 Compute budget diag (2) -> at Compute_PBL_Height (in module GeosCore/pbl_mix_mod.F90)
     ### MAIN: a COMPUTE_PBL_HEIGHT
     ### DO_DRYDEP: after dry dep
     ### MAIN: a DO_DRYDEP
HEMCO (VOLCANO): Opening /n/holyscratch01/external_repos/GEOS-CHEM/gcgrid/gcdata/ExtData/HEMCO/VOLCANO/v2024-04/so2_volcanic_emissions_CARN_v202401.degassing_only.rc
--- Initialize surface boundary conditions from input file ---
...etc.
     ### MAIN: a HEMCO PHASE 2
     ### Species Unit Conversion: kg/kg dry -> mol/mol dry
     ### Species Unit Conversion: mol/mol dry -> kg/kg dry
     ### MAIN: a Compute_Sflx_For_Vdiff
 Compute budget diag (1) -> at DO_PBL_MIX_2 (in module GeosCore/vdiff_mod.F90)
 Budget Diagnostic Warning: PBL-column tracer mass changed  unexpectedly, rerr=   374.54076564523081
 Tracer mass changed outside code sections monitored by Compute_Budget_Diagnostics!!! This could indicate a bug or additional calls to Compute_Budget_Diagnostics are needed.      

Between DO_PBL_MIX_2 and DO_TEND

 Compute budget diag (2) -> at DO_PBL_MIX_2 (in module GeosCore/vdiff_mod.F90)
 Compute budget diag (1) -> at DO_TEND (in module GeosCore/mixing_mod.F90)
 Budget Diagnostic Warning: PBL-column tracer mass changed  unexpectedly, rerr=   371.95822221675036
 Tracer mass changed outside code sections monitored by Compute_Budget_Diagnostics!!! This could indicate a bug or additional calls to Compute_Budget_Diagnostics are needed.       

Between DO_TEND and Do_Convection

 Compute budget diag (2) -> at DO_TEND (in module GeosCore/mixing_mod.F90)
     ### MAIN: a TURBDAY:2
 Compute budget diag (1) -> at Do_Convection (in module GeosCore/convection_mod.F)
 Budget Diagnostic Warning: PBL-column tracer mass changed  unexpectedly, rerr=   371.95822221675036
 Tracer mass changed outside code sections monitored by Compute_Budget_Diagnostics!!! This could indicate a bug or additional calls to Compute_Budget_Diagnostics are needed. 

Between AIRQNT and Do_Chemistry

 Compute budget diag (2) -> at AIRQNT (in module GeosCore/dao_mod.F)
 Compute budget diag (1) -> at Do_Chemistry  (in module GeosCore/chemistry_mod.F90)
 Budget Diagnostic Warning: PBL-column tracer mass changed  unexpectedly, rerr=   366.63856314338824
 Tracer mass changed outside code sections monitored by Compute_Budget_Diagnostics!!! This could indicate a bug or additional calls to Compute_Budget_Diagnostics are needed.   

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
@lizziel
Copy link
Contributor Author

lizziel commented Aug 1, 2024

I found a bug resulting from the recent addition of the fixed levels budget diagnostic. I pushed the fix. There is one remaining issue with warning message here:

 Compute budget diag (2) -> at Do_Transport (in module GeosCore/transport_mod.F90)
     ### MAIN: a DO_TRANSPORT
     ### MAIN: a SETUP_WETSCAV
 Compute budget diag (1) -> at Compute_PBL_Height (in module GeosCore/pbl_mix_mod.F90)
 Budget Diagnostic Warning: PBL-column tracer mass changed  unexpectedly, rerr=   3.7691022260238571E-002
 Tracer mass changed outside code sections monitored by Compute_Budget_Diagnostics!!! This could indicate a bug or additional calls to Compute_Budget_Diagnostics are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Feature Request New feature or request topic: Diagnostics Related to output diagnostic data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants