MERRA-2 implementation details: Difference between revisions

From Geos-chem
Jump to navigation Jump to search
Line 104: Line 104:
!width="175px"|File
!width="175px"|File
!width="800px"|Modifications made
!width="800px"|Modifications made
|-
 
|-valign="top"
|calcrate.F
|calcrate.F
|Multiple instances:
|Multiple instances:
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
|-
 
|-valign="top"
|carbon_mod.F
|carbon_mod.F
|Multiple instances:
|Multiple instances:
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
|-
 
|-valign="top"
|cldice_HbrHOBr_mod.F
|cldice_HbrHOBr_mod.F
|Multiple instances:
|Multiple instances:
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
|-
 
|-valign="top"
|convection_mod.F
|convection_mod.F
|
|
In routine DO_CONVECTION:
In routine DO_CONVECTION:
*Changed code to: <tt>#if defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
*Changed code to: <tt>#if defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
|-
 
|-valign="top"
|dao_mod.F
|dao_mod.F
|
|
Line 128: Line 133:
In routine INTERP:  
In routine INTERP:  
*Changed code to: <tt>#if defined( GEOS_FP ) || defined( MERRA2 )</tt>
*Changed code to: <tt>#if defined( GEOS_FP ) || defined( MERRA2 )</tt>
|-
 
|-valign="top"
|depo_mercury_mod.F
|depo_mercury_mod.F
|
|
In routine ADD_Hg2_SNOWPACK
In routine ADD_Hg2_SNOWPACK
*Changed code to: <tt>#if defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
*Changed code to: <tt>#if defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
|-
 
|-valign="top"
|dust_dead_mod.F
|dust_dead_mod.F
|
|
In routine DST_MBL:  
In routine DST_MBL:  
*For GEOS-FP, add a new value for parameter FLX_MSS_FDG_FCT.  The scale factor ensures that we get the same dust totals (w/in roundoff error) as for GEOS-5.
*For GEOS-FP, add a new value for parameter FLX_MSS_FDG_FCT.  The scale factor ensures that we get the same dust totals (w/in roundoff error) as for GEOS-5.
|-
 
|-valign="top"
|fast_jx_mod.F
|fast_jx_mod.F
|In routine FAST_JX:
|In routine FAST_JX:
*Do cloud overlapping for GEOS-FP in the same way as for GEOS-5 and MERRA.   
*Do cloud overlapping for GEOS-FP in the same way as for GEOS-5 and MERRA.   
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
|-
 
|-valign="top"
|gamap_mod.F
|gamap_mod.F
|
|
In routine INIT_TRACERINFO:  
In routine INIT_TRACERINFO:  
*Changed code to: <tt>#elif defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
*Changed code to: <tt>#elif defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
|-
 
|-valign="top"
|geosfp_read_mod.F90
|geosfp_read_mod.F90
|
|
*Added this module w/ routines to read GEOS-FP met data (in netCDF format)
*Added this module w/ routines to read GEOS-FP met data (in netCDF format)
|-
 
|-valign="top"
|global_ch4_mod.F
|global_ch4_mod.F
|
|
In routines WETLAND_EMIS and READ_COPROD:
In routines WETLAND_EMIS and READ_COPROD:
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
|-
 
|-valign="top"
|input_mod.F
|input_mod.F
|
|
Line 169: Line 181:
In routine VALIDATE_DIRECTORIES:  
In routine VALIDATE_DIRECTORIES:  
*Error check GEOS_FP_DIR for start & end date
*Error check GEOS_FP_DIR for start & end date
|-
 
|-valign="top"
|land_mercury_mod.F
|land_mercury_mod.F
|
|
Line 177: Line 190:
*Changed code to: <tt>#if defined( MERRA ) || defined( GEOS_FP )</tt>
*Changed code to: <tt>#if defined( MERRA ) || defined( GEOS_FP )</tt>
*Extend #if statement for variable SOIL_EMIS_FAC to get the code to compile w/o error.<br>'''''(NOTE: Team Hg: you will have to submit a proper value for this later.'''''  
*Extend #if statement for variable SOIL_EMIS_FAC to get the code to compile w/o error.<br>'''''(NOTE: Team Hg: you will have to submit a proper value for this later.'''''  
|-
 
|-valign="top"
|lightning_nox_mod.F
|lightning_nox_mod.F
|
|
Line 184: Line 198:
In routine GET_OTD_LIS_SCALE:
In routine GET_OTD_LIS_SCALE:
*Now use updated values for <tt>ANN_AVG_FLASHRATE</tt> computed by Lee Murray (2013-11-07).
*Now use updated values for <tt>ANN_AVG_FLASHRATE</tt> computed by Lee Murray (2013-11-07).
|-
 
