Difference between revisions of "Sandbox"

From Geos-chem
Jump to: navigation, search
(feel free to experiment here)
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==feel free to experiment here ==
+
== Instructions for adding tracers to GEOS-Chem ==
  
{| border=1 bordercolor="#000000" cellpadding="5" cellspacing="0"
+
'''''By [mailto:mpayer@seas.harvard.edu Melissa Payer]'''''
|-valign="top"
+
|Yuan_XLAI
+
|DEFAULT
+
|[[Leaf area indices in GEOS-Chem#Yuan processed MODIS LAI|Yuan processed MODIS LAI data]]
+
*cf Yuan et al 2011, doi:10.1016/j.rse.2011.01.001
+
  
This data has been processed into 73 netCDF variables (one corresponding to each Olson land type), which facilitates regridding by HEMCO.
+
These instructions describe how to add advected tracers to GEOS-Chem. Advected tracers are carried in the <tt>STT</tt> array (which is declared in <tt>GeosCore/tracer_mod.F</tt>), and are transported by the winds. 
|[ftp://ftp.as.harvard.edu/gcgrid/data/ExtData/HEMCO/Yuan_XLAI/v2019-03/ <tt>HEMCO/Yuan_XLAI/v2019-03</tt>]
+
  
|}
+
NOTE: Some advected tracers are also chemical species, which comprise GEOS-Chem's NOx-Ox-HC-aerosol chemistry mechanism.
  
 +
#<p>Add tracers to input.geos under Tracer Menu</p>
 +
##<p>Increase “Number of tracers” accordingly</p>
 +
##<p>Add tracer number, name, molecular weight, and emitted species to end of tracer list</p>
 +
#<p>Add tracer(s) to restart file – see separate instructions</p>
 +
#<p>Modify the following source code routines:</p>
 +
##<p><tt>Headers/CMN_SIZE_mod.F</tt></p>
 +
###<p>Increase <tt>NNPAR</tt> by number of tracers being added</p>
 +
###<p>If the species have anthropogenic emissions, increase NEMPARA accordingly</p>
 +
###<p>If the species have biogenic emissions, increase NEMPARB accordingly</p>
 +
###<p>If the species have biomass burning emissions, increase NBIOMAX accordingly</p>
 +
##<p><tt>GeosCore/tracerid_mod.F</tt></p>
 +
###<p>Increase <tt>NNNTRID</tt> by the number of tracers being added NOTE: <tt>NNNTRID</tt> must be equal to <tt>NNPAR</tt> in <tt>CMN_SIZE_mod.F</tt></p>
 +
###<p>Define tracer IDs as needed:</p>
 +
####<p>IDxxxx – ID for SMVGEAR species</p>
 +
####<p>IDTxxxx – GEOS-Chem tracer ID</p>
 +
####<p>IDExxxx – GEOS-Chem emission ID</p>
 +
####<p>IDBFxxxx – GEOS-Chem biofuel ID</p>
 +
####<p>IDBxxxx – GEOS-Chem biomass ID</p>
 +
###<p>In subroutine <tt>TRACERID</tt>,</p>
 +
####<p>Under “Assign tracer, biomass, biofuel, and anthro emission ID’s,” add case for added tracers to initialize IDTxxxx, IDBFxxxx, IDBxxxx</p>
 +
####<p>Under “Initialize the IDExxx flags,” add IF statement for added tracer IDs and initialize IDExxxx</p>
 +
####<p>Under “Fill IDEMS with appropriate tracer ID #’s,” add IF statement for added tracers</p>
 +
####<p>Under “Print additional information,” add WRITE statements for added tracers</p>
 +
###<p>In subroutine SETTRACE  (NOTE: Only do the following if species is included in SMVGEAR chemical mechanism<p>
 +
####<p>Add IF statement, to initialize IDxxxx</p>
 +
####<p>In subroutine INIT_TRACERID,</p>
 +
####<p>Zero all IDs added (IDxxxx, IDTxxxx, IDExxxx, etc.)</p>
 +
##<p>Other modules that may need to be updated include:</p>
 +
###<p>wetscav_mod.F</p>
 +
###<p>drydep_mod.F</p>
 +
###<p>emissions_mod.F</p>
 +
###<p>biomass_mod.F</p>
 +
###<p>biofuel_mod.F</p> etc.
  
  
=== Quick fix to use Yuan-processed MODIS LAI in GEOS-Chem Classic ===
 
  
Bob Yantosca discovered an error when using the Yuan-processed MODIS LAI data in GEOS-Chem "Classic" simulations.  HEMCO cannot locate the proper bounding timestamps for the interpolation.
+
Instructions for adding species to GEOS-Chem
  
<blockquote>Example: HEMCO should have detected that simulation date '''20160701''' was bounded by data timestamps '''20160624''' and '''20160704''', and should have interpolated accordingly.  Instead, HEMCO was detecting that simulation data '''20160701''' was bounded by data timestamps '''20160602''' and '''20160610'''.  This is clearly wrong.</blockquote>
+
Modify run directory files
  
Christoph Keller traced this error to routine <tt>GET_TIMEIDX</tt> in module <tt>HEMCO/Core/hcoio_read_std_mod.F90</tt>, which is only used for GEOS-Chem "Classic" simulations.  The search algorithm was continuing to look for timestamps further back in time than was necessary.
+
1) Add tracers to input.geos under Tracer Menu
 +
c) Increase “Number of tracers” accordingly
 +
d) Add tracer number, name, molecular weight, and emitted species to end of tracer list
  
