Difference between revisions of "Adding new History diagnostics"

From Geos-chem
Jump to: navigation, search
(Adding New Diagnostics)
(Adding New Diagnostics)
 
(One intermediate revision by the same user not shown)
Line 15: Line 15:
 
#[[History collections for species concentrations]]
 
#[[History collections for species concentrations]]
 
#[[History collections for TransportTracers]]
 
#[[History collections for TransportTracers]]
 +
#[[History collections for CO2]]
 
#[[Replicating the behavior of the prior timeseries diagnostics]]
 
#[[Replicating the behavior of the prior timeseries diagnostics]]
 
#<span style="color:blue">'''Adding new History diagnostics'''</span>
 
#<span style="color:blue">'''Adding new History diagnostics'''</span>
Line 24: Line 25:
  
 
#Declare diagnostic array at top of module
 
#Declare diagnostic array at top of module
#Set diagnostic array pointer to null in <tt>Init_State_Diag</tt> subroutine
+
#Set diagnostic array pointer to null in <tt>Zero_State_Diag</tt> subroutine
 
#Create a section in <tt>Init_State_Diag</tt> subroutine to allocate and register the array
 
#Create a section in <tt>Init_State_Diag</tt> subroutine to allocate and register the array
 
#Deallocate the diagnostic array in subroutine <tt>Cleanup_State_Diag</tt>
 
#Deallocate the diagnostic array in subroutine <tt>Cleanup_State_Diag</tt>

Latest revision as of 13:11, 10 May 2021

Previous | Next | Guide to GEOS-Chem History diagnostics

  1. Overview of History diagnostics
  2. Legend for History diagnostics
  3. Collections for History diagnostics
  4. History collections for advection and mixing
  5. History collections for aerosols
  6. History collections for budgets
  7. History collections for chemistry and photolysis
  8. History collections for convection and wet deposition
  9. History collections for dry deposition
  10. History collections for mercury and POPs
  11. History collections for met fields and related quantities
  12. History collections for methane
  13. History collections for species concentrations
  14. History collections for TransportTracers
  15. History collections for CO2
  16. Replicating the behavior of the prior timeseries diagnostics
  17. 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:

  1. Declare diagnostic array at top of module
  2. Set diagnostic array pointer to null in Zero_State_Diag subroutine
  3. Create a section in Init_State_Diag subroutine to allocate and register the array
  4. Deallocate the diagnostic array in subroutine Cleanup_State_Diag
  5. 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.



Previous | Next | Guide to GEOS-Chem History diagnostics