|-valign="top"
|main.F
|main.F
|
|
Line 191: Line 206:
*Split off the code that reads met fields into internal subroutines READ_INITIAL_MET_FIELDS and READ_MET_FIELDS, for clarity.
*Split off the code that reads met fields into internal subroutines READ_INITIAL_MET_FIELDS and READ_MET_FIELDS, for clarity.
*Renamed NN to NNN to avoid name confusion
*Renamed NN to NNN to avoid name confusion
|-
 
|-valign="top"
|mercury_mod.F
|mercury_mod.F
|
|
Line 197: Line 213:
*In the block that computes LWC, changed code to: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
*In the block that computes LWC, changed code to: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
*In the block that computes Hg0 exchange, changed code to: <tt>#if defined( MERRA ) || defined( GEOS_FP )</tt>
*In the block that computes Hg0 exchange, changed code to: <tt>#if defined( MERRA ) || defined( GEOS_FP )</tt>
|-
 
|-valign="top"
|ocean_mercury_mod.F
|ocean_mercury_mod.F
|
|
Multiple instances:
Multiple instances:
*Now use: <tt>#if defined( MERRA ) || defined( GEOS_FP )</tt>
*Now use: <tt>#if defined( MERRA ) || defined( GEOS_FP )</tt>
|-
 
|-valign="top"
|planeflight_mod.F
|planeflight_mod.F
|
|
In routine PLANEFLIGHT
In routine PLANEFLIGHT
*Now use: <tt>#if defined( MERRA ) || defined( GEOS_FP )</tt>
*Now use: <tt>#if defined( MERRA ) || defined( GEOS_FP )</tt>
|-
 
|-valign="top"
|strat_chem_mod.F90
|strat_chem_mod.F90
|
|
Multiple instances:
Multiple instances:
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
|-
 
|-valign="top"
|sulfate_mod.F
|sulfate_mod.F
|
|
Multiple instances:
Multiple instances:
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
|-valign="top"
|-valign="top"
|tagged_ox_mod.F
|tagged_ox_mod.F
|In routine GET_REGIONAL_POX:
|In routine GET_REGIONAL_POX:
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )</tt>
|-
 
|-valign="top"
|tpcore_bc_mod.F:
|tpcore_bc_mod.F:
|Multiple instances:
|Multiple instances:
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
*Now use: <tt>#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )</tt>
|-
 
|-valign="top"
|vdiff_mod.F90
|vdiff_mod.F90
|In routine VDIFFDR:
|In routine VDIFFDR:
*Changed code to: <tt>#if defined( MERRA ) || defined( GEOS_FP )</tt>
*Changed code to: <tt>#if defined( MERRA ) || defined( GEOS_FP )</tt>
|-
 
|-valign="top"
|wetscav_mod.F
|wetscav_mod.F
|In routines DO_WETDEP, DO_WASHOUT_ONLY
|In routines DO_WETDEP, DO_WASHOUT_ONLY

Revision as of 15:04, 12 August 2015

File:Page is under construction.jpg

Required coding changes in GEOS-Chem

As noted in the section above, the similarities between MERRA and GEOS-FP (especially of the vertical grids) means that in most cases we can just treat MERRA in the same way as for GEOS-5. In many areas of the code, the coding changes are straightforward and simply involve an extension of C-preprocessor statements such as:

#if defined( GEOS_5 ) || defined( MERRA )

to

#if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )

In other areas of GEOS-Chem the changes are more involved. Below we provide a description of the areas of GEOS-Chem that were modified for MERRA:

Top-level directory

File Modifications made
Makefile_header.mk
  • If MET=merra2 or MET=merra-2 (case-insensitive), then activate the MERRA2 C-preprocessor switch
    • i.e. Add -DMERRA2 to the Makefile variable USER_DEFS.
  • If GRID=05x0625 is added, then activate the GRID05x0625 C-preprocessor switch
    • i.e. Add -DGRID05x0625 to the Makefile variable USER_DEFS.

--Bob Y. (talk) 21:25, 11 August 2015 (UTC)

Headers directory

The following modifications for MERRA2 were made in the Headers/ directory:

File Modifications made
CMN_SIZE_mod.F
  • Added size parameters for GEOS-FP grids at 4° x 5° 2° x 2.5° and 0.25° x 0.3125° resolution
gigc_input_opt_mod.F90
  • Add MERRA2_DIR to the OptInput derived type
  • Set Input_Opt%MERRA2_DIR = './' in routine Init_GIGC_Input_Opt
gigc_state_met_mod.F90 Multiple instances:
  • Now use: #if defined( GEOS_FP ) || defined( MERRA ) || defined( MERRA2 )