If you need to run GEOS-Chem simulations with the Yuan-processed MODIS LAI data, Christoph Keller has submitted a quick fix.  Add the IF statement in  <span style="color:green">GREEN</span> to this code in <tt>hcoio_read_std_mod.F90</tt>.  This will force the timestamp search algorithm to terminate before it goes too far back in time.
+
2) Add tracer(s) to restart file – see separate instructions
  
        ! -------------------------------------------------------------
+
3) Modify globchem.dat to include additional species, kinetic reactions (including emissions and drydep), or photolysis reactions
        ! Check if we need to continue search. Even if the call above
+
NOTE: If you modify globchem.dat and plan to run GEOS-Chem using the KPP chemical solver, you will need to generate new gckpp*.F90 files. For more information see the following wiki pages:
        ! returned a time slice, it may be possible to continue looking
+
http://wiki.seas.harvard.edu/geos-chem/index.php/KPP_solvers_FAQ#What_are_the_cons_of_using_KPP.3F
        ! for a better suited time stamp. This is only the case if
+
http://wiki.seas.harvard.edu/geos-chem/index.php/Interfacing_GEOS-Chem_with_KPP#Generating_KPP_input_files_from_GEOS-Chem_globchem.dat
        ! there are discontinuities in the time stamps, e.g. if a file
+
        ! contains monthly data for 2005 and 2020. In that case, the
+
        ! call above would return the index for Dec 2005 for any
+
        ! simulation date between 2005 and 2010 (e.g. July 2010),
+
        ! whereas it makes more sense to use July 2005 (and eventually
+
        ! interpolate between the July 2005 and July 2020 data).
+
        ! The IsClosest command checks if there are any netCDF time
+
        ! stamps (prior to the selected one) that are closer to each
+
        ! other than the difference between the preferred time stamp
+
        ! prefYMDhm and the currently selected time stamp
+
        ! availYMDhm(tidx1a). In that case, it continues the search by
+
        ! updating prefYMDhm so that it falls within the range of the
+
        ! 'high-frequency' interval.
+
        ! -------------------------------------------------------------
+
        ExitSearch = .FALSE.
+
        IF ( Lct%Dct%Dta%CycleFlag == HCO_CFLAG_EXACT ) THEN
+
          ExitSearch = .TRUE.
+
        ELSE IF ( tidx1a > 0 ) THEN
+
          ExitSearch = IsClosest( prefYMDhm, availYMDhm, nTime, tidx1a )
+
        ENDIF
+
        <span style="color:green">!### for testing, only apply to containers with “XLAI” in the name
+
        IF ( INDEX( Lct%Dct%Cname, 'XLAI' ) > 0 ) THEN
+
          ExitSearch = .true.
+
        ENDIF</span>
+
  
We will try to add a more robust fix for this issue in the near future. We did not want to add a fix that was contingent on a HEMCO container name to the standard code.
+
4) If necessary, modify:
 
+
a) ratj.d – contains species names and branching ratios for FAST–JX photolysis species
NOTE: GCHP is unaffected by this issue, as it uses the MAPL ExtData functionality to read data from disk. We have verified that GCHP reads in the Yuan-processed MODIS LAI data properly.
+
For more information: http://acmg.seas.harvard.edu/geos/doc/man/chapter_5.html#5.4.1
 
