Adding new History diagnostics
- Overview of History diagnostics
- Legend for History diagnostics
- Collections for History diagnostics
- History collections for advection and mixing
- History collections for aerosols
- History collections for budgets
- History collections for chemistry and photolysis
- History collections for convection and wet deposition
- History collections for dry deposition
- History collections for mercury and POPs
- History collections for met fields and related quantities
- History collections for methane
- History collections for species concentrations
- History collections for TransportTracers
- History collections for CO2
- Replicating the behavior of the prior timeseries diagnostics
- Adding new History diagnostics
Adding New Diagnostics
To add your own diagnostics we recommend that you find a similar existing diagnostic and use its implementation as a template. Most of the work is done in Headers/state_diag_mod.F90. Briefly, the following updates to that file are essential for adding in your own netcdf diagnostics:
- Declare diagnostic array at top of module
- Set diagnostic array pointer to null in Zero_State_Diag subroutine
- Create a section in Init_State_Diag subroutine to allocate and register the array
- Deallocate the diagnostic array in subroutine Cleanup_State_Diag
- Add an if block for the diagnostic within subroutine Get_Metadata_State_Diag to define its metadata, making sure to list the diagnostic name with all capital letters
Good diagnostics to use as templates are SpeciesConc for 3-dimensional arrays that are for all species and DryDepVel for 2-dimensional arrays that are for a subset of species. If your diagnostic is not per species then AODDust is a good diagnostic to look at. Search the file Headers/state_diag_mod.F90 for any of these strings to find all instances of code related to their implementation.
Note that information about the dimensions and species collection the diagnostic will include must be specified when allocating the array in Init_State_Diag and in Get_Metadata_State_Diag. In the latter subroutine the Rank is the integer number of dimensions of the diagnostic (not including species) and the TagID string, if any, specifies the species collection to output the diagnostic per. TagIDs are defined in subroutine Get_TagInfo. Each TagID string can also be used as a wildcard within HISTORY.rc to simplify diagnostic name specification (for GEOS-Chem classic only).
Once you have implemented your diagnostic in Headers/state_diag_mod.F90, try adding it to HISTORY.rc and running. You should get your diagnostic output in the netcdf output file as all zeros. The next step is to populate the array with whatever value you want to output. You should do this by passing the State_Diag array to the location where you want to set the values. Then write code to fill the array being sure to wrap it in #if defined( NC_DIAG ) and #endif C-preprocessor code (no indent). A simple test of your understanding is to initially set values to a constant other than zero and see if the output matches what you set the arrays to.
For additional help implementing your own GEOS-Chem diagnostics please contact the GEOS-Chem Support Team.