--Bob Y. (talk) 21:26, 11 August 2015 (UTC)

GeosUtil directory

The following modifications for GEOS-FP were made in the GeosUtil/ directory:

File Modifications made
bpch2_mod.F In routine GET_MODELNAME:
  • Add MERRA2_47L and MERRA2 modelnames to the #if block

In routine GET_NAME_EXT:

  • Return grid name merra2 for MERRA2 fields

In routine GET_NAME_EXT_2D:

  • Now use #if defined( MERRA ) || defined( MERRA2 )

In routine GET_RES_EXT:

  • Return resolution string 05x0625 for 0.5° x 0.625° grids
pressure_mod.F In routines GET_PEDGE and GET_PEDGE_FULLGRID:
  • Compute PEDGE for MERRA2 in the same way as for GEOS-5, MERRA, and GEOS-FP

In routine INIT_PRESSURE:

  • Initialize Ap and Bp for MERRA2 in the same way as for GEOS-5, MERRA, and GEOS-FP
time_mod.F In routine GET_A1_TIME:
  • Compute the DATE array for MERRA2 the same way as is done for MERRA and GEOS-FP
transfer_mod.F In several routines:
  • Changed code to #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )

--Bob Y. (talk) 21:40, 11 August 2015 (UTC)

GeosCore directory

The following modifications for GEOS-FP were made in the GeosCore/ directory:

File Modifications made
calcrate.F Multiple instances:
  • Now use: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )
carbon_mod.F Multiple instances:
  • Now use: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )
cldice_HbrHOBr_mod.F Multiple instances:
  • Now use: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )
convection_mod.F

In routine DO_CONVECTION:

  • Changed code to: #if defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )
dao_mod.F

In routine COPY_I6_FIELDS:

  • Changed code to: #if defined( GEOS_FP ) || defined( MERRA2 )

In routine INTERP:

  • Changed code to: #if defined( GEOS_FP ) || defined( MERRA2 )
depo_mercury_mod.F

In routine ADD_Hg2_SNOWPACK

  • Changed code to: #if defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )
dust_dead_mod.F

In routine DST_MBL:

  • For GEOS-FP, add a new value for parameter FLX_MSS_FDG_FCT. The scale factor ensures that we get the same dust totals (w/in roundoff error) as for GEOS-5.
fast_jx_mod.F In routine FAST_JX:
  • Do cloud overlapping for GEOS-FP in the same way as for GEOS-5 and MERRA.
  • Now use: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )
gamap_mod.F

In routine INIT_TRACERINFO:

  • Changed code to: #elif defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )
geosfp_read_mod.F90
  • Added this module w/ routines to read GEOS-FP met data (in netCDF format)
global_ch4_mod.F

In routines WETLAND_EMIS and READ_COPROD:

  • Now use: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )
input_mod.F

In routine READ_SIMULATION_MENU:

  • Read value for GEOS_FP_DIR from input.geos file and save into Input_Opt
  • Set LUNZIP=.FALSE. for GEOS-FP met

In routine READ_CONVECTION_MENU:

  • Change #if statement to allow non-local PBL mixing for GEOS-FP met data

In routine READ_EMISSIONS_MENU:

  • Turn off LMEGANMONO when LMEGAN is turned off

In routine VALIDATE_DIRECTORIES:

  • Error check GEOS_FP_DIR for start & end date
land_mercury_mod.F

In routines LAND_MERCURY_FLUX:

  • Changed code to: #if defined( MERRA ) || defined( GEOS_FP )

In routines SOILEMIS:

  • Changed code to: #if defined( MERRA ) || defined( GEOS_FP )
  • Extend #if statement for variable SOIL_EMIS_FAC to get the code to compile w/o error.
    (NOTE: Team Hg: you will have to submit a proper value for this later.
lightning_nox_mod.F

In routine LIGHTNING:

  • Eliminate the shallow-cloud inhibititon trap for GEOS-FP, as we already do for GEOS-5 and MERRA

In routine GET_OTD_LIS_SCALE:

  • Now use updated values for ANN_AVG_FLASHRATE computed by Lee Murray (2013-11-07).
main.F
  • Rewrote USE statements for clarity
  • Added calls to routines from geosfp_read_mod.F
  • Split off the code that reads met fields into internal subroutines READ_INITIAL_MET_FIELDS and READ_MET_FIELDS, for clarity.
  • Renamed NN to NNN to avoid name confusion
mercury_mod.F

In routine CHEM_Hg0_Hg2:

  • In the block that computes LWC, changed code to: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )
  • In the block that computes Hg0 exchange, changed code to: #if defined( MERRA ) || defined( GEOS_FP )