+
b) jv_spec.dat – contains cross-sections and quantum yields for FAST–JX photolysis species
--[[User:Bmy|Bob Yantosca]] ([[User talk:Bmy|talk]]) 19:23, 7 June 2019 (UTC)
+
For more information: http://acmg.seas.harvard.edu/geos/doc/man/chapter_5.html#5.4.3

Latest revision as of 21:25, 10 May 2023

Instructions for adding tracers to GEOS-Chem

By Melissa Payer

These instructions describe how to add advected tracers to GEOS-Chem. Advected tracers are carried in the STT array (which is declared in GeosCore/tracer_mod.F), and are transported by the winds.

NOTE: Some advected tracers are also chemical species, which comprise GEOS-Chem's NOx-Ox-HC-aerosol chemistry mechanism.

  1. Add tracers to input.geos under Tracer Menu

    1. Increase “Number of tracers” accordingly

    2. Add tracer number, name, molecular weight, and emitted species to end of tracer list

  2. Add tracer(s) to restart file – see separate instructions

  3. Modify the following source code routines:

    1. Headers/CMN_SIZE_mod.F

      1. Increase NNPAR by number of tracers being added

      2. If the species have anthropogenic emissions, increase NEMPARA accordingly

      3. If the species have biogenic emissions, increase NEMPARB accordingly

      4. If the species have biomass burning emissions, increase NBIOMAX accordingly

    2. GeosCore/tracerid_mod.F

      1. Increase NNNTRID by the number of tracers being added NOTE: NNNTRID must be equal to NNPAR in CMN_SIZE_mod.F

      2. Define tracer IDs as needed:

        1. IDxxxx – ID for SMVGEAR species

        2. IDTxxxx – GEOS-Chem tracer ID

        3. IDExxxx – GEOS-Chem emission ID

        4. IDBFxxxx – GEOS-Chem biofuel ID

        5. IDBxxxx – GEOS-Chem biomass ID

      3. In subroutine TRACERID,

        1. Under “Assign tracer, biomass, biofuel, and anthro emission ID’s,” add case for added tracers to initialize IDTxxxx, IDBFxxxx, IDBxxxx

        2. Under “Initialize the IDExxx flags,” add IF statement for added tracer IDs and initialize IDExxxx

        3. Under “Fill IDEMS with appropriate tracer ID #’s,” add IF statement for added tracers

        4. Under “Print additional information,” add WRITE statements for added tracers

      4. In subroutine SETTRACE (NOTE: Only do the following if species is included in SMVGEAR chemical mechanism<p>

        1. <p>Add IF statement, to initialize IDxxxx

        2. In subroutine INIT_TRACERID,

        3. Zero all IDs added (IDxxxx, IDTxxxx, IDExxxx, etc.)

    3. Other modules that may need to be updated include:

      1. wetscav_mod.F

      2. drydep_mod.F

      3. emissions_mod.F

      4. biomass_mod.F

      5. biofuel_mod.F

        etc.


Instructions for adding species to GEOS-Chem

Modify run directory files

1) Add tracers to input.geos under Tracer Menu c) Increase “Number of tracers” accordingly d) Add tracer number, name, molecular weight, and emitted species to end of tracer list

2) Add tracer(s) to restart file – see separate instructions

3) Modify globchem.dat to include additional species, kinetic reactions (including emissions and drydep), or photolysis reactions NOTE: If you modify globchem.dat and plan to run GEOS-Chem using the KPP chemical solver, you will need to generate new gckpp*.F90 files. For more information see the following wiki pages: http://wiki.seas.harvard.edu/geos-chem/index.php/KPP_solvers_FAQ#What_are_the_cons_of_using_KPP.3F http://wiki.seas.harvard.edu/geos-chem/index.php/Interfacing_GEOS-Chem_with_KPP#Generating_KPP_input_files_from_GEOS-Chem_globchem.dat

4) If necessary, modify: a) ratj.d – contains species names and branching ratios for FAST–JX photolysis species For more information: http://acmg.seas.harvard.edu/geos/doc/man/chapter_5.html#5.4.1 b) jv_spec.dat – contains cross-sections and quantum yields for FAST–JX photolysis species For more information: http://acmg.seas.harvard.edu/geos/doc/man/chapter_5.html#5.4.3