ocean_mercury_mod.F

Multiple instances:

  • Now use: #if defined( MERRA ) || defined( GEOS_FP )
planeflight_mod.F

In routine PLANEFLIGHT

  • Now use: #if defined( MERRA ) || defined( GEOS_FP )
strat_chem_mod.F90

Multiple instances:

  • Now use: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )
sulfate_mod.F

Multiple instances:

  • Now use: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )
tagged_ox_mod.F In routine GET_REGIONAL_POX:
  • Now use: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP ) || defined( MERRA2 )
tpcore_bc_mod.F: Multiple instances:
  • Now use: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )
vdiff_mod.F90 In routine VDIFFDR:
  • Changed code to: #if defined( MERRA ) || defined( GEOS_FP )
wetscav_mod.F In routines DO_WETDEP, DO_WASHOUT_ONLY
  • Changed code to: #if defined( MERRA ) || defined( GEOS_FP )

In routine MAKE_QQ:

  • Add #if block for GEOS-FP met
  • Refer to PFILSAN(I,J,L+1) and PFLLSAN(I,J,L+1), since these fields are defined on level edges

In routine RAINOUT:

  • Changed code to: #if defined( GEOS_5 ) || defined( MERRA ) || defined( GEOS_FP )

--Bob Y. (talk) 22:13, 11 August 2015 (UTC)

NcdfUtil directory

We have added the NcdfUtil/ directory, which contains routines for netCDF file I/O. These routines are based on the NcdfUtilities package by Bob Yantosca. These are built when you compile GEOS-Chem with the NETCDF=yes Makefile option.

File Description
Makefile GNU Makefile used to build the NcdfUtil code.
TestNcdfUtil.F90 Test program to verify that the netCDF libraries were built properly. (This is executed only when you issue a make ncdfcheck command.)
m_do_err_out.F90 Routine to print out netCDF error messages.
m_netcdf_io_checks.F90 Routines to check whether a netCDF file contains a specified variable or dimension.
m_netcdf_io_close.F90 Routines to close a netCDF file.
m_netcdf_io_create.F90 Routines used to open a netCDF file for output and to synchronize a netCDF file.
m_netcdf_io_define.F90 Routines to define netCDF variables and attributes. Use this when writing data to a netCDF file.
m_netcdf_io_get_dimlen.F90 Routines to return dimension information from a netCDF file.
m_netcdf_io_handle_err.F90 Routines for netCDF I/O error handling.
m_netcdf_io_open.F90 Routines for opening a netCDF file for reading or for writing.
m_netcdf_io_read.F90 Routines for reading variables (of INTEGER, REAL*4, REAL*8, and CHARACTER types) from a netCDF file.
m_netcdf_io_readattr.F90 Routines for reading global and variable attributes (of INTEGER, REAL*4, REAL*8, and CHARACTER types) from a netCDF file.
m_netcdf_io_write.F90 Routines for writing data to a netCDF file

--Bob Y. 10:34, 3 February 2012 (EST)

NcdfUtil/perl subdirectory

In this directory, we have added scripts for automatically generating Fortran code with the proper calls from the NcdfUtilities package. We anticipate that this will be a convenience for GEOS-Chem users, as it will relieve some of the drudgery of writing these calls by hand.

File Description
StrTrim.pm Perl module used by the ncCode* scripts. Contains routines for stripping withe space from strings.
ncCodeDef Perl script that generates Fortran code to open a netCDF file and define the various dimensions, variables, and attributes.
ncCodeWrite Perl script that will generate Fortran code to write data to a netCDF file.
ncCodeRead Perl script that will generate Fortran code to read data from a netCDF file.
nc_definitions.rc Generic input file used by the ncCode* scripts. You can edit this.
definitions_cn.rc Customized version of nc_definitions.rc that will generate Fortran code for reading GEOS-FP CN data.
definitions_a1.rc Customized version of nc_definitions.rc that will generate Fortran code for reading GEOS-FP A1 data.
definitions_a3cld.rc Customized version of nc_definitions.rc that will generate Fortran code for reading GEOS-FP A3cld data.
definitions_a3dyn.rc Customized version of nc_definitions.rc that will generate Fortran code for reading GEOS-FP A3dyn data.
definitions_a3mstc.rc Customized version of nc_definitions.rc that will generate Fortran code for reading GEOS-FP A3mstC data.
definitions_a3mste.rc Customized version of nc_definitions.rc that will generate Fortran code for reading GEOS-FP A3mstE data.
definitions_i3.rc Customized version of nc_definitions.rc that will generate Fortran code for reading GEOS-FP I3 data.

--Bob Y. 15:49, 12 May 2014 (EDT)