From 11890621257a43a5226b8b24e0fe526d171a034e Mon Sep 17 00:00:00 2001 From: Thibaud Fritz Date: Wed, 6 Nov 2019 10:34:36 -0500 Subject: [PATCH 001/160] Feat: Changes to include GEOS-Chem as a chemistry option for CESM (1) This introduces an option to compile GEOS-Chem src files. (2) Interface is inexistant so far (3) CAM still uses the Terminator chem package to satisfy dependencies Reproducing commit from MSL - Jan 19, 2018 --- src/chemistry/pp_geoschem/.exclude | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/chemistry/pp_geoschem/.exclude diff --git a/src/chemistry/pp_geoschem/.exclude b/src/chemistry/pp_geoschem/.exclude new file mode 100644 index 0000000000..2f725c1ef5 --- /dev/null +++ b/src/chemistry/pp_geoschem/.exclude @@ -0,0 +1,53 @@ +regrid_a2a_mod.F90 +transport_mod.F +drydep_mod.F +tpcore_window_mod.F90 +tpcore_bc_mod.F90 +tpcore_fvdas_mod.F90 +olson_landmap_mod.F90 +geosfp_read_mod.F90 +modis_lai_mod.F90 +hco_interp_mod.F90 +merra2_read_mod.F90 +regrid_a2a_mod.F90 +land_mercury_mod.F +hcoio_read_std_mod.F90 +hcoio_dataread_mod.F90 +hco_readlist_mod.F90 +hcox_paranox_mod.F90 +hco_config_mod.F90 +planeflight_mod.F +hco_driver_mod.F90 +hcox_driver_mod.F90 +hcox_lightnox_mod.F90 +hcoi_standalone_mod.F90 +hemco_standalone.F90 +restart_mod.F +pops_mod.F +diag49_mod.F +diag51_mod.F +diag03_mod.F +diag04_mod.F +diag1.F +diag20_mod.F +diag_2pm.F +diag3.F +diag41_mod.F +diag42_mod.F +diag48_mod.F +diag50_mod.F +diag51b_mod.F +diag53_mod.F +diag56_mod.F +diag63_mod.F +emissions_mod.F90 +diag3.F +hcoi_gc_main_mod.F90 +gamap_mod.F +initialize.F +ndxx_setup.F +mixing_mod.F90 +vdiff_mod.F90 +input_mod.F +cleanup.F +main.F From a5bf274c92c4b95d7f2b1076a5fcf415fe1e6396 Mon Sep 17 00:00:00 2001 From: Thibaud Fritz Date: Thu, 14 May 2020 15:42:04 -0400 Subject: [PATCH 002/160] Squashed of 50+ commits from Thibaud Fritz Feat: Update config files to include GEOS-Chem option for CAM (1) Update config files in cam/bld/ (2) Update config files in cam/cime_config Feat: Add customized chemistry.F90 for GEOS-Chem: *Reproducing commit from MSL - Mar 6, 2018 Feat: Initial implementation of compilable code (1) The code can now be compiled using a CAM 4.0 + "dummy" GEOS-Chem component set (compset FGC). This is based on the "tropospheric mozart" set. *Reproducing commit from SDE - May 17, 2018 Feat: Make radiatively-active species into chemical constituants (1) Added N2O, CH4, CFC11, CFC12 Feat: Get tracers and species from input.geos and KPP (1) Tracer lists are now acquired from the input files and from the pre-built KPP mechanism *Reproducing commit from SDE - May 19, 2018 Feat: Add additional flags when compiling GEOS-Chem Fix: Update folder name following version 12.6.0 Feat: Allocate major state variables (Input, Met, Chem) (1) Allocating GEOS-Chem state variables (2) Setting input.geos path as a module variable *Reproducing commit from SDE - May 19, 2018 Chore: Cleanup and capitalization Feat: Initialize core GEOS-Chem modules (1) Initializes ChmState, GrdState and MetState objects (2) Grid objects are currently initialized identically. However, they should be chunk-dependent. The grids are set based on the lat/lon edges for now, using GEOS-Chem's SetGridFromCtrEdges subroutine (3) Initializes Input_Opt (4) Added subroutine to update time-steps within GEOS-Chem (5) Added error trapping statements Feat: Add initialization of Linoz module and passing CHEM_INPUTS (1) Initializing Linoz module (2) Passing CHEM_INPUTS to Input_Opt (3) Remove incorrect overwrite of NTracers Feat: Initialize and cleanup State_Chm and State_Met Feat: Initialize Drydep_Mod (1) Initialize Drydep_Mod (2) Update .exclude file to include GeosCore/drydep_mod.F Feat: Add Init_Error to chem_init for GEOS-Chem Feat: Initialize and cleanup GEOS-Chem modules (1) Add calls to module initialization and cleanup subroutines (2) Update .exclude file Feat: Get grid area and Ap and Bp values from CAM (1) Get grid area from CAM interface (2) Pass CAM's Ap and Bp values to GEOS-Chem's Pressure_Mod (3) Call to Cleanup_Pressure Feat: Affect data to State_Chm Feat: Initialize chemistry, add missing cleanup routines Feat: Initialize pressure transfer Feat: Add first call to chemistry Feat: Register all tracers using species database (1) Register species (2) Initial step towards the update of State_Met Feat: Fill key variables in State_Met Feat: Add PBL height transfer capability (1) Enforce lat/lonMidArr to be R4 not FP Feat: Enforce correct tracer registration Feat: Add initialization of short-lived species Feat: Update surface area during chemistry loop Feat: Use reference MMRs when queried for ICs (1) Zero reference MMRs at initialization (2) Use reference MMRs when queried for initial conditions Feat: Groundwork for correctly reporing H2O tendencies (1) Add indices to key species Feat: Add all advected species to output (1) Add advected species to output (2) Force precision of H2O to be r8 (3) Fixed capitalization of variables Feat: Make short-lived species persist between time steps Feat: Set GEOS-Chem data from CAM (1) Date information is now propagated to GEOS-Chem. Algorithm needs tweaking (seems to give a date 1 minute earlier than it should). Also currently force the year to be 2000 as the default CAM year is 0000. Feat: Disable stratospheric aerosols in GEOS-Chem Feat: Progate more met fields to State_Met using CAM data Feat: Change NY to PCOLS for consistency and add step count tracking Feat: Increased default list of diagnostics for GEOS-Chem Feat: Implement GEOS-Chem wet deposition + Estimate of 2D cloudiness (1) Implemented GEOS-Chem wet deposition (2) CAM does not provide an estimate of 2D cloud cover, so we use an estimate (maximum 3D cloudiness in vertical column). This matches the technique originally used for GCAP in GEOS-Chem. (3) Fix Z0 not being assigned Feat: Move SLS information to chem_mods + Emission module (1) Move tracer and SLS information out to chem_mods (2) Added temporary NO source to provide useful output (3) Initial code stub for an emissions module Fix: Fix reading of tracers in input.geos (1) Tracers in input.geos (2) Fix indentation Chore: Now compiling GEOS-Chem with -DMODEL_ Feat: Added wet/(dry) deposition. See more comments below! (01) Added definition of MaxTropLev, MaxStratLev and MaxChemLev. This will require some additional thought (02) As of right now, Linoz is turned off as the current grid doesn't extend past 30 km, causing segmentation when running with Linoz turned on (03) Added code that's commented out right now for future development (HEMCO, Olson landmap, convection, ...) (04) Added field descrition and unit of State_Met variables when converted from CESM to State_Met (05) Updated compution of cloud optical depth. Following what MOZART does. (06) Now correctly initializing InChemGrid to .True. everywhere (07) Added newDay, newMonth variables (08) Added wet deposition (09) Added dry deposition. However, it is purely a software right now, as it runs without initializing land types (10) Uniformization of variables Chore: Remove debug Feat: Deal with compile-time definition of GEOS-Chem dry dep. species (1) Update ChemNamelist to be able to read deposition species from .xml files and filtering these with the species list from mo_sim_dat.F90. This last file lists all GEOS-Chem species and is only read at compile time and is not compiled since GEOS-Chem tracers and species are defined at run time from input.geos and KPP files. (2) Update geoschem.xml to now list dry and wet deposition species Feat: Implement dry deposition in CESM/GC (1) Different options are available to compute dry deposition velocities: 1. All deposition velocities are computed from GEOS-Chem using data from HEMCO 2. CLM passes dry deposition velocities over land and ocean and ice velocities are computed from GEOS-Chem using data from HEMCO 3. CLM passes dry deposition velocities over land and ocean and ice velocities are computed in a similar way as MOZART Feat: Add missing file from last commit to replicate MOZART's dry dep. calculations Feat: Add Externals to download GEOS-Chem source code Feat: Add mo_chem_utils.F90 required for mo_drydep_mod Feat: Update .exclude Feat: Import CLM4.0/4.5/5.0 data and use it for GEOS-Chem (1) Import data from CLM (2) Add compset to run GEOS-Chem with CLM4.5/5.0 (3) Add routine getLandTypes to convert CLM to OlsonLandMaps. More work is needed to convert CLM4.5 land types (4) CAM's building procedure has been modified to include the right version of CLM (5) Modify .exclude Style: Fix typos that got introduced when converting commits to fork Feat: Modify Externals_CAM.cfg to download GEOS-Chem code Revert "Feat: Modify Externals_CAM.cfg to download GEOS-Chem code" Feat: Update .gitignore to ignore GEOS-Chem repo --- .gitignore | 2 +- Externals_CAM.cfg | 7 + bld/build-namelist | 8 +- bld/config_files/definition.xml | 2 + bld/configure | 69 +- bld/namelist_files/namelist_definition.xml | 2 +- bld/namelist_files/use_cases/geoschem.xml | 82 + .../use_cases/geoschem_baro_moist.xml | 22 + bld/perl5lib/Build/ChemNamelist.pm | 46 + cime_config/buildcpp | 9 + cime_config/config_component.xml | 12 +- cime_config/config_compsets.xml | 27 + src/chemistry/pp_geoschem/.exclude | 11 +- src/chemistry/pp_geoschem/aero_model.F90 | 1150 +++++ .../pp_geoschem/charge_neutrality.F90 | 176 + src/chemistry/pp_geoschem/chem_mods.F90 | 91 + .../pp_geoschem/chem_prod_loss_diags.F90 | 37 + src/chemistry/pp_geoschem/chemistry.F90 | 4225 +++++++++++++++++ src/chemistry/pp_geoschem/clybry_fam.F90 | 180 + src/chemistry/pp_geoschem/epp_ionization.F90 | 508 ++ src/chemistry/pp_geoschem/gc_emissions.F90 | 76 + src/chemistry/pp_geoschem/getLandTypes.F90 | 218 + src/chemistry/pp_geoschem/mo_apex.F90 | 314 ++ src/chemistry/pp_geoschem/mo_chem_utls.F90 | 162 + src/chemistry/pp_geoschem/mo_drydep.F90 | 3303 +++++++++++++ .../pp_geoschem/mo_gas_phase_chemdr.F90 | 1180 +++++ src/chemistry/pp_geoschem/mo_lightning.F90 | 182 + src/chemistry/pp_geoschem/mo_sim_dat.F90 | 839 ++++ src/chemistry/pp_geoschem/rate_diags.F90 | 177 + .../pp_geoschem/short_lived_species.F90 | 229 + src/chemistry/pp_geoschem/upper_bc.F90 | 243 + src/control/camsrfexch.F90 | 31 +- src/cpl/atm_import_export.F90 | 20 +- src/cpl/cam_cpl_indices.F90 | 15 +- 34 files changed, 13623 insertions(+), 32 deletions(-) create mode 100644 bld/namelist_files/use_cases/geoschem.xml create mode 100644 bld/namelist_files/use_cases/geoschem_baro_moist.xml create mode 100644 src/chemistry/pp_geoschem/aero_model.F90 create mode 100644 src/chemistry/pp_geoschem/charge_neutrality.F90 create mode 100644 src/chemistry/pp_geoschem/chem_mods.F90 create mode 100644 src/chemistry/pp_geoschem/chem_prod_loss_diags.F90 create mode 100644 src/chemistry/pp_geoschem/chemistry.F90 create mode 100644 src/chemistry/pp_geoschem/clybry_fam.F90 create mode 100644 src/chemistry/pp_geoschem/epp_ionization.F90 create mode 100644 src/chemistry/pp_geoschem/gc_emissions.F90 create mode 100644 src/chemistry/pp_geoschem/getLandTypes.F90 create mode 100644 src/chemistry/pp_geoschem/mo_apex.F90 create mode 100644 src/chemistry/pp_geoschem/mo_chem_utls.F90 create mode 100644 src/chemistry/pp_geoschem/mo_drydep.F90 create mode 100644 src/chemistry/pp_geoschem/mo_gas_phase_chemdr.F90 create mode 100644 src/chemistry/pp_geoschem/mo_lightning.F90 create mode 100644 src/chemistry/pp_geoschem/mo_sim_dat.F90 create mode 100644 src/chemistry/pp_geoschem/rate_diags.F90 create mode 100644 src/chemistry/pp_geoschem/short_lived_species.F90 create mode 100644 src/chemistry/pp_geoschem/upper_bc.F90 diff --git a/.gitignore b/.gitignore index 18ee78968c..5cc0bde57c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ src/physics/carma/base src/physics/clubb src/physics/cosp2/src src/physics/silhs - +src/chemistry/pp_geoschem/geoschem_src # Ignore compiled python buildnmlc diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index b9f5082208..e50b7ea88e 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -26,6 +26,13 @@ repo_url = https://github.com/CFMIP/COSPv2.0/tags/ tag = v2.0.3cesm/src required = True +[geoschem] +local_path = src/chemistry/pp_geoschem/geoschem_src +protocol = git +tag = CESM +repo_url = https://github.com/fritzt/CESM2-GC_Src +required = True + [externals_description] schema_version = 1.0.0 diff --git a/bld/build-namelist b/bld/build-namelist index 2b470043b8..7d8374fe81 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -1016,6 +1016,8 @@ if ((($chem =~ /waccm_ma/) or ($chem =~ /waccm_sc_mam/) or ($chem =~ /waccm_tsml $radval .= ",'A:N2O:N2O','A:CH4:CH4','A:CFC11:CFC11','A:CFC12:CFC12'"; } elsif ($prog_ghg1 and !$prog_ghg2 and !$chem_rad_passive ) { $radval .= ",'A:N2O:N2O','A:CH4:CH4','N:CFC11:CFC11','N:CFC12:CFC12'"; +} elsif ($chem =~ /geoschem/) { + $radval .= ",'A:N2O:N2O','A:CH4:CH4','A:CFC11:CFC11','A:CFC12:CFC12'"; } else { $radval .= ",'N:N2O:N2O','N:CH4:CH4','N:CFC11:CFC11','N:CFC12:CFC12'"; } @@ -1887,7 +1889,7 @@ my $megan_emis = defined $nl->get_value('megan_specifier'); if ( $megan_emis ) { add_default($nl, 'megan_factors_file'); } # Tropospheric full chemistry options -if (($chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) and ($phys !~ /cam6/)) { +if (($chem =~ /geoschem/ or $chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) and ($phys !~ /cam6/)) { # Surface emission datasets: my %verhash; @@ -2068,7 +2070,7 @@ if (($chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) } } -if ($chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) { +if ($chem =~ /geoschem/ or $chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) { my $val; @@ -2083,6 +2085,8 @@ if ($chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) { if ($chem =~ /_tsmlt_mam/ or $chem =~ /trop_strat/) { $val = "'CCL4','CF2CLBR','CF3BR','CFC11','CFC113','CFC12','CH3BR','CH3CCL3','CH3CL','CH4','CO2'" .",'H2','HCFC22','N2O','CFC114','CFC115','HCFC141B','HCFC142B','CH2BR2','CHBR3','H2402'"; + } elsif ($chem =~ /geoschem/) { + $val = "'CH4','OCS','N2O','CO2','CFC11','CFC12'"; } else { $val = "'CH4','H2','N2O','CO2','CFC11','CFC12'"; } diff --git a/bld/config_files/definition.xml b/bld/config_files/definition.xml index 656f62f152..dd0d01e5ee 100644 --- a/bld/config_files/definition.xml +++ b/bld/config_files/definition.xml @@ -93,6 +93,8 @@ test_radiative (Radiatively Active Dust), test_swelling (Sea Salt), test_tracers Chemistry package: trop_mam3 trop_mam4 trop_mam7 trop_mozart trop_strat_mam4_vbs trop_strat_mam4_vbsext waccm_ma waccm_mad waccm_mad_mam4 waccm_ma_mam4 waccm_ma_sulfur waccm_sc waccm_sc_mam4 waccm_tsmlt_mam4 terminator none + +Chemistry package: trop_mam3 trop_mam4 trop_mam7 trop_mozart trop_strat_mam4_vbs trop_strat_mam4_vbsext waccm_ma waccm_mad waccm_mad_mam4 waccm_ma_mam4 waccm_ma_sulfur waccm_sc waccm_sc_mam4 waccm_tsmlt_mam4 terminator GEOS-Chem none Prognostic mozart species packages: list of any subset of the following: DST,SSLT,SO4,GHG,OC,BC,CARBON16 diff --git a/bld/configure b/bld/configure index 581657e6d0..25bd9e1dbf 100755 --- a/bld/configure +++ b/bld/configure @@ -124,8 +124,11 @@ OPTIONS [ trop_mam3 | trop_mam4 | trop_mam7 | trop_mozart | trop_strat_mam4_vbs | trop_strat_mam4_vbsext | waccm_ma | waccm_mad | waccm_mad_mam4 | waccm_ma_mam4 | waccm_ma_sulfur | waccm_sc | waccm_sc_mam4 | waccm_tsmlt_mam4 | - terminator | none ]. + terminator | geoschem | none ]. Default: trop_mam4 for cam6 and trop_mam3 for cam5. + -clm_vers Version of land model to use. This option is only used when chem + is set to 'geoschem'. + [ 4.0 | 4.5 | 5.0 ] -[no]clubb_sgs Switch on [off] CLUBB_SGS. Default: on for cam6, otherwise off. -clubb_opts Comma separated list of CLUBB options to turn on/off. By default they are all off. Current option is: clubb_do_adv (Advect CLUBB moments) @@ -303,6 +306,7 @@ GetOptions( "ccsm_seq" => \$opts{'ccsm_seq'}, "cflags=s" => \$opts{'cflags'}, "chem=s" => \$opts{'chem'}, + "clm_vers=s" => \$opts{'clm_vers'}, "clubb_sgs!" => \$opts{'clubb_sgs'}, "clubb_opts=s" => \$opts{'clubb_opts'}, "co2_cycle" => \$opts{'co2_cycle'}, @@ -666,10 +670,10 @@ if (defined $opts{'chem'}) { # If the user has specified a simple physics package... if ($simple_phys) { - # the only valid chemistry options are 'none' and 'terminator' - if (($chem_pkg ne 'none') and ($chem_pkg ne 'terminator')) { + # the only valid chemistry options are 'none', 'terminator' and 'geoschem' + if (($chem_pkg ne 'none') and ($chem_pkg ne 'terminator') and ($chem_pkg ne 'geoschem')) { die "configure ERROR: -phys=$phys_pkg -chem=$chem_pkg\n". - " -chem can only be set to 'none' or 'terminator'.\n"; + " -chem can only be set to 'none', 'terminator' or 'geoschem'.\n"; } } elsif ($phys_pkg =~ m/^cam3$|^cam4$|^spcam_sam1mom$/) { @@ -1413,10 +1417,10 @@ if ($customize) { } if ($print>=2) { print "Chem preprocessor compiler: $chemproc_fc $eol"; } ($chem_nadv) = chem_preprocess($cfg_ref,$print,$chemproc_fc); -} elsif ($chem_pkg ne 'none') { +} elsif ($chem_pkg ne 'none' and $chem_pkg !~ 'geoschem') { # copy over chem docs - copy("$chem_src_dir/chem_mech.doc",$cam_bld) or die "copy failed $! \n"; - copy("$chem_src_dir/chem_mech.in" ,$cam_bld) or die "copy failed $! \n"; + copy("$chem_src_dir/chem_mech.doc",$cam_bld) or die "copy of chem_mec.doc failed $! \n"; + copy("$chem_src_dir/chem_mech.in" ,$cam_bld) or die "copy of chem_mech.in failed $! \n"; ($chem_nadv) = chem_number_adv($chem_src_dir); } @@ -1428,6 +1432,25 @@ if ($chem_pkg =~ '_mam3') { $chem_cppdefs = ' -DMODAL_AERO -DMODAL_AERO_7MODE '; } +# TMMF - wedge in GEOS-Chem CPP definitions here +if ($chem_pkg =~ 'geoschem') { + $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING -DLINUX_IFORT -DUSE_REAL8 -DMODEL_ -DMODEL_CESM'; + # TMMF - Temporary fix + $chem_nadv = 200; + if (defined $opts{'clm_vers'}) { + if ($opts{'clm_vers'} =~ 'CLM4.0') { + $chem_cppdefs .= ' -DCLM40' + } + elsif ($opts{'clm_vers'} =~ 'CLM4.5') { + $chem_cppdefs .= ' -DCLM45' + } + elsif ($opts{'clm_vers'} =~ 'CLM5.0') { + $chem_cppdefs .= ' -DCLM50' + } + } +} + + # CARMA sectional microphysics # # New CARMA models need to define the number of advected constituents. @@ -2785,13 +2808,17 @@ sub write_filepath } if ($chem_src_dir) { print $fh "$chem_src_dir\n"; + if ($chem_pkg eq 'geoschem') { + print $fh "$chem_src_dir/geoschem_src/GeosCore\n"; + print $fh "$chem_src_dir/geoschem_src/GeosUtil\n"; + print $fh "$chem_src_dir/geoschem_src/Headers\n"; + print $fh "$chem_src_dir/geoschem_src/HEMCO/Core\n"; + print $fh "$chem_src_dir/geoschem_src/HEMCO/Extensions\n"; + print $fh "$chem_src_dir/geoschem_src/HEMCO/Interfaces\n"; + print $fh "$chem_src_dir/geoschem_src/ISORROPIA\n"; + print $fh "$chem_src_dir/geoschem_src/KPP/Standard\n"; } +# print $fh "$camsrcdir/cam/src/chemistry/pp_geoschem\n"; } } - if ($chem =~ /_mam/) { - print $fh "$camsrcdir/src/chemistry/modal_aero\n"; - } else { - print $fh "$camsrcdir/src/chemistry/bulk_aero\n"; - } - print $fh "$camsrcdir/src/chemistry/aerosol\n"; if ($waccmx) { print $fh "$camsrcdir/src/physics/waccmx\n"; @@ -2804,7 +2831,21 @@ sub write_filepath } print $fh "$camsrcdir/src/ionosphere\n"; - print $fh "$camsrcdir/src/chemistry/mozart\n"; + # -- Added by MSL - 1/2018 + # -- Updated by TMMF - 11/2019 + if ($chem_pkg ne 'geoschem') { + print $fh "$camsrcdir/cam/src/chemistry/mozart\n"; + if ($chem =~ /_mam/) { + print $fh "$camsrcdir/cam/src/chemistry/modal_aero\n"; + } else { + print $fh "$camsrcdir/cam/src/chemistry/bulk_aero\n"; + } + print $fh "$camsrcdir/cam/src/chemistry/aerosol\n"; +# } +# else { +# print $fh "$camsrcdir/cam/src/chemistry/mozart\n"; + } + # -- print $fh "$camsrcdir/src/chemistry/utils\n"; if ($rad eq 'rrtmg') { diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 28899a7082..3bd44f4200 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3904,7 +3904,7 @@ Default: set by build-namelist Name of the CAM chemistry package. N.B. this variable may not be set by diff --git a/bld/namelist_files/use_cases/geoschem.xml b/bld/namelist_files/use_cases/geoschem.xml new file mode 100644 index 0000000000..14e8f7a9ba --- /dev/null +++ b/bld/namelist_files/use_cases/geoschem.xml @@ -0,0 +1,82 @@ + + + + +00010101 + +367.0e-6 + +atm/cam/inic/fv/cami-chem_1990-01-01_1.9x2.5_L26_c080114.nc + + +atm/cam/solar/spectral_irradiance_Lean_1610-2009_ann_c100405.nc +20000101 +FIXED + + +atm/cam/chem/trop_mozart_aero/aero +aero_1.9x2.5_L26_1850-2005_c091112.nc +CYCLICAL +2000 + + +atm/cam/chem/trop_mozart_aero/aero +aerosoldep_monthly_2000_mean_1.9x2.5_c090421.nc +CYCLICAL +2000 + + + atm/cam/ozone + ozone_1.9x2.5_L26_1850-2005_c090803.nc + O3 + CYCLICAL + 2000 + +.true. +'xactive_lnd' + + +2000 + + +2000 +atm/waccm/lb/LBC_1765-2500_1.9x2.5_CMIP5_RCP45_za_c120204.nc +CYCLICAL + + + + +'CYCLICAL' +2000 + + + 1, 24 + 0, -1 + 'A', 'A' + + + 'Q', 'U', 'V', 'OMEGA', 'T', 'PS', + + + + 'O3', 'NO', 'NO2', 'CO', 'HNO3', 'CH4', 'NIT', 'NH4', 'NH3', 'SO4', 'SO2', 'OH', + + + + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','BR2','BRNO3','CH2O','HCHO','CLNO3','DHDN','EOH','ETHLN','GLYC','GLYX','H2O2','HAC','HBR','HC187','HCL','HCOOH','HNO3','HOBR','HOCL','HONIT','HPALD','IEPOXA','IEPOXB','IEPOXD','IMAE','IPMN','ISN1','ISN1OG','ISOPNB','ISOPND','LIMO','LVOC','MACR','MACRN','MAP','MGLY','MONITS','MONITU','MTPA','MTPO','MVK','MVKN','N2O5','NH3','NO2','NPMN','O3','OPOG1','OPOG2','PAN','POG1','POG2','PPN','PROPNN','R4N2','RIPA','RIPB','RIPD','SO2','HOI','I2','IBR','ICL','HI','IONO','IONO2','I2O2','I2O3','I2O4','H2SO4','TSOG0','TSOG1','TSOG2','TSOG3' + + + + 'ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','DST1','DSTAL1','NITD1','SO4D1','DST2','DSTAL2','NITD2','SO4D2','DST3','DSTAL3','NITD3','SO4D3','DST4','DSTAL4','NITD4','SO4D4','INDIOL','IONITA','ISN1OA','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITS','OCPI','OCPO','OPOA1','OPOA2','PFE','POA1','POA2','SALA','SALC','SO4','SO4S','SOAIE','SOAGX','SOAME','SOAMG','SOAS','TSOA0','TSOA1','TSOA2','TSOA3','BRSALA','BRSALC','ISALA','ISALC','AERI' + + + + 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','BR2','CH2O','HCHO','DHDN','EOH','ETHLN','GLYC','GLYX','H2O2','HAC','HBR','HCL','HCOOH','HNO3','HOBR','HOCL','HONIT','IEPOXA','IEPOXB','IEPOXD','IMAE','ISN1','ISN1OG','ISOPNB','ISOPND','LIMO','LVOC','MACRN','MAP','MGLY','MOBA','MONITS','MONITU','MP','CH3OOH','MTPA','MTPO','MVKN','NH3','OPOG1','OPOG2','POG1','POG2','PROPNN','RIPA','RIPB','RIPD','SO2','TSOG0','TSOG1','TSOG2','TSOG3','HOI','I2','IBR','ICL','HI','IONO','IONO2','I2O2','I2O3','I2O4','H2SO4' + + + + 'ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','DST1','DSTAL1','NITD1','SO4D1','DST2','DSTAL2','NITD2','SO4D2','DST3','DSTAL3','NITD3','SO4D3','DST4','DSTAL4','NITD4','SO4D4','INDIOL','IONITA','ISN1OA','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITS','OCPI','OCPO','OPOA1','OPOA2','PFE','POA1','POA2','SALA','SALC','SO4','SO4S','SOAIE','SOAGX','SOAME','SOAMG','SOAS','TSOA0','TSOA1','TSOA2','TSOA3','BRSALA','BRSALC','ISALA','ISALC','AERI' + + + + diff --git a/bld/namelist_files/use_cases/geoschem_baro_moist.xml b/bld/namelist_files/use_cases/geoschem_baro_moist.xml new file mode 100644 index 0000000000..da938fe300 --- /dev/null +++ b/bld/namelist_files/use_cases/geoschem_baro_moist.xml @@ -0,0 +1,22 @@ + + + + + 10101 + + +.false. + + +0,-6 + + 'U:I','V:I','T:I' + +'baroclinic_wave' + + diff --git a/bld/perl5lib/Build/ChemNamelist.pm b/bld/perl5lib/Build/ChemNamelist.pm index 3584b98be0..0cf0114337 100644 --- a/bld/perl5lib/Build/ChemNamelist.pm +++ b/bld/perl5lib/Build/ChemNamelist.pm @@ -65,13 +65,33 @@ sub set_dep_lists } if ($print_lvl>=2) {print "Chemistry species : @species_list \n" ;} + if (!defined $nl->get_value('gas_wetdep_list')) { $gas_wetdep_list = get_gas_wetdep_list( $cfgdir, $print_lvl, @species_list ); + } else { + $gas_wetdep_list = $nl->get_value('gas_wetdep_list'); + $gas_wetdep_list = filter_dep_list( $gas_wetdep_list, $print_lvl, @species_list ); + } + if (!defined $nl->get_value('aer_wetdep_list')) { $aer_wetdep_list = get_aer_wetdep_list( $cfgdir, $print_lvl, @species_list ); + } else { + $aer_wetdep_list = $nl->get_value('aer_wetdep_list'); + $aer_wetdep_list = filter_dep_list( $aer_wetdep_list, $print_lvl, @species_list ); + } + if (!defined $nl->get_value('drydep_list')) { $gas_drydep_list = get_gas_drydep_list( $cfgdir, $print_lvl, @species_list ); + } else { + $gas_drydep_list = $nl->get_value('drydep_list'); + $gas_drydep_list = filter_dep_list( $gas_drydep_list, $print_lvl, @species_list ); + } + if (!defined $nl->get_value('aer_drydep_list')) { $aer_drydep_list = get_aer_drydep_list( $cfgdir, $print_lvl, @species_list ); + } else { + $aer_drydep_list = $nl->get_value('aer_drydep_list'); + $aer_drydep_list = filter_dep_list( $aer_drydep_list, $print_lvl, @species_list ); + } # set solubility factors for aerosols if (length($aer_wetdep_list)>2){ @@ -276,6 +296,32 @@ sub get_dep_list return ($list); } +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +sub filter_dep_list +{ + my ( $input_list, $print_lvl, @species_list ) = @_; + + my @master_list = split( ('\s+|\s*,+\s*'), $input_list); + + my $list = ''; + my $first = 1; my $pre = ""; + foreach my $name (sort @species_list) { + foreach my $item (@master_list) { + $item =~ s/['"]//g; #"' + if ($name eq $item) { + $list .= $pre . quote_string($name) ; + if ($first) { $pre = ","; $first = 0; } + } + } + } + + if ( length($list)<1 ) {$list = quote_string(' ') ;} + + return ($list); + +} + #------------------------------------------------------------------------------- sub read_master_list_file { diff --git a/cime_config/buildcpp b/cime_config/buildcpp index 7b8f9a8d53..eeb0ab57ad 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -40,6 +40,7 @@ def buildcpp(case): compiler = case.get_value("COMPILER") # for chem preprocessor nthrds_atm = case.get_value("NTHRDS_ATM") cam_config_opts = case.get_value("CAM_CONFIG_OPTS") + clm_config_opts = case.get_value("CLM_CONFIG_OPTS") # level information for CAM is part of the atm grid name - and must be stripped out nlev = '' @@ -93,6 +94,14 @@ def buildcpp(case): else: config_opts += ["-ocn", comp_ocn] + if '-chem geoschem' in cam_config_opts: + if 'clm4_0' in clm_config_opts: + config_opts += ["-clm_vers", "CLM4.0"] + elif 'clm4_5' in clm_config_opts: + config_opts += ["-clm_vers", "CLM4.5"] + elif 'clm5_0' in clm_config_opts: + config_opts += ["-clm_vers", "CLM5.0"] + # Add user options. config_opts += cam_config_opts.split(" ") diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 7873931219..fdc00f964b 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -10,8 +10,8 @@ --> CAM cam6 physics: CAM cam5 physics: - CAM cam4 physics: - CAM simplified and non-versioned physics : + CAM cam4 physics: + CAM simplified and non-versioned physics : @@ -255,6 +259,10 @@ scam_arm97 + + geoschem + geoschem + geoschem_baro_moist run_component_cam env_run.xml diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 5e07c0c925..1c637f1d73 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -381,6 +381,33 @@ SDYN_CAM40%WXIED_CLM40%SP_CICE%PRES_DOCN%DOM_RTM_SGLC_SWAV + + + + GEOSCHEM + 2000_CAM40%GC_SLND_SICE_SOCN_SROF_SGLC_SWAV + + + + GEOSCHEMTEST + 2000_CAM%GCHS_SLND_SICE_SOCN_SROF_SGLC_SWAV + + + + FGC + 2000_CAM40%GC_CLM40%SP_CICE%PRES_DOCN%DOM_RTM_SGLC_SWAV + + + + FGC_CLM45 + 2000_CAM40%GC_CLM45%SP_CICE%PRES_DOCN%DOM_RTM_SGLC_SWAV + + + + FGC_CLM50 + 2000_CAM40%GC_CLM50%SP_CICE%PRES_DOCN%DOM_RTM_SGLC_SWAV + + diff --git a/src/chemistry/pp_geoschem/.exclude b/src/chemistry/pp_geoschem/.exclude index 2f725c1ef5..48f78ec307 100644 --- a/src/chemistry/pp_geoschem/.exclude +++ b/src/chemistry/pp_geoschem/.exclude @@ -1,22 +1,19 @@ regrid_a2a_mod.F90 transport_mod.F -drydep_mod.F tpcore_window_mod.F90 tpcore_bc_mod.F90 tpcore_fvdas_mod.F90 -olson_landmap_mod.F90 +flexgrid_read_mod.F90 geosfp_read_mod.F90 -modis_lai_mod.F90 +get_met_mod.F90 hco_interp_mod.F90 merra2_read_mod.F90 regrid_a2a_mod.F90 -land_mercury_mod.F hcoio_read_std_mod.F90 hcoio_dataread_mod.F90 hco_readlist_mod.F90 hcox_paranox_mod.F90 hco_config_mod.F90 -planeflight_mod.F hco_driver_mod.F90 hcox_driver_mod.F90 hcox_lightnox_mod.F90 @@ -45,9 +42,7 @@ diag3.F hcoi_gc_main_mod.F90 gamap_mod.F initialize.F -ndxx_setup.F -mixing_mod.F90 -vdiff_mod.F90 input_mod.F cleanup.F main.F +mo_sim_dat.F90 diff --git a/src/chemistry/pp_geoschem/aero_model.F90 b/src/chemistry/pp_geoschem/aero_model.F90 new file mode 100644 index 0000000000..3c9133adf6 --- /dev/null +++ b/src/chemistry/pp_geoschem/aero_model.F90 @@ -0,0 +1,1150 @@ +!=============================================================================== +! Bulk Aerosol Model +!=============================================================================== +module aero_model + use shr_kind_mod, only: r8 => shr_kind_r8 + use constituents, only: pcnst, cnst_name, cnst_get_ind + use ppgrid, only: pcols, pver, pverp + use cam_abortutils, only: endrun + use cam_logfile, only: iulog + use perf_mod, only: t_startf, t_stopf + use camsrfexch, only: cam_in_t, cam_out_t + use physics_types, only: physics_state, physics_ptend, physics_ptend_init + use physics_buffer, only: physics_buffer_desc + use physconst, only: gravit, rair + use spmd_utils, only: masterproc + use physics_buffer, only: pbuf_get_field, pbuf_get_index + use cam_history, only: outfld + use infnan, only: nan, assignment(=) + + implicit none + private + + public :: aero_model_readnl + public :: aero_model_register + public :: aero_model_init + public :: aero_model_gasaerexch ! create, grow, change, and shrink aerosols. + public :: aero_model_drydep ! aerosol dry deposition and sediment + public :: aero_model_wetdep ! aerosol wet removal + public :: aero_model_emissions ! aerosol emissions + public :: aero_model_surfarea ! tropospheric aerosol wet surface area for chemistry + public :: aero_model_strat_surfarea ! stub + + ! Misc private data + + integer :: so4_ndx, cb2_ndx, oc2_ndx, nit_ndx + integer :: soa_ndx, soai_ndx, soam_ndx, soab_ndx, soat_ndx, soax_ndx + + ! Namelist variables + character(len=16) :: wetdep_list(pcnst) = ' ' + character(len=16) :: drydep_list(pcnst) = ' ' + + integer :: ndrydep = 0 + integer,allocatable :: drydep_indices(:) + integer :: nwetdep = 0 + integer,allocatable :: wetdep_indices(:) + logical :: drydep_lq(pcnst) + logical :: wetdep_lq(pcnst) + + integer :: fracis_idx = 0 + + real(r8) :: aer_sol_facti(pcnst) ! in-cloud solubility factor + real(r8) :: aer_sol_factb(pcnst) ! below-cloud solubility factor + real(r8) :: aer_scav_coef(pcnst) + +contains + + !============================================================================= + ! reads aerosol namelist options + !============================================================================= + subroutine aero_model_readnl(nlfile) + + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit + use mpishorthand + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + + ! Local variables + integer :: unitn, ierr + character(len=*), parameter :: subname = 'aero_model_readnl' + + ! Namelist variables + character(len=16) :: aer_wetdep_list(pcnst) = ' ' + character(len=16) :: aer_drydep_list(pcnst) = ' ' + + namelist /aerosol_nl/ aer_wetdep_list, aer_drydep_list + namelist /aerosol_nl/ aer_sol_facti, aer_sol_factb, aer_scav_coef + !----------------------------------------------------------------------------- + !aer_sol_facti = nan + !aer_sol_factb = nan + !aer_scav_coef = nan + + !! Read namelist + !if (masterproc) then + ! unitn = getunit() + ! open( unitn, file=trim(nlfile), status='old' ) + ! call find_group_name(unitn, 'aerosol_nl', status=ierr) + ! if (ierr == 0) then + ! read(unitn, aerosol_nl, iostat=ierr) + ! if (ierr /= 0) then + ! call endrun(subname // ':: ERROR reading namelist') + ! end if + ! end if + ! close(unitn) + ! call freeunit(unitn) + !end if + +#ifdef SPMD + ! Broadcast namelist variables + !call mpibcast(aer_wetdep_list, len(aer_wetdep_list(1))*pcnst, mpichar, 0, mpicom) + !call mpibcast(aer_drydep_list, len(aer_drydep_list(1))*pcnst, mpichar, 0, mpicom) + !call mpibcast(aer_sol_facti, pcnst, mpir8, 0, mpicom) + !call mpibcast(aer_sol_factb, pcnst, mpir8, 0, mpicom) + !call mpibcast(aer_scav_coef, pcnst, mpir8, 0, mpicom) +#endif + + !wetdep_list = aer_wetdep_list + !drydep_list = aer_drydep_list + + end subroutine aero_model_readnl + + !============================================================================= + !============================================================================= + subroutine aero_model_register() + !use mo_setsoa, only : soa_register + + !call soa_register() + end subroutine aero_model_register + + !============================================================================= + !============================================================================= + subroutine aero_model_init( pbuf2d ) + + !use mo_chem_utls, only: get_inv_ndx, get_spc_ndx + use cam_history, only: addfld, add_default, horiz_only + use phys_control, only: phys_getopts + !use mo_aerosols, only: aerosols_inti + !use mo_setsoa, only: soa_inti + !use dust_model, only: dust_init + !use seasalt_model, only: seasalt_init + !use drydep_mod, only: inidrydep + !use wetdep, only: wetdep_init + !use mo_setsox, only: has_sox + + ! args + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + + ! local vars + character(len=12), parameter :: subrname = 'aero_model_init' + integer :: m, id + character(len=20) :: dummy + logical :: history_aerosol ! Output MAM or SECT aerosol tendencies + + !call phys_getopts( history_aerosol_out=history_aerosol ) + !call aerosols_inti() + !call soa_inti(pbuf2d) + !call dust_init() + !call seasalt_init() + !call wetdep_init() + + !fracis_idx = pbuf_get_index('FRACIS') + + !nwetdep = 0 + !ndrydep = 0 + + !count_species: do m = 1,pcnst + ! if ( len_trim(wetdep_list(m)) /= 0 ) then + ! nwetdep = nwetdep+1 + ! endif + ! if ( len_trim(drydep_list(m)) /= 0 ) then + ! ndrydep = ndrydep+1 + ! endif + !enddo count_species + ! + !if (nwetdep>0) & + ! allocate(wetdep_indices(nwetdep)) + !if (ndrydep>0) & + ! allocate(drydep_indices(ndrydep)) + + !do m = 1,ndrydep + ! call cnst_get_ind ( drydep_list(m), id, abort=.false. ) + ! if (id>0) then + ! drydep_indices(m) = id + ! else + ! call endrun(subrname//': invalid drydep species: '//trim(drydep_list(m)) ) + ! endif + + ! if (masterproc) then + ! write(iulog,*) subrname//': '//drydep_list(m)//' will have drydep applied' + ! endif + !enddo + !do m = 1,nwetdep + ! call cnst_get_ind ( wetdep_list(m), id, abort=.false. ) + ! if (id>0) then + ! wetdep_indices(m) = id + ! else + ! call endrun(subrname//': invalid wetdep species: '//trim(wetdep_list(m)) ) + ! endif + ! + ! if (masterproc) then + ! write(iulog,*) subrname//': '//wetdep_list(m)//' will have wet removal' + ! endif + !enddo + ! + !! set flags for drydep tendencies + !drydep_lq(:) = .false. + !do m=1,ndrydep + ! id = drydep_indices(m) + ! drydep_lq(id) = .true. + !enddo + + !! set flags for wetdep tendencies + !wetdep_lq(:) = .false. + !do m=1,nwetdep + ! id = wetdep_indices(m) + ! wetdep_lq(id) = .true. + !enddo + + !do m = 1,ndrydep + ! + ! dummy = trim(drydep_list(m)) // 'TB' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s',trim(drydep_list(m))//' turbulent dry deposition flux') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + ! dummy = trim(drydep_list(m)) // 'GV' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s',trim(drydep_list(m)) //' gravitational dry deposition flux') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + ! dummy = trim(drydep_list(m)) // 'DD' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s',trim(drydep_list(m)) //' dry deposition flux at bottom (grav + turb)') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + ! dummy = trim(drydep_list(m)) // 'DT' + ! call addfld (dummy,(/ 'lev' /), 'A','kg/kg/s',trim(drydep_list(m))//' dry deposition') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + ! dummy = trim(drydep_list(m)) // 'DV' + ! call addfld (dummy,(/ 'lev' /), 'A','m/s',trim(drydep_list(m))//' deposition velocity') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + + !enddo + ! + !if (ndrydep>0) then + + ! call inidrydep(rair, gravit) + + ! dummy = 'RAM1' + ! call addfld (dummy,horiz_only, 'A','frac','RAM1') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + ! dummy = 'airFV' + ! call addfld (dummy,horiz_only, 'A','frac','FV') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + + ! if (sslt_active) then + ! dummy = 'SSTSFDRY' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Sea salt deposition flux at surface') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + ! endif + ! if (dust_active) then + ! dummy = 'DSTSFDRY' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Dust deposition flux at surface') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + ! endif + + !endif + + !do m = 1,nwetdep + + ! call addfld (trim(wetdep_list(m))//'SFWET', horiz_only, 'A','kg/m2/s', & + ! 'Wet deposition flux at surface') + ! call addfld (trim(wetdep_list(m))//'SFSIC', horiz_only, 'A','kg/m2/s', & + ! 'Wet deposition flux (incloud, convective) at surface') + ! call addfld (trim(wetdep_list(m))//'SFSIS', horiz_only, 'A','kg/m2/s', & + ! 'Wet deposition flux (incloud, stratiform) at surface') + ! call addfld (trim(wetdep_list(m))//'SFSBC', horiz_only, 'A','kg/m2/s', & + ! 'Wet deposition flux (belowcloud, convective) at surface') + ! call addfld (trim(wetdep_list(m))//'SFSBS', horiz_only, 'A','kg/m2/s', & + ! 'Wet deposition flux (belowcloud, stratiform) at surface') + ! call addfld (trim(wetdep_list(m))//'WET', (/ 'lev' /), 'A','kg/kg/s', & + ! 'wet deposition tendency') + ! call addfld (trim(wetdep_list(m))//'SIC', (/ 'lev' /), 'A','kg/kg/s', & + ! trim(wetdep_list(m))//' ic wet deposition') + ! call addfld (trim(wetdep_list(m))//'SIS', (/ 'lev' /), 'A','kg/kg/s', & + ! trim(wetdep_list(m))//' is wet deposition') + ! call addfld (trim(wetdep_list(m))//'SBC', (/ 'lev' /), 'A','kg/kg/s', & + ! trim(wetdep_list(m))//' bc wet deposition') + ! call addfld (trim(wetdep_list(m))//'SBS', (/ 'lev' /), 'A','kg/kg/s', & + ! trim(wetdep_list(m))//' bs wet deposition') + !enddo + ! + !if (nwetdep>0) then + ! if (sslt_active) then + ! dummy = 'SSTSFWET' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Sea salt wet deposition flux at surface') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + ! endif + ! if (dust_active) then + ! dummy = 'DSTSFWET' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Dust wet deposition flux at surface') + ! if ( history_aerosol ) then + ! call add_default (dummy, 1, ' ') + ! endif + ! endif + !endif + ! + !if (dust_active) then + ! ! emissions diagnostics .... + + ! do m = 1, dust_nbin + ! dummy = trim(dust_names(m)) // 'SF' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s',trim(dust_names(m))//' dust surface emission') + ! if (history_aerosol) then + ! call add_default (dummy, 1, ' ') + ! endif + ! enddo + + ! dummy = 'DSTSFMBL' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Mobilization flux at surface') + ! if (history_aerosol) then + ! call add_default (dummy, 1, ' ') + ! endif + + ! dummy = 'LND_MBL' + ! call addfld (dummy,horiz_only, 'A','frac','Soil erodibility factor') + ! if (history_aerosol) then + ! call add_default (dummy, 1, ' ') + ! endif + + !endif + ! + !if (sslt_active) then + + ! dummy = 'SSTSFMBL' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Mobilization flux at surface') + ! if (history_aerosol) then + ! call add_default (dummy, 1, ' ') + ! endif + + ! do m = 1, seasalt_nbin + ! dummy = trim(seasalt_names(m)) // 'SF' + ! call addfld (dummy,horiz_only, 'A','kg/m2/s',trim(seasalt_names(m))//' seasalt surface emission') + ! if (history_aerosol) then + ! call add_default (dummy, 1, ' ') + ! endif + ! enddo + + !endif + + !if( has_sox ) then + ! call addfld( 'XPH_LWC',(/ 'lev' /), 'A','kg/kg', 'pH value multiplied by lwc') + + ! if ( history_aerosol ) then + ! call add_default ('XPH_LWC', 1, ' ') + ! endif + !endif + + !so4_ndx = get_spc_ndx( 'SO4' ) + !soa_ndx = get_spc_ndx( 'SOA' ) + !soai_ndx = get_spc_ndx( 'SOAI' ) + !soam_ndx = get_spc_ndx( 'SOAM' ) + !soab_ndx = get_spc_ndx( 'SOAB' ) + !soat_ndx = get_spc_ndx( 'SOAT' ) + !soax_ndx = get_spc_ndx( 'SOAX' ) + !cb2_ndx = get_spc_ndx( 'CB2' ) + !oc2_ndx = get_spc_ndx( 'OC2' ) + !nit_ndx = get_spc_ndx( 'NH4NO3' ) + + end subroutine aero_model_init + + !============================================================================= + !============================================================================= + subroutine aero_model_drydep ( state, pbuf, obklen, ustar, cam_in, dt, cam_out, ptend ) + + !use dust_sediment_mod, only: dust_sediment_tend + !use drydep_mod, only: d3ddflux, calcram + !use dust_model, only: dust_depvel, dust_nbin, dust_names + !use seasalt_model, only: sslt_depvel=>seasalt_depvel, sslt_nbin=>seasalt_nbin, sslt_names=>seasalt_names + + ! args + type(physics_state), intent(in) :: state ! Physics state variables + real(r8), intent(in) :: obklen(:) + real(r8), intent(in) :: ustar(:) ! sfc fric vel + type(cam_in_t), target, intent(in) :: cam_in ! import state + real(r8), intent(in) :: dt ! time step + type(cam_out_t), intent(inout) :: cam_out ! export state + type(physics_ptend), intent(out) :: ptend ! indivdual parameterization tendencies + type(physics_buffer_desc), pointer :: pbuf(:) + + ! local vars + real(r8), pointer :: landfrac(:) ! land fraction + real(r8), pointer :: icefrac(:) ! ice fraction + real(r8), pointer :: ocnfrac(:) ! ocean fraction + real(r8), pointer :: fvin(:) ! + real(r8), pointer :: ram1in(:) ! for dry dep velocities from land model for progseasalts + + real(r8) :: fv(pcols) ! for dry dep velocities, from land modified over ocean & ice + real(r8) :: ram1(pcols) ! for dry dep velocities, from land modified over ocean & ice + + ! local decarations + + !integer, parameter :: naero = sslt_nbin+dust_nbin + !integer, parameter :: begslt = 1 + !integer, parameter :: endslt = sslt_nbin + !integer, parameter :: begdst = sslt_nbin+1 + !integer, parameter :: enddst = sslt_nbin+dust_nbin + + !integer :: ncol, lchnk + + !character(len=6) :: aeronames(naero) ! = (/ sslt_names, dust_names /) + + !real(r8) :: vlc_trb(pcols,naero) !Turbulent deposn velocity (m/s) + !real(r8) :: vlc_grv(pcols,pver,naero) !grav deposn velocity (m/s) + !real(r8) :: vlc_dry(pcols,pver,naero) !dry deposn velocity (m/s) + + !real(r8) :: dep_trb(pcols) !kg/m2/s + !real(r8) :: dep_grv(pcols) !kg/m2/s (total of grav and trb) + + !real(r8) :: tsflx_dst(pcols) + !real(r8) :: tsflx_slt(pcols) + !real(r8) :: pvaeros(pcols,pverp) ! sedimentation velocity in Pa + !real(r8) :: sflx(pcols) + + !real(r8) :: tvs(pcols,pver) + !real(r8) :: rho(pcols,pver) ! air density in kg/m3 + + !integer :: m,mm, i, im + ! + !if (ndrydep<1) return + + !landfrac => cam_in%landfrac(:) + !icefrac => cam_in%icefrac(:) + !ocnfrac => cam_in%ocnfrac(:) + !fvin => cam_in%fv(:) + !ram1in => cam_in%ram1(:) + + !lchnk = state%lchnk + !ncol = state%ncol + + !! calc ram and fv over ocean and sea ice ... + !call calcram( ncol,landfrac,icefrac,ocnfrac,obklen,& + ! ustar,ram1in,ram1,state%t(:,pver),state%pmid(:,pver),& + ! state%pdel(:,pver),fvin,fv) + + !call outfld( 'airFV', fv(:), pcols, lchnk ) + !call outfld( 'RAM1', ram1(:), pcols, lchnk ) + + !! note that tendencies are not only in sfc layer (because of sedimentation) + !! and that ptend is updated within each subroutine for different species + ! + !call physics_ptend_init(ptend, state%psetcols, 'aero_model_drydep', lq=drydep_lq) + + !aeronames(:sslt_nbin) = sslt_names(:) + !aeronames(sslt_nbin+1:) = dust_names(:) + + !lchnk = state%lchnk + !ncol = state%ncol + + !tvs(:ncol,:) = state%t(:ncol,:) + !rho(:ncol,:) = state%pmid(:ncol,:)/(rair*state%t(:ncol,:)) + + !! compute dep velocities for sea salt and dust... + !if (sslt_active) then + ! call sslt_depvel( state%t(:,:), state%pmid(:,:), state%q(:,:,1), ram1, fv, ncol, lchnk, & + ! vlc_dry(:,:,begslt:endslt), vlc_trb(:,begslt:endslt), vlc_grv(:,:,begslt:endslt)) + !endif + !if (dust_active) then + ! call dust_depvel( state%t(:,:), state%pmid(:,:), ram1, fv, ncol, & + ! vlc_dry(:,:,begdst:enddst), vlc_trb(:,begdst:enddst), vlc_grv(:,:,begdst:enddst) ) + !endif + + !tsflx_dst(:)=0._r8 + !tsflx_slt(:)=0._r8 + + !! do drydep for each of the bins of dust and seasalt + !do m=1,ndrydep + + ! mm = drydep_indices(m) + ! findindex: do im = 1,naero + ! if (trim(cnst_name(mm))==trim(aeronames(im))) exit findindex + ! enddo findindex + + ! pvaeros(:ncol,1)=0._r8 + ! pvaeros(:ncol,2:pverp) = vlc_dry(:ncol,:,im) + + ! call outfld( trim(cnst_name(mm))//'DV', pvaeros(:,2:pverp), pcols, lchnk ) + + ! if(.true.) then ! use phil's method + ! ! convert from meters/sec to pascals/sec + ! ! pvaeros(:,1) is assumed zero, use density from layer above in conversion + ! pvaeros(:ncol,2:pverp) = pvaeros(:ncol,2:pverp) * rho(:ncol,:)*gravit + + ! ! calculate the tendencies and sfc fluxes from the above velocities + ! call dust_sediment_tend( & + ! ncol, dt, state%pint(:,:), state%pmid, state%pdel, state%t , & + ! state%q(:,:,mm) , pvaeros , ptend%q(:,:,mm), sflx ) + ! else !use charlie's method + ! call d3ddflux(ncol, vlc_dry(:,:,im), state%q(:,:,mm),state%pmid,state%pdel, tvs,sflx,ptend%q(:,:,mm),dt) + ! endif + ! ! apportion dry deposition into turb and gravitational settling for tapes + ! do i=1,ncol + ! dep_trb(i)=sflx(i)*vlc_trb(i,im)/vlc_dry(i,pver,im) + ! dep_grv(i)=sflx(i)*vlc_grv(i,pver,im)/vlc_dry(i,pver,im) + ! enddo + + ! if ( any( sslt_names(:)==trim(cnst_name(mm)) ) ) & + ! tsflx_slt(:ncol)=tsflx_slt(:ncol)+sflx(:ncol) + ! if ( any( dust_names(:)==trim(cnst_name(mm)) ) ) & + ! tsflx_dst(:ncol)=tsflx_dst(:ncol)+sflx(:ncol) + + ! ! if the user has specified prescribed aerosol dep fluxes then + ! ! do not set cam_out dep fluxes according to the prognostic aerosols + ! if (.not. aerodep_flx_prescribed()) then + ! ! set deposition in export state + ! if (im==begdst) then + ! cam_out%dstdry1(:ncol) = max(sflx(:ncol), 0._r8) + ! elseif(im==begdst+1) then + ! cam_out%dstdry2(:ncol) = max(sflx(:ncol), 0._r8) + ! elseif(im==begdst+2) then + ! cam_out%dstdry3(:ncol) = max(sflx(:ncol), 0._r8) + ! elseif(im==begdst+3) then + ! cam_out%dstdry4(:ncol) = max(sflx(:ncol), 0._r8) + ! endif + ! endif + + ! call outfld( trim(cnst_name(mm))//'DD', sflx, pcols, lchnk) + ! call outfld( trim(cnst_name(mm))//'TB', dep_trb, pcols, lchnk ) + ! call outfld( trim(cnst_name(mm))//'GV', dep_grv, pcols, lchnk ) + ! call outfld( trim(cnst_name(mm))//'DT', ptend%q(:,:,mm), pcols, lchnk) + + !end do + ! + !! output the total dry deposition + !if (sslt_active) then + ! call outfld( 'SSTSFDRY', tsflx_slt, pcols, lchnk) + !endif + !if (dust_active) then + ! call outfld( 'DSTSFDRY', tsflx_dst, pcols, lchnk) + !endif + + endsubroutine aero_model_drydep + + !============================================================================= + !============================================================================= + subroutine aero_model_wetdep( state, dt, dlf, cam_out, ptend, pbuf) + + !use wetdep, only : wetdepa_v1, wetdep_inputs_set, wetdep_inputs_t + !use dust_model, only : dust_names + !use seasalt_model, only : sslt_names=>seasalt_names + + ! args + + type(physics_state), intent(in) :: state ! Physics state variables + real(r8), intent(in) :: dt ! time step + real(r8), intent(in) :: dlf(:,:) ! shallow+deep convective detrainment [kg/kg/s] + type(cam_out_t), intent(inout) :: cam_out ! export state + type(physics_ptend), intent(out) :: ptend ! indivdual parameterization tendencies + type(physics_buffer_desc), pointer :: pbuf(:) + + !! local vars + + !integer :: ncol ! number of atmospheric columns + !integer :: lchnk ! chunk identifier + !integer :: m,mm, i,k + + !real(r8) :: sflx_tot_dst(pcols) + !real(r8) :: sflx_tot_slt(pcols) + + !real(r8) :: iscavt(pcols, pver) + !real(r8) :: scavt(pcols, pver) + !real(r8) :: scavcoef(pcols,pver) ! Dana and Hales coefficient (/mm) (0.1) + !real(r8) :: sflx(pcols) ! deposition flux + + !real(r8) :: icscavt(pcols, pver) + !real(r8) :: isscavt(pcols, pver) + !real(r8) :: bcscavt(pcols, pver) + !real(r8) :: bsscavt(pcols, pver) + + !real(r8) :: sol_factb, sol_facti + + !real(r8) :: rainmr(pcols,pver) ! mixing ratio of rain within cloud volume + !real(r8) :: cldv(pcols,pver) ! cloudy volume undergoing scavenging + !real(r8) :: cldvcu(pcols,pver) ! Convective precipitation area at the top interface of current layer + !real(r8) :: cldvst(pcols,pver) ! Stratiform precipitation area at the top interface of current layer + + !real(r8), pointer :: fracis(:,:,:) ! fraction of transported species that are insoluble + + !type(wetdep_inputs_t) :: dep_inputs ! obj that contains inputs to wetdepa routine + + !if (nwetdep<1) return + + !call pbuf_get_field(pbuf, fracis_idx, fracis, start=(/1,1,1/), kount=(/pcols, pver, pcnst/) ) + + !call physics_ptend_init(ptend, state%psetcols, 'aero_model_wetdep', lq=wetdep_lq) + + !call wetdep_inputs_set( state, pbuf, dep_inputs ) + + !lchnk = state%lchnk + !ncol = state%ncol + + !sflx_tot_dst(:) = 0._r8 + !sflx_tot_slt(:) = 0._r8 + + !do m = 1, nwetdep + + ! mm = wetdep_indices(m) + + ! sol_factb = aer_sol_factb(m) + ! sol_facti = aer_sol_facti(m) + + ! scavcoef(:ncol,:) = aer_scav_coef(m) + + ! call wetdepa_v1( state%t, state%pmid, state%q(:,:,1), state%pdel, & + ! dep_inputs%cldt, dep_inputs%cldcu, dep_inputs%cmfdqr, & + ! dep_inputs%conicw, dep_inputs%prain, dep_inputs%qme, & + ! dep_inputs%evapr, dep_inputs%totcond, state%q(:,:,mm), dt, & + ! scavt, iscavt, dep_inputs%cldv, & + ! fracis(:,:,mm), sol_factb, ncol, & + ! scavcoef, & + ! sol_facti_in=sol_facti, & + ! icscavt=icscavt, isscavt=isscavt, bcscavt=bcscavt, bsscavt=bsscavt ) + + ! ptend%q(:ncol,:,mm)=scavt(:ncol,:) + + ! call outfld( trim(cnst_name(mm))//'WET', ptend%q(:,:,mm), pcols, lchnk) + ! call outfld( trim(cnst_name(mm))//'SIC', icscavt , pcols, lchnk) + ! call outfld( trim(cnst_name(mm))//'SIS', isscavt, pcols, lchnk) + ! call outfld( trim(cnst_name(mm))//'SBC', bcscavt, pcols, lchnk) + ! call outfld( trim(cnst_name(mm))//'SBS', bsscavt, pcols, lchnk) + + ! sflx(:)=0._r8 + + ! do k=1,pver + ! do i=1,ncol + ! sflx(i)=sflx(i)+ptend%q(i,k,mm)*state%pdel(i,k)/gravit + ! enddo + ! enddo + ! call outfld( trim(cnst_name(mm))//'SFWET', sflx, pcols, lchnk) + ! + ! if ( any( sslt_names(:)==trim(cnst_name(mm)) ) ) & + ! sflx_tot_slt(:ncol) = sflx_tot_slt(:ncol) + sflx(:ncol) + ! if ( any( dust_names(:)==trim(cnst_name(mm)) ) ) & + ! sflx_tot_dst(:ncol) = sflx_tot_dst(:ncol) + sflx(:ncol) + + ! ! if the user has specified prescribed aerosol dep fluxes then + ! ! do not set cam_out dep fluxes according to the prognostic aerosols + ! if (.not.aerodep_flx_prescribed()) then + ! ! export deposition fluxes to coupler ??? why "-" sign ??? + ! if (trim(cnst_name(mm))=='CB2') then + ! cam_out%bcphiwet(:) = max(-sflx(:), 0._r8) + ! elseif (trim(cnst_name(mm))=='OC2') then + ! cam_out%ocphiwet(:) = max(-sflx(:), 0._r8) + ! elseif (trim(cnst_name(mm))==trim(dust_names(1))) then + ! cam_out%dstwet1(:) = max(-sflx(:), 0._r8) + ! elseif (trim(cnst_name(mm))==trim(dust_names(2))) then + ! cam_out%dstwet2(:) = max(-sflx(:), 0._r8) + ! elseif (trim(cnst_name(mm))==trim(dust_names(3))) then + ! cam_out%dstwet3(:) = max(-sflx(:), 0._r8) + ! elseif (trim(cnst_name(mm))==trim(dust_names(4))) then + ! cam_out%dstwet4(:) = max(-sflx(:), 0._r8) + ! endif + ! endif + + !enddo + ! + !if (sslt_active) then + ! call outfld( 'SSTSFWET', sflx_tot_slt, pcols, lchnk) + !endif + !if (dust_active) then + ! call outfld( 'DSTSFWET', sflx_tot_dst, pcols, lchnk) + !endif + + endsubroutine aero_model_wetdep + + !------------------------------------------------------------------------- + ! provides aerosol surface area info for sectional aerosols + ! called from mo_usrrxt + !------------------------------------------------------------------------- + subroutine aero_model_surfarea( & + mmr, radmean, relhum, pmid, temp, strato_sad, sulfate, m, ltrop, & + dlat, het1_ndx, pbuf, ncol, sfc, dm_aer, sad_total, reff_trop ) + + !use mo_constants, only : pi, avo => avogadro + + ! dummy args + real(r8), intent(in) :: pmid(:,:) + real(r8), intent(in) :: temp(:,:) + real(r8), intent(in) :: mmr(:,:,:) + real(r8), intent(in) :: radmean ! mean radii in cm + real(r8), intent(in) :: strato_sad(:,:) + integer, intent(in) :: ncol + integer, intent(in) :: ltrop(:) + real(r8), intent(in) :: dlat(:) ! degrees latitude + integer, intent(in) :: het1_ndx + real(r8), intent(in) :: relhum(:,:) + real(r8), intent(in) :: m(:,:) ! total atm density (/cm^3) + real(r8), intent(in) :: sulfate(:,:) + type(physics_buffer_desc), pointer :: pbuf(:) + + real(r8), intent(inout) :: sfc(:,:,:) + real(r8), intent(inout) :: dm_aer(:,:,:) + real(r8), intent(inout) :: sad_total(:,:) + real(r8), intent(out) :: reff_trop(:,:) + + !! local vars + + !integer :: i,k + !real(r8) :: rho_air + !real(r8) :: v, n, n_exp, r_rd, r_sd + !real(r8) :: dm_sulf, dm_sulf_wet, log_sd_sulf, sfc_sulf, sfc_nit + !real(r8) :: dm_orgc, dm_orgc_wet, log_sd_orgc, sfc_oc, sfc_soa + !real(r8) :: sfc_soai, sfc_soam, sfc_soab, sfc_soat, sfc_soax + !real(r8) :: dm_bc, dm_bc_wet, log_sd_bc, sfc_bc + !real(r8) :: rxt_sulf, rxt_nit, rxt_oc, rxt_soa + !real(r8) :: c_n2o5, c_ho2, c_no2, c_no3 + !real(r8) :: s_exp + + !!----------------------------------------------------------------- + !! ... parameters for log-normal distribution by number + !! references: + !! Chin et al., JAS, 59, 461, 2003 + !! Liao et al., JGR, 108(D1), 4001, 2003 + !! Martin et al., JGR, 108(D3), 4097, 2003 + !!----------------------------------------------------------------- + !real(r8), parameter :: rm_sulf = 6.95e-6_r8 ! mean radius of sulfate particles (cm) (Chin) + !real(r8), parameter :: sd_sulf = 2.03_r8 ! standard deviation of radius for sulfate (Chin) + !real(r8), parameter :: rho_sulf = 1.7e3_r8 ! density of sulfate aerosols (kg/m3) (Chin) + + !real(r8), parameter :: rm_orgc = 2.12e-6_r8 ! mean radius of organic carbon particles (cm) (Chin) + !real(r8), parameter :: sd_orgc = 2.20_r8 ! standard deviation of radius for OC (Chin) + !real(r8), parameter :: rho_orgc = 1.8e3_r8 ! density of OC aerosols (kg/m3) (Chin) + + !real(r8), parameter :: rm_bc = 1.18e-6_r8 ! mean radius of soot/BC particles (cm) (Chin) + !real(r8), parameter :: sd_bc = 2.00_r8 ! standard deviation of radius for BC (Chin) + !real(r8), parameter :: rho_bc = 1.0e3_r8 ! density of BC aerosols (kg/m3) (Chin) + + !real(r8), parameter :: mw_so4 = 98.e-3_r8 ! so4 molecular wt (kg/mole) + + !integer :: irh, rh_l, rh_u + !real(r8) :: factor, rfac_sulf, rfac_oc, rfac_bc, rfac_ss + !logical :: zero_aerosols + + !!----------------------------------------------------------------- + !! ... table for hygroscopic growth effect on radius (Chin et al) + !! (no growth effect for mineral dust) + !!----------------------------------------------------------------- + !real(r8), dimension(7) :: table_rh, table_rfac_sulf, table_rfac_bc, table_rfac_oc, table_rfac_ss + + !data table_rh(1:7) / 0.0_r8, 0.5_r8, 0.7_r8, 0.8_r8, 0.9_r8, 0.95_r8, 0.99_r8/ + !data table_rfac_sulf(1:7) / 1.0_r8, 1.4_r8, 1.5_r8, 1.6_r8, 1.8_r8, 1.9_r8, 2.2_r8/ + !data table_rfac_oc(1:7) / 1.0_r8, 1.2_r8, 1.4_r8, 1.5_r8, 1.6_r8, 1.8_r8, 2.2_r8/ + !data table_rfac_bc(1:7) / 1.0_r8, 1.0_r8, 1.0_r8, 1.2_r8, 1.4_r8, 1.5_r8, 1.9_r8/ + !data table_rfac_ss(1:7) / 1.0_r8, 1.6_r8, 1.8_r8, 2.0_r8, 2.4_r8, 2.9_r8, 4.8_r8/ + + !!----------------------------------------------------------------- + !! ... exponent for calculating number density + !!----------------------------------------------------------------- + !n_exp = exp( -4.5_r8*log(sd_sulf)*log(sd_sulf) ) + + !dm_sulf = 2._r8 * rm_sulf + !dm_orgc = 2._r8 * rm_orgc + !dm_bc = 2._r8 * rm_bc + + !log_sd_sulf = log(sd_sulf) + !log_sd_orgc = log(sd_orgc) + !log_sd_bc = log(sd_bc) + + !reff_trop(:,:) = 0._r8 + + !ver_loop: do k = 1,pver + ! col_loop: do i = 1,ncol + ! !------------------------------------------------------------------------- + ! ! ... air density (kg/m3) + ! !------------------------------------------------------------------------- + ! rho_air = pmid(i,k)/(temp(i,k)*287.04_r8) + ! !------------------------------------------------------------------------- + ! ! ... aerosol growth interpolated from M.Chin's table + ! !------------------------------------------------------------------------- + ! if (relhum(i,k) >= table_rh(7)) then + ! rfac_sulf = table_rfac_sulf(7) + ! rfac_oc = table_rfac_oc(7) + ! rfac_bc = table_rfac_bc(7) + ! else + ! do irh = 2,7 + ! if (relhum(i,k) <= table_rh(irh)) then + ! exit + ! end if + ! end do + ! rh_l = irh-1 + ! rh_u = irh + + ! factor = (relhum(i,k) - table_rh(rh_l))/(table_rh(rh_u) - table_rh(rh_l)) + + ! rfac_sulf = table_rfac_sulf(rh_l) + factor*(table_rfac_sulf(rh_u) - table_rfac_sulf(rh_l)) + ! rfac_oc = table_rfac_oc(rh_u) + factor*(table_rfac_oc(rh_u) - table_rfac_oc(rh_l)) + ! rfac_bc = table_rfac_bc(rh_u) + factor*(table_rfac_bc(rh_u) - table_rfac_bc(rh_l)) + ! end if + + ! dm_sulf_wet = dm_sulf * rfac_sulf + ! dm_orgc_wet = dm_orgc * rfac_oc + ! dm_bc_wet = dm_bc * rfac_bc + + ! dm_bc_wet = min(dm_bc_wet ,50.e-6_r8) ! maximum size is 0.5 micron (Chin) + ! dm_orgc_wet = min(dm_orgc_wet,50.e-6_r8) ! maximum size is 0.5 micron (Chin) + + + ! !------------------------------------------------------------------------- + ! ! ... sulfate aerosols + ! !------------------------------------------------------------------------- + ! zero_aerosols = k < ltrop(i) + ! if ( abs( dlat(i) ) > 50._r8 ) then + ! zero_aerosols = pmid(i,k) < 30000._r8 + ! endif + ! !------------------------------------------------------------------------- + ! ! ... use ubvals climatology for stratospheric sulfate surface area density + ! !------------------------------------------------------------------------- + ! if( zero_aerosols ) then + ! sfc_sulf = strato_sad(i,k) + ! if ( het1_ndx > 0 ) then + ! sfc_sulf = 0._r8 ! reaction already taken into account in mo_strato_rates.F90 + ! end if + ! sfc_nit = 0._r8 + ! sfc_soa = 0._r8 + ! sfc_oc = 0._r8 + ! sfc_bc = 0._r8 + ! else + + ! if( so4_ndx > 0 ) then + ! !------------------------------------------------------------------------- + ! ! convert mass mixing ratio of aerosol to cm3/cm3 (cm^3_aerosol/cm^3_air) + ! ! v=volume density (m^3/m^3) + ! ! rho_aer=density of aerosol (kg/m^3) + ! ! v=m*rho_air/rho_aer [kg/kg * (kg/m3)_air/(kg/m3)_aer] + ! !------------------------------------------------------------------------- + ! v = mmr(i,k,so4_ndx) * rho_air/rho_sulf + ! !------------------------------------------------------------------------- + ! ! calculate the number density of aerosol (aerosols/cm3) + ! ! assuming a lognormal distribution + ! ! n = (aerosols/cm3) + ! ! dm = geometric mean diameter + ! ! + ! ! because only the dry mass of the aerosols is known, we + ! ! use the mean dry radius + ! !------------------------------------------------------------------------- + ! n = v * (6._r8/pi)*(1._r8/(dm_sulf**3._r8))*n_exp + ! !------------------------------------------------------------------------- + ! ! find surface area of aerosols using dm_wet, log_sd + ! ! (increase of sd due to RH is negligible) + ! ! and number density calculated above as distribution + ! ! parameters + ! ! sfc = surface area of wet aerosols (cm^2/cm^3) + ! !------------------------------------------------------------------------- + ! s_exp = exp(2._r8*log_sd_sulf*log_sd_sulf) + ! sfc_sulf = n * pi * (dm_sulf_wet**2._r8) * s_exp + + ! else + ! !------------------------------------------------------------------------- + ! ! if so4 not simulated, use off-line sulfate and calculate as above + ! ! convert sulfate vmr to volume density of aerosol (cm^3_aerosol/cm^3_air) + ! !------------------------------------------------------------------------- + ! v = sulfate(i,k) * m(i,k) * mw_so4 / (avo * rho_sulf) *1.e6_r8 + ! n = v * (6._r8/pi)*(1._r8/(dm_sulf**3._r8))*n_exp + ! s_exp = exp(2._r8*log_sd_sulf*log_sd_sulf) + ! sfc_sulf = n * pi * (dm_sulf_wet**2._r8) * s_exp + + ! end if + ! + ! !------------------------------------------------------------------------- + ! ! ammonium nitrate (follow same procedure as sulfate, using size and density of sulfate) + ! !------------------------------------------------------------------------- + ! if( nit_ndx > 0 ) then + ! v = mmr(i,k,nit_ndx) * rho_air/rho_sulf + ! n = v * (6._r8/pi)*(1._r8/(dm_sulf**3._r8))*n_exp + ! s_exp = exp(2._r8*log_sd_sulf*log_sd_sulf) + ! sfc_nit = n * pi * (dm_sulf_wet**2._r8) * s_exp + ! else + ! sfc_nit = 0._r8 + ! end if + + ! !------------------------------------------------------------------------- + ! ! hydrophylic organic carbon (follow same procedure as sulfate) + ! !------------------------------------------------------------------------- + ! if( oc2_ndx > 0 ) then + ! v = mmr(i,k,oc2_ndx) * rho_air/rho_orgc + ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3))*n_exp + ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) + ! sfc_oc = n * pi * (dm_orgc_wet**2._r8) * s_exp + ! else + ! sfc_oc = 0._r8 + ! end if + + ! !------------------------------------------------------------------------- + ! ! secondary organic carbon (follow same procedure as sulfate) + ! !------------------------------------------------------------------------- + ! if( soa_ndx > 0 ) then + ! v = mmr(i,k,soa_ndx) * rho_air/rho_orgc + ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp + ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) + ! sfc_soa = n * pi * (dm_orgc_wet**2._r8) * s_exp + ! else + ! sfc_soa = 0._r8 + ! end if + + ! !------------------------------------------------------------------------- + ! ! black carbon (follow same procedure as sulfate) + ! !------------------------------------------------------------------------- + ! if( cb2_ndx > 0 ) then + ! v = mmr(i,k,cb2_ndx) * rho_air/rho_bc + ! n = v * (6._r8/pi)*(1._r8/(dm_bc**3._r8))*n_exp + ! s_exp = exp(2._r8*log_sd_bc*log_sd_bc) + ! sfc_bc = n * pi * (dm_bc_wet**2._r8) * s_exp + ! else + ! sfc_bc = 0._r8 + ! end if + ! if( soai_ndx > 0 ) then + ! v = mmr(i,k,soai_ndx) * rho_air/rho_orgc + ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp + ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) + ! sfc_soai = n * pi * (dm_orgc_wet**2._r8) * s_exp + ! else + ! sfc_soai = 0._r8 + ! end if + ! if( soam_ndx > 0 ) then + ! v = mmr(i,k,soam_ndx) * rho_air/rho_orgc + ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp + ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) + ! sfc_soam = n * pi * (dm_orgc_wet**2._r8) * s_exp + ! else + ! sfc_soam = 0._r8 + ! end if + ! if( soab_ndx > 0 ) then + ! v = mmr(i,k,soab_ndx) * rho_air/rho_orgc + ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp + ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) + ! sfc_soab = n * pi * (dm_orgc_wet**2._r8) * s_exp + ! else + ! sfc_soab = 0._r8 + ! end if + ! if( soat_ndx > 0 ) then + ! v = mmr(i,k,soat_ndx) * rho_air/rho_orgc + ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp + ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) + ! sfc_soat = n * pi * (dm_orgc_wet**2._r8) * s_exp + ! else + ! sfc_soat = 0._r8 + ! end if + ! if( soax_ndx > 0 ) then + ! v = mmr(i,k,soax_ndx) * rho_air/rho_orgc + ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp + ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) + ! sfc_soax = n * pi * (dm_orgc_wet**2._r8) * s_exp + ! else + ! sfc_soax = 0._r8 + ! end if + ! sfc_soa = sfc_soa + sfc_soai + sfc_soam + sfc_soab + sfc_soat + sfc_soax + + ! end if + + ! sfc(i,k,:) = (/ sfc_sulf, sfc_nit, sfc_oc, sfc_soa, sfc_bc /) + ! dm_aer(i,k,:) = (/ dm_sulf_wet,dm_sulf_wet,dm_orgc_wet,dm_orgc_wet,dm_bc_wet /) + + ! !------------------------------------------------------------------------- + ! ! ... add up total surface area density for output + ! !------------------------------------------------------------------------- + ! sad_total(i,k) = sfc_sulf + sfc_nit + sfc_oc + sfc_soa + sfc_bc + + ! enddo col_loop + !enddo ver_loop + + end subroutine aero_model_surfarea + + !------------------------------------------------------------------------- + ! stub + !------------------------------------------------------------------------- + subroutine aero_model_strat_surfarea( ncol, mmr, pmid, temp, ltrop, pbuf, strato_sad, reff_strat ) + + ! dummy args + integer, intent(in) :: ncol + real(r8), intent(in) :: mmr(:,:,:) + real(r8), intent(in) :: pmid(:,:) + real(r8), intent(in) :: temp(:,:) + integer, intent(in) :: ltrop(:) ! tropopause level indices + type(physics_buffer_desc), pointer :: pbuf(:) + real(r8), intent(out) :: strato_sad(:,:) + real(r8), intent(out) :: reff_strat(:,:) + + strato_sad(:,:) = 0._r8 + reff_strat(:,:) = 0._r8 + + end subroutine aero_model_strat_surfarea + + !============================================================================= + !============================================================================= + subroutine aero_model_gasaerexch( loffset, ncol, lchnk, troplev, delt, reaction_rates, & + tfld, pmid, pdel, mbar, relhum, & + zm, qh2o, cwat, cldfr, cldnum, & + airdens, invariants, del_h2so4_gasprod, & + vmr0, vmr, pbuf ) + + use chem_mods, only : gas_pcnst + !use mo_aerosols, only : aerosols_formation, has_aerosols + !use mo_setsox, only : setsox, has_sox + !use mo_setsoa, only : setsoa, has_soa + + !----------------------------------------------------------------------- + ! ... dummy arguments + !----------------------------------------------------------------------- + integer, intent(in) :: loffset ! offset applied to modal aero "pointers" + integer, intent(in) :: ncol ! number columns in chunk + integer, intent(in) :: lchnk ! chunk index + integer, intent(in) :: troplev(:) + real(r8), intent(in) :: delt ! time step size (sec) + real(r8), intent(in) :: reaction_rates(:,:,:) ! reaction rates + real(r8), intent(in) :: tfld(:,:) ! temperature (K) + real(r8), intent(in) :: pmid(:,:) ! pressure at model levels (Pa) + real(r8), intent(in) :: pdel(:,:) ! pressure thickness of levels (Pa) + real(r8), intent(in) :: mbar(:,:) ! mean wet atmospheric mass ( amu ) + real(r8), intent(in) :: relhum(:,:) ! relative humidity + real(r8), intent(in) :: airdens(:,:) ! total atms density (molec/cm**3) + real(r8), intent(in) :: invariants(:,:,:) + real(r8), intent(in) :: del_h2so4_gasprod(:,:) + real(r8), intent(in) :: zm(:,:) + real(r8), intent(in) :: qh2o(:,:) + real(r8), intent(in) :: cwat(:,:) ! cloud liquid water content (kg/kg) + real(r8), intent(in) :: cldfr(:,:) + real(r8), intent(in) :: cldnum(:,:) ! droplet number concentration (#/kg) + real(r8), intent(in) :: vmr0(:,:,:) ! initial mixing ratios (before gas-phase chem changes) + real(r8), intent(inout) :: vmr(:,:,:) ! mixing ratios ( vmr ) + + type(physics_buffer_desc), pointer :: pbuf(:) + + !! local vars + + !real(r8) :: vmrcw(ncol,pver,gas_pcnst) ! cloud-borne aerosol (vmr) + + !real(r8) :: aqso4(ncol,1) ! aqueous phase chemistry + !real(r8) :: aqh2so4(ncol,1) ! aqueous phase chemistry + !real(r8) :: aqso4_h2o2(ncol) ! SO4 aqueous phase chemistry due to H2O2 + !real(r8) :: aqso4_o3(ncol) ! SO4 aqueous phase chemistry due to O3 + !real(r8) :: xphlwc(ncol,pver) ! pH value multiplied by lwc + + + ! !aqueous chemistry ... + + !if( has_sox ) then + ! call setsox( & + ! ncol, & + ! lchnk, & + ! loffset, & + ! delt, & + ! pmid, & + ! pdel, & + ! tfld, & + ! mbar, & + ! cwat, & + ! cldfr, & + ! cldnum, & + ! airdens, & + ! invariants, & + ! vmrcw, & + ! vmr, & + ! xphlwc, & + ! aqso4, & + ! aqh2so4, & + ! aqso4_h2o2,& + ! aqso4_o3 & + ! ) + ! call outfld( 'XPH_LWC',xphlwc(:ncol,:), ncol , lchnk ) + !endif + + !if( has_soa ) then + ! call setsoa( ncol, lchnk, delt, reaction_rates, tfld, airdens, vmr, pbuf) + !endif + + !if( has_aerosols ) then + ! call aerosols_formation( ncol, lchnk, tfld, relhum, vmr ) + !endif + + + end subroutine aero_model_gasaerexch + + !============================================================================= + !============================================================================= + subroutine aero_model_emissions( state, cam_in ) + !use seasalt_model, only: seasalt_emis, seasalt_indices + !use dust_model, only: dust_emis, dust_indices + use physics_types, only: physics_state + + ! Arguments: + + type(physics_state), intent(in) :: state ! Physics state variables + type(cam_in_t), intent(inout) :: cam_in ! import state + + !! local vars + + !integer :: lchnk, ncol + !integer :: m, mm + !real(r8) :: soil_erod_tmp(pcols) + !real(r8) :: sflx(pcols) ! accumulate over all bins for output + !real(r8) :: u10cubed(pcols) + !real (r8), parameter :: z0=0.0001_r8 ! m roughness length over oceans--from ocean model + + !lchnk = state%lchnk + !ncol = state%ncol + + !if (dust_active) then + + ! call dust_emis( ncol, lchnk, cam_in%dstflx, cam_in%cflx, soil_erod_tmp ) + + ! ! some dust emis diagnostics ... + ! sflx(:)=0._r8 + ! do m=1,dust_nbin + ! mm = dust_indices(m) + ! sflx(:ncol)=sflx(:ncol)+cam_in%cflx(:ncol,mm) + ! call outfld(trim(dust_names(m))//'SF',cam_in%cflx(:,mm),pcols, lchnk) + ! enddo + ! call outfld('DSTSFMBL',sflx(:),pcols,lchnk) + ! call outfld('LND_MBL',soil_erod_tmp(:),pcols, lchnk ) + !endif + + !if (sslt_active) then + ! u10cubed(:ncol)=sqrt(state%u(:ncol,pver)**2+state%v(:ncol,pver)**2) + ! ! move the winds to 10m high from the midpoint of the gridbox: + ! ! follows Tie and Seinfeld and Pandis, p.859 with math. + + ! u10cubed(:ncol)=u10cubed(:ncol)*log(10._r8/z0)/log(state%zm(:ncol,pver)/z0) + + ! ! we need them to the 3.41 power, according to Gong et al., 1997: + ! u10cubed(:ncol)=u10cubed(:ncol)**3.41_r8 + + ! sflx(:)=0._r8 + + ! call seasalt_emis( u10cubed, cam_in%sst, cam_in%ocnfrac, ncol, cam_in%cflx ) + + ! do m=1,seasalt_nbin + ! mm = seasalt_indices(m) + ! sflx(:ncol)=sflx(:ncol)+cam_in%cflx(:ncol,mm) + ! call outfld(trim(seasalt_names(m))//'SF',cam_in%cflx(:,mm),pcols,lchnk) + ! enddo + ! call outfld('SSTSFMBL',sflx(:),pcols,lchnk) + !endif + + end subroutine aero_model_emissions + +end module aero_model diff --git a/src/chemistry/pp_geoschem/charge_neutrality.F90 b/src/chemistry/pp_geoschem/charge_neutrality.F90 new file mode 100644 index 0000000000..92ec519000 --- /dev/null +++ b/src/chemistry/pp_geoschem/charge_neutrality.F90 @@ -0,0 +1,176 @@ +module charge_neutrality + + use shr_kind_mod, only : r8 => shr_kind_r8 + use ppgrid, only : pcols, pver + !use mo_chem_utls, only : get_spc_ndx + + implicit none + + private + public :: charge_balance + + interface charge_balance + module procedure charge_fix_vmr + module procedure charge_fix_mmr ! for fixing charge balance after vertical diffusion + end interface + + !integer, parameter :: pos_ion_n = 22 + !character(len=16), parameter :: pos_ion_names(pos_ion_n) = (/ & + ! 'Np ','N2p ','Op ','O2p ','NOp ', & + ! 'O4p ','O2p_H2O ','Hp_H2O ','Hp_2H2O ','Hp_3H2O ', & + ! 'Hp_4H2O ','Hp_5H2O ','H3Op_OH ','Hp_3N1 ','Hp_4N1 ', & + ! 'NOp_H2O ','NOp_2H2O ','NOp_3H2O ','NOp_CO2 ','NOp_N2 ', & + ! 'Op2P ','Op2D ' /) + + !integer, parameter :: neg_ion_n = 21 + !character(len=16), parameter :: neg_ion_names(neg_ion_n) = (/ & + ! 'Om ','O2m ','O3m ','O4m ','OHm ', & + ! 'CO3m ','CO4m ','NO2m ','NO3m ','HCO3m ', & + ! 'CLm ','CLOm ','CLm_H2O ','CLm_HCL ','CO3m_H2O ', & + ! 'NO3m_H2O ','CO3m2H2O ','NO2m_H2O ','NO3m2H2O ','NO3mHNO3 ', & + ! 'NO3m_HCL ' /) + +contains + + !----------------------------------------------------------------------- + ! ... force ion/electron balance + !----------------------------------------------------------------------- + subroutine charge_fix_vmr( ncol, vmr ) + + !----------------------------------------------------------------------- + ! ... dummy arguments + !----------------------------------------------------------------------- + integer, intent(in) :: ncol + real(r8), intent(inout) :: vmr(:,:,:) ! concentration + + !----------------------------------------------------------------------- + ! ... local variables + !----------------------------------------------------------------------- + integer :: i, n + integer :: elec_ndx + real(r8) :: wrk(ncol,pver) + + !elec_ndx = get_spc_ndx('e') + + !!-------------------------------------------------------------------- + !! If electrons are in the chemistry add up charges to get electrons + !!-------------------------------------------------------------------- + !if( elec_ndx > 0 ) then + ! wrk(:,:) = 0._r8 + + ! do i = 1,pos_ion_n + ! n = get_spc_ndx(pos_ion_names(i)) + ! if (n>0) then + ! wrk(:ncol,:) = wrk(:ncol,:) + vmr(:ncol,:,n) + ! endif + ! enddo + ! do i = 1,neg_ion_n + ! n = get_spc_ndx(neg_ion_names(i)) + ! if (n>0) then + ! wrk(:ncol,:) = wrk(:ncol,:) - vmr(:ncol,:,n) + ! endif + ! enddo + + ! where ( wrk(:,:)<0._r8 ) + ! wrk(:,:)=0._r8 + ! end where + + ! vmr(:ncol,:,elec_ndx) = wrk(:ncol,:) + + !end if + + end subroutine charge_fix_vmr + + !----------------------------------------------------------------------- + ! ... force ion/electron balance + !----------------------------------------------------------------------- + subroutine charge_fix_mmr(state, pbuf) + + use constituents, only : cnst_get_ind + use physconst, only : mbarv ! Constituent dependent mbar + use short_lived_species, only : slvd_index,slvd_pbf_ndx => pbf_idx ! Routines to access short lived species in pbuf + use chem_mods, only : adv_mass + use physics_buffer, only : pbuf_get_field,physics_buffer_desc ! Needed to get variables from physics buffer + use physics_types, only : physics_state + + !----------------------------------------------------------------------- + ! ... dummy arguments + !----------------------------------------------------------------------- + type(physics_state), intent(inout), target :: state + type(physics_buffer_desc), pointer :: pbuf(:) ! physics buffer + + !----------------------------------------------------------------------- + ! ... local variables + !----------------------------------------------------------------------- + !integer :: i, n, ns, nc + !integer :: elec_ndx + !integer :: lchnk !Chunk number from state structure + !integer :: ncol !Number of columns in this chunk from state structure + + !real(r8), dimension(:,:,:), pointer :: q ! model mass mixing ratios + !real(r8), dimension(:,:), pointer :: qs ! Pointer to access fields in pbuf + + !character(len=16) :: name + !real(r8) :: vmr(state%ncol,pver) + !real(r8) :: wrk(state%ncol,pver) + + !!----------------------------------------------------------------------- + !elec_ndx = get_spc_ndx('e') + + !!-------------------------------------------------------------------- + !! If electrons are simulated enforce charge neutrality ... + !!-------------------------------------------------------------------- + !if( elec_ndx > 0 ) then + ! lchnk = state%lchnk + ! ncol = state%ncol + ! q => state%q + ! wrk(:,:) = 0._r8 + + ! do i = 1,pos_ion_n+neg_ion_n + ! if (i .le. pos_ion_n) then + ! name = pos_ion_names(i) + ! else + ! name = neg_ion_names(i-pos_ion_n) + ! endif + ! n = get_spc_ndx(name) + + ! if (n>0) then + ! call cnst_get_ind( name, nc, abort=.false. ) + ! if (nc>0) then + ! vmr(:ncol,:) = mbarv(:ncol,:,lchnk) * q(:ncol,:,nc) / adv_mass(n) + ! else + ! ! not transported + ! ns = slvd_index( name ) + ! if (ns>0) then + ! call pbuf_get_field(pbuf, slvd_pbf_ndx, qs, start=(/1,1,ns/), kount=(/pcols,pver,1/) ) + ! vmr(:ncol,:) = mbarv(:ncol,:,lchnk) * qs(:ncol,:) / adv_mass(n) + ! endif + ! endif + ! if (i .le. pos_ion_n) then + ! wrk(:ncol,:) = wrk(:ncol,:) + vmr(:ncol,:) + ! else + ! wrk(:ncol,:) = wrk(:ncol,:) - vmr(:ncol,:) + ! endif + ! end if + ! end do + + ! where ( wrk(:,:)<0._r8 ) + ! wrk(:,:)=0._r8 + ! end where + + ! call cnst_get_ind( 'e', nc, abort=.false. ) + + ! if (nc>0) then + ! q(:ncol,:,nc) = adv_mass(elec_ndx) * wrk(:ncol,:) / mbarv(:ncol,:,lchnk) + ! else + ! ! not transported + ! ns = slvd_index( 'e' ) + ! call pbuf_get_field(pbuf, slvd_pbf_ndx, qs, start=(/1,1,ns/), kount=(/pcols,pver,1/) ) + ! qs(:ncol,:) = adv_mass(elec_ndx) * wrk(:ncol,:) / mbarv(:ncol,:,lchnk) + ! endif + + !endif + + end subroutine charge_fix_mmr + +end module charge_neutrality diff --git a/src/chemistry/pp_geoschem/chem_mods.F90 b/src/chemistry/pp_geoschem/chem_mods.F90 new file mode 100644 index 0000000000..af430ac0ca --- /dev/null +++ b/src/chemistry/pp_geoschem/chem_mods.F90 @@ -0,0 +1,91 @@ + module chem_mods +!-------------------------------------------------------------- +! ... Basic chemistry parameters and arrays +!-------------------------------------------------------------- + use shr_kind_mod, only : r8 => shr_kind_r8 + use constituents, only : pcnst + implicit none + save + + INTEGER, PARAMETER :: nTracersMax = 200 ! Must be equal to nadv_chem + INTEGER :: nTracers + CHARACTER(LEN=255) :: tracerNames(nTracersMax) + CHARACTER(LEN=255) :: tracerLongNames(nTracersMax) + REAL(r8) :: adv_Mass(nTracersMax) + REAL(r8) :: MWRatio(nTracersMax) + REAL(r8) :: ref_MMR(nTracersMax) + + ! Short-lived species (i.e. not advected) + INTEGER, PARAMETER :: nSlsMax = 500 ! UNadvected species only + INTEGER :: nSls + CHARACTER(LEN=255) :: slsNames(nSlsMax) + CHARACTER(LEN=255) :: slsLongnames(nSlsMax) + REAL(r8) :: sls_Ref_MMR(nSlsMax) + REAL(r8) :: slsMWRatio(nSlsMax) + + ! Mapping between constituents and GEOS-Chem tracers + INTEGER :: map2GC(pcnst) + INTEGER :: map2GC_Sls(nSlsMax) + + !----------------------------- + ! Dry deposition index mapping + !----------------------------- + ! drySpc_ndx maps drydep_list onto tracerNames such that + ! tracerNames(drySpc_ndx(:)) = drydep_list(:) + INTEGER, ALLOCATABLE :: drySpc_ndx(:) + + ! map2GC_dryDep maps drydep_list onto the GEOS-Chem dry deposition + ! velocity arrays such that + ! State_Chm%DryDepVel(1,:,map2GC_dryDep(:)) = cam_in%depVel(:,:) + INTEGER, ALLOCATABLE :: map2GC_dryDep(:) + + + ! Mapping from constituents to raw index + INTEGER :: map2Idx(pcnst) + + INTEGER, PARAMETER :: phtcnt = 40, & ! number of photolysis reactions + rxntot = 212, & ! number of total reactions + gascnt = 172, & ! number of gas phase reactions + nabscol = 2, & ! number of absorbing column densities + gas_pcnst = 103, & ! number of "gas phase" species + nfs = 4, & ! number of "fixed" species + relcnt = 0, & ! number of relationship species + grpcnt = 0, & ! number of group members + nzcnt = 824, & ! number of non-zero matrix entries + extcnt = 4, & ! number of species with external forcing + clscnt1 = 8, & ! number of species in explicit class + clscnt2 = 0, & ! number of species in hov class + clscnt3 = 0, & ! number of species in ebi class + clscnt4 = 95, & ! number of species in implicit class + clscnt5 = 0, & ! number of species in rodas class + indexm = 1, & ! index of total atm density in invariant array + indexh2o = 4, & ! index of water vapor density + clsze = 1, & ! loop length for implicit chemistry + rxt_tag_cnt = 95, & + enthalpy_cnt = 0 +! nslvd = 0 + integer :: clscnt(5) = 0 + integer :: cls_rxt_cnt(4,5) = 0 + integer :: clsmap(gas_pcnst,5) = 0 + integer :: permute(gas_pcnst,5) = 0 + integer :: diag_map(clscnt4) = 0 + !real(r8) :: adv_mass(gas_pcnst) = 0._r8 + real(r8) :: crb_mass(gas_pcnst) = 0._r8 + real(r8) :: fix_mass(max(1,nfs)) + real(r8), allocatable :: cph_enthalpy(:) + integer, allocatable :: cph_rid(:) + integer, allocatable :: num_rnts(:) + integer, allocatable :: rxt_tag_map(:) + real(r8), allocatable :: pht_alias_mult(:,:) + character(len=16), allocatable :: rxt_tag_lst(:) + character(len=16), allocatable :: pht_alias_lst(:,:) + character(len=16) :: inv_lst(max(1,nfs)) + character(len=16) :: extfrc_lst(max(1,extcnt)) + logical :: frc_from_dataset(max(1,extcnt)) + logical :: is_vector + logical :: is_scalar +! character(len=16) :: slvd_lst(max(1,nslvd)) + integer :: nslvd + character(len=255), allocatable :: slvd_lst(:) + real(r8), allocatable :: slvd_ref_mmr(:) + end module chem_mods diff --git a/src/chemistry/pp_geoschem/chem_prod_loss_diags.F90 b/src/chemistry/pp_geoschem/chem_prod_loss_diags.F90 new file mode 100644 index 0000000000..b3eb614cf4 --- /dev/null +++ b/src/chemistry/pp_geoschem/chem_prod_loss_diags.F90 @@ -0,0 +1,37 @@ +module chem_prod_loss_diags + use shr_kind_mod, only : r8 => shr_kind_r8 + use chem_mods, only : clscnt1, clscnt4, gas_pcnst, clsmap, permute + use ppgrid, only : pver + use chem_mods, only : rxntot + use cam_history, only : addfld, outfld, add_default + !use mo_tracname, only : solsym + + implicit none + + private + public :: chem_prod_loss_diags_init + public :: chem_prod_loss_diags_out + +contains + + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + subroutine chem_prod_loss_diags_init + + end subroutine chem_prod_loss_diags_init + + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + subroutine chem_prod_loss_diags_out( ncol, lchnk, base_sol, reaction_rates, prod_in, loss_in, xhnm ) + + integer, intent(in) :: ncol, lchnk + real(r8), intent(in) :: base_sol(ncol,pver,gas_pcnst) + real(r8), intent(in) :: reaction_rates(ncol,pver,max(1,rxntot)) + real(r8), intent(in) :: prod_in(ncol,pver,max(1,clscnt4)) + real(r8), intent(in) :: loss_in(ncol,pver,max(1,clscnt4)) + real(r8), intent(in) :: xhnm(ncol,pver) + + end subroutine chem_prod_loss_diags_out + +end module chem_prod_loss_diags + diff --git a/src/chemistry/pp_geoschem/chemistry.F90 b/src/chemistry/pp_geoschem/chemistry.F90 new file mode 100644 index 0000000000..6393a2e1b5 --- /dev/null +++ b/src/chemistry/pp_geoschem/chemistry.F90 @@ -0,0 +1,4225 @@ +!================================================================================================ +! This is the "GEOS-Chem" chemistry module. +!================================================================================================ + +module chemistry + use shr_kind_mod, only: r8 => shr_kind_r8 + use physics_types, only: physics_state, physics_ptend, physics_ptend_init + use ppgrid, only: begchunk, endchunk, pcols + use ppgrid, only: pver, pverp + use constituents, only: pcnst, cnst_add, cnst_get_ind + !use mo_gas_phase_chemdr, only: map2chm + !use mo_constants, only: pi + use shr_const_mod, only: molw_dryair=>SHR_CONST_MWDAIR + !use chem_mods, only : gas_pcnst, adv_mass + !use mo_sim_dat, only: set_sim_dat + use seq_drydep_mod, only : nddvels => n_drydep, drydep_list + use spmd_utils, only : MasterProc, myCPU=>Iam, nCPUs=>npes + use cam_logfile, only : iulog + use string_utils, only : to_upper + + !-------------------------------------------------------------------- + ! Basic GEOS-Chem modules + !-------------------------------------------------------------------- + USE DiagList_Mod, ONLY : DgnList ! Derived type for diagnostics list + USE Input_Opt_Mod, ONLY : OptInput ! Derived type for Input Options + USE State_Chm_Mod, ONLY : ChmState ! Derived type for Chemistry State object + USE State_Diag_Mod, ONLY : DgnState ! Derived type for Diagnostics State object + USE State_Grid_Mod, ONLY : GrdState ! Derived type for Grid State object + USE State_Met_Mod, ONLY : MetState ! Derived type for Meteorology State object + USE ErrCode_Mod ! Error codes for success or failure + USE Error_Mod ! For error checking + + !----------------------------------------------------------------- + ! Parameters to define floating-point variables + !----------------------------------------------------------------- + USE PRECISION_MOD, ONLY : fp, f4 ! Flexible precision + + use Chem_Mods, only : nSlvd, slvd_Lst, slvd_ref_MMR + + ! Exit routine in CAM + use cam_abortutils, only : endrun + + use chem_mods, only : nTracersMax + use chem_mods, only : nTracers + use chem_mods, only : tracerNames + use chem_mods, only : tracerLongNames + use chem_mods, only : adv_Mass + use chem_mods, only : mwRatio + use chem_mods, only : ref_mmr + use chem_mods, only : nSlsMax + use chem_mods, only : nSls + use chem_mods, only : slsNames + use chem_mods, only : slsLongNames + use chem_mods, only : sls_ref_MMR + use chem_mods, only : slsmwRatio + use chem_mods, only : map2GC + use chem_mods, only : map2GC_Sls + use chem_mods, only : map2Idx + + IMPLICIT NONE + PRIVATE + SAVE + ! + ! Public interfaces + ! + public :: chem_is ! identify which chemistry is being used + public :: chem_register ! register consituents + public :: chem_is_active ! returns true if this package is active (ghg_chem=.true.) + public :: chem_implements_cnst ! returns true if consituent is implemented by this package + public :: chem_init_cnst ! initialize mixing ratios if not read from initial file + public :: chem_init ! initialize (history) variables + public :: chem_timestep_tend ! interface to tendency computation + public :: chem_final + public :: chem_write_restart + public :: chem_read_restart + public :: chem_init_restart + public :: chem_readnl ! read chem namelist + + public :: chem_emissions + public :: chem_timestep_init + + ! Location of valid input.geos + CHARACTER(LEN=500) :: inputGeosPath + + ! Location of chemistry input (for now) + CHARACTER(LEN=500) :: chemInputsDir + + !----------------------------- + ! Derived type objects + !----------------------------- + TYPE(OptInput) :: Input_Opt ! Input Options object + TYPE(ChmState),ALLOCATABLE :: State_Chm(:) ! Chemistry State object + TYPE(DgnState),ALLOCATABLE :: State_Diag(:) ! Diagnostics State object + TYPE(GrdState),ALLOCATABLE :: State_Grid(:) ! Grid State object + TYPE(MetState),ALLOCATABLE :: State_Met(:) ! Meteorology State object + TYPE(DgnList ) :: Diag_List ! Diagnostics list object + + ! Indices of critical species + INTEGER :: iH2O, iO3, iCH4, iCO, iNO + + ! Indices in the physics buffer + INTEGER :: NDX_PBLH ! PBL height [m] + INTEGER :: NDX_FSDS ! Downward shortwave flux at surface [W/m2] + INTEGER :: NDX_CLDTOP ! Cloud top height [index] + INTEGER :: NDX_CLDFRC ! Cloud fraction [-] + INTEGER :: NDX_PRAIN ! Rain production rate [kg/kg/s] + INTEGER :: NDX_NEVAPR ! Total rate of precipitation evaporation [kg/kg/s] + INTEGER :: NDX_RPRDTOT ! Convective total precip. production rate [kg/kg/s] + INTEGER :: NDX_LSFLXPRC ! Large-scale precip. at interface (liq + snw) [kg/m2/s] + INTEGER :: NDX_LSFLXSNW ! Large-scale precip. at interface (snow only) [kg/m2/s] + + ! Get constituent indices + INTEGER :: ixCldLiq + INTEGER :: ixCldIce + + ! Strings + CHARACTER(LEN=255) :: ThisLoc + CHARACTER(LEN=255) :: ErrMsg + +#define ALLDDVEL_GEOSCHEM 1 +#define OCNDDVEL_GEOSCHEM 0 +#define OCNDDVEL_MOZART 0 + +! The following flags are only used if ALLDDVEL_GEOSCHEM is on +#define LANDTYPE_HEMCO 0 +#define LANDTYPE_CLM 1 + +#if ( OCNDDVEL_MOZART ) + ! Filenames to compute dry deposition velocities similarly to MOZART + CHARACTER(LEN=255) :: MOZART_depvel_lnd_file = 'depvel_lnd_file' + CHARACTER(LEN=255) :: MOZART_clim_soilw_file = 'clim_soilw_file' + CHARACTER(LEN=255) :: MOZART_season_wes_file = 'season_wes_file' +#endif + +!================================================================================================ +contains +!================================================================================================ + + LOGICAL function chem_is (NAME) + + CHARACTER(LEN=*), INTENT(IN) :: NAME + + chem_is = .false. + IF (NAME == 'geoschem' ) THEN + chem_is = .true. + ENDIF + IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_IS' + + end function chem_is + +!================================================================================================ + + subroutine chem_register + + use physics_buffer, only : pbuf_add_field, dtype_r8 + use PhysConst, only : MWDry + + use Short_Lived_Species, only : Register_Short_Lived_Species + + use State_Grid_Mod, only : Init_State_Grid, Cleanup_State_Grid + use State_Chm_Mod, only : Init_State_Chm, Cleanup_State_Chm + use State_Chm_Mod, only : Ind_ + use Input_Opt_Mod, only : Set_Input_Opt, Cleanup_Input_Opt + use Species_Mod, only : Species + + !----------------------------------------------------------------------- + ! + ! Purpose: register advected constituents for chemistry + ! + !----------------------------------------------------------------------- + ! Need to generate a temporary species database + Type(ChmState) :: SC + Type(GrdState) :: SG + Type(OptInput) :: IO + TYPE(Species), POINTER :: ThisSpc + + INTEGER :: I, N, M + REAL(r8) :: cptmp + REAL(r8) :: mwtmp + REAL(r8) :: qmin + REAL(r8) :: ref_VMR + CHARACTER(LEN=128) :: mixtype + CHARACTER(LEN=128) :: molectype + CHARACTER(LEN=128) :: lng_Name + LOGICAL :: camout + LOGICAL :: ic_from_cam2 + LOGICAL :: has_fixed_ubc + LOGICAL :: has_fixed_ubflx + + INTEGER :: RC + + ! SDE 2018-05-02: This seems to get called before anything else + ! that includes CHEM_INIT + ! At this point, mozart calls SET_SIM_DAT, which is specified by each + ! mechanism separately (ie mozart/chemistry.F90 calls the subroutine + ! set_sim_dat which is in pp_[mechanism]/mo_sim_dat.F90. That sets a lot of + ! data in other places, notably in "chem_mods" + + IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_REGISTER' + + ! Generate fake state_chm + IO%Max_BPCH_Diag = 1000 + IO%Max_AdvectSpc = 500 + IO%Max_Families = 250 + + IO%RootCPU = .False. + + CALL Set_Input_Opt( am_I_Root = .False., & + Input_Opt = IO, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Could not generate reference input options object!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Options needed by Init_State_Chm + IO%ITS_A_FULLCHEM_SIM = .True. + IO%LLinoz = .True. + IO%LUCX = .True. + IO%LPRT = .False. + IO%N_Advect = nTracers + DO I = 1, nTracers + IO%AdvectSpc_Name(I) = TRIM(tracerNames(I)) + ENDDO + IO%SalA_rEdge_um(1) = 0.01e+0_fp + IO%SalA_rEdge_um(2) = 0.50e+0_fp + IO%SalC_rEdge_um(1) = 0.50e+0_fp + IO%SalC_rEdge_um(2) = 8.00e+0_fp + + ! Prevent reporting + IO%rootCPU = .False. + IO%myCPU = myCPU + + CALL Init_State_Grid( am_I_Root = .False., & + State_Grid = SG , & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "Init_State_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + SG%NX = 1 + SG%NY = 1 + SG%NZ = 1 + + CALL Init_State_Chm( am_I_Root = .False., & + Input_Opt = IO, & + State_Chm = SC, & + State_Grid = SG, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "Init_State_Chm"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! At the moment, we force nadv_chem=200 in the setup file + ! Default + map2GC = -1 + ref_MMR(:) = 0.0e+0_r8 + MWRatio(:) = 1.0e+0_r8 + tracerLongNames = '' + + DO I = 1, nTracersMax + IF (I.LE.nTracers) THEN + N = Ind_(tracerNames(I)) + ThisSpc => SC%SpcData(N)%Info + lng_Name = TRIM(ThisSpc%FullName) + MWTmp = REAL(ThisSpc%MW_g,r8) + ref_VMR = REAL(ThisSpc%BackgroundVV,r8) + adv_Mass(I) = MWTmp + ref_MMR(I) = ref_VMR / (MWDry / MWTmp) + ELSE + lng_Name = TRIM(tracerNames(I)) + MWTmp = 1000.0e+0_r8 * (0.001e+0_r8) + adv_Mass(I) = MWTmp + ref_MMR(I) = 1.0e-38_r8 + ENDIF + MWRatio(I) = MWDry/MWTmp + tracerLongNames(I) = TRIM(lng_Name) + + ! dummy value for specific heat of constant pressure (Cp) + cptmp = 666._r8 + ! minimum mixing ratio + qmin = 1.e-38_r8 + ! mixing ratio type + mixtype = 'dry' + ! Used for ionospheric WACCM (WACCM-X) + molectype = 'minor' + ! Is an output field (?) + camout = .false. + ! Not true for O2(1-delta) or O2(1-sigma) + ic_from_cam2 = .true. + ! Use a fixed value at the upper boundary + has_fixed_ubc = .false. + ! Use a fixed flux condition at the upper boundary + has_fixed_ubflx = .false. + !write(tracernames(i),'(a,I0.4)') 'GCTRC_', i + ! NOTE: In MOZART, this only gets called for tracers + ! This is the call to add a "constituent" + CALL cnst_add( TRIM(tracerNames(I)), adv_Mass(I), cptmp, qmin, N, & + readiv=ic_from_cam2, mixtype=mixtype, cam_outfld=camout, & + molectype=molectype, fixed_ubc=has_fixed_ubc, & + fixed_ubflx=has_fixed_ubflx, longname=TRIM(lng_Name) ) + + ! Add to GC mapping. When starting a timestep, we will want to update the + ! concentration of State_Chm(x)%Species(1,iCol,iLev,m) with data from + ! constituent n + M = Ind_(TRIM(tracerNames(I))) + IF ( M > 0 ) THEN + map2GC(N) = M + map2Idx(N) = I + ENDIF + ! Nullify pointer + ThisSpc => NULL() + ENDDO + + ! Now unadvected species + map2GC_Sls = 0 + sls_ref_MMR(:) = 0.0e+0_r8 + SlsMWRatio(:) = -1.0e+0_r8 + slsLongNames = '' + DO I = 1, nSls + N = Ind_(slsNames(I)) + IF ( N .GT. 0 ) THEN + ThisSpc => SC%SpcData(N)%Info + MWTmp = REAL(ThisSpc%MW_g,r8) + ref_VMR = REAL(ThisSpc%BackgroundVV,r8) + lng_Name = TRIM(ThisSpc%FullName) + slsLongNames(I) = lng_Name + sls_ref_MMR(I) = ref_VMR / (MWDry / MWTmp) + SlsMWRatio(I) = MWDry / MWTmp + map2GC_Sls(I) = N + ThisSpc => NULL() + ENDIF + ENDDO + + ! Pass information to "short_lived_species" module + slvd_ref_MMR(1:nSls) = sls_ref_MMR(1:nSls) + CALL Register_Short_Lived_Species() + ! More information: + ! http://www.cesm.ucar.edu/models/atm-cam/docs/phys-interface/node5.html + + ! Clean up + Call Cleanup_State_Chm ( .False., SC, RC ) + Call Cleanup_State_Grid( .False., SG, RC ) + Call Cleanup_Input_Opt ( .False., IO, RC ) + + end subroutine chem_register + + subroutine chem_readnl(nlfile) + ! This is the FIRST routine to get called - so it should read in + ! GEOS-Chem options from input.geos without actually doing any + ! initialization + + use cam_abortutils, only : endrun + use units, only : getunit, freeunit + use mpishorthand + use gckpp_Model, only : nSpec, Spc_Names + use mo_chem_utls, only : get_spc_ndx + use chem_mods, only : drySpc_ndx + + ! args + CHARACTER(LEN=*), INTENT(IN) :: nlfile ! filepath for file containing namelist input + + ! Local variables + INTEGER :: I, N, nIgnored + INTEGER :: UNITN, IERR + CHARACTER(LEN=500) :: line + LOGICAL :: menuFound + LOGICAL :: validSLS + +#if ( OCNDDVEL_MOZART ) + namelist /chem_inparm/ MOZART_depvel_lnd_file, & + MOZART_clim_soilw_file, & + MOZART_season_wes_file +#endif + + nIgnored = 0 + + ! Set paths + ! MIT path + !inputGeosPath='/home/fritzt/input.geos.template' + !chemInputsDir='/net/d06/data/GCdata/ExtData/CHEM_INPUTS/' + ! Cheyenne path + inputGeosPath='/glade/u/home/fritzt/input.geos.template' + chemInputsDir='/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/' + + +#if ( ALLDDVEL_GEOSCHEM + OCNDDVEL_GEOSCHEM + OCNDDVEL_MOZART != 1 ) + IF (MasterProc) THEN + Write(iulog,'(/,a)') REPEAT( "=", 79 ) + Write(iulog,'(a)') " Preprocessor flags are not set correctly in chemistry.F90" + Write(iulog,'(a)') " The user needs to decide how to compute dry deposition velocities" + Write(iulog,'(a)') " Three options appear: " + Write(iulog,'(a)') " + Let GEOS-Chem calculate all dry deposition velocities." + Write(iulog,'(a)') " Required setup:" + Write(iulog,'(a)') " ALLDDVEL_GEOSCHEM == 1" + Write(iulog,'(a)') " OCNDDVEL_GEOSCHEM == 0" + Write(iulog,'(a)') " OCNDDVEL_MOZART == 0" + Write(iulog,'(a)') " + Let CLM compute dry deposition velocities over land and let" + Write(iulog,'(a)') " GEOS-Chem compute velocities over ocean and ice" + Write(iulog,'(a)') " Required setup:" + Write(iulog,'(a)') " ALLDDVEL_GEOSCHEM == 0" + Write(iulog,'(a)') " OCNDDVEL_GEOSCHEM == 1" + Write(iulog,'(a)') " OCNDDVEL_MOZART == 0" + Write(iulog,'(a)') " + Let CLM compute dry deposition velocities over land and" + Write(iulog,'(a)') " compute velocities over ocean and ice in a similar way as" + Write(iulog,'(a)') " MOZART" + Write(iulog,'(a)') " Required setup:" + Write(iulog,'(a)') " ALLDDVEL_GEOSCHEM == 0" + Write(iulog,'(a)') " OCNDDVEL_GEOSCHEM == 0" + Write(iulog,'(a)') " OCNDDVEL_MOZART == 1" + Write(iulog,'(a)') REPEAT( "=", 79 ) + CALL ENDRUN('Incorrect definitions for dry deposition velocities') + ENDIF +#endif +#if ( ALLDDVEL_GEOSCHEM && ( LANDTYPE_HEMCO + LANDTYPE_CLM != 1 ) ) + IF (MasterProc) THEN + Write(iulog,'(/,a)') REPEAT( "=", 79 ) + Write(iulog,'(a)') REPEAT( "=", 79 ) + Write(iulog,'(a)') " Preprocessor flags are not set correctly in chemistry.F90" + Write(iulog,'(a)') " Dry-deposition velocities are computed by GEOS-Chem" + Write(iulog,'(a)') " The user needs to decide if land types should be from CLM or from HEMCO" + CALL ENDRUN('Incorrect definitions for source of land type data') + ENDIF +#endif + + ALLOCATE(drySpc_ndx(nddvels), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate drySpc_ndx') + + IF (MasterProc) THEN + + Write(iulog,'(/,a)') REPEAT( '=', 50 ) + Write(iulog,'(a)') REPEAT( '=', 50 ) + Write(iulog,'(a)') 'This is the GEOS-CHEM / CESM interface' + Write(iulog,'(a)') REPEAT( '=', 50 ) + Write(iulog,'(a)') ' + Routines written by Thibaud M. Fritz' + Write(iulog,'(a)') ' + Laboratory for Aviation and the Environment,' + Write(iulog,'(a)') ' + Department of Aeronautics and Astronautics,' + Write(iulog,'(a)') ' + Massachusetts Institute of Technology' + Write(iulog,'(a)') REPEAT( '=', 50 ) + + Write(iulog,'(/,/, a)') 'Now defining GEOS-Chem tracers and dry deposition mapping...' + + UNITN = GETUNIT() + + !============================================================== + ! Opening input.geos and go to ADVECTED SPECIES MENU + !============================================================== + + OPEN( UNITN, FILE=TRIM(inputGeosPath), STATUS='OLD', IOSTAT=IERR ) + IF (IERR .NE. 0) THEN + CALL ENDRUN('chem_readnl: ERROR opening input.geos') + ENDIF + + ! Go to ADVECTED SPECIES MENU + menuFound = .False. + DO WHILE ( .NOT. menuFound ) + READ( UNITN, '(a)', IOSTAT=IERR ) line + IF ( IERR .NE. 0 ) THEN + CALL ENDRUN('chem_readnl: ERROR finding advected species menu') + ELSEIF ( INDEX(line, 'ADVECTED SPECIES MENU') > 0 ) THEN + menuFound = .True. + ENDIF + ENDDO + + !============================================================== + ! Read list of GEOS-Chem tracers + !============================================================== + + DO + ! Read line + READ(UNITN,'(26x,a)', IOSTAT=IERR) line + + IF ( INDEX( TRIM(line), '---' ) > 0 ) EXIT + + nTracers = nTracers + 1 + tracerNames(nTracers) = TRIM(line) + + ENDDO + + CLOSE(UNITN) + CALL FREEUNIT(UNITN) + + ! Assign remaining tracers dummy names + DO I = (nTracers+1), nTracersMax + WRITE(tracerNames(I),'(a,I0.4)') 'GCTRC_', I + ENDDO + + !============================================================== + ! Now go through the KPP mechanism and add any species not + ! implemented by the tracer list in input.geos + !============================================================== + + IF ( nSpec > nSlsMax ) THEN + CALL ENDRUN('chem_readnl: too many species - increase nSlsmax') + ENDIF + + nSls = 0 + DO I = 1, nSpec + ! Get the name of the species from KPP + line = ADJUSTL(TRIM(Spc_Names(I))) + ! Only add this + validSLS = ( .NOT. ANY(TRIM(line) .EQ. tracerNames) ) + IF (validSLS) THEN + ! Genuine new short-lived species + nSls = nSls + 1 + slsNames(nSls) = TRIM(line) + ENDIF + ENDDO + + !============================================================== + ! Get mapping between dry deposition species and species set + !============================================================== + + DO N = 1, nddvels + + ! The species names need to be convert to upper case as, + ! for instance, BR2 != Br2 + drySpc_ndx(N) = get_spc_ndx( to_upper(drydep_list(N)) ) + + IF ( drySpc_ndx(N) < 0 ) THEN + Write(iulog,'(a,a)') ' ## Ignoring dry deposition of ', & + TRIM(drydep_list(N)) + nIgnored = nIgnored + 1 + ENDIF + ENDDO + + IF ( nIgnored > 0 ) THEN + Write(iulog,'(a,a)') ' The species listed above have dry', & + ' deposition turned off for one of the following reasons:' + Write(iulog,'(a)') ' - They are not present in the GEOS-Chem tracer list.' + Write(iulog,'(a)') ' - They have a synonym (e.g. CH2O and HCHO).' + ENDIF + + !============================================================== + ! Print summary + !============================================================== + + Write(iulog,'(/, a)') '### Summary of GEOS-Chem species: ' + Write(iulog,'( a)') REPEAT( '-', 50 ) + Write(iulog,'( a)') '+ List of advected species: ' + Write(iulog,100) 'ID', 'Tracer', 'Dry deposition (T/F)' + DO N = 1, nTracers + WRITE(iulog,110) N, TRIM(tracerNames(N)), any(drySpc_ndx .eq. N) + ENDDO + + Write(iulog,'(/, a)') '+ List of short-lived species: ' + DO N = 1, nSls + WRITE(iulog,120) N, TRIM(slsNames(N)) + ENDDO + + 100 FORMAT( 1x, A3, 3x, A10, 1x, A25 ) + 110 FORMAT( 1x, I3, 3x, A10, 1x, L15 ) + 120 FORMAT( 1x, I3, 3x, A10 ) + + !============================================================== + + ENDIF + + !================================================================== + ! Broadcast to all processors + !================================================================== + +#if defined( SPMD ) + CALL MPIBCAST(nTracers, 1, MPIINT, 0, MPICOM ) + CALL MPIBCAST(tracerNames, LEN(tracerNames(1))*nTracersMax, MPICHAR, 0, MPICOM ) + CALL MPIBCAST(nSls, 1, MPIINT, 0, MPICOM ) + CALL MPIBCAST(slsNames, LEN(slsNames(1))*nSlsMax, MPICHAR, 0, MPICOM ) + CALL MPIBCAST(drySpc_ndx, nddvels, MPIINT, 0, MPICOM ) + +#if ( OCNDDVEL_MOZART ) + !============================================================== + ! The following lines should only be called if we compute + ! velocities over the ocean and ice in a MOZART-like way. + ! Thibaud M. Fritz - 26 Feb 2020 + !============================================================== + + CALL MPIBCAST(MOZART_depvel_lnd_file, LEN(MOZART_depvel_lnd_file), MPICHAR, 0, MPICOM) + CALL MPIBCAST(MOZART_clim_soilw_file, LEN(MOZART_clim_soilw_file), MPICHAR, 0, MPICOM) + CALL MPIBCAST(MOZART_season_wes_file, LEN(MOZART_season_wes_file), MPICHAR, 0, MPICOM) +#endif + +#endif + + ! Update "short_lived_species" arrays - will eventually unify these + nSlvd = nSls + ALLOCATE(slvd_Lst(nSlvd), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating slvd_Lst') + ALLOCATE(slvd_ref_MMR(nSlvd), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating slvd_ref_MMR') + DO I = 1, nSls + slvd_Lst(I) = TRIM(slsNames(I)) + ENDDO + + end subroutine chem_readnl + +!================================================================================================ + + function chem_is_active() + !----------------------------------------------------------------------- + logical :: chem_is_active + !----------------------------------------------------------------------- + chem_is_active = .true. + + end function chem_is_active + +!================================================================================================ + + function chem_implements_cnst(name) + !----------------------------------------------------------------------- + ! + ! Purpose: return true if specified constituent is implemented by this package + ! + ! Author: B. Eaton + ! + !----------------------------------------------------------------------- + IMPLICIT NONE + !-----------------------------Arguments--------------------------------- + + CHARACTER(LEN=*), INTENT(IN) :: name ! constituent name + LOGICAL :: chem_implements_cnst ! return value + + INTEGER :: I + + chem_implements_cnst = .false. + + DO I = 1, nTracers + IF (TRIM(tracerNames(I)) .eq. TRIM(NAME)) THEN + chem_implements_cnst = .true. + EXIT + ENDIF + ENDDO + + IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_IMPLEMENTS_CNST' + + end function chem_implements_cnst + +!=============================================================================== + + subroutine chem_init(phys_state, pbuf2d) + !----------------------------------------------------------------------- + ! + ! Purpose: initialize GEOS-Chem parts (state objects, mainly) + ! (and declare history variables) + ! + !----------------------------------------------------------------------- + use physics_buffer, only: physics_buffer_desc, pbuf_get_index + use cam_history, only: addfld, add_default, horiz_only + use chem_mods, only: map2GC_dryDep, drySpc_ndx + + use mpishorthand + use cam_abortutils, only : endrun + + use Input_Opt_Mod + use State_Chm_Mod + use State_Grid_Mod + use State_Met_Mod + use DiagList_Mod, only : Init_DiagList, Print_DiagList + use GC_Environment_Mod + use GC_Grid_Mod, only : SetGridFromCtrEdges + + ! Use GEOS-Chem versions of physical constants + use PhysConstants, only : PI, PI_180 + use PhysConstants, only : Re + + use Phys_Grid, only : get_Area_All_p + use hycoef, only : ps0, hyai, hybi + + use Time_Mod, only : Accept_External_Date_Time + !use Time_Mod, only : Set_Begin_Time, Set_End_Time + !use Time_Mod, only : Set_Current_Time, Set_DiagB + !use Transfer_Mod, only : Init_Transfer + use Linoz_Mod, only : Linoz_Read + +#if ( OCNDDVEL_MOZART ) + use seq_drydep_mod, only: drydep_method, DD_XLND + use mo_drydep, only: drydep_inti +#endif + + use CMN_Size_Mod + + use Drydep_Mod, only : Init_Drydep, DepName, nDVZind + use Carbon_Mod, only : Init_Carbon + use Dust_Mod, only : Init_Dust + use Seasalt_Mod, only : Init_Seasalt + use Sulfate_Mod, only : Init_Sulfate + use Aerosol_Mod, only : Init_Aerosol + use WetScav_Mod, only : Init_WetScav + use TOMS_Mod, only : Init_TOMS + use Pressure_Mod, only : Init_Pressure, Accept_External_ApBp + use Chemistry_Mod, only : Init_Chemistry + use UCX_Mod, only : Init_UCX +#if ( ALLDDVEL_GEOSCHEM && LANDTYPE_HEMCO ) + use Olson_Landmap_Mod +#endif + use Mixing_Mod + + use PBL_Mix_Mod, only : Init_PBL_Mix + + use GC_Emissions_Mod, only : GC_Emissions_Init + + TYPE(physics_state), INTENT(IN):: phys_state(BEGCHUNK:ENDCHUNK) + TYPE(physics_buffer_desc), POINTER :: pbuf2d(:,:) + + ! Local variables + + !---------------------------- + ! Scalars + !---------------------------- + + ! Integers + INTEGER :: LCHNK(BEGCHUNK:ENDCHUNK), NCOL(BEGCHUNK:ENDCHUNK) + INTEGER :: IWAIT, IERR + INTEGER :: nX, nY, nZ + INTEGER :: iX, jY + INTEGER :: I, J, L, N + INTEGER :: RC + INTEGER :: NLINOZ + + ! Logicals + LOGICAL :: am_I_Root, rootChunk + LOGICAL :: prtDebug + + ! Strings + CHARACTER(LEN=255) :: historyConfigFile + CHARACTER(LEN=255) :: SpcName + + ! Grid setup + REAL(fp) :: lonVal, latVal + REAL(fp) :: dLonFix, dLatFix + REAL(f4), ALLOCATABLE :: lonMidArr(:,:), latMidArr(:,:) + REAL(f4), ALLOCATABLE :: lonEdgeArr(:,:), latEdgeArr(:,:) + REAL(r8), ALLOCATABLE :: linozData(:,:,:,:) + + REAL(r8), ALLOCATABLE :: Col_Area(:) + REAL(fp), ALLOCATABLE :: Ap_CAM_Flip(:), Bp_CAM_Flip(:) + + REAL(r8), POINTER :: SlsPtr(:,:,:) + + + ! Assume a successful return until otherwise + RC = GC_SUCCESS + + ! For error trapping + ErrMsg = '' + ThisLoc = ' -> at GEOS-Chem (in chemistry/pp_geoschem/chemistry.F90)' + + ! LCHNK: which chunks we have on this process + LCHNK = PHYS_STATE%LCHNK + ! NCOL: number of atmospheric columns for each chunk + NCOL = PHYS_STATE%NCOL + + write(iulog,'(2(a,x,I6,x))') 'chem_init called on PE ', myCPU, ' of ', nCPUs + + ! The GEOS-Chem grids on every "chunk" will all be the same size, to avoid + ! the possibility of having differently-sized chunks + nX = 1 + !nY = MAXVAL(NCOL) + nY = PCOLS + nZ = PVER + + !! Add short lived speies to buffers + !CALL Pbuf_add_field(Trim(SLSBuffer),'global',dtype_r8,(/PCOLS,PVER,nSls/),Sls_Pbf_Idx) + !! Initialize + !ALLOCATE(SlsPtr(PCOLS,PVER,BEGCHUNK:ENDCHUNK), STAT=IERR) + !IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating SlsPtr') + !SlsPtr(:,:,:) = 0.0e+0_r8 + !DO I=1,nSls + ! SlsPtr(:,:,:) = sls_ref_MMR(I) + ! CALL pbuf_set_field(pbuf2d,Sls_Pbf_Idx,SlsPtr,start=(/1,1,i/),kount=(/PCOLS,PVER,1/)) + !ENDDO + !DEALLOCATE(SlsPtr) + + ! This ensures that each process allocates everything needed for its chunks + ALLOCATE(State_Chm(BEGCHUNK:ENDCHUNK) , STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Chm') + ALLOCATE(State_Diag(BEGCHUNK:ENDCHUNK) , STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Diag') + ALLOCATE(State_Grid(BEGCHUNK:ENDCHUNK), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Grid') + ALLOCATE(State_Met(BEGCHUNK:ENDCHUNK) , STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Met') + + ! Initialize fields of the Input Options object + CALL Set_Input_Opt( am_I_Root = MasterProc, & + Input_Opt = Input_Opt, & + RC = RC ) + + ! Set some basic flags + Input_Opt%LUCX = .True. + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "Set_Input_Opt"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + DO I = BEGCHUNK, ENDCHUNK + + ! Only treat the first chunk as the "root" + am_I_Root = ((I.EQ.BEGCHUNK) .and. MasterProc) + + ! Initialize fields of the Grid State object + CALL Init_State_Grid( am_I_Root = am_I_Root, & + State_Grid = State_Grid(I), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "Init_State_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + State_Grid(I)%NX = nX + State_Grid(I)%NY = nY + State_Grid(I)%NZ = nZ + + ! Initialize GEOS-Chem horizontal grid structure + CALL GC_Init_Grid( am_I_Root = am_I_Root, & + Input_Opt = Input_Opt, & + State_Grid = State_Grid(I), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "GC_Init_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Define more variables for State_Grid + ! TMMF, might need tweaking + State_Grid(I)%MaxTropLev = MIN(40, nZ) + State_Grid(I)%MaxStratLev = MIN(59, nZ) + + ! Set maximum number of levels in the chemistry grid + IF ( Input_Opt%LUCX ) THEN + State_Grid(I)%MaxChemLev = State_Grid(I)%MaxStratLev + ELSE + State_Grid(I)%MaxChemLev = State_Grid(I)%MaxTropLev + ENDIF + + ENDDO + + ! Note - this is called AFTER chem_readnl, after X, and after + ! every constituent has had its initial conditions read. Any + ! constituent which is not found in the CAM restart file will + ! then have already had a call to chem_implements_cnst, and will + ! have then had a call to chem_init_cnst to set a default VMR + ! Call the routine GC_Allocate_All (located in module file + ! GeosCore/gc_environment_mod.F90) to allocate all lat/lon + ! allocatable arrays used by GEOS-Chem. + CALL GC_Allocate_All ( am_I_Root = MasterProc, & + Input_Opt = Input_Opt, & + State_Grid = State_Grid(BEGCHUNK), & + value_I_Lo = 1, & + value_J_Lo = 1, & + value_I_Hi = nX, & + value_J_Hi = nY, & + value_IM = nX, & + value_JM = nY, & + value_LM = nZ, & + value_IM_WORLD = nX, & + value_JM_WORLD = nY, & + value_LM_WORLD = nZ, & + value_LLSTRAT = 59, & !TMMF + RC = RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "GC_Allocate_All"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + Input_Opt%myCPU = myCPU + Input_Opt%rootCPU = MasterProc + + ! TODO: Mimic GEOS-Chem's reading of input options + !IF (MasterProc) THEN + ! CALL Read_Input_File( am_I_Root = .True., & + ! Input_Opt = Input_Opt(BEGCHUNK), & + ! srcFile = inputGeosPath, & + ! RC = RC ) + !ENDIF + !CALL + + ! For now just hard-code it + ! First setup directories + Input_Opt%Chem_Inputs_Dir = TRIM(chemInputsDir) + + ! Simulation menu + Input_Opt%NYMDb = 20000101 + Input_Opt%NHMSb = 000000 + Input_Opt%NYMDe = 20010101 + Input_Opt%NHMSe = 000000 + + ! Now READ_SIMULATION_MENU + Input_Opt%ITS_A_CH4_SIM = .False. + Input_Opt%ITS_A_CO2_SIM = .False. + Input_Opt%ITS_A_FULLCHEM_SIM = .True. + Input_Opt%ITS_A_MERCURY_SIM = .False. + Input_Opt%ITS_A_POPS_SIM = .False. + Input_Opt%ITS_A_RnPbBe_SIM = .False. + Input_Opt%ITS_A_TAGO3_SIM = .False. + Input_Opt%ITS_A_TAGCO_SIM = .False. + Input_Opt%ITS_AN_AEROSOL_SIM = .False. + + ! Now READ_ADVECTED_SPECIES_MENU + Input_Opt%N_Advect = nTracers + IF (Input_Opt%N_Advect.GT.Input_Opt%Max_AdvectSpc) THEN + CALL ENDRUN('Number of tracers exceeds max count') + ENDIF + ! Assign tracer names + DO J = 1, Input_Opt%N_Advect + Input_Opt%AdvectSpc_Name(J) = TRIM(tracerNames(J)) + ENDDO + ! No tagged species + Input_Opt%LSplit = .False. + + ! Now READ_TRANSPORT_MENU + Input_Opt%LTran = .True. + Input_Opt%LFill = .True. + Input_Opt%TPCore_IOrd = 3 + Input_Opt%TPCore_JOrd = 3 + Input_Opt%TPCore_KOrd = 3 + + ! Now READ_CONVECTION_MENU + ! For now, TMMF + Input_Opt%LConv = .False. + Input_Opt%LTurb = .True. + Input_Opt%LNLPBL = .True. + + ! Now READ_EMISSIONS_MENU + Input_Opt%LEmis = .False. + Input_Opt%HCOConfigFile = 'HEMCO_Config.rc' + Input_Opt%LFix_PBL_Bro = .False. + + ! Set surface VMRs - turn this off so that CAM can handle it + Input_Opt%LCH4Emis = .False. + Input_Opt%LCH4SBC = .False. + Input_Opt%LOCSEmis = .False. + Input_Opt%LCFCEmis = .False. + Input_Opt%LClEmis = .False. + Input_Opt%LBrEmis = .False. + Input_Opt%LN2OEmis = .False. + Input_Opt%LBasicEmis = .False. + + ! Set initial conditions + Input_Opt%LSetH2O = .True. + + ! CFC control + Input_Opt%CFCYear = 0 + + ! Now READ_AEROSOL_MENU + Input_Opt%LSulf = .True. + Input_Opt%LMetalcatSO2 = .True. + Input_Opt%LCarb = .True. + Input_Opt%LBrC = .False. + Input_Opt%LSOA = .True. + Input_Opt%LSVPOA = .False. + Input_Opt%LOMOC = .False. + Input_Opt%LDust = .True. + Input_Opt%LDstUp = .False. + Input_Opt%LSSalt = .True. + Input_Opt%SalA_rEdge_um(1) = 0.01e+0_fp + Input_Opt%SalA_rEdge_um(2) = 0.50e+0_fp + Input_Opt%SalC_rEdge_um(1) = 0.50e+0_fp + Input_Opt%SalC_rEdge_um(2) = 8.00e+0_fp + Input_Opt%LMPOA = .False. + ! For now, disable solid PSCs and strat aerosol settling + ! Our treatment of the stratosphere isn't really sophisticated + ! enough to warrant it yet + Input_Opt%LGravStrat = .False. + Input_Opt%LSolidPSC = .False. + Input_Opt%LHomNucNAT = .False. + Input_Opt%T_NAT_Supercool = 3.0e+0_fp + Input_Opt%P_Ice_Supersat = 1.2e+0_fp + Input_Opt%LPSCChem = .True. + Input_Opt%LStratOD = .True. + Input_Opt%hvAerNIT = .False. + Input_Opt%hvAerNIT_JNIT = .False. + Input_Opt%hvAerNIT_JNITs = .False. + Input_Opt%JNITChanA = 0e+0_fp + Input_Opt%JNITChanB = 0e+0_fp + + ! Now READ_DEPOSITION_MENU + Input_Opt%LDryD = .True. + !================================================================== + ! Add the following options: + ! + GEOS-Chem computes ALL dry-deposition velocities + ! + CLM computes land velocities. Velocities over ocean and ice are + ! computed in a MOZART-like way + ! + CLM computes land velocities. Velocities over ocean and ice are + ! computed from GEOS-Chem + ! + ! Note: What to do about aerosols? Who should compute the dry + ! deposition velocities + ! + ! Thibaud M. Fritz - 26 Feb 2020 + !================================================================== + Input_Opt%LWetD = .True. + Input_Opt%CO2_Effect = .False. + Input_Opt%CO2_Level = 390.0_fp + Input_Opt%CO2_Ref = 390.0_fp + + ! Now READ_CHEMISTRY_MENU + Input_Opt%LChem = .True. + Input_Opt%LSChem = .False. ! .True. !TMMF + Input_Opt%LLinoz = .True. + Input_Opt%LSynoz = .True. + Input_Opt%LUCX = .True. + Input_Opt%LActiveH2O = .True. + Input_Opt%Use_Online_O3 = .True. + ! Expect to get total overhead ozone, although it shouldn not + ! make too much of a difference since we want to use "full-UCX" + Input_Opt%Use_O3_from_Met = .True. + Input_Opt%Use_TOMS_O3 = .False. + Input_Opt%Gamma_HO2 = 0.2e+0_fp + + Input_Opt%LPRT = .False. + + ! Read in data for Linoz. All CPUs allocate one array to hold the data. Only + ! the root CPU reads in the data; then we copy it out to a temporary array, + ! broadcast to all other CPUs, and finally duplicate the data into every + ! copy of Input_Opt + IF ( Input_Opt%LLinoz ) THEN + ! Allocate array for broadcast + nLinoz = Input_Opt%Linoz_NLevels * & + Input_Opt%Linoz_NLat * & + Input_Opt%Linoz_NMonths * & + Input_Opt%Linoz_NFields + ALLOCATE( linozData( Input_Opt%Linoz_NLevels, & + Input_Opt%Linoz_NLat, & + Input_Opt%Linoz_NMonths, & + Input_Opt%Linoz_NFields ), STAT=IERR) + IF (IERR.NE.0) CALL ENDRUN('Failure while allocating linozData') + linozData = 0.0e+0_r8 + + IF ( MasterProc ) THEN + ! Read data in to Input_Opt%Linoz_TParm + CALL Linoz_Read( MasterProc, Input_Opt, RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Linoz_Read"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ! Copy the data to a temporary array + linozData = REAL(Input_Opt%LINOZ_TPARM,r8) + ENDIF +#if defined( SPMD ) + CALL MPIBCAST( linozData, nLinoz, MPIR8, 0, MPICOM ) +#endif + IF ( .NOT. MasterProc ) THEN + Input_Opt%LINOZ_TPARM = REAL(linozData,fp) + ENDIF + DEALLOCATE(linozData) + ENDIF + + + ! Note: The following calculations do not setup the gridcell areas. + ! In any case, we will need to be constantly updating this grid + ! to compensate for the "multiple chunks per processor" element + ALLOCATE(lonMidArr(nX,nY), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating lonMidArr') + ALLOCATE(lonEdgeArr(nX+1,nY+1), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating lonEdgeArr') + ALLOCATE(latMidArr(nX,nY), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating latMidArr') + ALLOCATE(latEdgeArr(nX+1,nY+1), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating latEdgeArr') + + ! We could try and get the data from CAM.. but the goal is to make this GC + ! component completely grid independent. So for now, we set to arbitrary + ! values + ! TODO: This needs more refinement. For now, this generates identical + ! State_Grid for all chunks + DO L = BEGCHUNK, ENDCHUNK + lonMidArr = 0.0e+0_f4 + latMidArr = 0.0e+0_f4 + dLonFix = 360.0e+0_fp / REAL(nX,fp) + dLatFix = 180.0e+0_fp / REAL(nY,fp) + DO I = 1, nX + ! Center of box, assuming dateline edge + lonVal = -180.0e+0_fp + (REAL(I-1,fp)*dLonFix) + DO J = 1, nY + ! Center of box, assuming regular cells + latVal = -90.0e+0_fp + (REAL(J-1,fp)*dLatFix) + lonMidArr(I,J) = REAL((lonVal + (0.5e+0_fp * dLonFix)) * PI_180, f4) + latMidArr(I,J) = REAL((latVal + (0.5e+0_fp * dLatFix)) * PI_180, f4) + + ! Edges of box, assuming regular cells + lonEdgeArr(I,J) = REAL(lonVal * PI_180, f4) + latEdgeArr(I,J) = REAL(latVal * PI_180, f4) + ENDDO + ! Edges of box, assuming regular cells + lonEdgeArr(I,nY+1) = REAL((lonVal + dLonFix) * PI_180, f4) + latEdgeArr(I,nY+1) = REAL((latVal + dLatFix) * PI_180, f4) + ENDDO + DO J = 1, nY+1 + ! Edges of box, assuming regular cells + latVal = -90.0e+0_fp + (REAL(J-1,fp)*dLatFix) + lonEdgeArr(nX+1,J) = REAL((lonVal + dLonFix) * PI_180, f4) + latEdgeArr(nX+1,J) = REAL((latVal) * PI_180, f4) + ENDDO + + CALL SetGridFromCtrEdges( am_I_Root = MasterProc, & + State_Grid = State_Grid(L), & + lonCtr = lonMidArr, & + latCtr = latMidArr, & + lonEdge = lonEdgeArr, & + latEdge = latEdgeArr, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "SetGridFromCtrEdges"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ENDDO + DEALLOCATE(lonMidArr) + DEALLOCATE(latMidArr) + DEALLOCATE(lonEdgeArr) + DEALLOCATE(latEdgeArr) + + + ! Set the times held by "time_mod" + CALL Accept_External_Date_Time( am_I_Root = MasterProc, & + value_NYMDb = Input_Opt%NYMDb, & + value_NHMSb = Input_Opt%NHMSb, & + value_NYMDe = Input_Opt%NYMDe, & + value_NHMSe = Input_Opt%NHMSe, & + value_NYMD = Input_Opt%NYMDb, & + value_NHMS = Input_Opt%NHMSb, & + RC = RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Accept_External_Date_Time"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Start by setting some dummy timesteps + CALL GC_Update_Timesteps(300.0E+0_r8) + + ! Initialize error module + CALL Init_Error( MasterProc, Input_Opt, RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Error"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Set a flag to denote if we should print ND70 debug output + prtDebug = ( Input_Opt%LPRT .and. MasterProc ) + + ! Debug output + IF ( prtDebug ) CALL Debug_Msg( '### MAIN: a READ_INPUT_FILE' ) + + historyConfigFile = 'HISTORY.rc' ! InputOpt not yet initialized + !TMMF need to pass input.geos path + !CALL Init_DiagList( MasterProc, historyConfigFile, Diag_List, RC ) + !IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Error encountered in "Init_DiagList"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + !ENDIF + + !!### Print diagnostic list if needed for debugging + !IF ( prtDebug ) CALL Print_DiagList( am_I_Root, Diag_List, RC ) + + DO I = BEGCHUNK, ENDCHUNK + am_I_Root = (MasterProc .AND. (I == BEGCHUNK)) + + CALL GC_Init_StateObj( am_I_Root = am_I_Root, & ! Root CPU (Y/N)? + & Diag_List = Diag_List, & ! Diagnostic list obj + & Input_Opt = Input_Opt, & ! Input Options + & State_Chm = State_Chm(I), & ! Chemistry State + & State_Diag = State_Diag(I), & ! Diagnostics State + & State_Grid = State_Grid(I), & ! Grid State + & State_Met = State_Met(I), & ! Meteorology State + & RC = RC ) ! Success or failure + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "GC_Init_StateObj"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Start with v/v dry (CAM standard) + State_Chm(I)%Spc_Units = 'v/v dry' + + ENDDO + + ! Now replicate GC_Init_Extra + IF ( Input_Opt%LDryD ) THEN + + ! Setup for dry deposition + CALL Init_Drydep( am_I_Root = MasterProc, & + & Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK), & + & RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Drydep"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + !============================================================== + ! Get mapping between CESM dry deposited species and the + ! indices of State_Chm%DryDepVel. This needs to be done after + ! Init_Drydep + ! Thibaud M. Fritz - 04 Mar 2020 + !============================================================== + + ALLOCATE(map2GC_dryDep(nddvels), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate map2GC_dryDep') + + DO N = 1, nddvels + + ! Initialize index to -1 + map2GC_dryDep(N) = -1 + + IF ( drySpc_ndx(N) > 0 ) THEN + + ! Convert to upper case + SpcName = to_upper(drydep_list(N)) + + DO I = 1, State_Chm(BEGCHUNK)%nDryDep + IF ( TRIM( SpcName ) == TRIM( to_upper(depName(I)) ) ) THEN + map2GC_dryDep(N) = nDVZind(I) + EXIT + ENDIF + ENDDO + + ENDIF + + ENDDO + +#if ( OCNDDVEL_MOZART ) + !============================================================== + ! The following line should only be called if we compute + ! velocities over the ocean and ice in a MOZART-like way. + ! Thibaud M. Fritz - 26 Feb 2020 + !============================================================== + + IF ( drydep_method == DD_XLND ) THEN + CALL drydep_inti( MOZART_depvel_lnd_file, & + MOZART_clim_soilw_file, & + MOZART_season_wes_file ) + ELSE + Write(iulog,'(a,a)') ' drydep_method is set to: ', TRIM(drydep_method) + CALL ENDRUN('drydep_method must be DD_XLND to compute dry deposition' // & + ' velocities similarly to MOZART over ocean and ice!') + ENDIF +#endif + + ENDIF + + !================================================================= + ! Call setup routines for wet deposition + ! + ! We need to initialize the wetdep module if either wet + ! deposition or convection is turned on, so that we can do the + ! large-scale and convective scavenging. Also initialize the + ! wetdep module if both wetdep and convection are turned off, + ! but chemistry is turned on. The INIT_WETSCAV routine will also + ! allocate the H2O2s and SO2s arrays that are referenced in the + ! convection code. (bmy, 9/23/15) + !================================================================= + IF ( Input_Opt%LConv .OR. & + Input_Opt%LWetD .OR. & + Input_Opt%LChem ) THEN + CALL Init_WetScav( am_I_Root = MasterProc, & + & Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK), & + & RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_WetScav"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + !----------------------------------------------------------------- + ! Call SET_VDIFF_VALUES so that we can pass several values from + ! Input_Opt to the vdiff_mod.F90. This replaces the functionality + ! of logical_mod.F and tracer_mod.F.. This has to be called + ! after the input.geos file has been read from disk. + !----------------------------------------------------------------- + !CALL Set_VDiff_Values( am_I_Root = MasterProc, & + !& Input_Opt = Input_Opt, & + !& State_Chm = State_Chm(BEGCHUNK), & + !& RC = RC ) + + !&IF (RC /= GC_SUCCESS) THEN + ! ErrMsg = 'Error encountered in "Set_VDiff_Values"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + !ENDIF + + !----------------------------------------------------------------- + ! Initialize the GET_NDEP_MOD for soil NOx deposition (bmy, 6/17/16) + !----------------------------------------------------------------- + !CALL Init_Get_NDep( am_I_Root = MasterProc, & + !& Input_Opt = Input_Opt, & + !& State_Chm = State_Chm(BEGCHUNK), & + !& State_Diag = State_Diag(BEGCHUNK), & + !& RC = RC ) + ! + !IF (RC /= GC_SUCCESS) THEN + ! ErrMsg = 'Error encountered in "Init_Get_NDep"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + !ENDIF + + !----------------------------------------------------------------- + ! Initialize "carbon_mod.F" + !----------------------------------------------------------------- + IF ( Input_Opt%LCarb ) THEN + CALL Init_Carbon( am_I_Root = MasterProc, & + & Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK), & + & RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Carbon"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + IF ( Input_Opt%LDust ) THEN + CALL Init_Dust( am_I_Root = MasterProc, & + & Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK), & + & RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Dust"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + IF ( Input_Opt%LSSalt ) THEN + CALL Init_Seasalt( am_I_Root = MasterProc, & + & Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK), & + & RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Seasalt"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + IF ( Input_Opt%LSulf ) THEN + CALL Init_Sulfate( am_I_Root = MasterProc, & + & Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK), & + & RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Sulfate"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + IF ( Input_Opt%LSulf .OR. & + Input_Opt%LCarb .OR. & + Input_Opt%LDust .OR. & + Input_Opt%LSSalt ) THEN + CALL Init_Aerosol( am_I_Root = MasterProc, & + & Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK), & + & RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Aerosol"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + IF ( Input_Opt%LChem ) THEN + CALL Init_Toms( am_I_Root = MasterProc, & + & Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK), & + & RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_TOMS"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + ! This is a bare subroutine - no module + CALL NDXX_Setup( MasterProc, & + & Input_Opt, & + & State_Chm(BEGCHUNK), & + & State_Grid(BEGCHUNK), & + & RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_NDXX_Setup"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Init_PBL_Mix( am_I_Root = MasterProc, & + State_Grid = State_Grid(BEGCHUNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_PBL_Mix"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Set grid-cell area + DO I = BEGCHUNK, ENDCHUNK + ALLOCATE(Col_Area(NCOL(I)), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating Col_Area') + + CALL Get_Area_All_p(I, NCOL(I), Col_Area) + + ! Set default value (in case of chunks with fewer columns) + State_Grid(I)%Area_M2 = 1.0e+10_fp + DO iX = 1, nX + DO jY = 1, NCOL(I) + State_Grid(I)%Area_M2(iX,jY) = REAL(Col_Area(jY) * Re**2,fp) + ENDDO + ENDDO + + DEALLOCATE(Col_Area) + + ! Copy to State_Met(I)%Area_M2 + State_Met(I)%Area_M2 = State_Grid(I)%Area_M2 + ENDDO + + + ! Initialize (mostly unused) diagnostic arrays + ! WARNING: This routine likely calls on modules which are currently + ! excluded from the GC-CESM build (eg diag03) + ! CALL Initialize( MasterProc, Input_Opt, 2, RC ) + ! CALL Initialize( Masterproc, Input_Opt, 3, RC ) + + ! Get Ap and Bp from CAM at pressure edges + ALLOCATE(Ap_CAM_Flip(nZ+1), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating Ap_CAM_Flip') + ALLOCATE(Bp_CAM_Flip(nZ+1), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating Bp_CAM_Flip') + + Ap_CAM_Flip = 0.0e+0_fp + Bp_CAM_Flip = 0.0e+0_fp + DO I = 1, (nZ+1) + Ap_CAM_Flip(I) = hyai(nZ+2-I) * ps0 * 0.01e+0_r8 + Bp_CAM_Flip(I) = hybi(nZ+2-I) + ENDDO + + !----------------------------------------------------------------- + ! Initialize the hybrid pressure module. Define Ap and Bp. + !----------------------------------------------------------------- + CALL Init_Pressure( am_I_Root = MasterProc, & ! Root CPU (Y/N)? + State_Grid = State_Grid(BEGCHUNK), & ! Grid State + RC = RC ) ! Success or failure + + ! Trapping errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Pressure"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + !----------------------------------------------------------------- + ! Pass external Ap and Bp to GEOS-Chem's Pressure_Mod + !----------------------------------------------------------------- + CALL Accept_External_ApBp( am_I_Root = MasterProc, & ! Root CPU (Y/N)? + State_Grid = State_Grid(BEGCHUNK), & ! Grid State + ApIn = Ap_CAM_Flip, & ! "A" term for hybrid grid + BpIn = Bp_CAM_Flip, & ! "B" term for hybrid grid + RC = RC ) ! Success or failure + + ! Print vertical coordinates + IF ( MasterProc ) THEN + WRITE( 6, '(a)' ) REPEAT( '=', 79 ) + WRITE( 6, '(a,/)' ) 'V E R T I C A L G R I D S E T U P' + WRITE( 6, '( ''Ap '', /, 6(f11.6,1x) )' ) Ap_CAM_Flip(1:State_Grid(BEGCHUNK)%NZ+1) + WRITE( 6, '(a)' ) + WRITE( 6, '( ''Bp '', /, 6(f11.6,1x) )' ) Bp_CAM_Flip(1:State_Grid(BEGCHUNK)%NZ+1) + WRITE( 6, '(a)' ) REPEAT( '=', 79 ) + ENDIF + + ! Trapping errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Accept_External_ApBp"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + DEALLOCATE(Ap_CAM_Flip,Bp_CAM_Flip) + + !! Initialize HEMCO? + !CALL Emissions_Init ( am_I_Root = MasterProc, & + ! Input_Opt = Input_Opt, & + ! State_Met = State_Met, & + ! State_Chm = State_Chm, & + ! State_Grid = State_Grid, & + ! State_Met = State_Met, & + ! RC = RC, & + ! HcoConfig = HcoConfig ) + ! + !IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Error encountered in "Emissions_Init"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + !ENDIF + ! + +#if ( ALLDDVEL_GEOSCHEM && LANDTYPE_HEMCO ) + ! Populate the State_Met%LandTypeFrac field with data from HEMCO + CALL Init_LandTypeFrac( am_I_Root = MasterProc, & + Input_Opt = Input_Opt, & + State_Met = State_Met(BEGCHUNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_LandTypeFrac"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Compute the Olson landmap fields of State_Met + ! (e.g. State_Met%IREG, State_Met%ILAND, etc.) + CALL Compute_Olson_Landmap( am_I_Root = MasterProc, & + Input_Opt = Input_Opt, & + State_Grid = State_Grid(BEGCHUNK), & + State_Met = State_Met(BEGCHUNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Compute_Olson_Landmap"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF +#endif + + ! Initialize PBL quantities but do not do mixing + ! Add option for non-local PBL (Lin, 03/31/09) + CALL Init_Mixing ( am_I_Root = MasterProc, & + Input_Opt = Input_Opt, & + State_Chm = State_Chm(BEGCHUNK), & + State_Diag = State_Diag(BEGCHUNK), & + State_Grid = State_Grid(BEGCHUNK), & + State_Met = State_Met(BEGCHUNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in Init_Mixing!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + IF ( Input_Opt%Its_A_FullChem_Sim .OR. & + Input_Opt%Its_An_Aerosol_Sim ) THEN + ! This also initializes Fast-JX + CALL Init_Chemistry( am_I_Root = MasterProc, & + & Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK), & + & RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Chemistry"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + IF ( Input_Opt%LChem .AND. & + Input_Opt%LUCX ) THEN + CALL Init_UCX( am_I_Root = MasterProc, & + & Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK) ) + ENDIF + + ! Get the index of H2O + iH2O = Ind_('H2O') + iO3 = Ind_('O3') + iCH4 = Ind_('CH4') + iCO = Ind_('CO') + iNO = Ind_('NO') + + ! Get indices for physical fields in physics buffer + NDX_PBLH = Pbuf_Get_Index('pblh' ) + NDX_FSDS = Pbuf_Get_Index('FSDS' ) + NDX_CLDTOP = Pbuf_Get_Index('CLDTOP' ) + NDX_CLDFRC = Pbuf_Get_Index('CLD' ) + NDX_PRAIN = Pbuf_Get_Index('PRAIN' ) + NDX_NEVAPR = Pbuf_Get_Index('NEVAPR' ) + NDX_RPRDTOT = Pbuf_Get_Index('RPRDTOT' ) + NDX_LSFLXPRC = Pbuf_Get_Index('LS_FLXPRC') + NDX_LSFLXSNW = Pbuf_Get_Index('LS_FLXSNW') + + ! Get cloud water indices + CALL Cnst_Get_Ind('CLDLIQ', ixCldLiq) + CALL Cnst_Get_Ind('CLDICE', ixCldIce) + + ! Can add history output here too with the "addfld" & "add_default" routines + ! Note that constituents are already output by default + ! Add all species as output fields if desired + DO I = 1, nTracers + SpcName = TRIM(tracerNames(I)) + CALL AddFld( TRIM(SpcName), (/ 'lev' /), 'A', 'mol/mol', TRIM(tracerLongNames(I))//' concentration') + IF (TRIM(SpcName) == 'O3') THEN + CALL Add_Default ( TRIM(SpcName), 1, ' ') + ENDIF + ENDDO + DO I =1, nSls + SpcName = TRIM(slsNames(I)) + CALL AddFld( TRIM(SpcName), (/ 'lev' /), 'A', 'mol/mol', TRIM(slsLongNames(I))//' concentration') + !CALL Add_Default(TRIM(SpcName), 1, '') + ENDDO + + ! Initialize emissions interface (this will eventually handle HEMCO) + CALL GC_Emissions_Init + + !CALL AddFld ( 'BCPI', (/'lev'/), 'A', 'mole/mole', trim('BCPI')//' mixing ratio' ) + !CALL Add_Default ( 'BCPI', 1, ' ') + +#if defined( CLM40 ) + SpcName = 'lu_soil' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_landice' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_deeplake' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_shallowlake' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_wetland' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_urban' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_icemec' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_crop' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') +#elif defined( CLM45 ) || defined( CLM50 ) + SpcName = 'lu_soil' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_crop' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_landice' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_deeplake' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_wetland' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'lu_urban' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') +#endif + SpcName = 'p_notveg' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_needle_eg_temp' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_needle_eg_bor' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_needle_dd_bor' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_broad_eg_trop' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_broad_eg_temp' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_broad_dd_trop' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_broad_dd_temp' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_broad_dd_bor' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_broad_eg_sh' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_broad_dd_temp_sh' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_broad_dd_bor_sh' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_c3_arctic_grass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_c3_narctic_grass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_c4_grass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_c3_crop' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_c3_irrigated' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') +#if defined( CLM40 ) + SpcName = 'p_c3_corn' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_spring_cereal' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_winter_cereal' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_soybean' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') +#elif defined( CLM45 ) || defined( CLM50 ) + SpcName = 'p_temp_corn' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_temp_corn' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_spring_wheat' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_spring_wheat' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_winter_wheat' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_winter_wheat' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_temp_soybean' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_temp_soybean' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_barley' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_barley' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_winter_barley' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_winter_barley' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_rye' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_rye' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_winter_rye' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_winter_rye' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_cassava' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_cassava' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_citrus' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_citrus' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_cocoa' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_cocoa' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_coffee' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_coffee' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_cotton' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_cotton' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_datepalm' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_datepalm' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_foddergrass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_foddergrass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_grapes' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_grapes' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_groundnuts' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_groundnuts' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_millet' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_millet' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_oilpalm' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_oilpalm' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_potatoes' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_potatoes' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_pulses' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_pulses' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_rapeseed' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_rapessed' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_rice' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_rice' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_sorghum' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_sorghum' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_sugarbeet' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_sugarbeet' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_sugarcane' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_sugarcane' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_sunflower' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_sunflower' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_miscanthus' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_miscanthus' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_switchgrass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_switchgrass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_trop_corn' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_trop_corn' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_trop_soybean' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'p_irr_trop_soybean' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') +#endif + SpcName = 'pla_notveg' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_needle_eg_temp' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_needle_eg_bor' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_needle_dd_bor' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_broad_eg_trop' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_broad_eg_temp' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_broad_dd_trop' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_broad_dd_temp' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_broad_dd_bor' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_broad_eg_sh' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_broad_dd_temp_sh' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_broad_dd_bor_sh' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_c3_arctic_grass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_c3_narctic_grass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_c4_grass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_c3_crop' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_c3_irrigated' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') +#if defined( CLM40 ) + SpcName = 'pla_c3_corn' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_spring_cereal' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_winter_cereal' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_soybean' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') +#elif defined( CLM45 ) || defined( CLM50 ) + SpcName = 'pla_temp_corn' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_temp_corn' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_spring_wheat' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_spring_wheat' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_winter_wheat' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_winter_wheat' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_temp_soybean' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_temp_soybean' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_barley' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_barley' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_winter_barley' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_winter_barley' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_rye' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_rye' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_winter_rye' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_winter_rye' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_cassava' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_cassava' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_citrus' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_citrus' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_cocoa' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_cocoa' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_coffee' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_coffee' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_cotton' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_cotton' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_datepalm' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_datepalm' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_foddergrass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_foddergrass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_grapes' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_grapes' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_groundnuts' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_groundnuts' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_millet' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_millet' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_oilpalm' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_oilpalm' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_potatoes' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_potatoes' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_pulses' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_pulses' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_rapeseed' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_rapessed' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_rice' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_rice' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_sorghum' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_sorghum' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_sugarbeet' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_sugarbeet' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_sugarcane' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_sugarcane' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_sunflower' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_sunflower' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_miscanthus' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_miscanthus' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_switchgrass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_switchgrass' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_trop_corn' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_trop_corn' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_trop_soybean' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') + SpcName = 'pla_irr_trop_soybean' + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') +#endif + + IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_INIT' + + end subroutine chem_init + +!=============================================================================== + + subroutine chem_timestep_init(phys_state, pbuf2d) + use physics_buffer, only: physics_buffer_desc + + TYPE(physics_state), INTENT(IN):: phys_state(begchunk:endchunk) + TYPE(physics_buffer_desc), POINTER :: pbuf2d(:,:) + + ! Not sure what we would realistically do here rather than in tend + + end subroutine chem_timestep_init + +!=============================================================================== + + subroutine GC_Update_Timesteps(DT) + + use Time_Mod, only : Set_Timesteps + + REAL(r8), INTENT(IN) :: DT + INTEGER :: DT_MIN + INTEGER, SAVE :: DT_MIN_LAST = -1 + + DT_MIN = NINT(DT) + + Input_Opt%TS_CHEM = DT_MIN + Input_Opt%TS_EMIS = DT_MIN + Input_Opt%TS_CONV = DT_MIN + Input_Opt%TS_DYN = DT_MIN + Input_Opt%TS_RAD = DT_MIN + + ! Only bother updating the module information if there's been a change + IF (DT_MIN .NE. DT_MIN_LAST) THEN + IF (MasterProc) WRITE(iulog,'(a,F7.1,a)') ' --> GC: updating dt to ', DT, ' seconds' + + CALL Set_Timesteps( MasterProc, & + CHEMISTRY = DT_MIN, & + EMISSION = DT_MIN, & + DYNAMICS = DT_MIN, & + UNIT_CONV = DT_MIN, & + CONVECTION = DT_MIN, & + DIAGNOS = DT_MIN, & + RADIATION = DT_MIN ) + DT_MIN_LAST = DT_MIN + ENDIF + + end subroutine + +!=============================================================================== + + subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) + + use physics_buffer, only: physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx + use cam_history, only: outfld + use camsrfexch, only: cam_in_t, cam_out_t + + use phys_grid, only: get_ncols_p, get_rlat_all_p, get_rlon_all_p + + use chem_mods, only: drySpc_ndx, map2GC_dryDep +#if ( LANDTYPE_CLM ) + use Olson_Landmap_Mod, only: Compute_Olson_Landmap + use Modis_LAI_Mod, only: Compute_XLAI +#endif +#if ( ALLDDVEL_GEOSCHEM || OCNDDVEL_GEOSCHEM ) + use Drydep_Mod, only: Do_Drydep +#elif ( OCNDDVEL_MOZART ) + use mo_drydep, only: drydep_update, drydep_fromlnd +#endif + use Drydep_Mod, only: DEPNAME !TMMF, this is just needed for debug + use Drydep_Mod, only: Update_DryDepSav + use Mixing_Mod + + use Dao_Mod, only: Set_Dry_Surface_Pressure + use Dao_Mod, only: AirQnt + use GC_Grid_Mod, only: SetGridFromCtr + use Pressure_Mod, only: Set_Floating_Pressures + use Pressure_Mod, only: Accept_External_Pedge + use Time_Mod, only: Accept_External_Date_Time + use Strat_chem_Mod, only: Init_Strat_Chem + use Toms_Mod, only: Compute_Overhead_O3 + use Chemistry_Mod, only: Do_Chemistry + use Wetscav_Mod, only: Setup_Wetscav, Do_WetDep + use CMN_Size_Mod, only: PTop + use PBL_Mix_Mod, only: Compute_PBL_Height + + use Tropopause, only: Tropopause_findChemTrop, Tropopause_Find + + ! For calculating SZA + use Orbit, only: zenith + use Time_Manager, only: Get_Curr_Calday, Get_Curr_Date + + ! Calculating relative humidity + use WV_Saturation, only: QSat + use PhysConst, only: MWDry + + ! Grid area + use PhysConst, only: Gravit + use PhysConstants, only: Re + use Phys_Grid, only: get_area_all_p, get_lat_all_p, get_lon_all_p + + use Short_Lived_Species, only : Get_Short_Lived_Species + use Short_Lived_Species, only : Set_Short_Lived_Species + + ! Use GEOS-Chem versions of physical constants + use PhysConstants, only: PI, PI_180, g0 + + REAL(r8), INTENT(IN) :: dT ! Time step + TYPE(physics_state), INTENT(IN) :: State ! Physics State variables + TYPE(physics_ptend), INTENT(OUT) :: ptend ! indivdual parameterization tendencies + TYPE(cam_in_t), INTENT(INOUT) :: cam_in + TYPE(cam_out_t), INTENT(IN) :: cam_out + TYPE(physics_buffer_desc), POINTER :: pbuf(:) + REAL(r8), OPTIONAL, INTENT(OUT) :: fh2o(PCOLS) ! h2o flux to balance source from chemistry + + ! Initial MMR for all species + REAL(r8) :: MMR_Beg(PCOLS,PVER,nSls+nTracers) + REAL(r8) :: MMR_End(PCOLS,PVER,nSls+nTracers) + REAL(r8) :: MMR_TEnd(PCOLS,PVER,nSls+nTracers) + + + ! Mapping (?) + LOGICAL :: lq(pcnst) + + ! Indexing + INTEGER :: I, J, K, L, N, M + INTEGER :: nX, nY, nZ + + INTEGER :: LCHNK, NCOL + + REAL(r8), DIMENSION(State%NCOL) :: & + CSZA, & ! Cosine of solar zenith angle + Zsurf, & ! Surface height + Rlats, Rlons ! Chunk latitudes and longitudes (radians) + + REAL(r8), POINTER :: PblH(:) ! PBL height on each chunk [m] + REAL(r8), POINTER :: cldTop(:) ! Cloud top height [?] + REAL(r8), POINTER :: cldFrc(:,:) ! Cloud fraction [-] + REAL(r8), POINTER :: Fsds(:) ! Downward shortwave flux at surface [W/m2] + REAL(r8), POINTER :: PRain(:,:) ! Total stratiform precip. prod. (rain + snow) [kg/kg/s] + REAL(r8), POINTER :: RprdTot(:,:) ! Total convective precip. prod. (rain + snow) [kg/kg/s] + REAL(r8), POINTER :: NEvapr(:,:) ! Evaporation of total precipitation (rain + snow) [kg/kg/s] + REAL(r8), POINTER :: LsFlxPrc(:,:) ! Large-scale downward precip. flux at interface (rain + snow) [kg/m2/s] + REAL(r8), POINTER :: LsFlxSnw(:,:) ! Large-scale downward precip. flux at interface (snow only) [kg/m2/s] + + REAL(r8) :: RelHum(State%NCOL, PVER) ! Relative humidity [0-1] + REAL(r8) :: SatV (State%NCOL, PVER) ! Work arrays + REAL(r8) :: SatQ (State%NCOL, PVER) ! Work arrays + REAL(r8) :: qH2O (State%NCOL, PVER) ! Specific humidity [kg/kg] + REAL(r8) :: H2OVMR(State%NCOL, PVER) ! H2O volume mixing ratio +#if ( OCNDDVEL_MOZART ) + REAL(r8) :: windSpeed(State%NCOL) ! Wind speed at ground level [m/s] + REAL(r8) :: potT(State%NCOL) ! Potential temperature [K] + + INTEGER :: latndx(PCOLS) + INTEGER :: lonndx(PCOLS) + + ! For MOZART's dry deposition over ocean and ice + ! Deposition velocity (cm/s) + REAL(r8) :: MOZART_depVel(State%NCOL, nTracersMax) + ! Deposition flux (/cm^2/s) + REAL(r8) :: MOZART_depFlx(State%NCOL, nTracersMax) +#endif + REAL(r8), PARAMETER :: zlnd = 0.01_r8 ! Roughness length for soil [m] + REAL(r8), PARAMETER :: zslnd = 0.0024_r8 ! Roughness length for snow [m] + REAL(r8), PARAMETER :: zsice = 0.0400_r8 ! Roughness length for sea ice [m] + REAL(r8), PARAMETER :: zocn = 0.0001_r8 ! Roughness length for oean [m] + + ! Because of strat chem + LOGICAL, SAVE :: SCHEM_READY = .FALSE. + + REAL(f4) :: lonMidArr(1,PCOLS), latMidArr(1,PCOLS) + INTEGER :: iMaxLoc(1) + + REAL(r8) :: Col_Area(State%NCOL) + + ! Intermediate arrays + INTEGER :: Trop_Lev (PCOLS) + REAL(r8) :: Trop_P (PCOLS) + REAL(r8) :: Trop_T (PCOLS) + REAL(r8) :: Trop_Ht (PCOLS) + REAL(r8) :: SnowDepth(PCOLS) + REAL(r8) :: cld2D (PCOLS) + REAL(r8) :: Z0 (PCOLS) + REAL(r8) :: Sd_Ice, Sd_Lnd, Sd_Avg, Frc_Ice + + ! Estimating cloud optical depth + REAL(r8) :: cld(PCOLS,PVER) + REAL(r8) :: TauCli(PCOLS,PVER) + REAL(r8) :: TauClw(PCOLS,PVER) + REAL(r8), PARAMETER :: re_m = 1.0e-05_r8 ! Cloud drop radius in m + REAL(r8), PARAMETER :: cldMin = 1.0e-02_r8 ! Minimum cloud cover + REAL(r8), PARAMETER :: cnst = 1.5e+00_r8 / (re_m * 1.0e+03_r8 * g0) + + ! Calculating SZA + REAL(r8) :: Calday + + ! For archiving + CHARACTER(LEN=255) :: SpcName + REAL(r8) :: VMR(State%NCOL,PVER) + + REAL(r8) :: SlsData(State%NCOL, PVER, nSls) + + INTEGER :: currYr, currMo, currDy, currTOD + INTEGER :: currYMD, currHMS, currHr, currMn, currSc + REAL(f4) :: currUTC + LOGICAL :: firstDay = .True. + LOGICAL :: newDay = .False. + LOGICAL :: newMonth = .False. + + INTEGER :: TIM_NDX + + INTEGER, SAVE :: iStep = 0 + LOGICAL :: rootChunk + INTEGER :: RC + + ! LCHNK: which chunk we have on this process + LCHNK = State%LCHNK + ! NCOL: number of atmospheric columns on this chunk + NCOL = State%NCOL + + ! Am I the first chunk on the first CPU? + rootChunk = ( MasterProc.and.(LCHNK==BEGCHUNK) ) + + ! Count the number of steps which have passed + IF (LCHNK.EQ.BEGCHUNK) iStep = iStep + 1 + + ! Need to update the timesteps throughout the code + CALL GC_Update_Timesteps(dT) + + + ! For safety's sake + PTop = State%Pint(1,1)*0.01e+0_fp + + ! Need to be super careful that the module arrays are updated and correctly + ! set. NOTE: First thing - you'll need to flip all the data vertically + + nX = 1 + nY = NCOL + nZ = PVER + + ! Update the grid lat/lons since they are module variables + ! Assume (!) that area hasn't changed for now, as GEOS-Chem will + ! retrieve this from State_Met which is chunked + !CALL get_rlat_all_p( LCHNK, NCOL, Rlats ) + !CALL get_rlon_all_p( LCHNK, NCOL, Rlons ) + Rlats(1:nY) = State%Lat(1:nY) + Rlons(1:nY) = State%Lon(1:nY) + + lonMidArr = 0.0e+0_f4 + latMidArr = 0.0e+0_f4 + DO I = 1, nX + DO J = 1, nY + lonMidArr(I,J) = REAL(Rlons(J), f4) + latMidArr(I,J) = REAL(Rlats(J), f4) + ENDDO + ENDDO + + ! Update the grid + Call SetGridFromCtr( am_I_Root = rootChunk, & + State_Grid = State_Grid(LCHNK), & + lonCtr = lonMidArr, & + latCtr = latMidArr, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "SetGridFromCtr"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Set area + CALL Get_Area_All_p( LCHNK, nY, Col_Area ) + + ! Field : AREA_M2 + ! Description: Grid box surface area + ! Unit : - + ! Dimensions : nX, nY + ! Note : Set default value (in case of chunks with fewer columns) + State_Grid(LCHNK)%Area_M2 = 1.0e+10_fp + DO J = 1, nY + State_Grid(LCHNK)%Area_M2(1,J) = REAL(Col_Area(J) * Re**2,fp) + ENDDO + State_Met(LCHNK)%Area_M2 = State_Grid(LCHNK)%Area_M2 + + ! 2. Copy tracers into State_Chm + ! Data was received in kg/kg dry + State_Chm(LCHNK)%Spc_Units = 'kg/kg dry' + ! Initialize ALL State_Chm species data to zero, not just tracers + State_Chm(LCHNK)%Species = 0.0e+0_fp + + lq(:) = .FALSE. + + MMR_Beg = 0.0e+0_r8 + DO N = 1, pcnst + M = map2GC(N) + IF (M > 0) THEN + I = 1 + DO J = 1, nY + DO K = 1, nZ + ! CURRENTLY KG/KG DRY + MMR_Beg(J,K,M) = State%q(J,nZ+1-K,N) + State_Chm(LCHNK)%Species(1,J,K,M) = REAL(MMR_Beg(J,K,M),fp) + ENDDO + ENDDO + lq(N) = .TRUE. + ENDIF + ENDDO + + ! Retrieve previous value of species data + SlsData(:,:,:) = 0.0e+0_r8 + CALL Get_Short_Lived_Species( SlsData, LCHNK, nY, Pbuf ) + + ! Remap and flip them + DO N = 1, nSls + M = map2GC_Sls(N) + IF (M > 0) THEN + DO J = 1, nY + DO K = 1, nZ + State_Chm(LCHNK)%Species(1,J,K,M) = REAL(SlsData(J,nZ+1-K,N),fp) + ENDDO + ENDDO + ENDIF + ENDDO + + ! Initialize tendency array + CALL Physics_ptend_init(ptend, State%psetcols, 'chemistry', lq=lq) + + ! Calculate COS(SZA) + Calday = Get_Curr_Calday( ) + CALL Zenith( Calday, Rlats, Rlons, CSZA, nY ) + + ! Get all required data from physics buffer + TIM_NDX = Pbuf_Old_Tim_Idx() + CALL Pbuf_Get_Field( Pbuf, NDX_PBLH, PblH ) + CALL Pbuf_Get_Field( Pbuf, NDX_FSDS, Fsds ) + CALL Pbuf_Get_Field( Pbuf, NDX_CLDTOP, cldTop ) + CALL Pbuf_Get_Field( Pbuf, NDX_CLDFRC, cldFrc, START=(/1,1,TIM_NDX/), KOUNT=(/NCOL,PVER,1/) ) + CALL Pbuf_Get_Field( Pbuf, NDX_NEVAPR, NEvapr, START=(/1,1/), KOUNT=(/NCOL,PVER/)) + CALL Pbuf_Get_Field( Pbuf, NDX_PRAIN, PRain, START=(/1,1/), KOUNT=(/NCOL,PVER/)) + CALL Pbuf_Get_Field( Pbuf, NDX_RPRDTOT, RprdTot, START=(/1,1/), KOUNT=(/NCOL,PVER/)) + CALL Pbuf_Get_Field( Pbuf, NDX_LSFLXPRC, LsFlxPrc, START=(/1,1/), KOUNT=(/NCOL,PVERP/)) + CALL Pbuf_Get_Field( Pbuf, NDX_LSFLXSNW, LsFlxSnw, START=(/1,1/), KOUNT=(/NCOL,PVERP/)) + + ! Get VMR and MMR of H2O + H2OVMR = 0.0e0_fp + qH2O = 0.0e0_fp + ! Note MWDRY = 28.966 g/mol + DO J = 1, nY + DO L = 1, nZ + qH2O(J,L) = REAL(State_Chm(LCHNK)%Species(1,J,L,iH2O),r8) + H2OVMR(J,L) = qH2O(J,L) * MWDry / 18.016e+0_fp + ENDDO + ENDDO + + ! Calculate RH (range 0-1, note still level 1 = TOA) + relHum(:,:) = 0.0e+0_r8 + CALL QSat(State%T(:nY,:), State%Pmid(:nY,:), SatV, SatQ) + DO J = 1, nY + DO L = 1, nZ + relHum(J,L) = 0.622e+0_r8 * H2OVMR(J,L) / SatQ(J,L) + relHum(J,L) = MAX( 0.0e+0_r8, MIN( 1.0e+0_r8, relHum(J,L) ) ) + ENDDO + ENDDO + + Z0 = 0.0e+0_r8 + DO J = 1, nY + Z0(J) = cam_in%landFrac(J) * zlnd & + + cam_in%iceFrac(J) * zsice & + + cam_in%ocnFrac(J) * zocn + IF (( cam_in%snowhLand(J) > 0.01_r8 ) .OR. & + ( cam_in%snowhIce(J) > 0.01_r8 )) THEN + ! Land is covered in snow + Z0(J) = zslnd + ENDIF + ENDDO + + ! Estimate cloud liquid water content and OD + TauCli = 0.0e+0_r8 + TauClw = 0.0e+0_r8 + + ! Note: all using CAM vertical convention (1 = TOA) + ! Calculation is based on that done for MOZART + DO J = 1, nY + DO L = nZ, 1, -1 + ! Convert water mixing ratio [kg/kg] to water content [g/m^3] + IF ( ( State%Q(J,L,ixCldLiq) + State%Q(J,L,ixCldIce) ) * & + State%PMid(J,L) / (State%T(J,L) * 287.0e+00_r8) * 1.0e+03_r8 <= 0.01_r8 .AND. & + cldFrc(J,L) /= 0.0e+00_r8 ) THEN + cld(J,L) = 0.0e+00_r8 + ELSE + cld(J,L) = cldFrc(J,L) + ENDIF + ENDDO + ENDDO + + DO J = 1, nY + IF ( COUNT( cld(J,:nZ) > cldMin ) > 0 ) THEN + DO L = nZ, 1, -1 + ! ================================================================= + ! =========== Compute cloud optical depth based on ============ + ! =========== Liao et al. JGR, 104, 23697, 1999 ============ + ! ================================================================= + ! + ! Tau = 3/2 * LWC * dZ / ( \rho_w * r_e ) + ! dZ = - dP / ( \rho_air * g ) + ! since Pint is ascending, we can neglect the minus sign + ! + ! Tau = 3/2 * LWC * dP / ( \rho_air * r_e * \rho_w * g ) + ! LWC / \rho_air = Q + ! + ! Tau = 3/2 * Q * dP / ( r_e * rho_w * g ) + ! Tau(K) = 3/2 * Q(K) * (Pint(K+1) - Pint(K)) / (re * rho_w * g ) + ! Tau(K) = Q(K) * (Pint(K+1) - Pint(K)) * Cnst + ! + ! Unit check: | + ! Q : [kg H2O/kg air] | + ! Pint : [Pa]=[kg air/m/s^2] | + ! re : [m] | = 1.0e-5 + ! rho_w: [kg H2O/m^3] | = 1.0e+3 + ! g : [m/s^2] | = 9.81 + ! + TauClw(J,L) = State%Q(J,L,ixCldLiq) & + * (State%Pint(J,L+1)-State%Pint(J,L)) & + * cnst + TauClw(J,L) = MAX(TauClw(J,L), 0.0e+00_r8) + TauCli(J,L) = State%Q(J,L,ixCldIce) & + * (State%Pint(J,L+1)-State%Pint(J,L)) & + * cnst + TauCli(J,L) = MAX(TauCli(J,L), 0.0e+00_r8) + + ENDDO + ENDIF + ENDDO + + ! Retrieve tropopause level + Trop_Lev = 0.0e+0_r8 + CALL Tropopause_FindChemTrop(State, Trop_Lev) + ! Back out the pressure + Trop_P = 1000.0e+0_r8 + DO J = 1, nY + Trop_P(J) = State%PMid(J,Trop_Lev(J)) * 0.01e+0_r8 + ENDDO + + ! Calculate snow depth + snowDepth = 0.0e+0_r8 + DO J = 1, nY + Sd_Ice = MAX(0.0e+0_r8,cam_in%snowhIce(J)) + Sd_Lnd = MAX(0.0e+0_r8,cam_in%snowhLand(J)) + Frc_Ice = MAX(0.0e+0_r8,cam_in%iceFrac(J)) + IF (Frc_Ice > 0.0e+0_r8) THEN + Sd_Avg = (Sd_Lnd*(1.0e+0_r8 - Frc_Ice)) + (Sd_Ice * Frc_Ice) + ELSE + Sd_Avg = Sd_Lnd + ENDIF + snowDepth(J) = Sd_Avg + ENDDO + + ! Field : ALBD + ! Description: Visible surface albedo + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%ALBD (1,:) = cam_in%Asdir(:) + + ! Field : CLDFRC + ! Description: Column cloud fraction + ! Unit : - + ! Dimensions : nX, nY + ! Note : Estimate column cloud fraction as the maximum cloud + ! fraction in the column (pessimistic assumption) + DO J = 1, nY + State_Met(LCHNK)%CLDFRC(1,J) = MAXVAL(cldFrc(J,:)) + ENDDO + + ! Field : EFLUX, HFLUX + ! Description: Latent heat flux, sensible heat flux + ! Unit : W/m^2 + ! Dimensions : nX, nY + State_Met(LCHNK)%EFLUX (1,:) = cam_in%Lhf(:) + State_Met(LCHNK)%HFLUX (1,:) = cam_in%Shf(:) + + ! Field : LandTypeFrac + ! Description: Olson fraction per type + ! Unit : - (between 0 and 1) + ! Dimensions : nX, nY, NSURFTYPE + ! Note : Index 1 is water +#if ( LANDTYPE_CLM ) + ! Fill in water + State_Met(LCHNK)%LandTypeFrac(1,:, 1) = cam_in%ocnFrac(:) & + + cam_in%iceFrac(:) +#if ( ALLDDVEL_GEOSCHEM ) + CALL getLandTypes( cam_in, & + nY, & + State_Met(LCHNK) ) +#endif +#endif + + ! Field : FRCLND, FRLAND, FROCEAN, FRSEAICE, FRLAKE, FRLANDIC + ! Description: Olson land fraction + ! Fraction of land + ! Fraction of ocean + ! Fraction of sea ice + ! Fraction of lake + ! Fraction of land ice + ! Fraction of snow + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%FRCLND (1,:) = 1.e+0_fp - & + State_Met(LCHNK)%LandTypeFrac(1,:,1) ! Olson Land Fraction + State_Met(LCHNK)%FRLAND (1,:) = cam_in%landFrac(:) + State_Met(LCHNK)%FROCEAN (1,:) = cam_in%ocnFrac(:) + cam_in%iceFrac(:) + State_Met(LCHNK)%FRSEAICE (1,:) = cam_in%iceFrac(:) +#if ( LANDTYPE_CLM ) + State_Met(LCHNK)%FRLAKE (1,:) = cam_in%lwtgcell(:,3) + & + cam_in%lwtgcell(:,4) + State_Met(LCHNK)%FRLANDIC (1,:) = cam_in%lwtgcell(:,2) + State_Met(LCHNK)%FRSNO (1,:) = 0.0e+0_fp +#else + State_Met(LCHNK)%FRLAKE (1,:) = 0.0e+0_fp + State_Met(LCHNK)%FRLANDIC (1,:) = 0.0e+0_fp + State_Met(LCHNK)%FRSNO (1,:) = 0.0e+0_fp +#endif + + ! Field : GWETROOT, GWETTOP + ! Description: Root and top soil moisture + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%GWETROOT (1,:) = 0.0e+0_fp + State_Met(LCHNK)%GWETTOP (1,:) = 0.0e+0_fp + + ! Field : LAI + ! Description: Leaf area index + ! Unit : m^2/m^2 + ! Dimensions : nX, nY + State_Met(LCHNK)%LAI (1,:) = 0.0e+0_fp + + ! Field : PARDR, PARDF + ! Description: Direct and diffuse photosynthetically active radiation + ! Unit : W/m^2 + ! Dimensions : nX, nY + State_Met(LCHNK)%PARDR (1,:) = 0.0e+0_fp + State_Met(LCHNK)%PARDF (1,:) = 0.0e+0_fp + + ! Field : PBLH + ! Description: PBL height + ! Unit : m + ! Dimensions : nX, nY + State_Met(LCHNK)%PBLH (1,:) = PblH(:nY) + + ! Field : PHIS + ! Description: Surface geopotential height + ! Unit : m + ! Dimensions : nX, nY + State_Met(LCHNK)%PHIS (1,:) = State%Phis(:) + + ! Field : PRECANV, PRECCON, PRECLSC, PRECTOT + ! Description: Anvil precipitation @ ground + ! Convective precipitation @ ground + ! Large-scale precipitation @ ground + ! Total precipitation @ ground + ! Unit : kg/m^2/s + ! Dimensions : nX, nY + State_Met(LCHNK)%PRECANV (1,:) = 0.0e+0_fp + State_Met(LCHNK)%PRECCON (1,:) = cam_out%Precc(:) + State_Met(LCHNK)%PRECLSC (1,:) = cam_out%Precl(:) + State_Met(LCHNK)%PRECTOT (1,:) = cam_out%Precc(:) + cam_out%Precl(:) + + ! Field : TROPP + ! Description: Tropopause pressure + ! Unit : hPa + ! Dimensions : nX, nY + State_Met(LCHNK)%TROPP (1,:) = Trop_P(:) + + ! Field : PS1_WET, PS2_WET + ! Description: Wet surface pressure at start and end of timestep + ! Unit : hPa + ! Dimensions : nX, nY + State_Met(LCHNK)%PS1_WET (1,:) = State%ps(:)*0.01e+0_fp + State_Met(LCHNK)%PS2_WET (1,:) = State%ps(:)*0.01e+0_fp + + ! Field : SLP + ! Description: Sea level pressure + ! Unit : hPa + ! Dimensions : nX, nY + State_Met(LCHNK)%SLP (1,:) = State%ps(:)*0.01e+0_fp + + ! Field : TS, TSKIN + ! Description: Surface temperature, surface skin temperature + ! Unit : K + ! Dimensions : nX, nY + State_Met(LCHNK)%TS (1,:) = cam_in%TS(:) + State_Met(LCHNK)%TSKIN (1,:) = cam_in%TS(:) + + ! Field : SWGDN + ! Description: Incident radiation @ ground + ! Unit : W/m^2 + ! Dimensions : nX, nY + State_Met(LCHNK)%SWGDN (1,:) = fsds(:) + + ! Field : TO3 + ! Description: Total overhead ozone column + ! Unit : DU + ! Dimensions : nX, nY + State_Met(LCHNK)%TO3 (1,:) = 300.0e+0_fp ! TMMF + + ! Field : SNODP, SNOMAS + ! Description: Snow depth, snow mass + ! Unit : m, kg/m^2 + ! Dimensions : nX, nY + ! Note : Conversion from m to kg/m^2 + ! \rho_{ice} = 916.7 kg/m^3 + State_Met(LCHNK)%SNODP (1,:) = snowDepth(:) + State_Met(LCHNK)%SNOMAS (1,:) = snowDepth(:) * 916.7e+0_r8 + + ! Field : SUNCOS, SUNCOSmid + ! Description: COS(solar zenith angle) at current time and midpoint + ! of chemistry timestep + ! Unit : - + ! Dimensions : nX, nY + ! Note : Compute tendency in -/s (tmmf, 1/13/20) ? + State_Met(LCHNK)%SUNCOS (1,:) = CSZA(:) + State_Met(LCHNK)%SUNCOSmid (1,:) = CSZA(:) + + ! Field : U10M, V10M + ! Description: E/W and N/S wind speed @ 10m height + ! Unit : m/s + ! Dimensions : nX, nY + State_Met(LCHNK)%U10M (1,:) = State%U(:,nZ) + State_Met(LCHNK)%V10M (1,:) = State%V(:,nZ) + + ! Field : USTAR + ! Description: Friction velocity + ! Unit : m/s + ! Dimensions : nX, nY + ! Note : We here combine the land friction velocity (fv) with + ! the ocean friction velocity (ustar) + DO J = 1, nY + State_Met(LCHNK)%USTAR (1,J) = & + cam_in%fv(J) * ( cam_in%landFrac(J)) & + + cam_in%uStar(J) * ( 1.0e+0_fp - cam_in%landFrac(J)) + ENDDO + + ! Field : Z0 + ! Description: Surface roughness length + ! Unit : m + ! Dimensions : nX, nY + State_Met(LCHNK)%Z0 (1,:) = Z0(:) + + DO J = 1, nY + iMaxLoc = MAXLOC( (/ State_Met(LCHNK)%FRLAND(1,J) + & + State_Met(LCHNK)%FRLANDIC(1,J) + & + State_Met(LCHNK)%FRLAKE(1,J), & + State_Met(LCHNK)%FRSEAICE(1,J), & + State_Met(LCHNK)%FROCEAN(1,J) - & + State_Met(LCHNK)%FRSEAICE(1,J) /) ) + IF ( iMaxLoc(1) == 3 ) iMaxLoc(1) = 0 + ! reset ocean to 0 + + ! Field : LWI + ! Description: Land/water indices + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%LWI(1,J) = FLOAT( iMaxLoc(1) ) + ENDDO + + ! Three-dimensional fields on level edges + DO J = 1, nY + DO L = 1, nZ+1 + ! Field : PEDGE + ! Description: Wet air pressure at (vertical) level edges + ! Unit : hPa + ! Dimensions : nX, nY, nZ+1 + State_Met(LCHNK)%PEDGE (1,J,L) = State%Pint(J,nZ+2-L)*0.01e+0_fp + + ! Field : CMFMC + ! Description: Upward moist convective mass flux + ! Unit : kg/m^2/s + ! Dimensions : nX, nY, nZ+1 + State_Met(LCHNK)%CMFMC (1,J,L) = 0.0e+0_fp + + ! Field : PFICU, PFLCU + ! Description: Downward flux of ice/liquid precipitation (convective) + ! Unit : kg/m^2/s + ! Dimensions : nX, nY, nZ+1 + State_Met(LCHNK)%PFICU (1,J,L) = 0.0e+0_fp + State_Met(LCHNK)%PFLCU (1,J,L) = 0.0e+0_fp + + ! Field : PFILSAN, PFLLSAN + ! Description: Downward flux of ice/liquid precipitation (Large-scale & anvil) + ! Unit : kg/m^2/s + ! Dimensions : nX, nY, nZ+1 + State_Met(LCHNK)%PFILSAN (1,J,L) = LsFlxSnw(j,nZ+2-L) ! kg/m2/s + State_Met(LCHNK)%PFLLSAN (1,J,L) = MAX(0.0e+0_fp,LsFlxPrc(J,nZ+2-L) - LsFlxSnw(J,nZ+2-L)) ! kg/m2/s + ENDDO + ENDDO + + DO J = 1, nY + ! Field : U, V + ! Description: Max cloud top height + ! Unit : level + ! Dimensions : nX, nY + State_Met(LCHNK)%cldTops(1,J) = nZ + 1 - NINT(cldTop(J)) + ENDDO + + ! Three-dimensional fields on level centers + DO J = 1, nY + DO L = 1, nZ + + ! Field : U, V + ! Description: E/W and N/S component of wind + ! Unit : m/s + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%U (1,J,L) = State%U(J,nZ+1-L) + State_Met(LCHNK)%V (1,J,L) = State%V(J,nZ+1-L) + + ! Field : OMEGA + ! Description: Updraft velocity + ! Unit : Pa/s + ! Dimensions : nX, nY, nZ + !State_Met(LCHNK)%OMEGA (1,J,L) = State%Omega(J,nZ+1-L) + + ! Field : CLDF + ! Description: 3-D cloud fraction + ! Unit : - + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%CLDF (1,J,L) = cldFrc(j,nZ+1-l) + + ! Field : DTRAIN + ! Description: Detrainment flux + ! Unit : kg/m^2/s + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%DTRAIN (1,J,L) = 0.0e+0_fp ! Used in convection + + ! Field : DQRCU + ! Description: Convective precipitation production rate + ! Unit : kg/kg dry air/s + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%DQRCU (1,J,L) = 0.0e+0_fp ! Used in convection + + ! Field : DQRLSAN + ! Description: Large-scale precipitation production rate + ! Unit : kg/kg dry air/s + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%DQRLSAN (1,J,L) = PRain(J,nZ+1-L) ! kg/kg/s + + ! Field : QI, QL + ! Description: Cloud ice/water mixing ratio + ! Unit : kg/kg dry air + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%QI (1,J,L) = State%Q(J,nZ+1-L,ixCldIce) ! kg ice / kg dry air + State_Met(LCHNK)%QL (1,J,L) = State%Q(J,nZ+1-L,ixCldLiq) ! kg water / kg dry air + + ! Field : RH + ! Description: Relative humidity + ! Unit : % + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%RH (1,J,L) = RelHum(J,nZ+1-L) * 100.0e+0_fp + + ! Field : TAUCLI, TAUCLW + ! Description: Optical depth of ice/H2O clouds + ! Unit : - + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%TAUCLI (1,J,L) = TauCli(J,nZ+1-L) + State_Met(LCHNK)%TAUCLW (1,J,L) = TauClw(J,nZ+1-L) + + ! Field : REEVAPCN + ! Description: Evaporation of convective precipitation + ! (w/r/t dry air) + ! Unit : kg + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%REEVAPCN (1,J,L) = 0.0e+0_fp + + ! Field : REEVAPLS + ! Description: Evaporation of large-scale + anvil precipitation + ! (w/r/t dry air) + ! Unit : kg + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%REEVAPLS (1,J,L) = NEvapr(J,nZ+1-L) ! kg/kg/s + + ! Field : SPHU1, SPHU2 + ! Description: Specific humidity at current and next timestep + ! Unit : g H2O/ kg air + ! Dimensions : nX, nY, nZ + ! Note : Since we are using online meteorology, we do not have + ! access to the data at the next time step + ! Compute tendency in g H2O/kg air/s (tmmf, 1/13/20) ? + State_Met(LCHNK)%SPHU1 (1,J,L) = qH2O(J,nZ+1-L) * 1.0e+3_fp ! g/kg + State_Met(LCHNK)%SPHU2 (1,J,L) = qH2O(J,nZ+1-L) * 1.0e+3_fp ! g/kg + + ! Field : TMPU1, TMPU2 + ! Description: Temperature at current and next timestep + ! Unit : K + ! Dimensions : nX, nY, nZ + ! Note : Since we are using online meteorology, we do not have + ! access to the data at the next time step + ! Compute tendency in K/s (tmmf, 1/13/20) ? + State_Met(LCHNK)%TMPU1 (1,J,L) = State%T(J,nZ+1-L) + State_Met(LCHNK)%TMPU2 (1,J,L) = State%T(J,nZ+1-L) + ENDDO + ENDDO + + ! Field : T + ! Description: Temperature at current time + ! Unit : K + ! Dimensions : nX, nY, nZ + ! Note : Since we are using online meteorology, we do not have + ! access to the data at the next time step + ! Compute tendency in K/s (tmmf, 1/13/20) ? + State_Met(LCHNK)%T = (State_Met(LCHNK)%TMPU1 + State_Met(LCHNK)%TMPU2)*0.5e+0_fp + + ! Field : SPHU + ! Description: Specific humidity at current time + ! Unit : g H2O/ kg air + ! Dimensions : nX, nY, nZ + ! Note : Since we are using online meteorology, we do not have + ! access to the data at the next time step + ! Compute tendency in g H2O/kg air/s (tmmf, 1/13/20) ? + State_Met(LCHNK)%SPHU = (State_Met(LCHNK)%SPHU1 + State_Met(LCHNK)%SPHU2)*0.5e+0_fp + + ! Field : OPTD + ! Description: Total in-cloud optical depth (visible band) + ! Unit : - + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%OPTD = State_Met(LCHNK)%TAUCLI + State_Met(LCHNK)%TAUCLW + + ! Nullify all pointers + Nullify(PblH ) + Nullify(Fsds ) + Nullify(PRain ) + Nullify(LsFlxSnw) + Nullify(LsFlxPrc) + Nullify(cldTop ) + Nullify(cldFrc ) + Nullify(NEvapr ) + Nullify(RprdTot ) + + ! Field : InChemGrid + ! Description: Are we in the chemistry grid? + ! Unit : - + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%InChemGrid(:,:,:) = .True. + + ! Determine current date and time + CALL Get_Curr_Date( yr = currYr, & + mon = currMo, & + day = currDy, & + tod = currTOD ) + + ! For now, force year to be 2000 + currYr = 2000 + currYMD = (currYr*1000) + (currMo*100) + (currDy) + ! Deal with subdaily + currUTC = REAL(currTOD,f4)/3600.0e+0_f4 + currSc = 0 + currMn = 0 + currHr = 0 + DO WHILE (currTOD > 3600) + currTOD = currTOD - 3600 + currHr = currHr + 1 + ENDDO + DO WHILE (currTOD > 60) + currTOD = currTOD - 60 + currMn = currMn + 1 + ENDDO + currSc = currTOD + currHMS = (currHr*1000) + (currMn*100) + (currSc) + + IF ( firstDay ) THEN + newDay = .True. + newMonth = .True. + firstDay = .False. + ELSE IF ( currHMS < dT ) THEN + newDay = .True. + IF ( currDy == 1 ) THEN + newMonth = .True. + ELSE + newMonth = .False. + ENDIF + ELSE + newDay = .False. + newMonth = .False. + ENDIF + + ! Pass time values obtained from the ESMF environment to GEOS-Chem + CALL Accept_External_Date_Time( am_I_Root = rootChunk, & + value_NYMD = currYMD, & + value_NHMS = currHMS, & + value_YEAR = currYr, & + value_MONTH = currMo, & + value_DAY = currDy, & + value_DAYOFYR = INT(FLOOR(Calday)), & + value_HOUR = currHr, & + value_MINUTE = currMn, & + value_HELAPSED = 0.0e+0_f4, & + value_UTC = currUTC, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Failed to update time in GEOS-Chem!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Accept_External_PEdge( am_I_Root = rootChunk, & + State_Met = State_Met(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Failed to update pressure edges!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Field : PS1_DRY, PS2_DRY + ! Description: Dry surface pressure at current and next timestep + ! Unit : hPa + ! Dimensions : nX, nY, nZ+1 + ! Note : 1. Use the CAM PSDry fields instead of using the + ! GEOS-Chem calculation + ! 2. As we are using online meteorology, we do not + ! have access to the fields at the next time step + ! Compute Pa/s tendency? (tmmf, 1/13/20) + State_Met(LCHNK)%PS1_DRY (1,:) = State%PSDry(:) * 0.01e+0_fp + State_Met(LCHNK)%PS2_DRY (1,:) = State%PSDry(:) * 0.01e+0_fp + + ! Field : PSC2_WET, PSC2_DRY + ! Description: Interpolated wet and dry surface pressure at the + ! current time + ! Unit : hPa + ! Dimensions : nX, nY, nZ+1 + ! Note : As we are using online meteorology, we do not + ! have access to the fields at the next time step + ! Compute Pa/s tendency? (tmmf, 1/13/20) + State_Met(LCHNK)%PSC2_WET = State_Met(LCHNK)%PS1_WET + State_Met(LCHNK)%PSC2_DRY = State_Met(LCHNK)%PS1_DRY + + CALL Set_Floating_Pressures( am_I_Root = rootChunk, & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Failed to set floating pressures!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Set quantities of interest but do not change VMRs + ! This function updates: + ! ==================================================================== + ! (1) PEDGE : Moist air pressure at grid box bottom [hPa] + ! (2) PEDGE_DRY : Dry air partial pressure at box bottom [hPa] + ! (3) PMID : Moist air pressure at grid box centroid [hPa] + ! (4) PMID_DRY : Dry air partial pressure at box centroid [hPa] + ! (5) PMEAN : Altitude-weighted mean moist air pressure [hPa] + ! (6) PMEAN_DRY : Alt-weighted mean dry air partial pressure [hPa] + ! (7) DELP : Delta-P extent of grid box [hPa] + ! (Same for both moist and dry air since we + ! assume constant water vapor pressure + ! across box) + ! (8) AIRDEN : Mean grid box dry air density [kg/m^3] + ! (defined as total dry air mass/box vol) + ! (9) MAIRDEN : Mean grid box moist air density [kg/m^3] + ! (defined as total moist air mass/box vol) + ! (10) AD : Total dry air mass in grid box [kg] + ! (11) ADMOIST : Total moist air mass in grid box [kg] + ! (12) BXHEIGHT : Vertical height of grid box [m] + ! (13) AIRVOL : Volume of grid box [m^3] + ! (14) MOISTMW : Molecular weight of moist air in box [g/mol] + ! ==================================================================== + CALL AirQnt( am_I_Root = rootChunk, & + Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC, & + Update_Mixing_Ratio = .False. ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Failed to calculate air properties!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Initialize strat chem if not already done. This has to be done here because + ! it needs to have non-zero values in State_Chm%AD, which only happens after + ! the first call to AirQnt + !IF ( (.not.SCHEM_READY) .and. Input_Opt%LSCHEM ) THEN + IF ( (.not.SCHEM_READY) .and. .True. ) THEN !TMMF + CALL Init_Strat_Chem( am_I_Root = rootChunk, & + Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Met = State_Met(LCHNK), & + State_Grid = State_Grid(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Strat_Chem"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + SCHEM_READY = .True. + ENDIF + + !============================================================== + ! ***** R U N H E M C O P H A S E 1 ***** + ! + ! Phase 1 updates the HEMCO clock and the content of the + ! HEMCO data list. This should be done before writing the + ! diagnostics organized in the HEMCO diagnostics structure, + ! and before using any of the HEMCO data list fields. + ! (ckeller, 4/1/15) + !============================================================== + ! Run HEMCO Phase 1 + !CALL Emissions_Run ( am_I_Root = MasterProc, & + ! Input_Opt = Input_Opt, & + ! State_Chm = State_Chm(LCHNK), & + ! State_Diag = State_Diag(LCHNK), & + ! State_Grid = State_Grid(LCHNK), & + ! State_Met = State_Met(LCHNK), & + ! EmisTime = EmisTime, & + ! Phase = 1, & + ! RC = RC ) + ! + !! Trap potential errors + !IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Error encountered in "Emissions_Run"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + !ENDIF + + !---------------------------------------------------------- + ! %%% GET SOME NON-EMISSIONS DATA FIELDS VIA HEMCO %%% + ! + ! HEMCO can track non-emission data fields for chemistry + ! simulations. Put these subroutine calls after the + ! call to EMISSIONS_RUN, so that the HEMCO data structure + ! will be initialized. (bmy, 3/20/15) + ! + ! HEMCO data list is now updated further above, so can + ! take these calls out of the emissions sequence. + ! (ckeller, 4/01/15) + !---------------------------------------------------------- + !IF ( LCHEM .and. newMonth ) THEN + ! + ! ! The following only apply when photolysis is used, + ! ! that is for fullchem or aerosol simulations. + ! IF ( ITS_A_FULLCHEM_SIM .or. ITS_AN_AEROSOL_SIM ) THEN + ! + ! ! Copy UV Albedo data (for photolysis) into the + ! ! State_Met%UVALBEDO field. (bmy, 3/20/15) + ! CALL Get_UvAlbedo( am_I_Root = MasterProc, & + ! Input_Opt = Input_Opt, & + ! State_Met = State_Met(LCHNK), & + ! RC = RC ) + ! + ! ! Trap potential errors + ! IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Error encountered in "Get_UvAlbedo"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + ! ENDIF + ! + ! IF ( Input_Opt%USE_TOMS_O3 ) THEN + ! ! Get TOMS overhead O3 columns for photolysis from + ! ! the HEMCO data structure (bmy, 3/20/15) + ! CALL Read_TOMS( am_I_Root = MasterProc, & + ! Input_Opt = Input_Opt, & + ! RC = RC ) + ! + ! ! Trap potential errors + ! IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Error encountered in "Read_TOMS"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + ! ENDIF + ! ENDIF + ! + ! ENDIF + ! + ! ! Read data required for Hg2 gas-particle partitioning + ! ! (H Amos, 25 Oct 2011) + ! IF ( ITS_A_MERCURY_SIM ) THEN + ! CALL Read_Hg2_Partitioning( am_I_Root = MasterProc, & + ! Input_Opt = Input_Opt, & + ! State_Grid = State_Grid(LCHNK), & + ! State_Met = State_Met(LCHNK), & + ! MONTH = 1, & !TMMF + ! RC = RC ) + ! + ! ! Trap potential errors + ! IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = + ! 'Error encountered in "Read_Hg2_Partitioning"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + ! ENDIF + ! + ! ENDIF + !ENDIF + + !! Prescribe methane surface concentrations throughout PBL + !IF ( ITS_A_FULLCHEM_SIM .and. id_CH4 > 0 ) THEN + ! + ! ! Set CH4 concentrations + ! CALL SET_CH4( am_I_Root = MasterProc, & + ! Input_Opt = Input_Opt, & + ! State_Chm = State_Chm(LCHNK), & + ! State_Diag = State_Diag(LCHNK), & + ! State_Grid = State_Grid(LCHNK), & + ! State_Met = State_Met(LCHNK), & + ! RC = RC ) + ! + ! ! Trap potential errors + ! IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Error encountered in call to "SET_CH4"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + ! ENDIF + !ENDIF + + ! Eventually initialize/reset wetdep + IF ( Input_Opt%LConv .OR. Input_Opt%LChem .OR. Input_Opt%LWetD ) THEN + CALL Setup_WetScav( am_I_Root = rootChunk, & + Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Setup_WetScav"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + !============================================================== + ! ***** C O M P U T E P B L H E I G H T etc. ***** + !============================================================== + ! Move this call from the PBL mixing routines because the PBL + ! height is used by drydep and some of the emissions routines. + ! (ckeller, 3/5/15) + ! This function updates: + ! ==================================================================== + ! (1) InPbl : Logical indicating if we are in the PBL [-] + ! (2) PBL_TOP_L : Number of layers in the PBL [-] + ! (3) PBL_TOP_hPa: Pressure at the top of the PBL [hPa] + ! (4) PBL_TOP_m : PBL height [m] + ! (5) PBL_THICK : PBL thickness [hPa] + ! (6) F_OF_PBL : Fraction of grid box within the PBL [-] + ! (7) F_UNDER_PBLTOP: Fraction of grid box underneath the PBL top [-] + ! (8) PBL_MAX_L : Model level where PBL top occurs [-] + ! ==================================================================== + CALL Compute_PBL_Height( am_I_Root = rootChunk, & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Compute_PBL_Height"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + !-------------------------------------------------------------- + ! Test for emission timestep + ! Now always do emissions here, even for full-mixing + ! (ckeller, 3/5/15) + !-------------------------------------------------------------- + !================================================================== + ! ***** D R Y D E P O S I T I O N ***** + !================================================================== + !================================================================== + ! Compute dry deposition velocities + ! + ! CLM computes dry deposition velocities over land. + ! We need to merge the land component passed through cam_in and + ! the ocn/ice dry deposition velocities. + ! + ! If using the CLM velocities, two options show up: + ! 1. Compute dry deposition velocities over ocean and ice similarly + ! to the way MOZART does it (OCNDDVEL_MOZART) + ! 2. Use GEOS-Chem's dry deposition module to compute velocities + ! and then scale them with the ocean fraction (OCNDDVEL_GEOSCHEM) + ! + ! A third option would be to let GEOS-Chem compute dry deposition + ! velocity (ALLDDVEL_GEOSCHEM), thus overwriting the input from CLM + ! + ! drydep_method must be set to DD_XLND. + ! + ! The following options are currently supported: + ! - ALLDDVEL_GEOSCHEM + ! - OCNDDVEL_GEOSCHEM + ! - OCNDDVEL_MOZART + ! + ! The ALLDDVEL_GEOSCHEM coupled with LANDTYPE_CLM requires that CLM + ! passes land type information (land type and leaf area index). + !================================================================== + ! + ! State_Chm expects dry deposition velocities in m/s, whereas + ! CLM returns land deposition velocities in cm/s! + ! + ! For now, dry deposition velocities are only computed for gases + ! (which is what CLM deals with). Dry deposition for aerosols is + ! work in progress. + ! + ! Thibaud M. Fritz - 27 Feb 2020 + !================================================================== + + IF ( Input_Opt%LDryD ) THEN +#if ( LANDTYPE_CLM ) + ! Compute the Olson landmap fields of State_Met + ! (e.g. State_Met%IREG, State_Met%ILAND, etc.) + CALL Compute_Olson_Landmap( am_I_Root = rootChunk, & + Input_Opt = Input_Opt, & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Compute_Olson_Landmap"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Compute State_Met%XLAI (for drydep) and State_Met%MODISLAI, + ! which is the average LAI per grid box (for soil NOx emissions) + CALL Compute_Xlai( am_I_Root = rootChunk, & + Input_Opt = Input_Opt, & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Compute_Xlai"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF +#endif + +#if ( ALLDDVEL_GEOSCHEM || OCNDDVEL_GEOSCHEM ) + + ! Compute drydep velocities and update State_Chm%DryDepVel + CALL Do_Drydep( am_I_Root = rootChunk, & + Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Do_Drydep"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + +#if ( OCNDDVEL_GEOSCHEM ) + + DO N = 1, nddvels + + !! Print debug + !IF ( rootChunk ) THEN + ! IF ( N == 1 ) THEN + ! Write(iulog,*) "Number of GC dry deposition species = ", & + ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) + ! Write(iulog,*) "Number of CESM dry deposition species = ", & + ! nddvels + ! ENDIF + ! Write(iulog,*) "N = ", N + ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) + ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) + ! IF ( map2GC_dryDep(N) > 0 ) THEN + ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) + ! ENDIF + ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) + ! IF ( drySpc_ndx(N) > 0 ) THEN + ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) + ! ENDIF + ! Write(iulog,*) "CLM-depVel = ", & + ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]" + ! IF ( map2GC_dryDep(N) > 0 ) THEN + ! Write(iulog,*) "GC-depVel = ", & + ! MAXVAL(State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N))), " [m/s]" + ! ENDIF + !ENDIF + + IF ( map2GC_dryDep(N) > 0 ) THEN + ! State_Chm%DryDepVel is in m/s + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & + ! This first bit corresponds to the dry deposition + ! velocities over land as computed from CLM and + ! converted to m/s. This is scaled by the fraction + ! of land. + cam_in%depVel(:nY,N) * 1.0e-02_fp & + * MAX(0._fp, 1.0_fp - State_Met(LCHNK)%FROCEAN(1,:nY)) & + ! This second bit corresponds to the dry deposition + ! velocities over ocean and sea ice as computed from + ! GEOS-Chem. This is scaled by the fraction of ocean + ! and sea ice. + + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) & + * State_Met(LCHNK)%FROCEAN(1,:nY) + ENDIF + ENDDO + +#endif + +#elif ( OCNDDVEL_MOZART ) + ! This routine updates the deposition velocities from CLM in the + ! pointer lnd(LCHNK)%dvel as long as drydep_method == DD_XLND is + ! True. + CALL drydep_update( State, cam_in ) + + windSpeed(:nY) = SQRT( State%U(:nY,nZ)*State%U(:nY,nZ) + & + State%V(:nY,nZ)*State%V(:nY,nZ) ) + potT(:nY) = State%T(:nY,nZ) * (1._fp + qH2O(:nY,nZ)) + + CALL get_lat_all_p( LCHNK, nY, latndx ) + CALL get_lon_all_p( LCHNK, nY, lonndx ) + + CALL drydep_fromlnd( ocnfrac = cam_in%ocnfrac(:), & + icefrac = cam_in%icefrac(:), & + ncdate = currYMD, & + sfc_temp = cam_in%TS(:), & + pressure_sfc = State%PS(:), & + wind_speed = windSpeed(:), & + spec_hum = qH2O(:,nZ), & + air_temp = State%T(:,nZ), & + pressure_10m = State%PMid(:,nZ), & + rain = State_Met(LCHNK)%PRECTOT(1,:), & + snow = cam_in%Snowhland(:), & + solar_flux = State_Met(LCHNK)%SWGDN(1,:), & + dvelocity = MOZART_depVel(:,:), & + dflx = MOZART_depFlx(:,:), & + State_Chm = State_Chm(LCHNK), & + tv = potT(:), & + soilw = -99._fp, & + rh = relHum(:,nZ), & + ncol = nY, & + lonndx = lonndx(:), & + latndx = latndx(:), & + lchnk = LCHNK ) + + DO N = 1, nddvels + + !! Print debug + !IF ( rootChunk ) THEN + ! IF ( N == 1 ) THEN + ! Write(iulog,*) "Number of GC dry deposition species = ", & + ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) + ! Write(iulog,*) "Number of CESM dry deposition species = ", & + ! nddvels + ! ENDIF + ! Write(iulog,*) "N = ", N + ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) + ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) + ! IF ( map2GC_dryDep(N) > 0 ) THEN + ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) + ! ENDIF + ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) + ! IF ( drySpc_ndx(N) > 0 ) THEN + ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) + ! ENDIF + ! Write(iulog,*) "CLM-depVel = ", & + ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]", LCHNK + ! IF ( drySpc_ndx(N) > 0 ) THEN + ! Write(iulog,*) "Merged depVel = ", & + ! MAXVAL(MOZART_depVel(:nY,drySpc_ndx(N))) * 1.0e-02_fp, " [m/s]", LCHNK + ! ENDIF + !ENDIF + + IF ( ( map2GC_dryDep(N) > 0 ) .AND. ( drySpc_ndx(N) > 0 ) ) THEN + ! State_Chm%DryDepVel is in m/s + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & + MOZART_depVel(:nY,drySpc_ndx(N)) * 1.0e-02_fp + ENDIF + + ENDDO + +#else + ! We should be in one of the cases above as any exceptions should be + ! caught when running chem_readnl, but just for safety's safe: + CALL ENDRUN('Incorrect definitions for dry deposition velocities') +#endif + + CALL Update_DryDepSav( am_I_Root = rootChunk, & + Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ENDIF + + !!=========================================================== + !! ***** E M I S S I O N S ***** + !! + !! NOTE: For a complete description of how emissions from + !! HEMCO are added into GEOS-Chem (and how they are mixed + !! into the boundary layer), please see the wiki page: + !! + !! http://wiki-geos-chem.org/Distributing_emissions_in_the_PBL + !!=========================================================== + ! + !! EMISSIONS_RUN will call HEMCO run phase 2. HEMCO run phase + !! only calculates emissions. All data has been read to disk + !! in phase 1 at the beginning of the time step. + !! (ckeller, 4/1/15) + !CALL Emissions_Run( am_I_Root = rootChunk, & + ! Input_Opt = Input_Opt, & + ! State_Chm = State_Chmk(LCHNK), & + ! State_Diag = State_Diag(LCHNK), & + ! State_Grid = State_Grid(LCHNK), & + ! State_Met = State_Met(LCHNK), & + ! TimeForEmis = TimeForEmis, & + ! Phase = 2, & + ! RC = RC ) + ! + !! Trap potential errors + !IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = + ! 'Error encountered in "Emissions_Run"! after drydep!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + !ENDIF + + !=========================================================== + ! ***** M I X E D L A Y E R M I X I N G ***** + !=========================================================== + + ! Note: mixing routine expects tracers in v/v + ! DO_MIXING applies the tracer tendencies (dry deposition, + ! emission rates) to the tracer arrays and performs PBL + ! mixing. + ! In the non-local PBL scheme, dry deposition and emission + ! fluxes below the PBL are handled within the PBL mixing + ! routine. Otherwise, tracer concentrations are first updated + ! and the full-mixing is then applied. + ! (ckeller, 3/5/15) + ! NOTE: Tracer concentration units are converted locally + ! to [v/v dry air] for mixing. Eventually mixing should + ! be updated to use [kg/kg total air] (ewl, 9/18/15) + ! + ! This requires HEMCO. For now comment out. + ! Thibaud M. Fritz - 05/07/20 + !CALL Do_Mixing( am_I_Root = rootChunk, & + ! Input_Opt = Input_Opt, & + ! State_Chm = State_Chm(LCHNK), & + ! State_Diag = State_Diag(LCHNK), & + ! State_Grid = State_Grid(LCHNK), & + ! State_Met = State_Met(LCHNK), & + ! RC = RC ) + ! + !! Trap potential errors + !IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Error encountered in "Do_Mixing"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + !ENDIF + + !!=========================================================== + !! ***** C L O U D C O N V E C T I O N ***** + !!=========================================================== + !IF ( LCONV ) THEN + ! + ! ! Call the appropriate convection routine + ! ! NOTE: Tracer concentration units are converted locally + ! ! to [kg/kg total air] for convection (ewl, 9/18/15) + ! CALL Do_Convection( am_I_Root = rootChunk, & + ! Input_Opt = Input_Opt, & + ! State_Chm = State_Chm(LCHNK), & + ! State_Diag = State_Diag(LCHNK), & + ! State_Grid = State_Grid(LCHNK), & + ! State_Met = State_Met(LCHNK), & + ! RC = RC ) + ! + ! ! Trap potential errors + ! IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Error encountered in "Do_Convection"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + ! ENDIF + !ENDIF + + !============================================================== + ! ***** C H E M I S T R Y ***** + !============================================================== + ! Get the overhead column O3 for use with FAST-J + IF ( Input_Opt%Its_A_FullChem_Sim .OR. & + Input_Opt%Its_An_Aerosol_Sim ) THEN + + IF ( Input_Opt%LChem ) THEN + CALL Compute_Overhead_O3( am_I_Root = rootChunk, & + State_Grid = State_Grid(LCHNK), & + DAY = currDy, & + USE_O3_FROM_MET = Input_Opt%Use_O3_From_Met, & + TO3 = State_Met(LCHNK)%TO3 ) + ENDIF + ENDIF + + CALL Do_Chemistry( am_I_Root = rootChunk, & + Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Do_Chemistry"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + !============================================================== + ! ***** W E T D E P O S I T I O N (rainout + washout) ***** + !============================================================== + IF ( Input_Opt%LWetD ) THEN + + ! Do wet deposition + ! NOTE: Tracer concentration units are converted locally + ! to [kg/m2] in wet deposition to enable calculations + ! along the column (ewl, 9/18/15) + CALL Do_WetDep( am_I_Root = rootChunk, & + Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Do_WetDep"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ENDIF + + ! Make sure State_Chm(lchnk) is back in kg/kg dry! + ! Reset H2O MMR to the initial value (no chemistry tendency in H2O just yet) + State_Chm(LCHNK)%Species(1,:,:,iH2O) = MMR_Beg(:,:,iH2O) + + ! Store unadvected species data + SlsData = 0.0e+0_r8 + DO N = 1, nSls + M = map2GC_Sls(N) + IF ( M > 0 ) THEN + DO J = 1, nY + DO K = 1, nZ + SlsData(J,nZ+1-K,N) = REAL(State_Chm(LCHNK)%Species(1,J,K,M),r8) + ENDDO + ENDDO + ENDIF + ENDDO + CALL Set_Short_Lived_Species( SlsData, LCHNK, nY, Pbuf ) + + ! Write diagnostic output + DO N = 1, pcnst + M = map2GC(N) + I = map2Idx(N) + IF ( M > 0 ) THEN + SpcName = tracerNames(I) + VMR = 0.0e+0_r8 + DO J = 1, nY + DO K = 1, nZ + VMR(J,nZ+1-K) = REAL(State_Chm(LCHNK)%Species(1,J,K,M),r8) * MWRatio(I) + ENDDO + ENDDO + CALL OutFld( TRIM(SpcName), VMR(:nY,:), nY, LCHNK ) + ENDIF + ENDDO + +#if defined( CLM40 ) + SpcName = 'lu_soil' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,1), nY, LCHNK ) + SpcName = 'lu_landice' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,2), nY, LCHNK ) + SpcName = 'lu_deeplake' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,3), nY, LCHNK ) + SpcName = 'lu_shallowlake' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,4), nY, LCHNK ) + SpcName = 'lu_wetland' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,5), nY, LCHNK ) + SpcName = 'lu_urban' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,6), nY, LCHNK ) + SpcName = 'lu_icemec' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,7), nY, LCHNK ) + SpcName = 'lu_crop' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,8), nY, LCHNK ) +#elif defined( CLM45 ) || defined( CLM50 ) + SpcName = 'lu_soil' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,1), nY, LCHNK ) + SpcName = 'lu_crop' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,2), nY, LCHNK ) + SpcName = 'lu_landice' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,4), nY, LCHNK ) + SpcName = 'lu_deeplake' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,5), nY, LCHNK ) + SpcName = 'lu_wetland' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,6), nY, LCHNK ) + SpcName = 'lu_urban' + CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,7) & + + cam_in%lwtgcell(:,8) & + + cam_in%lwtgcell(:,9), nY, LCHNK ) +#endif + SpcName = 'p_notveg' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,1), nY, LCHNK ) + SpcName = 'p_needle_eg_temp' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,2), nY, LCHNK ) + SpcName = 'p_needle_eg_bor' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,3), nY, LCHNK ) + SpcName = 'p_needle_dd_bor' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,4), nY, LCHNK ) + SpcName = 'p_broad_eg_trop' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,5), nY, LCHNK ) + SpcName = 'p_broad_eg_temp' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,6), nY, LCHNK ) + SpcName = 'p_broad_dd_trop' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,7), nY, LCHNK ) + SpcName = 'p_broad_dd_temp' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,8), nY, LCHNK ) + SpcName = 'p_broad_dd_bor' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,9), nY, LCHNK ) + SpcName = 'p_broad_eg_sh' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,10), nY, LCHNK ) + SpcName = 'p_broad_dd_temp_sh' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,11), nY, LCHNK ) + SpcName = 'p_broad_dd_bor_sh' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,12), nY, LCHNK ) + SpcName = 'p_c3_arctic_grass' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,13), nY, LCHNK ) + SpcName = 'p_c3_narctic_grass' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,14), nY, LCHNK ) + SpcName = 'p_c4_grass' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,15), nY, LCHNK ) + SpcName = 'p_c3_crop' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,16), nY, LCHNK ) + SpcName = 'p_c3_irrigated' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,17), nY, LCHNK ) +#if defined( CLM40 ) + SpcName = 'p_c3_corn' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,18), nY, LCHNK ) + SpcName = 'p_spring_cereal' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,19), nY, LCHNK ) + SpcName = 'p_winter_cereal' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,20), nY, LCHNK ) + SpcName = 'p_soybean' +#elif defined( CLM45 ) || defined( CLM50 ) + SpcName = 'p_temp_corn' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,18), nY, LCHNK ) + SpcName = 'p_irr_temp_corn' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,19), nY, LCHNK ) + SpcName = 'p_spring_wheat' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,20), nY, LCHNK ) + SpcName = 'p_irr_spring_wheat' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,21), nY, LCHNK ) + SpcName = 'p_winter_wheat' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,22), nY, LCHNK ) + SpcName = 'p_irr_winter_wheat' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,23), nY, LCHNK ) + SpcName = 'p_temp_soybean' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,24), nY, LCHNK ) + SpcName = 'p_irr_temp_soybean' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,25), nY, LCHNK ) + SpcName = 'p_barley' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,26), nY, LCHNK ) + SpcName = 'p_irr_barley' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,27), nY, LCHNK ) + SpcName = 'p_winter_barley' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,28), nY, LCHNK ) + SpcName = 'p_irr_winter_barley' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,29), nY, LCHNK ) + SpcName = 'p_rye' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,30), nY, LCHNK ) + SpcName = 'p_irr_rye' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,31), nY, LCHNK ) + SpcName = 'p_winter_rye' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,32), nY, LCHNK ) + SpcName = 'p_irr_winter_rye' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,33), nY, LCHNK ) + SpcName = 'p_cassava' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,34), nY, LCHNK ) + SpcName = 'p_irr_cassava' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,35), nY, LCHNK ) + SpcName = 'p_citrus' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,36), nY, LCHNK ) + SpcName = 'p_irr_citrus' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,37), nY, LCHNK ) + SpcName = 'p_cocoa' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,38), nY, LCHNK ) + SpcName = 'p_irr_cocoa' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,39), nY, LCHNK ) + SpcName = 'p_coffee' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,40), nY, LCHNK ) + SpcName = 'p_irr_coffee' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,41), nY, LCHNK ) + SpcName = 'p_cotton' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,42), nY, LCHNK ) + SpcName = 'p_irr_cotton' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,43), nY, LCHNK ) + SpcName = 'p_datepalm' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,44), nY, LCHNK ) + SpcName = 'p_irr_datepalm' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,45), nY, LCHNK ) + SpcName = 'p_foddergrass' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,46), nY, LCHNK ) + SpcName = 'p_irr_foddergrass' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,47), nY, LCHNK ) + SpcName = 'p_grapes' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,48), nY, LCHNK ) + SpcName = 'p_irr_grapes' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,49), nY, LCHNK ) + SpcName = 'p_groundnuts' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,50), nY, LCHNK ) + SpcName = 'p_irr_groundnuts' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,51), nY, LCHNK ) + SpcName = 'p_millet' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,52), nY, LCHNK ) + SpcName = 'p_irr_millet' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,53), nY, LCHNK ) + SpcName = 'p_oilpalm' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,54), nY, LCHNK ) + SpcName = 'p_irr_oilpalm' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,55), nY, LCHNK ) + SpcName = 'p_potatoes' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,56), nY, LCHNK ) + SpcName = 'p_irr_potatoes' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,57), nY, LCHNK ) + SpcName = 'p_pulses' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,58), nY, LCHNK ) + SpcName = 'p_irr_pulses' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,59), nY, LCHNK ) + SpcName = 'p_rapeseed' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,60), nY, LCHNK ) + SpcName = 'p_irr_rapessed' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,61), nY, LCHNK ) + SpcName = 'p_rice' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,62), nY, LCHNK ) + SpcName = 'p_irr_rice' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,63), nY, LCHNK ) + SpcName = 'p_sorghum' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,64), nY, LCHNK ) + SpcName = 'p_irr_sorghum' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,65), nY, LCHNK ) + SpcName = 'p_sugarbeet' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,66), nY, LCHNK ) + SpcName = 'p_irr_sugarbeet' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,67), nY, LCHNK ) + SpcName = 'p_sugarcane' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,68), nY, LCHNK ) + SpcName = 'p_irr_sugarcane' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,69), nY, LCHNK ) + SpcName = 'p_sunflower' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,70), nY, LCHNK ) + SpcName = 'p_irr_sunflower' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,71), nY, LCHNK ) + SpcName = 'p_miscanthus' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,72), nY, LCHNK ) + SpcName = 'p_irr_miscanthus' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,73), nY, LCHNK ) + SpcName = 'p_switchgrass' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,74), nY, LCHNK ) + SpcName = 'p_irr_switchgrass' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,75), nY, LCHNK ) + SpcName = 'p_trop_corn' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,76), nY, LCHNK ) + SpcName = 'p_irr_trop_corn' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,77), nY, LCHNK ) + SpcName = 'p_trop_soybean' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,78), nY, LCHNK ) + SpcName = 'p_irr_trop_soybean' + CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,79), nY, LCHNK ) +#endif + SpcName = 'pla_notveg' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,1), nY, LCHNK ) + SpcName = 'pla_needle_eg_temp' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,2), nY, LCHNK ) + SpcName = 'pla_needle_eg_bor' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,3), nY, LCHNK ) + SpcName = 'pla_needle_dd_bor' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,4), nY, LCHNK ) + SpcName = 'pla_broad_eg_trop' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,5), nY, LCHNK ) + SpcName = 'pla_broad_eg_temp' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,6), nY, LCHNK ) + SpcName = 'pla_broad_dd_trop' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,7), nY, LCHNK ) + SpcName = 'pla_broad_dd_temp' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,8), nY, LCHNK ) + SpcName = 'pla_broad_dd_bor' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,9), nY, LCHNK ) + SpcName = 'pla_broad_eg_sh' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,10), nY, LCHNK ) + SpcName = 'pla_broad_dd_temp_sh' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,11), nY, LCHNK ) + SpcName = 'pla_broad_dd_bor_sh' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,12), nY, LCHNK ) + SpcName = 'pla_c3_arctic_grass' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,13), nY, LCHNK ) + SpcName = 'pla_c3_narctic_grass' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,14), nY, LCHNK ) + SpcName = 'pla_c4_grass' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,15), nY, LCHNK ) + SpcName = 'pla_c3_crop' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,16), nY, LCHNK ) + SpcName = 'pla_c3_irrigated' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,17), nY, LCHNK ) +#if defined( CLM40 ) + SpcName = 'pla_c3_corn' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,18), nY, LCHNK ) + SpcName = 'pla_spring_cereal' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,19), nY, LCHNK ) + SpcName = 'pla_winter_cereal' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,20), nY, LCHNK ) + SpcName = 'pla_soybean' +#elif defined( CLM45 ) || defined( CLM50 ) + SpcName = 'pla_temp_corn' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,18), nY, LCHNK ) + SpcName = 'pla_irr_temp_corn' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,19), nY, LCHNK ) + SpcName = 'pla_spring_wheat' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,20), nY, LCHNK ) + SpcName = 'pla_irr_spring_wheat' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,21), nY, LCHNK ) + SpcName = 'pla_winter_wheat' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,22), nY, LCHNK ) + SpcName = 'pla_irr_winter_wheat' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,23), nY, LCHNK ) + SpcName = 'pla_temp_soybean' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,24), nY, LCHNK ) + SpcName = 'pla_irr_temp_soybean' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,25), nY, LCHNK ) + SpcName = 'pla_barley' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,26), nY, LCHNK ) + SpcName = 'pla_irr_barley' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,27), nY, LCHNK ) + SpcName = 'pla_winter_barley' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,28), nY, LCHNK ) + SpcName = 'pla_irr_winter_barley' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,29), nY, LCHNK ) + SpcName = 'pla_rye' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,30), nY, LCHNK ) + SpcName = 'pla_irr_rye' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,31), nY, LCHNK ) + SpcName = 'pla_winter_rye' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,32), nY, LCHNK ) + SpcName = 'pla_irr_winter_rye' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,33), nY, LCHNK ) + SpcName = 'pla_cassava' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,34), nY, LCHNK ) + SpcName = 'pla_irr_cassava' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,35), nY, LCHNK ) + SpcName = 'pla_citrus' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,36), nY, LCHNK ) + SpcName = 'pla_irr_citrus' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,37), nY, LCHNK ) + SpcName = 'pla_cocoa' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,38), nY, LCHNK ) + SpcName = 'pla_irr_cocoa' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,39), nY, LCHNK ) + SpcName = 'pla_coffee' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,40), nY, LCHNK ) + SpcName = 'pla_irr_coffee' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,41), nY, LCHNK ) + SpcName = 'pla_cotton' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,42), nY, LCHNK ) + SpcName = 'pla_irr_cotton' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,43), nY, LCHNK ) + SpcName = 'pla_datepalm' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,44), nY, LCHNK ) + SpcName = 'pla_irr_datepalm' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,45), nY, LCHNK ) + SpcName = 'pla_foddergrass' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,46), nY, LCHNK ) + SpcName = 'pla_irr_foddergrass' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,47), nY, LCHNK ) + SpcName = 'pla_grapes' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,48), nY, LCHNK ) + SpcName = 'pla_irr_grapes' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,49), nY, LCHNK ) + SpcName = 'pla_groundnuts' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,50), nY, LCHNK ) + SpcName = 'pla_irr_groundnuts' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,51), nY, LCHNK ) + SpcName = 'pla_millet' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,52), nY, LCHNK ) + SpcName = 'pla_irr_millet' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,53), nY, LCHNK ) + SpcName = 'pla_oilpalm' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,54), nY, LCHNK ) + SpcName = 'pla_irr_oilpalm' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,55), nY, LCHNK ) + SpcName = 'pla_potatoes' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,56), nY, LCHNK ) + SpcName = 'pla_irr_potatoes' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,57), nY, LCHNK ) + SpcName = 'pla_pulses' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,58), nY, LCHNK ) + SpcName = 'pla_irr_pulses' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,59), nY, LCHNK ) + SpcName = 'pla_rapeseed' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,60), nY, LCHNK ) + SpcName = 'pla_irr_rapessed' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,61), nY, LCHNK ) + SpcName = 'pla_rice' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,62), nY, LCHNK ) + SpcName = 'pla_irr_rice' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,63), nY, LCHNK ) + SpcName = 'pla_sorghum' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,64), nY, LCHNK ) + SpcName = 'pla_irr_sorghum' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,65), nY, LCHNK ) + SpcName = 'pla_sugarbeet' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,66), nY, LCHNK ) + SpcName = 'pla_irr_sugarbeet' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,67), nY, LCHNK ) + SpcName = 'pla_sugarcane' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,68), nY, LCHNK ) + SpcName = 'pla_irr_sugarcane' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,69), nY, LCHNK ) + SpcName = 'pla_sunflower' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,70), nY, LCHNK ) + SpcName = 'pla_irr_sunflower' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,71), nY, LCHNK ) + SpcName = 'pla_miscanthus' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,72), nY, LCHNK ) + SpcName = 'pla_irr_miscanthus' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,73), nY, LCHNK ) + SpcName = 'pla_switchgrass' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,74), nY, LCHNK ) + SpcName = 'pla_irr_switchgrass' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,75), nY, LCHNK ) + SpcName = 'pla_trop_corn' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,76), nY, LCHNK ) + SpcName = 'pla_irr_trop_corn' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,77), nY, LCHNK ) + SpcName = 'pla_trop_soybean' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,78), nY, LCHNK ) + SpcName = 'pla_irr_trop_soybean' + CALL OutFld( TRIM(SpcName), cam_in%lai(:,79), nY, LCHNK ) +#endif + + DO N = 1, nSls + SpcName = slsNames(n) + VMR = 0.0e+0_r8 + M = map2GC_Sls(n) + IF ( M > 0 ) THEN + DO J = 1, nY + DO K = 1, nZ + VMR(J,nZ+1-K) = REAL(State_Chm(LCHNK)%Species(1,J,K,M),r8) * SLSMWratio(N) + ENDDO + ENDDO + CALL OutFld( TRIM(SpcName), VMR(:nY,:), nY, LCHNK ) + ENDIF + ENDDO + + ! NOTE: Re-flip all the arrays vertically or suffer the consequences + ! ptend%q dimensions: [column, ?, species] + Ptend%Q(:,:,:) = 0.0e+0_r8 + MMR_End = 0.0e+0_r8 + DO N = 1, pcnst + M = map2GC(N) + IF (M > 0) THEN + I = 1 + DO J = 1, nY + DO K = 1, nZ + ! CURRENTLY KG/KG + MMR_End (J,K,M) = REAL(State_Chm(LCHNK)%Species(1,J,K,M),r8) + MMR_TEnd(J,K,M) = MMR_End(J,K,M) - MMR_Beg(J,K,M) + ptend%q(J,nZ+1-K,N) = (MMR_End(J,K,M)-MMR_Beg(J,K,M))/dT + ENDDO + ENDDO + ENDIF + ENDDO + + IF (PRESENT(fh2o)) THEN + fh2o(:nY) = 0.0e+0_r8 + !DO K = 1, nZ + ! fh2o(:nY) = fh2o(:nY) + Ptend%Q(:nY,K,iH2O)*State%Pdel(:nY,K)/Gravit + !ENDDO + ENDIF + + IF (rootChunk) WRITE(iulog,'(a)') ' GEOS-Chem chemistry step completed' + + end subroutine chem_timestep_tend + +!=============================================================================== + subroutine chem_init_cnst(name, latvals, lonvals, mask, q) + + CHARACTER(LEN=*), INTENT(IN) :: name ! constituent name + REAL(r8), INTENT(IN) :: latvals(:) ! lat in degrees (NCOL) + REAL(r8), INTENT(IN) :: lonvals(:) ! lon in degrees (NCOL) + LOGICAL, INTENT(IN) :: mask(:) ! Only initialize where .true. + REAL(r8), INTENT(OUT) :: q(:,:) ! kg tracer/kg dry air (NCOL, PVER + ! Used to initialize tracer fields if desired. + ! Will need a simple mapping structure as well as the CAM tracer registration + ! routines. + + INTEGER :: ILEV, NLEV, I + REAL(r8) :: QTemp, Min_MMR + + IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_INIT_CNST' + + NLEV = SIZE(Q, 2) + ! Retrieve a "background value" for this from the database + Min_MMR = 1.0e-38_r8 + DO I = 1, nTracers + IF (TRIM(tracerNames(I)).eq.TRIM(name)) THEN + Min_MMR = ref_MMR(i) + EXIT + ENDIF + ENDDO + + DO ILEV = 1, NLEV + WHERE(MASK) + ! Set to the minimum mixing ratio + Q(:,ILEV) = Min_MMR + END WHERE + ENDDO + + end subroutine chem_init_cnst + +!=============================================================================== + subroutine chem_final + + use Input_Opt_Mod, only : Cleanup_Input_Opt + use State_Chm_Mod, only : Cleanup_State_Chm + use State_Diag_Mod, only : Cleanup_State_Diag + use State_Grid_Mod, only : Cleanup_State_Grid + use State_Met_Mod, only : Cleanup_State_Met + use Error_Mod, only : Cleanup_Error + + use FlexChem_Mod, only : Cleanup_FlexChem + use UCX_Mod, only : Cleanup_UCX + use Drydep_Mod, only : Cleanup_Drydep + use WetScav_Mod, only : Cleanup_Wetscav + use Carbon_Mod, only : Cleanup_Carbon + use Dust_Mod, only : Cleanup_Dust + use Seasalt_Mod, only : Cleanup_Seasalt + use Aerosol_Mod, only : Cleanup_Aerosol + use TOMS_Mod, only : Cleanup_Toms + use Sulfate_Mod, only : Cleanup_Sulfate + use Pressure_Mod, only : Cleanup_Pressure + use Strat_Chem_Mod, only : Cleanup_Strat_Chem + use PBL_Mix_Mod, only : Cleanup_PBL_Mix + + use CMN_Size_Mod, only : Cleanup_CMN_Size + use CMN_O3_Mod, only : Cleanup_CMN_O3 + use CMN_FJX_Mod, only : Cleanup_CMN_FJX + + ! Special: cleans up after NDXX_Setup + use Diag_Mod, only : Cleanup_Diag + + use GC_Emissions_Mod, only: GC_Emissions_Final + + INTEGER :: I, RC + LOGICAL :: am_I_Root + + ! Finalize GEOS-Chem + IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_FINAL' + + CALL Cleanup_UCX( MasterProc ) + CALL Cleanup_Aerosol + CALL Cleanup_Carbon + CALL Cleanup_Drydep + CALL Cleanup_Dust + CALL Cleanup_FlexChem( am_I_Root, RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Cleanup_FlexChem"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Cleanup_PBL_Mix + CALL Cleanup_Pressure + CALL Cleanup_Seasalt + CALL Cleanup_Sulfate + CALL Cleanup_Strat_Chem + CALL Cleanup_Toms( MasterProc, RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Cleanup_Toms"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Cleanup_WetScav( MasterProc, RC) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Cleanup_WetScav"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL GC_Emissions_Final + + ! Call extra cleanup routines, from modules in Headers/ + CALL Cleanup_CMN_O3( MasterProc, RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Cleanup_CMN_O3"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Cleanup_CMN_SIZE( MasterProc, RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Cleanup_CMN_SIZE"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Cleanup_CMN_FJX( MasterProc, RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Cleanup_CMN_FJX"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Cleanup_Diag + + ! Cleanup Input_Opt + CALL Cleanup_Input_Opt( MasterProc, Input_Opt, RC ) + + ! Loop over each chunk and cleanup the variables + DO I = BEGCHUNK, ENDCHUNK + am_I_Root = ((I.eq.BEGCHUNK) .and. MasterProc) + + CALL Cleanup_State_Chm ( am_I_Root, State_Chm(I), RC ) + CALL Cleanup_State_Diag( am_I_Root, State_Diag(I), RC ) + CALL Cleanup_State_Grid( am_I_Root, State_Grid(I), RC ) + CALL Cleanup_State_Met ( am_I_Root, State_Met(I), RC ) + ENDDO + CALL Cleanup_Error + + ! Finally deallocate state variables + IF (ALLOCATED(State_Chm)) DEALLOCATE(State_Chm) + IF (ALLOCATED(State_Diag)) DEALLOCATE(State_Diag) + IF (ALLOCATED(State_Grid)) DEALLOCATE(State_Grid) + IF (ALLOCATED(State_Met)) DEALLOCATE(State_Met) + + IF (ALLOCATED(slvd_Lst )) DEALLOCATE(slvd_Lst) + IF (ALLOCATED(slvd_ref_MMR)) DEALLOCATE(slvd_ref_MMR) + + RETURN + + end subroutine chem_final +!=============================================================================== + subroutine chem_init_restart(File) + use pio, only : file_desc_t + TYPE(file_desc_t) :: File + + IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_INIT_RESTART' + + RETURN + + end subroutine chem_init_restart +!=============================================================================== + subroutine chem_write_restart( File ) + !use tracer_cnst, only: write_tracer_cnst_restart + !use tracer_srcs, only: write_tracer_srcs_restart + !use linoz_data, only: write_linoz_data_restart + use pio, only : file_desc_t + IMPLICIT NONE + TYPE(file_desc_t) :: File + + IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_WRITE_RESTART' + ! + ! data for offline tracers + ! + !call write_tracer_cnst_restart(File) + !call write_tracer_srcs_restart(File) + !call write_linoz_data_restart(File) + end subroutine chem_write_restart +!=============================================================================== + subroutine chem_read_restart( File ) + !use tracer_cnst, only: read_tracer_cnst_restart + !use tracer_srcs, only: read_tracer_srcs_restart + !use linoz_data, only: read_linoz_data_restart + + use pio, only : file_desc_t + IMPLICIT NONE + TYPE(file_desc_t) :: File + + if (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_READ_RESTART' + ! + ! data for offline tracers + ! + !call read_tracer_cnst_restart(File) + !call read_tracer_srcs_restart(File) + !call read_linoz_data_restart(File) + end subroutine chem_read_restart +!================================================================================ + subroutine chem_emissions( state, cam_in ) + use camsrfexch, only: cam_in_t + + use PhysConstants, only: PI, PI_180 + + ! Arguments: + + TYPE(physics_state), INTENT(IN) :: state ! Physics state variables + TYPE(cam_in_t), INTENT(INOUT) :: cam_in ! import state + + REAL(r8) :: Rlats(State%NCOL) + REAL(r8) :: Rlons(State%NCOL) + REAL(r8) :: Dlat, Dlon + REAL(r8) :: SFlx(State%NCOL,nTracers) + + INTEGER :: M, N, I + INTEGER :: LCHNK, NCOL + LOGICAL :: rootChunk + + LOGICAL, SAVE :: FIRST = .TRUE. + + ! LCHNK: which chunk we have on this process + LCHNK = State%LCHNK + ! NCOL: number of atmospheric columns on this chunk + NCOL = State%NCOL + rootChunk = ( MasterProc.and.(LCHNK.EQ.BEGCHUNK) ) + + SFlx(:,:) = 0.0e+0_r8 + Rlats(1:ncol) = State%Lat(1:NCOL) + Rlons(1:ncol) = State%Lon(1:NCOL) + + IF (FIRST) THEN + ENDIF + + !TMMF + ! Test: emit 1e-10 kg/m2/s of NO in a square around Europe + DO M = 1, PCNST + N = map2GC(M) + IF ((N>0).and.(N==iNO)) THEN + SFlx(:,N) = 0.0e+0_r8 + DO I = 1, NCOL + Dlat = Rlats(i) / REAL(PI_180,r8) + Dlon = Rlons(i) / REAL(PI_180,r8) + IF ((Dlat > 50.0e+0_r8).and.(Dlat < 60.0e+0_r8).and.(Dlon > -15.0e+0_r8).and.(Dlon < 5.0e+0_r8)) THEN + SFlx(I,N) = SFlx(I,N) + 1.0e-10_r8 + ENDIF + ENDDO + cam_in%CFlx(:NCOL,M) = cam_in%CFlx(:NCOL,M) + SFlx(:NCOL,N) + ENDIF + ENDDO + + end subroutine chem_emissions + +end module chemistry diff --git a/src/chemistry/pp_geoschem/clybry_fam.F90 b/src/chemistry/pp_geoschem/clybry_fam.F90 new file mode 100644 index 0000000000..d53a32fdf0 --- /dev/null +++ b/src/chemistry/pp_geoschem/clybry_fam.F90 @@ -0,0 +1,180 @@ +!----------------------------------------------------------------------- +! +! Manages the adjustment of ClOy and BrOy family components in response +! to conservation issues resulting from advection. +! +! Created by: Francis Vitt +! Date: 21 May 2008 +! Modified by Stacy Walters +! Date: 13 August 2008 +!----------------------------------------------------------------------- + +module clybry_fam + + use shr_kind_mod, only : r8 => shr_kind_r8 + use ppgrid, only : pcols, pver + use chem_mods, only : gas_pcnst, adv_mass + use constituents, only : pcnst + use short_lived_species,only: set_short_lived_species,get_short_lived_species + + implicit none + + save + + private + public :: clybry_fam_set + public :: clybry_fam_adj + public :: clybry_fam_init + + integer :: id_cly,id_bry + + integer :: id_cl,id_clo,id_hocl,id_cl2,id_cl2o2,id_oclo,id_hcl,id_clono2 + integer :: id_br,id_bro,id_hbr,id_brono2,id_brcl,id_hobr + + logical :: has_clybry + +contains + + !------------------------------------------ + !------------------------------------------ + subroutine clybry_fam_init + + !use mo_chem_utls, only : get_spc_ndx + implicit none + + integer :: ids(16) + + !id_cly = get_spc_ndx('CLY') + !id_bry = get_spc_ndx('BRY') + + !id_cl = get_spc_ndx('CL') + !id_clo = get_spc_ndx('CLO') + !id_hocl = get_spc_ndx('HOCL') + !id_cl2 = get_spc_ndx('CL2') + !id_cl2o2 = get_spc_ndx('CL2O2') + !id_oclo = get_spc_ndx('OCLO') + !id_hcl = get_spc_ndx('HCL') + !id_clono2 = get_spc_ndx('CLONO2') + + !id_br = get_spc_ndx('BR') + !id_bro = get_spc_ndx('BRO') + !id_hbr = get_spc_ndx('HBR') + !id_brono2 = get_spc_ndx('BRONO2') + !id_brcl = get_spc_ndx('BRCL') + !id_hobr = get_spc_ndx('HOBR') + + !ids = (/ id_cly,id_bry, & + ! id_cl,id_clo,id_hocl,id_cl2,id_cl2o2,id_oclo,id_hcl,id_clono2, & + ! id_br,id_bro,id_hbr,id_brono2,id_brcl,id_hobr /) + + !has_clybry = all( ids(:) > 0 ) + + endsubroutine clybry_fam_init + +!-------------------------------------------------------------- +! set the ClOy and BrOy mass mixing ratios +! - this is call before advection +!-------------------------------------------------------------- + subroutine clybry_fam_set( ncol, lchnk, map2chm, q, pbuf ) + + use time_manager, only : get_nstep + use physics_buffer, only : physics_buffer_desc + + implicit none + +!-------------------------------------------------------------- +! ... dummy arguments +!-------------------------------------------------------------- + integer, intent(in) :: ncol, lchnk + integer, intent(in) :: map2chm(pcnst) + real(r8), intent(inout) :: q(pcols,pver,pcnst) + type(physics_buffer_desc), pointer :: pbuf(:) + + !real(r8) :: wrk(ncol,pver,2) + !real(r8) :: mmr(pcols,pver,gas_pcnst) + !integer :: n, m + + if (.not. has_clybry) return + + end subroutine clybry_fam_set + +!-------------------------------------------------------------- +! adjust the ClOy and BrOy individual family members +! - this is call after advection +!-------------------------------------------------------------- + subroutine clybry_fam_adj( ncol, lchnk, map2chm, q, pbuf ) + + use time_manager, only : is_first_step + use physics_buffer, only : physics_buffer_desc + + implicit none + +!-------------------------------------------------------------- +! ... dummy arguments +!-------------------------------------------------------------- + integer, intent(in) :: ncol, lchnk + integer, intent(in) :: map2chm(pcnst) + real(r8), intent(inout) :: q(pcols,pver,pcnst) + type(physics_buffer_desc), pointer :: pbuf(:) + + end subroutine clybry_fam_adj + +!-------------------------------------------------------------- +! private methods +!-------------------------------------------------------------- + +!-------------------------------------------------------------- +! compute the mass mixing retio of ClOy +!-------------------------------------------------------------- + function cloy( q, pcols, ncol ) + +!-------------------------------------------------------------- +! ... dummy arguments +!-------------------------------------------------------------- + integer, intent(in) :: pcols + integer, intent(in) :: ncol + real(r8), intent(in) :: q(pcols,pver,gas_pcnst) + +!-------------------------------------------------------------- +! ... function declaration +!-------------------------------------------------------------- + real(r8) :: cloy(ncol,pver) + +!-------------------------------------------------------------- +! ... local variables +!-------------------------------------------------------------- + real(r8) :: wrk(ncol) + integer :: k + + cloy = 0._r8 + + end function cloy + +!-------------------------------------------------------------- +! compute the mass mixing retio of BrOy +!-------------------------------------------------------------- + function broy( q, pcols, ncol ) + +!-------------------------------------------------------------- +! ... dummy arguments +!-------------------------------------------------------------- + integer, intent(in) :: pcols + integer, intent(in) :: ncol + real(r8), intent(in) :: q(pcols,pver,gas_pcnst) + +!-------------------------------------------------------------- +! ... function declaration +!-------------------------------------------------------------- + real(r8) :: broy(ncol,pver) + +!-------------------------------------------------------------- +! ... local variables +!-------------------------------------------------------------- + real(r8) :: wrk(ncol) + integer :: k + + broy = 0._r8 + + end function broy + +end module clybry_fam diff --git a/src/chemistry/pp_geoschem/epp_ionization.F90 b/src/chemistry/pp_geoschem/epp_ionization.F90 new file mode 100644 index 0000000000..98276cd5f3 --- /dev/null +++ b/src/chemistry/pp_geoschem/epp_ionization.F90 @@ -0,0 +1,508 @@ +!------------------------------------------------------------------------------- +! Energetic Particle Precipitation (EPP) forcings module +! Manages ionization of the atmosphere due to energetic particles, which consists of +! solar protons events (SPE), galactic cosmic rays(GCR), medium energy electrons (MEE) +!------------------------------------------------------------------------------- +module epp_ionization + use shr_kind_mod, only : r8 => shr_kind_r8, cs => shr_kind_cs, cl=> shr_kind_cl + use spmd_utils, only : masterproc + use cam_abortutils, only : endrun + use cam_logfile, only : iulog + use phys_grid, only : pcols, pver, begchunk, endchunk, get_ncols_p + use pio, only : var_desc_t, file_desc_t + use pio, only : pio_get_var, pio_inq_varid, pio_get_att + use pio, only : pio_inq_varndims, pio_inq_vardimid, pio_inq_dimname, pio_inq_dimlen + use pio, only : PIO_NOWRITE + use cam_pio_utils, only : cam_pio_openfile + use ioFileMod, only : getfil + use input_data_utils, only : time_coordinate + + implicit none + private + + public :: epp_ionization_readnl ! read namelist variables + public :: epp_ionization_init ! initialization + public :: epp_ionization_adv ! read and time/space interpolate the data + public :: epp_ionization_ionpairs! ion pairs production rates + public :: epp_ionization_setmag ! update geomagnetic coordinates mapping + public :: epp_ionization_active + + character(len=cl) :: epp_all_filepath = 'NONE' + character(len=cs) :: epp_all_varname = 'epp_ion_rates' + character(len=cl) :: epp_mee_filepath = 'NONE' + character(len=cs) :: epp_mee_varname = 'iprm' + character(len=cl) :: epp_spe_filepath = 'NONE' + character(len=cs) :: epp_spe_varname = 'iprp' + character(len=cl) :: epp_gcr_filepath = 'NONE' + character(len=cs) :: epp_gcr_varname = 'iprg' + + logical, protected :: epp_ionization_active = .false. + + type input_obj_t + type(file_desc_t) :: fid + type(var_desc_t) :: vid + character(len=32) :: units + integer :: nlevs = 0 + integer :: nglats = 0 + real(r8), allocatable :: press(:) + real(r8), allocatable :: glats(:) + real(r8), allocatable :: gwght(:,:) ! (pcol, begchunk:endchunk) + integer, allocatable :: glatn(:,:) ! (pcol, begchunk:endchunk) + real(r8), allocatable :: indata(:,:,:,:) ! (pcol,nlevs,begchunk:endchunk,2) inputs at indexm and indexp + type(time_coordinate) :: time_coord + endtype input_obj_t + + type(input_obj_t), pointer :: epp_in => null() + type(input_obj_t), pointer :: spe_in => null() + type(input_obj_t), pointer :: mee_in => null() + type(input_obj_t), pointer :: gcr_in => null() + +contains + + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + subroutine epp_ionization_readnl(nlfile) + + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit + use spmd_utils, only: mpicom, mpi_character, masterprocid + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + + !! Local variables + !integer :: unitn, ierr + !character(len=*), parameter :: subname = 'epp_ionization_readnl' + + !namelist /epp_ionization_nl/ epp_all_filepath, epp_all_varname, & + ! epp_mee_filepath, epp_mee_varname, epp_spe_filepath, epp_spe_varname, epp_gcr_filepath, epp_gcr_varname + + !! Read namelist + !if (masterproc) then + ! unitn = getunit() + ! open( unitn, file=trim(nlfile), status='old' ) + ! call find_group_name(unitn, 'epp_ionization_nl', status=ierr) + ! if (ierr == 0) then + ! read(unitn, epp_ionization_nl, iostat=ierr) + ! if (ierr /= 0) then + ! call endrun(subname // ':: ERROR reading namelist') + ! end if + ! end if + ! close(unitn) + ! call freeunit(unitn) + !end if + + !! Broadcast namelist variables + !call mpi_bcast(epp_all_filepath, len(epp_all_filepath), mpi_character, masterprocid, mpicom, ierr) + !call mpi_bcast(epp_mee_filepath, len(epp_mee_filepath), mpi_character, masterprocid, mpicom, ierr) + !call mpi_bcast(epp_spe_filepath, len(epp_spe_filepath), mpi_character, masterprocid, mpicom, ierr) + !call mpi_bcast(epp_gcr_filepath, len(epp_gcr_filepath), mpi_character, masterprocid, mpicom, ierr) + + !call mpi_bcast(epp_all_varname, len(epp_all_varname), mpi_character, masterprocid, mpicom, ierr) + !call mpi_bcast(epp_mee_varname, len(epp_mee_varname), mpi_character, masterprocid, mpicom, ierr) + !call mpi_bcast(epp_spe_varname, len(epp_spe_varname), mpi_character, masterprocid, mpicom, ierr) + !call mpi_bcast(epp_gcr_varname, len(epp_gcr_varname), mpi_character, masterprocid, mpicom, ierr) + + !epp_ionization_active = epp_all_filepath /= 'NONE' + !epp_ionization_active = epp_mee_filepath /= 'NONE' .or. epp_ionization_active + !epp_ionization_active = epp_spe_filepath /= 'NONE' .or. epp_ionization_active + !epp_ionization_active = epp_gcr_filepath /= 'NONE' .or. epp_ionization_active + + !if ( epp_ionization_active .and. masterproc ) then + ! write(iulog,*) subname//':: epp_all_filepath = '//trim(epp_all_filepath) + ! write(iulog,*) subname//':: epp_mee_filepath = '//trim(epp_mee_filepath) + ! write(iulog,*) subname//':: epp_spe_filepath = '//trim(epp_spe_filepath) + ! write(iulog,*) subname//':: epp_gcr_filepath = '//trim(epp_gcr_filepath) + !endif + + end subroutine epp_ionization_readnl + + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + subroutine epp_ionization_init() + !use cam_history, only : addfld + + !character(len=32) :: fldunits + !fldunits = '' + ! + !if (epp_all_filepath /= 'NONE') then + ! epp_in => create_input_obj(epp_all_filepath,epp_all_varname) + ! fldunits = trim(epp_in%units) + !else + ! if (epp_mee_filepath /= 'NONE') then + ! mee_in => create_input_obj(epp_mee_filepath,epp_mee_varname) + ! fldunits = trim(mee_in%units) + ! endif + ! if (epp_spe_filepath /= 'NONE') then + ! spe_in => create_input_obj(epp_spe_filepath,epp_spe_varname) + ! fldunits = trim(spe_in%units) + ! endif + ! if (epp_gcr_filepath /= 'NONE') then + ! gcr_in => create_input_obj(epp_gcr_filepath,epp_gcr_varname) + ! fldunits = trim(gcr_in%units) + ! endif + !endif + !call addfld( 'EPPions', (/ 'lev' /), 'A', fldunits, 'EPP ionization data' ) + + end subroutine epp_ionization_init + + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + subroutine epp_ionization_setmag( maglat ) + real(r8), intent(in) :: maglat(pcols,begchunk:endchunk) + + if (.not.epp_ionization_active) return + + !if ( associated(epp_in) ) then + ! call set_wghts(maglat,epp_in) + !else + ! if ( associated(mee_in) ) then + ! call set_wghts(maglat,mee_in) + ! endif + ! if ( associated(spe_in) ) then + ! call set_wghts(maglat,spe_in) + ! endif + ! if ( associated(gcr_in) ) then + ! call set_wghts(maglat,gcr_in) + ! endif + !endif + + end subroutine epp_ionization_setmag + + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + subroutine epp_ionization_adv + + if (.not.epp_ionization_active) return + + !if ( associated(epp_in) ) then + ! call update_input(epp_in) + !else + ! if ( associated(spe_in) ) then + ! call update_input(spe_in) + ! endif + ! if ( associated(gcr_in) ) then + ! call update_input(gcr_in) + ! endif + ! if ( associated(mee_in) ) then + ! call update_input(mee_in) + ! endif + !endif + + end subroutine epp_ionization_adv + + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + subroutine epp_ionization_ionpairs( ncol, lchnk, pmid, temp, ionpairs ) + + integer, intent(in) :: ncol, lchnk + real(r8), intent(in) :: pmid(:,:), temp(:,:) + real(r8), intent(out) :: ionpairs(:,:) ! ion pair production rate + + ionpairs = 0._r8 + if (.not.epp_ionization_active) return + + !if ( associated(epp_in) ) then + ! ionpairs(:ncol,:) = ionpairs(:ncol,:) + interp_ionpairs( ncol, lchnk, pmid, temp, epp_in ) + !else + ! if ( associated(spe_in) ) then + ! ionpairs(:ncol,:) = ionpairs(:ncol,:) + interp_ionpairs( ncol, lchnk, pmid, temp, spe_in ) + ! endif + ! if ( associated(gcr_in) ) then + ! ionpairs(:ncol,:) = ionpairs(:ncol,:) + interp_ionpairs( ncol, lchnk, pmid, temp, gcr_in ) + ! endif + ! if ( associated(mee_in) ) then + ! ionpairs(:ncol,:) = ionpairs(:ncol,:) + interp_ionpairs( ncol, lchnk, pmid, temp, mee_in ) + ! endif + !endif + + end subroutine epp_ionization_ionpairs + + ! private methods + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + subroutine update_input( input ) + type(input_obj_t), pointer :: input + + if ( input%time_coord%read_more() ) then + call input%time_coord%advance() + call read_next_data( input ) + else + call input%time_coord%advance() + endif + + end subroutine update_input + + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + subroutine read_next_data( input ) + type(input_obj_t), pointer :: input + + !! read data corresponding surrounding time indices + !if ( input%nglats > 0 ) then + ! call read_2d_profile( input ) + !else + ! call read_1d_profile( input ) + !endif + + end subroutine read_next_data + + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + function interp_ionpairs( ncol, lchnk, pmid, temp, input ) result( ionpairs ) + use interpolate_data, only : lininterp + use physconst, only : rairv + use cam_history, only : outfld + + integer, intent(in) :: ncol, lchnk + real(r8), intent(in) :: pmid(:,:) ! Pa + real(r8), intent(in) :: temp(:,:) ! K + type(input_obj_t), pointer :: input + real(r8) :: ionpairs(ncol,pver) + + real(r8) :: fctr1, fctr2 + real(r8) :: wrk(ncol,input%nlevs) + real(r8) :: ions_diags(ncol,pver) ! for diagnostics + integer :: i + + !if (input%time_coord%time_interp) then + ! ! time interpolate + ! fctr1 = input%time_coord%wghts(1) + ! fctr2 = input%time_coord%wghts(2) + ! wrk(:ncol,:) = fctr1*input%indata(:ncol,:,lchnk,1) + fctr2*input%indata(:ncol,:,lchnk,2) + !else + ! wrk(:ncol,:) = input%indata(:ncol,:,lchnk,1) + !endif + + !! vertical interpolate ... + !! interpolate to model levels + !do i = 1,ncol + + ! ! interpolate over log pressure + ! call lininterp( wrk(i,:input%nlevs), log(input%press(:input%nlevs)*1.e2_r8), input%nlevs, & + ! ionpairs(i,:pver), log(pmid(i,:pver)), pver ) + ! ions_diags(i,:pver) = ionpairs(i,:pver) + ! + ! if ( index(trim(input%units), 'g^-1') > 0 ) then + ! ! convert to ionpairs/cm3/sec + ! ionpairs(i,:pver) = ionpairs(i,:pver) *(1.e-3_r8*pmid(i,:pver)/(rairv(i,:pver,lchnk)*temp(i,:pver))) + ! endif + !enddo + + !call outfld( 'EPPions', ions_diags(:ncol,:), ncol, lchnk ) + + end function interp_ionpairs + + !----------------------------------------------------------------------------- + ! read 2D profile (geomag-lat vs press) and transfer to geographic grid + !----------------------------------------------------------------------------- + subroutine read_2d_profile( input ) + + type(input_obj_t), pointer :: input + + ! local vars + real(r8) :: wrk2d( input%nglats, input%nlevs, 2 ) + integer :: t, c, i, ntimes, ncols, ierr + real(r8) :: wght1, wght2 + integer :: gndx1, gndx2 + integer :: cnt(3), strt(3) + + !if (input%time_coord%time_interp) then + ! ntimes = 2 + !else + ! ntimes = 1 + !endif + + !cnt(1) = input%nglats + !cnt(2) = input%nlevs + !cnt(3) = ntimes + + !strt(:) = 1 + !strt(3) = input%time_coord%indxs(1) + + !ierr = pio_get_var( input%fid, input%vid, strt, cnt, wrk2d ) + + !do t = 1,ntimes + ! do c=begchunk,endchunk + ! ncols = get_ncols_p(c) + ! do i = 1,ncols + ! gndx1 = input%glatn(i,c) + ! if (gndx1>0) then + ! wght1 = input%gwght(i,c) + ! gndx2 = gndx1+1 + ! if (gndx2.le.input%nglats) then + ! wght2 = 1._r8-wght1 + ! input%indata(i,:,c,t) = wght1*wrk2d(gndx1,:,t) & + ! + wght2*wrk2d(gndx2,:,t) + ! else + ! input%indata(i,:,c,t) = wght1*wrk2d(gndx1,:,t) + ! endif + ! else + ! input%indata(i,:,c,t) = 0._r8 + ! endif + ! end do + ! end do + !end do + + end subroutine read_2d_profile + + !----------------------------------------------------------------------------- + ! read 1D vertical profile and transfer to geographic grid poleward of 60 degrees geomag-lat + !----------------------------------------------------------------------------- + subroutine read_1d_profile( input ) + + type(input_obj_t), pointer :: input + + ! local vars + real(r8) :: wrk( input%nlevs, 2 ) + integer :: t, c, i, ntimes, ncols, ierr + integer :: cnt(2), strt(2) + + !if (input%time_coord%time_interp) then + ! ntimes = 2 + !else + ! ntimes = 1 + !endif + + !cnt(1) = input%nlevs + !cnt(2) = ntimes + + !strt(:) = 1 + !strt(2) = input%time_coord%indxs(1) + + !ierr = pio_get_var( input%fid, input%vid, strt, cnt, wrk ) + + !do t = 1,ntimes + ! do c=begchunk,endchunk + ! ncols = get_ncols_p(c) + ! do i = 1,ncols + ! input%indata(i,:,c,t) = input%gwght(i,c)*wrk(:,t) + ! end do + ! end do + !end do + + end subroutine read_1d_profile + + !----------------------------------------------------------------------------- + !----------------------------------------------------------------------------- + function create_input_obj( path, varname ) result(in_obj) + use infnan, only : nan, assignment(=) + + character(*), intent(in) :: path + character(*), intent(in) :: varname + type(input_obj_t), pointer :: in_obj + + character(len=cl) :: filen + character(len=cl) :: data_units + character(len=cs) :: dimname + integer :: i, ierr + integer, allocatable :: dimids(:) + integer :: pres_did, pres_vid, glat_did, glat_vid, ndims + + if (path .eq. 'NONE') return + + !allocate(in_obj) + + !call in_obj%time_coord%initialize( path ) + + !call getfil( path, filen, 0 ) + !call cam_pio_openfile( in_obj%fid, filen, PIO_NOWRITE ) + + !ierr = pio_inq_varid( in_obj%fid, varname, in_obj%vid ) + + !ierr = pio_get_att( in_obj%fid, in_obj%vid, 'units', data_units) + !in_obj%units = trim(data_units(1:32)) + + !ierr = pio_inq_varndims( in_obj%fid, in_obj%vid, ndims ) + !allocate( dimids(ndims) ) + + !ierr = pio_inq_vardimid( in_obj%fid, in_obj%vid, dimids) + !pres_did = -1 + !glat_did = -1 + !do i = 1,ndims + ! ierr = pio_inq_dimname( in_obj%fid, dimids(i), dimname ) + ! select case( trim(dimname(1:4)) ) + ! case ( 'pres', 'lev', 'plev' ) + ! pres_did = dimids(i) + ! ierr = pio_inq_varid( in_obj%fid, dimname, pres_vid) + ! case ( 'glat' ) + ! glat_did = dimids(i) + ! ierr = pio_inq_varid( in_obj%fid, dimname, glat_vid) + ! case default + ! end select + !end do + + !deallocate( dimids ) + + !if (pres_did>0) then + ! ierr = pio_inq_dimlen( in_obj%fid, pres_did, in_obj%nlevs ) + ! allocate( in_obj%press(in_obj%nlevs) ) + ! ierr = pio_get_var( in_obj%fid, pres_vid, in_obj%press ) + !endif + !if (glat_did>0) then + ! ierr = pio_inq_dimlen( in_obj%fid, glat_did, in_obj%nglats ) + ! allocate( in_obj%glats(in_obj%nglats) ) + ! ierr = pio_get_var( in_obj%fid, glat_vid, in_obj%glats ) + ! allocate( in_obj%glatn(pcols,begchunk:endchunk) ) + !endif + ! + !allocate( in_obj%gwght(pcols,begchunk:endchunk) ) + + !if (in_obj%time_coord%time_interp) then + ! allocate( in_obj%indata(pcols,in_obj%nlevs,begchunk:endchunk,2) ) + !else + ! allocate( in_obj%indata(pcols,in_obj%nlevs,begchunk:endchunk,1) ) + !endif + !in_obj%indata = nan + + end function create_input_obj + + !----------------------------------------------------------------------- + !----------------------------------------------------------------------- + subroutine set_wghts( maglat, input ) + + real(r8), intent(in) :: maglat(pcols,begchunk:endchunk) + type(input_obj_t), pointer :: input + + integer :: i, c, ncols, imag + + !if (input%nglats>1) then ! read in general EPP 2D ionpairs production rates + ! do c = begchunk,endchunk + ! ncols = get_ncols_p(c) + ! col_loop: do i = 1,ncols + ! if ( maglat(i,c) .lt. input%glats(1) ) then + ! input%glatn(i,c) = 1 + ! input%gwght(i,c) = 1._r8 + ! elseif ( maglat(i,c) .gt. input%glats(input%nglats) ) then + ! input%glatn(i,c) = input%nglats + ! input%gwght(i,c) = 1._r8 + ! else + ! mag_loop: do imag = 1,input%nglats-1 + ! if ( maglat(i,c) .ge. input%glats(imag) .and. & + ! maglat(i,c) .lt. input%glats(imag+1) ) then + ! input%gwght(i,c) = (input%glats(imag+1)-maglat(i,c) ) & + ! / (input%glats(imag+1)-input%glats(imag)) + ! input%glatn(i,c) = imag + ! exit mag_loop + ! endif + ! enddo mag_loop + ! endif + ! enddo col_loop + ! enddo + !else ! read in 1D SPE ionpairs profile ... + ! do c = begchunk,endchunk + ! ncols = get_ncols_p(c) + ! do i = 1,ncols + ! if ( abs(maglat(i,c)) .ge. 60._r8 ) then ! poleward of 60 degrees + ! input%gwght(i,c) = 1._r8 + ! else + ! input%gwght(i,c) = 0._r8 + ! endif + ! enddo + ! enddo + !endif + + !call read_next_data( input ) ! update the inputs when wghts are updated + + end subroutine set_wghts + +end module epp_ionization diff --git a/src/chemistry/pp_geoschem/gc_emissions.F90 b/src/chemistry/pp_geoschem/gc_emissions.F90 new file mode 100644 index 0000000000..05841a9e66 --- /dev/null +++ b/src/chemistry/pp_geoschem/gc_emissions.F90 @@ -0,0 +1,76 @@ +!================================================================================================ +! This is the "GEOS-Chem" chemistry emissions interface +!================================================================================================ +module GC_Emissions_Mod + + use Shr_kind_mod, only : r8 => shr_kind_r8 + use Spmd_utils, only : MasterProc, myCPU=>iam, nCPUs=>npes + use Cam_logfile, only : iulog + use Cam_abortutils, only : endrun + + use Chem_mods, only : NTracers + use Chem_mods, only : TracerNames + use Chem_mods, only : Map2GC + + use Tracer_data, only : trfld,trfile + + IMPLICIT NONE + + TYPE :: Emission + INTEGER :: Spc_Ndx + REAL(r8) :: MW + REAL(r8) :: Scalefactor + CHARACTER(LEN=256) :: Filename + CHARACTER(LEN=16) :: Species + CHARACTER(LEN=8) :: Units + INTEGER :: Nsectors + CHARACTER(LEN=32), POINTER :: Sectors(:) + TYPE(trfld), POINTER :: Fields(:) + TYPE(trfile) :: File + ENDTYPE Emission + + PRIVATE + + PUBLIC :: GC_Emissions_Init + PUBLIC :: GC_Emissions_Calc + PUBLIC :: GC_Emissions_Final + + ! Stand-in: emissions + TYPE(Emission), ALLOCATABLE :: Emissions(:) + INTEGER :: N_Emis_Files + +!================================================================================================ +contains +!================================================================================================ + + subroutine GC_Emissions_Init + + INTEGER :: Ierr + + N_Emis_Files=1 + ALLOCATE(Emissions(N_Emis_Files), STAT=IERR) + IF (IERR.NE.0) CALL ENDRUN('Could not allocate GC emissions') + + end subroutine GC_Emissions_Init + + subroutine GC_Emissions_Calc(Eflx) + + ! Emissions in kg/m2/s + ! Dimensions: [N columns x K levels x C constituents ] + REAL(r8), INTENT(OUT) :: EFlx(:,:,:) + INTEGER :: I_Trc, I_Emis + + EFlx(:,:,:) = 0.0e+0_r8 + DO I_Emis = 1, N_Emis_Files + ! Read emissions file + DO I_Trc = 1, NTracers + ENDDO + ENDDO + + end subroutine GC_Emissions_Calc + + subroutine GC_Emissions_Final + IF (ALLOCATED(Emissions)) DEALLOCATE(Emissions) + end subroutine GC_Emissions_Final + + end module GC_Emissions_Mod diff --git a/src/chemistry/pp_geoschem/getLandTypes.F90 b/src/chemistry/pp_geoschem/getLandTypes.F90 new file mode 100644 index 0000000000..9852d706f5 --- /dev/null +++ b/src/chemistry/pp_geoschem/getLandTypes.F90 @@ -0,0 +1,218 @@ +!------------------------------------------------------------------------------ +!BOP +! +! !ROUTINE: getLandTypes.F90 +! +! !DESCRIPTION: Subroutine getLandTypes converts the land types and leaf +! area indices from the land model to the LandTypeFrac and XLAI_NATIVE +! arrays in GEOS-Chem. +! +! !INTERFACE: +! + SUBROUTINE getLandTypes( cam_in, nY, State_Met ) +! +! !USES: +! + USE camsrfexch, ONLY : cam_in_t + USE State_Met_Mod, ONLY : MetState + USE seq_drydep_mod, ONLY : NPatch + USE shr_kind_mod, ONLY : r8 => shr_kind_r8 + USE PRECISION_MOD, ONLY : fp, f4 ! Flexible precision + USE CMN_SIZE_Mod, ONLY : NSURFTYPE + USE cam_abortutils, ONLY : endrun + IMPLICIT NONE +! +! !INPUT PARAMETERS: +! + TYPE(cam_in_t), INTENT(IN ) :: cam_in ! CAM + INTEGER, INTENT(IN ) :: nY ! Number of grid cells on chunk +! +! !INPUT/OUTPUT PARAMETERS: +! + TYPE(MetState), INTENT(INOUT) :: State_Met +! +! !REVISION HISTORY: +! 8 May 2020 - Thibaud M. Fritz - Initial version +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + INTEGER :: J, T + REAL(r8) :: waterFrac, landFrac + +#if defined( CLM40 ) + + ! Mapping for CLM4.0 + ! -----------------------------------|-------------------------------------- + ! Olson land type | CLM land type + ! -----------------------------------|-------------------------------------- + ! Inland/sea water (ID = 1) | Ocean fraction + ! | Deeplake & Shallowlake (LUID =3/4) + ! Urban (ID = 2) | Urban - Not Applied (LUID = 6) + ! Low Sparse Grassland (ID = 3) | + ! Coniferous Forest (ID = 4) | + ! Deciduous Conifer Forest (ID = 5) | Needleleaf Deciduous Bor. (PAID = 3) + ! Deciduous Broadleaf For. (ID = 6) | + ! Evergreen Broadleaf For. (ID = 7) | + ! Tall Grasses and Shrubs (ID = 8) | + ! Bare Desert (ID = 9) | Not veg. \ Ice (PAID = 0\LUID = 2) + ! Upland Tundra (ID = 10) | Broadleaf Deciduous Bore. (PAID = 11) + ! Irrigated Grassland (ID = 11) | C3 Irrigated (PAID = 16) + ! Semi Desert (ID = 12) | + ! Glacier ice (ID = 13) | Land ice (LUID = 2) + ! Wooded Wet Swamp (ID = 14) | + ! - (ID = 15) | + ! - (ID = 16) | + ! Shrub Evergreen (ID = 17) | + ! - (ID = 18) | + ! Shrub Deciduous (ID = 19) | + ! Evergreen Forest and Fi. (ID = 20) | + ! Cool Rain Forest (ID = 21) | + ! Conifer Boreal Forest (ID = 22) | Needleleaf Evergreen Bor. (PAID = 2) + ! Cool Conifer Forest (ID = 23) | + ! Cool Mixed Forest (ID = 24) | Broadleaf Deciduous Bore. (PAID = 8) + ! Mixed Forest (ID = 25) | + ! Cool Broadleaf Forest (ID = 26) | Broadleaf Deciduous Temp. (PAID = 7) + ! Deciduous Broadleaf For. (ID = 27) | + ! Conifer Forest (ID = 28) | Needleleaf Evergreen Tem. (PAID = 1) + ! Montane Tropical Forests (ID = 29) | + ! Seasonal Tropical Fores. (ID = 30) | + ! Cool Crops and Towns (ID = 31) | Winter Temp. Cereal (PAID = 19) + ! Crops and Town (ID = 32) | C3 Crop (PAID = 15) + ! | Spring Temp. Cereal (PAID = 18) + ! Dry Tropical Woods (ID = 33) | + ! Tropical Rainforest (ID = 34) | Broadleaf Evergreen Trop. (PAID = 4) + ! Tropical Degraded Forest (ID = 35) | + ! Corn and Beans Cropland (ID = 36) | Corn (PAID = 17) + ! | Soybean (PAID = 20) + ! Rice Paddy and Field (ID = 37) | + ! Hot Irrigated Cropland (ID = 38) | + ! Cool Irrigated Cropland (ID = 39) | + ! - (ID = 40) | + ! Cool Grasses and Shrubs (ID = 41) | + ! Hot and Mild Grasses and (ID = 42) | C3 Non-Arctic Grass (PAID = 13) + ! Cold Grassland (ID = 43) | C3 Arctic Grass (PAID = 12) + ! Savanna (Woods) (ID = 44) | Broadleaf Deciduous Trop. (PAID = 6) + ! | C4 Grass (PAID = 14) + ! Mire, Bog, Fen (ID = 45) | Wetland - Not Applied (LUID = 5) + ! Marsh Wetland (ID = 46) | + ! Mediterranean Scrub (ID = 47) | Broadleaf Evergreen Shru. (PAID = 9) + ! Dry Woody Scrub (ID = 48) | + ! - (ID = 49) | + ! - (ID = 50) | + ! - (ID = 51) | + ! Semi Desert Shrubs (ID = 52) | Broadleaf Deciduous Temp. (PAID = 10) + ! Semi Desert Sage (ID = 53) | + ! Barren Tundra (ID = 54) | + ! Cool Southern Hemisphere (ID = 55) | Broadleaf Evergreen Temp. (PAID = 5) + ! Cool Fields and Woods (ID = 56) | + ! Forest and Field (ID = 57) | + ! Cool Forest and Field (ID = 58) | + ! Fields and Woody Savanna (ID = 59) | + ! Succulent and Thorn Scr. (ID = 60) | + ! Small Leaf Mixed Woods (ID = 61) | + ! Deciduous and Mixed Bor. (ID = 62) | + ! Narrow Conifers (ID = 63) | + ! Wooded Tundra (ID = 64) | + ! Heath Scrub (ID = 65) | + ! - (ID = 66) | + ! - (ID = 67) | + ! - (ID = 68) | + ! - (ID = 69) | + ! Polar and Alpine Desert (ID = 70) | + ! - (ID = 71) | + ! - (ID = 72) | + ! Mangrove (ID = 73) | + + !================================================================== + ! The urban and wetland land unit types seem to be already + ! accounted for in patches, as it introduces total land fractions + ! (summed over all types) greater than 100%. + ! Thibaud M. Fritz - 06 May 2020 + !================================================================== + + DO J = 1, nY + waterFrac = cam_in%ocnFrac(J) + cam_in%iceFrac(J) & + + cam_in%lwtgcell(J,3) + cam_in%lwtgcell(J,4) + landFrac = 1.0e+0_fp - waterFrac + + ! Initialize fraction land for this grid cell + State_Met%LandTypeFrac(1,J, 1) = waterFrac + !State_Met%LandTypeFrac(1,J, 2) = cam_in%lwtgcell(J, 6) + State_Met%LandTypeFrac(1,J, 9) = cam_in%pwtgcell(J, 1) & + - cam_in%lwtgcell(J, 2) + State_Met%LandTypeFrac(1,J,10) = cam_in%pwtgcell(J,12) + State_Met%LandTypeFrac(1,J,13) = cam_in%lwtgcell(J, 2) + State_Met%LandTypeFrac(1,J,24) = cam_in%pwtgcell(J, 9) + State_Met%LandTypeFrac(1,J,26) = cam_in%pwtgcell(J, 8) + !State_Met%LandTypeFrac(1,J,45) = cam_in%lwtgcell(J, 5) + State_Met%LandTypeFrac(1,J,52) = cam_in%pwtgcell(J,11) + State_Met%LandTypeFrac(1,J,47) = cam_in%pwtgcell(J,10) + State_Met%LandTypeFrac(1,J,55) = cam_in%pwtgcell(J, 6) + State_Met%LandTypeFrac(1,J,34) = cam_in%pwtgcell(J, 5) + State_Met%LandTypeFrac(1,J,43) = cam_in%pwtgcell(J,13) + State_Met%LandTypeFrac(1,J,42) = cam_in%pwtgcell(J,14) + State_Met%LandTypeFrac(1,J,32) = cam_in%pwtgcell(J,16) + State_Met%LandTypeFrac(1,J,44) = cam_in%pwtgcell(J,15) + State_Met%LandTypeFrac(1,J, 5) = cam_in%pwtgcell(J, 4) + State_Met%LandTypeFrac(1,J,22) = cam_in%pwtgcell(J, 3) + State_Met%LandTypeFrac(1,J,28) = cam_in%pwtgcell(J, 2) + State_Met%LandTypeFrac(1,J,44) = & + State_Met%LandTypeFrac(1,J,44) + cam_in%pwtgcell(J, 7) + State_Met%LandTypeFrac(1,J,11) = cam_in%pwtgcell(J,17) + State_Met%LandTypeFrac(1,J,36) = cam_in%pwtgcell(J,18) + State_Met%LandTypeFrac(1,J,31) = cam_in%pwtgcell(J,20) + State_Met%LandTypeFrac(1,J,32) = & + State_Met%LandTypeFrac(1,J,32) + cam_in%pwtgcell(J,19) + State_Met%LandTypeFrac(1,J,36) = & + State_Met%LandTypeFrac(1,J,36) + cam_in%pwtgcell(J,21) + + State_Met%XLAI_NATIVE(1,J,10) = cam_in%lai(J,12) + State_Met%XLAI_NATIVE(1,J,24) = cam_in%lai(J, 9) + State_Met%XLAI_NATIVE(1,J,26) = cam_in%lai(J, 8) + State_Met%XLAI_NATIVE(1,J,52) = cam_in%lai(J,11) + State_Met%XLAI_NATIVE(1,J,47) = cam_in%lai(J,10) + State_Met%XLAI_NATIVE(1,J,55) = cam_in%lai(J, 6) + State_Met%XLAI_NATIVE(1,J,34) = cam_in%lai(J, 5) + State_Met%XLAI_NATIVE(1,J,43) = cam_in%lai(J,13) + State_Met%XLAI_NATIVE(1,J,42) = cam_in%lai(J,14) + State_Met%XLAI_NATIVE(1,J,32) = cam_in%lai(J,16) + State_Met%XLAI_NATIVE(1,J,44) = cam_in%lai(J,15) + State_Met%XLAI_NATIVE(1,J, 5) = cam_in%lai(J, 4) + State_Met%XLAI_NATIVE(1,J,22) = cam_in%lai(J, 3) + State_Met%XLAI_NATIVE(1,J,28) = cam_in%lai(J, 2) + State_Met%XLAI_NATIVE(1,J,44) = & + State_Met%XLAI_NATIVE(1,J,44) + cam_in%lai(J, 7) + State_Met%XLAI_NATIVE(1,J,11) = cam_in%lai(J,17) + State_Met%XLAI_NATIVE(1,J,36) = cam_in%lai(J,18) + State_Met%XLAI_NATIVE(1,J,31) = cam_in%lai(J,20) + State_Met%XLAI_NATIVE(1,J,32) = & + State_Met%XLAI_NATIVE(1,J,32) + cam_in%lai(J,19) + State_Met%XLAI_NATIVE(1,J,36) = & + State_Met%XLAI_NATIVE(1,J,36) + cam_in%lai(J,21) + + DO T = 2, NSURFTYPE + State_Met%LandTypeFrac(1,J,T) = & + State_Met%LandTypeFrac(1,J,T) * landFrac + + State_Met%XLAI_NATIVE(1,J,T) = & + State_Met%XLAI_NATIVE(1,J,T) * landFrac + + ! Make sure that the land type fractions do not exceed 1 + IF ( State_Met%LandTypeFrac(1,J,T) > 1.0e+0_fp ) THEN + State_Met%LandTypeFrac(1,J,T) = 1.0e+0_fp + ELSEIF ( State_Met%LandTypeFrac(1,J,T) < 0.0e+0_fp ) THEN + State_Met%LandTypeFrac(1,J,T) = 0.0e+0_fp + ENDIF + ENDDO + + ENDDO +#elif defined( CLM45 ) || defined( CLM50 ) +#else + CALL endrun('Cannot figure out which version of CLM') +#endif + + END SUBROUTINE getLandTypes +!EOC diff --git a/src/chemistry/pp_geoschem/mo_apex.F90 b/src/chemistry/pp_geoschem/mo_apex.F90 new file mode 100644 index 0000000000..0737f7e278 --- /dev/null +++ b/src/chemistry/pp_geoschem/mo_apex.F90 @@ -0,0 +1,314 @@ +module mo_apex + +!------------------------------------------------------------------------------- +! Purpose: +! +! Calculate apex coordinates and magnetic field magnitudes +! at global geographic grid for year of current model run. +! +! Method: +! +! The magnetic field parameters output by this module are time and height +! independent. They are chunked for waccm physics, i.e., allocated as +! (pcols,begchunk:endchunk) +! Interface sub apexmag is called once per run from sub inti. +! Sub apexmag may be called for years 1900 through 2005. +! This module is dependent on routines in apex_subs.F (modified IGRF model). +! Apex_subs has several authors, but has been modified and maintained +! in recent years by Roy Barnes (bozo@ucar.edu). +! Subs apxmka and apxmall are called with the current lat x lon grid +! resolution. +! +! Author: Ben Foster, foster@ucar.edu (Nov, 2003) +!------------------------------------------------------------------------------- + + use shr_kind_mod, only: r8 => shr_kind_r8 + use ppgrid, only: pcols, begchunk, endchunk ! physics grid + use cam_abortutils, only: endrun + use cam_logfile, only: iulog + use spmd_utils, only: masterproc + !use apex, only: apex_mka, apex_mall, apex_dypol, apex_set_igrf + !use apex, only: apex_beg_yr, apex_end_yr + implicit none + + private + public :: mo_apex_readnl + public :: mo_apex_init + public :: mo_apex_init1 + public :: alatm, alonm, bnorth, beast, bdown, bmag + public :: d1vec, d2vec, colatp, elonp + public :: maglon0 ! geographic longitude at the equator where geomagnetic longitude is zero (radians) + + ! year to initialize apex + real(r8), public, protected :: geomag_year = -1._r8 + logical, public, protected :: geomag_year_updated = .true. + + integer :: fixed_geomag_year = -1 + +!------------------------------------------------------------------------------- +! Magnetic field output arrays, chunked for physics: +! (these are allocated (pcols,begchunk:endchunk) by sub allocate_arrays) +!------------------------------------------------------------------------------- + real(r8), protected, allocatable, dimension(:,:) :: & ! (pcols,begchunk:endchunk) + alatm, & ! apex mag latitude at each geographic grid point (radians) + alonm, & ! apex mag longitude at each geographic grid point (radians) + bnorth, & ! northward component of magnetic field + beast, & ! eastward component of magnetic field + bdown, & ! downward component of magnetic field + bmag ! magnitude of magnetic field + real(r8), protected, allocatable, dimension(:,:,:) :: & ! (3,pcols,begchunk:endchunk) + d1vec, & ! base vectors more-or-less magnetic eastward direction + d2vec ! base vectors more-or-less magnetic downward/equatorward direction + real(r8), protected :: & + colatp, & ! geocentric colatitude of geomagnetic dipole north pole (deg) + elonp ! East longitude of geomagnetic dipole north pole (deg) + + real(r8), protected :: maglon0 + + character(len=256) :: igrf_geomag_coefs_file = 'igrf_geomag_coefs_file' + +contains + +!====================================================================== +!====================================================================== +subroutine mo_apex_readnl(nlfile) + + use namelist_utils, only : find_group_name + use units, only : getunit, freeunit + use spmd_utils, only : mpicom, masterprocid, mpi_integer, mpi_character + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + + !! Local variables + !integer :: unitn, ierr + !character(len=*), parameter :: subname = 'mo_apex_readnl' + + !namelist /geomag_nl/ fixed_geomag_year, igrf_geomag_coefs_file + + !! Read namelist + !if (masterproc) then + ! unitn = getunit() + ! open( unitn, file=trim(nlfile), status='old' ) + ! call find_group_name(unitn, 'geomag_nl', status=ierr) + ! if (ierr == 0) then + ! read(unitn, geomag_nl, iostat=ierr) + ! if (ierr /= 0) then + ! call endrun(subname // ':: ERROR reading namelist') + ! end if + ! end if + ! close(unitn) + ! call freeunit(unitn) + !end if + + !! Broadcast namelist variables + !call mpi_bcast(fixed_geomag_year, 1, mpi_integer, masterprocid, mpicom, ierr) + !call mpi_bcast(igrf_geomag_coefs_file, len(igrf_geomag_coefs_file), mpi_character, masterprocid, mpicom, ierr) + +end subroutine mo_apex_readnl + +!====================================================================== +!====================================================================== +subroutine mo_apex_init1() + use time_manager, only: get_curr_date + use dyn_grid, only: get_horiz_grid_dim_d + + +end subroutine mo_apex_init1 + +!====================================================================== +!====================================================================== +subroutine mo_apex_init(phys_state) +!------------------------------------------------------------------------------- +! Driver for apex code to calculate apex magnetic coordinates at +! current geographic spatial resolution for given year. This calls +! routines in apex_subs.F. +! +! This is called once per run from sub inti. +!------------------------------------------------------------------------------- + + use physconst,only : pi + use physics_types, only: physics_state + !use epp_ionization,only: epp_ionization_setmag + + ! Input/output arguments + type(physics_state), intent(in), dimension(begchunk:endchunk) :: phys_state + +!!------------------------------------------------------------------------------- +!! Local variables +!!------------------------------------------------------------------------------- +! real(r8), parameter :: re = 6.378165e8_r8 ! earth radius (cm) +! real(r8), parameter :: h0 = 9.0e6_r8 ! base height (90 km) +! real(r8), parameter :: hs = 1.3e7_r8 +! real(r8), parameter :: eps = 1.e-6_r8 ! epsilon +! real(r8), parameter :: cm2km = 1.e-5_r8 +! +! integer :: c, i, ist ! indices +! integer :: ncol +! +! real(r8) :: alt, hr, alon, alat, & ! apxmall args +! vmp, w, d, be3, sim, xlatqd, f, si, collat, collon +! +!!------------------------------------------------------------------------------- +!! Non-scalar arguments returned by APXMALL: +!!------------------------------------------------------------------------------- +! real(r8) :: bhat(3) +! real(r8) :: d3(3) +! real(r8) :: e1(3), e2(3), e3(3) +! real(r8) :: f1(2), f2(2) +! +! real(r8) :: bg(3), d1g(3), d2g(3), bmg +! +! real(r8) :: rdum +! +! real(r8) :: maglat(pcols,begchunk:endchunk) +! +! real(r8), parameter :: rtd = 180._r8/pi ! radians to degrees +! real(r8), parameter :: dtr = pi/180._r8 ! degrees to radians +! +! call mo_apex_init1() +! if ((.not.geomag_year_updated) .and. (allocated(alatm))) return +! +!!------------------------------------------------------------------------------- +!! Allocate output arrays +!!------------------------------------------------------------------------------- +! call allocate_arrays() +! +! alt = hs*cm2km ! altitude for apxmall (km) +! hr = alt ! reference altitude (km) +! +!!------------------------------------------------------------------------------ +!! Apex coords alon, alat are returned for each geographic grid point: +!! first form global arrays +!!------------------------------------------------------------------------------ +! do c = begchunk, endchunk +! ncol = phys_state(c)%ncol +! do i = 1,ncol +! collat = phys_state(c)%lat(i)*rtd ! latitude of current column (deg) +! collon = phys_state(c)%lon(i)*rtd ! latitude of current column (deg) +! if ( collon < -180._r8 ) collon = collon+360._r8 +! if ( collon > 180._r8 ) collon = collon-360._r8 +! call apex_mall( & +! collat, collon, alt, hr, & ! Inputs +! bg, bhat, bmag(i,c), si, & ! Mag Fld +! alon, alat, & ! Apex lon,lat output +! vmp, w, d, be3, sim, d1vec(:,i,c), d2vec(:,i,c), d3, e1, e2, e3, & ! Mod Apex +! xlatqd, f, f1, f2, ist ) ! Qsi-Dpl +! if( ist /= 0 ) then +! write(iulog,"(/,'>>> mo_apex_init: Error from apxmall: ist=',i4)") ist +! call endrun('mo_apex_init: Error from apxmall') +! end if +! beast (i,c) = bg(1) +! bnorth(i,c) = bg(2) +! bdown (i,c) = -bg(3) +! alonm (i,c) = alon*dtr ! mag lons (radians) +! alatm (i,c) = alat*dtr ! mag lats (radians) +! maglat(i,c) = alat ! mag lats (degrees) +! enddo +! enddo +! +! ! find geograghic latitude ( maglon0 ) where the geomagnetic latitude is zero at the equator +! ! by first extracting the geographic coordinates at zero degrees longitude ... +! collat = 0._r8 +! collon = 0._r8 +! call apex_mall( & +! collat, collon, alt, hr, & ! Inputs +! bg, bhat, bmg, si, & ! Mag Fld +! alon, alat, & ! Apex lon,lat output +! vmp, w, d, be3, sim, d1g, d2g, d3, e1, e2, e3, & ! Mod Apex +! xlatqd, f, f1, f2, ist ) ! Qsi-Dpl +! +! if( ist /= 0 ) then +! write(iulog,"(/,'>>> mo_apex_init: Error from apxmall: ist=',i4)") ist +! call endrun('mo_apex_init: Error from apxmall') +! end if +! +! maglon0 = -alon*dtr ! (radians) geograghic latitude where the geomagnetic latitude is zero +! ! where longitude ranges from -180E to 180E +! +! call apex_dypol( colatp, elonp, rdum ) ! get geomagnetic dipole north pole +! +! if (masterproc) then +! write(iulog, "('mo_apex_init: colatp,elonp ', 2f12.6)") colatp, elonp +! write(iulog, "('mo_apex_init: Calculated apex magnetic coordinates for year AD ',f8.2)") geomag_year +! endif +! +! call epp_ionization_setmag(maglat) + +end subroutine mo_apex_init + +subroutine allocate_arrays +!!------------------------------------------------------------------------------ +!! Allocate module output arrays for chunked physics grid. +!!------------------------------------------------------------------------------ +! +!!------------------------------------------------------------------------------ +!! local variables +!!------------------------------------------------------------------------------ +! integer :: istat ! status of allocate statements +! +! if (.not.allocated(alatm)) then +! allocate(alatm(pcols,begchunk:endchunk),stat=istat) +! if (istat /= 0) then +! write(iulog,"('>>> allocate_arrays: allocate of alatm failed: istat=',i5)") istat +! call endrun +! end if +! end if +! +! if (.not.allocated(alonm)) then +! allocate(alonm(pcols,begchunk:endchunk),stat=istat) +! if (istat /= 0) then +! write(iulog,"('>>> allocate_arrays: allocate of alonm failed: istat=',i5)") istat +! call endrun +! end if +! end if +! +! if (.not.allocated(bnorth)) then +! allocate(bnorth(pcols,begchunk:endchunk),stat=istat) +! if (istat /= 0) then +! write(iulog,"('>>> allocate_arrays: allocate of bnorth failed: istat=',i5)") istat +! call endrun +! end if +! end if +! +! if (.not.allocated(beast)) then +! allocate(beast(pcols,begchunk:endchunk),stat=istat) +! if (istat /= 0) then +! write(iulog,"('>>> allocate_arrays: allocate of beast failed: istat=',i5)") istat +! call endrun +! end if +! end if +! +! if (.not.allocated(bdown)) then +! allocate(bdown(pcols,begchunk:endchunk),stat=istat) +! if (istat /= 0) then +! write(iulog,"('>>> allocate_arrays: allocate of bdown failed: istat=',i5)") istat +! call endrun +! end if +! end if +! +! if (.not.allocated(bmag)) then +! allocate(bmag(pcols,begchunk:endchunk),stat=istat) +! if (istat /= 0) then +! write(iulog,"('>>> allocate_arrays: allocate of bmag failed: istat=',i5)") istat +! call endrun +! end if +! end if +! if (.not.allocated(d1vec)) then +! allocate(d1vec(3,pcols,begchunk:endchunk),stat=istat) +! if (istat /= 0) then +! write(iulog,"('>>> allocate_arrays: allocate of d1vec failed: istat=',i5)") istat +! call endrun +! endif +! endif +! +! if (.not.allocated(d2vec)) then +! allocate(d2vec(3,pcols,begchunk:endchunk),stat=istat) +! if (istat /= 0) then +! write(iulog,"('>>> allocate_arrays: allocate of d2vec failed: istat=',i5)") istat +! call endrun +! endif +! endif +! +end subroutine allocate_arrays + +end module mo_apex diff --git a/src/chemistry/pp_geoschem/mo_chem_utls.F90 b/src/chemistry/pp_geoschem/mo_chem_utls.F90 new file mode 100644 index 0000000000..1d709c09dc --- /dev/null +++ b/src/chemistry/pp_geoschem/mo_chem_utls.F90 @@ -0,0 +1,162 @@ + +module mo_chem_utls + + private + public :: get_spc_ndx!, get_het_ndx, get_extfrc_ndx, get_rxt_ndx, get_inv_ndx + + save + +contains + + integer function get_spc_ndx( spc_name ) + !----------------------------------------------------------------------- + ! ... return overall species index associated with spc_name + !----------------------------------------------------------------------- + + use chem_mods, only : nTracers, tracnam => tracerNames + use string_utils, only : to_upper + + implicit none + + !----------------------------------------------------------------------- + ! ... dummy arguments + !----------------------------------------------------------------------- + character(len=*), intent(in) :: spc_name + + !----------------------------------------------------------------------- + ! ... local variables + !----------------------------------------------------------------------- + integer :: m + + get_spc_ndx = -1 + do m = 1, nTracers + if( trim( spc_name ) == trim( to_upper( tracnam(m) ) ) ) then + get_spc_ndx = m + exit + end if + end do + + end function get_spc_ndx + +! integer function get_inv_ndx( invariant ) +! !----------------------------------------------------------------------- +! ! ... return overall external frcing index associated with spc_name +! !----------------------------------------------------------------------- +! +! use chem_mods, only : nfs, inv_lst +! +! implicit none +! +! !----------------------------------------------------------------------- +! ! ... dummy arguments +! !----------------------------------------------------------------------- +! character(len=*), intent(in) :: invariant +! +! !----------------------------------------------------------------------- +! ! ... local variables +! !----------------------------------------------------------------------- +! integer :: m +! +! get_inv_ndx = -1 +! do m = 1,nfs +! if( trim( invariant ) == trim( inv_lst(m) ) ) then +! get_inv_ndx = m +! exit +! end if +! end do +! +! end function get_inv_ndx +! +! integer function get_het_ndx( het_name ) +! !----------------------------------------------------------------------- +! ! ... return overall het process index associated with spc_name +! !----------------------------------------------------------------------- +! +! use gas_wetdep_opts,only : gas_wetdep_method, gas_wetdep_list, gas_wetdep_cnt +! +! implicit none +! +! !----------------------------------------------------------------------- +! ! ... dummy arguments +! !----------------------------------------------------------------------- +! character(len=*), intent(in) :: het_name +! +! !----------------------------------------------------------------------- +! ! ... local variables +! !----------------------------------------------------------------------- +! integer :: m +! +! get_het_ndx=-1 +! +! do m=1,gas_wetdep_cnt +! +! if( trim( het_name ) == trim( gas_wetdep_list(m) ) ) then +! get_het_ndx = get_spc_ndx( gas_wetdep_list(m) ) +! return +! endif +! +! enddo +! +! end function get_het_ndx +! +! integer function get_extfrc_ndx( frc_name ) +! !----------------------------------------------------------------------- +! ! ... return overall external frcing index associated with spc_name +! !----------------------------------------------------------------------- +! +! use chem_mods, only : extcnt, extfrc_lst +! +! implicit none +! +! !----------------------------------------------------------------------- +! ! ... dummy arguments +! !----------------------------------------------------------------------- +! character(len=*), intent(in) :: frc_name +! +! !----------------------------------------------------------------------- +! ! ... local variables +! !----------------------------------------------------------------------- +! integer :: m +! +! get_extfrc_ndx = -1 +! if( extcnt > 0 ) then +! do m = 1,max(1,extcnt) +! if( trim( frc_name ) == trim( extfrc_lst(m) ) ) then +! get_extfrc_ndx = m +! exit +! end if +! end do +! end if +! +! end function get_extfrc_ndx +! +! integer function get_rxt_ndx( rxt_tag ) +! !----------------------------------------------------------------------- +! ! ... return overall external frcing index associated with spc_name +! !----------------------------------------------------------------------- +! +! use chem_mods, only : rxt_tag_cnt, rxt_tag_lst, rxt_tag_map +! +! implicit none +! +! !----------------------------------------------------------------------- +! ! ... dummy arguments +! !----------------------------------------------------------------------- +! character(len=*), intent(in) :: rxt_tag +! +! !----------------------------------------------------------------------- +! ! ... local variables +! !----------------------------------------------------------------------- +! integer :: m +! +! get_rxt_ndx = -1 +! do m = 1,rxt_tag_cnt +! if( trim( rxt_tag ) == trim( rxt_tag_lst(m) ) ) then +! get_rxt_ndx = rxt_tag_map(m) +! exit +! end if +! end do +! +! end function get_rxt_ndx + +end module mo_chem_utls diff --git a/src/chemistry/pp_geoschem/mo_drydep.F90 b/src/chemistry/pp_geoschem/mo_drydep.F90 new file mode 100644 index 0000000000..50656ef30b --- /dev/null +++ b/src/chemistry/pp_geoschem/mo_drydep.F90 @@ -0,0 +1,3303 @@ +module mo_drydep + + !--------------------------------------------------------------------- + ! ... Dry deposition velocity input data and code for netcdf input + !--------------------------------------------------------------------- + +!LKE (10/11/2010): added HCN, CH3CN, HCOOH +!LKE (7/30/2015): added new TS1 species (phenooh, iepox, noa, etc.) + + use shr_kind_mod, only : r8 => shr_kind_r8, shr_kind_cl + !use chem_mods, only : gas_pcnst !This needs to be replaced by nTracersMax + use pmgrid, only : plev, plevp + use spmd_utils, only : masterproc, iam + use ppgrid, only : pcols, begchunk, endchunk + !use mo_tracname, only : solsym !This is replaced by tracerNames + use chem_mods, only : tracerNames, nTracersMax, nTracers, drySpc_ndx + use cam_abortutils, only : endrun + use ioFileMod, only : getfil + use pio + use cam_pio_utils, only : cam_pio_openfile, cam_pio_closefile + use cam_logfile, only : iulog + use dyn_grid, only : get_dyn_grid_parm, get_horiz_grid_d + use scamMod, only : single_column + + use seq_drydep_mod, only : nddvels => n_drydep, drydep_list, mapping + use physconst, only : karman + + use State_Chm_Mod, only : ChmState ! Derived type for Chemistry State object + + implicit none + + save + + interface drydep_inti + module procedure dvel_inti_table + module procedure dvel_inti_xactive + module procedure dvel_inti_fromlnd + end interface + + interface drydep + !module procedure drydep_table + module procedure drydep_xactive + module procedure drydep_fromlnd + end interface + + private + public :: drydep_inti, drydep, set_soilw, chk_soilw, has_drydep + public :: drydep_update + public :: drydep_fromlnd + public :: n_land_type, fraction_landuse, drydep_srf_file + + real(r8) :: dels + real(r8), allocatable :: days(:) ! day of year for soilw + real(r8), allocatable :: dvel(:,:,:,:) ! depvel array interpolated to model grid + real(r8), allocatable :: dvel_interp(:,:,:) ! depvel array interpolated to grid and time + integer :: last, next ! day indicies + integer :: ndays ! # of days in soilw file + !integer :: map(gas_pcnst) ! indices for drydep species + integer :: map(nTracersMax) ! indices for drydep species + integer :: nspecies ! number of depvel species in input file + + integer :: pan_ndx, mpan_ndx, no2_ndx, hno3_ndx, o3_ndx, & + h2o2_ndx, onit_ndx, onitr_ndx, ch4_ndx, ch2o_ndx, & + ch3ooh_ndx, pooh_ndx, ch3coooh_ndx, c2h5ooh_ndx, eooh_ndx, & + c3h7ooh_ndx, rooh_ndx, ch3cocho_ndx, co_ndx, ch3coch3_ndx, & + no_ndx, ho2no2_ndx, glyald_ndx, hyac_ndx, ch3oh_ndx, c2h5oh_ndx, & + hydrald_ndx, h2_ndx, Pb_ndx, o3s_ndx, o3inert_ndx, macrooh_ndx, & + xooh_ndx, ch3cho_ndx, isopooh_ndx + integer :: alkooh_ndx, mekooh_ndx, tolooh_ndx, terpooh_ndx, ch3cooh_ndx + integer :: soa_ndx, so4_ndx, cb1_ndx, cb2_ndx, oc1_ndx, oc2_ndx, nh3_ndx, nh4no3_ndx, & + sa1_ndx, sa2_ndx, sa3_ndx, sa4_ndx, nh4_ndx + integer :: soam_ndx, soai_ndx, soat_ndx, soab_ndx, soax_ndx, & + sogm_ndx, sogi_ndx, sogt_ndx, sogb_ndx, sogx_ndx + + logical :: alkooh_dd, mekooh_dd, tolooh_dd, terpooh_dd, ch3cooh_dd + logical :: soa_dd, so4_dd, cb1_dd, cb2_dd, oc1_dd, oc2_dd, nh3_dd, nh4no3_dd, & + sa1_dd, sa2_dd, sa3_dd, sa4_dd, nh4_dd + logical :: soam_dd, soai_dd, soat_dd, soab_dd, soax_dd, & + sogm_dd, sogi_dd, sogt_dd, sogb_dd, sogx_dd + + logical :: pan_dd, mpan_dd, no2_dd, hno3_dd, o3_dd, isopooh_dd, ch4_dd,& + h2o2_dd, onit_dd, onitr_dd, ch2o_dd, macrooh_dd, xooh_dd, & + ch3ooh_dd, pooh_dd, ch3coooh_dd, c2h5ooh_dd, eooh_dd, ch3cho_dd, c2h5oh_dd, & + c3h7ooh_dd, rooh_dd, ch3cocho_dd, co_dd, ch3coch3_dd, & + glyald_dd, hyac_dd, ch3oh_dd, hydrald_dd, h2_dd, Pb_dd, o3s_dd, o3inert_dd + + integer :: so2_ndx + integer :: ch3cn_ndx, hcn_ndx, hcooh_ndx + logical :: ch3cn_dd, hcn_dd, hcooh_dd + + integer :: o3a_ndx,xpan_ndx,xmpan_ndx,xno2_ndx,xhno3_ndx,xonit_ndx,xonitr_ndx,xno_ndx,xho2no2_ndx,xnh4no3_ndx + logical :: o3a_dd, xpan_dd, xmpan_dd, xno2_dd, xhno3_dd, xonit_dd, xonitr_dd, xno_dd, xho2no2_dd, xnh4no3_dd + +!lke-TS1 + integer :: phenooh_ndx, benzooh_ndx, c6h5ooh_ndx, bzooh_ndx, xylolooh_ndx, xylenooh_ndx + integer :: terp2ooh_ndx, terprod1_ndx, terprod2_ndx, hmprop_ndx, mboooh_ndx, hpald_ndx, iepox_ndx + integer :: noa_ndx, alknit_ndx, isopnita_ndx, isopnitb_ndx, honitr_ndx, isopnooh_ndx + integer :: nc4cho_ndx, nc4ch2oh_ndx, terpnit_ndx, nterpooh_ndx + logical :: phenooh_dd, benzooh_dd, c6h5ooh_dd, bzooh_dd, xylolooh_dd, xylenooh_dd + logical :: terp2ooh_dd, terprod1_dd, terprod2_dd, hmprop_dd, mboooh_dd, hpald_dd, iepox_dd + logical :: noa_dd, alknit_dd, isopnita_dd, isopnitb_dd, honitr_dd, isopnooh_dd + logical :: nc4cho_dd, nc4ch2oh_dd, terpnit_dd, nterpooh_dd + + integer :: cohc_ndx=-1, come_ndx=-1 + integer, parameter :: NTAGS = 50 + integer :: cotag_ndx(NTAGS) + integer :: tag_cnt + + integer :: & + o3_tab_ndx = -1, & + h2o2_tab_ndx = -1, & + ch3ooh_tab_ndx = -1, & + co_tab_ndx = -1, & + ch3cho_tab_ndx = -1 + logical :: & + o3_in_tab = .false., & + h2o2_in_tab = .false., & + ch3ooh_in_tab = .false., & + co_in_tab = .false., & + ch3cho_in_tab = .false. + + real(r8), parameter :: small_value = 1.e-36_r8 + real(r8), parameter :: large_value = 1.e36_r8 + real(r8), parameter :: diffm = 1.789e-5_r8 + real(r8), parameter :: diffk = 1.461e-5_r8 + real(r8), parameter :: difft = 2.060e-5_r8 + real(r8), parameter :: vonkar = karman + real(r8), parameter :: ric = 0.2_r8 + real(r8), parameter :: r = 287.04_r8 + real(r8), parameter :: cp = 1004._r8 + real(r8), parameter :: grav = 9.81_r8 + real(r8), parameter :: p00 = 100000._r8 + real(r8), parameter :: wh2o = 18.0153_r8 + real(r8), parameter :: ph = 1.e-5_r8 + real(r8), parameter :: ph_inv = 1._r8/ph + real(r8), parameter :: rovcp = r/cp + + integer, pointer :: index_season_lai(:,:) + + !logical, public :: has_dvel(gas_pcnst) = .false. + !integer :: map_dvel(gas_pcnst) = 0 + logical, public :: has_dvel(nTracersMax) = .false. + integer :: map_dvel(nTracersMax) = 0 + real(r8) , allocatable :: soilw_3d(:,:,:) + + logical, parameter :: dyn_soilw = .false. + + real(r8), allocatable :: fraction_landuse(:,:,:) + real(r8), allocatable, dimension(:,:,:) :: dep_ra ! [s/m] aerodynamic resistance + real(r8), allocatable, dimension(:,:,:) :: dep_rb ! [s/m] resistance across sublayer + integer, parameter :: n_land_type = 11 + + real(r8), public :: crb + + type lnd_dvel_type + real(r8), pointer :: dvel(:,:) ! deposition velocity over land (cm/s) + end type lnd_dvel_type + + type(lnd_dvel_type), allocatable :: lnd(:) + character(len=SHR_KIND_CL) :: drydep_srf_file + +contains + + !--------------------------------------------------------------------------- + !--------------------------------------------------------------------------- + subroutine dvel_inti_fromlnd + use cam_abortutils, only : endrun + use seq_drydep_mod, only : dfoxd + + implicit none + + allocate( lnd(begchunk:endchunk) ) + + crb = (difft/diffm)**(2._r8/3._r8) !.666666_r8 + + endsubroutine dvel_inti_fromlnd + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + subroutine drydep_update( state, cam_in ) + use physics_types, only : physics_state + use camsrfexch, only : cam_in_t + use seq_drydep_mod, only : drydep_method, DD_XLND + + type(physics_state), intent(in) :: state ! Physics state variables + type(cam_in_t), intent(in) :: cam_in + integer :: ispec + + if (nddvels<1) return + if (drydep_method /= DD_XLND) return + + lnd(state%lchnk)%dvel => cam_in%depvel + + end subroutine drydep_update + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + subroutine drydep_fromlnd( ocnfrac, icefrac, ncdate, sfc_temp, pressure_sfc, & + wind_speed, spec_hum, air_temp, pressure_10m, rain, & + snow, solar_flux, dvelocity, dflx, State_Chm, & + tv, soilw, rh, ncol, lonndx, latndx, lchnk ) + + !------------------------------------------------------------------------------------- + ! combines the deposition velocities provided by the land model with deposition + ! velocities over ocean and sea ice + !------------------------------------------------------------------------------------- + + use ppgrid, only : pcols + +#if (defined OFFLINE_DYN) + use metdata, only: get_met_fields +#endif + + implicit none + + !------------------------------------------------------------------------------------- + ! ... dummy arguments + !------------------------------------------------------------------------------------- + + real(r8), intent(in) :: icefrac(pcols) + real(r8), intent(in) :: ocnfrac(pcols) + + integer, intent(in) :: ncol + integer, intent(in) :: ncdate ! present date (yyyymmdd) + real(r8), intent(in) :: sfc_temp(pcols) ! surface temperature (K) + real(r8), intent(in) :: pressure_sfc(pcols) ! surface pressure (Pa) + real(r8), intent(in) :: wind_speed(pcols) ! 10 meter wind speed (m/s) + real(r8), intent(in) :: spec_hum(pcols) ! specific humidity (kg/kg) + real(r8), intent(in) :: rh(ncol,1) ! relative humidity + real(r8), intent(in) :: air_temp(pcols) ! surface air temperature (K) + real(r8), intent(in) :: pressure_10m(pcols) ! 10 meter pressure (Pa) + real(r8), intent(in) :: rain(pcols) + real(r8), intent(in) :: snow(pcols) ! snow height (m) + real(r8), intent(in) :: soilw(pcols) ! soil moisture fraction + real(r8), intent(in) :: solar_flux(pcols) ! direct shortwave radiation at surface (W/m^2) + real(r8), intent(in) :: tv(pcols) ! potential temperature + type(ChmState), intent(in):: State_Chm ! GEOS-Chem State Chem + real(r8), intent(out) :: dvelocity(ncol,nTracersMax) ! deposition velocity (cm/s) + real(r8), intent(inout) :: dflx(pcols,nTracersMax) ! deposition flux (/cm^2/s) + + integer, intent(in) :: latndx(pcols) ! chunk latitude indicies + integer, intent(in) :: lonndx(pcols) ! chunk longitude indicies + integer, intent(in) :: lchnk ! chunk number + + !------------------------------------------------------------------------------------- + ! ... local variables + !------------------------------------------------------------------------------------- + real(r8) :: ocnice_dvel(ncol,nTracersMax) + real(r8) :: ocnice_dflx(pcols,nTracersMax) + + real(r8), dimension(ncol) :: term ! work array + integer :: ispec + real(r8) :: lndfrac(pcols) +#if (defined OFFLINE_DYN) + real(r8) :: met_ocnfrac(pcols) + real(r8) :: met_icefrac(pcols) +#endif + integer :: i + + lndfrac(:ncol) = 1._r8 - ocnfrac(:ncol) - icefrac(:ncol) + + where( lndfrac(:ncol) < 0._r8 ) + lndfrac(:ncol) = 0._r8 + endwhere + +#if (defined OFFLINE_DYN) + call get_met_fields(lndfrac, met_ocnfrac, met_icefrac, lchnk, ncol) +#endif + + !------------------------------------------------------------------------------------- + ! ... initialize + !------------------------------------------------------------------------------------- + dvelocity(:,:) = 0._r8 + + !------------------------------------------------------------------------------------- + ! ... compute the dep velocities over ocean and sea ice + ! land type 7 is used for ocean + ! land type 8 is used for sea ice + !------------------------------------------------------------------------------------- + call drydep_xactive( ncdate, sfc_temp, pressure_sfc, & + wind_speed, spec_hum, air_temp, pressure_10m, rain, & + snow, solar_flux, ocnice_dvel, ocnice_dflx, & + State_Chm, tv, soilw, & + rh, ncol, lonndx, latndx, lchnk, & +#if (defined OFFLINE_DYN) + ocnfrc=met_ocnfrac,icefrc=met_icefrac, beglandtype=7, endlandtype=8 ) +#else + ocnfrc=ocnfrac,icefrc=icefrac, beglandtype=7, endlandtype=8 ) +#endif + term(:ncol) = 1.e-2_r8 * pressure_10m(:ncol) / (r*tv(:ncol)) + + do ispec = 1, nddvels + !------------------------------------------------------------------------------------- + ! ... merge the land component with the non-land component + ! ocn and ice already have fractions factored in + !------------------------------------------------------------------------------------- + if ( drySpc_ndx(ispec) > 0 ) then + !Write(6,*) " Spec = ", drydep_list(iSpec), lchnk + !Write(6,*) " lndfrac = ", MAXVAL(lndfrac(:)), lchnk + !Write(6,*) " lndfrac = ", MINVAL(lndfrac(:)), lchnk + !Write(6,*) " lndvel = ", MAXVAL(lnd(lchnk)%dvel(:,iSpec)), " [cm/s]", lchnk + !Write(6,*) " ocnvel = ", MAXVAL(ocnice_dvel(:,drySpc_ndx(iSpec))), " [cm/s]", lchnk + dvelocity(:ncol,drySpc_ndx(ispec)) = lnd(lchnk)%dvel(:ncol,ispec)*lndfrac(:ncol) & + + ocnice_dvel(:ncol,drySpc_ndx(ispec)) + !Write(6,*) " dvel = ", MAXVAL(dvelocity(:,drySpc_ndx(iSpec))), " [cm/s]", lchnk + endif + enddo + + !------------------------------------------------------------------------------------- + ! ... special adjustments + !------------------------------------------------------------------------------------- + if( mpan_ndx>0 ) then + dvelocity(:ncol,mpan_ndx) = dvelocity(:ncol,mpan_ndx)/3._r8 + endif + if( xmpan_ndx>0 ) then + dvelocity(:ncol,xmpan_ndx) = dvelocity(:ncol,xmpan_ndx)/3._r8 + endif + if( hcn_ndx>0 ) then + dvelocity(:ncol,hcn_ndx) = ocnice_dvel(:ncol,hcn_ndx) ! should be zero over land + endif + if( ch3cn_ndx>0 ) then + dvelocity(:ncol,ch3cn_ndx) = ocnice_dvel(:ncol,ch3cn_ndx) ! should be zero over land + endif + + ! HCOOH, use CH3COOH dep.vel + if( hcooh_ndx > 0 .and. ch3cooh_ndx > 0 ) then + if( has_dvel(hcooh_ndx) ) then + dvelocity(:ncol,hcooh_ndx) = dvelocity(:ncol,ch3cooh_ndx) + end if + end if + + !------------------------------------------------------------------------------------- + ! ... assign CO tags to CO + ! put this kludge in for now ... + ! -- should be able to set all these via the table mapping in seq_drydep_mod + !------------------------------------------------------------------------------------- + if( cohc_ndx>0 .and. co_ndx>0 ) then + dvelocity(:ncol,cohc_ndx) = dvelocity(:ncol,co_ndx) + dflx(:ncol,cohc_ndx) = dvelocity(:ncol,co_ndx) * term(:ncol) * State_Chm%Species(1,:ncol,plev,cohc_ndx) + endif + if( come_ndx>0 .and. co_ndx>0 ) then + dvelocity(:ncol,come_ndx) = dvelocity(:ncol,co_ndx) + dflx(:ncol,come_ndx) = dvelocity(:ncol,co_ndx) * term(:ncol) * State_Chm%Species(1,:ncol,plev,come_ndx) + endif + + if ( co_ndx>0 ) then + do i=1,tag_cnt + dvelocity(:ncol,cotag_ndx(i)) = dvelocity(:ncol,co_ndx) + dflx(:ncol,cotag_ndx(i)) = dvelocity(:ncol,co_ndx) * term(:ncol) * State_Chm%Species(1,:ncol,plev,cotag_ndx(i)) + enddo + endif + + do ispec = 1,nddvels + !------------------------------------------------------------------------------------- + ! ... compute the deposition flux + !------------------------------------------------------------------------------------- + if ( drySpc_ndx(ispec) > 0 ) then + dflx(:ncol,drySpc_ndx(ispec)) = dvelocity(:ncol,drySpc_ndx(ispec)) * term(:ncol) * State_Chm%Species(1,:ncol,plev,drySpc_ndx(ispec)) + endif + end do + + end subroutine drydep_fromlnd + + !--------------------------------------------------------------------------- + !--------------------------------------------------------------------------- + subroutine dvel_inti_table( depvel_file ) + !--------------------------------------------------------------------------- + ! ... Initialize module, depvel arrays, and a few other variables. + ! The depvel fields will be linearly interpolated to the correct time + !--------------------------------------------------------------------------- + + use mo_constants, only : d2r, r2d + use ioFileMod, only : getfil + use string_utils, only : to_lower, GLC + use mo_chem_utls, only : get_spc_ndx + use constituents, only : pcnst + use chem_mods, only : drySpc_ndx + use interpolate_data, only : lininterp_init, lininterp, lininterp_finish,interp_type + use mo_constants, only : pi + use phys_grid, only : get_ncols_p, get_rlat_all_p, get_rlon_all_p + + implicit none + + character(len=*), intent(in) :: depvel_file + + !--------------------------------------------------------------------------- + ! ... Local variables + !--------------------------------------------------------------------------- + integer :: nlat, nlon, nmonth, ndims + integer :: dimid_lat, dimid_lon, dimid_species, dimid_time + integer :: dimid(4), count(4), start(4) + integer :: m, ispecies, nchar, ierr + real(r8) :: scale_factor + + real(r8), allocatable :: dvel_lats(:), dvel_lons(:) + real(r8), allocatable :: dvel_in(:,:,:,:) ! input depvel array + character(len=50) :: units + character(len=20), allocatable :: species_names(:) ! names of depvel species + logical :: found + type(file_desc_t) :: piofile + type(var_desc_t) :: vid, vid_dvel + + character(len=shr_kind_cl) :: locfn + integer :: mm,n + + integer :: i, c, ncols + real(r8) :: to_lats(pcols), to_lons(pcols) + type(interp_type) :: lon_wgts, lat_wgts + real(r8), parameter :: zero=0._r8, twopi=2._r8*pi + + mm = 1 + do m = 1,pcnst + if ( len_trim(drydep_list(m))==0 ) exit + n = drySpc_ndx(m) + !n = get_spc_ndx(drydep_list(m)) + if ( n < 1 ) then + write(iulog,*) 'drydep_inti: '//drydep_list(m)//' is not included in species set' + call endrun('drydep_init: invalid dry deposition species') + endif + enddo + + if( masterproc ) then + write(iulog,*) 'drydep_inti: following species have dry deposition' + do i=1,nddvels + if( len_trim(drydep_list(i)) > 0 ) then + write(iulog,*) 'drydep_inti: '//trim(drydep_list(i))//' is requested to have dry dep' + endif + enddo + write(iulog,*) 'drydep_inti:' + endif + + if ( nddvels < 1 ) return + + !--------------------------------------------------------------------------- + ! ... Setup species maps + !--------------------------------------------------------------------------- + o3a_ndx = get_spc_ndx( 'O3A') + xpan_ndx = get_spc_ndx( 'XPAN') + xmpan_ndx = get_spc_ndx( 'XMPAN') + xno2_ndx = get_spc_ndx( 'XNO2') + xhno3_ndx = get_spc_ndx( 'XHNO3') + xonit_ndx = get_spc_ndx( 'XONIT') + xonitr_ndx = get_spc_ndx( 'XONITR') + xno_ndx = get_spc_ndx( 'XNO') + xho2no2_ndx = get_spc_ndx( 'XHO2NO2') + o3a_dd = has_drydep( 'O3A') + xpan_dd = has_drydep( 'XPAN') + xmpan_dd = has_drydep( 'XMPAN') + xno2_dd = has_drydep( 'XNO2') + xhno3_dd = has_drydep( 'XHNO3') + xonit_dd = has_drydep( 'XONIT') + xonitr_dd = has_drydep( 'XONITR') + xno_dd = has_drydep( 'XNO') + xho2no2_dd = has_drydep( 'XHO2NO2') + + pan_ndx = get_spc_ndx( 'PAN') + mpan_ndx = get_spc_ndx( 'MPAN') + no2_ndx = get_spc_ndx( 'NO2') + hno3_ndx = get_spc_ndx( 'HNO3') + co_ndx = get_spc_ndx( 'CO') + o3_ndx = get_spc_ndx( 'O3') + if( o3_ndx < 1 ) then + o3_ndx = get_spc_ndx( 'OX') + end if + h2o2_ndx = get_spc_ndx( 'H2O2') + onit_ndx = get_spc_ndx( 'ONIT') + onitr_ndx = get_spc_ndx( 'ONITR') + ch4_ndx = get_spc_ndx( 'CH4') + ch2o_ndx = get_spc_ndx( 'CH2O') + ch3ooh_ndx = get_spc_ndx( 'CH3OOH') + ch3cho_ndx = get_spc_ndx( 'CH3CHO') + ch3cocho_ndx = get_spc_ndx( 'CH3COCHO') + pooh_ndx = get_spc_ndx( 'POOH') + ch3coooh_ndx = get_spc_ndx( 'CH3COOOH') + c2h5ooh_ndx = get_spc_ndx( 'C2H5OOH') + eooh_ndx = get_spc_ndx( 'EOOH') + c3h7ooh_ndx = get_spc_ndx( 'C3H7OOH') + rooh_ndx = get_spc_ndx( 'ROOH') + ch3coch3_ndx = get_spc_ndx( 'CH3COCH3') + no_ndx = get_spc_ndx( 'NO') + ho2no2_ndx = get_spc_ndx( 'HO2NO2') + glyald_ndx = get_spc_ndx( 'GLYALD') + hyac_ndx = get_spc_ndx( 'HYAC') + ch3oh_ndx = get_spc_ndx( 'CH3OH') + c2h5oh_ndx = get_spc_ndx( 'C2H5OH') + macrooh_ndx = get_spc_ndx( 'MACROOH') + isopooh_ndx = get_spc_ndx( 'ISOPOOH') + xooh_ndx = get_spc_ndx( 'XOOH') + hydrald_ndx = get_spc_ndx( 'HYDRALD') + h2_ndx = get_spc_ndx( 'H2') + Pb_ndx = get_spc_ndx( 'Pb') + o3s_ndx = get_spc_ndx( 'O3S') + o3inert_ndx = get_spc_ndx( 'O3INERT') + alkooh_ndx = get_spc_ndx( 'ALKOOH') + mekooh_ndx = get_spc_ndx( 'MEKOOH') + tolooh_ndx = get_spc_ndx( 'TOLOOH') + terpooh_ndx = get_spc_ndx( 'TERPOOH') + ch3cooh_ndx = get_spc_ndx( 'CH3COOH') + soam_ndx = get_spc_ndx( 'SOAM' ) + soai_ndx = get_spc_ndx( 'SOAI' ) + soat_ndx = get_spc_ndx( 'SOAT' ) + soab_ndx = get_spc_ndx( 'SOAB' ) + soax_ndx = get_spc_ndx( 'SOAX' ) + sogm_ndx = get_spc_ndx( 'SOGM' ) + sogi_ndx = get_spc_ndx( 'SOGI' ) + sogt_ndx = get_spc_ndx( 'SOGT' ) + sogb_ndx = get_spc_ndx( 'SOGB' ) + sogx_ndx = get_spc_ndx( 'SOGX' ) + soa_ndx = get_spc_ndx( 'SOA' ) + so4_ndx = get_spc_ndx( 'SO4' ) + cb1_ndx = get_spc_ndx( 'CB1' ) + cb2_ndx = get_spc_ndx( 'CB2' ) + oc1_ndx = get_spc_ndx( 'OC1' ) + oc2_ndx = get_spc_ndx( 'OC2' ) + nh3_ndx = get_spc_ndx( 'NH3' ) + nh4no3_ndx = get_spc_ndx( 'NH4NO3' ) + xnh4no3_ndx = get_spc_ndx( 'XNH4NO3' ) + sa1_ndx = get_spc_ndx( 'SA1' ) + sa2_ndx = get_spc_ndx( 'SA2' ) + sa3_ndx = get_spc_ndx( 'SA3' ) + sa4_ndx = get_spc_ndx( 'SA4' ) + nh4_ndx = get_spc_ndx( 'NH4' ) + alkooh_dd = has_drydep( 'ALKOOH') + mekooh_dd = has_drydep( 'MEKOOH') + tolooh_dd = has_drydep( 'TOLOOH') + terpooh_dd = has_drydep( 'TERPOOH') + ch3cooh_dd = has_drydep( 'CH3COOH') + soam_dd = has_drydep( 'SOAM' ) + soai_dd = has_drydep( 'SOAI' ) + soat_dd = has_drydep( 'SOAT' ) + soab_dd = has_drydep( 'SOAB' ) + soax_dd = has_drydep( 'SOAX' ) + sogm_dd = has_drydep( 'SOGM' ) + sogi_dd = has_drydep( 'SOGI' ) + sogt_dd = has_drydep( 'SOGT' ) + sogb_dd = has_drydep( 'SOGB' ) + sogx_dd = has_drydep( 'SOGX' ) + soa_dd = has_drydep( 'SOA' ) + so4_dd = has_drydep( 'SO4' ) + cb1_dd = has_drydep( 'CB1' ) + cb2_dd = has_drydep( 'CB2' ) + oc1_dd = has_drydep( 'OC1' ) + oc2_dd = has_drydep( 'OC2' ) + nh3_dd = has_drydep( 'NH3' ) + nh4no3_dd = has_drydep( 'NH4NO3' ) + xnh4no3_dd = has_drydep( 'XNH4NO3' ) + sa1_dd = has_drydep( 'SA1' ) + sa2_dd = has_drydep( 'SA2' ) + sa3_dd = has_drydep( 'SA3' ) + sa4_dd = has_drydep( 'SA4' ) + nh4_dd = has_drydep( 'NH4' ) + pan_dd = has_drydep( 'PAN') + mpan_dd = has_drydep( 'MPAN') + no2_dd = has_drydep( 'NO2') + hno3_dd = has_drydep( 'HNO3') + co_dd = has_drydep( 'CO') + o3_dd = has_drydep( 'O3') + if( .not. o3_dd ) then + o3_dd = has_drydep( 'OX') + end if + h2o2_dd = has_drydep( 'H2O2') + onit_dd = has_drydep( 'ONIT') + onitr_dd = has_drydep( 'ONITR') + ch4_dd = has_drydep( 'CH4') + ch2o_dd = has_drydep( 'CH2O') + ch3ooh_dd = has_drydep( 'CH3OOH') + ch3cho_dd = has_drydep( 'CH3CHO') + c2h5oh_dd = has_drydep( 'C2H5OH') + eooh_dd = has_drydep( 'EOOH') + ch3cocho_dd = has_drydep( 'CH3COCHO') + pooh_dd = has_drydep( 'POOH') + ch3coooh_dd = has_drydep( 'CH3COOOH') + c2h5ooh_dd = has_drydep( 'C2H5OOH') + c3h7ooh_dd = has_drydep( 'C3H7OOH') + rooh_dd = has_drydep( 'ROOH') + ch3coch3_dd = has_drydep( 'CH3COCH3') + glyald_dd = has_drydep( 'GLYALD') + hyac_dd = has_drydep( 'HYAC') + ch3oh_dd = has_drydep( 'CH3OH') + macrooh_dd = has_drydep( 'MACROOH') + isopooh_dd = has_drydep( 'ISOPOOH') + xooh_dd = has_drydep( 'XOOH') + hydrald_dd = has_drydep( 'HYDRALD') + h2_dd = has_drydep( 'H2') + Pb_dd = has_drydep( 'Pb') + o3s_dd = has_drydep( 'O3S') + o3inert_dd = has_drydep( 'O3INERT') + ch3cn_dd = has_drydep( 'CH3CN') + hcn_dd = has_drydep( 'HCN') + hcooh_dd = has_drydep( 'HCOOH') + ch3cn_ndx = get_spc_ndx( 'CH3CN') + hcn_ndx = get_spc_ndx( 'HCN') + hcooh_ndx = get_spc_ndx( 'HCOOH' ) + + if( masterproc ) then + write(iulog,*) 'dvel_inti: diagnostics' + write(iulog,'(10i5)') pan_ndx, mpan_ndx, no2_ndx, hno3_ndx, o3_ndx, & + h2o2_ndx, onit_ndx, onitr_ndx, ch4_ndx, ch2o_ndx, & + ch3ooh_ndx, pooh_ndx, ch3coooh_ndx, c2h5ooh_ndx, eooh_ndx, & + c3h7ooh_ndx, rooh_ndx, ch3cocho_ndx, co_ndx, ch3coch3_ndx, & + no_ndx, ho2no2_ndx, glyald_ndx, hyac_ndx, ch3oh_ndx, c2h5oh_ndx, & + hydrald_ndx, h2_ndx, Pb_ndx, o3s_ndx, o3inert_ndx, macrooh_ndx, & + xooh_ndx, ch3cho_ndx, isopooh_ndx, noa_ndx, alknit_ndx, isopnita_ndx, & + honitr_ndx, isopnooh_ndx, nc4cho_ndx, nc4ch2oh_ndx, terpnit_ndx, nterpooh_ndx + write(iulog,*) pan_dd, mpan_dd, no2_dd, hno3_dd, o3_dd, isopooh_dd, ch4_dd,& + h2o2_dd, onit_dd, onitr_dd, ch2o_dd, macrooh_dd, xooh_dd, & + ch3ooh_dd, pooh_dd, ch3coooh_dd, c2h5ooh_dd, eooh_dd, ch3cho_dd, c2h5oh_dd, & + c3h7ooh_dd, rooh_dd, ch3cocho_dd, co_dd, ch3coch3_dd, & + glyald_dd, hyac_dd, ch3oh_dd, hydrald_dd, h2_dd, Pb_dd, o3s_dd, o3inert_dd, & + noa_dd, alknit_dd, isopnita_dd, & + honitr_dd, isopnooh_dd, nc4cho_dd, nc4ch2oh_dd, terpnit_dd, nterpooh_dd + endif + !--------------------------------------------------------------------------- + ! ... Open NetCDF file + !--------------------------------------------------------------------------- + call getfil (depvel_file, locfn, 0) + call cam_pio_openfile (piofile, trim(locfn), PIO_NOWRITE) + + !--------------------------------------------------------------------------- + ! ... Get variable ID for dep vel array + !--------------------------------------------------------------------------- + ierr = pio_inq_varid( piofile, 'dvel', vid_dvel ) + + !--------------------------------------------------------------------------- + ! ... Inquire about dimensions + !--------------------------------------------------------------------------- + ierr = pio_inq_dimid( piofile, 'lon', dimid_lon ) + ierr = pio_inq_dimlen( piofile, dimid_lon, nlon ) + ierr = pio_inq_dimid( piofile, 'lat', dimid_lat ) + ierr = pio_inq_dimlen( piofile, dimid_lat, nlat ) + ierr = pio_inq_dimid( piofile, 'species', dimid_species ) + ierr = pio_inq_dimlen( piofile, dimid_species, nspecies ) + ierr = pio_inq_dimid( piofile, 'time', dimid_time ) + ierr = pio_inq_dimlen( piofile, dimid_time, nmonth ) + if(masterproc) write(iulog,*) 'dvel_inti: dimensions (nlon,nlat,nspecies,nmonth) = ',nlon,nlat,nspecies,nmonth + + !--------------------------------------------------------------------------- + ! ... Check dimensions of dvel variable. Must be (lon, lat, species, month). + !--------------------------------------------------------------------------- + ierr = pio_inq_varndims( piofile, vid_dvel, ndims ) + + if( masterproc .and. ndims /= 4 ) then + write(iulog,*) 'dvel_inti: dvel has ',ndims,' dimensions. Expecting 4.' + call endrun + end if + ierr = pio_inq_vardimid( piofile, vid_dvel, dimid ) + + if( dimid(1) /= dimid_lon .or. dimid(2) /= dimid_lat .or. & + dimid(3) /= dimid_species .or. dimid(4) /= dimid_time ) then + write(iulog,*) 'dvel_inti: Dimensions in wrong order for dvel' + write(iulog,*) '... Expecting (lon, lat, species, month)' + call endrun + end if + + !--------------------------------------------------------------------------- + ! ... Allocate depvel lats, lons and read + !--------------------------------------------------------------------------- + allocate( dvel_lats(nlat), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'dvel_inti: Failed to allocate dvel_lats vector' + call endrun + end if + allocate( dvel_lons(nlon), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'dvel_inti: Failed to allocate dvel_lons vector' + call endrun + end if + + ierr = pio_inq_varid( piofile, 'lat', vid ) + ierr = pio_get_var( piofile, vid, dvel_lats ) + ierr = pio_inq_varid( piofile, 'lon', vid ) + ierr = pio_get_var( piofile, vid, dvel_lons ) + + !--------------------------------------------------------------------------- + ! ... Set the transform from inputs lats to simulation lats + !--------------------------------------------------------------------------- + dvel_lats(:nlat) = d2r * dvel_lats(:nlat) + dvel_lons(:nlon) = d2r * dvel_lons(:nlon) + + !--------------------------------------------------------------------------- + ! ... Allocate dvel and read data from file + !--------------------------------------------------------------------------- + allocate( dvel_in(nlon, nlat ,nspecies, nmonth), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'dvel_inti: Failed to allocate dvel_in' + call endrun + end if + start = (/ 1, 1, 1, 1 /) + count = (/ nlon, nlat, nspecies, nmonth /) + + ierr = pio_get_var( piofile, vid_dvel, start, count, dvel_in ) + + + !--------------------------------------------------------------------------- + ! ... Check units of deposition velocity. If necessary, convert to cm/s. + !--------------------------------------------------------------------------- + units(:) = ' ' + ierr = pio_get_att( piofile, vid_dvel, 'units', units ) + if( to_lower(trim(units(:GLC(units)))) == 'm/s' ) then +#ifdef DEBUG + if(masterproc) write(iulog,*) 'dvel_inti: depvel units = m/s. Converting to cm/s' +#endif + scale_factor = 100._r8 + elseif( to_lower(trim(units(:GLC(units)))) == 'cm/s' ) then +#ifdef DEBUG + if(masterproc) write(iulog,*) 'dvel_inti: depvel units = cm/s' +#endif + scale_factor = 1._r8 + else +#ifdef DEBUG + if(masterproc) then + write(iulog,*) 'dvel_inti: Warning! depvel units unknown = ', to_lower(trim(units)) + write(iulog,*) ' ... proceeding with scale_factor=1' + end if +#endif + scale_factor = 1._r8 + end if + + dvel_in(:,:,:,:) = scale_factor*dvel_in(:,:,:,:) + + !--------------------------------------------------------------------------- + ! ... Regrid deposition velocities + !--------------------------------------------------------------------------- + allocate( dvel(pcols,begchunk:endchunk,nspecies,nmonth),stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'dvel_inti: Failed to allocate dvel' + call endrun + end if + + do c=begchunk,endchunk + ncols = get_ncols_p(c) + call get_rlat_all_p(c, pcols, to_lats) + call get_rlon_all_p(c, pcols, to_lons) + call lininterp_init(dvel_lons, nlon, to_lons, ncols, 2, lon_wgts, zero, twopi) + call lininterp_init(dvel_lats, nlat, to_lats, ncols, 1, lat_wgts) + + do ispecies = 1,nspecies + do m = 1,12 + call lininterp( dvel_in( :,:,ispecies,m ), nlon, nlat, dvel(:,c,ispecies,m), ncols,lon_wgts,lat_wgts) + end do + end do + + call lininterp_finish(lat_wgts) + call lininterp_finish(lon_wgts) + end do + + deallocate( dvel_in ) + deallocate( dvel_lats, dvel_lons ) + + !--------------------------------------------------------------------------- + ! ... Read in species names and determine mapping to tracer numbers + !--------------------------------------------------------------------------- + allocate( species_names(nspecies), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'dvel_inti: species_names allocation error = ',ierr + call endrun + end if + ierr = pio_inq_varid( piofile, 'species_name', vid ) + ierr = pio_inq_varndims( piofile, vid, ndims ) + + ierr = pio_inq_vardimid( piofile, vid, dimid ) + + ierr = pio_inq_dimlen( piofile, dimid(1), nchar ) + map(:) = 0 + do ispecies = 1,nspecies + start(:2) = (/ 1, ispecies /) + count(:2) = (/ nchar, 1 /) + species_names(ispecies)(:) = ' ' + ierr = pio_get_var( piofile, vid, start(1:2), count(1:2), species_names(ispecies:ispecies) ) + if( species_names(ispecies) == 'O3' ) then + o3_in_tab = .true. + o3_tab_ndx = ispecies + else if( species_names(ispecies) == 'H2O2' ) then + h2o2_in_tab = .true. + h2o2_tab_ndx = ispecies + else if( species_names(ispecies) == 'CH3OOH' ) then + ch3ooh_in_tab = .true. + ch3ooh_tab_ndx = ispecies + else if( species_names(ispecies) == 'CO' ) then + co_in_tab = .true. + co_tab_ndx = ispecies + else if( species_names(ispecies) == 'CH3CHO' ) then + ch3cho_in_tab = .true. + ch3cho_tab_ndx = ispecies + end if + found = .false. + do m = 1, nTracers + if( species_names(ispecies) == tracerNames(m) .or. & + (species_names(ispecies) == 'O3' .and. tracerNames(m) == 'OX') .or. & + (species_names(ispecies) == 'HNO4' .and. tracerNames(m) == 'HO2NO2') ) then + if ( has_drydep( tracerNames(m) ) ) then + map(m) = ispecies + found = .true. +#ifdef DEBUG + if( masterproc ) then + write(iulog,*) 'dvel_inti: ispecies, m, tracnam = ',ispecies,m,trim(tracerNames(m)) + end if +#endif + exit + end if + end if + end do + if( .not. found ) then + write(iulog,*) 'dvel_inti: Warning! DVEL species ',trim(species_names(ispecies)),' not found' + endif + end do + deallocate( species_names ) + + call cam_pio_closefile( piofile ) + + !--------------------------------------------------------------------------- + ! ... Allocate dvel_interp array + !--------------------------------------------------------------------------- + allocate( dvel_interp(pcols,begchunk:endchunk,nspecies),stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'dvel_inti: Failed to allocate dvel_interp; error = ',ierr + call endrun + end if + + end subroutine dvel_inti_table + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + subroutine interpdvel( calday, ncol, lchnk ) + !--------------------------------------------------------------------------- + ! ... Interpolate the fields whose values are required at the + ! begining of a timestep. + !--------------------------------------------------------------------------- + + use time_manager, only : get_calday + + implicit none + + !--------------------------------------------------------------------------- + ! ... Dummy arguments + !--------------------------------------------------------------------------- + real(r8), intent(in) :: calday ! Interpolate the input data to calday + integer, intent(in) :: ncol, lchnk + + !--------------------------------------------------------------------------- + ! ... Local variables + !--------------------------------------------------------------------------- + integer :: m, last, next + integer :: dates(12) = (/ 116, 214, 316, 415, 516, 615, & + 716, 816, 915, 1016, 1115, 1216 /) + real(r8) :: calday_loc, last_days, next_days + real(r8), save :: dys(12) + logical, save :: entered = .false. + + if( .not. entered ) then + do m = 1,12 + dys(m) = get_calday( dates(m), 0 ) + end do + entered = .true. + end if + + if( calday < dys(1) ) then + next = 1 + last = 12 + else if( calday >= dys(12) ) then + next = 1 + last = 12 + else + do m = 11,1,-1 + if( calday >= dys(m) ) then + exit + end if + end do + last = m + next = m + 1 + end if + + last_days = dys( last ) + next_days = dys( next ) + calday_loc = calday + + if( next_days < last_days ) then + next_days = next_days + 365._r8 + end if + if( calday_loc < last_days ) then + calday_loc = calday_loc + 365._r8 + end if + + do m = 1,nspecies + call intp2d( last_days, next_days, calday_loc, ncol, lchnk, & + dvel(:,lchnk,m,last), & + dvel(:,lchnk,m,next), & + dvel_interp(:,lchnk,m) ) + end do + + end subroutine interpdvel + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + subroutine intp2d( t1, t2, tint, ncol, lchnk, f1, f2, fint ) + !----------------------------------------------------------------------- + ! ... Linearly interpolate between f1(t1) and f2(t2) to fint(tint). + !----------------------------------------------------------------------- + + implicit none + + !----------------------------------------------------------------------- + ! ... Dummy arguments + !----------------------------------------------------------------------- + real(r8), intent(in) :: & + t1, & ! time level of f1 + t2, & ! time level of f2 + tint ! interpolant time + real(r8), dimension(pcols), intent(in) :: & + f1, & ! field at time t1 + f2 ! field at time t2 + + integer, intent(in) :: ncol, lchnk + + real(r8), intent(out) :: & + fint(pcols) ! field at time tint + + + !----------------------------------------------------------------------- + ! ... Local variables + !----------------------------------------------------------------------- + real(r8) :: factor + + factor = (tint - t1)/(t2 - t1) + + fint(:ncol) = f1(:ncol) + (f2(:ncol) - f1(:ncol))*factor + + end subroutine intp2d + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + !subroutine drydep_table( calday, tsurf, zen_angle, & + ! depvel, dflx, q, p, & + ! tv, ncol, icefrac, ocnfrac, lchnk ) + ! !-------------------------------------------------------- + ! ! ... Form the deposition velocities for this + ! ! latitude slice + ! !-------------------------------------------------------- + + ! use physconst, only : rair,pi + ! use dycore, only : dycore_is + + ! implicit none + + ! !-------------------------------------------------------- + ! ! ... Dummy arguments + ! !-------------------------------------------------------- + ! integer, intent(in) :: ncol ! columns in chunk + ! real(r8), intent(in) :: q(pcols,plev,gas_pcnst) ! tracer mmr (kg/kg) + ! real(r8), intent(in) :: p(pcols) ! midpoint pressure in surface layer (Pa) + ! real(r8), intent(in) :: tv(pcols) ! virtual temperature in surface layer (K) + ! real(r8), intent(in) :: calday ! time of year in days + ! real(r8), intent(in) :: tsurf(pcols) ! surface temperature (K) + ! real(r8), intent(in) :: zen_angle(ncol) ! zenith angle (radians) + ! real(r8), intent(inout) :: dflx(pcols,gas_pcnst) ! flux due to dry deposition (kg/m^2/sec) + ! real(r8), intent(out) :: depvel(ncol,gas_pcnst) ! deposition vel (cm/s) + + ! real(r8), intent(in) :: icefrac(pcols) ! sea-ice areal fraction + ! real(r8), intent(in) :: ocnfrac(pcols) ! ocean areal fraction + ! + ! integer, intent(in) :: lchnk + ! !----------------------------------------------------------------------- + ! ! ... Local variables + ! !----------------------------------------------------------------------- + ! integer :: m, i + ! real(r8), dimension(ncol) :: vel, glace, temp_fac, wrk, tmp + ! real(r8), dimension(ncol) :: o3_tab_dvel + ! real(r8), dimension(ncol) :: ocean + + ! real(r8), parameter :: pid2 = .5_r8 * pi + + ! if(dycore_is('UNSTRUCTURED')) then + ! call endrun( 'Option not supported for unstructured atmosphere grids ') + ! end if + + ! !----------------------------------------------------------------------- + ! ! ... Note the factor 1.e-2 in the wrk array calculation is + ! ! to transform the incoming dep vel from cm/s to m/s + ! !----------------------------------------------------------------------- + ! wrk(:ncol) = 1.e-2_r8 * p(:ncol) / (rair * tv(:ncol)) + + ! !-------------------------------------------------------- + ! ! ... Initialize all deposition velocities to zero + ! !-------------------------------------------------------- + ! depvel(:,:) = 0._r8 + + ! !-------------------------------------------------------- + ! ! ... Time interpolate primary depvel array + ! ! (also seaice and npp) + ! !-------------------------------------------------------- + ! call interpdvel( calday, ncol, lchnk ) + + ! if( o3_in_tab ) then + ! do i=1,ncol + ! o3_tab_dvel(i) = dvel_interp(i,lchnk,o3_tab_ndx) + ! enddo + ! end if + + ! !-------------------------------------------------------- + ! ! ... Set deposition velocities + ! !-------------------------------------------------------- + ! do m = 1,gas_pcnst + ! if( map(m) /= 0 ) then + ! do i = 1,ncol + ! depvel(i,m) = dvel_interp(i,lchnk,map(m)) + ! dflx(i,m) = wrk(i) * depvel(i,m) * q(i,plev,m) + ! enddo + ! end if + ! end do + + ! !-------------------------------------------------------- + ! ! ... Set some variables needed for some dvel calculations + ! !-------------------------------------------------------- + ! temp_fac(:ncol) = min( 1._r8, max( 0._r8, (tsurf(:ncol) - 268._r8) / 5._r8 ) ) + ! ocean(:ncol) = icefrac(:ncol)+ocnfrac(:ncol) + ! glace(:ncol) = icefrac(:ncol) + (1._r8 - ocean(:ncol)) * (1._r8 - temp_fac(:ncol)) + ! glace(:ncol) = min( 1._r8,glace(:ncol) ) + + ! !-------------------------------------------------------- + ! ! ... Set pan & mpan + ! !-------------------------------------------------------- + ! if( o3_in_tab ) then + ! tmp(:ncol) = o3_tab_dvel(:ncol) / 3._r8 + ! else + ! tmp(:) = 0._r8 + ! end if + ! if( pan_dd ) then + ! if( map(pan_ndx) == 0 ) then + ! depvel(:ncol,pan_ndx) = tmp(:ncol) + ! dflx(:ncol,pan_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,pan_ndx) + ! end if + ! end if + ! if( mpan_dd ) then + ! if( map(mpan_ndx) == 0 ) then + ! depvel(:ncol,mpan_ndx) = tmp(:ncol) + ! dflx(:ncol,mpan_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,mpan_ndx) + ! end if + ! end if + + ! !-------------------------------------------------------- + ! ! ... Set no2 dvel + ! !-------------------------------------------------------- + ! if( no2_dd ) then + ! if( map(no2_ndx) == 0 .and. o3_in_tab ) then + ! depvel(:ncol,no2_ndx) = (.6_r8*o3_tab_dvel(:ncol) + .055_r8*ocean(:ncol)) * .9_r8 + ! dflx(:ncol,no2_ndx) = wrk(:) * depvel(:ncol,no2_ndx) * q(:ncol,plev,no2_ndx) + ! end if + ! end if + + ! !-------------------------------------------------------- + ! ! ... Set hno3 dvel + ! !-------------------------------------------------------- + ! tmp(:ncol) = (2._r8 - ocnfrac(:ncol)) * (1._r8 - glace(:ncol)) + .05_r8 * glace(:ncol) + ! if( hno3_dd ) then + ! if( map(hno3_ndx) == 0 ) then + ! depvel(:ncol,hno3_ndx) = tmp(:ncol) + ! dflx(:ncol,hno3_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,hno3_ndx) + ! else + ! tmp(:ncol) = depvel(:ncol,hno3_ndx) + ! end if + ! end if + ! if( onitr_dd ) then + ! if( map(onitr_ndx) == 0 ) then + ! depvel(:ncol,onitr_ndx) = tmp(:ncol) + ! dflx(:ncol,onitr_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,onitr_ndx) + ! end if + ! end if + ! if( isopooh_dd ) then + ! if( map(isopooh_ndx) == 0 ) then + ! depvel(:ncol,isopooh_ndx) = tmp(:ncol) + ! dflx(:ncol,isopooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,isopooh_ndx) + ! end if + ! end if + + ! !-------------------------------------------------------- + ! ! ... Set h2o2 dvel + ! !-------------------------------------------------------- + ! if( .not. h2o2_in_tab ) then + ! if( o3_in_tab ) then + ! tmp(:ncol) = .05_r8*glace(:ncol) + ocean(:ncol) - icefrac(:ncol) & + ! + (1._r8 - (glace(:) + ocean(:ncol)) + icefrac(:ncol)) & + ! *max( 1._r8,1._r8/(.5_r8 + 1._r8/(6._r8*o3_tab_dvel(:ncol))) ) + ! else + ! tmp(:ncol) = 0._r8 + ! end if + ! else + ! do i=1,ncol + ! tmp(i) = dvel_interp(i,lchnk,h2o2_tab_ndx) + ! enddo + ! end if + ! if( h2o2_dd ) then + ! if( map(h2o2_ndx) == 0 ) then + ! depvel(:ncol,h2o2_ndx) = tmp(:ncol) + ! dflx(:ncol,h2o2_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,h2o2_ndx) + ! end if + ! end if + ! !-------------------------------------------------------- + ! ! ... Set hcn dvel + ! !-------------------------------------------------------- + ! if( hcn_dd ) then + ! if( map(hcn_ndx) == 0 ) then + ! depvel(:ncol,hcn_ndx) = ocnfrac(:ncol)*0.2_r8 + ! endif + ! endif + ! !-------------------------------------------------------- + ! ! ... Set ch3cn dvel + ! !-------------------------------------------------------- + ! if( ch3cn_dd ) then + ! if( map(ch3cn_ndx) == 0 ) then + ! depvel(:,ch3cn_ndx) = ocnfrac(:ncol)*0.2_r8 + ! endif + ! endif + ! !-------------------------------------------------------- + ! ! ... Set onit + ! !-------------------------------------------------------- + ! if( onit_dd ) then + ! if( map(onit_ndx) == 0 ) then + ! depvel(:ncol,onit_ndx) = tmp(:ncol) + ! dflx(:ncol,onit_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,onit_ndx) + ! end if + ! end if + ! if( ch3cocho_dd ) then + ! if( map(ch3cocho_ndx) == 0 ) then + ! depvel(:ncol,ch3cocho_ndx) = tmp(:ncol) + ! dflx(:ncol,ch3cocho_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch3cocho_ndx) + ! end if + ! end if + ! if( ch3ooh_in_tab ) then + ! do i=1,ncol + ! tmp(i) = dvel_interp(i,lchnk,ch3ooh_tab_ndx) + ! enddo + ! else + ! tmp(:ncol) = .5_r8 * tmp(:ncol) + ! end if + ! if( ch3ooh_dd ) then + ! if( map(ch3ooh_ndx) == 0 ) then + ! depvel(:ncol,ch3ooh_ndx) = tmp(:ncol) + ! dflx(:ncol,ch3ooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch3ooh_ndx) + ! end if + ! end if + ! if( pooh_dd ) then + ! if( map(pooh_ndx) == 0 ) then + ! depvel(:ncol,pooh_ndx) = tmp(:ncol) + ! dflx(:ncol,pooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,pooh_ndx) + ! end if + ! end if + ! if( ch3coooh_dd ) then + ! if( map(ch3coooh_ndx) == 0 ) then + ! depvel(:ncol,ch3coooh_ndx) = tmp(:ncol) + ! dflx(:ncol,ch3coooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch3coooh_ndx) + ! end if + ! end if + ! if( c2h5ooh_dd ) then + ! if( map(c2h5ooh_ndx) == 0 ) then + ! depvel(:ncol,c2h5ooh_ndx) = tmp(:ncol) + ! dflx(:ncol,c2h5ooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,c2h5ooh_ndx) + ! end if + ! end if + ! if( c3h7ooh_dd ) then + ! if( map(c3h7ooh_ndx) == 0 ) then + ! depvel(:ncol,c3h7ooh_ndx) = tmp(:ncol) + ! dflx(:ncol,c3h7ooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,c3h7ooh_ndx) + ! end if + ! end if + ! if( rooh_dd ) then + ! if( map(rooh_ndx) == 0 ) then + ! depvel(:ncol,rooh_ndx) = tmp(:ncol) + ! dflx(:ncol,rooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,rooh_ndx) + ! end if + ! end if + ! if( macrooh_dd ) then + ! if( map(macrooh_ndx) == 0 ) then + ! depvel(:ncol,macrooh_ndx) = tmp(:ncol) + ! dflx(:ncol,macrooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,macrooh_ndx) + ! end if + ! end if + ! if( xooh_dd ) then + ! if( map(xooh_ndx) == 0 ) then + ! depvel(:ncol,xooh_ndx) = tmp(:ncol) + ! dflx(:ncol,xooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,xooh_ndx) + ! end if + ! end if + ! if( ch3oh_dd ) then + ! if( map(ch3oh_ndx) == 0 ) then + ! depvel(:ncol,ch3oh_ndx) = tmp(:ncol) + ! dflx(:ncol,ch3oh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch3oh_ndx) + ! end if + ! end if + ! if( c2h5oh_dd ) then + ! if( map(c2h5oh_ndx) == 0 ) then + ! depvel(:ncol,c2h5oh_ndx) = tmp(:ncol) + ! dflx(:ncol,c2h5oh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,c2h5oh_ndx) + ! end if + ! end if + ! if( alkooh_dd ) then + ! if( map(alkooh_ndx) == 0 ) then + ! depvel(:ncol,alkooh_ndx) = tmp(:ncol) + ! dflx(:ncol,alkooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,alkooh_ndx) + ! end if + ! end if + ! if( mekooh_dd ) then + ! if( map(mekooh_ndx) == 0 ) then + ! depvel(:ncol,mekooh_ndx) = tmp(:ncol) + ! dflx(:ncol,mekooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,mekooh_ndx) + ! end if + ! end if + ! if( tolooh_dd ) then + ! if( map(tolooh_ndx) == 0 ) then + ! depvel(:ncol,tolooh_ndx) = tmp(:ncol) + ! dflx(:ncol,tolooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,tolooh_ndx) + ! end if + ! end if + ! if( o3_in_tab ) then + ! tmp(:ncol) = o3_tab_dvel(:ncol) + ! else + ! tmp(:ncol) = 0._r8 + ! end if + ! if( ch2o_dd ) then + ! if( map(ch2o_ndx) == 0 ) then + ! depvel(:ncol,ch2o_ndx) = tmp(:ncol) + ! dflx(:ncol,ch2o_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch2o_ndx) + ! end if + ! end if + + ! if( hydrald_dd ) then + ! if( map(hydrald_ndx) == 0 ) then + ! depvel(:ncol,hydrald_ndx) = tmp(:ncol) + ! dflx(:ncol,hydrald_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,hydrald_ndx) + ! end if + ! end if + ! if( ch3cooh_dd ) then + ! if( map(ch3cooh_ndx) == 0 ) then + ! depvel(:ncol,ch3cooh_ndx) = depvel(:ncol,ch2o_ndx) + ! dflx(:ncol,ch3cooh_ndx) = wrk(:ncol) * depvel(:ncol,ch3cooh_ndx) * q(:ncol,plev,ch3cooh_ndx) + ! end if + ! end if + ! if( eooh_dd ) then + ! if( map(eooh_ndx) == 0 ) then + ! depvel(:ncol,eooh_ndx) = depvel(:ncol,ch2o_ndx) + ! dflx(:ncol,eooh_ndx) = wrk(:ncol) * depvel(:ncol,eooh_ndx) * q(:ncol,plev,eooh_ndx) + ! end if + ! end if + ! ! HCOOH - set to CH3COOH + ! if( hcooh_dd ) then + ! if( map(hcooh_ndx) == 0 ) then + ! depvel(:ncol,hcooh_ndx) = depvel(:ncol,ch2o_ndx) + ! dflx(:ncol,hcooh_ndx) = wrk(:ncol) * depvel(:ncol,hcooh_ndx) * q(:ncol,plev,hcooh_ndx) + ! end if + ! end if + + ! !-------------------------------------------------------- + ! ! ... Set co and related species dep vel + ! !-------------------------------------------------------- + ! if( co_in_tab ) then + ! do i=1,ncol + ! tmp(i) = dvel_interp(i,lchnk,co_tab_ndx) + ! enddo + ! else + ! tmp(:) = 0._r8 + ! end if + ! if( co_dd ) then + ! if( map(co_ndx) == 0 ) then + ! depvel(:ncol,co_ndx) = tmp(:ncol) + ! dflx(:ncol,co_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,co_ndx) + ! end if + ! end if + ! if( ch3coch3_dd ) then + ! if( map(ch3coch3_ndx) == 0 ) then + ! depvel(:ncol,ch3coch3_ndx) = tmp(:ncol) + ! dflx(:ncol,ch3coch3_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch3coch3_ndx) + ! end if + ! end if + ! if( hyac_dd ) then + ! if( map(hyac_ndx) == 0 ) then + ! depvel(:ncol,hyac_ndx) = tmp(:ncol) + ! dflx(:ncol,hyac_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,hyac_ndx) + ! end if + ! end if + ! if( h2_dd ) then + ! if( map(h2_ndx) == 0 ) then + ! depvel(:ncol,h2_ndx) = tmp(:ncol) * 1.5_r8 ! Hough(1991) + ! dflx(:ncol,h2_ndx) = wrk(:ncol) * depvel(:ncol,h2_ndx) * q(:ncol,plev,h2_ndx) + ! end if + ! end if + + ! !-------------------------------------------------------- + ! ! ... Set glyald + ! !-------------------------------------------------------- + ! if( glyald_dd ) then + ! if( map(glyald_ndx) == 0 ) then + ! if( ch3cho_dd ) then + ! depvel(:ncol,glyald_ndx) = depvel(:ncol,ch3cho_ndx) + ! else if( ch3cho_in_tab ) then + ! do i=1,ncol + ! depvel(i,glyald_ndx) = dvel_interp(i,lchnk,ch3cho_tab_ndx) + ! enddo + ! else + ! depvel(:ncol,glyald_ndx) = 0._r8 + ! end if + ! dflx(:ncol,glyald_ndx) = wrk(:ncol) * depvel(:ncol,glyald_ndx) * q(:ncol,plev,glyald_ndx) + ! end if + ! end if + + ! !-------------------------------------------------------- + ! ! ... Lead deposition + ! !-------------------------------------------------------- + ! if( Pb_dd ) then + ! if( map(Pb_ndx) == 0 ) then + ! depvel(:ncol,Pb_ndx) = ocean(:ncol) * .05_r8 + (1._r8 - ocean(:ncol)) * .2_r8 + ! dflx(:ncol,Pb_ndx) = wrk(:ncol) * depvel(:ncol,Pb_ndx) * q(:ncol,plev,Pb_ndx) + ! end if + ! end if + + ! !-------------------------------------------------------- + ! ! ... diurnal dependence for OX dvel + ! !-------------------------------------------------------- + ! if( o3_dd .or. o3s_dd .or. o3inert_dd ) then + ! if( o3_dd .or. o3_in_tab ) then + ! if( o3_dd ) then + ! tmp(:ncol) = max( 1._r8,sqrt( (depvel(:ncol,o3_ndx) - .2_r8)**3/.27_r8 + 4._r8*depvel(:ncol,o3_ndx) + .67_r8 ) ) + ! vel(:ncol) = depvel(:ncol,o3_ndx) + ! else if( o3_in_tab ) then + ! tmp(:ncol) = max( 1._r8,sqrt( (o3_tab_dvel(:ncol) - .2_r8)**3/.27_r8 + 4._r8*o3_tab_dvel(:ncol) + .67_r8 ) ) + ! vel(:ncol) = o3_tab_dvel(:ncol) + ! end if + ! where( abs( zen_angle(:) ) > pid2 ) + ! vel(:) = vel(:) / tmp(:) + ! elsewhere + ! vel(:) = vel(:) * tmp(:) + ! endwhere + + ! else + ! vel(:ncol) = 0._r8 + ! end if + ! if( o3_dd ) then + ! depvel(:ncol,o3_ndx) = vel(:ncol) + ! dflx(:ncol,o3_ndx) = wrk(:ncol) * vel(:ncol) * q(:ncol,plev,o3_ndx) + ! end if + ! !-------------------------------------------------------- + ! ! ... Set stratospheric O3 deposition + ! !-------------------------------------------------------- + ! if( o3s_dd ) then + ! depvel(:ncol,o3s_ndx) = vel(:ncol) + ! dflx(:ncol,o3s_ndx) = wrk(:ncol) * vel(:ncol) * q(:ncol,plev,o3s_ndx) + ! end if + ! if( o3inert_dd ) then + ! depvel(:ncol,o3inert_ndx) = vel(:ncol) + ! dflx(:ncol,o3inert_ndx) = wrk(:ncol) * vel(:ncol) * q(:ncol,plev,o3inert_ndx) + ! end if + ! end if + + ! if( xno2_dd ) then + ! if( map(xno2_ndx) == 0 ) then + ! depvel(:ncol,xno2_ndx) = depvel(:ncol,no2_ndx) + ! dflx(:ncol,xno2_ndx) = wrk(:ncol) * depvel(:ncol,xno2_ndx) * q(:ncol,plev,xno2_ndx) + ! end if + ! endif + ! if( o3a_dd ) then + ! if( map(o3a_ndx) == 0 ) then + ! depvel(:ncol,o3a_ndx) = depvel(:ncol,o3_ndx) + ! dflx(:ncol,o3a_ndx) = wrk(:ncol) * depvel(:ncol,o3a_ndx) * q(:ncol,plev,o3a_ndx) + ! end if + ! endif + ! if( xhno3_dd ) then + ! if( map(xhno3_ndx) == 0 ) then + ! depvel(:ncol,xhno3_ndx) = depvel(:ncol,hno3_ndx) + ! dflx(:ncol,xhno3_ndx) = wrk(:ncol) * depvel(:ncol,xhno3_ndx) * q(:ncol,plev,xhno3_ndx) + ! end if + ! endif + ! if( xnh4no3_dd ) then + ! if( map(xnh4no3_ndx) == 0 ) then + ! depvel(:ncol,xnh4no3_ndx) = depvel(:ncol,nh4no3_ndx) + ! dflx(:ncol,xnh4no3_ndx) = wrk(:ncol) * depvel(:ncol,xnh4no3_ndx) * q(:ncol,plev,xnh4no3_ndx) + ! end if + ! endif + ! if( xpan_dd ) then + ! if( map(xpan_ndx) == 0 ) then + ! depvel(:ncol,xpan_ndx) = depvel(:ncol,pan_ndx) + ! dflx(:ncol,xpan_ndx) = wrk(:ncol) * depvel(:ncol,xpan_ndx) * q(:ncol,plev,xpan_ndx) + ! end if + ! endif + ! if( xmpan_dd ) then + ! if( map(xmpan_ndx) == 0 ) then + ! depvel(:ncol,xmpan_ndx) = depvel(:ncol,mpan_ndx) + ! dflx(:ncol,xmpan_ndx) = wrk(:ncol) * depvel(:ncol,xmpan_ndx) * q(:ncol,plev,xmpan_ndx) + ! end if + ! endif + ! if( xonit_dd ) then + ! if( map(xonit_ndx) == 0 ) then + ! depvel(:ncol,xonit_ndx) = depvel(:ncol,onit_ndx) + ! dflx(:ncol,xonit_ndx) = wrk(:ncol) * depvel(:ncol,xonit_ndx) * q(:ncol,plev,xonit_ndx) + ! end if + ! endif + ! if( xonitr_dd ) then + ! if( map(xonitr_ndx) == 0 ) then + ! depvel(:ncol,xonitr_ndx) = depvel(:ncol,onitr_ndx) + ! dflx(:ncol,xonitr_ndx) = wrk(:ncol) * depvel(:ncol,xonitr_ndx) * q(:ncol,plev,xonitr_ndx) + ! end if + ! endif + ! if( xno_dd ) then + ! if( map(xno_ndx) == 0 ) then + ! depvel(:ncol,xno_ndx) = depvel(:ncol,no_ndx) + ! dflx(:ncol,xno_ndx) = wrk(:ncol) * depvel(:ncol,xno_ndx) * q(:ncol,plev,xno_ndx) + ! end if + ! endif + ! if( xho2no2_dd ) then + ! if( map(xho2no2_ndx) == 0 ) then + ! depvel(:ncol,xho2no2_ndx) = depvel(:ncol,ho2no2_ndx) + ! dflx(:ncol,xho2no2_ndx) = wrk(:ncol) * depvel(:ncol,xho2no2_ndx) * q(:ncol,plev,xho2no2_ndx) + ! end if + ! endif + ! !lke-TS1 + ! if( phenooh_dd ) then + ! if( map(phenooh_ndx) == 0 ) then + ! depvel(:ncol,phenooh_ndx) = depvel(:ncol,ch3ooh_ndx) + ! dflx(:ncol,phenooh_ndx) = wrk(:ncol) * depvel(:ncol,phenooh_ndx) * q(:ncol,plev,phenooh_ndx) + ! end if + ! endif + ! if( benzooh_dd ) then + ! if( map(benzooh_ndx) == 0 ) then + ! depvel(:ncol,benzooh_ndx) = depvel(:ncol,ch3ooh_ndx) + ! dflx(:ncol,benzooh_ndx) = wrk(:ncol) * depvel(:ncol,benzooh_ndx) * q(:ncol,plev,benzooh_ndx) + ! end if + ! endif + ! if( c6h5ooh_dd ) then + ! if( map(c6h5ooh_ndx) == 0 ) then + ! depvel(:ncol,c6h5ooh_ndx) = depvel(:ncol,ch3ooh_ndx) + ! dflx(:ncol,c6h5ooh_ndx) = wrk(:ncol) * depvel(:ncol,c6h5ooh_ndx) * q(:ncol,plev,c6h5ooh_ndx) + ! end if + ! endif + ! if( bzooh_dd ) then + ! if( map(bzooh_ndx) == 0 ) then + ! depvel(:ncol,bzooh_ndx) = depvel(:ncol,ch3ooh_ndx) + ! dflx(:ncol,bzooh_ndx) = wrk(:ncol) * depvel(:ncol,bzooh_ndx) * q(:ncol,plev,bzooh_ndx) + ! end if + ! endif + ! if( xylolooh_dd ) then + ! if( map(xylolooh_ndx) == 0 ) then + ! depvel(:ncol,xylolooh_ndx) = depvel(:ncol,ch3ooh_ndx) + ! dflx(:ncol,xylolooh_ndx) = wrk(:ncol) * depvel(:ncol,xylolooh_ndx) * q(:ncol,plev,xylolooh_ndx) + ! end if + ! endif + ! if( xylenooh_dd ) then + ! if( map(xylenooh_ndx) == 0 ) then + ! depvel(:ncol,xylenooh_ndx) = depvel(:ncol,ch3ooh_ndx) + ! dflx(:ncol,xylenooh_ndx) = wrk(:ncol) * depvel(:ncol,xylenooh_ndx) * q(:ncol,plev,xylenooh_ndx) + ! end if + ! endif + ! if( terpooh_dd ) then + ! if( map(terpooh_ndx) == 0 ) then + ! depvel(:ncol,terpooh_ndx) = depvel(:ncol,isopooh_ndx) + ! dflx(:ncol,terpooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,terpooh_ndx) + ! end if + ! end if + ! if( terp2ooh_dd ) then + ! if( map(terp2ooh_ndx) == 0 ) then + ! depvel(:ncol,terp2ooh_ndx) = depvel(:ncol,isopooh_ndx) + ! dflx(:ncol,terp2ooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,terp2ooh_ndx) + ! end if + ! end if + ! if( terprod1_dd ) then + ! if( map(terprod1_ndx) == 0 ) then + ! depvel(:ncol,terprod1_ndx) = depvel(:ncol,hyac_ndx) + ! dflx(:ncol,terprod1_ndx) = wrk(:ncol) * depvel(:ncol,terprod1_ndx) * q(:ncol,plev,terprod1_ndx) + ! end if + ! endif + ! if( terprod2_dd ) then + ! if( map(terprod2_ndx) == 0 ) then + ! depvel(:ncol,terprod2_ndx) = depvel(:ncol,hyac_ndx) + ! dflx(:ncol,terprod2_ndx) = wrk(:ncol) * depvel(:ncol,terprod2_ndx) * q(:ncol,plev,terprod2_ndx) + ! end if + ! endif + ! if( hmprop_dd ) then + ! if( map(hmprop_ndx) == 0 ) then + ! depvel(:ncol,hmprop_ndx) = depvel(:ncol,glyald_ndx) + ! dflx(:ncol,hmprop_ndx) = wrk(:ncol) * depvel(:ncol,hmprop_ndx) * q(:ncol,plev,hmprop_ndx) + ! end if + ! endif + ! if( mboooh_dd ) then + ! if( map(mboooh_ndx) == 0 ) then + ! depvel(:ncol,mboooh_ndx) = depvel(:ncol,isopooh_ndx) + ! dflx(:ncol,mboooh_ndx) = wrk(:ncol) * depvel(:ncol,mboooh_ndx) * q(:ncol,plev,mboooh_ndx) + ! end if + ! endif + ! if( hpald_dd ) then + ! if( map(hpald_ndx) == 0 ) then + ! depvel(:ncol,hpald_ndx) = depvel(:ncol,ch3ooh_ndx) + ! dflx(:ncol,hpald_ndx) = wrk(:ncol) * depvel(:ncol,hpald_ndx) * q(:ncol,plev,hpald_ndx) + ! end if + ! endif + ! if( iepox_dd ) then + ! if( map(iepox_ndx) == 0 ) then + ! depvel(:ncol,iepox_ndx) = depvel(:ncol,hyac_ndx) + ! dflx(:ncol,iepox_ndx) = wrk(:ncol) * depvel(:ncol,iepox_ndx) * q(:ncol,plev,iepox_ndx) + ! end if + ! endif + ! if( noa_dd ) then + ! if( map(noa_ndx) == 0 ) then + ! depvel(:ncol,noa_ndx) = depvel(:ncol,h2o2_ndx) + ! dflx(:ncol,noa_ndx) = wrk(:ncol) * depvel(:ncol,noa_ndx) * q(:ncol,plev,noa_ndx) + ! end if + ! endif + ! if( alknit_dd ) then + ! if( map(alknit_ndx) == 0 ) then + ! depvel(:ncol,alknit_ndx) = depvel(:ncol,h2o2_ndx) + ! dflx(:ncol,alknit_ndx) = wrk(:ncol) * depvel(:ncol,alknit_ndx) * q(:ncol,plev,alknit_ndx) + ! end if + ! endif + ! if( isopnita_dd ) then + ! if( map(isopnita_ndx) == 0 ) then + ! depvel(:ncol,isopnita_ndx) = depvel(:ncol,h2o2_ndx) + ! dflx(:ncol,isopnita_ndx) = wrk(:ncol) * depvel(:ncol,isopnita_ndx) * q(:ncol,plev,isopnita_ndx) + ! end if + ! endif + ! if( isopnitb_dd ) then + ! if( map(isopnitb_ndx) == 0 ) then + ! depvel(:ncol,isopnitb_ndx) = depvel(:ncol,h2o2_ndx) + ! dflx(:ncol,isopnitb_ndx) = wrk(:ncol) * depvel(:ncol,isopnitb_ndx) * q(:ncol,plev,isopnitb_ndx) + ! end if + ! endif + ! if( honitr_dd ) then + ! if( map(honitr_ndx) == 0 ) then + ! depvel(:ncol,honitr_ndx) = depvel(:ncol,h2o2_ndx) + ! dflx(:ncol,honitr_ndx) = wrk(:ncol) * depvel(:ncol,honitr_ndx) * q(:ncol,plev,honitr_ndx) + ! end if + ! endif + ! if( isopnooh_dd ) then + ! if( map(isopnooh_ndx) == 0 ) then + ! depvel(:ncol,isopnooh_ndx) = depvel(:ncol,h2o2_ndx) + ! dflx(:ncol,isopnooh_ndx) = wrk(:ncol) * depvel(:ncol,isopnooh_ndx) * q(:ncol,plev,isopnooh_ndx) + ! end if + ! endif + ! if( nc4cho_dd ) then + ! if( map(nc4cho_ndx) == 0 ) then + ! depvel(:ncol,nc4cho_ndx) = depvel(:ncol,h2o2_ndx) + ! dflx(:ncol,nc4cho_ndx) = wrk(:ncol) * depvel(:ncol,nc4cho_ndx) * q(:ncol,plev,nc4cho_ndx) + ! end if + ! endif + ! if( nc4ch2oh_dd ) then + ! if( map(nc4ch2oh_ndx) == 0 ) then + ! depvel(:ncol,nc4ch2oh_ndx) = depvel(:ncol,h2o2_ndx) + ! dflx(:ncol,nc4ch2oh_ndx) = wrk(:ncol) * depvel(:ncol,nc4ch2oh_ndx) * q(:ncol,plev,nc4ch2oh_ndx) + ! end if + ! endif + ! if( terpnit_dd ) then + ! if( map(terpnit_ndx) == 0 ) then + ! depvel(:ncol,terpnit_ndx) = depvel(:ncol,h2o2_ndx) + ! dflx(:ncol,terpnit_ndx) = wrk(:ncol) * depvel(:ncol,terpnit_ndx) * q(:ncol,plev,terpnit_ndx) + ! end if + ! endif + ! if( nterpooh_dd ) then + ! if( map(nterpooh_ndx) == 0 ) then + ! depvel(:ncol,nterpooh_ndx) = depvel(:ncol,h2o2_ndx) + ! dflx(:ncol,nterpooh_ndx) = wrk(:ncol) * depvel(:ncol,nterpooh_ndx) * q(:ncol,plev,nterpooh_ndx) + ! end if + ! endif + + + !end subroutine drydep_table + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + subroutine dvel_inti_xactive( depvel_lnd_file, clim_soilw_file, season_wes_file ) + !------------------------------------------------------------------------------------- + ! ... intialize interactive drydep + !------------------------------------------------------------------------------------- + use dycore, only : dycore_is + use mo_constants, only : r2d + use chem_mods, only : adv_mass + use mo_chem_utls, only : get_spc_ndx ! Replaced, TMMF + use seq_drydep_mod,only : drydep_method, DD_XATM, DD_XLND + use phys_control, only : phys_getopts + + implicit none + + !------------------------------------------------------------------------------------- + ! ... dummy arguments + !------------------------------------------------------------------------------------- + character(len=*), intent(in) :: depvel_lnd_file, clim_soilw_file, season_wes_file + + !------------------------------------------------------------------------------------- + ! ... local variables + !------------------------------------------------------------------------------------- + integer :: i, j, ii, jj, jl, ju + integer :: nlon_veg, nlat_veg, npft_veg + integer :: nlat_lai, npft_lai, pos_min, imin + integer :: dimid + integer :: m, n, l, id + integer :: length1, astat + integer, allocatable :: wk_lai(:,:,:) + integer, allocatable :: index_season_lai_j(:,:) + integer :: k, num_max, k_max + integer :: num_seas(5) + integer :: plon, plat + integer :: ierr, ndx + + real(r8) :: spc_mass + real(r8) :: diff_min, target_lat + real(r8), allocatable :: vegetation_map(:,:,:) + real(r8), pointer :: soilw_map(:,:,:) + real(r8), allocatable :: work(:,:) + real(r8), allocatable :: landmask(:,:) + real(r8), allocatable :: urban(:,:) + real(r8), allocatable :: lake(:,:) + real(r8), allocatable :: wetland(:,:) + real(r8), allocatable :: lon_veg(:) + real(r8), allocatable :: lon_veg_edge(:) + real(r8), allocatable :: lat_veg(:) + real(r8), allocatable :: lat_veg_edge(:) + real(r8), allocatable :: lat_lai(:) + real(r8), allocatable :: clat(:) + character(len=32) :: test_name + character(len=4) :: tag_name + type(file_desc_t) :: piofile + type(var_desc_t) :: vid + logical :: do_soilw + + character(len=shr_kind_cl) :: locfn + logical :: prog_modal_aero + + ! determine if modal aerosols are active so that fraction_landuse array is initialized for modal aerosal dry dep + call phys_getopts(prog_modal_aero_out=prog_modal_aero) + + call dvel_inti_fromlnd() + + if( masterproc ) then + write(iulog,*) 'drydep_inti: following species have dry deposition' + do i=1,nddvels + if( len_trim(drydep_list(i)) > 0 ) then + write(iulog,*) 'drydep_inti: '//trim(drydep_list(i))//' is requested to have dry dep' + endif + enddo + write(iulog,*) 'drydep_inti:' + endif + + !------------------------------------------------------------------------------------- + ! ... get species indices + !------------------------------------------------------------------------------------- + xpan_ndx = get_spc_ndx( 'XPAN' ) + xmpan_ndx = get_spc_ndx( 'XMPAN' ) + o3a_ndx = get_spc_ndx( 'O3A' ) + + ch4_ndx = get_spc_ndx( 'CH4' ) + h2_ndx = get_spc_ndx( 'H2' ) + co_ndx = get_spc_ndx( 'CO' ) + Pb_ndx = get_spc_ndx( 'Pb' ) + pan_ndx = get_spc_ndx( 'PAN' ) + mpan_ndx = get_spc_ndx( 'MPAN' ) + o3_ndx = get_spc_ndx( 'OX' ) + if( o3_ndx < 0 ) then + o3_ndx = get_spc_ndx( 'O3' ) + end if + so2_ndx = get_spc_ndx( 'SO2' ) + alkooh_ndx = get_spc_ndx( 'ALKOOH') + mekooh_ndx = get_spc_ndx( 'MEKOOH') + tolooh_ndx = get_spc_ndx( 'TOLOOH') + terpooh_ndx = get_spc_ndx( 'TERPOOH') + ch3cooh_ndx = get_spc_ndx( 'CH3COOH') + soa_ndx = get_spc_ndx( 'SOA' ) + so4_ndx = get_spc_ndx( 'SO4' ) + cb1_ndx = get_spc_ndx( 'CB1' ) + cb2_ndx = get_spc_ndx( 'CB2' ) + oc1_ndx = get_spc_ndx( 'OC1' ) + oc2_ndx = get_spc_ndx( 'OC2' ) + nh3_ndx = get_spc_ndx( 'NH3' ) + nh4no3_ndx = get_spc_ndx( 'NH4NO3' ) + sa1_ndx = get_spc_ndx( 'SA1' ) + sa2_ndx = get_spc_ndx( 'SA2' ) + sa3_ndx = get_spc_ndx( 'SA3' ) + sa4_ndx = get_spc_ndx( 'SA4' ) + nh4_ndx = get_spc_ndx( 'NH4' ) + alkooh_dd = has_drydep( 'ALKOOH') + mekooh_dd = has_drydep( 'MEKOOH') + tolooh_dd = has_drydep( 'TOLOOH') + terpooh_dd = has_drydep( 'TERPOOH') + ch3cooh_dd = has_drydep( 'CH3COOH') + soa_dd = has_drydep( 'SOA' ) + so4_dd = has_drydep( 'SO4' ) + cb1_dd = has_drydep( 'CB1' ) + cb2_dd = has_drydep( 'CB2' ) + oc1_dd = has_drydep( 'OC1' ) + oc2_dd = has_drydep( 'OC2' ) + nh3_dd = has_drydep( 'NH3' ) + nh4no3_dd = has_drydep( 'NH4NO3' ) + sa1_dd = has_drydep( 'SA1' ) + sa2_dd = has_drydep( 'SA2' ) + sa3_dd = has_drydep( 'SA3' ) + sa4_dd = has_drydep( 'SA4' ) + nh4_dd = has_drydep( 'NH4' ) +! + soam_ndx = get_spc_ndx( 'SOAM' ) + soai_ndx = get_spc_ndx( 'SOAI' ) + soat_ndx = get_spc_ndx( 'SOAT' ) + soab_ndx = get_spc_ndx( 'SOAB' ) + soax_ndx = get_spc_ndx( 'SOAX' ) + sogm_ndx = get_spc_ndx( 'SOGM' ) + sogi_ndx = get_spc_ndx( 'SOGI' ) + sogt_ndx = get_spc_ndx( 'SOGT' ) + sogb_ndx = get_spc_ndx( 'SOGB' ) + sogx_ndx = get_spc_ndx( 'SOGX' ) + soam_dd = has_drydep ( 'SOAM' ) + soai_dd = has_drydep ( 'SOAI' ) + soat_dd = has_drydep ( 'SOAT' ) + soab_dd = has_drydep ( 'SOAB' ) + soax_dd = has_drydep ( 'SOAX' ) + sogm_dd = has_drydep ( 'SOGM' ) + sogi_dd = has_drydep ( 'SOGI' ) + sogt_dd = has_drydep ( 'SOGT' ) + sogb_dd = has_drydep ( 'SOGB' ) + sogx_dd = has_drydep ( 'SOGX' ) +! + hcn_ndx = get_spc_ndx( 'HCN') + ch3cn_ndx = get_spc_ndx( 'CH3CN') + +!lke-TS1 + phenooh_ndx = get_spc_ndx( 'PHENOOH') + benzooh_ndx = get_spc_ndx( 'BENZOOH') + c6h5ooh_ndx = get_spc_ndx( 'C6H5OOH') + bzooh_ndx = get_spc_ndx( 'BZOOH') + xylolooh_ndx = get_spc_ndx( 'XYLOLOOH') + xylenooh_ndx = get_spc_ndx( 'XYLENOOH') + terp2ooh_ndx = get_spc_ndx( 'TERP2OOH') + terprod1_ndx = get_spc_ndx( 'TERPROD1') + terprod2_ndx = get_spc_ndx( 'TERPROD2') + hmprop_ndx = get_spc_ndx( 'HMPROP') + mboooh_ndx = get_spc_ndx( 'MBOOOH') + hpald_ndx = get_spc_ndx( 'HPALD') + iepox_ndx = get_spc_ndx( 'IEPOX') + noa_ndx = get_spc_ndx( 'NOA') + alknit_ndx = get_spc_ndx( 'ALKNIT') + isopnita_ndx = get_spc_ndx( 'ISOPNITA') + isopnitb_ndx = get_spc_ndx( 'ISOPNITB') + honitr_ndx = get_spc_ndx( 'HONITR') + isopnooh_ndx = get_spc_ndx( 'ISOPNOOH') + nc4cho_ndx = get_spc_ndx( 'NC4CHO') + nc4ch2oh_ndx = get_spc_ndx( 'NC4CH2OH') + terpnit_ndx = get_spc_ndx( 'TERPNIT') + nterpooh_ndx = get_spc_ndx( 'NTERPOOH') + phenooh_dd = has_drydep( 'PHENOOH') + benzooh_dd = has_drydep( 'BENZOOH') + c6h5ooh_dd = has_drydep( 'C6H5OOH') + bzooh_dd = has_drydep( 'BZOOH') + xylolooh_dd = has_drydep( 'XYLOLOOH') + xylenooh_dd = has_drydep( 'XYLENOOH') + terp2ooh_dd = has_drydep( 'TERP2OOH') + terprod1_dd = has_drydep( 'TERPROD1') + terprod2_dd = has_drydep( 'TERPROD2') + hmprop_dd = has_drydep( 'HMPROP') + mboooh_dd = has_drydep( 'MBOOOH') + hpald_dd = has_drydep( 'HPALD') + iepox_dd = has_drydep( 'IEPOX') + noa_dd = has_drydep( 'NOA') + alknit_dd = has_drydep( 'ALKNIT') + isopnita_dd = has_drydep( 'ISOPNITA') + isopnitb_dd = has_drydep( 'ISOPNITB') + honitr_dd = has_drydep( 'HONITR') + isopnooh_dd = has_drydep( 'ISOPNOOH') + nc4cho_dd = has_drydep( 'NC4CHO') + nc4ch2oh_dd = has_drydep( 'NC4CH2OH') + terpnit_dd = has_drydep( 'TERPNIT') + nterpooh_dd = has_drydep( 'NTERPOOH') +! + cohc_ndx = get_spc_ndx( 'COhc' ) + come_ndx = get_spc_ndx( 'COme' ) + + tag_cnt=0 + cotag_ndx(:)=-1 + do i = 1,NTAGS + write(tag_name,'(a2,i2.2)') 'CO',i + ndx = get_spc_ndx(tag_name) + if (ndx>0) then + tag_cnt = tag_cnt+1 + cotag_ndx(tag_cnt) = ndx + endif + enddo + + o3s_ndx = get_spc_ndx( 'O3S' ) + + do i=1,nddvels + if ( ( mapping(i) > 0 ) .and. ( drySpc_ndx(i) > 0 ) ) then + m = drySpc_ndx(i) + has_dvel(m) = .true. + map_dvel(m) = i + endif + enddo + + if( all( .not. has_dvel(:) ) ) then + return + end if + + !--------------------------------------------------------------------------- + ! ... allocate module variables + !--------------------------------------------------------------------------- + allocate( dep_ra(pcols,n_land_type,begchunk:endchunk),stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate dep_ra; error = ',astat + call endrun + end if + allocate( dep_rb(pcols,n_land_type,begchunk:endchunk),stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate dep_rb; error = ',astat + call endrun + end if + + if (drydep_method == DD_XLND .and. (.not.prog_modal_aero)) then + return + endif + + do_soilw = .not. dyn_soilw .and. (has_drydep( 'H2' ) .or. has_drydep( 'CO' )) + allocate( fraction_landuse(pcols,n_land_type, begchunk:endchunk),stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate fraction_landuse; error = ',astat + call endrun + end if + if(do_soilw) then + allocate(soilw_3d(pcols,12,begchunk:endchunk),stat=astat) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate soilw_3d error = ',astat + call endrun + end if + end if + + plon = get_dyn_grid_parm('plon') + plat = get_dyn_grid_parm('plat') + allocate( index_season_lai_j(n_land_type,12),stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate index_season_lai_j; error = ',astat + call endrun + end if + if(dycore_is('UNSTRUCTURED') ) then + call get_landuse_and_soilw_from_file(do_soilw) + allocate( index_season_lai(plon,12),stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate index_season_lai; error = ',astat + call endrun + end if + else + allocate( index_season_lai(plat,12),stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate index_season_lai; error = ',astat + call endrun + end if + !--------------------------------------------------------------------------- + ! ... read landuse map + !--------------------------------------------------------------------------- + call getfil (depvel_lnd_file, locfn, 0) + call cam_pio_openfile (piofile, trim(locfn), PIO_NOWRITE) + !--------------------------------------------------------------------------- + ! ... get the dimensions + !--------------------------------------------------------------------------- + ierr = pio_inq_dimid( piofile, 'lon', dimid ) + ierr = pio_inq_dimlen( piofile, dimid, nlon_veg ) + ierr = pio_inq_dimid( piofile, 'lat', dimid ) + ierr = pio_inq_dimlen( piofile, dimid, nlat_veg ) + ierr = pio_inq_dimid( piofile, 'pft', dimid ) + ierr = pio_inq_dimlen( piofile, dimid, npft_veg ) + !--------------------------------------------------------------------------- + ! ... allocate arrays + !--------------------------------------------------------------------------- + allocate( vegetation_map(nlon_veg,nlat_veg,npft_veg), work(nlon_veg,nlat_veg), stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate vegation_map; error = ',astat + call endrun + end if + allocate( urban(nlon_veg,nlat_veg), lake(nlon_veg,nlat_veg), & + landmask(nlon_veg,nlat_veg), wetland(nlon_veg,nlat_veg), stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate vegation_map; error = ',astat + call endrun + end if + allocate( lon_veg(nlon_veg), lat_veg(nlat_veg), & + lon_veg_edge(nlon_veg+1), lat_veg_edge(nlat_veg+1), stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate vegation lon, lat arrays; error = ',astat + call endrun + end if + !--------------------------------------------------------------------------- + ! ... read the vegetation map and landmask + !--------------------------------------------------------------------------- + ierr = pio_inq_varid( piofile, 'PCT_PFT', vid ) + ierr = pio_get_var( piofile, vid, vegetation_map ) + + ierr = pio_inq_varid( piofile, 'LANDMASK', vid ) + ierr = pio_get_var( piofile, vid, landmask ) + + ierr = pio_inq_varid( piofile, 'PCT_URBAN', vid ) + ierr = pio_get_var( piofile, vid, urban ) + + ierr = pio_inq_varid( piofile, 'PCT_LAKE', vid ) + ierr = pio_get_var( piofile, vid, lake ) + + ierr = pio_inq_varid( piofile, 'PCT_WETLAND', vid ) + ierr = pio_get_var( piofile, vid, wetland ) + + call cam_pio_closefile( piofile ) + + !--------------------------------------------------------------------------- + ! scale vegetation, urban, lake, and wetland to fraction + !--------------------------------------------------------------------------- + vegetation_map(:,:,:) = .01_r8 * vegetation_map(:,:,:) + wetland(:,:) = .01_r8 * wetland(:,:) + lake(:,:) = .01_r8 * lake(:,:) + urban(:,:) = .01_r8 * urban(:,:) +#ifdef DEBUG + if(masterproc) then + write(iulog,*) 'minmax vegetation_map ',minval(vegetation_map),maxval(vegetation_map) + write(iulog,*) 'minmax wetland ',minval(wetland),maxval(wetland) + write(iulog,*) 'minmax landmask ',minval(landmask),maxval(landmask) + end if +#endif + !--------------------------------------------------------------------------- + ! ... define lat-lon of vegetation map (1x1) + !--------------------------------------------------------------------------- + lat_veg(:) = (/ (-89.5_r8 + (i-1),i=1,nlat_veg ) /) + lon_veg(:) = (/ ( 0.5_r8 + (i-1),i=1,nlon_veg ) /) + lat_veg_edge(:) = (/ (-90.0_r8 + (i-1),i=1,nlat_veg+1) /) + lon_veg_edge(:) = (/ ( 0.0_r8 + (i-1),i=1,nlon_veg+1) /) + !--------------------------------------------------------------------------- + ! ... read soilw table if necessary + !--------------------------------------------------------------------------- + + if( do_soilw ) then + call soilw_inti( clim_soilw_file, nlon_veg, nlat_veg, soilw_map ) + end if + + !--------------------------------------------------------------------------- + ! ... regrid to model grid + !--------------------------------------------------------------------------- + + call interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_veg_edge, & + lon_veg, lon_veg_edge, landmask, urban, lake, & + wetland, vegetation_map, soilw_map, do_soilw ) + + deallocate( vegetation_map, work, stat=astat ) + deallocate( lon_veg, lat_veg, lon_veg_edge, lat_veg_edge, stat=astat ) + deallocate( landmask, urban, lake, wetland, stat=astat ) + if( do_soilw ) then + deallocate( soilw_map, stat=astat ) + end if + endif ! Unstructured grid + + if (drydep_method == DD_XLND) then + return + endif + + !--------------------------------------------------------------------------- + ! ... read LAI based season indeces + !--------------------------------------------------------------------------- + call getfil (season_wes_file, locfn, 0) + call cam_pio_openfile (piofile, trim(locfn), PIO_NOWRITE) + !--------------------------------------------------------------------------- + ! ... get the dimensions + !--------------------------------------------------------------------------- + ierr = pio_inq_dimid( piofile, 'lat', dimid ) + ierr = pio_inq_dimlen( piofile, dimid, nlat_lai ) + ierr = pio_inq_dimid( piofile, 'pft', dimid ) + ierr = pio_inq_dimlen( piofile, dimid, npft_lai ) + !--------------------------------------------------------------------------- + ! ... allocate arrays + !--------------------------------------------------------------------------- + allocate( lat_lai(nlat_lai), wk_lai(nlat_lai,npft_lai,12), stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate vegation_map; error = ',astat + call endrun + end if + !--------------------------------------------------------------------------- + ! ... read the latitude and the season indicies + !--------------------------------------------------------------------------- + ierr = pio_inq_varid( piofile, 'lat', vid ) + ierr = pio_get_var( piofile, vid, lat_lai ) + + ierr = pio_inq_varid( piofile, 'season_wes', vid ) + ierr = pio_get_var( piofile, vid, wk_lai ) + + call cam_pio_closefile( piofile ) + + + if(dycore_is('UNSTRUCTURED') ) then + ! For unstructured grids plon is the 1d horizontal grid size and plat=1 + allocate(clat(plon)) + call get_horiz_grid_d(plon, clat_d_out=clat) + jl = 1 + ju = plon + else + allocate(clat(plat)) + call get_horiz_grid_d(plat, clat_d_out=clat) + jl = 1 + ju = plat + end if + imin = 1 + do j = 1,ju + diff_min = 10._r8 + pos_min = -99 + target_lat = clat(j)*r2d + do i = imin,nlat_lai + if( abs(lat_lai(i) - target_lat) < diff_min ) then + diff_min = abs(lat_lai(i) - target_lat) + pos_min = i + end if + end do + if( pos_min < 0 ) then + write(iulog,*) 'dvel_inti: cannot find ',target_lat,' at j,pos_min,diff_min = ',j,pos_min,diff_min + write(iulog,*) 'dvel_inti: imin,nlat_lai = ',imin,nlat_lai + write(iulog,*) 'dvel_inti: lat_lai' + write(iulog,'(1p,10g12.5)') lat_lai(:) + call endrun + end if + if(dycore_is('UNSTRUCTURED') ) then + imin=1 + else + imin = pos_min + end if + index_season_lai_j(:,:) = wk_lai(pos_min,:,:) + + !--------------------------------------------------------------------------- + ! specify the season as the most frequent in the 11 vegetation classes + ! this was done to remove a banding problem in dvel (JFL Oct 04) + !--------------------------------------------------------------------------- + do m = 1,12 + num_seas = 0 + do l = 1,11 + do k = 1,5 + if( index_season_lai_j(l,m) == k ) then + num_seas(k) = num_seas(k) + 1 + exit + end if + end do + end do + + num_max = -1 + do k = 1,5 + if( num_seas(k) > num_max ) then + num_max = num_seas(k) + k_max = k + endif + end do + + index_season_lai(j,m) = k_max + end do + end do + + deallocate( lat_lai, wk_lai, clat, index_season_lai_j) + + end subroutine dvel_inti_xactive + + !------------------------------------------------------------------------------------- + subroutine get_landuse_and_soilw_from_file(do_soilw) + use ncdio_atm, only : infld + logical, intent(in) :: do_soilw + logical :: readvar + + type(file_desc_t) :: piofile + character(len=shr_kind_cl) :: locfn + logical :: lexist + + call getfil (drydep_srf_file, locfn, 1, lexist) + if(lexist) then + call cam_pio_openfile(piofile, locfn, PIO_NOWRITE) + + call infld('fraction_landuse', piofile, 'ncol','class',1,pcols,1,n_land_type, begchunk,endchunk, & + fraction_landuse, readvar, gridname='physgrid') + if (.not. readvar) then + write(iulog,*)'**************************************' + write(iulog,*)'get_landuse_and_soilw_from_file: INFO:' + write(iulog,*)' fraction_landuse not read from file: ' + write(iulog,*)' ', trim(locfn) + write(iulog,*)' setting all values to zero' + write(iulog,*)'**************************************' + fraction_landuse = 0._r8 + end if + + if(do_soilw) then + call infld('soilw', piofile, 'ncol','month',1,pcols,1,12, begchunk,endchunk, & + soilw_3d, readvar, gridname='physgrid') + end if + + call cam_pio_closefile(piofile) + else + call endrun('Unstructured grids require drydep_srf_file ') + end if + + + end subroutine get_landuse_and_soilw_from_file + + !------------------------------------------------------------------------------------- + subroutine interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_veg_edge, & + lon_veg, lon_veg_edge, landmask, urban, lake, & + wetland, vegetation_map, soilw_map, do_soilw ) + + use mo_constants, only : r2d + use scamMod, only : latiop,loniop,scmlat,scmlon,scm_cambfb_mode + use shr_scam_mod , only: shr_scam_getCloseLatLon ! Standardized system subroutines + use cam_initfiles, only: initial_file_get_id + use dycore, only : dycore_is + use phys_grid, only : scatter_field_to_chunk + implicit none + + !------------------------------------------------------------------------------------- + ! ... dummy arguments + !------------------------------------------------------------------------------------- + integer, intent(in) :: plon, plat, nlon_veg, nlat_veg, npft_veg + real(r8), pointer :: soilw_map(:,:,:) + real(r8), intent(in) :: landmask(nlon_veg,nlat_veg) + real(r8), intent(in) :: urban(nlon_veg,nlat_veg) + real(r8), intent(in) :: lake(nlon_veg,nlat_veg) + real(r8), intent(in) :: wetland(nlon_veg,nlat_veg) + real(r8), intent(in) :: vegetation_map(nlon_veg,nlat_veg,npft_veg) + real(r8), intent(in) :: lon_veg(nlon_veg) + real(r8), intent(in) :: lon_veg_edge(nlon_veg+1) + real(r8), intent(in) :: lat_veg(nlat_veg) + real(r8), intent(in) :: lat_veg_edge(nlat_veg+1) + logical, intent(in) :: do_soilw + + !------------------------------------------------------------------------------------- + ! ... local variables + !------------------------------------------------------------------------------------- + real(r8) :: closelat,closelon + integer :: latidx,lonidx + + integer, parameter :: veg_ext = 20 + type(file_desc_t), pointer :: piofile + integer :: i, j, ii, jj, jl, ju, i_ndx, n + integer, dimension(plon+1) :: ind_lon + integer, dimension(plat+1) :: ind_lat + real(r8) :: total_land + real(r8), dimension(plon+1) :: lon_edge + real(r8), dimension(plat+1) :: lat_edge + real(r8) :: lat1, lat2, lon1, lon2 + real(r8) :: x1, x2, y1, y2, dx, dy + real(r8) :: area, total_area + real(r8), dimension(npft_veg+3) :: fraction + real(r8) :: total_soilw_area + real(r8) :: fraction_soilw + real(r8) :: total_soilw(12) + + real(r8), dimension(-veg_ext:nlon_veg+veg_ext) :: lon_veg_edge_ext + integer, dimension(-veg_ext:nlon_veg+veg_ext) :: mapping_ext + + real(r8), allocatable :: lam(:), phi(:), garea(:) + + logical, parameter :: has_npole = .true. + integer :: ploniop,platiop + real(r8) :: tmp_frac_lu(plon,n_land_type,plat), tmp_soilw_3d(plon,12,plat) + + if(dycore_is('UNSTRUCTURED') ) then + ! For unstructured grids plon is the 1d horizontal grid size and plat=1 + allocate(lam(plon), phi(plon)) + call get_horiz_grid_d(plon, clat_d_out=phi) + else + allocate(lam(plon), phi(plat)) + call get_horiz_grid_d(plat, clat_d_out=phi) + endif + call get_horiz_grid_d(plon, clon_d_out=lam) + + + jl = 1 + ju = plon + + if (single_column) then + if (scm_cambfb_mode) then + piofile => initial_file_get_id() + call shr_scam_getCloseLatLon(piofile%fh,scmlat,scmlon,closelat,closelon,latidx,lonidx) + ploniop=size(loniop) + platiop=size(latiop) + else + latidx=1 + lonidx=1 + ploniop=1 + platiop=1 + end if + + lon_edge(1) = loniop(lonidx) * r2d - .5_r8*(loniop(2) - loniop(1)) * r2d + + if (lonidx.lt.ploniop) then + lon_edge(2) = loniop(lonidx+1) * r2d - .5_r8*(loniop(2) - loniop(1)) * r2d + else + lon_edge(2) = lon_edge(1) + (loniop(2) - loniop(1)) * r2d + end if + + lat_edge(1) = latiop(latidx) * r2d - .5_r8*(latiop(2) - latiop(1)) * r2d + + if (latidx.lt.platiop) then + lat_edge(2) = latiop(latidx+1) * r2d - .5_r8*(latiop(2) - latiop(1)) * r2d + else + lat_edge(2) = lat_edge(1) + (latiop(2) - latiop(1)) * r2d + end if + else + do i = 1,plon + lon_edge(i) = lam(i) * r2d - .5_r8*(lam(2) - lam(1)) * r2d + end do + lon_edge(plon+1) = lon_edge(plon) + (lam(2) - lam(1)) * r2d + if( .not. has_npole ) then + do j = 1,plat+1 + lat_edge(j) = phi(j) * r2d - .5_r8*(phi(2) - phi(1)) * r2d + end do + else + do j = 1,plat + lat_edge(j) = phi(j) * r2d - .5_r8*(phi(2) - phi(1)) * r2d + end do + lat_edge(plat+1) = lat_edge(plat) + (phi(2) - phi(1)) * r2d + end if + end if + do j = 1,plat+1 + lat_edge(j) = min( lat_edge(j), 90._r8 ) + lat_edge(j) = max( lat_edge(j),-90._r8 ) + end do + + !------------------------------------------------------------------------------------- + ! wrap around the longitudes + !------------------------------------------------------------------------------------- + do i = -veg_ext,0 + lon_veg_edge_ext(i) = lon_veg_edge(nlon_veg+i) - 360._r8 + mapping_ext (i) = nlon_veg+i + end do + do i = 1,nlon_veg + lon_veg_edge_ext(i) = lon_veg_edge(i) + mapping_ext (i) = i + end do + do i = nlon_veg+1,nlon_veg+veg_ext + lon_veg_edge_ext(i) = lon_veg_edge(i-nlon_veg) + 360._r8 + mapping_ext (i) = i-nlon_veg + end do +#ifdef DEBUG + write(iulog,*) 'interp_map : lon_edge ',lon_edge + write(iulog,*) 'interp_map : lat_edge ',lat_edge + write(iulog,*) 'interp_map : mapping_ext ',mapping_ext +#endif + do j = 1,plon+1 + lon1 = lon_edge(j) + do i = -veg_ext,nlon_veg+veg_ext + dx = lon_veg_edge_ext(i ) - lon1 + dy = lon_veg_edge_ext(i+1) - lon1 + if( dx*dy <= 0._r8 ) then + ind_lon(j) = i + exit + end if + end do + end do + + do j = 1,plat+1 + lat1 = lat_edge(j) + do i = 1,nlat_veg + dx = lat_veg_edge(i ) - lat1 + dy = lat_veg_edge(i+1) - lat1 + if( dx*dy <= 0._r8 ) then + ind_lat(j) = i + exit + end if + end do + end do +#ifdef DEBUG + write(iulog,*) 'interp_map : ind_lon ',ind_lon + write(iulog,*) 'interp_map : ind_lat ',ind_lat +#endif + lat_loop : do j = 1,plat + lon_loop : do i = 1,plon + total_area = 0._r8 + fraction = 0._r8 + total_soilw(:) = 0._r8 + total_soilw_area = 0._r8 + do jj = ind_lat(j),ind_lat(j+1) + y1 = max( lat_edge(j),lat_veg_edge(jj) ) + y2 = min( lat_edge(j+1),lat_veg_edge(jj+1) ) + dy = (y2 - y1)/(lat_veg_edge(jj+1) - lat_veg_edge(jj)) + do ii =ind_lon(i),ind_lon(i+1) + i_ndx = mapping_ext(ii) + x1 = max( lon_edge(i),lon_veg_edge_ext(ii) ) + x2 = min( lon_edge(i+1),lon_veg_edge_ext(ii+1) ) + dx = (x2 - x1)/(lon_veg_edge_ext(ii+1) - lon_veg_edge_ext(ii)) + area = dx * dy + total_area = total_area + area + !----------------------------------------------------------------- + ! ... special case for ocean grid point + !----------------------------------------------------------------- + if( nint(landmask(i_ndx,jj)) == 0 ) then + fraction(npft_veg+1) = fraction(npft_veg+1) + area + else + do n = 1,npft_veg + fraction(n) = fraction(n) + vegetation_map(i_ndx,jj,n) * area + end do + fraction(npft_veg+1) = fraction(npft_veg+1) + area * lake (i_ndx,jj) + fraction(npft_veg+2) = fraction(npft_veg+2) + area * wetland(i_ndx,jj) + fraction(npft_veg+3) = fraction(npft_veg+3) + area * urban (i_ndx,jj) + !----------------------------------------------------------------- + ! ... check if land accounts for the whole area. + ! If not, the remaining area is in the ocean + !----------------------------------------------------------------- + total_land = sum(vegetation_map(i_ndx,jj,:)) & + + urban (i_ndx,jj) & + + lake (i_ndx,jj) & + + wetland(i_ndx,jj) + if( total_land < 1._r8 ) then + fraction(npft_veg+1) = fraction(npft_veg+1) + (1._r8 - total_land) * area + end if + !------------------------------------------------------------------------------------- + ! ... compute weighted average of soilw over grid (non-water only) + !------------------------------------------------------------------------------------- + if( do_soilw ) then + fraction_soilw = total_land - (lake(i_ndx,jj) + wetland(i_ndx,jj)) + total_soilw_area = total_soilw_area + fraction_soilw * area + total_soilw(:) = total_soilw(:) + fraction_soilw * area * soilw_map(i_ndx,jj,:) + end if + end if + end do + end do + !------------------------------------------------------------------------------------- + ! ... divide by total area of grid box + !------------------------------------------------------------------------------------- + fraction(:) = fraction(:)/total_area + !------------------------------------------------------------------------------------- + ! ... make sure we don't have too much or too little + !------------------------------------------------------------------------------------- + if( abs( sum(fraction) - 1._r8) > .001_r8 ) then + fraction(:) = fraction(:)/sum(fraction) + end if + !------------------------------------------------------------------------------------- + ! ... map to Wesely land classification + !------------------------------------------------------------------------------------- + + + + + tmp_frac_lu(i, 1, j) = fraction(20) ! Urban + tmp_frac_lu(i, 2, j) = sum(fraction(16:17)) ! + tmp_frac_lu(i, 3, j) = sum(fraction(13:15)) ! + tmp_frac_lu(i, 4, j) = sum(fraction( 5: 9)) ! + tmp_frac_lu(i, 5, j) = sum(fraction( 2: 4)) ! + tmp_frac_lu(i, 6, j) = fraction(19) ! Wetland + tmp_frac_lu(i, 7, j) = fraction(18) ! Lake + tmp_frac_lu(i, 8, j) = fraction( 1) ! + tmp_frac_lu(i, 9, j) = 0._r8 + tmp_frac_lu(i,10, j) = 0._r8 + tmp_frac_lu(i,11, j) = sum(fraction(10:12)) ! + if( do_soilw ) then + if( total_soilw_area > 0._r8 ) then + tmp_soilw_3d(i,:,j) = total_soilw(:)/total_soilw_area + else + tmp_soilw_3d(i,:,j) = -99._r8 + end if + end if + end do lon_loop + end do lat_loop + !------------------------------------------------------------------------------------- + ! ... reshape according to lat-lon blocks + !------------------------------------------------------------------------------------- + call scatter_field_to_chunk(1,n_land_type,1,plon,tmp_frac_lu,fraction_landuse) + if(do_soilw) call scatter_field_to_chunk(1,12,1,plon,tmp_soilw_3d,soilw_3d) + !------------------------------------------------------------------------------------- + ! ... make sure there are no out of range values + !------------------------------------------------------------------------------------- + where (fraction_landuse < 0._r8) fraction_landuse = 0._r8 + where (fraction_landuse > 1._r8) fraction_landuse = 1._r8 + + end subroutine interp_map + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + subroutine drydep_xactive( ncdate, sfc_temp, pressure_sfc, & + wind_speed, spec_hum, air_temp, pressure_10m, rain, & + snow, solar_flux, dvel, dflx, State_Chm, & + tv, soilw, rh, ncol, lonndx, latndx, lchnk, & + ocnfrc, icefrc, beglandtype, endlandtype ) + !------------------------------------------------------------------------------------- + ! code based on wesely (atmospheric environment, 1989, vol 23, p. 1293-1304) for + ! calculation of r_c, and on walcek et. al. (atmospheric enviroment, 1986, + ! vol. 20, p. 949-964) for calculation of r_a and r_b + ! + ! as suggested in walcek (u_i)(u*_i) = (u_a)(u*_a) + ! is kept constant where i represents a subgrid environment and a the + ! grid average environment. thus the calculation proceeds as follows: + ! va the grid averaged wind is calculated on dots + ! z0(i) the grid averaged roughness coefficient is calculated + ! ri(i) the grid averaged richardson number is calculated + ! --> the grid averaged (u_a)(u*_a) is calculated + ! --> subgrid scale u*_i is calculated assuming (u_i) given as above + ! --> final deposotion velocity is weighted average of subgrid scale velocities + ! + ! code written by P. Hess, rewritten in fortran 90 by JFL (August 2000) + ! modified by JFL to be used in MOZART-2 (October 2002) + !------------------------------------------------------------------------------------- + + use seq_drydep_mod, only: z0, rgso, rgss, h2_a, h2_b, h2_c, ri, rclo, rcls, rlu, rac + use seq_drydep_mod, only: seq_drydep_setHCoeff, foxd, drat + use physconst, only: tmelt + use seq_drydep_mod, only: drydep_method, DD_XLND + + implicit none + + !------------------------------------------------------------------------------------- + ! ... dummy arguments + !------------------------------------------------------------------------------------- + integer, intent(in) :: ncol + integer, intent(in) :: ncdate ! present date (yyyymmdd) + real(r8), intent(in) :: sfc_temp(pcols) ! surface temperature (K) + real(r8), intent(in) :: pressure_sfc(pcols) ! surface pressure (Pa) + real(r8), intent(in) :: wind_speed(pcols) ! 10 meter wind speed (m/s) + real(r8), intent(in) :: spec_hum(pcols) ! specific humidity (kg/kg) + real(r8), intent(in) :: rh(ncol,1) ! relative humidity + real(r8), intent(in) :: air_temp(pcols) ! surface air temperature (K) + real(r8), intent(in) :: pressure_10m(pcols) ! 10 meter pressure (Pa) + real(r8), intent(in) :: rain(pcols) + real(r8), intent(in) :: snow(pcols) ! snow height (m) + real(r8), intent(in) :: soilw(pcols) ! soil moisture fraction + real(r8), intent(in) :: solar_flux(pcols) ! direct shortwave radiation at surface (W/m^2) + real(r8), intent(in) :: tv(pcols) ! potential temperature + type(ChmState), intent(in):: State_Chm ! GEOS-Chem State Chem + real(r8), intent(out) :: dvel(ncol,nTracersMax) ! deposition velocity (cm/s) + real(r8), intent(inout) :: dflx(pcols,nTracersMax) ! deposition flux (/cm^2/s) + + integer, intent(in) :: latndx(pcols) ! chunk latitude indicies + integer, intent(in) :: lonndx(pcols) ! chunk longitude indicies + integer, intent(in) :: lchnk ! chunk number + + integer, intent(in), optional :: beglandtype + integer, intent(in), optional :: endlandtype + + real(r8), intent(in), optional :: ocnfrc(pcols) + real(r8), intent(in), optional :: icefrc(pcols) + + !------------------------------------------------------------------------------------- + ! ... local variables + !------------------------------------------------------------------------------------- + real(r8), parameter :: scaling_to_cm_per_s = 100._r8 + real(r8), parameter :: rain_threshold = 1.e-7_r8 ! of the order of 1cm/day expressed in m/s + + integer :: i, ispec, lt, m + integer :: sndx + integer :: month + + real(r8) :: slope = 0._r8 + real(r8) :: z0water ! revised z0 over water + real(r8) :: p ! pressure at midpoint first layer + real(r8) :: pg ! surface pressure + real(r8) :: es ! saturation vapor pressure + real(r8) :: ws ! saturation mixing ratio + real(r8) :: hvar ! constant to compute xmol + real(r8) :: h ! constant to compute xmol + real(r8) :: psih ! stability correction factor + real(r8) :: rs ! constant for calculating rsmx + real(r8) :: rmx ! resistance by vegetation + real(r8) :: zovl ! ratio of z to m-o length + real(r8) :: cvarb ! cvar averaged over landtypes + real(r8) :: bb ! b averaged over landtypes + real(r8) :: ustarb ! ustar averaged over landtypes + real(r8) :: tc(ncol) ! temperature in celsius + real(r8) :: cts(ncol) ! correction to rlu rcl and rgs for frost + + !------------------------------------------------------------------------------------- + ! local arrays: dependent on location and species + !------------------------------------------------------------------------------------- + real(r8), dimension(ncol,nddvels) :: heff + + !------------------------------------------------------------------------------------- + ! local arrays: dependent on location only + !------------------------------------------------------------------------------------- + integer :: index_season(ncol,n_land_type) + real(r8), dimension(ncol) :: tha ! atmospheric virtual potential temperature + real(r8), dimension(ncol) :: thg ! ground virtual potential temperature + real(r8), dimension(ncol) :: z ! height of lowest level + real(r8), dimension(ncol) :: va ! magnitude of v on cross points + real(r8), dimension(ncol) :: ribn ! richardson number + real(r8), dimension(ncol) :: qs ! saturation specific humidity + real(r8), dimension(ncol) :: crs ! multiplier to calculate crs + real(r8), dimension(ncol) :: rdc ! part of lower canopy resistance + real(r8), dimension(ncol) :: uustar ! u*ustar (assumed constant over grid) + real(r8), dimension(ncol) :: z0b ! average roughness length over grid + real(r8), dimension(ncol) :: wrk ! work array + real(r8), dimension(ncol) :: term ! work array + real(r8), dimension(ncol) :: resc ! work array + real(r8), dimension(ncol) :: lnd_frc ! work array + logical, dimension(ncol) :: unstable + logical, dimension(ncol) :: has_rain + logical, dimension(ncol) :: has_dew + + !------------------------------------------------------------------------------------- + ! local arrays: dependent on location and landtype + !------------------------------------------------------------------------------------- + real(r8), dimension(ncol,n_land_type) :: rds ! resistance for deposition of sulfate + real(r8), dimension(ncol,n_land_type) :: b ! buoyancy parameter for unstable conditions + real(r8), dimension(ncol,n_land_type) :: cvar ! height parameter + real(r8), dimension(ncol,n_land_type) :: ustar ! friction velocity + real(r8), dimension(ncol,n_land_type) :: xmol ! monin-obukhov length + + !------------------------------------------------------------------------------------- + ! local arrays: dependent on location, landtype and species + !------------------------------------------------------------------------------------- + real(r8), dimension(ncol,n_land_type,nTracersMax) :: rsmx ! vegetative resistance (plant mesophyll) + real(r8), dimension(ncol,n_land_type,nTracersMax) :: rclx ! lower canopy resistance + real(r8), dimension(ncol,n_land_type,nTracersMax) :: rlux ! vegetative resistance (upper canopy) + real(r8), dimension(ncol,n_land_type) :: rlux_o3 ! vegetative resistance (upper canopy) + real(r8), dimension(ncol,n_land_type,nTracersMax) :: rgsx ! ground resistance + real(r8) :: pmid(ncol,1) ! for seasalt aerosols + real(r8) :: tfld(ncol,1) ! for seasalt aerosols + real(r8) :: fact, vds + real(r8) :: rc ! combined surface resistance + real(r8) :: var_soilw, dv_soil_h2, fact_h2 ! h2 dvel wrking variables + logical :: fr_lnduse(ncol,n_land_type) ! wrking array + real(r8) :: dewm ! multiplier for rs when dew occurs + + real(r8) :: lcl_frc_landuse(ncol,n_land_type) + + integer :: beglt, endlt + + !------------------------------------------------------------------------------------- + ! jfl : mods for PAN + !------------------------------------------------------------------------------------- + real(r8) :: dv_pan + real(r8) :: c0_pan(11) = (/ 0.000_r8, 0.006_r8, 0.002_r8, 0.009_r8, 0.015_r8, & + 0.006_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.002_r8, 0.002_r8 /) + real(r8) :: k_pan (11) = (/ 0.000_r8, 0.010_r8, 0.005_r8, 0.004_r8, 0.003_r8, & + 0.005_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.075_r8, 0.002_r8 /) + + if (present( beglandtype)) then + beglt = beglandtype + else + beglt = 1 + endif + if (present( endlandtype)) then + endlt = endlandtype + else + endlt = n_land_type + endif + + !------------------------------------------------------------------------------------- + ! initialize + !------------------------------------------------------------------------------------- + do m = 1,nTracersMax + dvel(:,m) = 0._r8 + end do + + if( all( .not. has_dvel(:) ) ) then + return + end if + + !------------------------------------------------------------------------------------- + ! define species-dependent parameters (temperature dependent) + !------------------------------------------------------------------------------------- + call seq_drydep_setHCoeff( ncol, sfc_temp, heff ) + + do lt = 1,n_land_type + dep_ra (:,lt,lchnk) = 0._r8 + dep_rb (:,lt,lchnk) = 0._r8 + rds(:,lt) = 0._r8 + end do + + !------------------------------------------------------------------------------------- + ! ... set month + !------------------------------------------------------------------------------------- + month = mod( ncdate,10000 )/100 + + !------------------------------------------------------------------------------------- + ! define which season (relative to Northern hemisphere climate) + !------------------------------------------------------------------------------------- + + !------------------------------------------------------------------------------------- + ! define season index based on fixed LAI + !------------------------------------------------------------------------------------- + if ( drydep_method == DD_XLND ) then + index_season = 4 + else + do i = 1,ncol + index_season(i,:) = index_season_lai(latndx(i),month) + end do + endif + !------------------------------------------------------------------------------------- + ! special case for snow covered terrain + !------------------------------------------------------------------------------------- + do i = 1,ncol + if( snow(i) > .01_r8 ) then + index_season(i,:) = 4 + end if + end do + !------------------------------------------------------------------------------------- + ! scale rain and define logical arrays + !------------------------------------------------------------------------------------- + has_rain(:ncol) = rain(:ncol) > rain_threshold + + !------------------------------------------------------------------------------------- + ! loop over longitude points + !------------------------------------------------------------------------------------- + col_loop : do i = 1,ncol + p = pressure_10m(i) + pg = pressure_sfc(i) + !------------------------------------------------------------------------------------- + ! potential temperature + !------------------------------------------------------------------------------------- + tha(i) = air_temp(i) * (p00/p )**rovcp * (1._r8 + .61_r8*spec_hum(i)) + thg(i) = sfc_temp(i) * (p00/pg)**rovcp * (1._r8 + .61_r8*spec_hum(i)) + !------------------------------------------------------------------------------------- + ! height of 1st level + !------------------------------------------------------------------------------------- + z(i) = - r/grav * air_temp(i) * (1._r8 + .61_r8*spec_hum(i)) * log(p/pg) + !------------------------------------------------------------------------------------- + ! wind speed + !------------------------------------------------------------------------------------- + va(i) = max( .01_r8,wind_speed(i) ) + !------------------------------------------------------------------------------------- + ! Richardson number + !------------------------------------------------------------------------------------- + ribn(i) = z(i) * grav * (tha(i) - thg(i))/thg(i) / (va(i)*va(i)) + ribn(i) = min( ribn(i),ric ) + unstable(i) = ribn(i) < 0._r8 + !------------------------------------------------------------------------------------- + ! saturation vapor pressure (Pascals) + ! saturation mixing ratio + ! saturation specific humidity + !------------------------------------------------------------------------------------- + es = 611._r8*exp( 5414.77_r8*(sfc_temp(i) - tmelt)/(tmelt*sfc_temp(i)) ) + ws = .622_r8*es/(pg - es) + qs(i) = ws/(1._r8 + ws) + has_dew(i) = .false. + if( qs(i) <= spec_hum(i) ) then + has_dew(i) = .true. + end if + if( sfc_temp(i) < tmelt ) then + has_dew(i) = .false. + end if + !------------------------------------------------------------------------------------- + ! constant in determining rs + !------------------------------------------------------------------------------------- + tc(i) = sfc_temp(i) - tmelt + if( sfc_temp(i) > tmelt .and. sfc_temp(i) < 313.15_r8 ) then + crs(i) = (1._r8 + (200._r8/(solar_flux(i) + .1_r8))**2) * (400._r8/(tc(i)*(40._r8 - tc(i)))) + else + crs(i) = large_value + end if + !------------------------------------------------------------------------------------- + ! rdc (lower canopy res) + !------------------------------------------------------------------------------------- + rdc(i) = 100._r8*(1._r8 + 1000._r8/(solar_flux(i) + 10._r8))/(1._r8 + 1000._r8*slope) + end do col_loop + + !------------------------------------------------------------------------------------- + ! ... form working arrays + !------------------------------------------------------------------------------------- + do lt = 1,n_land_type + do i=1,ncol + if ( drydep_method == DD_XLND ) then + lcl_frc_landuse(i,lt) = 0._r8 + else + lcl_frc_landuse(i,lt) = fraction_landuse(i,lt,lchnk) + endif + enddo + end do + if ( present(ocnfrc) .and. present(icefrc) ) then + do i=1,ncol + ! land type 7 is used for ocean + ! land type 8 is used for sea ice + lcl_frc_landuse(i,7) = ocnfrc(i) + lcl_frc_landuse(i,8) = icefrc(i) + enddo + endif + do lt = 1,n_land_type + do i=1,ncol + fr_lnduse(i,lt) = lcl_frc_landuse(i,lt) > 0._r8 + enddo + end do + + !------------------------------------------------------------------------------------- + ! find grid averaged z0: z0bar (the roughness length) z_o=exp[S(f_i*ln(z_oi))] + ! this is calculated so as to find u_i, assuming u*u=u_i*u_i + !------------------------------------------------------------------------------------- + z0b(:) = 0._r8 + do lt = 1,n_land_type + do i = 1,ncol + if( fr_lnduse(i,lt) ) then + z0b(i) = z0b(i) + lcl_frc_landuse(i,lt) * log( z0(index_season(i,lt),lt) ) + end if + end do + end do + + !------------------------------------------------------------------------------------- + ! find the constant velocity uu*=(u_i)(u*_i) + !------------------------------------------------------------------------------------- + do i = 1,ncol + z0b(i) = exp( z0b(i) ) + cvarb = vonkar/log( z(i)/z0b(i) ) + !------------------------------------------------------------------------------------- + ! unstable and stable cases + !------------------------------------------------------------------------------------- + if( unstable(i) ) then + bb = 9.4_r8*(cvarb**2)*sqrt( abs(ribn(i))*z(i)/z0b(i) ) + ustarb = cvarb * va(i) * sqrt( 1._r8 - (9.4_r8*ribn(i)/(1._r8 + 7.4_r8*bb)) ) + else + ustarb = cvarb * va(i)/(1._r8 + 4.7_r8*ribn(i)) + end if + uustar(i) = va(i)*ustarb + end do + + !------------------------------------------------------------------------------------- + ! calculate the friction velocity for each land type u_i=uustar/u*_i + !------------------------------------------------------------------------------------- + do lt = beglt,endlt + do i = 1,ncol + if( fr_lnduse(i,lt) ) then + if( unstable(i) ) then + cvar(i,lt) = vonkar/log( z(i)/z0(index_season(i,lt),lt) ) + b(i,lt) = 9.4_r8*(cvar(i,lt)**2)* sqrt( abs(ribn(i))*z(i)/z0(index_season(i,lt),lt) ) + ustar(i,lt) = sqrt( cvar(i,lt)*uustar(i)*sqrt( 1._r8 - (9.4_r8*ribn(i)/(1._r8 + 7.4_r8*b(i,lt))) ) ) + else + cvar(i,lt) = vonkar/log( z(i)/z0(index_season(i,lt),lt) ) + ustar(i,lt) = sqrt( cvar(i,lt)*uustar(i)/(1._r8 + 4.7_r8*ribn(i)) ) + end if + end if + end do + end do + + !------------------------------------------------------------------------------------- + ! revise calculation of friction velocity and z0 over water + !------------------------------------------------------------------------------------- + lt = 7 + do i = 1,ncol + if( fr_lnduse(i,lt) ) then + if( unstable(i) ) then + z0water = (.016_r8*(ustar(i,lt)**2)/grav) + diffk/(9.1_r8*ustar(i,lt)) + cvar(i,lt) = vonkar/(log( z(i)/z0water )) + b(i,lt) = 9.4_r8*(cvar(i,lt)**2)*sqrt( abs(ribn(i))*z(i)/z0water ) + ustar(i,lt) = sqrt( cvar(i,lt)*uustar(i)* sqrt( 1._r8 - (9.4_r8*ribn(i)/(1._r8+ 7.4_r8*b(i,lt))) ) ) + else + z0water = (.016_r8*(ustar(i,lt)**2)/grav) + diffk/(9.1_r8*ustar(i,lt)) + cvar(i,lt) = vonkar/(log(z(i)/z0water)) + ustar(i,lt) = sqrt( cvar(i,lt)*uustar(i)/(1._r8 + 4.7_r8*ribn(i)) ) + end if + end if + end do + + !------------------------------------------------------------------------------------- + ! compute monin-obukhov length for unstable and stable conditions/ sublayer resistance + !------------------------------------------------------------------------------------- + do lt = beglt,endlt + do i = 1,ncol + if( fr_lnduse(i,lt) ) then + hvar = (va(i)/0.74_r8) * (tha(i) - thg(i)) * (cvar(i,lt)**2) + if( unstable(i) ) then ! unstable + h = hvar*(1._r8 - (9.4_r8*ribn(i)/(1._r8 + 5.3_r8*b(i,lt)))) + else + h = hvar/((1._r8+4.7_r8*ribn(i))**2) + end if + xmol(i,lt) = thg(i) * ustar(i,lt) * ustar(i,lt) / (vonkar * grav * h) + end if + end do + end do + + !------------------------------------------------------------------------------------- + ! psih + !------------------------------------------------------------------------------------- + do lt = beglt,endlt + do i = 1,ncol + if( fr_lnduse(i,lt) ) then + if( xmol(i,lt) < 0._r8 ) then + zovl = z(i)/xmol(i,lt) + zovl = max( -1._r8,zovl ) + psih = exp( .598_r8 + .39_r8*log( -zovl ) - .09_r8*(log( -zovl ))**2 ) + vds = 2.e-3_r8*ustar(i,lt) * (1._r8 + (300/(-xmol(i,lt)))**0.666_r8) + else + zovl = z(i)/xmol(i,lt) + zovl = min( 1._r8,zovl ) + psih = -5._r8 * zovl + vds = 2.e-3_r8*ustar(i,lt) + end if + dep_ra (i,lt,lchnk) = (vonkar - psih*cvar(i,lt))/(ustar(i,lt)*vonkar*cvar(i,lt)) + dep_rb (i,lt,lchnk) = (2._r8/(vonkar*ustar(i,lt))) * crb + rds(i,lt) = 1._r8/vds + end if + end do + end do + + !------------------------------------------------------------------------------------- + ! surface resistance : depends on both land type and species + ! land types are computed seperately, then resistance is computed as average of values + ! following wesely rc=(1/(rs+rm) + 1/rlu +1/(rdc+rcl) + 1/(rac+rgs))**-1 + ! + ! compute rsmx = 1/(rs+rm) : multiply by 3 if surface is wet + !------------------------------------------------------------------------------------- + species_loop1 : do ispec = 1,nTracersMax + if( has_dvel(ispec) ) then + m = map_dvel(ispec) + do lt = beglt,endlt + do i = 1,ncol + if( fr_lnduse(i,lt) ) then + sndx = index_season(i,lt) + if( ispec == o3_ndx .or. ispec == o3a_ndx .or. ispec == so2_ndx ) then + rmx = 0._r8 + else + rmx = 1._r8/(heff(i,m)/3000._r8 + 100._r8*foxd(m)) + end if + cts(i) = 1000._r8*exp( - tc(i) - 4._r8 ) ! correction for frost + rgsx(i,lt,ispec) = cts(i) + 1._r8/((heff(i,m)/(1.e5_r8*rgss(sndx,lt))) + (foxd(m)/rgso(sndx,lt))) + !------------------------------------------------------------------------------------- + ! special case for H2 and CO;; CH4 is set ot a fraction of dv(H2) + !------------------------------------------------------------------------------------- + if( ispec == h2_ndx .or. ispec == co_ndx .or. ispec == ch4_ndx ) then + if( ispec == co_ndx ) then + fact_h2 = 1.0_r8 + elseif ( ispec == h2_ndx ) then + fact_h2 = 0.5_r8 + elseif ( ispec == ch4_ndx ) then + fact_h2 = 50.0_r8 + end if + !------------------------------------------------------------------------------------- + ! no deposition on snow, ice, desert, and water + !------------------------------------------------------------------------------------- + if( lt == 1 .or. lt == 7 .or. lt == 8 .or. sndx == 4 ) then + rgsx(i,lt,ispec) = large_value + else + var_soilw = max( .1_r8,min( soilw(i),.3_r8 ) ) + if( lt == 3 ) then + var_soilw = log( var_soilw ) + end if + dv_soil_h2 = h2_c(lt) + var_soilw*(h2_b(lt) + var_soilw*h2_a(lt)) + if( dv_soil_h2 > 0._r8 ) then + rgsx(i,lt,ispec) = fact_h2/(dv_soil_h2*1.e-4_r8) + end if + end if + end if + if( lt == 7 ) then + rclx(i,lt,ispec) = large_value + rsmx(i,lt,ispec) = large_value + rlux(i,lt,ispec) = large_value + else + rs = ri(sndx,lt)*crs(i) + if ( has_dew(i) .or. has_rain(i) ) then + dewm = 3._r8 + else + dewm = 1._r8 + end if + rsmx(i,lt,ispec) = (dewm*rs*drat(m) + rmx) + !------------------------------------------------------------------------------------- + ! jfl : special case for PAN + !------------------------------------------------------------------------------------- + if( ispec == pan_ndx .or. ispec == xpan_ndx ) then + dv_pan = c0_pan(lt) * (1._r8 - exp( -k_pan(lt)*(dewm*rs*drat(m))*1.e-2_r8 )) + if( dv_pan > 0._r8 .and. sndx /= 4 ) then + rsmx(i,lt,ispec) = ( 1._r8/dv_pan ) + end if + end if + rclx(i,lt,ispec) = cts(i) + 1._r8/((heff(i,m)/(1.e5_r8*rcls(sndx,lt))) + (foxd(m)/rclo(sndx,lt))) + rlux(i,lt,ispec) = cts(i) + rlu(sndx,lt)/(1.e-5_r8*heff(i,m) + foxd(m)) + end if + end if + end do + end do + end if + end do species_loop1 + + do lt = beglt,endlt + if( lt /= 7 ) then + do i = 1,ncol + if( fr_lnduse(i,lt) ) then + sndx = index_season(i,lt) + !------------------------------------------------------------------------------------- + ! ... no effect if sfc_temp < O C + !------------------------------------------------------------------------------------- + if( sfc_temp(i) > tmelt ) then + if( has_dew(i) ) then + rlux_o3(i,lt) = 3000._r8*rlu(sndx,lt)/(1000._r8 + rlu(sndx,lt)) + if( o3_ndx > 0 ) then + rlux(i,lt,o3_ndx) = rlux_o3(i,lt) + endif + if( o3a_ndx > 0 ) then + rlux(i,lt,o3a_ndx) = rlux_o3(i,lt) + endif + end if + if( has_rain(i) ) then + ! rlux(i,lt,o3_ndx) = 1./(1.e-3 + (1./(3.*rlu(sndx,lt)))) + rlux_o3(i,lt) = 3000._r8*rlu(sndx,lt)/(1000._r8 + 3._r8*rlu(sndx,lt)) + if( o3_ndx > 0 ) then + rlux(i,lt,o3_ndx) = rlux_o3(i,lt) + endif + if( o3a_ndx > 0 ) then + rlux(i,lt,o3a_ndx) = rlux_o3(i,lt) + endif + end if + end if + + if ( o3_ndx > 0 ) then + rclx(i,lt,o3_ndx) = cts(i) + rclo(index_season(i,lt),lt) + rlux(i,lt,o3_ndx) = cts(i) + rlux(i,lt,o3_ndx) + end if + if ( o3a_ndx > 0 ) then + rclx(i,lt,o3a_ndx) = cts(i) + rclo(index_season(i,lt),lt) + rlux(i,lt,o3a_ndx) = cts(i) + rlux(i,lt,o3a_ndx) + end if + + end if + end do + end if + end do + + species_loop2 : do ispec = 1,nTracersMax + m = map_dvel(ispec) + if( has_dvel(ispec) ) then + if( ispec /= o3_ndx .and. ispec /= o3a_ndx .and. ispec /= so2_ndx ) then + do lt = beglt,endlt + if( lt /= 7 ) then + do i = 1,ncol + if( fr_lnduse(i,lt) ) then + !------------------------------------------------------------------------------------- + ! no effect if sfc_temp < O C + !------------------------------------------------------------------------------------- + if( sfc_temp(i) > tmelt ) then + if( has_dew(i) ) then + rlux(i,lt,ispec) = 1._r8/((1._r8/(3._r8*rlux(i,lt,ispec))) & + + 1.e-7_r8*heff(i,m) + foxd(m)/rlux_o3(i,lt)) + end if + end if + + end if + end do + end if + end do + else if( ispec == so2_ndx ) then + do lt = beglt,endlt + if( lt /= 7 ) then + do i = 1,ncol + if( fr_lnduse(i,lt) ) then + !------------------------------------------------------------------------------------- + ! no effect if sfc_temp < O C + !------------------------------------------------------------------------------------- + if( sfc_temp(i) > tmelt ) then + if( qs(i) <= spec_hum(i) ) then + rlux(i,lt,ispec) = 100._r8 + end if + if( has_rain(i) ) then + ! rlux(i,lt,ispec) = 1./(2.e-4 + (1./(3.*rlu(index_season(i,lt),lt)))) + rlux(i,lt,ispec) = 15._r8*rlu(index_season(i,lt),lt)/(5._r8 + 3.e-3_r8*rlu(index_season(i,lt),lt)) + end if + end if + rclx(i,lt,ispec) = cts(i) + rcls(index_season(i,lt),lt) + rlux(i,lt,ispec) = cts(i) + rlux(i,lt,ispec) + + end if + end do + end if + end do + do i = 1,ncol + if( fr_lnduse(i,1) .and. (has_dew(i) .or. has_rain(i)) ) then + rlux(i,1,ispec) = 50._r8 + end if + end do + end if + end if + end do species_loop2 + + !------------------------------------------------------------------------------------- + ! compute rc + !------------------------------------------------------------------------------------- + term(:ncol) = 1.e-2_r8 * pressure_10m(:ncol) / (r*tv(:ncol)) + species_loop3 : do ispec = 1,nTracersMax + if( has_dvel(ispec) ) then + wrk(:) = 0._r8 + lt_loop: do lt = beglt,endlt + do i = 1,ncol + if (fr_lnduse(i,lt)) then + resc(i) = 1._r8/( 1._r8/rsmx(i,lt,ispec) + 1._r8/rlux(i,lt,ispec) & + + 1._r8/(rdc(i) + rclx(i,lt,ispec)) & + + 1._r8/(rac(index_season(i,lt),lt) + rgsx(i,lt,ispec))) + + resc(i) = max( 10._r8,resc(i) ) + + lnd_frc(i) = lcl_frc_landuse(i,lt) + endif + enddo + !------------------------------------------------------------------------------------- + ! ... compute average deposition velocity + !------------------------------------------------------------------------------------- + select case( tracerNames(ispec) ) + case( 'SO2' ) + if( lt == 7 ) then + where( fr_lnduse(:ncol,lt) ) + ! assume no surface resistance for SO2 over water` + wrk(:) = wrk(:) + lnd_frc(:)/(dep_ra(:ncol,lt,lchnk) + dep_rb(:ncol,lt,lchnk)) + endwhere + else + where( fr_lnduse(:ncol,lt) ) + wrk(:) = wrk(:) + lnd_frc(:)/(dep_ra(:ncol,lt,lchnk) + dep_rb(:ncol,lt,lchnk) + resc(:)) + endwhere + end if + + ! JFL - increase in dry deposition of SO2 to improve bias over US/Europe + wrk(:) = wrk(:) * 2._r8 + + case( 'SO4' ) + where( fr_lnduse(:ncol,lt) ) + wrk(:) = wrk(:) + lnd_frc(:)/(dep_ra(:ncol,lt,lchnk) + rds(:,lt)) + endwhere + case( 'NH4', 'NH4NO3', 'XNH4NO3' ) + where( fr_lnduse(:ncol,lt) ) + wrk(:) = wrk(:) + lnd_frc(:)/(dep_ra(:ncol,lt,lchnk) + 0.5_r8*rds(:,lt)) + endwhere + + !------------------------------------------------------------------------------------- + ! ... special case for Pb (for consistency with offline code) + !------------------------------------------------------------------------------------- + case( 'Pb' ) + if( lt == 7 ) then + where( fr_lnduse(:ncol,lt) ) + wrk(:) = wrk(:) + lnd_frc(:) * 0.05e-2_r8 + endwhere + else + where( fr_lnduse(:ncol,lt) ) + wrk(:ncol) = wrk(:ncol) + lnd_frc(:ncol) * 0.2e-2_r8 + endwhere + end if + + !------------------------------------------------------------------------------------- + ! ... special case for carbon aerosols + !------------------------------------------------------------------------------------- + case( 'CB1', 'CB2', 'OC1', 'OC2', 'SOAM', 'SOAI', 'SOAT', 'SOAB','SOAX' ) + if ( drydep_method == DD_XLND ) then + where( fr_lnduse(:ncol,lt) ) + wrk(:ncol) = wrk(:ncol) + lnd_frc(:ncol) * 0.10e-2_r8 + endwhere + else + wrk(:ncol) = 0.10e-2_r8 + endif + + !------------------------------------------------------------------------------------- + ! deposition over ocean for HCN, CH3CN + ! velocity estimated from aircraft measurements (E.Apel, INTEX-B) + !------------------------------------------------------------------------------------- + case( 'HCN','CH3CN' ) + if( lt == 7 ) then ! over ocean only + where( fr_lnduse(:ncol,lt) .and. snow(:ncol) < 0.01_r8 ) + wrk(:ncol) = wrk(:ncol) + lnd_frc(:ncol) * 0.2e-2_r8 + endwhere + end if + case default + where( fr_lnduse(:ncol,lt) ) + wrk(:ncol) = wrk(:ncol) + lnd_frc(:ncol)/(dep_ra(:ncol,lt,lchnk) + dep_rb(:ncol,lt,lchnk) + resc(:ncol)) + endwhere + end select + end do lt_loop + dvel(:ncol,ispec) = wrk(:ncol) * scaling_to_cm_per_s + dflx(:ncol,ispec) = term(:ncol) * dvel(:ncol,ispec) * State_Chm%Species(1,:ncol,plev,ispec) + end if + + end do species_loop3 + + if ( beglt > 1 ) return + + !------------------------------------------------------------------------------------- + ! ... special adjustments + !------------------------------------------------------------------------------------- + if( mpan_ndx > 0 ) then + if( has_dvel(mpan_ndx) ) then + dvel(:ncol,mpan_ndx) = dvel(:ncol,mpan_ndx)/3._r8 + dflx(:ncol,mpan_ndx) = term(:ncol) * dvel(:ncol,mpan_ndx) * State_Chm%Species(1,:ncol,plev,mpan_ndx) + end if + end if + if( xmpan_ndx > 0 ) then + if( has_dvel(xmpan_ndx) ) then + dvel(:ncol,xmpan_ndx) = dvel(:ncol,xmpan_ndx)/3._r8 + dflx(:ncol,xmpan_ndx) = term(:ncol) * dvel(:ncol,xmpan_ndx) * State_Chm%Species(1,:ncol,plev,xmpan_ndx) + end if + end if + + ! HCOOH, use CH3COOH dep.vel + if( hcooh_ndx > 0) then + if( has_dvel(hcooh_ndx) ) then + dvel(:ncol,hcooh_ndx) = dvel(:ncol,ch3cooh_ndx) + dflx(:ncol,hcooh_ndx) = term(:ncol) * dvel(:ncol,hcooh_ndx) * State_Chm%Species(1,:ncol,plev,hcooh_ndx) + end if + end if +! +! SOG species +! + if( sogm_ndx > 0) then + if( has_dvel(sogm_ndx) ) then + dvel(:ncol,sogm_ndx) = dvel(:ncol,ch3cooh_ndx) + dflx(:ncol,sogm_ndx) = term(:ncol) * dvel(:ncol,sogm_ndx) * State_Chm%Species(1,:ncol,plev,sogm_ndx) + end if + end if + if( sogi_ndx > 0) then + if( has_dvel(sogi_ndx) ) then + dvel(:ncol,sogi_ndx) = dvel(:ncol,ch3cooh_ndx) + dflx(:ncol,sogi_ndx) = term(:ncol) * dvel(:ncol,sogi_ndx) * State_Chm%Species(1,:ncol,plev,sogi_ndx) + end if + end if + if( sogt_ndx > 0) then + if( has_dvel(sogt_ndx) ) then + dvel(:ncol,sogt_ndx) = dvel(:ncol,ch3cooh_ndx) + dflx(:ncol,sogt_ndx) = term(:ncol) * dvel(:ncol,sogt_ndx) * State_Chm%Species(1,:ncol,plev,sogt_ndx) + end if + end if + if( sogb_ndx > 0) then + if( has_dvel(sogb_ndx) ) then + dvel(:ncol,sogb_ndx) = dvel(:ncol,ch3cooh_ndx) + dflx(:ncol,sogb_ndx) = term(:ncol) * dvel(:ncol,sogb_ndx) * State_Chm%Species(1,:ncol,plev,sogb_ndx) + end if + end if + if( sogx_ndx > 0) then + if( has_dvel(sogx_ndx) ) then + dvel(:ncol,sogx_ndx) = dvel(:ncol,ch3cooh_ndx) + dflx(:ncol,sogx_ndx) = term(:ncol) * dvel(:ncol,sogx_ndx) * State_Chm%Species(1,:ncol,plev,sogx_ndx) + end if + end if +! + end subroutine drydep_xactive + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + subroutine soilw_inti( ncfile, nlon_veg, nlat_veg, soilw_map ) + !------------------------------------------------------------------ + ! ... read primary soil moisture table + !------------------------------------------------------------------ + + use time_manager, only : get_calday + + implicit none + + !------------------------------------------------------------------ + ! ... dummy args + !------------------------------------------------------------------ + integer, intent(in) :: & + nlon_veg, & + nlat_veg + real(r8), pointer :: soilw_map(:,:,:) + character(len=*), intent(in) :: ncfile ! file name of netcdf file containing data + + !------------------------------------------------------------------ + ! ... local variables + !------------------------------------------------------------------ + integer :: gndx = 0 + integer :: nlat, & ! # of lats in soilw file + nlon ! # of lons in soilw file + integer :: i, ip, k, m + integer :: j, jl, ju + integer :: lev, day, ierr + type(file_desc_t) :: piofile + type(var_desc_t) :: vid + + integer :: dimid_lat, dimid_lon, dimid_time + integer :: dates(12) = (/ 116, 214, 316, 415, 516, 615, & + 716, 816, 915, 1016, 1115, 1216 /) + + character(len=shr_kind_cl) :: locfn + + !----------------------------------------------------------------------- + ! ... open netcdf file + !----------------------------------------------------------------------- + call getfil (ncfile, locfn, 0) + call cam_pio_openfile (piofile, trim(locfn), PIO_NOWRITE) + + !----------------------------------------------------------------------- + ! ... get longitudes + !----------------------------------------------------------------------- + ierr = pio_inq_dimid( piofile, 'lon', dimid_lon ) + ierr = pio_inq_dimlen( piofile, dimid_lon, nlon ) + if( nlon /= nlon_veg ) then + write(iulog,*) 'soilw_inti: soil and vegetation lons differ; ',nlon, nlon_veg + call endrun + end if + !----------------------------------------------------------------------- + ! ... get latitudes + !----------------------------------------------------------------------- + ierr = pio_inq_dimid( piofile, 'lat', dimid_lat ) + ierr = pio_inq_dimlen( piofile, dimid_lat, nlat ) + if( nlat /= nlat_veg ) then + write(iulog,*) 'soilw_inti: soil and vegetation lats differ; ',nlat, nlat_veg + call endrun + end if + !----------------------------------------------------------------------- + ! ... set times (days of year) + !----------------------------------------------------------------------- + ierr = pio_inq_dimid( piofile, 'time', dimid_time ) + ierr = pio_inq_dimlen( piofile, dimid_time, ndays ) + if( ndays /= 12 ) then + write(iulog,*) 'soilw_inti: dataset not a cyclical year' + call endrun + end if + allocate( days(ndays),stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'soilw_inti: days allocation error = ',ierr + call endrun + end if + do m = 1,min(12,ndays) + days(m) = get_calday( dates(m), 0 ) + end do + + !------------------------------------------------------------------ + ! ... allocate arrays + !------------------------------------------------------------------ + allocate( soilw_map(nlon,nlat,ndays), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'soilw_inti: soilw_map allocation error = ',ierr + call endrun + end if + + !------------------------------------------------------------------ + ! ... read in the soil moisture + !------------------------------------------------------------------ + ierr = pio_inq_varid( piofile, 'SOILW', vid ) + ierr = pio_get_var( piofile, vid, soilw_map ) + !------------------------------------------------------------------ + ! ... close file + !------------------------------------------------------------------ + call cam_pio_closefile( piofile ) + + end subroutine soilw_inti + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + subroutine chk_soilw( calday ) + !-------------------------------------------------------------------- + ! ... check timing for ub values + !-------------------------------------------------------------------- + + use mo_constants, only : dayspy + + implicit none + + !-------------------------------------------------------------------- + ! ... dummy args + !-------------------------------------------------------------------- + real(r8), intent(in) :: calday + + !-------------------------------------------------------------------- + ! ... local variables + !-------------------------------------------------------------------- + integer :: m, upper + real(r8) :: numer, denom + + !-------------------------------------------------------- + ! ... setup the time interpolation + !-------------------------------------------------------- + if( calday < days(1) ) then + next = 1 + last = ndays + else + if( days(ndays) < dayspy ) then + upper = ndays + else + upper = ndays - 1 + end if + do m = upper,1,-1 + if( calday >= days(m) ) then + exit + end if + end do + last = m + next = mod( m,ndays ) + 1 + end if + numer = calday - days(last) + denom = days(next) - days(last) + if( numer < 0._r8 ) then + numer = dayspy + numer + end if + if( denom < 0._r8 ) then + denom = dayspy + denom + end if + dels = max( min( 1._r8,numer/denom ),0._r8 ) + + end subroutine chk_soilw + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + subroutine set_soilw( soilw, lchnk, calday ) + !-------------------------------------------------------------------- + ! ... set the soil moisture + !-------------------------------------------------------------------- + + implicit none + + !-------------------------------------------------------------------- + ! ... dummy args + !-------------------------------------------------------------------- + real(r8), intent(inout) :: soilw(pcols) + integer, intent(in) :: lchnk ! chunk indice + real(r8), intent(in) :: calday + + + integer :: i, ilon,ilat + + call chk_soilw( calday ) + + soilw(:) = soilw_3d(:,last,lchnk) + dels *( soilw_3d(:,next,lchnk) - soilw_3d(:,last,lchnk)) + + end subroutine set_soilw + + !------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------- + function has_drydep( name ) + + implicit none + + character(len=*), intent(in) :: name + + logical :: has_drydep + integer :: i + + has_drydep = .false. + + do i=1,nddvels + if ( trim(name) == trim(drydep_list(i)) ) then + has_drydep = .true. + exit + endif + enddo + + endfunction has_drydep + +end module mo_drydep diff --git a/src/chemistry/pp_geoschem/mo_gas_phase_chemdr.F90 b/src/chemistry/pp_geoschem/mo_gas_phase_chemdr.F90 new file mode 100644 index 0000000000..a881683024 --- /dev/null +++ b/src/chemistry/pp_geoschem/mo_gas_phase_chemdr.F90 @@ -0,0 +1,1180 @@ +module mo_gas_phase_chemdr + + use shr_kind_mod, only : r8 => shr_kind_r8 + use shr_const_mod, only : pi => shr_const_pi + use constituents, only : pcnst + use cam_history, only : fieldname_len + use chem_mods, only : phtcnt, rxntot, gas_pcnst + use chem_mods, only : rxt_tag_cnt, rxt_tag_lst, rxt_tag_map, extcnt, num_rnts + !use dust_model, only : dust_names, ndust => dust_nbin + use ppgrid, only : pcols, pver + use phys_control, only : phys_getopts + use carma_flags_mod, only : carma_hetchem_feedback + use chem_prod_loss_diags, only: chem_prod_loss_diags_init, chem_prod_loss_diags_out + + implicit none + save + + private + public :: gas_phase_chemdr, gas_phase_chemdr_inti + public :: map2chm + + integer :: map2chm(pcnst) = 0 ! index map to/from chemistry/constituents list + + integer :: synoz_ndx, so4_ndx, h2o_ndx, o2_ndx, o_ndx, hno3_ndx, hcl_ndx, dst_ndx, cldice_ndx, snow_ndx + integer :: o3_ndx, o3s_ndx + integer :: het1_ndx + integer :: ndx_cldfr, ndx_cmfdqr, ndx_nevapr, ndx_cldtop, ndx_prain + integer :: ndx_h2so4 +! +! CCMI +! + integer :: st80_25_ndx + integer :: st80_25_tau_ndx + integer :: aoa_nh_ndx + integer :: aoa_nh_ext_ndx + integer :: nh_5_ndx + integer :: nh_50_ndx + integer :: nh_50w_ndx + integer :: sad_pbf_ndx + integer :: cb1_ndx,cb2_ndx,oc1_ndx,oc2_ndx,dst1_ndx,dst2_ndx,sslt1_ndx,sslt2_ndx + integer :: soa_ndx,soai_ndx,soam_ndx,soat_ndx,soab_ndx,soax_ndx + + character(len=fieldname_len),dimension(rxt_tag_cnt) :: tag_names + character(len=fieldname_len),dimension(extcnt) :: extfrc_name + + logical :: pm25_srf_diag + logical :: pm25_srf_diag_soa + + logical :: convproc_do_aer + integer :: ele_temp_ndx, ion_temp_ndx + +contains + + subroutine gas_phase_chemdr_inti() + + !use mo_chem_utls, only : get_spc_ndx, get_extfrc_ndx, get_rxt_ndx + use cam_history, only : addfld,add_default,horiz_only + !use mo_chm_diags, only : chm_diags_inti + use constituents, only : cnst_get_ind + use physics_buffer, only : pbuf_get_index + use rate_diags, only : rate_diags_init + use cam_abortutils, only : endrun + + implicit none + + character(len=3) :: string + integer :: n, m, err, ii + logical :: history_cesm_forcing + character(len=16) :: unitstr + !----------------------------------------------------------------------- + logical :: history_scwaccm_forcing + + call phys_getopts( history_scwaccm_forcing_out = history_scwaccm_forcing ) + + call phys_getopts( convproc_do_aer_out = convproc_do_aer, history_cesm_forcing_out=history_cesm_forcing ) + + !ndx_h2so4 = get_spc_ndx('H2SO4') +! +! CCMI +! + !st80_25_ndx = get_spc_ndx ('ST80_25') + !st80_25_tau_ndx = get_rxt_ndx ('ST80_25_tau') + !aoa_nh_ndx = get_spc_ndx ('AOA_NH') + !aoa_nh_ext_ndx = get_extfrc_ndx('AOA_NH') + !nh_5_ndx = get_spc_ndx('NH_5') + !nh_50_ndx = get_spc_ndx('NH_50') + !nh_50w_ndx = get_spc_ndx('NH_50W') +! + !cb1_ndx = get_spc_ndx('CB1') + !cb2_ndx = get_spc_ndx('CB2') + !oc1_ndx = get_spc_ndx('OC1') + !oc2_ndx = get_spc_ndx('OC2') + !dst1_ndx = get_spc_ndx('DST01') + !dst2_ndx = get_spc_ndx('DST02') + !sslt1_ndx = get_spc_ndx('SSLT01') + !sslt2_ndx = get_spc_ndx('SSLT02') + !soa_ndx = get_spc_ndx('SOA') + !soam_ndx = get_spc_ndx('SOAM') + !soai_ndx = get_spc_ndx('SOAI') + !soat_ndx = get_spc_ndx('SOAT') + !soab_ndx = get_spc_ndx('SOAB') + !soax_ndx = get_spc_ndx('SOAX') + + !pm25_srf_diag = cb1_ndx>0 .and. cb2_ndx>0 .and. oc1_ndx>0 .and. oc2_ndx>0 & + ! .and. dst1_ndx>0 .and. dst2_ndx>0 .and. sslt1_ndx>0 .and. sslt2_ndx>0 & + ! .and. soa_ndx>0 + + !pm25_srf_diag_soa = cb1_ndx>0 .and. cb2_ndx>0 .and. oc1_ndx>0 .and. oc2_ndx>0 & + ! .and. dst1_ndx>0 .and. dst2_ndx>0 .and. sslt1_ndx>0 .and. sslt2_ndx>0 & + ! .and. soam_ndx>0 .and. soai_ndx>0 .and. soat_ndx>0 .and. soab_ndx>0 .and. soax_ndx>0 + ! + !if ( pm25_srf_diag .or. pm25_srf_diag_soa) then + ! call addfld('PM25_SRF',horiz_only,'I','kg/kg','bottom layer PM2.5 mixing ratio' ) + !endif + !call addfld('U_SRF',horiz_only,'I','m/s','bottom layer wind velocity' ) + !call addfld('V_SRF',horiz_only,'I','m/s','bottom layer wind velocity' ) + !call addfld('Q_SRF',horiz_only,'I','kg/kg','bottom layer specific humidity' ) +! + !het1_ndx= get_rxt_ndx('het1') + !o3_ndx = get_spc_ndx('O3') + !o3s_ndx = get_spc_ndx('O3S') + !o_ndx = get_spc_ndx('O') + !o2_ndx = get_spc_ndx('O2') + !so4_ndx = get_spc_ndx('SO4') + !h2o_ndx = get_spc_ndx('H2O') + !hno3_ndx = get_spc_ndx('HNO3') + !hcl_ndx = get_spc_ndx('HCL') + !dst_ndx = get_spc_ndx( dust_names(1) ) + !synoz_ndx = get_extfrc_ndx( 'SYNOZ' ) + !call cnst_get_ind( 'CLDICE', cldice_ndx ) + !call cnst_get_ind( 'SNOWQM', snow_ndx, abort=.false. ) + + + !do m = 1,extcnt + ! WRITE(UNIT=string, FMT='(I2.2)') m + ! extfrc_name(m) = 'extfrc_'// trim(string) + ! call addfld( extfrc_name(m), (/ 'lev' /), 'I', ' ', 'ext frcing' ) + !end do + + !do n = 1,rxt_tag_cnt + ! tag_names(n) = trim(rxt_tag_lst(n)) + ! if (n<=phtcnt) then + ! call addfld( tag_names(n), (/ 'lev' /), 'I', '/s', 'photolysis rate constant' ) + ! else + ! ii = n-phtcnt + ! select case(num_rnts(ii)) + ! case(1) + ! unitstr='/s' + ! case(2) + ! unitstr='cm3/molecules/s' + ! case(3) + ! unitstr='cm6/molecules2/s' + ! case default + ! call endrun('gas_phase_chemdr_inti: invalid value in num_rnts used to set units in reaction rate constant') + ! end select + ! call addfld( tag_names(n), (/ 'lev' /), 'I', unitstr, 'reaction rate constant' ) + ! endif + ! if (history_scwaccm_forcing) then + ! select case (trim(tag_names(n))) + ! case ('jh2o_a', 'jh2o_b', 'jh2o_c' ) + ! call add_default( tag_names(n), 1, ' ') + ! end select + ! endif + !enddo + + !call addfld( 'DTCBS', horiz_only, 'I', ' ','photolysis diagnostic black carbon OD' ) + !call addfld( 'DTOCS', horiz_only, 'I', ' ','photolysis diagnostic organic carbon OD' ) + !call addfld( 'DTSO4', horiz_only, 'I', ' ','photolysis diagnostic SO4 OD' ) + !call addfld( 'DTSOA', horiz_only, 'I', ' ','photolysis diagnostic SOA OD' ) + !call addfld( 'DTANT', horiz_only, 'I', ' ','photolysis diagnostic NH4SO4 OD' ) + !call addfld( 'DTSAL', horiz_only, 'I', ' ','photolysis diagnostic salt OD' ) + !call addfld( 'DTDUST', horiz_only, 'I', ' ','photolysis diagnostic dust OD' ) + !call addfld( 'DTTOTAL', horiz_only, 'I', ' ','photolysis diagnostic total aerosol OD' ) + !call addfld( 'FRACDAY', horiz_only, 'I', ' ','photolysis diagnostic fraction of day' ) + + !call addfld( 'QDSAD', (/ 'lev' /), 'I', '/s', 'water vapor sad delta' ) + !call addfld( 'SAD_STRAT', (/ 'lev' /), 'I', 'cm2/cm3', 'stratospheric aerosol SAD' ) + !call addfld( 'SAD_SULFC', (/ 'lev' /), 'I', 'cm2/cm3', 'chemical sulfate aerosol SAD' ) + !call addfld( 'SAD_SAGE', (/ 'lev' /), 'I', 'cm2/cm3', 'SAGE sulfate aerosol SAD' ) + !call addfld( 'SAD_LNAT', (/ 'lev' /), 'I', 'cm2/cm3', 'large-mode NAT aerosol SAD' ) + !call addfld( 'SAD_ICE', (/ 'lev' /), 'I', 'cm2/cm3', 'water-ice aerosol SAD' ) + !call addfld( 'RAD_SULFC', (/ 'lev' /), 'I', 'cm', 'chemical sad sulfate' ) + !call addfld( 'RAD_LNAT', (/ 'lev' /), 'I', 'cm', 'large nat radius' ) + !call addfld( 'RAD_ICE', (/ 'lev' /), 'I', 'cm', 'sad ice' ) + !call addfld( 'SAD_TROP', (/ 'lev' /), 'I', 'cm2/cm3', 'tropospheric aerosol SAD' ) + !call addfld( 'SAD_AERO', (/ 'lev' /), 'I', 'cm2/cm3', 'aerosol surface area density' ) + !if (history_cesm_forcing) then + ! call add_default ('SAD_AERO',8,' ') + !endif + !call addfld( 'REFF_AERO', (/ 'lev' /), 'I', 'cm', 'aerosol effective radius' ) + !call addfld( 'SULF_TROP', (/ 'lev' /), 'I', 'mol/mol', 'tropospheric aerosol SAD' ) + !call addfld( 'QDSETT', (/ 'lev' /), 'I', '/s', 'water vapor settling delta' ) + !call addfld( 'QDCHEM', (/ 'lev' /), 'I', '/s', 'water vapor chemistry delta') + !call addfld( 'HNO3_TOTAL', (/ 'lev' /), 'I', 'mol/mol', 'total HNO3' ) + !call addfld( 'HNO3_STS', (/ 'lev' /), 'I', 'mol/mol', 'STS condensed HNO3' ) + !call addfld( 'HNO3_NAT', (/ 'lev' /), 'I', 'mol/mol', 'NAT condensed HNO3' ) + !call addfld( 'HNO3_GAS', (/ 'lev' /), 'I', 'mol/mol', 'gas-phase hno3' ) + !call addfld( 'H2O_GAS', (/ 'lev' /), 'I', 'mol/mol', 'gas-phase h2o' ) + !call addfld( 'HCL_TOTAL', (/ 'lev' /), 'I', 'mol/mol', 'total hcl' ) + !call addfld( 'HCL_GAS', (/ 'lev' /), 'I', 'mol/mol', 'gas-phase hcl' ) + !call addfld( 'HCL_STS', (/ 'lev' /), 'I', 'mol/mol', 'STS condensed HCL' ) + + !if (het1_ndx>0) then + ! call addfld( 'het1_total', (/ 'lev' /), 'I', '/s', 'total N2O5 + H2O het rate constant' ) + !endif + !call addfld( 'SZA', horiz_only, 'I', 'degrees', 'solar zenith angle' ) + + !call chm_diags_inti() + !call rate_diags_init() + +!----------------------------------------------------------------------- +! get pbuf indicies +!----------------------------------------------------------------------- + !ndx_cldfr = pbuf_get_index('CLD') + !ndx_cmfdqr = pbuf_get_index('RPRDTOT') + !ndx_nevapr = pbuf_get_index('NEVAPR') + !ndx_prain = pbuf_get_index('PRAIN') + !ndx_cldtop = pbuf_get_index('CLDTOP') + + !sad_pbf_ndx= pbuf_get_index('VOLC_SAD',errcode=err) ! prescribed strat aerosols (volcanic) + !if (.not.sad_pbf_ndx>0) sad_pbf_ndx = pbuf_get_index('SADSULF',errcode=err) ! CARMA's version of strat aerosols + + !ele_temp_ndx = pbuf_get_index('TElec',errcode=err)! electron temperature index + !ion_temp_ndx = pbuf_get_index('TIon',errcode=err) ! ion temperature index + + !! diagnostics for stratospheric heterogeneous reactions + !call addfld( 'GAMMA_HET1', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) + !call addfld( 'GAMMA_HET2', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) + !call addfld( 'GAMMA_HET3', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) + !call addfld( 'GAMMA_HET4', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) + !call addfld( 'GAMMA_HET5', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) + !call addfld( 'GAMMA_HET6', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) + !call addfld( 'WTPER', (/ 'lev' /), 'I', '%', 'H2SO4 Weight Percent' ) + + !call chem_prod_loss_diags_init + + end subroutine gas_phase_chemdr_inti + + +!----------------------------------------------------------------------- +!----------------------------------------------------------------------- + subroutine gas_phase_chemdr(lchnk, ncol, imozart, q, & + phis, zm, zi, calday, & + tfld, pmid, pdel, pint, & + cldw, troplev, troplevchem, & + ncldwtr, ufld, vfld, & + delt, ps, xactive_prates, & + fsds, ts, asdir, ocnfrac, icefrac, & + precc, precl, snowhland, ghg_chem, latmapback, & + drydepflx, wetdepflx, cflx, fire_sflx, fire_ztop, nhx_nitrogen_flx, noy_nitrogen_flx, qtend, pbuf) + + !----------------------------------------------------------------------- + ! ... Chem_solver advances the volumetric mixing ratio + ! forward one time step via a combination of explicit, + ! ebi, hov, fully implicit, and/or rodas algorithms. + !----------------------------------------------------------------------- + + use chem_mods, only : nabscol, nfs, indexm, clscnt4 + use physconst, only : rga + !use mo_photo, only : set_ub_col, setcol, table_photo, xactive_photo + !use mo_exp_sol, only : exp_sol + !use mo_imp_sol, only : imp_sol + !use mo_setrxt, only : setrxt + !use mo_adjrxt, only : adjrxt + !use mo_phtadj, only : phtadj + !use llnl_O1D_to_2OH_adj,only : O1D_to_2OH_adj + !use mo_usrrxt, only : usrrxt + !use mo_setinv, only : setinv + !use mo_negtrc, only : negtrc + !use mo_sulf, only : sulf_interp + !use mo_setext, only : setext + !use fire_emissions, only : fire_emissions_vrt + !use mo_sethet, only : sethet + !use mo_drydep, only : drydep, set_soilw + !use seq_drydep_mod, only : DD_XLND, DD_XATM, DD_TABL, drydep_method + !use mo_fstrat, only : set_fstrat_vals, set_fstrat_h2o + !use noy_ubc, only : noy_ubc_set + !use mo_flbc, only : flbc_set + !use phys_grid, only : get_rlat_all_p, get_rlon_all_p, get_lat_all_p, get_lon_all_p + !use mo_mean_mass, only : set_mean_mass + !use cam_history, only : outfld + !use wv_saturation, only : qsat + !use constituents, only : cnst_mw + !use mo_drydep, only : has_drydep + !use time_manager, only : get_ref_date + !use mo_ghg_chem, only : ghg_chem_set_rates, ghg_chem_set_flbc + !use mo_sad, only : sad_strat_calc + !use charge_neutrality, only : charge_balance + !use mo_strato_rates, only : ratecon_sfstrat + !use mo_aero_settling, only : strat_aer_settling + !use shr_orb_mod, only : shr_orb_decl + !use cam_control_mod, only : lambm0, eccen, mvelpp, obliqr + !use mo_strato_rates, only : has_strato_chem + !use short_lived_species,only: set_short_lived_species,get_short_lived_species + !use mo_chm_diags, only : chm_diags, het_diags + !use perf_mod, only : t_startf, t_stopf + !use gas_wetdep_opts, only : gas_wetdep_method + use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx + !use infnan, only : nan, assignment(=) + !use rate_diags, only : rate_diags_calc + !use mo_mass_xforms, only : mmr2vmr, vmr2mmr, h2o_to_vmr, mmr2vmri + !use orbit, only : zenith +! +! LINOZ +! + !use lin_strat_chem, only : do_lin_strat_chem, lin_strat_chem_solve + !use linoz_data, only : has_linoz_data +! +! for aqueous chemistry and aerosol growth +! + !use aero_model, only : aero_model_gasaerexch + + !use aero_model, only : aero_model_strat_surfarea + + implicit none + + !----------------------------------------------------------------------- + ! ... Dummy arguments + !----------------------------------------------------------------------- + integer, intent(in) :: lchnk ! chunk index + integer, intent(in) :: ncol ! number columns in chunk + integer, intent(in) :: imozart ! gas phase start index in q + real(r8), intent(in) :: delt ! timestep (s) + real(r8), intent(in) :: calday ! day of year + real(r8), intent(in) :: ps(pcols) ! surface pressure + real(r8), intent(in) :: phis(pcols) ! surface geopotential + real(r8),target,intent(in) :: tfld(pcols,pver) ! midpoint temperature (K) + real(r8), intent(in) :: pmid(pcols,pver) ! midpoint pressures (Pa) + real(r8), intent(in) :: pdel(pcols,pver) ! pressure delta about midpoints (Pa) + real(r8), intent(in) :: ufld(pcols,pver) ! zonal velocity (m/s) + real(r8), intent(in) :: vfld(pcols,pver) ! meridional velocity (m/s) + real(r8), intent(in) :: cldw(pcols,pver) ! cloud water (kg/kg) + real(r8), intent(in) :: ncldwtr(pcols,pver) ! droplet number concentration (#/kg) + real(r8), intent(in) :: zm(pcols,pver) ! midpoint geopotential height above the surface (m) + real(r8), intent(in) :: zi(pcols,pver+1) ! interface geopotential height above the surface (m) + real(r8), intent(in) :: pint(pcols,pver+1) ! interface pressures (Pa) + real(r8), intent(in) :: q(pcols,pver,pcnst) ! species concentrations (kg/kg) + real(r8),pointer, intent(in) :: fire_sflx(:,:) ! fire emssions surface flux (kg/m^2/s) + real(r8),pointer, intent(in) :: fire_ztop(:) ! top of vertical distribution of fire emssions (m) + logical, intent(in) :: xactive_prates + real(r8), intent(in) :: fsds(pcols) ! longwave down at sfc + real(r8), intent(in) :: icefrac(pcols) ! sea-ice areal fraction + real(r8), intent(in) :: ocnfrac(pcols) ! ocean areal fraction + real(r8), intent(in) :: asdir(pcols) ! albedo: shortwave, direct + real(r8), intent(in) :: ts(pcols) ! sfc temp (merged w/ocean if coupled) + real(r8), intent(in) :: precc(pcols) ! + real(r8), intent(in) :: precl(pcols) ! + real(r8), intent(in) :: snowhland(pcols) ! + logical, intent(in) :: ghg_chem + integer, intent(in) :: latmapback(pcols) + integer, intent(in) :: troplev(pcols) ! trop/strat separation vertical index + integer, intent(in) :: troplevchem(pcols) ! trop/strat chemistry separation vertical index + real(r8), intent(inout) :: qtend(pcols,pver,pcnst) ! species tendencies (kg/kg/s) + real(r8), intent(inout) :: cflx(pcols,pcnst) ! constituent surface flux (kg/m^2/s) + real(r8), intent(out) :: drydepflx(pcols,pcnst) ! dry deposition flux (kg/m^2/s) + real(r8), intent(in) :: wetdepflx(pcols,pcnst) ! wet deposition flux (kg/m^2/s) + real(r8), intent(out) :: nhx_nitrogen_flx(pcols) + real(r8), intent(out) :: noy_nitrogen_flx(pcols) + + type(physics_buffer_desc), pointer :: pbuf(:) + + !!----------------------------------------------------------------------- + !! ... Local variables + !!----------------------------------------------------------------------- + !real(r8), parameter :: m2km = 1.e-3_r8 + !real(r8), parameter :: Pa2mb = 1.e-2_r8 + + !real(r8), pointer :: prain(:,:) + !real(r8), pointer :: nevapr(:,:) + !real(r8), pointer :: cmfdqr(:,:) + !real(r8), pointer :: cldfr(:,:) + !real(r8), pointer :: cldtop(:) + + !integer :: i, k, m, n + !integer :: tim_ndx + !real(r8) :: delt_inverse + !real(r8) :: esfact + !integer :: latndx(pcols) ! chunk lat indicies + !integer :: lonndx(pcols) ! chunk lon indicies + !real(r8) :: invariants(ncol,pver,nfs) + !real(r8) :: col_dens(ncol,pver,max(1,nabscol)) ! column densities (molecules/cm^2) + !real(r8) :: col_delta(ncol,0:pver,max(1,nabscol)) ! layer column densities (molecules/cm^2) + !real(r8) :: extfrc(ncol,pver,max(1,extcnt)) + !real(r8) :: vmr(ncol,pver,gas_pcnst) ! xported species (vmr) + !real(r8) :: reaction_rates(ncol,pver,max(1,rxntot)) ! reaction rates + !real(r8) :: depvel(ncol,gas_pcnst) ! dry deposition velocity (cm/s) + !real(r8) :: het_rates(ncol,pver,max(1,gas_pcnst)) ! washout rate (1/s) + !real(r8), dimension(ncol,pver) :: & + ! h2ovmr, & ! water vapor volume mixing ratio + ! mbar, & ! mean wet atmospheric mass ( amu ) + ! zmid, & ! midpoint geopotential in km + ! zmidr, & ! midpoint geopotential in km realitive to surf + ! sulfate, & ! trop sulfate aerosols + ! pmb ! pressure at midpoints ( hPa ) + !real(r8), dimension(ncol,pver) :: & + ! cwat, & ! cloud water mass mixing ratio (kg/kg) + ! wrk + !real(r8), dimension(ncol,pver+1) :: & + ! zintr ! interface geopotential in km realitive to surf + !real(r8), dimension(ncol,pver+1) :: & + ! zint ! interface geopotential in km + !real(r8), dimension(ncol) :: & + ! zen_angle, & ! solar zenith angles + ! zsurf, & ! surface height (m) + ! rlats, rlons ! chunk latitudes and longitudes (radians) + !real(r8) :: sza(ncol) ! solar zenith angles (degrees) + !real(r8), parameter :: rad2deg = 180._r8/pi ! radians to degrees conversion factor + !real(r8) :: relhum(ncol,pver) ! relative humidity + !real(r8) :: satv(ncol,pver) ! wrk array for relative humidity + !real(r8) :: satq(ncol,pver) ! wrk array for relative humidity + + !integer :: j + !integer :: ltrop_sol(pcols) ! tropopause vertical index used in chem solvers + !real(r8), pointer :: strato_sad(:,:) ! stratospheric sad (1/cm) + + !real(r8) :: sad_trop(pcols,pver) ! total tropospheric sad (cm^2/cm^3) + !real(r8) :: reff(pcols,pver) ! aerosol effective radius (cm) + !real(r8) :: reff_strat(pcols,pver) ! stratospheric aerosol effective radius (cm) + + !real(r8) :: tvs(pcols) + !integer :: ncdate,yr,mon,day,sec + !real(r8) :: wind_speed(pcols) ! surface wind speed (m/s) + !logical, parameter :: dyn_soilw = .false. + !logical :: table_soilw + !real(r8) :: soilw(pcols) + !real(r8) :: prect(pcols) + !real(r8) :: sflx(pcols,gas_pcnst) + !real(r8) :: wetdepflx_diag(pcols,gas_pcnst) + !real(r8) :: dust_vmr(ncol,pver,ndust) + !real(r8) :: dt_diag(pcols,8) ! od diagnostics + !real(r8) :: fracday(pcols) ! fraction of day + !real(r8) :: o2mmr(ncol,pver) ! o2 concentration (kg/kg) + !real(r8) :: ommr(ncol,pver) ! o concentration (kg/kg) + !real(r8) :: mmr(pcols,pver,gas_pcnst) ! chem working concentrations (kg/kg) + !real(r8) :: mmr_new(pcols,pver,gas_pcnst) ! chem working concentrations (kg/kg) + !real(r8) :: hno3_gas(ncol,pver) ! hno3 gas phase concentration (mol/mol) + !real(r8) :: hno3_cond(ncol,pver,2) ! hno3 condensed phase concentration (mol/mol) + !real(r8) :: hcl_gas(ncol,pver) ! hcl gas phase concentration (mol/mol) + !real(r8) :: hcl_cond(ncol,pver) ! hcl condensed phase concentration (mol/mol) + !real(r8) :: h2o_gas(ncol,pver) ! h2o gas phase concentration (mol/mol) + !real(r8) :: h2o_cond(ncol,pver) ! h2o condensed phase concentration (mol/mol) + !real(r8) :: cldice(pcols,pver) ! cloud water "ice" (kg/kg) + !real(r8) :: radius_strat(ncol,pver,3) ! radius of sulfate, nat, & ice ( cm ) + !real(r8) :: sad_strat(ncol,pver,3) ! surf area density of sulfate, nat, & ice ( cm^2/cm^3 ) + !real(r8) :: mmr_tend(pcols,pver,gas_pcnst) ! chemistry species tendencies (kg/kg/s) + !real(r8) :: qh2o(pcols,pver) ! specific humidity (kg/kg) + !real(r8) :: delta + + ! !for aerosol formation.... + !real(r8) :: del_h2so4_gasprod(ncol,pver) + !real(r8) :: vmr0(ncol,pver,gas_pcnst) + +! +! CCMI +! + !real(r8) :: xlat + !real(r8) :: pm25(ncol) + + !real(r8) :: dlats(ncol) + + !real(r8), dimension(ncol,pver) :: & ! aerosol reaction diagnostics + ! gprob_n2o5, & + ! gprob_cnt_hcl, & + ! gprob_cnt_h2o, & + ! gprob_bnt_h2o, & + ! gprob_hocl_hcl, & + ! gprob_hobr_hcl, & + ! wtper + + !real(r8), pointer :: ele_temp_fld(:,:) ! electron temperature pointer + !real(r8), pointer :: ion_temp_fld(:,:) ! ion temperature pointer + !real(r8) :: prod_out(ncol,pver,max(1,clscnt4)) + !real(r8) :: loss_out(ncol,pver,max(1,clscnt4)) + + !if ( ele_temp_ndx>0 .and. ion_temp_ndx>0 ) then + ! call pbuf_get_field(pbuf, ele_temp_ndx, ele_temp_fld) + ! call pbuf_get_field(pbuf, ion_temp_ndx, ion_temp_fld) + !else + ! ele_temp_fld => tfld + ! ion_temp_fld => tfld + !endif + + !! initialize to NaN to hopefully catch user defined rxts that go unset + !reaction_rates(:,:,:) = nan + + !Dummy output + qtend = 0.0e+0_r8 + cflx = 0.0e+0_r8 + drydepflx = 0.0e+0_r8 + + !delt_inverse = 1._r8 / delt + !!----------------------------------------------------------------------- + !! ... Get chunck latitudes and longitudes + !!----------------------------------------------------------------------- + !call get_lat_all_p( lchnk, ncol, latndx ) + !call get_lon_all_p( lchnk, ncol, lonndx ) + !call get_rlat_all_p( lchnk, ncol, rlats ) + !call get_rlon_all_p( lchnk, ncol, rlons ) + !tim_ndx = pbuf_old_tim_idx() + !call pbuf_get_field(pbuf, ndx_prain, prain, start=(/1,1/), kount=(/ncol,pver/)) + !call pbuf_get_field(pbuf, ndx_cldfr, cldfr, start=(/1,1,tim_ndx/), kount=(/ncol,pver,1/) ) + !call pbuf_get_field(pbuf, ndx_cmfdqr, cmfdqr, start=(/1,1/), kount=(/ncol,pver/)) + !call pbuf_get_field(pbuf, ndx_nevapr, nevapr, start=(/1,1/), kount=(/ncol,pver/)) + !call pbuf_get_field(pbuf, ndx_cldtop, cldtop ) + + !reff_strat(:,:) = 0._r8 + + !dlats(:) = rlats(:)*rad2deg ! convert to degrees + + !!----------------------------------------------------------------------- + !! ... Calculate cosine of zenith angle + !! then cast back to angle (radians) + !!----------------------------------------------------------------------- + !call zenith( calday, rlats, rlons, zen_angle, ncol ) + !zen_angle(:) = acos( zen_angle(:) ) + + !sza(:) = zen_angle(:) * rad2deg + !call outfld( 'SZA', sza, ncol, lchnk ) + + !!----------------------------------------------------------------------- + !! ... Xform geopotential height from m to km + !! and pressure from Pa to mb + !!----------------------------------------------------------------------- + !zsurf(:ncol) = rga * phis(:ncol) + !do k = 1,pver + ! zintr(:ncol,k) = m2km * zi(:ncol,k) + ! zmidr(:ncol,k) = m2km * zm(:ncol,k) + ! zmid(:ncol,k) = m2km * (zm(:ncol,k) + zsurf(:ncol)) + ! zint(:ncol,k) = m2km * (zi(:ncol,k) + zsurf(:ncol)) + ! pmb(:ncol,k) = Pa2mb * pmid(:ncol,k) + !end do + !zint(:ncol,pver+1) = m2km * (zi(:ncol,pver+1) + zsurf(:ncol)) + !zintr(:ncol,pver+1)= m2km * zi(:ncol,pver+1) + + !!----------------------------------------------------------------------- + !! ... map incoming concentrations to working array + !!----------------------------------------------------------------------- + !do m = 1,pcnst + ! n = map2chm(m) + ! if( n > 0 ) then + ! mmr(:ncol,:,n) = q(:ncol,:,m) + ! end if + !end do + + !call get_short_lived_species( mmr, lchnk, ncol, pbuf ) + + !!----------------------------------------------------------------------- + !! ... Set atmosphere mean mass + !!----------------------------------------------------------------------- + !call set_mean_mass( ncol, mmr, mbar ) + + !!----------------------------------------------------------------------- + !! ... Xform from mmr to vmr + !!----------------------------------------------------------------------- + !call mmr2vmr( mmr(:ncol,:,:), vmr(:ncol,:,:), mbar(:ncol,:), ncol ) + +! +! CCMI +! +! reset STE tracer to specific vmr of 200 ppbv +! + !if ( st80_25_ndx > 0 ) then + ! where ( pmid(:ncol,:) < 80.e+2_r8 ) + ! vmr(:ncol,:,st80_25_ndx) = 200.e-9_r8 + ! end where + !end if +! +! reset AOA_NH, NH_5, NH_50, NH_50W surface mixing ratios between 30N and 50N +! + !if ( aoa_nh_ndx>0 ) then + ! do j=1,ncol + ! xlat = dlats(j) + ! if ( xlat >= 30._r8 .and. xlat <= 50._r8 ) then + ! vmr(j,pver,aoa_nh_ndx) = 0._r8 + ! end if + ! end do + !end if + !if ( nh_5_ndx>0 ) then + ! do j=1,ncol + ! xlat = dlats(j) + ! if ( xlat >= 30._r8 .and. xlat <= 50._r8 ) then + ! vmr(j,pver,nh_5_ndx) = 100.e-9_r8 + ! end if + ! end do + !end if + !if ( nh_50_ndx>0 ) then + ! do j=1,ncol + ! xlat = dlats(j) + ! if ( xlat >= 30._r8 .and. xlat <= 50._r8 ) then + ! vmr(j,pver,nh_50_ndx) = 100.e-9_r8 + ! end if + ! end do + !end if + !if ( nh_50w_ndx>0 ) then + ! do j=1,ncol + ! xlat = dlats(j) + ! if ( xlat >= 30._r8 .and. xlat <= 50._r8 ) then + ! vmr(j,pver,nh_50w_ndx) = 100.e-9_r8 + ! end if + ! end do + !end if + + !if (h2o_ndx>0) then + ! !----------------------------------------------------------------------- + ! ! ... store water vapor in wrk variable + ! !----------------------------------------------------------------------- + ! qh2o(:ncol,:) = mmr(:ncol,:,h2o_ndx) + ! h2ovmr(:ncol,:) = vmr(:ncol,:,h2o_ndx) + !else + ! qh2o(:ncol,:) = q(:ncol,:,1) + ! !----------------------------------------------------------------------- + ! ! ... Xform water vapor from mmr to vmr and set upper bndy values + ! !----------------------------------------------------------------------- + ! call h2o_to_vmr( q(:ncol,:,1), h2ovmr(:ncol,:), mbar(:ncol,:), ncol ) + + ! call set_fstrat_h2o( h2ovmr, pmid, troplev, calday, ncol, lchnk ) + + !endif + + !!----------------------------------------------------------------------- + !! ... force ion/electron balance + !!----------------------------------------------------------------------- + !call charge_balance( ncol, vmr ) + + !!----------------------------------------------------------------------- + !! ... Set the "invariants" + !!----------------------------------------------------------------------- + !call setinv( invariants, tfld, h2ovmr, vmr, pmid, ncol, lchnk, pbuf ) + + !!----------------------------------------------------------------------- + !! ... stratosphere aerosol surface area + !!----------------------------------------------------------------------- + !if (sad_pbf_ndx>0) then + ! call pbuf_get_field(pbuf, sad_pbf_ndx, strato_sad) + !else + ! allocate(strato_sad(pcols,pver)) + ! strato_sad(:,:) = 0._r8 + + ! ! Prognostic modal stratospheric sulfate: compute dry strato_sad + ! call aero_model_strat_surfarea( ncol, mmr, pmid, tfld, troplevchem, pbuf, strato_sad, reff_strat ) + + !endif + + !stratochem: if ( has_strato_chem ) then + ! !----------------------------------------------------------------------- + ! ! ... initialize condensed and gas phases; all hno3 to gas + ! !----------------------------------------------------------------------- + ! hcl_cond(:,:) = 0.0_r8 + ! hcl_gas (:,:) = 0.0_r8 + ! do k = 1,pver + ! hno3_gas(:,k) = vmr(:,k,hno3_ndx) + ! h2o_gas(:,k) = h2ovmr(:,k) + ! hcl_gas(:,k) = vmr(:,k,hcl_ndx) + ! wrk(:,k) = h2ovmr(:,k) + ! if (snow_ndx>0) then + ! cldice(:ncol,k) = q(:ncol,k,cldice_ndx) + q(:ncol,k,snow_ndx) + ! else + ! cldice(:ncol,k) = q(:ncol,k,cldice_ndx) + ! endif + ! end do + ! do m = 1,2 + ! do k = 1,pver + ! hno3_cond(:,k,m) = 0._r8 + ! end do + ! end do + + ! call mmr2vmri( cldice(:ncol,:), h2o_cond(:ncol,:), mbar(:ncol,:), cnst_mw(cldice_ndx), ncol ) + + ! !----------------------------------------------------------------------- + ! ! ... call SAD routine + ! !----------------------------------------------------------------------- + ! call sad_strat_calc( lchnk, invariants(:ncol,:,indexm), pmb, tfld, hno3_gas, & + ! hno3_cond, h2o_gas, h2o_cond, hcl_gas, hcl_cond, strato_sad(:ncol,:), radius_strat, & + ! sad_strat, ncol, pbuf ) + +! ! NOTE: output of total HNO3 is before vmr is set to gas-phase. + ! call outfld( 'HNO3_TOTAL', vmr(:ncol,:,hno3_ndx), ncol ,lchnk ) + + + ! do k = 1,pver + ! vmr(:,k,hno3_ndx) = hno3_gas(:,k) + ! h2ovmr(:,k) = h2o_gas(:,k) + ! vmr(:,k,h2o_ndx) = h2o_gas(:,k) + ! wrk(:,k) = (h2ovmr(:,k) - wrk(:,k))*delt_inverse + ! end do + + ! call outfld( 'QDSAD', wrk(:,:), ncol, lchnk ) +! + ! call outfld( 'SAD_STRAT', strato_sad(:ncol,:), ncol, lchnk ) + ! call outfld( 'SAD_SULFC', sad_strat(:,:,1), ncol, lchnk ) + ! call outfld( 'SAD_LNAT', sad_strat(:,:,2), ncol, lchnk ) + ! call outfld( 'SAD_ICE', sad_strat(:,:,3), ncol, lchnk ) +! + ! call outfld( 'RAD_SULFC', radius_strat(:,:,1), ncol, lchnk ) + ! call outfld( 'RAD_LNAT', radius_strat(:,:,2), ncol, lchnk ) + ! call outfld( 'RAD_ICE', radius_strat(:,:,3), ncol, lchnk ) +! + ! call outfld( 'HNO3_GAS', vmr(:ncol,:,hno3_ndx), ncol, lchnk ) + ! call outfld( 'HNO3_STS', hno3_cond(:,:,1), ncol, lchnk ) + ! call outfld( 'HNO3_NAT', hno3_cond(:,:,2), ncol, lchnk ) +! + ! call outfld( 'HCL_TOTAL', vmr(:ncol,:,hcl_ndx), ncol, lchnk ) + ! call outfld( 'HCL_GAS', hcl_gas (:,:), ncol ,lchnk ) + ! call outfld( 'HCL_STS', hcl_cond(:,:), ncol ,lchnk ) + + ! !----------------------------------------------------------------------- + ! ! ... call aerosol reaction rates + ! !----------------------------------------------------------------------- + ! call ratecon_sfstrat( ncol, invariants(:,:,indexm), pmid, tfld, & + ! radius_strat(:,:,1), sad_strat(:,:,1), sad_strat(:,:,2), & + ! sad_strat(:,:,3), h2ovmr, vmr, reaction_rates, & + ! gprob_n2o5, gprob_cnt_hcl, gprob_cnt_h2o, gprob_bnt_h2o, & + ! gprob_hocl_hcl, gprob_hobr_hcl, wtper ) + + ! call outfld( 'GAMMA_HET1', gprob_n2o5 (:ncol,:), ncol, lchnk ) + ! call outfld( 'GAMMA_HET2', gprob_cnt_h2o (:ncol,:), ncol, lchnk ) + ! call outfld( 'GAMMA_HET3', gprob_bnt_h2o (:ncol,:), ncol, lchnk ) + ! call outfld( 'GAMMA_HET4', gprob_cnt_hcl (:ncol,:), ncol, lchnk ) + ! call outfld( 'GAMMA_HET5', gprob_hocl_hcl(:ncol,:), ncol, lchnk ) + ! call outfld( 'GAMMA_HET6', gprob_hobr_hcl(:ncol,:), ncol, lchnk ) + ! call outfld( 'WTPER', wtper (:ncol,:), ncol, lchnk ) + + !endif stratochem + +! ! NOTE: For gas-phase solver only. +! ! ratecon_sfstrat needs total hcl. + !if (hcl_ndx>0) then + ! vmr(:,:,hcl_ndx) = hcl_gas(:,:) + !endif + + !!----------------------------------------------------------------------- + !! ... Set the column densities at the upper boundary + !!----------------------------------------------------------------------- + !call set_ub_col( col_delta, vmr, invariants, pint(:,1), pdel, ncol, lchnk) + + !!----------------------------------------------------------------------- + !! ... Set rates for "tabular" and user specified reactions + !!----------------------------------------------------------------------- + !call setrxt( reaction_rates, tfld, invariants(1,1,indexm), ncol ) + ! + !sulfate(:,:) = 0._r8 + !if ( .not. carma_hetchem_feedback ) then + ! if( so4_ndx < 1 ) then ! get offline so4 field if not prognostic + ! call sulf_interp( ncol, lchnk, sulfate ) + ! else + ! sulfate(:,:) = vmr(:,:,so4_ndx) + ! endif + !endif + ! + !!----------------------------------------------------------------- + !! ... zero out sulfate above tropopause + !!----------------------------------------------------------------- + !do k = 1, pver + ! do i = 1, ncol + ! if (k < troplevchem(i)) then + ! sulfate(i,k) = 0.0_r8 + ! end if + ! end do + !end do + + !call outfld( 'SULF_TROP', sulfate(:ncol,:), ncol, lchnk ) + + !!----------------------------------------------------------------- + !! ... compute the relative humidity + !!----------------------------------------------------------------- + !call qsat(tfld(:ncol,:), pmid(:ncol,:), satv, satq) + + !do k = 1,pver + ! relhum(:,k) = .622_r8 * h2ovmr(:,k) / satq(:,k) + ! relhum(:,k) = max( 0._r8,min( 1._r8,relhum(:,k) ) ) + !end do + ! + !cwat(:ncol,:pver) = cldw(:ncol,:pver) + + !call usrrxt( reaction_rates, tfld, ion_temp_fld, ele_temp_fld, invariants, h2ovmr, & + ! pmid, invariants(:,:,indexm), sulfate, mmr, relhum, strato_sad, & + ! troplevchem, dlats, ncol, sad_trop, reff, cwat, mbar, pbuf ) + + !call outfld( 'SAD_TROP', sad_trop(:ncol,:), ncol, lchnk ) + + !! Add trop/strat components of SAD for output + !sad_trop(:ncol,:)=sad_trop(:ncol,:)+strato_sad(:ncol,:) + !call outfld( 'SAD_AERO', sad_trop(:ncol,:), ncol, lchnk ) + + !! Add trop/strat components of effective radius for output + !reff(:ncol,:)=reff(:ncol,:)+reff_strat(:ncol,:) + !call outfld( 'REFF_AERO', reff(:ncol,:), ncol, lchnk ) + + !if (het1_ndx>0) then + ! call outfld( 'het1_total', reaction_rates(:,:,het1_ndx), ncol, lchnk ) + !endif + + !if (ghg_chem) then + ! call ghg_chem_set_rates( reaction_rates, latmapback, zen_angle, ncol, lchnk ) + !endif + + !do i = phtcnt+1,rxt_tag_cnt + ! call outfld( tag_names(i), reaction_rates(:ncol,:,rxt_tag_map(i)), ncol, lchnk ) + !enddo + + !call adjrxt( reaction_rates, invariants, invariants(1,1,indexm), ncol,pver ) + + !!----------------------------------------------------------------------- + !! ... Compute the photolysis rates at time = t(n+1) + !!----------------------------------------------------------------------- + !!----------------------------------------------------------------------- + !! ... Set the column densities + !!----------------------------------------------------------------------- + !call setcol( col_delta, col_dens, vmr, pdel, ncol ) + + !!----------------------------------------------------------------------- + !! ... Calculate the photodissociation rates + !!----------------------------------------------------------------------- + + !esfact = 1._r8 + !call shr_orb_decl( calday, eccen, mvelpp, lambm0, obliqr , & + ! delta, esfact ) + + + !if ( xactive_prates ) then + ! if ( dst_ndx > 0 ) then + ! dust_vmr(:ncol,:,1:ndust) = vmr(:ncol,:,dst_ndx:dst_ndx+ndust-1) + ! else + ! dust_vmr(:ncol,:,:) = 0._r8 + ! endif + + ! !----------------------------------------------------------------- + ! ! ... compute the photolysis rates + ! !----------------------------------------------------------------- + ! call xactive_photo( reaction_rates, vmr, tfld, cwat, cldfr, & + ! pmid, zmidr, col_dens, zen_angle, asdir, & + ! invariants(1,1,indexm), ps, ts, & + ! esfact, relhum, dust_vmr, dt_diag, fracday, ncol, lchnk ) + + ! call outfld('DTCBS', dt_diag(:ncol,1), ncol, lchnk ) + ! call outfld('DTOCS', dt_diag(:ncol,2), ncol, lchnk ) + ! call outfld('DTSO4', dt_diag(:ncol,3), ncol, lchnk ) + ! call outfld('DTANT', dt_diag(:ncol,4), ncol, lchnk ) + ! call outfld('DTSAL', dt_diag(:ncol,5), ncol, lchnk ) + ! call outfld('DTDUST', dt_diag(:ncol,6), ncol, lchnk ) + ! call outfld('DTSOA', dt_diag(:ncol,7), ncol, lchnk ) + ! call outfld('DTTOTAL', dt_diag(:ncol,8), ncol, lchnk ) + ! call outfld('FRACDAY', fracday(:ncol), ncol, lchnk ) + + !else + ! !----------------------------------------------------------------- + ! ! ... lookup the photolysis rates from table + ! !----------------------------------------------------------------- + ! call table_photo( reaction_rates, pmid, pdel, tfld, zmid, zint, & + ! col_dens, zen_angle, asdir, cwat, cldfr, & + ! esfact, vmr, invariants, ncol, lchnk, pbuf ) + !endif + + !do i = 1,phtcnt + ! call outfld( tag_names(i), reaction_rates(:ncol,:,rxt_tag_map(i)), ncol, lchnk ) + !enddo + + !!----------------------------------------------------------------------- + !! ... Adjust the photodissociation rates + !!----------------------------------------------------------------------- + !call O1D_to_2OH_adj( reaction_rates, invariants, invariants(:,:,indexm), ncol, tfld ) + !call phtadj( reaction_rates, invariants, invariants(:,:,indexm), ncol,pver ) + + !!----------------------------------------------------------------------- + !! ... Compute the extraneous frcing at time = t(n+1) + !!----------------------------------------------------------------------- + !if ( o2_ndx > 0 .and. o_ndx > 0 ) then + ! do k = 1,pver + ! o2mmr(:ncol,k) = mmr(:ncol,k,o2_ndx) + ! ommr(:ncol,k) = mmr(:ncol,k,o_ndx) + ! end do + !endif + !call setext( extfrc, zint, zintr, cldtop, & + ! zmid, lchnk, tfld, o2mmr, ommr, & + ! pmid, mbar, rlats, calday, ncol, rlons, pbuf ) + !! include forcings from fire emissions ... + !call fire_emissions_vrt( ncol, lchnk, zint, fire_sflx, fire_ztop, extfrc ) + + !do m = 1,extcnt + ! if( m /= synoz_ndx .and. m /= aoa_nh_ext_ndx ) then + ! do k = 1,pver + ! extfrc(:ncol,k,m) = extfrc(:ncol,k,m) / invariants(:ncol,k,indexm) + ! end do + ! endif + ! call outfld( extfrc_name(m), extfrc(:ncol,:,m), ncol, lchnk ) + !end do + + !!----------------------------------------------------------------------- + !! ... Form the washout rates + !!----------------------------------------------------------------------- + !if ( gas_wetdep_method=='MOZ' ) then + ! call sethet( het_rates, pmid, zmid, phis, tfld, & + ! cmfdqr, prain, nevapr, delt, invariants(:,:,indexm), & + ! vmr, ncol, lchnk ) + ! if (.not. convproc_do_aer) then + ! call het_diags( het_rates(:ncol,:,:), mmr(:ncol,:,:), pdel(:ncol,:), lchnk, ncol ) + ! endif + !else + ! het_rates = 0._r8 + !end if +! +! CCMI +! +! set loss to below the tropopause only +! + !if ( st80_25_tau_ndx > 0 ) then + ! do i = 1,ncol + ! reaction_rates(i,1:troplev(i),st80_25_tau_ndx) = 0._r8 + ! enddo + !end if + + !if ( has_linoz_data ) then + ! ltrop_sol(:ncol) = troplev(:ncol) + !else + ! ltrop_sol(:ncol) = 0 ! apply solver to all levels + !endif + + !! save h2so4 before gas phase chem (for later new particle nucleation) + !if (ndx_h2so4 > 0) then + ! del_h2so4_gasprod(1:ncol,:) = vmr(1:ncol,:,ndx_h2so4) + !else + ! del_h2so4_gasprod(:,:) = 0.0_r8 + !endif + + !vmr0(:ncol,:,:) = vmr(:ncol,:,:) ! mixing ratios before chemistry changes + + !!======================================================================= + !! ... Call the class solution algorithms + !!======================================================================= + !!----------------------------------------------------------------------- + !! ... Solve for "Explicit" species + !!----------------------------------------------------------------------- + !call exp_sol( vmr, reaction_rates, het_rates, extfrc, delt, invariants(1,1,indexm), ncol, lchnk, ltrop_sol ) + + !!----------------------------------------------------------------------- + !! ... Solve for "Implicit" species + !!----------------------------------------------------------------------- + !if ( has_strato_chem ) wrk(:,:) = vmr(:,:,h2o_ndx) + !call t_startf('imp_sol') + !! + !call imp_sol( vmr, reaction_rates, het_rates, extfrc, delt, & + ! ncol,pver, lchnk, prod_out, loss_out ) + + !call t_stopf('imp_sol') + + !call chem_prod_loss_diags_out( ncol, lchnk, vmr, reaction_rates, prod_out, loss_out, invariants(:ncol,:,indexm) ) + !if( h2o_ndx>0) call outfld( 'H2O_GAS', vmr(1,1,h2o_ndx), ncol ,lchnk ) + + !! reset O3S to O3 in the stratosphere ... + !if ( o3_ndx > 0 .and. o3s_ndx > 0 ) then + ! do i = 1,ncol + ! vmr(i,1:troplev(i),o3s_ndx) = vmr(i,1:troplev(i),o3_ndx) + ! end do + !end if + + !if (convproc_do_aer) then + ! call vmr2mmr( vmr(:ncol,:,:), mmr_new(:ncol,:,:), mbar(:ncol,:), ncol ) + ! ! mmr_new = average of mmr values before and after imp_sol + ! mmr_new(:ncol,:,:) = 0.5_r8*( mmr(:ncol,:,:) + mmr_new(:ncol,:,:) ) + ! call het_diags( het_rates(:ncol,:,:), mmr_new(:ncol,:,:), pdel(:ncol,:), lchnk, ncol ) + !endif + + !! save h2so4 change by gas phase chem (for later new particle nucleation) + !if (ndx_h2so4 > 0) then + ! del_h2so4_gasprod(1:ncol,:) = vmr(1:ncol,:,ndx_h2so4) - del_h2so4_gasprod(1:ncol,:) + !endif + +! +! Aerosol processes ... +! + + !call aero_model_gasaerexch( imozart-1, ncol, lchnk, troplevchem, delt, reaction_rates, & + ! tfld, pmid, pdel, mbar, relhum, & + ! zm, qh2o, cwat, cldfr, ncldwtr, & + ! invariants(:,:,indexm), invariants, del_h2so4_gasprod, & + ! vmr0, vmr, pbuf ) + + !if ( has_strato_chem ) then + + ! wrk(:ncol,:) = (vmr(:ncol,:,h2o_ndx) - wrk(:ncol,:))*delt_inverse + ! call outfld( 'QDCHEM', wrk(:ncol,:), ncol, lchnk ) + ! call outfld( 'HNO3_GAS', vmr(:ncol,:,hno3_ndx), ncol ,lchnk ) + + ! !----------------------------------------------------------------------- + ! ! ... aerosol settling + ! ! first settle hno3(2) using radius ice + ! ! secnd settle hno3(3) using radius large nat + ! !----------------------------------------------------------------------- + ! wrk(:,:) = vmr(:,:,h2o_ndx) +#ifdef ALT_SETTL + ! where( h2o_cond(:,:) > 0._r8 ) + ! settl_rad(:,:) = radius_strat(:,:,3) + ! elsewhere + ! settl_rad(:,:) = 0._r8 + ! endwhere + ! call strat_aer_settling( invariants(1,1,indexm), pmid, delt, zmid, tfld, & + ! hno3_cond(1,1,2), settl_rad, ncol, lchnk, 1 ) + + ! where( h2o_cond(:,:) == 0._r8 ) + ! settl_rad(:,:) = radius_strat(:,:,2) + ! elsewhere + ! settl_rad(:,:) = 0._r8 + ! endwhere + ! call strat_aer_settling( invariants(1,1,indexm), pmid, delt, zmid, tfld, & + ! hno3_cond(1,1,2), settl_rad, ncol, lchnk, 2 ) +#else + ! call strat_aer_settling( invariants(1,1,indexm), pmid, delt, zmid, tfld, & + ! hno3_cond(1,1,2), radius_strat(1,1,2), ncol, lchnk, 2 ) +#endif + + !----------------------------------------------------------------------- + ! ... reform total hno3 and hcl = gas + all condensed + !----------------------------------------------------------------------- +! NOTE: vmr for hcl and hno3 is gas-phase at this point. +! hno3_cond(:,k,1) = STS; hno3_cond(:,k,2) = NAT + + ! do k = 1,pver + ! vmr(:,k,hno3_ndx) = vmr(:,k,hno3_ndx) + hno3_cond(:,k,1) & + ! + hno3_cond(:,k,2) + ! vmr(:,k,hcl_ndx) = vmr(:,k,hcl_ndx) + hcl_cond(:,k) + ! + ! end do + + ! wrk(:,:) = (vmr(:,:,h2o_ndx) - wrk(:,:))*delt_inverse + ! call outfld( 'QDSETT', wrk(:,:), ncol, lchnk ) + + !endif + +! +! LINOZ +! + !if ( do_lin_strat_chem ) then + ! call lin_strat_chem_solve( ncol, lchnk, vmr(:,:,o3_ndx), col_dens(:,:,1), tfld, zen_angle, pmid, delt, rlats, troplev ) + !end if + + !!----------------------------------------------------------------------- + !! ... Check for negative values and reset to zero + !!----------------------------------------------------------------------- + !call negtrc( 'After chemistry ', vmr, ncol ) + + !!----------------------------------------------------------------------- + !! ... Set upper boundary mmr values + !!----------------------------------------------------------------------- + !call set_fstrat_vals( vmr, pmid, pint, troplev, calday, ncol,lchnk ) + + !!----------------------------------------------------------------------- + !! ... Set fixed lower boundary mmr values + !!----------------------------------------------------------------------- + !call flbc_set( vmr, ncol, lchnk, map2chm ) + + !!----------------------------------------------------------------------- + !! set NOy UBC + !!----------------------------------------------------------------------- + !call noy_ubc_set( lchnk, ncol, vmr ) + + !if ( ghg_chem ) then + ! call ghg_chem_set_flbc( vmr, ncol ) + !endif + + !!----------------------------------------------------------------------- + !! force ion/electron balance -- ext forcings likely do not conserve charge + !!----------------------------------------------------------------------- + !call charge_balance( ncol, vmr ) + + !!----------------------------------------------------------------------- + !! ... Xform from vmr to mmr + !!----------------------------------------------------------------------- + !call vmr2mmr( vmr(:ncol,:,:), mmr_tend(:ncol,:,:), mbar(:ncol,:), ncol ) + + !call set_short_lived_species( mmr_tend, lchnk, ncol, pbuf ) + + !!----------------------------------------------------------------------- + !! ... Form the tendencies + !!----------------------------------------------------------------------- + !do m = 1,gas_pcnst + ! mmr_new(:ncol,:,m) = mmr_tend(:ncol,:,m) + ! mmr_tend(:ncol,:,m) = (mmr_tend(:ncol,:,m) - mmr(:ncol,:,m))*delt_inverse + !enddo + + !do m = 1,pcnst + ! n = map2chm(m) + ! if( n > 0 ) then + ! qtend(:ncol,:,m) = qtend(:ncol,:,m) + mmr_tend(:ncol,:,n) + ! end if + !end do + + !tvs(:ncol) = tfld(:ncol,pver) * (1._r8 + qh2o(:ncol,pver)) + + !sflx(:,:) = 0._r8 + !call get_ref_date(yr, mon, day, sec) + !ncdate = yr*10000 + mon*100 + day + !wind_speed(:ncol) = sqrt( ufld(:ncol,pver)*ufld(:ncol,pver) + vfld(:ncol,pver)*vfld(:ncol,pver) ) + !prect(:ncol) = precc(:ncol) + precl(:ncol) + + !if ( drydep_method == DD_XLND ) then + ! soilw = -99 + ! call drydep( ocnfrac, icefrac, ncdate, ts, ps, & + ! wind_speed, qh2o(:,pver), tfld(:,pver), pmid(:,pver), prect, & + ! snowhland, fsds, depvel, sflx, mmr, & + ! tvs, soilw, relhum(:,pver:pver), ncol, lonndx, latndx, lchnk ) + !else if ( drydep_method == DD_XATM ) then + ! table_soilw = has_drydep( 'H2' ) .or. has_drydep( 'CO' ) + ! if( .not. dyn_soilw .and. table_soilw ) then + ! call set_soilw( soilw, lchnk, calday ) + ! end if + ! call drydep( ncdate, ts, ps, & + ! wind_speed, qh2o(:,pver), tfld(:,pver), pmid(:,pver), prect, & + ! snowhland, fsds, depvel, sflx, mmr, & + ! tvs, soilw, relhum(:,pver:pver), ncol, lonndx, latndx, lchnk ) + !else if ( drydep_method == DD_TABL ) then + ! call drydep( calday, ts, zen_angle, & + ! depvel, sflx, mmr, pmid(:,pver), & + ! tvs, ncol, icefrac, ocnfrac, lchnk ) + !endif + + !drydepflx(:,:) = 0._r8 + !do m = 1,pcnst + ! n = map2chm( m ) + ! if ( n > 0 ) then + ! cflx(:ncol,m) = cflx(:ncol,m) - sflx(:ncol,n) + ! drydepflx(:ncol,m) = sflx(:ncol,n) + ! wetdepflx_diag(:ncol,n) = wetdepflx(:ncol,m) + ! endif + !end do + + !call chm_diags( lchnk, ncol, vmr(:ncol,:,:), mmr_new(:ncol,:,:), & + ! reaction_rates(:ncol,:,:), invariants(:ncol,:,:), depvel(:ncol,:), sflx(:ncol,:), & + ! mmr_tend(:ncol,:,:), pdel(:ncol,:), pmid(:ncol,:), troplev(:ncol), wetdepflx_diag(:ncol,:), & + ! nhx_nitrogen_flx(:ncol), noy_nitrogen_flx(:ncol) ) + + !call rate_diags_calc( reaction_rates(:,:,:), vmr(:,:,:), invariants(:,:,indexm), ncol, lchnk ) +! +! jfl +! +! surface vmr +! + !if ( pm25_srf_diag ) then + ! pm25(:ncol) = mmr_new(:ncol,pver,cb1_ndx) & + ! + mmr_new(:ncol,pver,cb2_ndx) & + ! + mmr_new(:ncol,pver,oc1_ndx) & + ! + mmr_new(:ncol,pver,oc2_ndx) & + ! + mmr_new(:ncol,pver,dst1_ndx) & + ! + mmr_new(:ncol,pver,dst2_ndx) & + ! + mmr_new(:ncol,pver,sslt1_ndx) & + ! + mmr_new(:ncol,pver,sslt2_ndx) & + ! + mmr_new(:ncol,pver,soa_ndx) & + ! + mmr_new(:ncol,pver,so4_ndx) + ! call outfld('PM25_SRF',pm25(:ncol) , ncol, lchnk ) + !endif + !if ( pm25_srf_diag_soa ) then + ! pm25(:ncol) = mmr_new(:ncol,pver,cb1_ndx) & + ! + mmr_new(:ncol,pver,cb2_ndx) & + ! + mmr_new(:ncol,pver,oc1_ndx) & + ! + mmr_new(:ncol,pver,oc2_ndx) & + ! + mmr_new(:ncol,pver,dst1_ndx) & + ! + mmr_new(:ncol,pver,dst2_ndx) & + ! + mmr_new(:ncol,pver,sslt1_ndx) & + ! + mmr_new(:ncol,pver,sslt2_ndx) & + ! + mmr_new(:ncol,pver,soam_ndx) & + ! + mmr_new(:ncol,pver,soai_ndx) & + ! + mmr_new(:ncol,pver,soat_ndx) & + ! + mmr_new(:ncol,pver,soab_ndx) & + ! + mmr_new(:ncol,pver,soax_ndx) & + ! + mmr_new(:ncol,pver,so4_ndx) + ! call outfld('PM25_SRF',pm25(:ncol) , ncol, lchnk ) + !endif +! +! + !call outfld('Q_SRF',qh2o(:ncol,pver) , ncol, lchnk ) + !call outfld('U_SRF',ufld(:ncol,pver) , ncol, lchnk ) + !call outfld('V_SRF',vfld(:ncol,pver) , ncol, lchnk ) + +! + !if (.not.sad_pbf_ndx>0) then + ! deallocate(strato_sad) + !endif + + end subroutine gas_phase_chemdr + +end module mo_gas_phase_chemdr diff --git a/src/chemistry/pp_geoschem/mo_lightning.F90 b/src/chemistry/pp_geoschem/mo_lightning.F90 new file mode 100644 index 0000000000..206c1e7fc6 --- /dev/null +++ b/src/chemistry/pp_geoschem/mo_lightning.F90 @@ -0,0 +1,182 @@ +module mo_lightning + !---------------------------------------------------------------------- + ! ... the lightning module + !---------------------------------------------------------------------- + + use shr_kind_mod, only : r8 => shr_kind_r8 + use ppgrid, only : begchunk, endchunk, pcols, pver + use phys_grid, only : ngcols_p + use cam_abortutils, only : endrun + use cam_logfile, only : iulog + use spmd_utils, only : masterproc, mpicom + + implicit none + + private + public :: lightning_inti + public :: lightning_no_prod + public :: prod_no + + save + + real(r8) :: csrf + real(r8) :: factor = 0.1_r8 ! user-controlled scaling factor to achieve arbitrary no prod. + real(r8) :: geo_factor ! grid cell area factor + real(r8) :: vdist(16,3) ! vertical distribution of lightning + real(r8), allocatable :: prod_no(:,:,:) + real(r8), allocatable :: glob_prod_no_col(:,:) + real(r8), allocatable :: flash_freq(:,:) + integer :: no_ndx,xno_ndx + logical :: has_no_lightning_prod = .false. + +contains + + subroutine lightning_inti( lght_no_prd_factor ) + !---------------------------------------------------------------------- + ! ... initialize the lightning module + !---------------------------------------------------------------------- + use mo_constants, only : pi + use ioFileMod, only : getfil + !use mo_chem_utls, only : get_spc_ndx + + use cam_history, only : addfld, add_default, horiz_only + use dyn_grid, only : get_dyn_grid_parm + use phys_control, only : phys_getopts + + implicit none + + !---------------------------------------------------------------------- + ! ... dummy args + !---------------------------------------------------------------------- + real(r8), intent(in) :: lght_no_prd_factor ! lightning no production factor + + !!---------------------------------------------------------------------- + !! ... local variables + !!---------------------------------------------------------------------- + !integer :: astat + !integer :: ncid + !integer :: dimid + !integer :: vid + !integer :: gndx + !integer :: jl, ju + !integer :: nlat, nlon + !integer :: plon, plat + !real(r8), allocatable :: lats(:) + !real(r8), allocatable :: lons(:) + !real(r8), allocatable :: landmask(:,:) + !character(len=256) :: locfn + !logical :: history_cesm_forcing + + !call phys_getopts( history_cesm_forcing_out = history_cesm_forcing ) + + !no_ndx = get_spc_ndx('NO') + !xno_ndx = get_spc_ndx('XNO') + + !has_no_lightning_prod = no_ndx>0 .or. xno_ndx>0 + !if (.not.has_no_lightning_prod) return + + ! + !if( lght_no_prd_factor /= 1._r8 ) then + ! factor = factor*lght_no_prd_factor + !end if + + + !if (masterproc) write(iulog,*) 'lght_inti: lightning no production scaling factor = ',factor + + !!---------------------------------------------------------------------- + !! ... vdist(kk,itype) = % of lightning nox between (kk-1) and (kk) + !! km for profile itype + !!---------------------------------------------------------------------- + !vdist(:,1) = (/ 3.0_r8, 3.0_r8, 3.0_r8, 3.0_r8, 3.4_r8, 3.5_r8, 3.6_r8, 4.0_r8, & ! midlat cont + ! 5.0_r8, 7.0_r8, 9.0_r8, 14.0_r8, 16.0_r8, 14.0_r8, 8.0_r8, 0.5_r8 /) + !vdist(:,2) = (/ 2.5_r8, 2.5_r8, 2.5_r8, 2.5_r8, 2.5_r8, 2.5_r8, 2.5_r8, 6.1_r8, & ! trop marine + ! 17.0_r8, 15.4_r8, 14.5_r8, 13.0_r8, 12.5_r8, 2.8_r8, 0.9_r8, 0.3_r8 /) + !vdist(:,3) = (/ 2.0_r8, 2.0_r8, 2.0_r8, 1.5_r8, 1.5_r8, 1.5_r8, 3.0_r8, 5.8_r8, & ! trop cont + ! 7.6_r8, 9.6_r8, 11.0_r8, 14.0_r8, 14.0_r8, 14.0_r8, 8.2_r8, 2.3_r8 /) + + !allocate( prod_no(pcols,pver,begchunk:endchunk),stat=astat ) + !if( astat /= 0 ) then + ! write(iulog,*) 'lght_inti: failed to allocate prod_no; error = ',astat + ! call endrun + !end if + !allocate( flash_freq(pcols,begchunk:endchunk),stat=astat ) + !if( astat /= 0 ) then + ! write(iulog,*) 'lght_inti: failed to allocate flash_freq; error = ',astat + ! call endrun + !end if + !allocate( glob_prod_no_col(pcols,begchunk:endchunk),stat=astat ) + !if( astat /= 0 ) then + ! write(iulog,*) 'lght_inti: failed to allocate glob_prod_no_col; error = ',astat + ! call endrun + !end if + !prod_no(:,:,:) = 0._r8 + !flash_freq(:,:) = 0._r8 + !geo_factor = ngcols_p/(4._r8*pi) + + + !call addfld( 'LNO_COL_PROD', horiz_only, 'I', 'TG N/YR', 'lighting column NO source' ) + !call addfld( 'LNO_PROD', (/ 'lev' /), 'I', '/cm3/s', 'lighting insitu NO source' ) + !call addfld( 'FLASHFRQ', horiz_only, 'I', '1/MIN', 'lighting flash rate' ) ! flash frequency in grid box per minute (PPP) + !call addfld( 'FLASHENGY', horiz_only, 'I', ' ', 'lighting flash rate' ) ! flash frequency in grid box per minute (PPP) + !call addfld( 'CLDHGT', horiz_only, 'I', 'KM', 'cloud top height' ) ! cloud top height + !call addfld( 'DCHGZONE', horiz_only, 'I', 'KM', 'depth of discharge zone' ) ! depth of discharge zone + !call addfld( 'CGIC', horiz_only, 'I', 'RATIO', 'ratio of cloud-ground/intracloud discharges' ) ! ratio of cloud-ground/intracloud discharges + + !if ( history_cesm_forcing ) then + ! call add_default('LNO_COL_PROD',1,' ') + !endif + + end subroutine lightning_inti + + subroutine lightning_no_prod( state, pbuf2d, cam_in ) + !---------------------------------------------------------------------- + ! ... set no production from lightning + !---------------------------------------------------------------------- + use physics_types, only : physics_state + + use physics_buffer, only : pbuf_get_index, physics_buffer_desc, pbuf_get_field, pbuf_get_chunk + use physconst, only : rga + use phys_grid, only : get_rlat_all_p, get_lat_all_p, get_lon_all_p, get_wght_all_p + use cam_history, only : outfld + use camsrfexch, only : cam_in_t + use shr_reprosum_mod, only : shr_reprosum_calc + !use mo_constants, only : rearth, d2r + implicit none + + !---------------------------------------------------------------------- + ! ... dummy args + !---------------------------------------------------------------------- + type(physics_state), intent(in) :: state(begchunk:endchunk) ! physics state + + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + type(cam_in_t), intent(in) :: cam_in(begchunk:endchunk) ! physics state + + !---------------------------------------------------------------------- + ! ... local variables + !---------------------------------------------------------------------- + + !---------------------------------------------------------------------- + ! ... parameters to determine cg/ic ratio [price and rind, 1993] + !---------------------------------------------------------------------- + + if (.not.has_no_lightning_prod) return + + ! < === INSERT CALCULATION HERE === > + + !!-------------------------------------------------------------------------------- + !! ... output lightning no production to history file + !!-------------------------------------------------------------------------------- + !do c = begchunk,endchunk + ! lchnk = state(c)%lchnk + ! call outfld( 'LNO_PROD', prod_no(:,:,c), pcols, lchnk ) + ! call outfld( 'LNO_COL_PROD', glob_prod_no_col(:,c), pcols, lchnk ) + ! call outfld( 'FLASHFRQ', flash_freq(:,c), pcols, lchnk ) + ! call outfld( 'FLASHENGY', flash_energy(:,c), pcols, lchnk ) + ! call outfld( 'CLDHGT', cldhgt(:,c), pcols, lchnk ) + ! call outfld( 'DCHGZONE', dchgzone(:,c), pcols, lchnk ) + ! call outfld( 'CGIC', cgic(:,c), pcols, lchnk ) + !enddo + + end subroutine lightning_no_prod + +end module mo_lightning diff --git a/src/chemistry/pp_geoschem/mo_sim_dat.F90 b/src/chemistry/pp_geoschem/mo_sim_dat.F90 new file mode 100644 index 0000000000..38b193b66b --- /dev/null +++ b/src/chemistry/pp_geoschem/mo_sim_dat.F90 @@ -0,0 +1,839 @@ + + module mo_sim_dat + + private + public :: set_sim_dat + + contains + + subroutine set_sim_dat + + use chem_mods, only : clscnt, cls_rxt_cnt, clsmap, permute, adv_mass, fix_mass, crb_mass + use chem_mods, only : diag_map + use chem_mods, only : phtcnt, rxt_tag_cnt, rxt_tag_lst, rxt_tag_map + use chem_mods, only : pht_alias_lst, pht_alias_mult + use chem_mods, only : extfrc_lst, inv_lst, slvd_lst + use chem_mods, only : enthalpy_cnt, cph_enthalpy, cph_rid, num_rnts, rxntot + use cam_abortutils,only : endrun + use mo_tracname, only : solsym + use chem_mods, only : frc_from_dataset + use chem_mods, only : is_scalar, is_vector + use shr_kind_mod, only : r8 => shr_kind_r8 + use cam_logfile, only : iulog + + implicit none + +!-------------------------------------------------------------- +! ... local variables +!-------------------------------------------------------------- + integer :: ios + + is_scalar = .false. + is_vector = .true. + + clscnt(:) = (/ 30, 0, 0, 191, 0 /) + + cls_rxt_cnt(:,1) = (/ 37, 61, 0, 30 /) + cls_rxt_cnt(:,4) = (/ 23, 174, 326, 191 /) + + solsym(:273) = (/ 'CH2I2 ','CH2ICL ','CH2IBR ', & + 'NITs ','NIT ','AERI ', & + 'CO2 ','INDIOL ','ISALA ', & + 'ISALC ','ISN1OA ','ISN1OG ', & + 'LBRO2H ','LBRO2N ','LISOPOH ', & + 'LISOPNO3 ','LTRO2H ','LTRO2N ', & + 'LVOCOA ','LVOC ','LXRO2H ', & + 'LXRO2N ','MSA ','PYAC ', & + 'SO4H1 ','SO4H2 ','SOAGX ', & + 'SOAIE ','SOAME ','IMAE ', & + 'SOAMG ','POx ','LOx ', & + 'PCO ','LCO ','PSO4 ', & + 'LCH4 ','PH2O2 ','I2O4 ', & + 'DHDN ','DHDC ','I2O2 ', & + 'MONITA ','BENZ ','CH3CCL3 ', & + 'H1301 ','H2402 ','I2O3 ', & + 'PMNN ','PPN ','TOLU ', & + 'BRNO2 ','CCL4 ','CFC11 ', & + 'CFC12 ','CFC113 ','CFC114 ', & + 'CFC115 ','CH3I ','H1211 ', & + 'IBR ','IEPOXD ','INO ', & + 'N2O ','TRO2 ','BRO2 ', & + 'IEPOXA ','IEPOXB ','IONITA ', & + 'N ','OCS ','XRO2 ', & + 'HI ','MAP ','ICL ', & + 'IMAO3 ','MPN ','CHBR3 ', & + 'CHCL3 ','CL2O2 ','CH2BR2 ', & + 'CH2CL2 ','HCFC141b ','HCFC142b ', & + 'IONO ','HCFC123 ','HCFC22 ', & + 'OIO ','RA3P ','RB3P ', & + 'XYLE ','DMS ','CLNO2 ', & + 'ETP ','CH3BR ','CH3CL ', & + 'HNO4 ','CLOO ','OCLO ', & + 'PAN ','RP ','HNO2 ', & + 'ALK4 ','PP ','PRPN ', & + 'SO4 ','BRCL ','PIP ', & + 'R4P ','HPALD ','C3H8 ', & + 'DHPCARP ','HOI ','HC187 ', & + 'HPC52O2 ','VRP ','ATOOH ', & + 'BR2 ','IAP ','MOBA ', & + 'HONIT ','DHMOB ','RIPB ', & + 'MP ','ISNP ','BRSALA ', & + 'BRSALC ','MAOP ','MRP ', & + 'RIPA ','RIPD ','EOH ', & + 'ETHLN ','N2O5 ','INPN ', & + 'MTPA ','MTPO ','NPMN ', & + 'C2H6 ','IONO2 ','MOBAOO ', & + 'DIBOO ','LIMO ','IPMN ', & + 'H ','MACRNO2 ','BRNO3 ', & + 'ROH ','MONITS ','CL2 ', & + 'I2 ','ISOPNB ','ISNOHOO ', & + 'CH4 ','MVKOO ','ISNOOB ', & + 'GAOO ','CH3CHOO ','MGLYOO ', & + 'IEPOXOO ','GLYX ','MVKN ', & + 'MGLOO ','PRN1 ','MONITU ', & + 'A3O2 ','PROPNN ','ISNOOA ', & + 'MAN2 ','PO2 ','ISOPNDO2 ', & + 'HCOOH ','B3O2 ','MACROO ', & + 'R4N1 ','MAOPO2 ','ISOP ', & + 'H2O2 ','ATO2 ','I ', & + 'RCO3 ','OLNN ','OLND ', & + 'LIMO2 ','MACRN ','IO ', & + 'KO2 ','HOBR ','ISOPNBO2 ', & + 'HC5OO ','PIO2 ','HNO3 ', & + 'ISOPND ','NMAO3 ','ACTA ', & + 'HOCL ','VRO2 ','ISN1 ', & + 'CH2OO ','GLYC ','CLNO3 ', & + 'MGLY ','ACET ','HC5 ', & + 'RIO2 ','INO2 ','R4O2 ', & + 'ETO2 ','R4N2 ','HAC ', & + 'MRO2 ','BRO ','PRPE ', & + 'RCHO ','MEK ','MACR ', & + 'CH2O ','ALD2 ','MVK ', & + 'MCO3 ','SO2 ','HCL ', & + 'HBR ','H2O ','CLO ', & + 'HO2 ','OH ','BR ', & + 'O ','NO2 ','MO2 ', & + 'NO3 ','NO ','O3 ', & + 'CL ','CO ','O1D ', & + 'H2 ','MOH ','N2 ', & + 'O2 ','RCOOH ','SO4s ', & + 'NH3 ','NH4 ','BCPI ', & + 'OCPI ','BCPO ','OCPO ', & + 'DST1 ','DST2 ','DST3 ', & + 'DST4 ','SALA ','SALC ', & + 'TSOG1 ','TSOG2 ','TSOG3 ', & + 'TSOG0 ','TSOA1 ','TSOA2 ', & + 'TSOA3 ','TSOA0 ','ASOG1 ', & + 'ASOG2 ','ASOG3 ','ASOAN ', & + 'ASOA1 ','ASOA2 ','ASOA3 ', & + 'SOAP ','SOAS ','PFE ' /) + + adv_mass(:221) = (/ 133.141340_r8, 104.142600_r8, 28.010400_r8, 12.011000_r8, 12.011000_r8, & + 204.342600_r8, 78.110400_r8, 160.122200_r8, 126.108600_r8, 98.098200_r8, & + 84.072400_r8, 98.098200_r8, 98.098200_r8, 112.124000_r8, 72.143800_r8, & + 56.103200_r8, 79.904000_r8, 115.356700_r8, 95.903400_r8, 141.908940_r8, & + 99.716850_r8, 106.120800_r8, 124.135000_r8, 26.036800_r8, 28.051600_r8, & + 46.065800_r8, 62.065200_r8, 30.066400_r8, 42.077400_r8, 76.091000_r8, & + 44.092200_r8, 110.109200_r8, 153.821800_r8, 165.364506_r8, 148.910210_r8, & + 137.367503_r8, 187.375310_r8, 170.921013_r8, 154.466716_r8, 120.913206_r8, & + 173.833800_r8, 30.025200_r8, 94.937200_r8, 133.402300_r8, 44.051000_r8, & + 50.485900_r8, 41.050940_r8, 58.076800_r8, 72.061400_r8, 60.050400_r8, & + 76.049800_r8, 32.040000_r8, 48.039400_r8, 16.040600_r8, 252.730400_r8, & + 35.452700_r8, 70.905400_r8, 102.904200_r8, 51.452100_r8, 97.457640_r8, & + 100.916850_r8, 28.010400_r8, 44.009800_r8, 66.007206_r8, 82.461503_r8, & + 108.135600_r8, 62.132400_r8, 135.064039_r8, 135.064039_r8, 135.064039_r8, & + 28.010400_r8, 78.064600_r8, 18.998403_r8, 60.050400_r8, 58.035600_r8, & + 1.007400_r8, 2.014800_r8, 259.823613_r8, 34.013600_r8, 98.078400_r8, & + 80.911400_r8, 116.948003_r8, 100.493706_r8, 86.467906_r8, 36.460100_r8, & + 27.025140_r8, 46.024600_r8, 20.005803_r8, 63.012340_r8, 79.011740_r8, & + 96.910800_r8, 52.459500_r8, 135.114940_r8, 116.112400_r8, 74.076200_r8, & + 100.113000_r8, 118.127200_r8, 68.114200_r8, 147.125940_r8, 147.125940_r8, & + 162.117940_r8, 163.125340_r8, 118.127200_r8, 184.350200_r8, 70.087800_r8, & + 120.100800_r8, 72.102600_r8, 104.101400_r8, 147.084740_r8, 136.228400_r8, & + 70.087800_r8, 14.006740_r8, 44.012880_r8, 108.010480_r8, 147.125940_r8, & + 145.111140_r8, 58.442468_r8, 58.442468_r8, 58.442468_r8, 17.028940_r8, & + 18.036340_r8, 28.010400_r8, 28.010400_r8, 30.006140_r8, 46.005540_r8, & + 62.004940_r8, 119.074340_r8, 231.239540_r8, 1.007400_r8, 1.007400_r8, & + 1.007400_r8, 1.007400_r8, 15.999400_r8, 47.998200_r8, 67.451500_r8, & + 60.076400_r8, 133.100140_r8, 121.047940_r8, 183.117740_r8, 93.102400_r8, & + 94.109800_r8, 176.121600_r8, 12.011000_r8, 12.011000_r8, 92.090400_r8, & + 90.075600_r8, 32.066000_r8, 146.056419_r8, 48.065400_r8, 64.064800_r8, & + 80.064200_r8, 115.107340_r8, 115.107340_r8, 115.107340_r8, 250.445000_r8, & + 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & + 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & + 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 28.010400_r8, & + 310.582400_r8, 140.134400_r8, 186.241400_r8, 215.240140_r8, 186.241400_r8, & + 168.227200_r8, 154.201400_r8, 174.148000_r8, 92.136200_r8, 150.126000_r8, & + 106.162000_r8, 188.173800_r8, 122.161400_r8, 204.173200_r8, 14.006740_r8, & + 14.006740_r8, 137.112200_r8, 103.135200_r8, 159.114800_r8, 123.127600_r8, & + 61.057800_r8, 75.083600_r8, 109.101800_r8, 75.042400_r8, 47.032000_r8, & + 129.089600_r8, 105.108800_r8, 61.057800_r8, 77.057200_r8, 33.006200_r8, & + 63.031400_r8, 117.119800_r8, 117.119800_r8, 119.093400_r8, 115.063800_r8, & + 101.079200_r8, 117.078600_r8, 103.094000_r8, 230.232140_r8, 15.999400_r8, & + 17.006800_r8, 175.114200_r8, 91.083000_r8, 89.068200_r8, 199.218600_r8, & + 185.234000_r8, 173.140600_r8, 149.118600_r8, 187.166400_r8, 203.165800_r8, & + 18.014200_r8 /) + + crb_mass(:221) = (/ 60.055000_r8, 60.055000_r8, 12.011000_r8, 12.011000_r8, 12.011000_r8, & + 180.165000_r8, 72.066000_r8, 72.066000_r8, 72.066000_r8, 60.055000_r8, & + 48.044000_r8, 60.055000_r8, 60.055000_r8, 72.066000_r8, 60.055000_r8, & + 48.044000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, & + 0.000000_r8, 84.077000_r8, 84.077000_r8, 24.022000_r8, 24.022000_r8, & + 24.022000_r8, 24.022000_r8, 24.022000_r8, 36.033000_r8, 36.033000_r8, & + 36.033000_r8, 72.066000_r8, 12.011000_r8, 12.011000_r8, 12.011000_r8, & + 12.011000_r8, 24.022000_r8, 24.022000_r8, 24.022000_r8, 12.011000_r8, & + 12.011000_r8, 12.011000_r8, 12.011000_r8, 24.022000_r8, 24.022000_r8, & + 12.011000_r8, 24.022000_r8, 36.033000_r8, 36.033000_r8, 24.022000_r8, & + 24.022000_r8, 12.011000_r8, 12.011000_r8, 12.011000_r8, 12.011000_r8, & + 0.000000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, & + 12.011000_r8, 12.011000_r8, 12.011000_r8, 12.011000_r8, 12.011000_r8, & + 84.077000_r8, 24.022000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, & + 12.011000_r8, 24.022000_r8, 0.000000_r8, 24.022000_r8, 24.022000_r8, & + 0.000000_r8, 0.000000_r8, 24.022000_r8, 0.000000_r8, 0.000000_r8, & + 0.000000_r8, 24.022000_r8, 24.022000_r8, 12.011000_r8, 0.000000_r8, & + 12.011000_r8, 12.011000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, & + 0.000000_r8, 0.000000_r8, 48.044000_r8, 60.055000_r8, 36.033000_r8, & + 60.055000_r8, 60.055000_r8, 60.055000_r8, 60.055000_r8, 60.055000_r8, & + 60.055000_r8, 60.055000_r8, 60.055000_r8, 156.143000_r8, 48.044000_r8, & + 48.044000_r8, 48.044000_r8, 48.044000_r8, 48.044000_r8, 120.110000_r8, & + 48.044000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, 60.055000_r8, & + 60.055000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, & + 0.000000_r8, 12.011000_r8, 12.011000_r8, 0.000000_r8, 0.000000_r8, & + 0.000000_r8, 36.033000_r8, 120.110000_r8, 0.000000_r8, 0.000000_r8, & + 0.000000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, & + 12.011000_r8, 48.044000_r8, 24.022000_r8, 84.077000_r8, 72.066000_r8, & + 72.066000_r8, 72.066000_r8, 12.011000_r8, 12.011000_r8, 36.033000_r8, & + 36.033000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, & + 0.000000_r8, 0.000000_r8, 0.000000_r8, 0.000000_r8, 180.165000_r8, & + 180.165000_r8, 180.165000_r8, 180.165000_r8, 180.165000_r8, 180.165000_r8, & + 180.165000_r8, 180.165000_r8, 180.165000_r8, 180.165000_r8, 180.165000_r8, & + 180.165000_r8, 180.165000_r8, 180.165000_r8, 180.165000_r8, 12.011000_r8, & + 264.242000_r8, 84.077000_r8, 120.110000_r8, 120.110000_r8, 120.110000_r8, & + 120.110000_r8, 108.099000_r8, 84.077000_r8, 84.077000_r8, 60.055000_r8, & + 96.088000_r8, 96.088000_r8, 96.088000_r8, 96.088000_r8, 0.000000_r8, & + 0.000000_r8, 84.077000_r8, 60.055000_r8, 72.066000_r8, 84.077000_r8, & + 24.022000_r8, 36.033000_r8, 72.066000_r8, 24.022000_r8, 12.011000_r8, & + 60.055000_r8, 48.044000_r8, 24.022000_r8, 24.022000_r8, 0.000000_r8, & + 12.011000_r8, 60.055000_r8, 60.055000_r8, 48.044000_r8, 48.044000_r8, & + 48.044000_r8, 48.044000_r8, 48.044000_r8, 120.110000_r8, 0.000000_r8, & + 0.000000_r8, 72.066000_r8, 36.033000_r8, 36.033000_r8, 120.110000_r8, & + 120.110000_r8, 84.077000_r8, 60.055000_r8, 96.088000_r8, 96.088000_r8, & + 0.000000_r8 /) + + fix_mass(: 3) = (/ 0.00000000_r8, 28.0134800_r8, 31.9988000_r8 /) + + clsmap(: 30,1) = (/ 3, 21, 33, 34, 35, 36, 37, 38, 39, 40, & + 41, 43, 44, 46, 54, 55, 61, 63, 71, 78, & + 82, 83, 84, 113, 122, 123, 148, 170, 185, 186 /) + clsmap(:191,4) = (/ 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, & + 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, & + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, & + 42, 45, 47, 48, 49, 50, 51, 52, 53, 56, & + 57, 58, 59, 60, 62, 64, 65, 66, 67, 68, & + 69, 70, 72, 73, 74, 75, 76, 77, 79, 80, & + 81, 85, 86, 87, 88, 89, 90, 91, 92, 93, & + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, & + 104, 105, 106, 107, 108, 109, 110, 111, 112, 114, & + 115, 116, 117, 118, 119, 120, 121, 124, 125, 126, & + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, & + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, & + 147, 149, 150, 151, 152, 153, 154, 155, 156, 157, & + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, & + 168, 169, 171, 172, 173, 174, 175, 176, 177, 178, & + 179, 180, 181, 182, 183, 184, 187, 188, 189, 190, & + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, & + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, & + 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, & + 221 /) + + permute(:191,4) = (/ 121, 120, 1, 2, 144, 46, 85, 47, 86, 96, & + 68, 117, 75, 60, 81, 174, 61, 187, 110, 62, & + 78, 70, 111, 64, 79, 71, 149, 90, 39, 65, & + 189, 161, 38, 147, 166, 108, 102, 134, 91, 184, & + 45, 36, 183, 148, 155, 40, 50, 52, 69, 3, & + 4, 5, 41, 132, 151, 142, 176, 162, 114, 42, & + 138, 177, 49, 133, 57, 175, 83, 131, 136, 154, & + 58, 156, 72, 43, 139, 113, 107, 164, 89, 123, & + 34, 165, 73, 104, 74, 106, 145, 169, 82, 67, & + 84, 152, 6, 7, 8, 37, 9, 190, 185, 179, & + 141, 87, 10, 11, 12, 13, 188, 186, 76, 80, & + 59, 97, 44, 98, 48, 77, 14, 15, 109, 88, & + 103, 167, 140, 63, 16, 17, 18, 19, 20, 21, & + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, & + 32, 33, 35, 53, 115, 118, 99, 150, 153, 116, & + 51, 54, 55, 124, 56, 92, 105, 146, 100, 93, & + 137, 135, 119, 173, 182, 129, 112, 66, 125, 178, & + 94, 168, 171, 170, 126, 172, 143, 122, 159, 180, & + 181, 95, 130, 160, 158, 157, 127, 163, 128, 101, & + 191 /) + + diag_map(:191) = (/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, & + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, & + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, & + 31, 32, 33, 39, 45, 46, 49, 52, 55, 59, & + 62, 65, 68, 71, 74, 81, 87, 91, 96, 100, & + 109, 116, 121, 125, 134, 142, 147, 150, 155, 158, & + 161, 164, 168, 172, 176, 180, 184, 190, 193, 199, & + 205, 211, 214, 219, 224, 229, 234, 240, 245, 250, & + 258, 266, 272, 278, 284, 290, 296, 302, 308, 314, & + 320, 326, 334, 340, 347, 353, 356, 363, 367, 376, & + 384, 391, 397, 403, 409, 415, 423, 431, 435, 443, & + 451, 459, 467, 476, 483, 494, 503, 507, 515, 522, & + 533, 544, 552, 563, 576, 583, 594, 610, 621, 630, & + 640, 649, 657, 661, 666, 677, 687, 695, 709, 726, & + 732, 739, 744, 761, 787, 809, 819, 827, 841, 856, & + 865, 874, 886, 898, 911, 915, 928, 950, 969, 985, & + 996,1007,1024,1044,1060,1072,1083,1108,1130,1153, & + 1186,1205,1236,1250,1263,1276,1296,1390,1448,1473, & + 1621,1672,1699,1734,1776,1837,1862,1893,1917,1996, & + 2022 /) + + extfrc_lst(: 17) = (/ 'so4_a2 ','NO ','NO2 ','SO2 ','SVOC ', & + 'pom_a1 ','pom_a4 ','so4_a1 ','CO ','bc_a1 ', & + 'bc_a4 ','num_a1 ','num_a2 ','num_a4 ','OH ', & + 'N ','AOA_NH ' /) + + frc_from_dataset(: 17) = (/ .true., .true., .true., .true., .true., & + .true., .true., .true., .true., .true., & + .true., .true., .true., .true., .false., & + .false., .false. /) + + inv_lst(: 3) = (/ 'M ', 'N2 ', 'O2 ' /) + + slvd_lst(: 34) = (/ 'ACBZO2 ', 'ALKO2 ', 'BENZO2 ', 'BZOO ', 'C2H5O2 ', & + 'C3H7O2 ', 'C6H5O2 ', 'CH3CO3 ', 'CH3O2 ', 'DICARBO2 ', & + 'ENEO2 ', 'EO ', 'EO2 ', 'HO2 ', 'HOCH2OO ', & + 'ISOPAO2 ', 'ISOPBO2 ', 'MACRO2 ', 'MALO2 ', 'MCO3 ', & + 'MDIALO2 ', 'MEKO2 ', 'NTERPO2 ', 'O1D ', 'OH ', & + 'PHENO2 ', 'PO2 ', 'RO2 ', 'TERP2O2 ', 'TERPO2 ', & + 'TOLO2 ', 'XO2 ', 'XYLENO2 ', 'XYLOLO2 ' /) + + if( allocated( rxt_tag_lst ) ) then + deallocate( rxt_tag_lst ) + end if + allocate( rxt_tag_lst(rxt_tag_cnt),stat=ios ) + if( ios /= 0 ) then + write(iulog,*) 'set_sim_dat: failed to allocate rxt_tag_lst; error = ',ios + call endrun + end if + if( allocated( rxt_tag_map ) ) then + deallocate( rxt_tag_map ) + end if + allocate( rxt_tag_map(rxt_tag_cnt),stat=ios ) + if( ios /= 0 ) then + write(iulog,*) 'set_sim_dat: failed to allocate rxt_tag_map; error = ',ios + call endrun + end if + rxt_tag_lst( 1: 200) = (/ 'jh2o_b ', 'jh2o_a ', & + 'jh2o_c ', 'jh2o2 ', & + 'jo2_a ', 'jo2_b ', & + 'jo3_a ', 'jo3_b ', & + 'jhno3 ', 'jho2no2_a ', & + 'jho2no2_b ', 'jn2o ', & + 'jn2o5_a ', 'jn2o5_b ', & + 'jno ', 'jno2 ', & + 'jno3_b ', 'jno3_a ', & + 'jalknit ', 'jalkooh ', & + 'jbenzooh ', 'jbepomuc ', & + 'jbigald ', 'jbigald1 ', & + 'jbigald2 ', 'jbigald3 ', & + 'jbigald4 ', 'jbzooh ', & + 'jc2h5ooh ', 'jc3h7ooh ', & + 'jc6h5ooh ', 'jch2o_a ', & + 'jch2o_b ', 'jch3cho ', & + 'jacet ', 'jmgly ', & + 'jch3co3h ', 'jch3ooh ', & + 'jch4_a ', 'jch4_b ', & + 'jco2 ', 'jeooh ', & + 'jglyald ', 'jglyoxal ', & + 'jhonitr ', 'jhpald ', & + 'jhyac ', 'jisopnooh ', & + 'jisopooh ', 'jmacr_a ', & + 'jmacr_b ', 'jmek ', & + 'jmekooh ', 'jmpan ', & + 'jmvk ', 'jnc4cho ', & + 'jnoa ', 'jnterpooh ', & + 'jonitr ', 'jpan ', & + 'jphenooh ', 'jpooh ', & + 'jrooh ', 'jtepomuc ', & + 'jterp2ooh ', 'jterpnit ', & + 'jterpooh ', 'jterprd1 ', & + 'jterprd2 ', 'jtolooh ', & + 'jxooh ', 'jxylenooh ', & + 'jxylolooh ', 'jbrcl ', & + 'jbro ', 'jbrono2_b ', & + 'jbrono2_a ', 'jccl4 ', & + 'jcf2clbr ', 'jcf3br ', & + 'jcfcl3 ', 'jcfc113 ', & + 'jcfc114 ', 'jcfc115 ', & + 'jcf2cl2 ', 'jch2br2 ', & + 'jch3br ', 'jch3ccl3 ', & + 'jch3cl ', 'jchbr3 ', & + 'jcl2 ', 'jcl2o2 ', & + 'jclo ', 'jclono2_a ', & + 'jclono2_b ', 'jcof2 ', & + 'jcofcl ', 'jh2402 ', & + 'jhbr ', 'jhcfc141b ', & + 'jhcfc142b ', 'jhcfc22 ', & + 'jhcl ', 'jhf ', & + 'jhobr ', 'jhocl ', & + 'joclo ', 'jsf6 ', & + 'jh2so4 ', 'jocs ', & + 'jso ', 'jso2 ', & + 'jso3 ', 'jsoa1_a1 ', & + 'jsoa1_a2 ', 'jsoa2_a1 ', & + 'jsoa2_a2 ', 'jsoa3_a1 ', & + 'jsoa3_a2 ', 'jsoa4_a1 ', & + 'jsoa4_a2 ', 'jsoa5_a1 ', & + 'jsoa5_a2 ', 'O1D_H2 ', & + 'O1D_H2O ', 'O1D_N2 ', & + 'O1D_O2ab ', 'O1D_O3 ', & + 'O_O3 ', 'usr_O_O ', & + 'usr_O_O2 ', 'H2_O ', & + 'H2O2_O ', 'H_HO2 ', & + 'H_HO2a ', 'H_HO2b ', & + 'H_O2 ', 'HO2_O ', & + 'HO2_O3 ', 'H_O3 ', & + 'OH_H2 ', 'OH_H2O2 ', & + 'OH_HO2 ', 'OH_O ', & + 'OH_O3 ', 'OH_OH ', & + 'OH_OH_M ', 'usr_HO2_HO2 ', & + 'HO2NO2_OH ', 'N_NO ', & + 'N_NO2a ', 'N_NO2b ', & + 'N_NO2c ', 'N_O2 ', & + 'NO2_O ', 'NO2_O3 ', & + 'NO2_O_M ', 'NO3_HO2 ', & + 'NO3_NO ', 'NO3_O ', & + 'NO3_OH ', 'N_OH ', & + 'NO_HO2 ', 'NO_O3 ', & + 'NO_O_M ', 'O1D_N2Oa ', & + 'O1D_N2Ob ', 'tag_NO2_HO2 ', & + 'tag_NO2_NO3 ', 'tag_NO2_OH ', & + 'usr_HNO3_OH ', 'usr_HO2NO2_M ', & + 'usr_N2O5_M ', 'CL_CH2O ', & + 'CL_CH4 ', 'CL_H2 ', & + 'CL_H2O2 ', 'CL_HO2a ', & + 'CL_HO2b ', 'CL_O3 ', & + 'CLO_CH3O2 ', 'CLO_CLOa ', & + 'CLO_CLOb ', 'CLO_CLOc ', & + 'CLO_HO2 ', 'CLO_NO ', & + 'CLONO2_CL ', 'CLO_NO2_M ', & + 'CLONO2_O ', 'CLONO2_OH ', & + 'CLO_O ', 'CLO_OHa ', & + 'CLO_OHb ', 'HCL_O ', & + 'HCL_OH ', 'HOCL_CL ', & + 'HOCL_O ', 'HOCL_OH ', & + 'O1D_CCL4 ', 'O1D_CF2CLBR ' /) + rxt_tag_lst( 201: 400) = (/ 'O1D_CFC11 ', 'O1D_CFC113 ', & + 'O1D_CFC114 ', 'O1D_CFC115 ', & + 'O1D_CFC12 ', 'O1D_HCLa ', & + 'O1D_HCLb ', 'tag_CLO_CLO_M ', & + 'usr_CL2O2_M ', 'BR_CH2O ', & + 'BR_HO2 ', 'BR_O3 ', & + 'BRO_BRO ', 'BRO_CLOa ', & + 'BRO_CLOb ', 'BRO_CLOc ', & + 'BRO_HO2 ', 'BRO_NO ', & + 'BRO_NO2_M ', 'BRONO2_O ', & + 'BRO_O ', 'BRO_OH ', & + 'HBR_O ', 'HBR_OH ', & + 'HOBR_O ', 'O1D_CF3BR ', & + 'O1D_CHBR3 ', 'O1D_H2402 ', & + 'O1D_HBRa ', 'O1D_HBRb ', & + 'F_CH4 ', 'F_H2 ', & + 'F_H2O ', 'F_HNO3 ', & + 'O1D_COF2 ', 'O1D_COFCL ', & + 'CH2BR2_CL ', 'CH2BR2_OH ', & + 'CH3BR_CL ', 'CH3BR_OH ', & + 'CH3CCL3_OH ', 'CH3CL_CL ', & + 'CH3CL_OH ', 'CHBR3_CL ', & + 'CHBR3_OH ', 'HCFC141B_OH ', & + 'HCFC142B_OH ', 'HCFC22_OH ', & + 'O1D_CH2BR2 ', 'O1D_CH3BR ', & + 'O1D_HCFC141B ', 'O1D_HCFC142B ', & + 'O1D_HCFC22 ', 'CH2O_HO2 ', & + 'CH2O_NO3 ', 'CH2O_O ', & + 'CH2O_OH ', 'CH3O2_CH3O2a ', & + 'CH3O2_CH3O2b ', 'CH3O2_HO2 ', & + 'CH3O2_NO ', 'CH3OH_OH ', & + 'CH3OOH_OH ', 'CH4_OH ', & + 'CO_OH_M ', 'HCN_OH ', & + 'HCOOH_OH ', 'HOCH2OO_HO2 ', & + 'HOCH2OO_M ', 'HOCH2OO_NO ', & + 'O1D_CH4a ', 'O1D_CH4b ', & + 'O1D_CH4c ', 'O1D_HCN ', & + 'usr_CO_OH_b ', 'C2H2_CL_M ', & + 'C2H2_OH_M ', 'C2H4_CL_M ', & + 'C2H4_O3 ', 'C2H5O2_C2H5O2 ', & + 'C2H5O2_CH3O2 ', 'C2H5O2_HO2 ', & + 'C2H5O2_NO ', 'C2H5OH_OH ', & + 'C2H5OOH_OH ', 'C2H6_CL ', & + 'C2H6_OH ', 'CH3CHO_NO3 ', & + 'CH3CHO_OH ', 'CH3CN_OH ', & + 'CH3CO3_CH3CO3 ', 'CH3CO3_CH3O2 ', & + 'CH3CO3_HO2 ', 'CH3CO3_NO ', & + 'CH3COOH_OH ', 'CH3COOOH_OH ', & + 'EO2_HO2 ', 'EO2_NO ', & + 'EO_M ', 'EO_O2 ', & + 'GLYALD_OH ', 'GLYOXAL_OH ', & + 'PAN_OH ', 'tag_C2H4_OH ', & + 'tag_CH3CO3_NO2 ', 'usr_PAN_M ', & + 'C3H6_NO3 ', 'C3H6_O3 ', & + 'C3H7O2_CH3O2 ', 'C3H7O2_HO2 ', & + 'C3H7O2_NO ', 'C3H7OOH_OH ', & + 'C3H8_OH ', 'CH3COCHO_NO3 ', & + 'CH3COCHO_OH ', 'HYAC_OH ', & + 'NOA_OH ', 'PO2_HO2 ', & + 'PO2_NO ', 'POOH_OH ', & + 'RO2_CH3O2 ', 'RO2_HO2 ', & + 'RO2_NO ', 'ROOH_OH ', & + 'tag_C3H6_OH ', 'usr_CH3COCH3_OH ', & + 'BIGENE_NO3 ', 'BIGENE_OH ', & + 'ENEO2_NO ', 'ENEO2_NOb ', & + 'HONITR_OH ', 'MACRO2_CH3CO3 ', & + 'MACRO2_CH3O2 ', 'MACRO2_HO2 ', & + 'MACRO2_NO3 ', 'MACRO2_NOa ', & + 'MACRO2_NOb ', 'MACR_O3 ', & + 'MACR_OH ', 'MACROOH_OH ', & + 'MCO3_CH3CO3 ', 'MCO3_CH3O2 ', & + 'MCO3_HO2 ', 'MCO3_MCO3 ', & + 'MCO3_NO ', 'MCO3_NO3 ', & + 'MEKO2_HO2 ', 'MEKO2_NO ', & + 'MEK_OH ', 'MEKOOH_OH ', & + 'MPAN_OH_M ', 'MVK_O3 ', & + 'MVK_OH ', 'usr_MCO3_NO2 ', & + 'usr_MPAN_M ', 'ALKNIT_OH ', & + 'ALKO2_HO2 ', 'ALKO2_NO ', & + 'ALKO2_NOb ', 'ALKOOH_OH ', & + 'BIGALK_OH ', 'HPALD_OH ', & + 'HYDRALD_OH ', 'IEPOX_OH ', & + 'ISOPAO2_CH3CO3 ', 'ISOPAO2_CH3O2 ', & + 'ISOPAO2_HO2 ', 'ISOPAO2_NO ', & + 'ISOPAO2_NO3 ', 'ISOPBO2_CH3CO3 ', & + 'ISOPBO2_CH3O2 ', 'ISOPBO2_HO2 ', & + 'ISOPBO2_M ', 'ISOPBO2_NO ', & + 'ISOPBO2_NO3 ', 'ISOPNITA_OH ', & + 'ISOPNITB_OH ', 'ISOP_NO3 ', & + 'ISOPNO3_CH3CO3 ', 'ISOPNO3_CH3O2 ', & + 'ISOPNO3_HO2 ', 'ISOPNO3_NO ', & + 'ISOPNO3_NO3 ', 'ISOPNOOH_OH ', & + 'ISOP_O3 ', 'ISOP_OH ', & + 'ISOPOOH_OH ', 'NC4CH2OH_OH ', & + 'NC4CHO_OH ', 'XO2_CH3CO3 ', & + 'XO2_CH3O2 ', 'XO2_HO2 ', & + 'XO2_NO ', 'XO2_NO3 ', & + 'XOOH_OH ', 'ACBZO2_HO2 ', & + 'ACBZO2_NO ', 'BENZENE_OH ', & + 'BENZO2_HO2 ', 'BENZO2_NO ' /) + rxt_tag_lst( 401: 528) = (/ 'BENZOOH_OH ', 'BZALD_OH ', & + 'BZOO_HO2 ', 'BZOOH_OH ', & + 'BZOO_NO ', 'C6H5O2_HO2 ', & + 'C6H5O2_NO ', 'C6H5OOH_OH ', & + 'CRESOL_OH ', 'DICARBO2_HO2 ', & + 'DICARBO2_NO ', 'DICARBO2_NO2 ', & + 'MALO2_HO2 ', 'MALO2_NO ', & + 'MALO2_NO2 ', 'MDIALO2_HO2 ', & + 'MDIALO2_NO ', 'MDIALO2_NO2 ', & + 'PHENO2_HO2 ', 'PHENO2_NO ', & + 'PHENOL_OH ', 'PHENO_NO2 ', & + 'PHENO_O3 ', 'PHENOOH_OH ', & + 'tag_ACBZO2_NO2 ', 'TOLO2_HO2 ', & + 'TOLO2_NO ', 'TOLOOH_OH ', & + 'TOLUENE_OH ', 'usr_PBZNIT_M ', & + 'XYLENES_OH ', 'XYLENO2_HO2 ', & + 'XYLENO2_NO ', 'XYLENOOH_OH ', & + 'XYLOLO2_HO2 ', 'XYLOLO2_NO ', & + 'XYLOL_OH ', 'XYLOLOOH_OH ', & + 'BCARY_NO3 ', 'BCARY_O3 ', & + 'BCARY_OH ', 'MTERP_NO3 ', & + 'MTERP_O3 ', 'MTERP_OH ', & + 'NTERPO2_CH3O2 ', 'NTERPO2_HO2 ', & + 'NTERPO2_NO ', 'NTERPO2_NO3 ', & + 'NTERPOOH_OH ', 'TERP2O2_CH3O2 ', & + 'TERP2O2_HO2 ', 'TERP2O2_NO ', & + 'TERP2OOH_OH ', 'TERPNIT_OH ', & + 'TERPO2_CH3O2 ', 'TERPO2_HO2 ', & + 'TERPO2_NO ', 'TERPOOH_OH ', & + 'TERPROD1_NO3 ', 'TERPROD1_OH ', & + 'TERPROD2_OH ', 'OCS_O ', & + 'OCS_OH ', 'S_O2 ', & + 'S_O3 ', 'SO_BRO ', & + 'SO_CLO ', 'S_OH ', & + 'SO_NO2 ', 'SO_O2 ', & + 'SO_O3 ', 'SO_OCLO ', & + 'SO_OH ', 'usr_SO2_OH ', & + 'usr_SO3_H2O ', 'DMS_NO3 ', & + 'DMS_OHa ', 'NH3_OH ', & + 'usr_DMS_OH ', 'usr_GLYOXAL_aer ', & + 'usr_HO2_aer ', 'usr_HONITR_aer ', & + 'usr_ISOPNITA_aer ', 'usr_ISOPNITB_aer ', & + 'usr_N2O5_aer ', 'usr_NC4CH2OH_aer ', & + 'usr_NC4CHO_aer ', 'usr_NH4_strat_tau ', & + 'usr_NO2_aer ', 'usr_NO3_aer ', & + 'usr_NTERPOOH_aer ', 'usr_ONITR_aer ', & + 'usr_TERPNIT_aer ', 'BCARY_NO3_vbs ', & + 'BCARY_O3_vbs ', 'BCARY_OH_vbs ', & + 'BENZENE_OH_vbs ', 'ISOP_NO3_vbs ', & + 'ISOP_O3_vbs ', 'ISOP_OH_vbs ', & + 'IVOC_OH ', 'MTERP_NO3_vbs ', & + 'MTERP_O3_vbs ', 'MTERP_OH_vbs ', & + 'SVOC_OH ', 'TOLUENE_OH_vbs ', & + 'XYLENES_OH_vbs ', 'het1 ', & + 'het10 ', 'het11 ', & + 'het12 ', 'het13 ', & + 'het14 ', 'het15 ', & + 'het16 ', 'het17 ', & + 'het2 ', 'het3 ', & + 'het4 ', 'het5 ', & + 'het6 ', 'het7 ', & + 'het8 ', 'het9 ', & + 'E90_tau ', 'NH_50_tau ', & + 'NH_5_tau ', 'ST80_25_tau ' /) + rxt_tag_map(:rxt_tag_cnt) = (/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, & + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, & + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, & + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, & + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, & + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, & + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, & + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, & + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, & + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, & + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, & + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, & + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, & + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, & + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, & + 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, & + 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, & + 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, & + 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, & + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, & + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, & + 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, & + 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, & + 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, & + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, & + 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, & + 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, & + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, & + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, & + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, & + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, & + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, & + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, & + 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, & + 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, & + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, & + 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, & + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, & + 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, & + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, & + 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, & + 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, & + 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, & + 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, & + 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, & + 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, & + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, & + 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, & + 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, & + 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, & + 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, & + 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, & + 521, 522, 523, 524, 525, 526, 527, 528 /) + if( allocated( pht_alias_lst ) ) then + deallocate( pht_alias_lst ) + end if + allocate( pht_alias_lst(phtcnt,2),stat=ios ) + if( ios /= 0 ) then + write(iulog,*) 'set_sim_dat: failed to allocate pht_alias_lst; error = ',ios + call endrun + end if + if( allocated( pht_alias_mult ) ) then + deallocate( pht_alias_mult ) + end if + allocate( pht_alias_mult(phtcnt,2),stat=ios ) + if( ios /= 0 ) then + write(iulog,*) 'set_sim_dat: failed to allocate pht_alias_mult; error = ',ios + call endrun + end if + pht_alias_lst(:,1) = (/ ' ', ' ', ' ', ' ', & + 'userdefined ', 'userdefined ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', 'userdefined ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ' /) + pht_alias_lst(:,2) = (/ ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', 'jch3ooh ', 'jch3ooh ', & + 'jch3ooh ', 'jno2 ', 'jno2 ', 'jno2 ', & + 'jno2 ', 'jno2 ', 'jno2 ', 'jch3ooh ', & + 'jch3ooh ', 'jch3ooh ', 'jch3ooh ', ' ', & + ' ', ' ', ' ', ' ', & + 'jh2o2 ', ' ', ' ', ' ', & + ' ', 'jch3ooh ', ' ', 'jmgly ', & + 'jch2o_a ', 'jno2 ', ' ', 'jch3ooh ', & + 'jch3ooh ', ' ', ' ', 'jacet ', & + 'jch3ooh ', 'jpan ', ' ', 'jch2o_a ', & + 'jch2o_a ', 'jch3ooh ', 'jch3cho ', ' ', & + 'jch3ooh ', 'jch3ooh ', 'jch3ooh ', 'jno2 ', & + 'jch3ooh ', 'jch3ooh ', 'jch3ooh ', 'jch3cho ', & + 'jch3cho ', 'jch3ooh ', 'jch3ooh ', 'jch3ooh ', & + 'jch3ooh ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', ' ', ' ', ' ', & + ' ', 'jno2 ', 'jno2 ', 'jno2 ', & + 'jno2 ', 'jno2 ', 'jno2 ', 'jno2 ', & + 'jno2 ', 'jno2 ', 'jno2 ' /) + pht_alias_mult(:,1) = (/ 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8 /) + pht_alias_mult(:,2) = (/ 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, .10_r8, 0.2_r8, .14_r8, .20_r8, & + .20_r8, .006_r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 0.28_r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + .006_r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, .10_r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & + 1._r8, 1._r8, 1._r8, .0004_r8, .0004_r8, & + .0004_r8, .0004_r8, .0004_r8, .0004_r8, .0004_r8, & + .0004_r8, .0004_r8, .0004_r8 /) + allocate( cph_enthalpy(enthalpy_cnt),stat=ios ) + if( ios /= 0 ) then + write(iulog,*) 'set_sim_dat: failed to allocate cph_enthalpy; error = ',ios + call endrun + end if + allocate( cph_rid(enthalpy_cnt),stat=ios ) + if( ios /= 0 ) then + write(iulog,*) 'set_sim_dat: failed to allocate cph_rid; error = ',ios + call endrun + end if + cph_rid(:) = (/ 126, 129, 130, 131, 134, & + 137, 138, 139, 140, 143, & + 144, 145, 148, 150, 154, & + 155, 163, 164 /) + cph_enthalpy(:) = (/ 189.810000_r8, 392.190000_r8, 493.580000_r8, 101.390000_r8, 232.590000_r8, & + 203.400000_r8, 226.580000_r8, 120.100000_r8, 194.710000_r8, 293.620000_r8, & + 67.670000_r8, 165.300000_r8, 165.510000_r8, 313.750000_r8, 133.750000_r8, & + 193.020000_r8, 34.470000_r8, 199.170000_r8 /) + allocate( num_rnts(rxntot-phtcnt),stat=ios ) + if( ios /= 0 ) then + write(iulog,*) 'set_sim_dat: failed to allocate num_rnts; error = ',ios + call endrun + end if + num_rnts(:) = (/ 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, & + 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, & + 2, 3, 2, 2, 3, 3, 3, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 3, 3, 2, 2, 1, 2, 2, 2, 2, & + 2, 2, 3, 3, 3, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, & + 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, & + 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, & + 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, & + 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, & + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & + 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, & + 2, 2, 2, 1, 1, 2, 2, 2, 1, 1, & + 2, 1, 1, 1, 1 /) + + end subroutine set_sim_dat + + end module mo_sim_dat diff --git a/src/chemistry/pp_geoschem/rate_diags.F90 b/src/chemistry/pp_geoschem/rate_diags.F90 new file mode 100644 index 0000000000..40b5fa6dde --- /dev/null +++ b/src/chemistry/pp_geoschem/rate_diags.F90 @@ -0,0 +1,177 @@ +!-------------------------------------------------------------------------------- +! Manages writing reaction rates to history +!-------------------------------------------------------------------------------- +module rate_diags + + use shr_kind_mod, only : r8 => shr_kind_r8 + use shr_kind_mod, only : CL => SHR_KIND_CL + use cam_history, only : fieldname_len + use cam_history, only : addfld, add_default + use cam_history, only : outfld + use chem_mods, only : rxt_tag_cnt, rxt_tag_lst, rxt_tag_map + use ppgrid, only : pver + use spmd_utils, only : masterproc + use cam_abortutils, only : endrun +! use sums_utils, only : sums_grp_t, parse_sums + + implicit none + private + public :: rate_diags_init + public :: rate_diags_calc + public :: rate_diags_readnl + + character(len=fieldname_len) :: rate_names(rxt_tag_cnt) + +! integer :: ngrps = 0 +! type(sums_grp_t), allocatable :: grps(:) + + integer, parameter :: maxlines = 200 + character(len=CL), allocatable :: rxn_rate_sums(:) + +contains + +!------------------------------------------------------------------- +!------------------------------------------------------------------- + subroutine rate_diags_readnl(nlfile) + + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit + use spmd_utils, only: mpicom, mpi_character, masterprocid + + ! args + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + + ! Local variables + integer :: unitn, ierr + + namelist /rxn_rate_diags_nl/ rxn_rate_sums + + allocate( rxn_rate_sums( maxlines ) ) + rxn_rate_sums(:) = ' ' + + !! Read namelist + !if (masterproc) then + ! unitn = getunit() + ! open( unitn, file=trim(nlfile), status='old' ) + ! call find_group_name(unitn, 'rxn_rate_diags_nl', status=ierr) + ! if (ierr == 0) then + ! read(unitn, rxn_rate_diags_nl, iostat=ierr) + ! if (ierr /= 0) then + ! call endrun('rate_diags_readnl:: ERROR reading namelist') + ! end if + ! end if + ! close(unitn) + ! call freeunit(unitn) + !end if + + ! Broadcast namelist variables + call mpi_bcast(rxn_rate_sums,len(rxn_rate_sums(1))*maxlines, mpi_character, masterprocid, mpicom, ierr) + + end subroutine rate_diags_readnl +!-------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------- + subroutine rate_diags_init + use phys_control, only : phys_getopts + + integer :: i, len, pos + character(len=64) :: name + logical :: history_scwaccm_forcing + + call phys_getopts( history_scwaccm_forcing_out = history_scwaccm_forcing ) + + !do i = 1,rxt_tag_cnt + ! pos = 0 + ! pos = index(rxt_tag_lst(i),'tag_') + ! if (pos <= 0) pos = index(rxt_tag_lst(i),'usr_') + ! if (pos <= 0) pos = index(rxt_tag_lst(i),'cph_') + ! if (pos <= 0) pos = index(rxt_tag_lst(i),'ion_') + ! if (pos>0) then + ! name = 'r_'//trim(rxt_tag_lst(i)(5:)) + ! else + ! name = 'r_'//trim(rxt_tag_lst(i)(1:)) + ! endif + ! len = min(fieldname_len,len_trim(name)) + ! rate_names(i) = trim(name(1:len)) + ! call addfld(rate_names(i), (/ 'lev' /),'A', 'molecules/cm3/sec','reaction rate') + ! if (history_scwaccm_forcing .and. rate_names(i) == 'r_O1D_H2O') then + ! call add_default( rate_names(i), 1, ' ') + ! endif + !enddo + + !! parse the terms of the summations + !call parse_sums(rxn_rate_sums, ngrps, grps) + !deallocate( rxn_rate_sums ) + + !do i = 1, ngrps + ! call addfld( grps(i)%name, (/ 'lev' /),'A', 'molecules/cm3/sec','reaction rate group') + !enddo + + end subroutine rate_diags_init + +!-------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------- + subroutine rate_diags_calc( rxt_rates, vmr, m, ncol, lchnk ) + + !use mo_rxt_rates_conv, only: set_rates + + real(r8), intent(inout) :: rxt_rates(:,:,:) ! 'molec/cm3/sec' + real(r8), intent(in) :: vmr(:,:,:) + real(r8), intent(in) :: m(:,:) ! air density (molecules/cm3) + integer, intent(in) :: ncol, lchnk + + !integer :: i, j, ndx + !real(r8) :: group_rate(ncol,pver) + + rxt_rates(:,:,:) = 0.0e+0_r8 + + !call set_rates( rxt_rates, vmr, ncol ) + + !! output individual tagged rates + !do i = 1, rxt_tag_cnt + ! ! convert from vmr/sec to molecules/cm3/sec + ! rxt_rates(:ncol,:,rxt_tag_map(i)) = rxt_rates(:ncol,:,rxt_tag_map(i)) * m(:ncol,:) + ! call outfld( rate_names(i), rxt_rates(:ncol,:,rxt_tag_map(i)), ncol, lchnk ) + !enddo + + !! output rate groups ( or families ) + !do i = 1, ngrps + ! group_rate(:,:) = 0._r8 + ! do j = 1, grps(i)%nmembers + ! ndx = lookup_tag_ndx(grps(i)%term(j)) + ! group_rate(:ncol,:) = group_rate(:ncol,:) + grps(i)%multipler(j)*rxt_rates(:ncol,:,ndx) + ! enddo + ! call outfld( grps(i)%name, group_rate(:ncol,:), ncol, lchnk ) + !end do + + end subroutine rate_diags_calc + +!------------------------------------------------------------------- +! Private routines : +!------------------------------------------------------------------- +!------------------------------------------------------------------- + +!------------------------------------------------------------------- +! finds the index corresponging to a given reacton name +!------------------------------------------------------------------- + function lookup_tag_ndx( name ) result( ndx ) + character(len=*) :: name + integer :: ndx + + integer :: i + + ndx = -1 + + !findloop: do i = 1,rxt_tag_cnt + ! if (trim(name) .eq. trim(rate_names(i)(3:))) then + ! ndx = i + ! return + ! endif + !end do findloop + + !if (ndx<0) then + ! call endrun('rate_diags: not able to find rxn tag name: '//trim(name)) + !endif + + end function lookup_tag_ndx + +end module rate_diags diff --git a/src/chemistry/pp_geoschem/short_lived_species.F90 b/src/chemistry/pp_geoschem/short_lived_species.F90 new file mode 100644 index 0000000000..b4dc6d55ff --- /dev/null +++ b/src/chemistry/pp_geoschem/short_lived_species.F90 @@ -0,0 +1,229 @@ +!--------------------------------------------------------------------- +! Manages the storage of non-transported short-lived chemical species +! in the physics buffer. +! +! Created by: Francis Vitt -- 20 Aug 2008 +!--------------------------------------------------------------------- +module short_lived_species + + use shr_kind_mod, only : r8 => shr_kind_r8 + use chem_mods, only : slvd_lst, nslvd, gas_pcnst, slvd_ref_mmr + use cam_logfile, only : iulog + use ppgrid, only : pcols, pver, begchunk, endchunk + use spmd_utils, only : masterproc + + + implicit none + + save + private + !public :: map + public :: register_short_lived_species + public :: short_lived_species_initic + public :: short_lived_species_writeic + public :: initialize_short_lived_species + public :: set_short_lived_species + public :: get_short_lived_species + public :: slvd_index + public :: pbf_idx + + integer :: pbf_idx + !integer :: map(nslvd) + + character(len=16), parameter :: pbufname = 'ShortLivedSpecies' + +contains + +!--------------------------------------------------------------------- +!--------------------------------------------------------------------- + subroutine register_short_lived_species + use physics_buffer, only : pbuf_add_field, dtype_r8 + + implicit none + + integer :: m + + if ( nslvd < 1 ) return + + call pbuf_add_field(pbufname,'global',dtype_r8,(/pcols,pver,nslvd/),pbf_idx) + + end subroutine register_short_lived_species + +!--------------------------------------------------------------------- +!--------------------------------------------------------------------- + subroutine short_lived_species_initic +#ifdef WACCMX_IONOS + use cam_history, only : addfld, add_default + + integer :: m + character(len=24) :: varname + + do m=1,nslvd + varname = trim(slvd_lst(m))//'&IC' + call addfld (varname, (/ 'lev' /),'I','kg/kg',trim(varname)//' not-transported species',gridname='physgrid') + call add_default (varname,0, 'I') + enddo +#endif + end subroutine short_lived_species_initic + +!--------------------------------------------------------------------- +!--------------------------------------------------------------------- + subroutine short_lived_species_writeic( lchnk, pbuf ) + use cam_history, only : outfld, write_inithist + use physics_buffer, only : physics_buffer_desc, pbuf_get_field + + integer , intent(in) :: lchnk ! chunk identifier + type(physics_buffer_desc), pointer :: pbuf(:) +#ifdef WACCMX_IONOS + real(r8),pointer :: tmpptr(:,:) + integer :: m + character(len=24) :: varname + + if ( write_inithist() ) then + do m=1,nslvd + varname = trim(slvd_lst(m))//'&IC' + call pbuf_get_field(pbuf, pbf_idx, tmpptr, start=(/1,1,m/), kount=(/ pcols,pver,1 /)) + call outfld(varname, tmpptr, pcols,lchnk) + enddo + endif +#endif + end subroutine short_lived_species_writeic + +!--------------------------------------------------------------------- +!--------------------------------------------------------------------- + subroutine initialize_short_lived_species(ncid_ini, pbuf2d) + use cam_grid_support, only : cam_grid_check, cam_grid_id + use cam_grid_support, only : cam_grid_get_dim_names + use cam_abortutils, only : endrun + !use mo_tracname, only : solsym !TMMF + use ncdio_atm, only : infld + use pio, only : file_desc_t + use physics_buffer, only : physics_buffer_desc, pbuf_set_field, pbuf_get_chunk, pbuf_get_field + + implicit none + + type(file_desc_t), intent(inout) :: ncid_ini + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + + integer :: m,n,lchnk + integer :: grid_id + character(len=255) :: fieldname + character(len=4) :: dim1name, dim2name + logical :: found + real(r8),pointer :: tmpptr(:,:,:) ! temporary pointer + real(r8),pointer :: tmpptr2(:,:,:) ! temporary pointer + character(len=*), parameter :: subname='INITIALIZE_SHORT_LIVED_SPECIES' + + if ( nslvd < 1 ) return + + found = .false. + + grid_id = cam_grid_id('physgrid') + if (.not. cam_grid_check(grid_id)) then + call endrun(trim(subname)//': Internal error, no "physgrid" grid') + end if + call cam_grid_get_dim_names(grid_id, dim1name, dim2name) + + call pbuf_set_field(pbuf2d, pbf_idx, 0._r8) + + allocate(tmpptr(pcols,pver,begchunk:endchunk)) + + do m=1,nslvd + !n = map(m) + !fieldname = solsym(n) + write(fieldname,'(a,a)') trim(slvd_lst(m)) + call infld( fieldname,ncid_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tmpptr, found, gridname='physgrid') + + if (.not.found) then + !tmpptr(:,:,:) = 1.e-36_r8 + tmpptr(:,:,:) = slvd_ref_mmr(m) + endif + + call pbuf_set_field(pbuf2d, pbf_idx, tmpptr, start=(/1,1,m/),kount=(/pcols,pver,1/)) + + if (MasterProc) write(iulog,'(a20,a)') TRIM(fieldname), ' is set to short-lived' + ! DEBUG: remove as this will be confusing to most due to the negative + ! dummy MW which was used to calculate the reference MMR + if (MasterProc) write(iulog,'(a, E16.5E4)') ' --> reference MMR: ', slvd_ref_mmr(m) + + enddo + + deallocate(tmpptr) + + end subroutine initialize_short_lived_species + +!--------------------------------------------------------------------- +!--------------------------------------------------------------------- + subroutine set_short_lived_species( q, lchnk, ncol, pbuf ) + + use physics_buffer, only : physics_buffer_desc, pbuf_set_field + + implicit none + + real(r8), intent(in) :: q(pcols,pver,nslvd) + integer, intent(in) :: lchnk, ncol + type(physics_buffer_desc), pointer :: pbuf(:) + + integer :: m,n + + if ( nslvd < 1 ) return + + do m=1,nslvd + !n = map(m) + !call pbuf_set_field(pbuf, pbf_idx, q(:,:,m), start=(/1,1,n/),kount=(/pcols,pver,1/)) + call pbuf_set_field(pbuf, pbf_idx, q(:,:,m), start=(/1,1,m/),kount=(/pcols,pver,1/)) + enddo + + end subroutine set_short_lived_species + +!--------------------------------------------------------------------- +!--------------------------------------------------------------------- + subroutine get_short_lived_species( q, lchnk, ncol, pbuf ) + use physics_buffer, only : physics_buffer_desc, pbuf_get_field + + implicit none + + real(r8), intent(inout) :: q(pcols,pver,nslvd) + integer, intent(in) :: lchnk, ncol + type(physics_buffer_desc), pointer :: pbuf(:) + real(r8),pointer :: tmpptr(:,:) + + + integer :: m,n + + if ( nslvd < 1 ) return + + do m=1,nslvd + !n = map(m) + call pbuf_get_field(pbuf, pbf_idx, tmpptr, start=(/1,1,m/), kount=(/ pcols,pver,1 /)) + !q(:ncol,:,n) = tmpptr(:ncol,:) + q(:ncol,:,m) = tmpptr(:ncol,:) + enddo + + endsubroutine get_short_lived_species + +!--------------------------------------------------------------------- +!--------------------------------------------------------------------- + function slvd_index( name ) + implicit none + + character(len=*) :: name + integer :: slvd_index + + integer :: m + + slvd_index = -1 + + if ( nslvd < 1 ) return + + do m=1,nslvd + if ( name == slvd_lst(m) ) then + slvd_index = m + return + endif + enddo + + endfunction slvd_index + +end module short_lived_species diff --git a/src/chemistry/pp_geoschem/upper_bc.F90 b/src/chemistry/pp_geoschem/upper_bc.F90 new file mode 100644 index 0000000000..61f4dab886 --- /dev/null +++ b/src/chemistry/pp_geoschem/upper_bc.F90 @@ -0,0 +1,243 @@ + +module upper_bc + +!--------------------------------------------------------------------------------- +! Module to compute the upper boundary condition for temperature (dry static energy) +! and trace gases. Uses the MSIS model, and SNOE and TIME GCM data. +! +! original code by Stacy Walters +! adapted by B. A. Boville +!--------------------------------------------------------------------------------- + + use shr_kind_mod, only: r8 => shr_kind_r8 + use shr_const_mod,only: grav => shr_const_g, & ! gravitational constant (m/s^2) + kboltz => shr_const_boltz, & ! Boltzmann constant + pi => shr_const_pi, & ! pi + rEarth => shr_const_rearth ! Earth radius + use ppgrid, only: pcols, pver, pverp + use constituents, only: pcnst + use cam_logfile, only: iulog + use spmd_utils, only: masterproc + use ref_pres, only: ptop_ref + + implicit none + private + save +! +! Public interfaces +! + public :: ubc_defaultopts ! set default values of namelist variables + public :: ubc_setopts ! get namelist input + public :: ubc_init ! global initialization + public :: ubc_timestep_init ! time step initialization + public :: ubc_get_vals ! get ubc values for this step + +! Namelist variables + character(len=256) :: snoe_ubc_file = ' ' + real(r8) :: t_pert_ubc = 0._r8 + real(r8) :: no_xfac_ubc = 1._r8 + + character(len=256) :: tgcm_ubc_file = ' ' + integer :: tgcm_ubc_cycle_yr = 0 + integer :: tgcm_ubc_fixed_ymd = 0 + integer :: tgcm_ubc_fixed_tod = 0 + integer :: f_ndx, hf_ndx + character(len=32) :: tgcm_ubc_data_type = 'CYCLICAL' + + logical :: apply_upper_bc = .true. + +!================================================================================================ +contains +!================================================================================================ + +subroutine ubc_defaultopts(tgcm_ubc_file_out, tgcm_ubc_data_type_out, tgcm_ubc_cycle_yr_out, tgcm_ubc_fixed_ymd_out, & + tgcm_ubc_fixed_tod_out, snoe_ubc_file_out, t_pert_ubc_out, no_xfac_ubc_out) +!----------------------------------------------------------------------- +! Purpose: Return default runtime options +!----------------------------------------------------------------------- + + real(r8), intent(out), optional :: t_pert_ubc_out + real(r8), intent(out), optional :: no_xfac_ubc_out + character(len=*), intent(out), optional :: tgcm_ubc_file_out + character(len=*), intent(out), optional :: snoe_ubc_file_out + integer , intent(out), optional :: tgcm_ubc_cycle_yr_out + integer , intent(out), optional :: tgcm_ubc_fixed_ymd_out + integer , intent(out), optional :: tgcm_ubc_fixed_tod_out + character(len=*), intent(out), optional :: tgcm_ubc_data_type_out + +!----------------------------------------------------------------------- + + if ( present(tgcm_ubc_file_out) ) then + tgcm_ubc_file_out = tgcm_ubc_file + endif + if ( present(tgcm_ubc_data_type_out) ) then + tgcm_ubc_data_type_out = tgcm_ubc_data_type + endif + if ( present(tgcm_ubc_cycle_yr_out) ) then + tgcm_ubc_cycle_yr_out = tgcm_ubc_cycle_yr + endif + if ( present(tgcm_ubc_fixed_ymd_out) ) then + tgcm_ubc_fixed_ymd_out = tgcm_ubc_fixed_ymd + endif + if ( present(tgcm_ubc_fixed_tod_out) ) then + tgcm_ubc_fixed_tod_out = tgcm_ubc_fixed_tod + endif + if ( present(snoe_ubc_file_out) ) then + snoe_ubc_file_out = snoe_ubc_file + endif + if ( present(t_pert_ubc_out) ) then + t_pert_ubc_out = t_pert_ubc + endif + if ( present(no_xfac_ubc_out) ) then + no_xfac_ubc_out = no_xfac_ubc + endif + +end subroutine ubc_defaultopts + +!================================================================================================ + +subroutine ubc_setopts(tgcm_ubc_file_in, tgcm_ubc_data_type_in, tgcm_ubc_cycle_yr_in, tgcm_ubc_fixed_ymd_in, & + tgcm_ubc_fixed_tod_in, snoe_ubc_file_in, t_pert_ubc_in, no_xfac_ubc_in) +!----------------------------------------------------------------------- +! Purpose: Set runtime options +!----------------------------------------------------------------------- + + use cam_abortutils, only : endrun + + real(r8), intent(in), optional :: t_pert_ubc_in + real(r8), intent(in), optional :: no_xfac_ubc_in + character(len=*), intent(in), optional :: tgcm_ubc_file_in + character(len=*), intent(in), optional :: snoe_ubc_file_in + integer , intent(in), optional :: tgcm_ubc_cycle_yr_in + integer , intent(in), optional :: tgcm_ubc_fixed_ymd_in + integer , intent(in), optional :: tgcm_ubc_fixed_tod_in + character(len=*), intent(in), optional :: tgcm_ubc_data_type_in + +!----------------------------------------------------------------------- + + if ( present(tgcm_ubc_file_in) ) then + tgcm_ubc_file = tgcm_ubc_file_in + endif + if ( present(tgcm_ubc_data_type_in) ) then + tgcm_ubc_data_type = tgcm_ubc_data_type_in + endif + if ( present(tgcm_ubc_cycle_yr_in) ) then + tgcm_ubc_cycle_yr = tgcm_ubc_cycle_yr_in + endif + if ( present(tgcm_ubc_fixed_ymd_in) ) then + tgcm_ubc_fixed_ymd = tgcm_ubc_fixed_ymd_in + endif + if ( present(tgcm_ubc_fixed_tod_in) ) then + tgcm_ubc_fixed_tod = tgcm_ubc_fixed_tod_in + endif + if ( present(snoe_ubc_file_in) ) then + snoe_ubc_file = snoe_ubc_file_in + endif + if ( present(t_pert_ubc_in) ) then + t_pert_ubc = t_pert_ubc_in + endif + if ( present(no_xfac_ubc_in) ) then + no_xfac_ubc = no_xfac_ubc_in + if( no_xfac_ubc < 0._r8 ) then + write(iulog,*) 'ubc_setopts: no_xfac_ubc = ',no_xfac_ubc,' must be >= 0' + call endrun + end if + endif + +end subroutine ubc_setopts + +!=============================================================================== + + subroutine ubc_init() +!----------------------------------------------------------------------- +! Initialization of time independent fields for the upper boundary condition +! Calls initialization routine for MSIS, TGCM and SNOE +!----------------------------------------------------------------------- + + ! Assume we are running in a simulation with ptop >= 1 Pa + apply_upper_bc = .false. + + if (.not.apply_upper_bc) return + + end subroutine ubc_init + +!=============================================================================== + + subroutine ubc_timestep_init(pbuf2d, state) +!----------------------------------------------------------------------- +! timestep dependent setting +!----------------------------------------------------------------------- + + use solar_parms_data, only: kp=>solar_parms_kp, ap=>solar_parms_ap, f107=>solar_parms_f107 + use solar_parms_data, only: f107a=>solar_parms_f107a, f107p=>solar_parms_f107p + use physics_types, only: physics_state + use ppgrid, only: begchunk, endchunk + use physics_buffer, only: physics_buffer_desc + + type(physics_state), intent(in) :: state(begchunk:endchunk) + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + + if (.not.apply_upper_bc) return + + end subroutine ubc_timestep_init + +!=============================================================================== + + subroutine ubc_get_vals (lchnk, ncol, pint, zi, t, q, omega, phis, & + msis_temp, ubc_mmr, ubc_flux) + +!----------------------------------------------------------------------- +! interface routine for vertical diffusion and pbl scheme +!----------------------------------------------------------------------- + use cam_abortutils, only: endrun + use physconst, only: avogad, rairv, mbarv, rga ! Avogadro, gas constant, mean mass, universal gas constant + use phys_control, only: waccmx_is + use constituents, only: cnst_get_ind, cnst_mw, cnst_fixed_ubc ! Needed for ubc_flux + +!------------------------------Arguments-------------------------------- + integer, intent(in) :: lchnk ! chunk identifier + integer, intent(in) :: ncol ! number of atmospheric columns + real(r8), intent(in) :: pint(pcols,pverp) ! interface pressures + real(r8), intent(in) :: zi(pcols,pverp) ! interface geoptl height above sfc + real(r8), intent(in) :: t(pcols,pver) ! midpoint temperature + real(r8), intent(in),target :: q(pcols,pver,pcnst) ! contituent mixing ratios (kg/kg) + real(r8), intent(in) :: omega(pcols,pver) ! Vertical pressure velocity (Pa/s) + real(r8), intent(in) :: phis(pcols) ! Surface geopotential (m2/s2) + + real(r8), intent(out) :: msis_temp(pcols) ! upper bndy temperature (K) + real(r8), intent(out) :: ubc_mmr(pcols,pcnst) ! upper bndy mixing ratios (kg/kg) + real(r8), intent(out) :: ubc_flux(pcols,pcnst) ! upper bndy flux (kg/s/m^2) + +!---------------------------Local storage------------------------------- + integer :: m ! constituent index + integer :: ierr ! error flag for allocates + integer :: indx_H ! cnst index for H + integer :: indx_HE ! cnst index for He + integer :: iCol ! column loop counter + + real(r8), parameter :: m2km = 1.e-3_r8 ! meter to km + real(r8) :: rho_top(pcols) ! density at top interface + real(r8) :: z_top(pcols) ! height of top interface (km) + + real(r8), parameter :: hfluxlimitfac = 0.72_r8 ! Hydrogen upper boundary flux limiting factor + + real(r8) :: nmbartop ! Top level density (rho) + real(r8) :: zkt ! Factor for H Jean's escape flux calculation + real(r8) :: nDensHETop ! Helium number density (kg/m3) + real(r8) :: pScaleHeight ! Scale height (m) + real(r8) :: wN2 ! Neutral vertical velocity second level (m/s) + real(r8) :: wN3 ! Neutral vertical velocity at third level (m/s) + real(r8) :: wNTop ! Neutral vertical velocity at top level (m/s) + + real(r8), pointer :: qh_top(:) ! Top level hydrogen mixing ratio (kg/kg) +!----------------------------------------------------------------------- + + ubc_mmr(:,:) = 0._r8 + ubc_flux(:,:) = 0._r8 + msis_temp(:) = 0._r8 + + if (.not. apply_upper_bc) return + + end subroutine ubc_get_vals + +end module upper_bc diff --git a/src/control/camsrfexch.F90 b/src/control/camsrfexch.F90 index d48e42b433..fae49a18ab 100644 --- a/src/control/camsrfexch.F90 +++ b/src/control/camsrfexch.F90 @@ -120,6 +120,9 @@ module camsrfexch real(r8) :: re(pcols) ! atm/ocn saved version of re real(r8) :: ssq(pcols) ! atm/ocn saved version of ssq real(r8), pointer, dimension(:,:) :: depvel ! deposition velocities + real(r8), pointer, dimension(:,:) :: lwtgcell ! landunit areas + real(r8), pointer, dimension(:,:) :: pwtgcell ! patch areas + real(r8), pointer, dimension(:,:) :: lai ! leaf area indices real(r8), pointer, dimension(:,:) :: dstflx ! dust fluxes real(r8), pointer, dimension(:,:) :: meganflx ! MEGAN fluxes real(r8), pointer, dimension(:,:) :: fireflx ! wild fire emissions @@ -146,7 +149,7 @@ module camsrfexch ! !INTERFACE ! subroutine hub2atm_alloc( cam_in ) - use seq_drydep_mod, only: lnd_drydep, n_drydep + use seq_drydep_mod, only: lnd_drydep, n_drydep, NLUse, NPatch use cam_cpl_indices, only: index_x2a_Sl_ram1, index_x2a_Sl_fv, index_x2a_Sl_soilw, index_x2a_Fall_flxdst1 use cam_cpl_indices, only: index_x2a_Fall_flxvoc use shr_megan_mod, only: shr_megan_mechcomps_n @@ -177,6 +180,9 @@ subroutine hub2atm_alloc( cam_in ) nullify(cam_in(c)%fv) nullify(cam_in(c)%soilw) nullify(cam_in(c)%depvel) + nullify(cam_in(c)%lwtgcell) + nullify(cam_in(c)%pwtgcell) + nullify(cam_in(c)%lai) nullify(cam_in(c)%dstflx) nullify(cam_in(c)%meganflx) nullify(cam_in(c)%fireflx) @@ -210,6 +216,12 @@ subroutine hub2atm_alloc( cam_in ) do c = begchunk,endchunk allocate (cam_in(c)%depvel(pcols,n_drydep), stat=ierror) if ( ierror /= 0 ) call endrun('HUB2ATM_ALLOC error: allocation error depvel') + allocate (cam_in(c)%lwtgcell(pcols,NLUse), stat=ierror) + if ( ierror /= 0 ) call endrun('HUB2ATM_ALLOC error: allocation error lwtgcell') + allocate (cam_in(c)%pwtgcell(pcols,NPatch), stat=ierror) + if ( ierror /= 0 ) call endrun('HUB2ATM_ALLOC error: allocation error pwtgcell') + allocate (cam_in(c)%lai(pcols,NPatch), stat=ierror) + if ( ierror /= 0 ) call endrun('HUB2ATM_ALLOC error: allocation error lai') end do endif @@ -266,6 +278,11 @@ subroutine hub2atm_alloc( cam_in ) if (lnd_drydep .and. n_drydep>0) then cam_in(c)%depvel (:,:) = 0._r8 endif + if (lnd_drydep) then + cam_in(c)%lwtgcell (:,:) = 0._r8 + cam_in(c)%pwtgcell (:,:) = 0._r8 + cam_in(c)%lai (:,:) = 0._r8 + endif if ( index_x2a_Fall_flxfire>0 .and. shr_fire_emis_mechcomps_n>0 ) then cam_in(c)%fireflx(:,:) = 0._r8 cam_in(c)%fireztop(:) = 0._r8 @@ -411,6 +428,18 @@ subroutine hub2atm_deallocate(cam_in) deallocate(cam_in(c)%depvel) nullify(cam_in(c)%depvel) end if + if(associated(cam_in(c)%lwtgcell)) then + deallocate(cam_in(c)%lwtgcell) + nullify(cam_in(c)%lwtgcell) + end if + if(associated(cam_in(c)%pwtgcell)) then + deallocate(cam_in(c)%pwtgcell) + nullify(cam_in(c)%pwtgcell) + end if + if(associated(cam_in(c)%lai)) then + deallocate(cam_in(c)%lai) + nullify(cam_in(c)%lai) + end if enddo diff --git a/src/cpl/atm_import_export.F90 b/src/cpl/atm_import_export.F90 index 8ff1839da6..31e8d803e5 100644 --- a/src/cpl/atm_import_export.F90 +++ b/src/cpl/atm_import_export.F90 @@ -13,7 +13,7 @@ subroutine atm_import( x2a, cam_in, restart_init ) use phys_grid , only: get_ncols_p use ppgrid , only: begchunk, endchunk use shr_const_mod, only: shr_const_stebol - use seq_drydep_mod, only: n_drydep + use seq_drydep_mod, only: n_drydep, NLUse, NPatch use shr_fire_emis_mod, only: shr_fire_emis_mechcomps_n use co2_cycle , only: c_i, co2_readFlux_ocn, co2_readFlux_fuel use co2_cycle , only: co2_transport, co2_time_interp_ocn, co2_time_interp_fuel @@ -101,6 +101,24 @@ subroutine atm_import( x2a, cam_in, restart_init ) cam_in(c)%depvel(i,:n_drydep) = & x2a(index_x2a_Sl_ddvel:index_x2a_Sl_ddvel+n_drydep-1, ig) endif + + ! for landunit weights + if (index_x2a_Sl_lwtgcell /= 0 ) then + cam_in(c)%lwtgcell(i,:NLUse) = & + x2a(index_x2a_Sl_lwtgcell:index_x2a_Sl_lwtgcell+NLUse-1, ig) + end if + + ! for patch weights + if (index_x2a_Sl_pwtgcell /= 0 ) then + cam_in(c)%pwtgcell(i,:NPatch) = & + x2a(index_x2a_Sl_pwtgcell:index_x2a_Sl_pwtgcell+NPatch-1, ig) + end if + + ! for leaf area indices + if (index_x2a_Sl_lai /= 0 ) then + cam_in(c)%lai(i,:NPatch) = & + x2a(index_x2a_Sl_lai:index_x2a_Sl_lai+NPatch-1, ig) + end if ! ! fields needed to calculate water isotopes to ocean evaporation processes ! diff --git a/src/cpl/cam_cpl_indices.F90 b/src/cpl/cam_cpl_indices.F90 index ec6d7a1546..acc02abe8f 100644 --- a/src/cpl/cam_cpl_indices.F90 +++ b/src/cpl/cam_cpl_indices.F90 @@ -3,6 +3,8 @@ module cam_cpl_indices use seq_flds_mod use mct_mod use seq_drydep_mod, only: drydep_fields_token, lnd_drydep + use seq_drydep_mod, only: luse_fields_token, patch_fields_token + use seq_drydep_mod, only: lai_fields_token use shr_megan_mod, only: shr_megan_fields_token, shr_megan_mechcomps_n use shr_fire_emis_mod, only: shr_fire_emis_fields_token, shr_fire_emis_ztop_token, shr_fire_emis_mechcomps_n @@ -86,6 +88,9 @@ module cam_cpl_indices integer :: index_x2a_So_re ! square of atm/ocn exch. coeff integer :: index_x2a_So_ssq ! surface saturation specific humidity in ocean integer :: index_x2a_Sl_ddvel ! dry deposition velocities from land + integer :: index_x2a_Sl_lwtgcell ! landunit area weights + integer :: index_x2a_Sl_pwtgcell ! patch area weights + integer :: index_x2a_Sl_lai ! leaf area indices integer :: index_x2a_Sx_u10 ! 10m wind contains @@ -157,9 +162,15 @@ subroutine cam_cpl_indices_set( ) endif if ( lnd_drydep )then - index_x2a_Sl_ddvel = mct_avect_indexra(x2a, trim(drydep_fields_token)) + index_x2a_Sl_ddvel = mct_avect_indexra(x2a, trim(drydep_fields_token)) + index_x2a_Sl_lwtgcell = mct_avect_indexra(x2a, trim(luse_fields_token)) + index_x2a_Sl_pwtgcell = mct_avect_indexra(x2a, trim(patch_fields_token)) + index_x2a_Sl_lai = mct_avect_indexra(x2a, trim(lai_fields_token)) else - index_x2a_Sl_ddvel = 0 + index_x2a_Sl_ddvel = 0 + index_x2a_Sl_lwtgcell = 0 + index_x2a_Sl_pwtgcell = 0 + index_x2a_Sl_lai = 0 end if index_a2x_Sa_z = mct_avect_indexra(a2x,'Sa_z') From 94b742390f57fff227e93faba2085433a0d4937e Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 15 May 2020 21:20:43 -0400 Subject: [PATCH 003/160] Squashed 5 commits from Haipeng Lin Feat: Implement HEMCO_CESM within CESM-GC (Initial attempt in syncing CAM sources) Feat: HEMCO_CESM code integration (full). Add mo_sim_dat and mo_tracname Fix: Call set_sim_dat from chemistry.F90 to pass solsym to HEMCO_CESM. Fix: Do not assign other variables within mo_sim_dat -- to discuss Fix: Comment out mo_sim_dat except solsym, expand solsym size to nTracersMax *This might not be needed after all as HEMCO_CESM now reads tracer names from chem_mods. But fixing this so it doesn't infinite loop. --- .gitignore | 1 + Externals_CAM.cfg | 8 + bld/config_files/definition.xml | 4 + bld/configure | 45 +- bld/namelist_files/namelist_definition.xml | 17 + src/chemistry/pp_geoschem/.exclude | 15 +- src/chemistry/pp_geoschem/chemistry.F90 | 9 + src/chemistry/pp_geoschem/mo_sim_dat.F90 | 1400 ++++++++++---------- src/chemistry/pp_geoschem/mo_tracname.F90 | 17 + src/control/cam_comp.F90 | 42 + src/control/runtime_opts.F90 | 7 + src/physics/cam/phys_control.F90 | 8 +- 12 files changed, 856 insertions(+), 717 deletions(-) create mode 100644 src/chemistry/pp_geoschem/mo_tracname.F90 diff --git a/.gitignore b/.gitignore index 5cc0bde57c..fcb95837b8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ src/physics/clubb src/physics/cosp2/src src/physics/silhs src/chemistry/pp_geoschem/geoschem_src +src/hemco # Ignore compiled python buildnmlc diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index e50b7ea88e..a6b4048f33 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -33,6 +33,14 @@ tag = CESM repo_url = https://github.com/fritzt/CESM2-GC_Src required = True +[hemco] +local_path = src/hemco +protocol = git +branch = development +repo_url = https://github.com/jimmielin/HEMCO_CESM.git +required = True +externals = Externals_HCO.cfg + [externals_description] schema_version = 1.0.0 diff --git a/bld/config_files/definition.xml b/bld/config_files/definition.xml index dd0d01e5ee..e6a6055002 100644 --- a/bld/config_files/definition.xml +++ b/bld/config_files/definition.xml @@ -52,6 +52,10 @@ Option to turn on waccmx thermosphere/ionosphere extension: 0 => no, 1 => yes Ionosphere model used in WACCMX. + +Switch to turn on Harmonized Emissions Component (HEMCO): 0 => no, 1 => yes. +WARNING THIS IS ON BY DEFAULT FOR DEVELOPMENT - DO NOT SUBMIT THIS TO PRODUCTION CODE + Physics package: cam3, cam4, cam5, cam6, held_suarez, adiabatic, kessler, tj2016, spcam_sam1mom, spcam_m2005. diff --git a/bld/configure b/bld/configure index 25bd9e1dbf..4540f09a90 100755 --- a/bld/configure +++ b/bld/configure @@ -139,6 +139,7 @@ OPTIONS Makefile defaults. E.g. -cppdefs '-DVAR1 -DVAR2' -dyn Dynamical core option: [eul | fv | se]. Default: fv. -edit_chem_mech Invokes CAMCHEM_EDITOR to allow the user to edit the chemistry mechanism file + -hemco Switch enables the use of the Harmonized Emissions Component. -hgrid Specify horizontal grid. Use nlatxnlon for spectral grids; dlatxdlon for fv grids (dlat and dlon are the grid cell size in degrees for latitude and longitude respectively); nexnp for @@ -324,6 +325,7 @@ GetOptions( "fopt=s" => \$opts{'fopt'}, "gmake=s" => \$opts{'gmake'}, "h|help" => \$opts{'help'}, + "hemco" => \$opts{'hemco'}, "hgrid=s" => \$opts{'hgrid'}, "ionosphere=s" => \$opts{'ionosphere'}, "lapack_libdir=s" => \$opts{'lapack_libdir'}, @@ -1608,6 +1610,14 @@ else { $nadv = $cfg_ref->get('nadv'); if ($print>=2) { print "Total advected constituents: $nadv$eol"; } +#----------------------------------------------------------------------------------------------- + +# Harmonized Emissions Component (HEMCO) +if (defined $opts{'hemco'}) { + $cfg_ref->set('hemco', $opts{'hemco'}); +} +my $hemco = $cfg_ref->get('hemco'); + #----------------------------------------------------------------------------------------------- # Makefile configuration ####################################################################### #----------------------------------------------------------------------------------------------- @@ -1994,6 +2004,13 @@ $cfg_cppdefs .= ' -DHAVE_VPRINTF -DHAVE_TIMES -DHAVE_GETTIMEOFDAY -DHAVE_COMM_F2 unless ($target_os eq 'aix' or $target_os =~ 'bg' or $target_os eq 'darwin') { $cfg_cppdefs .= ' -DHAVE_NANOTIME -DBIT64 -DHAVE_SLASHPROC'; } + +# Harmonized Emissions Component (HEMCO) +if ($hemco) { + $cfg_cppdefs .= ' -DMODEL_ -DMODEL_CESM -DHEMCO_CESM -DUSE_REAL8 '; + print "Compiling highly-experimental HEMCO with CESM.$eol"; +} + #----------------------------------------------------------------------------------------------- # External libraries ########################################################################### #----------------------------------------------------------------------------------------------- @@ -2753,6 +2770,7 @@ sub write_filepath my $waccm_phys = $cfg_ref->get('waccm_phys'); my $waccmx = $cfg_ref->get('waccmx'); my $ionos = $cfg_ref->get('ionosphere'); + my $hemco = $cfg_ref->get('hemco'); my $carma = $cfg_ref->get('carma'); my $rad = $cfg_ref->get('rad'); my $dyn = $cfg_ref->get('dyn'); @@ -2812,9 +2830,6 @@ sub write_filepath print $fh "$chem_src_dir/geoschem_src/GeosCore\n"; print $fh "$chem_src_dir/geoschem_src/GeosUtil\n"; print $fh "$chem_src_dir/geoschem_src/Headers\n"; - print $fh "$chem_src_dir/geoschem_src/HEMCO/Core\n"; - print $fh "$chem_src_dir/geoschem_src/HEMCO/Extensions\n"; - print $fh "$chem_src_dir/geoschem_src/HEMCO/Interfaces\n"; print $fh "$chem_src_dir/geoschem_src/ISORROPIA\n"; print $fh "$chem_src_dir/geoschem_src/KPP/Standard\n"; } # print $fh "$camsrcdir/cam/src/chemistry/pp_geoschem\n"; } @@ -2831,6 +2846,30 @@ sub write_filepath } print $fh "$camsrcdir/src/ionosphere\n"; + # -- Added by hplin - 5/2020 + if ($hemco) { + print $fh "$camsrcdir/src/hemco\n"; + + # if not compiling with GEOS-Chem; coordinate this with tfritz later + # we may eventually remove all this + print $fh "$camsrcdir/src/hemco/HEMCO/src/Shared\n"; + + # right now shared files have been renamed for no-conflict + # if ($chem_pkg ne 'geoschem') { + print $fh "$camsrcdir/src/hemco/HEMCO/src/Shared/Headers\n"; + print $fh "$camsrcdir/src/hemco/HEMCO/src/Shared/GeosUtil\n"; + # } + + # to remove - need to use pio + print $fh "$camsrcdir/src/hemco/HEMCO/src/Shared/NcdfUtil\n"; + + # hplin 2/16/20: temporarily add hemco src code directories manually + # until we figure out a better compile routine. + print $fh "$camsrcdir/src/hemco/HEMCO/src/Core\n"; + print $fh "$camsrcdir/src/hemco/HEMCO/src/Extensions\n"; + print $fh "$camsrcdir/src/hemco/HEMCO/src/Interfaces\n"; + } + # -- Added by MSL - 1/2018 # -- Updated by TMMF - 11/2019 if ($chem_pkg ne 'geoschem') { diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 3bd44f4200..3424886ca4 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3913,6 +3913,15 @@ cache file to be consistent with how CAM was built. Default: set by build-namelist + +Full pathname to CAM physics grid ESMF mesh file. +N.B. this variable may not be set by the user. +It is set by build-namelist via information in the configure +cache file to be consistent with how CAM was built. +Default: set by build-namelist + + Runtime options of upper thermosphere WACCM-X. 'ionosphere' for @@ -4000,6 +4009,14 @@ Full pathname of AMIE inputs for southern hemisphere. Default: NONE. + + +Full pathname of dataset for coefficient data used in Weimer05 +high latitude electric potential model. +Default: set by build-namelist. + + Date: Tue, 19 May 2020 11:26:36 -0400 Subject: [PATCH 004/160] Squashed 2 commits from Thibaud Fritz Feat: Add Olson / CLM land type mapping for CLM4.5/5.0 Feat: Add FAST_JX_DIR in Input_Opt. Remove hard-wired paths in fast_jx --- src/chemistry/pp_geoschem/chemistry.F90 | 4 + src/chemistry/pp_geoschem/getLandTypes.F90 | 416 ++++++++++++++++++--- 2 files changed, 378 insertions(+), 42 deletions(-) diff --git a/src/chemistry/pp_geoschem/chemistry.F90 b/src/chemistry/pp_geoschem/chemistry.F90 index f99181f1cd..caea37321e 100644 --- a/src/chemistry/pp_geoschem/chemistry.F90 +++ b/src/chemistry/pp_geoschem/chemistry.F90 @@ -931,6 +931,10 @@ subroutine chem_init(phys_state, pbuf2d) Input_Opt%TPCore_JOrd = 3 Input_Opt%TPCore_KOrd = 3 + ! Now READ_PHOTOLYSIS_MENU + Input_Opt%FAST_JX_DIR ='/glade/p/univ/umit0034/ExtData/' // & + 'CHEM_INPUTS/FAST_JX/v2019-06/' + ! Now READ_CONVECTION_MENU ! For now, TMMF Input_Opt%LConv = .False. diff --git a/src/chemistry/pp_geoschem/getLandTypes.F90 b/src/chemistry/pp_geoschem/getLandTypes.F90 index 9852d706f5..2a7ef31932 100644 --- a/src/chemistry/pp_geoschem/getLandTypes.F90 +++ b/src/chemistry/pp_geoschem/getLandTypes.F90 @@ -20,6 +20,7 @@ SUBROUTINE getLandTypes( cam_in, nY, State_Met ) USE PRECISION_MOD, ONLY : fp, f4 ! Flexible precision USE CMN_SIZE_Mod, ONLY : NSURFTYPE USE cam_abortutils, ONLY : endrun + IMPLICIT NONE ! ! !INPUT PARAMETERS: @@ -55,17 +56,17 @@ SUBROUTINE getLandTypes( cam_in, nY, State_Met ) ! Coniferous Forest (ID = 4) | ! Deciduous Conifer Forest (ID = 5) | Needleleaf Deciduous Bor. (PAID = 3) ! Deciduous Broadleaf For. (ID = 6) | - ! Evergreen Broadleaf For. (ID = 7) | + ! Evergreen Broadleaf For. (ID = 7) | Broadleaf Evergreen Temp. (PAID = 5) ! Tall Grasses and Shrubs (ID = 8) | ! Bare Desert (ID = 9) | Not veg. \ Ice (PAID = 0\LUID = 2) ! Upland Tundra (ID = 10) | Broadleaf Deciduous Bore. (PAID = 11) - ! Irrigated Grassland (ID = 11) | C3 Irrigated (PAID = 16) + ! Irrigated Grassland (ID = 11) | ! Semi Desert (ID = 12) | ! Glacier ice (ID = 13) | Land ice (LUID = 2) ! Wooded Wet Swamp (ID = 14) | ! - (ID = 15) | ! - (ID = 16) | - ! Shrub Evergreen (ID = 17) | + ! Shrub Evergreen (ID = 17) | Broadleaf Evergreen Shru. (PAID = 9) ! - (ID = 18) | ! Shrub Deciduous (ID = 19) | ! Evergreen Forest and Fi. (ID = 20) | @@ -81,6 +82,7 @@ SUBROUTINE getLandTypes( cam_in, nY, State_Met ) ! Seasonal Tropical Fores. (ID = 30) | ! Cool Crops and Towns (ID = 31) | Winter Temp. Cereal (PAID = 19) ! Crops and Town (ID = 32) | C3 Crop (PAID = 15) + ! | C3 Irrigated (PAID = 16) ! | Spring Temp. Cereal (PAID = 18) ! Dry Tropical Woods (ID = 33) | ! Tropical Rainforest (ID = 34) | Broadleaf Evergreen Trop. (PAID = 4) @@ -98,15 +100,15 @@ SUBROUTINE getLandTypes( cam_in, nY, State_Met ) ! | C4 Grass (PAID = 14) ! Mire, Bog, Fen (ID = 45) | Wetland - Not Applied (LUID = 5) ! Marsh Wetland (ID = 46) | - ! Mediterranean Scrub (ID = 47) | Broadleaf Evergreen Shru. (PAID = 9) - ! Dry Woody Scrub (ID = 48) | + ! Mediterranean Scrub (ID = 47) | + ! Dry Woody Scrub (ID = 48) | Broadleaf Deciduous Temp. (PAID = 10) ! - (ID = 49) | ! - (ID = 50) | ! - (ID = 51) | - ! Semi Desert Shrubs (ID = 52) | Broadleaf Deciduous Temp. (PAID = 10) + ! Semi Desert Shrubs (ID = 52) | ! Semi Desert Sage (ID = 53) | ! Barren Tundra (ID = 54) | - ! Cool Southern Hemisphere (ID = 55) | Broadleaf Evergreen Temp. (PAID = 5) + ! Cool Southern Hemisphere (ID = 55) | ! Cool Fields and Woods (ID = 56) | ! Forest and Field (ID = 57) | ! Cool Forest and Field (ID = 58) | @@ -141,57 +143,387 @@ SUBROUTINE getLandTypes( cam_in, nY, State_Met ) ! Initialize fraction land for this grid cell State_Met%LandTypeFrac(1,J, 1) = waterFrac !State_Met%LandTypeFrac(1,J, 2) = cam_in%lwtgcell(J, 6) + State_Met%LandTypeFrac(1,J, 5) = cam_in%pwtgcell(J, 4) + State_Met%LandTypeFrac(1,J, 7) = cam_in%pwtgcell(J, 6) State_Met%LandTypeFrac(1,J, 9) = cam_in%pwtgcell(J, 1) & - cam_in%lwtgcell(J, 2) State_Met%LandTypeFrac(1,J,10) = cam_in%pwtgcell(J,12) State_Met%LandTypeFrac(1,J,13) = cam_in%lwtgcell(J, 2) + State_Met%LandTypeFrac(1,J,17) = cam_in%pwtgcell(J,10) + State_Met%LandTypeFrac(1,J,22) = cam_in%pwtgcell(J, 3) State_Met%LandTypeFrac(1,J,24) = cam_in%pwtgcell(J, 9) State_Met%LandTypeFrac(1,J,26) = cam_in%pwtgcell(J, 8) - !State_Met%LandTypeFrac(1,J,45) = cam_in%lwtgcell(J, 5) - State_Met%LandTypeFrac(1,J,52) = cam_in%pwtgcell(J,11) - State_Met%LandTypeFrac(1,J,47) = cam_in%pwtgcell(J,10) - State_Met%LandTypeFrac(1,J,55) = cam_in%pwtgcell(J, 6) - State_Met%LandTypeFrac(1,J,34) = cam_in%pwtgcell(J, 5) - State_Met%LandTypeFrac(1,J,43) = cam_in%pwtgcell(J,13) - State_Met%LandTypeFrac(1,J,42) = cam_in%pwtgcell(J,14) - State_Met%LandTypeFrac(1,J,32) = cam_in%pwtgcell(J,16) - State_Met%LandTypeFrac(1,J,44) = cam_in%pwtgcell(J,15) - State_Met%LandTypeFrac(1,J, 5) = cam_in%pwtgcell(J, 4) - State_Met%LandTypeFrac(1,J,22) = cam_in%pwtgcell(J, 3) State_Met%LandTypeFrac(1,J,28) = cam_in%pwtgcell(J, 2) - State_Met%LandTypeFrac(1,J,44) = & - State_Met%LandTypeFrac(1,J,44) + cam_in%pwtgcell(J, 7) - State_Met%LandTypeFrac(1,J,11) = cam_in%pwtgcell(J,17) - State_Met%LandTypeFrac(1,J,36) = cam_in%pwtgcell(J,18) State_Met%LandTypeFrac(1,J,31) = cam_in%pwtgcell(J,20) - State_Met%LandTypeFrac(1,J,32) = & - State_Met%LandTypeFrac(1,J,32) + cam_in%pwtgcell(J,19) - State_Met%LandTypeFrac(1,J,36) = & - State_Met%LandTypeFrac(1,J,36) + cam_in%pwtgcell(J,21) + State_Met%LandTypeFrac(1,J,32) = cam_in%pwtgcell(J,16) & + + cam_in%pwtgcell(J,17) & + + cam_in%pwtgcell(J,19) + State_Met%LandTypeFrac(1,J,34) = cam_in%pwtgcell(J, 5) + State_Met%LandTypeFrac(1,J,36) = cam_in%pwtgcell(J,18) & + + cam_in%pwtgcell(J,21) + State_Met%LandTypeFrac(1,J,42) = cam_in%pwtgcell(J,14) + State_Met%LandTypeFrac(1,J,43) = cam_in%pwtgcell(J,13) + State_Met%LandTypeFrac(1,J,44) = cam_in%pwtgcell(J, 7) & + + cam_in%pwtgcell(J,15) + !State_Met%LandTypeFrac(1,J,45) = cam_in%lwtgcell(J, 5) + State_Met%LandTypeFrac(1,J,48) = cam_in%pwtgcell(J,11) + State_Met%XLAI_NATIVE(1,J, 5) = cam_in%lai(J, 4) + State_Met%XLAI_NATIVE(1,J, 7) = cam_in%lai(J, 6) State_Met%XLAI_NATIVE(1,J,10) = cam_in%lai(J,12) + State_Met%XLAI_NATIVE(1,J,17) = cam_in%lai(J,10) + State_Met%XLAI_NATIVE(1,J,22) = cam_in%lai(J, 3) State_Met%XLAI_NATIVE(1,J,24) = cam_in%lai(J, 9) State_Met%XLAI_NATIVE(1,J,26) = cam_in%lai(J, 8) - State_Met%XLAI_NATIVE(1,J,52) = cam_in%lai(J,11) - State_Met%XLAI_NATIVE(1,J,47) = cam_in%lai(J,10) - State_Met%XLAI_NATIVE(1,J,55) = cam_in%lai(J, 6) + State_Met%XLAI_NATIVE(1,J,28) = cam_in%lai(J, 2) + State_Met%XLAI_NATIVE(1,J,31) = cam_in%lai(J,20) + State_Met%XLAI_NATIVE(1,J,32) = cam_in%lai(J,16) & + + cam_in%lai(J,17) & + + cam_in%lai(J,19) State_Met%XLAI_NATIVE(1,J,34) = cam_in%lai(J, 5) - State_Met%XLAI_NATIVE(1,J,43) = cam_in%lai(J,13) + State_Met%XLAI_NATIVE(1,J,36) = cam_in%lai(J,18) & + + cam_in%lai(J,21) State_Met%XLAI_NATIVE(1,J,42) = cam_in%lai(J,14) - State_Met%XLAI_NATIVE(1,J,32) = cam_in%lai(J,16) - State_Met%XLAI_NATIVE(1,J,44) = cam_in%lai(J,15) + State_Met%XLAI_NATIVE(1,J,43) = cam_in%lai(J,13) + State_Met%XLAI_NATIVE(1,J,44) = cam_in%lai(J, 7) & + + cam_in%lai(J,15) + State_Met%XLAI_NATIVE(1,J,48) = cam_in%lai(J,11) + + DO T = 2, NSURFTYPE + State_Met%LandTypeFrac(1,J,T) = & + State_Met%LandTypeFrac(1,J,T) * landFrac + + State_Met%XLAI_NATIVE(1,J,T) = & + State_Met%XLAI_NATIVE(1,J,T) * landFrac + + ! Make sure that the land type fractions do not exceed 1 + IF ( State_Met%LandTypeFrac(1,J,T) > 1.0e+0_fp ) THEN + State_Met%LandTypeFrac(1,J,T) = 1.0e+0_fp + ELSEIF ( State_Met%LandTypeFrac(1,J,T) < 0.0e+0_fp ) THEN + State_Met%LandTypeFrac(1,J,T) = 0.0e+0_fp + ENDIF + ENDDO + + ENDDO + +#elif defined( CLM45 ) || defined( CLM50 ) + + ! Mapping for CLM4.5/CLM5.0 + ! -----------------------------------|-------------------------------------- + ! Olson land type | CLM land type + ! -----------------------------------|-------------------------------------- + ! Inland/sea water (ID = 1) | Ocean fraction + ! | Deeplake (LUID = 5) + ! Urban (ID = 2) | Urban - Not Applied (LUID =7-9) + ! Low Sparse Grassland (ID = 3) | + ! Coniferous Forest (ID = 4) | + ! Deciduous Conifer Forest (ID = 5) | Needleleaf Deciduous Bor. (PAID = 3) + ! Deciduous Broadleaf For. (ID = 6) | + ! Evergreen Broadleaf For. (ID = 7) | Broadleaf Evergreen Temp. (PAID = 5) + ! Tall Grasses and Shrubs (ID = 8) | + ! Bare Desert (ID = 9) | Not veg. \ Ice (PAID = 0\LUID = 4) + ! Upland Tundra (ID = 10) | Broadleaf Deciduous Bore. (PAID = 11) + ! Irrigated Grassland (ID = 11) | + ! Semi Desert (ID = 12) | + ! Glacier ice (ID = 13) | Land ice (LUID = 4) + ! Wooded Wet Swamp (ID = 14) | + ! - (ID = 15) | + ! - (ID = 16) | + ! Shrub Evergreen (ID = 17) | Broadleaf Evergreen Shru. (PAID = 9) + ! - (ID = 18) | + ! Shrub Deciduous (ID = 19) | + ! Evergreen Forest and Fi. (ID = 20) | + ! Cool Rain Forest (ID = 21) | + ! Conifer Boreal Forest (ID = 22) | Needleleaf Evergreen Bor. (PAID = 2) + ! Cool Conifer Forest (ID = 23) | + ! Cool Mixed Forest (ID = 24) | Broadleaf Deciduous Bore. (PAID = 8) + ! Mixed Forest (ID = 25) | + ! Cool Broadleaf Forest (ID = 26) | Broadleaf Deciduous Temp. (PAID = 7) + ! Deciduous Broadleaf For. (ID = 27) | + ! Conifer Forest (ID = 28) | Needleleaf Evergreen Tem. (PAID = 1) + ! Montane Tropical Forests (ID = 29) | + ! Seasonal Tropical Fores. (ID = 30) | + ! Cool Crops and Towns (ID = 31) | + ! Crops and Town (ID = 32) | C3 Crop (PAID = 15) + ! | C3 Irrigated (PAID = 16) + ! Dry Tropical Woods (ID = 33) | + ! Tropical Rainforest (ID = 34) | Broadleaf Evergreen Trop. (PAID = 4) + ! Tropical Degraded Forest (ID = 35) | + ! Corn and Beans Cropland (ID = 36) | Corn (PAID = 17) + ! | Irrigated Temperate Corn (PAID = 18) + ! | Spring Wheat (PAID = 19) + ! | Irrigated Spring Wheat (PAID = 20) + ! | Winter Wheat (PAID = 21) + ! | Irrigated Winter Wheat (PAID = 22) + ! | Temperated Soybean (PAID = 23) + ! | Irrigated Temperate Soyb. (PAID = 24) + ! | Barley (PAID = 25) + ! | Irrigated Barley (PAID = 26) + ! | Winter Barley (PAID = 27) + ! | Irrigated Winter Barley (PAID = 28) + ! | Rye (PAID = 29) + ! | Irrigated Rye (PAID = 30) + ! | Winter Rye (PAID = 31) + ! | Irrigated Winter Rye (PAID = 32) + ! | Cassava (PAID = 33) + ! | Irrigated Cassava (PAID = 34) + ! | Citrus (PAID = 35) + ! | Irrigated Citrus (PAID = 36) + ! | Cocoa (PAID = 37) + ! | Irrigated Cocoa (PAID = 38) + ! | Coffee (PAID = 39) + ! | Irrigated Coffee (PAID = 40) + ! | Cotton (PAID = 41) + ! | Irrigated Cotton (PAID = 42) + ! | Datepalm (PAID = 43) + ! | Irrigated Datepalm (PAID = 44) + ! | Foddergrass (PAID = 45) + ! | Irrigated Foddergrass (PAID = 46) + ! | Grapes (PAID = 47) + ! | Irrigated Grapes (PAID = 48) + ! | Groundnuts (PAID = 49) + ! | Irrigated Groundnuts (PAID = 50) + ! | Millet (PAID = 51) + ! | Irrigated Millet (PAID = 52) + ! | Oilpalm (PAID = 53) + ! | Irrigated Oilpalm (PAID = 54) + ! | Potatoes (PAID = 55) + ! | Irrigated Potatoes (PAID = 56) + ! | Pulses (PAID = 57) + ! | Irrigated Pulses (PAID = 58) + ! | Rapeseed (PAID = 59) + ! | Irrigated Rapeseed (PAID = 60) + ! | Rice (PAID = 61) + ! | Irrigated Rice (PAID = 62) + ! | Sorghum (PAID = 63) + ! | Irrigated Sorghum (PAID = 64) + ! | Sugarbeet (PAID = 65) + ! | Irrigated Sugarbeet (PAID = 66) + ! | Sugarcane (PAID = 67) + ! | Irrigated Sugarcane (PAID = 68) + ! | Sunflower (PAID = 69) + ! | Irrigated Sunflower (PAID = 70) + ! | Miscanthus (PAID = 71) + ! | Irrigated Miscanthus (PAID = 72) + ! | Switchgrass (PAID = 73) + ! | Irrigated Switchgrass (PAID = 74) + ! | Tropical Corn (PAID = 75) + ! | Irrigated Tropical Corn (PAID = 76) + ! | Tropical Soybean (PAID = 77) + ! | Irrigated Tropical Soybe. (PAID = 78) + ! Rice Paddy and Field (ID = 37) | + ! Hot Irrigated Cropland (ID = 38) | + ! Cool Irrigated Cropland (ID = 39) | + ! - (ID = 40) | + ! Cool Grasses and Shrubs (ID = 41) | + ! Hot and Mild Grasses and (ID = 42) | C3 Non-Arctic Grass (PAID = 13) + ! Cold Grassland (ID = 43) | C3 Arctic Grass (PAID = 12) + ! Savanna (Woods) (ID = 44) | Broadleaf Deciduous Trop. (PAID = 6) + ! | C4 Grass (PAID = 14) + ! Mire, Bog, Fen (ID = 45) | Wetland - Not Applied (LUID = 6) + ! Marsh Wetland (ID = 46) | + ! Mediterranean Scrub (ID = 47) | + ! Dry Woody Scrub (ID = 48) | Broadleaf Deciduous Temp. (PAID = 10) + ! - (ID = 49) | + ! - (ID = 50) | + ! - (ID = 51) | + ! Semi Desert Shrubs (ID = 52) | + ! Semi Desert Sage (ID = 53) | + ! Barren Tundra (ID = 54) | + ! Cool Southern Hemisphere (ID = 55) | + ! Cool Fields and Woods (ID = 56) | + ! Forest and Field (ID = 57) | + ! Cool Forest and Field (ID = 58) | + ! Fields and Woody Savanna (ID = 59) | + ! Succulent and Thorn Scr. (ID = 60) | + ! Small Leaf Mixed Woods (ID = 61) | + ! Deciduous and Mixed Bor. (ID = 62) | + ! Narrow Conifers (ID = 63) | + ! Wooded Tundra (ID = 64) | + ! Heath Scrub (ID = 65) | + ! - (ID = 66) | + ! - (ID = 67) | + ! - (ID = 68) | + ! - (ID = 69) | + ! Polar and Alpine Desert (ID = 70) | + ! - (ID = 71) | + ! - (ID = 72) | + ! Mangrove (ID = 73) | + + State_Met%LandTypeFrac(:,:,:) = 0.0e+0_fp + State_Met%XLAI_NATIVE(:,:,:) = 0.0e+0_fp + + DO J = 1, nY + waterFrac = cam_in%ocnFrac(J) + cam_in%iceFrac(J) & + + cam_in%lwtgcell(J,5) + landFrac = 1.0e+0_fp - waterFrac + + ! Initialize fraction land for this grid cell + State_Met%LandTypeFrac(1,J, 1) = waterFrac + !State_Met%LandTypeFrac(1,J, 2) = cam_in%lwtgcell(J, 7) & + ! + cam_in%lwtgcell(J, 8) & + ! + cam_in%lwtgcell(J, 9) + State_Met%LandTypeFrac(1,J, 5) = cam_in%pwtgcell(J, 4) + State_Met%LandTypeFrac(1,J, 7) = cam_in%pwtgcell(J, 6) + State_Met%LandTypeFrac(1,J, 9) = cam_in%pwtgcell(J, 1) & + * ( 1.0e+0_fp - cam_in%lwtgcell(J, 4) ) + State_Met%LandTypeFrac(1,J,10) = cam_in%pwtgcell(J,12) + State_Met%LandTypeFrac(1,J,13) = cam_in%lwtgcell(J, 4) + State_Met%LandTypeFrac(1,J,17) = cam_in%pwtgcell(J,10) + State_Met%LandTypeFrac(1,J,22) = cam_in%pwtgcell(J, 3) + State_Met%LandTypeFrac(1,J,24) = cam_in%pwtgcell(J, 9) + State_Met%LandTypeFrac(1,J,26) = cam_in%pwtgcell(J, 8) + State_Met%LandTypeFrac(1,J,28) = cam_in%pwtgcell(J, 2) + State_Met%LandTypeFrac(1,J,32) = cam_in%pwtgcell(J,16) & + + cam_in%pwtgcell(J,17) + State_Met%LandTypeFrac(1,J,34) = cam_in%pwtgcell(J, 5) + State_Met%LandTypeFrac(1,J,36) = cam_in%pwtgcell(J,18) & + + cam_in%pwtgcell(J,19) & + + cam_in%pwtgcell(J,20) & + + cam_in%pwtgcell(J,21) & + + cam_in%pwtgcell(J,22) & + + cam_in%pwtgcell(J,23) & + + cam_in%pwtgcell(J,24) & + + cam_in%pwtgcell(J,25) & + + cam_in%pwtgcell(J,26) & + + cam_in%pwtgcell(J,27) & + + cam_in%pwtgcell(J,28) & + + cam_in%pwtgcell(J,29) & + + cam_in%pwtgcell(J,30) & + + cam_in%pwtgcell(J,31) & + + cam_in%pwtgcell(J,32) & + + cam_in%pwtgcell(J,33) & + + cam_in%pwtgcell(J,34) & + + cam_in%pwtgcell(J,35) & + + cam_in%pwtgcell(J,36) & + + cam_in%pwtgcell(J,37) & + + cam_in%pwtgcell(J,38) & + + cam_in%pwtgcell(J,39) & + + cam_in%pwtgcell(J,40) & + + cam_in%pwtgcell(J,41) & + + cam_in%pwtgcell(J,42) & + + cam_in%pwtgcell(J,43) & + + cam_in%pwtgcell(J,44) & + + cam_in%pwtgcell(J,45) & + + cam_in%pwtgcell(J,46) & + + cam_in%pwtgcell(J,47) & + + cam_in%pwtgcell(J,48) & + + cam_in%pwtgcell(J,49) & + + cam_in%pwtgcell(J,50) & + + cam_in%pwtgcell(J,51) & + + cam_in%pwtgcell(J,52) & + + cam_in%pwtgcell(J,53) & + + cam_in%pwtgcell(J,54) & + + cam_in%pwtgcell(J,55) & + + cam_in%pwtgcell(J,56) & + + cam_in%pwtgcell(J,57) & + + cam_in%pwtgcell(J,58) & + + cam_in%pwtgcell(J,59) & + + cam_in%pwtgcell(J,60) & + + cam_in%pwtgcell(J,61) & + + cam_in%pwtgcell(J,62) & + + cam_in%pwtgcell(J,63) & + + cam_in%pwtgcell(J,64) & + + cam_in%pwtgcell(J,65) & + + cam_in%pwtgcell(J,66) & + + cam_in%pwtgcell(J,67) & + + cam_in%pwtgcell(J,68) & + + cam_in%pwtgcell(J,69) & + + cam_in%pwtgcell(J,70) & + + cam_in%pwtgcell(J,71) & + + cam_in%pwtgcell(J,72) & + + cam_in%pwtgcell(J,73) & + + cam_in%pwtgcell(J,74) & + + cam_in%pwtgcell(J,75) & + + cam_in%pwtgcell(J,76) & + + cam_in%pwtgcell(J,77) & + + cam_in%pwtgcell(J,78) & + + cam_in%pwtgcell(J,79) + State_Met%LandTypeFrac(1,J,42) = cam_in%pwtgcell(J,14) + State_Met%LandTypeFrac(1,J,43) = cam_in%pwtgcell(J,13) + State_Met%LandTypeFrac(1,J,44) = cam_in%pwtgcell(J, 7) & + + cam_in%pwtgcell(J,15) + !State_Met%LandTypeFrac(1,J,45) = cam_in%lwtgcell(J, 6) + State_Met%LandTypeFrac(1,J,48) = cam_in%pwtgcell(J,11) + State_Met%XLAI_NATIVE(1,J, 5) = cam_in%lai(J, 4) + State_Met%XLAI_NATIVE(1,J, 7) = cam_in%lai(J, 6) + State_Met%XLAI_NATIVE(1,J,10) = cam_in%lai(J,12) + State_Met%XLAI_NATIVE(1,J,17) = cam_in%lai(J,10) State_Met%XLAI_NATIVE(1,J,22) = cam_in%lai(J, 3) + State_Met%XLAI_NATIVE(1,J,24) = cam_in%lai(J, 9) + State_Met%XLAI_NATIVE(1,J,26) = cam_in%lai(J, 8) State_Met%XLAI_NATIVE(1,J,28) = cam_in%lai(J, 2) - State_Met%XLAI_NATIVE(1,J,44) = & - State_Met%XLAI_NATIVE(1,J,44) + cam_in%lai(J, 7) - State_Met%XLAI_NATIVE(1,J,11) = cam_in%lai(J,17) - State_Met%XLAI_NATIVE(1,J,36) = cam_in%lai(J,18) - State_Met%XLAI_NATIVE(1,J,31) = cam_in%lai(J,20) - State_Met%XLAI_NATIVE(1,J,32) = & - State_Met%XLAI_NATIVE(1,J,32) + cam_in%lai(J,19) - State_Met%XLAI_NATIVE(1,J,36) = & - State_Met%XLAI_NATIVE(1,J,36) + cam_in%lai(J,21) + State_Met%XLAI_NATIVE(1,J,32) = cam_in%lai(J,16) & + + cam_in%lai(J,17) + State_Met%XLAI_NATIVE(1,J,34) = cam_in%lai(J, 5) + State_Met%XLAI_NATIVE(1,J,36) = cam_in%lai(J,18) & + + cam_in%lai(J,19) & + + cam_in%lai(J,20) & + + cam_in%lai(J,21) & + + cam_in%lai(J,22) & + + cam_in%lai(J,23) & + + cam_in%lai(J,24) & + + cam_in%lai(J,25) & + + cam_in%lai(J,26) & + + cam_in%lai(J,27) & + + cam_in%lai(J,28) & + + cam_in%lai(J,29) & + + cam_in%lai(J,30) & + + cam_in%lai(J,31) & + + cam_in%lai(J,32) & + + cam_in%lai(J,33) & + + cam_in%lai(J,34) & + + cam_in%lai(J,35) & + + cam_in%lai(J,36) & + + cam_in%lai(J,37) & + + cam_in%lai(J,38) & + + cam_in%lai(J,39) & + + cam_in%lai(J,40) & + + cam_in%lai(J,41) & + + cam_in%lai(J,42) & + + cam_in%lai(J,43) & + + cam_in%lai(J,44) & + + cam_in%lai(J,45) & + + cam_in%lai(J,46) & + + cam_in%lai(J,47) & + + cam_in%lai(J,48) & + + cam_in%lai(J,49) & + + cam_in%lai(J,50) & + + cam_in%lai(J,51) & + + cam_in%lai(J,52) & + + cam_in%lai(J,53) & + + cam_in%lai(J,54) & + + cam_in%lai(J,55) & + + cam_in%lai(J,56) & + + cam_in%lai(J,57) & + + cam_in%lai(J,58) & + + cam_in%lai(J,59) & + + cam_in%lai(J,60) & + + cam_in%lai(J,61) & + + cam_in%lai(J,62) & + + cam_in%lai(J,63) & + + cam_in%lai(J,64) & + + cam_in%lai(J,65) & + + cam_in%lai(J,66) & + + cam_in%lai(J,67) & + + cam_in%lai(J,68) & + + cam_in%lai(J,69) & + + cam_in%lai(J,70) & + + cam_in%lai(J,71) & + + cam_in%lai(J,72) & + + cam_in%lai(J,73) & + + cam_in%lai(J,74) & + + cam_in%lai(J,75) & + + cam_in%lai(J,76) & + + cam_in%lai(J,77) & + + cam_in%lai(J,78) & + + cam_in%lai(J,79) + State_Met%XLAI_NATIVE(1,J,42) = cam_in%lai(J,14) + State_Met%XLAI_NATIVE(1,J,43) = cam_in%lai(J,13) + State_Met%XLAI_NATIVE(1,J,44) = cam_in%lai(J, 7) & + + cam_in%lai(J,15) + State_Met%XLAI_NATIVE(1,J,48) = cam_in%lai(J,11) DO T = 2, NSURFTYPE State_Met%LandTypeFrac(1,J,T) = & @@ -209,7 +541,7 @@ SUBROUTINE getLandTypes( cam_in, nY, State_Met ) ENDDO ENDDO -#elif defined( CLM45 ) || defined( CLM50 ) + #else CALL endrun('Cannot figure out which version of CLM') #endif From 63df68000515bcd439b621f10d08ab0ab35961fd Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 21 Jul 2020 10:19:46 -0600 Subject: [PATCH 005/160] Squashed 4 commits from Lizzie Lundgren Change GEOS-Chem source to CESM-GC GitHub organization and branch name Use GEOS-Chem branch feature/13.0.0+CESM Update HEMCO interfaces directory name in configure Partial updates to enable GEOS-Chem dev/13.0.0 to build in CESM Signed-off-by: Lizzie Lundgren --- Externals_CAM.cfg | 4 +- bld/configure | 2 +- src/chemistry/pp_geoschem/.exclude | 46 +- src/chemistry/pp_geoschem/chemistry.F90 | 1024 +++++++++++------------ 4 files changed, 491 insertions(+), 585 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index a6b4048f33..906d81c24c 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -29,8 +29,8 @@ required = True [geoschem] local_path = src/chemistry/pp_geoschem/geoschem_src protocol = git -tag = CESM -repo_url = https://github.com/fritzt/CESM2-GC_Src +branch = feature/13.0.0+CESM +repo_url = https://github.com/CESM-GC/geos-chem required = True [hemco] diff --git a/bld/configure b/bld/configure index 4540f09a90..459fda9916 100755 --- a/bld/configure +++ b/bld/configure @@ -2867,7 +2867,7 @@ sub write_filepath # until we figure out a better compile routine. print $fh "$camsrcdir/src/hemco/HEMCO/src/Core\n"; print $fh "$camsrcdir/src/hemco/HEMCO/src/Extensions\n"; - print $fh "$camsrcdir/src/hemco/HEMCO/src/Interfaces\n"; + print $fh "$camsrcdir/src/hemco/HEMCO/src/Interfaces/Shared\n"; } # -- Added by MSL - 1/2018 diff --git a/src/chemistry/pp_geoschem/.exclude b/src/chemistry/pp_geoschem/.exclude index 674cabfdd2..313c41158c 100644 --- a/src/chemistry/pp_geoschem/.exclude +++ b/src/chemistry/pp_geoschem/.exclude @@ -1,39 +1,23 @@ regrid_a2a_mod.F90 -transport_mod.F +transport_mod.F90 tpcore_window_mod.F90 -tpcore_bc_mod.F90 tpcore_fvdas_mod.F90 flexgrid_read_mod.F90 -geosfp_read_mod.F90 get_met_mod.F90 -merra2_read_mod.F90 -regrid_a2a_mod.F90 -restart_mod.F -pops_mod.F -diag49_mod.F -diag51_mod.F -diag03_mod.F -diag04_mod.F -diag1.F -diag20_mod.F -diag_2pm.F -diag3.F -diag41_mod.F -diag42_mod.F -diag48_mod.F -diag50_mod.F -diag51b_mod.F -diag53_mod.F -diag56_mod.F -diag63_mod.F +pops_mod.F90 +planeflight_mod.F90 +diag51_mod.F90 +diag1.F90 +diag03_mod.F90 +diag3.F90 +diag51b_mod.F90 +diag53_mod.F90 emissions_mod.F90 -diag3.F -hcoi_gc_main_mod.F90 -gamap_mod.F -initialize.F -input_mod.F -cleanup.F -main.F +gamap_mod.F90 +initialize.F90 +input_mod.F90 +cleanup.F90 +main.F90 hcoi_gc_diagn_include.H hcoi_gc_diagn_mod.F90 -hcoi_gc_main_mod.F90 \ No newline at end of file +hco_interface_gc_mod.F90 \ No newline at end of file diff --git a/src/chemistry/pp_geoschem/chemistry.F90 b/src/chemistry/pp_geoschem/chemistry.F90 index caea37321e..2914f1ae38 100644 --- a/src/chemistry/pp_geoschem/chemistry.F90 +++ b/src/chemistry/pp_geoschem/chemistry.F90 @@ -212,591 +212,588 @@ subroutine chem_register IO%RootCPU = .False. - CALL Set_Input_Opt( am_I_Root = .False., & - Input_Opt = IO, & + CALL Set_Input_Opt( Am_I_Root = MasterProc, & + INPUT_OPT = IO, & RC = RC ) - if(masterproc) write(iulog,*) 'GCCALL after Set_Input_Opt' + IF(MASTERPROC) WRITE(IULOG,*) 'GCCALL AFTER SET_INPUT_OPT' IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Could not generate reference input options object!' - CALL Error_Stop( ErrMsg, ThisLoc ) + ERRMSG = 'COULD NOT GENERATE REFERENCE INPUT OPTIONS OBJECT!' + CALL ERROR_STOP( ERRMSG, THISLOC ) ENDIF - ! Options needed by Init_State_Chm - IO%ITS_A_FULLCHEM_SIM = .True. - IO%LLinoz = .True. - IO%LUCX = .True. - IO%LPRT = .False. - IO%N_Advect = nTracers - DO I = 1, nTracers - IO%AdvectSpc_Name(I) = TRIM(tracerNames(I)) + ! OPTIONS NEEDED BY INIT_STATE_CHM + IO%ITS_A_FULLCHEM_SIM = .TRUE. + IO%LLINOZ = .TRUE. + IO%LUCX = .TRUE. + IO%LPRT = .FALSE. + IO%N_ADVECT = NTRACERS + DO I = 1, NTRACERS + IO%ADVECTSPC_NAME(I) = TRIM(TRACERNAMES(I)) ENDDO - IO%SalA_rEdge_um(1) = 0.01e+0_fp - IO%SalA_rEdge_um(2) = 0.50e+0_fp - IO%SalC_rEdge_um(1) = 0.50e+0_fp - IO%SalC_rEdge_um(2) = 8.00e+0_fp + IO%SALA_REDGE_UM(1) = 0.01E+0_FP + IO%SALA_REDGE_UM(2) = 0.50E+0_FP + IO%SALC_REDGE_UM(1) = 0.50E+0_FP + IO%SALC_REDGE_UM(2) = 8.00E+0_FP - ! Prevent reporting - IO%rootCPU = .False. - IO%myCPU = myCPU + ! PREVENT REPORTING + IO%ROOTCPU = .FALSE. + IO%MYCPU = MYCPU - CALL Init_State_Grid( am_I_Root = .False., & - State_Grid = SG , & + CALL INIT_STATE_GRID( STATE_GRID = SG , & RC = RC ) IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered within call to "Init_State_Grid"!' - CALL Error_Stop( ErrMsg, ThisLoc ) + ERRMSG = 'ERROR ENCOUNTERED WITHIN CALL TO "INIT_STATE_GRID"!' + CALL ERROR_STOP( ERRMSG, THISLOC ) ENDIF SG%NX = 1 SG%NY = 1 SG%NZ = 1 - CALL Init_State_Chm( am_I_Root = .False., & - Input_Opt = IO, & - State_Chm = SC, & - State_Grid = SG, & + CALL INIT_STATE_CHM( INPUT_OPT = IO, & + STATE_CHM = SC, & + STATE_GRID = SG, & RC = RC ) IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered within call to "Init_State_Chm"!' - CALL Error_Stop( ErrMsg, ThisLoc ) + ERRMSG = 'ERROR ENCOUNTERED WITHIN CALL TO "INIT_STATE_CHM"!' + CALL ERROR_STOP( ERRMSG, THISLOC ) ENDIF - ! At the moment, we force nadv_chem=200 in the setup file - ! Default - map2GC = -1 - ref_MMR(:) = 0.0e+0_r8 - MWRatio(:) = 1.0e+0_r8 - tracerLongNames = '' - - DO I = 1, nTracersMax - IF (I.LE.nTracers) THEN - N = Ind_(tracerNames(I)) - ThisSpc => SC%SpcData(N)%Info - lng_Name = TRIM(ThisSpc%FullName) - MWTmp = REAL(ThisSpc%MW_g,r8) - ref_VMR = REAL(ThisSpc%BackgroundVV,r8) - adv_Mass(I) = MWTmp - ref_MMR(I) = ref_VMR / (MWDry / MWTmp) + ! AT THE MOMENT, WE FORCE NADV_CHEM=200 IN THE SETUP FILE + ! DEFAULT + MAP2GC = -1 + REF_MMR(:) = 0.0E+0_R8 + MWRATIO(:) = 1.0E+0_R8 + TRACERLONGNAMES = '' + + DO I = 1, NTRACERSMAX + IF (I.LE.NTRACERS) THEN + N = IND_(TRACERNAMES(I)) + THISSPC => SC%SPCDATA(N)%INFO + LNG_NAME = TRIM(THISSPC%FULLNAME) + MWTMP = REAL(THISSPC%MW_G,R8) + REF_VMR = REAL(THISSPC%BACKGROUNDVV,R8) + ADV_MASS(I) = MWTMP + REF_MMR(I) = REF_VMR / (MWDRY / MWTMP) ELSE - lng_Name = TRIM(tracerNames(I)) - MWTmp = 1000.0e+0_r8 * (0.001e+0_r8) - adv_Mass(I) = MWTmp - ref_MMR(I) = 1.0e-38_r8 + LNG_NAME = TRIM(TRACERNAMES(I)) + MWTMP = 1000.0E+0_R8 * (0.001E+0_R8) + ADV_MASS(I) = MWTMP + REF_MMR(I) = 1.0E-38_R8 ENDIF - MWRatio(I) = MWDry/MWTmp - tracerLongNames(I) = TRIM(lng_Name) - - ! dummy value for specific heat of constant pressure (Cp) - cptmp = 666._r8 - ! minimum mixing ratio - qmin = 1.e-38_r8 - ! mixing ratio type - mixtype = 'dry' - ! Used for ionospheric WACCM (WACCM-X) - molectype = 'minor' - ! Is an output field (?) - camout = .false. - ! Not true for O2(1-delta) or O2(1-sigma) - ic_from_cam2 = .true. - ! Use a fixed value at the upper boundary - has_fixed_ubc = .false. - ! Use a fixed flux condition at the upper boundary - has_fixed_ubflx = .false. - !write(tracernames(i),'(a,I0.4)') 'GCTRC_', i - ! NOTE: In MOZART, this only gets called for tracers - ! This is the call to add a "constituent" - CALL cnst_add( TRIM(tracerNames(I)), adv_Mass(I), cptmp, qmin, N, & - readiv=ic_from_cam2, mixtype=mixtype, cam_outfld=camout, & - molectype=molectype, fixed_ubc=has_fixed_ubc, & - fixed_ubflx=has_fixed_ubflx, longname=TRIM(lng_Name) ) - - ! Add to GC mapping. When starting a timestep, we will want to update the - ! concentration of State_Chm(x)%Species(1,iCol,iLev,m) with data from - ! constituent n - M = Ind_(TRIM(tracerNames(I))) + MWRATIO(I) = MWDRY/MWTMP + TRACERLONGNAMES(I) = TRIM(LNG_NAME) + + ! DUMMY VALUE FOR SPECIFIC HEAT OF CONSTANT PRESSURE (CP) + CPTMP = 666._R8 + ! MINIMUM MIXING RATIO + QMIN = 1.E-38_R8 + ! MIXING RATIO TYPE + MIXTYPE = 'DRY' + ! USED FOR IONOSPHERIC WACCM (WACCM-X) + MOLECTYPE = 'MINOR' + ! IS AN OUTPUT FIELD (?) + CAMOUT = .FALSE. + ! NOT TRUE FOR O2(1-DELTA) OR O2(1-SIGMA) + IC_FROM_CAM2 = .TRUE. + ! USE A FIXED VALUE AT THE UPPER BOUNDARY + HAS_FIXED_UBC = .FALSE. + ! USE A FIXED FLUX CONDITION AT THE UPPER BOUNDARY + HAS_FIXED_UBFLX = .FALSE. + !WRITE(TRACERNAMES(I),'(A,I0.4)') 'GCTRC_', I + ! NOTE: IN MOZART, THIS ONLY GETS CALLED FOR TRACERS + ! THIS IS THE CALL TO ADD A "CONSTITUENT" + CALL CNST_ADD( TRIM(TRACERNAMES(I)), ADV_MASS(I), CPTMP, QMIN, N, & + READIV=IC_FROM_CAM2, MIXTYPE=MIXTYPE, CAM_OUTFLD=CAMOUT, & + MOLECTYPE=MOLECTYPE, FIXED_UBC=HAS_FIXED_UBC, & + FIXED_UBFLX=HAS_FIXED_UBFLX, LONGNAME=TRIM(LNG_NAME) ) + + ! ADD TO GC MAPPING. WHEN STARTING A TIMESTEP, WE WILL WANT TO UPDATE THE + ! CONCENTRATION OF STATE_CHM(X)%SPECIES(1,ICOL,ILEV,M) WITH DATA FROM + ! CONSTITUENT N + M = IND_(TRIM(TRACERNAMES(I))) IF ( M > 0 ) THEN - map2GC(N) = M - map2Idx(N) = I + MAP2GC(N) = M + MAP2IDX(N) = I ENDIF - ! Nullify pointer - ThisSpc => NULL() + ! NULLIFY POINTER + THISSPC => NULL() ENDDO - ! Now unadvected species - map2GC_Sls = 0 - sls_ref_MMR(:) = 0.0e+0_r8 - SlsMWRatio(:) = -1.0e+0_r8 - slsLongNames = '' - DO I = 1, nSls - N = Ind_(slsNames(I)) + ! NOW UNADVECTED SPECIES + MAP2GC_SLS = 0 + SLS_REF_MMR(:) = 0.0E+0_R8 + SLSMWRATIO(:) = -1.0E+0_R8 + SLSLONGNAMES = '' + DO I = 1, NSLS + N = IND_(SLSNAMES(I)) IF ( N .GT. 0 ) THEN - ThisSpc => SC%SpcData(N)%Info - MWTmp = REAL(ThisSpc%MW_g,r8) - ref_VMR = REAL(ThisSpc%BackgroundVV,r8) - lng_Name = TRIM(ThisSpc%FullName) - slsLongNames(I) = lng_Name - sls_ref_MMR(I) = ref_VMR / (MWDry / MWTmp) - SlsMWRatio(I) = MWDry / MWTmp - map2GC_Sls(I) = N - ThisSpc => NULL() + THISSPC => SC%SPCDATA(N)%INFO + MWTMP = REAL(THISSPC%MW_G,R8) + REF_VMR = REAL(THISSPC%BACKGROUNDVV,R8) + LNG_NAME = TRIM(THISSPC%FULLNAME) + SLSLONGNAMES(I) = LNG_NAME + SLS_REF_MMR(I) = REF_VMR / (MWDRY / MWTMP) + SLSMWRATIO(I) = MWDRY / MWTMP + MAP2GC_SLS(I) = N + THISSPC => NULL() ENDIF ENDDO - ! Pass information to "short_lived_species" module - slvd_ref_MMR(1:nSls) = sls_ref_MMR(1:nSls) - CALL Register_Short_Lived_Species() - ! More information: - ! http://www.cesm.ucar.edu/models/atm-cam/docs/phys-interface/node5.html + ! PASS INFORMATION TO "SHORT_LIVED_SPECIES" MODULE + SLVD_REF_MMR(1:NSLS) = SLS_REF_MMR(1:NSLS) + CALL REGISTER_SHORT_LIVED_SPECIES() + ! MORE INFORMATION: + ! HTTP://WWW.CESM.UCAR.EDU/MODELS/ATM-CAM/DOCS/PHYS-INTERFACE/NODE5.HTML - ! Clean up - Call Cleanup_State_Chm ( .False., SC, RC ) - Call Cleanup_State_Grid( .False., SG, RC ) - Call Cleanup_Input_Opt ( .False., IO, RC ) + ! CLEAN UP + CALL CLEANUP_STATE_CHM ( .FALSE., SC, RC ) + CALL CLEANUP_STATE_GRID( .FALSE., SG, RC ) + CALL CLEANUP_INPUT_OPT ( .FALSE., IO, RC ) - end subroutine chem_register + END SUBROUTINE CHEM_REGISTER - subroutine chem_readnl(nlfile) - ! This is the FIRST routine to get called - so it should read in - ! GEOS-Chem options from input.geos without actually doing any - ! initialization + SUBROUTINE CHEM_READNL(NLFILE) + ! THIS IS THE FIRST ROUTINE TO GET CALLED - SO IT SHOULD READ IN + ! GEOS-CHEM OPTIONS FROM INPUT.GEOS WITHOUT ACTUALLY DOING ANY + ! INITIALIZATION - use cam_abortutils, only : endrun - use units, only : getunit, freeunit - use mpishorthand - use gckpp_Model, only : nSpec, Spc_Names - use mo_chem_utls, only : get_spc_ndx - use chem_mods, only : drySpc_ndx + USE CAM_ABORTUTILS, ONLY : ENDRUN + USE UNITS, ONLY : GETUNIT, FREEUNIT + USE MPISHORTHAND + USE GCKPP_MODEL, ONLY : NSPEC, SPC_NAMES + USE MO_CHEM_UTLS, ONLY : GET_SPC_NDX + USE CHEM_MODS, ONLY : DRYSPC_NDX - ! args - CHARACTER(LEN=*), INTENT(IN) :: nlfile ! filepath for file containing namelist input + ! ARGS + CHARACTER(LEN=*), INTENT(IN) :: NLFILE ! FILEPATH FOR FILE CONTAINING NAMELIST INPUT - ! Local variables - INTEGER :: I, N, nIgnored + ! LOCAL VARIABLES + INTEGER :: I, N, NIGNORED INTEGER :: UNITN, IERR - CHARACTER(LEN=500) :: line - LOGICAL :: menuFound - LOGICAL :: validSLS - -#if ( OCNDDVEL_MOZART ) - namelist /chem_inparm/ MOZART_depvel_lnd_file, & - MOZART_clim_soilw_file, & - MOZART_season_wes_file -#endif - - nIgnored = 0 - - ! Set paths - ! MIT path - !inputGeosPath='/home/fritzt/input.geos.template' - !chemInputsDir='/net/d06/data/GCdata/ExtData/CHEM_INPUTS/' - ! Cheyenne path - inputGeosPath='/glade/u/home/fritzt/input.geos.template' - chemInputsDir='/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/' - - -#if ( ALLDDVEL_GEOSCHEM + OCNDDVEL_GEOSCHEM + OCNDDVEL_MOZART != 1 ) - IF (MasterProc) THEN - Write(iulog,'(/,a)') REPEAT( "=", 79 ) - Write(iulog,'(a)') " Preprocessor flags are not set correctly in chemistry.F90" - Write(iulog,'(a)') " The user needs to decide how to compute dry deposition velocities" - Write(iulog,'(a)') " Three options appear: " - Write(iulog,'(a)') " + Let GEOS-Chem calculate all dry deposition velocities." - Write(iulog,'(a)') " Required setup:" - Write(iulog,'(a)') " ALLDDVEL_GEOSCHEM == 1" - Write(iulog,'(a)') " OCNDDVEL_GEOSCHEM == 0" - Write(iulog,'(a)') " OCNDDVEL_MOZART == 0" - Write(iulog,'(a)') " + Let CLM compute dry deposition velocities over land and let" - Write(iulog,'(a)') " GEOS-Chem compute velocities over ocean and ice" - Write(iulog,'(a)') " Required setup:" - Write(iulog,'(a)') " ALLDDVEL_GEOSCHEM == 0" - Write(iulog,'(a)') " OCNDDVEL_GEOSCHEM == 1" - Write(iulog,'(a)') " OCNDDVEL_MOZART == 0" - Write(iulog,'(a)') " + Let CLM compute dry deposition velocities over land and" - Write(iulog,'(a)') " compute velocities over ocean and ice in a similar way as" - Write(iulog,'(a)') " MOZART" - Write(iulog,'(a)') " Required setup:" - Write(iulog,'(a)') " ALLDDVEL_GEOSCHEM == 0" - Write(iulog,'(a)') " OCNDDVEL_GEOSCHEM == 0" - Write(iulog,'(a)') " OCNDDVEL_MOZART == 1" - Write(iulog,'(a)') REPEAT( "=", 79 ) - CALL ENDRUN('Incorrect definitions for dry deposition velocities') + CHARACTER(LEN=500) :: LINE + LOGICAL :: MENUFOUND + LOGICAL :: VALIDSLS + +#IF ( OCNDDVEL_MOZART ) + NAMELIST /CHEM_INPARM/ MOZART_DEPVEL_LND_FILE, & + MOZART_CLIM_SOILW_FILE, & + MOZART_SEASON_WES_FILE +#ENDIF + + NIGNORED = 0 + + ! SET PATHS + ! MIT PATH + !INPUTGEOSPATH='/HOME/FRITZT/INPUT.GEOS.TEMPLATE' + !CHEMINPUTSDIR='/NET/D06/DATA/GCDATA/EXTDATA/CHEM_INPUTS/' + ! CHEYENNE PATH + INPUTGEOSPATH='/GLADE/U/HOME/FRITZT/INPUT.GEOS.TEMPLATE' + CHEMINPUTSDIR='/GLADE/P/UNIV/UMIT0034/EXTDATA/CHEM_INPUTS/' + + +#IF ( ALLDDVEL_GEOSCHEM + OCNDDVEL_GEOSCHEM + OCNDDVEL_MOZART != 1 ) + IF (MASTERPROC) THEN + WRITE(IULOG,'(/,A)') REPEAT( "=", 79 ) + WRITE(IULOG,'(A)') " PREPROCESSOR FLAGS ARE NOT SET CORRECTLY IN CHEMISTRY.F90" + WRITE(IULOG,'(A)') " THE USER NEEDS TO DECIDE HOW TO COMPUTE DRY DEPOSITION VELOCITIES" + WRITE(IULOG,'(A)') " THREE OPTIONS APPEAR: " + WRITE(IULOG,'(A)') " + LET GEOS-CHEM CALCULATE ALL DRY DEPOSITION VELOCITIES." + WRITE(IULOG,'(A)') " REQUIRED SETUP:" + WRITE(IULOG,'(A)') " ALLDDVEL_GEOSCHEM == 1" + WRITE(IULOG,'(A)') " OCNDDVEL_GEOSCHEM == 0" + WRITE(IULOG,'(A)') " OCNDDVEL_MOZART == 0" + WRITE(IULOG,'(A)') " + LET CLM COMPUTE DRY DEPOSITION VELOCITIES OVER LAND AND LET" + WRITE(IULOG,'(A)') " GEOS-CHEM COMPUTE VELOCITIES OVER OCEAN AND ICE" + WRITE(IULOG,'(A)') " REQUIRED SETUP:" + WRITE(IULOG,'(A)') " ALLDDVEL_GEOSCHEM == 0" + WRITE(IULOG,'(A)') " OCNDDVEL_GEOSCHEM == 1" + WRITE(IULOG,'(A)') " OCNDDVEL_MOZART == 0" + WRITE(IULOG,'(A)') " + LET CLM COMPUTE DRY DEPOSITION VELOCITIES OVER LAND AND" + WRITE(IULOG,'(A)') " COMPUTE VELOCITIES OVER OCEAN AND ICE IN A SIMILAR WAY AS" + WRITE(IULOG,'(A)') " MOZART" + WRITE(IULOG,'(A)') " REQUIRED SETUP:" + WRITE(IULOG,'(A)') " ALLDDVEL_GEOSCHEM == 0" + WRITE(IULOG,'(A)') " OCNDDVEL_GEOSCHEM == 0" + WRITE(IULOG,'(A)') " OCNDDVEL_MOZART == 1" + WRITE(IULOG,'(A)') REPEAT( "=", 79 ) + CALL ENDRUN('INCORRECT DEFINITIONS FOR DRY DEPOSITION VELOCITIES') ENDIF -#endif -#if ( ALLDDVEL_GEOSCHEM && ( LANDTYPE_HEMCO + LANDTYPE_CLM != 1 ) ) - IF (MasterProc) THEN - Write(iulog,'(/,a)') REPEAT( "=", 79 ) - Write(iulog,'(a)') REPEAT( "=", 79 ) - Write(iulog,'(a)') " Preprocessor flags are not set correctly in chemistry.F90" - Write(iulog,'(a)') " Dry-deposition velocities are computed by GEOS-Chem" - Write(iulog,'(a)') " The user needs to decide if land types should be from CLM or from HEMCO" - CALL ENDRUN('Incorrect definitions for source of land type data') +#ENDIF +#IF ( ALLDDVEL_GEOSCHEM && ( LANDTYPE_HEMCO + LANDTYPE_CLM != 1 ) ) + IF (MASTERPROC) THEN + WRITE(IULOG,'(/,A)') REPEAT( "=", 79 ) + WRITE(IULOG,'(A)') REPEAT( "=", 79 ) + WRITE(IULOG,'(A)') " PREPROCESSOR FLAGS ARE NOT SET CORRECTLY IN CHEMISTRY.F90" + WRITE(IULOG,'(A)') " DRY-DEPOSITION VELOCITIES ARE COMPUTED BY GEOS-CHEM" + WRITE(IULOG,'(A)') " THE USER NEEDS TO DECIDE IF LAND TYPES SHOULD BE FROM CLM OR FROM HEMCO" + CALL ENDRUN('INCORRECT DEFINITIONS FOR SOURCE OF LAND TYPE DATA') ENDIF -#endif +#ENDIF - ALLOCATE(drySpc_ndx(nddvels), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate drySpc_ndx') + ALLOCATE(DRYSPC_NDX(NDDVELS), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('FAILED TO ALLOCATE DRYSPC_NDX') - IF (MasterProc) THEN + IF (MASTERPROC) THEN - Write(iulog,'(/,a)') REPEAT( '=', 50 ) - Write(iulog,'(a)') REPEAT( '=', 50 ) - Write(iulog,'(a)') 'This is the GEOS-CHEM / CESM interface' - Write(iulog,'(a)') REPEAT( '=', 50 ) - Write(iulog,'(a)') ' + Routines written by Thibaud M. Fritz' - Write(iulog,'(a)') ' + Laboratory for Aviation and the Environment,' - Write(iulog,'(a)') ' + Department of Aeronautics and Astronautics,' - Write(iulog,'(a)') ' + Massachusetts Institute of Technology' - Write(iulog,'(a)') REPEAT( '=', 50 ) + WRITE(IULOG,'(/,A)') REPEAT( '=', 50 ) + WRITE(IULOG,'(A)') REPEAT( '=', 50 ) + WRITE(IULOG,'(A)') 'THIS IS THE GEOS-CHEM / CESM INTERFACE' + WRITE(IULOG,'(A)') REPEAT( '=', 50 ) + WRITE(IULOG,'(A)') ' + ROUTINES WRITTEN BY THIBAUD M. FRITZ' + WRITE(IULOG,'(A)') ' + LABORATORY FOR AVIATION AND THE ENVIRONMENT,' + WRITE(IULOG,'(A)') ' + DEPARTMENT OF AERONAUTICS AND ASTRONAUTICS,' + WRITE(IULOG,'(A)') ' + MASSACHUSETTS INSTITUTE OF TECHNOLOGY' + WRITE(IULOG,'(A)') REPEAT( '=', 50 ) - Write(iulog,'(/,/, a)') 'Now defining GEOS-Chem tracers and dry deposition mapping...' + WRITE(IULOG,'(/,/, A)') 'NOW DEFINING GEOS-CHEM TRACERS AND DRY DEPOSITION MAPPING...' UNITN = GETUNIT() !============================================================== - ! Opening input.geos and go to ADVECTED SPECIES MENU + ! OPENING INPUT.GEOS AND GO TO ADVECTED SPECIES MENU !============================================================== - OPEN( UNITN, FILE=TRIM(inputGeosPath), STATUS='OLD', IOSTAT=IERR ) + OPEN( UNITN, FILE=TRIM(INPUTGEOSPATH), STATUS='OLD', IOSTAT=IERR ) IF (IERR .NE. 0) THEN - CALL ENDRUN('chem_readnl: ERROR opening input.geos') + CALL ENDRUN('CHEM_READNL: ERROR OPENING INPUT.GEOS') ENDIF - ! Go to ADVECTED SPECIES MENU - menuFound = .False. - DO WHILE ( .NOT. menuFound ) - READ( UNITN, '(a)', IOSTAT=IERR ) line + ! GO TO ADVECTED SPECIES MENU + MENUFOUND = .FALSE. + DO WHILE ( .NOT. MENUFOUND ) + READ( UNITN, '(A)', IOSTAT=IERR ) LINE IF ( IERR .NE. 0 ) THEN - CALL ENDRUN('chem_readnl: ERROR finding advected species menu') - ELSEIF ( INDEX(line, 'ADVECTED SPECIES MENU') > 0 ) THEN - menuFound = .True. + CALL ENDRUN('CHEM_READNL: ERROR FINDING ADVECTED SPECIES MENU') + ELSEIF ( INDEX(LINE, 'ADVECTED SPECIES MENU') > 0 ) THEN + MENUFOUND = .TRUE. ENDIF ENDDO !============================================================== - ! Read list of GEOS-Chem tracers + ! READ LIST OF GEOS-CHEM TRACERS !============================================================== DO - ! Read line - READ(UNITN,'(26x,a)', IOSTAT=IERR) line + ! READ LINE + READ(UNITN,'(26X,A)', IOSTAT=IERR) LINE - IF ( INDEX( TRIM(line), '---' ) > 0 ) EXIT + IF ( INDEX( TRIM(LINE), '---' ) > 0 ) EXIT - nTracers = nTracers + 1 - tracerNames(nTracers) = TRIM(line) + NTRACERS = NTRACERS + 1 + TRACERNAMES(NTRACERS) = TRIM(LINE) ENDDO CLOSE(UNITN) CALL FREEUNIT(UNITN) - ! Assign remaining tracers dummy names - DO I = (nTracers+1), nTracersMax - WRITE(tracerNames(I),'(a,I0.4)') 'GCTRC_', I + ! ASSIGN REMAINING TRACERS DUMMY NAMES + DO I = (NTRACERS+1), NTRACERSMAX + WRITE(TRACERNAMES(I),'(A,I0.4)') 'GCTRC_', I ENDDO !============================================================== - ! Now go through the KPP mechanism and add any species not - ! implemented by the tracer list in input.geos + ! NOW GO THROUGH THE KPP MECHANISM AND ADD ANY SPECIES NOT + ! IMPLEMENTED BY THE TRACER LIST IN INPUT.GEOS !============================================================== - IF ( nSpec > nSlsMax ) THEN - CALL ENDRUN('chem_readnl: too many species - increase nSlsmax') + IF ( NSPEC > NSLSMAX ) THEN + CALL ENDRUN('CHEM_READNL: TOO MANY SPECIES - INCREASE NSLSMAX') ENDIF - nSls = 0 - DO I = 1, nSpec - ! Get the name of the species from KPP - line = ADJUSTL(TRIM(Spc_Names(I))) - ! Only add this - validSLS = ( .NOT. ANY(TRIM(line) .EQ. tracerNames) ) - IF (validSLS) THEN - ! Genuine new short-lived species - nSls = nSls + 1 - slsNames(nSls) = TRIM(line) + NSLS = 0 + DO I = 1, NSPEC + ! GET THE NAME OF THE SPECIES FROM KPP + LINE = ADJUSTL(TRIM(SPC_NAMES(I))) + ! ONLY ADD THIS + VALIDSLS = ( .NOT. ANY(TRIM(LINE) .EQ. TRACERNAMES) ) + IF (VALIDSLS) THEN + ! GENUINE NEW SHORT-LIVED SPECIES + NSLS = NSLS + 1 + SLSNAMES(NSLS) = TRIM(LINE) ENDIF ENDDO !============================================================== - ! Get mapping between dry deposition species and species set + ! GET MAPPING BETWEEN DRY DEPOSITION SPECIES AND SPECIES SET !============================================================== - DO N = 1, nddvels + DO N = 1, NDDVELS - ! The species names need to be convert to upper case as, - ! for instance, BR2 != Br2 - drySpc_ndx(N) = get_spc_ndx( to_upper(drydep_list(N)) ) + ! THE SPECIES NAMES NEED TO BE CONVERT TO UPPER CASE AS, + ! FOR INSTANCE, BR2 != BR2 + DRYSPC_NDX(N) = GET_SPC_NDX( TO_UPPER(DRYDEP_LIST(N)) ) - IF ( drySpc_ndx(N) < 0 ) THEN - Write(iulog,'(a,a)') ' ## Ignoring dry deposition of ', & - TRIM(drydep_list(N)) - nIgnored = nIgnored + 1 + IF ( DRYSPC_NDX(N) < 0 ) THEN + WRITE(IULOG,'(A,A)') ' ## IGNORING DRY DEPOSITION OF ', & + TRIM(DRYDEP_LIST(N)) + NIGNORED = NIGNORED + 1 ENDIF ENDDO - IF ( nIgnored > 0 ) THEN - Write(iulog,'(a,a)') ' The species listed above have dry', & - ' deposition turned off for one of the following reasons:' - Write(iulog,'(a)') ' - They are not present in the GEOS-Chem tracer list.' - Write(iulog,'(a)') ' - They have a synonym (e.g. CH2O and HCHO).' + IF ( NIGNORED > 0 ) THEN + WRITE(IULOG,'(A,A)') ' THE SPECIES LISTED ABOVE HAVE DRY', & + ' DEPOSITION TURNED OFF FOR ONE OF THE FOLLOWING REASONS:' + WRITE(IULOG,'(A)') ' - THEY ARE NOT PRESENT IN THE GEOS-CHEM TRACER LIST.' + WRITE(IULOG,'(A)') ' - THEY HAVE A SYNONYM (E.G. CH2O AND HCHO).' ENDIF !============================================================== - ! Print summary + ! PRINT SUMMARY !============================================================== - Write(iulog,'(/, a)') '### Summary of GEOS-Chem species: ' - Write(iulog,'( a)') REPEAT( '-', 50 ) - Write(iulog,'( a)') '+ List of advected species: ' - Write(iulog,100) 'ID', 'Tracer', 'Dry deposition (T/F)' - DO N = 1, nTracers - WRITE(iulog,110) N, TRIM(tracerNames(N)), any(drySpc_ndx .eq. N) + WRITE(IULOG,'(/, A)') '### SUMMARY OF GEOS-CHEM SPECIES: ' + WRITE(IULOG,'( A)') REPEAT( '-', 50 ) + WRITE(IULOG,'( A)') '+ LIST OF ADVECTED SPECIES: ' + WRITE(IULOG,100) 'ID', 'TRACER', 'DRY DEPOSITION (T/F)' + DO N = 1, NTRACERS + WRITE(IULOG,110) N, TRIM(TRACERNAMES(N)), ANY(DRYSPC_NDX .EQ. N) ENDDO - Write(iulog,'(/, a)') '+ List of short-lived species: ' - DO N = 1, nSls - WRITE(iulog,120) N, TRIM(slsNames(N)) + WRITE(IULOG,'(/, A)') '+ LIST OF SHORT-LIVED SPECIES: ' + DO N = 1, NSLS + WRITE(IULOG,120) N, TRIM(SLSNAMES(N)) ENDDO - 100 FORMAT( 1x, A3, 3x, A10, 1x, A25 ) - 110 FORMAT( 1x, I3, 3x, A10, 1x, L15 ) - 120 FORMAT( 1x, I3, 3x, A10 ) + 100 FORMAT( 1X, A3, 3X, A10, 1X, A25 ) + 110 FORMAT( 1X, I3, 3X, A10, 1X, L15 ) + 120 FORMAT( 1X, I3, 3X, A10 ) !============================================================== ENDIF !================================================================== - ! Broadcast to all processors + ! BROADCAST TO ALL PROCESSORS !================================================================== -#if defined( SPMD ) - CALL MPIBCAST(nTracers, 1, MPIINT, 0, MPICOM ) - CALL MPIBCAST(tracerNames, LEN(tracerNames(1))*nTracersMax, MPICHAR, 0, MPICOM ) - CALL MPIBCAST(nSls, 1, MPIINT, 0, MPICOM ) - CALL MPIBCAST(slsNames, LEN(slsNames(1))*nSlsMax, MPICHAR, 0, MPICOM ) - CALL MPIBCAST(drySpc_ndx, nddvels, MPIINT, 0, MPICOM ) +#IF DEFINED( SPMD ) + CALL MPIBCAST(NTRACERS, 1, MPIINT, 0, MPICOM ) + CALL MPIBCAST(TRACERNAMES, LEN(TRACERNAMES(1))*NTRACERSMAX, MPICHAR, 0, MPICOM ) + CALL MPIBCAST(NSLS, 1, MPIINT, 0, MPICOM ) + CALL MPIBCAST(SLSNAMES, LEN(SLSNAMES(1))*NSLSMAX, MPICHAR, 0, MPICOM ) + CALL MPIBCAST(DRYSPC_NDX, NDDVELS, MPIINT, 0, MPICOM ) -#if ( OCNDDVEL_MOZART ) +#IF ( OCNDDVEL_MOZART ) !============================================================== - ! The following lines should only be called if we compute - ! velocities over the ocean and ice in a MOZART-like way. - ! Thibaud M. Fritz - 26 Feb 2020 + ! THE FOLLOWING LINES SHOULD ONLY BE CALLED IF WE COMPUTE + ! VELOCITIES OVER THE OCEAN AND ICE IN A MOZART-LIKE WAY. + ! THIBAUD M. FRITZ - 26 FEB 2020 !============================================================== - CALL MPIBCAST(MOZART_depvel_lnd_file, LEN(MOZART_depvel_lnd_file), MPICHAR, 0, MPICOM) - CALL MPIBCAST(MOZART_clim_soilw_file, LEN(MOZART_clim_soilw_file), MPICHAR, 0, MPICOM) - CALL MPIBCAST(MOZART_season_wes_file, LEN(MOZART_season_wes_file), MPICHAR, 0, MPICOM) -#endif - -#endif - - ! Update "short_lived_species" arrays - will eventually unify these - nSlvd = nSls - ALLOCATE(slvd_Lst(nSlvd), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating slvd_Lst') - ALLOCATE(slvd_ref_MMR(nSlvd), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating slvd_ref_MMR') - DO I = 1, nSls - slvd_Lst(I) = TRIM(slsNames(I)) + CALL MPIBCAST(MOZART_DEPVEL_LND_FILE, LEN(MOZART_DEPVEL_LND_FILE), MPICHAR, 0, MPICOM) + CALL MPIBCAST(MOZART_CLIM_SOILW_FILE, LEN(MOZART_CLIM_SOILW_FILE), MPICHAR, 0, MPICOM) + CALL MPIBCAST(MOZART_SEASON_WES_FILE, LEN(MOZART_SEASON_WES_FILE), MPICHAR, 0, MPICOM) +#ENDIF + +#ENDIF + + ! UPDATE "SHORT_LIVED_SPECIES" ARRAYS - WILL EVENTUALLY UNIFY THESE + NSLVD = NSLS + ALLOCATE(SLVD_LST(NSLVD), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING SLVD_LST') + ALLOCATE(SLVD_REF_MMR(NSLVD), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING SLVD_REF_MMR') + DO I = 1, NSLS + SLVD_LST(I) = TRIM(SLSNAMES(I)) ENDDO - end subroutine chem_readnl + END SUBROUTINE CHEM_READNL !================================================================================================ - function chem_is_active() + FUNCTION CHEM_IS_ACTIVE() !----------------------------------------------------------------------- - logical :: chem_is_active + LOGICAL :: CHEM_IS_ACTIVE !----------------------------------------------------------------------- - chem_is_active = .true. + CHEM_IS_ACTIVE = .TRUE. - end function chem_is_active + END FUNCTION CHEM_IS_ACTIVE !================================================================================================ - function chem_implements_cnst(name) + FUNCTION CHEM_IMPLEMENTS_CNST(NAME) !----------------------------------------------------------------------- ! - ! Purpose: return true if specified constituent is implemented by this package + ! PURPOSE: RETURN TRUE IF SPECIFIED CONSTITUENT IS IMPLEMENTED BY THIS PACKAGE ! - ! Author: B. Eaton + ! AUTHOR: B. EATON ! !----------------------------------------------------------------------- IMPLICIT NONE - !-----------------------------Arguments--------------------------------- + !-----------------------------ARGUMENTS--------------------------------- - CHARACTER(LEN=*), INTENT(IN) :: name ! constituent name - LOGICAL :: chem_implements_cnst ! return value + CHARACTER(LEN=*), INTENT(IN) :: NAME ! CONSTITUENT NAME + LOGICAL :: CHEM_IMPLEMENTS_CNST ! RETURN VALUE INTEGER :: I - chem_implements_cnst = .false. + CHEM_IMPLEMENTS_CNST = .FALSE. - DO I = 1, nTracers - IF (TRIM(tracerNames(I)) .eq. TRIM(NAME)) THEN - chem_implements_cnst = .true. + DO I = 1, NTRACERS + IF (TRIM(TRACERNAMES(I)) .EQ. TRIM(NAME)) THEN + CHEM_IMPLEMENTS_CNST = .TRUE. EXIT ENDIF ENDDO - IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_IMPLEMENTS_CNST' + IF (MASTERPROC) WRITE(IULOG,'(A)') 'GCCALL CHEM_IMPLEMENTS_CNST' - end function chem_implements_cnst + END FUNCTION CHEM_IMPLEMENTS_CNST !=============================================================================== - subroutine chem_init(phys_state, pbuf2d) + SUBROUTINE CHEM_INIT(PHYS_STATE, PBUF2D) !----------------------------------------------------------------------- ! - ! Purpose: initialize GEOS-Chem parts (state objects, mainly) - ! (and declare history variables) + ! PURPOSE: INITIALIZE GEOS-CHEM PARTS (STATE OBJECTS, MAINLY) + ! (AND DECLARE HISTORY VARIABLES) ! !----------------------------------------------------------------------- - use physics_buffer, only: physics_buffer_desc, pbuf_get_index - use cam_history, only: addfld, add_default, horiz_only - use chem_mods, only: map2GC_dryDep, drySpc_ndx - - use mpishorthand - use cam_abortutils, only : endrun - - use Input_Opt_Mod - use State_Chm_Mod - use State_Grid_Mod - use State_Met_Mod - use DiagList_Mod, only : Init_DiagList, Print_DiagList - use GC_Environment_Mod - use GC_Grid_Mod, only : SetGridFromCtrEdges - - ! Use GEOS-Chem versions of physical constants - use PhysConstants, only : PI, PI_180 - use PhysConstants, only : Re - - use Phys_Grid, only : get_Area_All_p - use hycoef, only : ps0, hyai, hybi - - use Time_Mod, only : Accept_External_Date_Time - !use Time_Mod, only : Set_Begin_Time, Set_End_Time - !use Time_Mod, only : Set_Current_Time, Set_DiagB - !use Transfer_Mod, only : Init_Transfer - use Linoz_Mod, only : Linoz_Read - -#if ( OCNDDVEL_MOZART ) - use seq_drydep_mod, only: drydep_method, DD_XLND - use mo_drydep, only: drydep_inti -#endif - - use CMN_Size_Mod - - use Drydep_Mod, only : Init_Drydep, DepName, nDVZind - use Carbon_Mod, only : Init_Carbon - use Dust_Mod, only : Init_Dust - use Seasalt_Mod, only : Init_Seasalt - use Sulfate_Mod, only : Init_Sulfate - use Aerosol_Mod, only : Init_Aerosol - use WetScav_Mod, only : Init_WetScav - use TOMS_Mod, only : Init_TOMS - use Pressure_Mod, only : Init_Pressure, Accept_External_ApBp - use Chemistry_Mod, only : Init_Chemistry - use UCX_Mod, only : Init_UCX -#if ( ALLDDVEL_GEOSCHEM && LANDTYPE_HEMCO ) - use Olson_Landmap_Mod -#endif - use Mixing_Mod - - use PBL_Mix_Mod, only : Init_PBL_Mix - - use GC_Emissions_Mod, only : GC_Emissions_Init - - TYPE(physics_state), INTENT(IN):: phys_state(BEGCHUNK:ENDCHUNK) - TYPE(physics_buffer_desc), POINTER :: pbuf2d(:,:) - - ! Local variables + USE PHYSICS_BUFFER, ONLY: PHYSICS_BUFFER_DESC, PBUF_GET_INDEX + USE CAM_HISTORY, ONLY: ADDFLD, ADD_DEFAULT, HORIZ_ONLY + USE CHEM_MODS, ONLY: MAP2GC_DRYDEP, DRYSPC_NDX + + USE MPISHORTHAND + USE CAM_ABORTUTILS, ONLY : ENDRUN + + USE INPUT_OPT_MOD + USE STATE_CHM_MOD + USE STATE_GRID_MOD + USE STATE_MET_MOD + USE DIAGLIST_MOD, ONLY : INIT_DIAGLIST, PRINT_DIAGLIST + USE GC_ENVIRONMENT_MOD + USE GC_GRID_MOD, ONLY : SETGRIDFROMCTREDGES + + ! USE GEOS-CHEM VERSIONS OF PHYSICAL CONSTANTS + USE PHYSCONSTANTS, ONLY : PI, PI_180 + USE PHYSCONSTANTS, ONLY : RE + + USE PHYS_GRID, ONLY : GET_AREA_ALL_P + USE HYCOEF, ONLY : PS0, HYAI, HYBI + + USE TIME_MOD, ONLY : ACCEPT_EXTERNAL_DATE_TIME + !USE TIME_MOD, ONLY : SET_BEGIN_TIME, SET_END_TIME + !USE TIME_MOD, ONLY : SET_CURRENT_TIME, SET_DIAGB + !USE TRANSFER_MOD, ONLY : INIT_TRANSFER + USE LINOZ_MOD, ONLY : LINOZ_READ + +#IF ( OCNDDVEL_MOZART ) + USE SEQ_DRYDEP_MOD, ONLY: DRYDEP_METHOD, DD_XLND + USE MO_DRYDEP, ONLY: DRYDEP_INTI +#ENDIF + + USE CMN_SIZE_MOD + + USE DRYDEP_MOD, ONLY : INIT_DRYDEP, DEPNAME, NDVZIND + USE CARBON_MOD, ONLY : INIT_CARBON + USE DUST_MOD, ONLY : INIT_DUST + USE SEASALT_MOD, ONLY : INIT_SEASALT + USE SULFATE_MOD, ONLY : INIT_SULFATE + USE AEROSOL_MOD, ONLY : INIT_AEROSOL + USE WETSCAV_MOD, ONLY : INIT_WETSCAV + USE PRESSURE_MOD, ONLY : INIT_PRESSURE, ACCEPT_EXTERNAL_APBP + USE CHEMISTRY_MOD, ONLY : INIT_CHEMISTRY + USE UCX_MOD, ONLY : INIT_UCX +#IF ( ALLDDVEL_GEOSCHEM && LANDTYPE_HEMCO ) + USE OLSON_LANDMAP_MOD +#ENDIF + USE MIXING_MOD + + USE PBL_MIX_MOD, ONLY : INIT_PBL_MIX + + USE GC_EMISSIONS_MOD, ONLY : GC_EMISSIONS_INIT + + TYPE(PHYSICS_STATE), INTENT(IN):: PHYS_STATE(BEGCHUNK:ENDCHUNK) + TYPE(PHYSICS_BUFFER_DESC), POINTER :: PBUF2D(:,:) + + ! LOCAL VARIABLES !---------------------------- - ! Scalars + ! SCALARS !---------------------------- - ! Integers + ! INTEGERS INTEGER :: LCHNK(BEGCHUNK:ENDCHUNK), NCOL(BEGCHUNK:ENDCHUNK) INTEGER :: IWAIT, IERR - INTEGER :: nX, nY, nZ - INTEGER :: iX, jY + INTEGER :: NX, NY, NZ + INTEGER :: IX, JY INTEGER :: I, J, L, N INTEGER :: RC INTEGER :: NLINOZ - ! Logicals - LOGICAL :: am_I_Root, rootChunk - LOGICAL :: prtDebug + ! LOGICALS + LOGICAL :: ROOTCHUNK + LOGICAL :: PRTDEBUG - ! Strings - CHARACTER(LEN=255) :: historyConfigFile - CHARACTER(LEN=255) :: SpcName + ! STRINGS + CHARACTER(LEN=255) :: HISTORYCONFIGFILE + CHARACTER(LEN=255) :: SPCNAME - ! Grid setup - REAL(fp) :: lonVal, latVal - REAL(fp) :: dLonFix, dLatFix - REAL(f4), ALLOCATABLE :: lonMidArr(:,:), latMidArr(:,:) - REAL(f4), ALLOCATABLE :: lonEdgeArr(:,:), latEdgeArr(:,:) - REAL(r8), ALLOCATABLE :: linozData(:,:,:,:) + ! GRID SETUP + REAL(FP) :: LONVAL, LATVAL + REAL(FP) :: DLONFIX, DLATFIX + REAL(F4), ALLOCATABLE :: LONMIDARR(:,:), LATMIDARR(:,:) + REAL(F4), ALLOCATABLE :: LONEDGEARR(:,:), LATEDGEARR(:,:) + REAL(R8), ALLOCATABLE :: LINOZDATA(:,:,:,:) - REAL(r8), ALLOCATABLE :: Col_Area(:) - REAL(fp), ALLOCATABLE :: Ap_CAM_Flip(:), Bp_CAM_Flip(:) + REAL(R8), ALLOCATABLE :: COL_AREA(:) + REAL(FP), ALLOCATABLE :: AP_CAM_FLIP(:), BP_CAM_FLIP(:) - REAL(r8), POINTER :: SlsPtr(:,:,:) + REAL(R8), POINTER :: SLSPTR(:,:,:) - ! Assume a successful return until otherwise + ! ASSUME A SUCCESSFUL RETURN UNTIL OTHERWISE RC = GC_SUCCESS - ! For error trapping - ErrMsg = '' - ThisLoc = ' -> at GEOS-Chem (in chemistry/pp_geoschem/chemistry.F90)' + ! FOR ERROR TRAPPING + ERRMSG = '' + THISLOC = ' -> AT GEOS-CHEM (IN CHEMISTRY/PP_GEOSCHEM/CHEMISTRY.F90)' - ! LCHNK: which chunks we have on this process + ! LCHNK: WHICH CHUNKS WE HAVE ON THIS PROCESS LCHNK = PHYS_STATE%LCHNK - ! NCOL: number of atmospheric columns for each chunk + ! NCOL: NUMBER OF ATMOSPHERIC COLUMNS FOR EACH CHUNK NCOL = PHYS_STATE%NCOL - write(iulog,'(2(a,x,I6,x))') 'chem_init called on PE ', myCPU, ' of ', nCPUs - - ! The GEOS-Chem grids on every "chunk" will all be the same size, to avoid - ! the possibility of having differently-sized chunks - nX = 1 - !nY = MAXVAL(NCOL) - nY = PCOLS - nZ = PVER - - !! Add short lived speies to buffers - !CALL Pbuf_add_field(Trim(SLSBuffer),'global',dtype_r8,(/PCOLS,PVER,nSls/),Sls_Pbf_Idx) - !! Initialize - !ALLOCATE(SlsPtr(PCOLS,PVER,BEGCHUNK:ENDCHUNK), STAT=IERR) - !IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating SlsPtr') - !SlsPtr(:,:,:) = 0.0e+0_r8 - !DO I=1,nSls - ! SlsPtr(:,:,:) = sls_ref_MMR(I) - ! CALL pbuf_set_field(pbuf2d,Sls_Pbf_Idx,SlsPtr,start=(/1,1,i/),kount=(/PCOLS,PVER,1/)) + WRITE(IULOG,'(2(A,X,I6,X))') 'CHEM_INIT CALLED ON PE ', MYCPU, ' OF ', NCPUS + + ! THE GEOS-CHEM GRIDS ON EVERY "CHUNK" WILL ALL BE THE SAME SIZE, TO AVOID + ! THE POSSIBILITY OF HAVING DIFFERENTLY-SIZED CHUNKS + NX = 1 + !NY = MAXVAL(NCOL) + NY = PCOLS + NZ = PVER + + !! ADD SHORT LIVED SPEIES TO BUFFERS + !CALL PBUF_ADD_FIELD(TRIM(SLSBUFFER),'GLOBAL',DTYPE_R8,(/PCOLS,PVER,NSLS/),SLS_PBF_IDX) + !! INITIALIZE + !ALLOCATE(SLSPTR(PCOLS,PVER,BEGCHUNK:ENDCHUNK), STAT=IERR) + !IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING SLSPTR') + !SLSPTR(:,:,:) = 0.0E+0_R8 + !DO I=1,NSLS + ! SLSPTR(:,:,:) = SLS_REF_MMR(I) + ! CALL PBUF_SET_FIELD(PBUF2D,SLS_PBF_IDX,SLSPTR,START=(/1,1,I/),KOUNT=(/PCOLS,PVER,1/)) !ENDDO - !DEALLOCATE(SlsPtr) - - ! This ensures that each process allocates everything needed for its chunks - ALLOCATE(State_Chm(BEGCHUNK:ENDCHUNK) , STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Chm') - ALLOCATE(State_Diag(BEGCHUNK:ENDCHUNK) , STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Diag') - ALLOCATE(State_Grid(BEGCHUNK:ENDCHUNK), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Grid') - ALLOCATE(State_Met(BEGCHUNK:ENDCHUNK) , STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Met') - - ! Initialize fields of the Input Options object - CALL Set_Input_Opt( am_I_Root = MasterProc, & - Input_Opt = Input_Opt, & + !DEALLOCATE(SLSPTR) + + ! THIS ENSURES THAT EACH PROCESS ALLOCATES EVERYTHING NEEDED FOR ITS CHUNKS + ALLOCATE(STATE_CHM(BEGCHUNK:ENDCHUNK) , STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING STATE_CHM') + ALLOCATE(STATE_DIAG(BEGCHUNK:ENDCHUNK) , STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING STATE_DIAG') + ALLOCATE(STATE_GRID(BEGCHUNK:ENDCHUNK), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING STATE_GRID') + ALLOCATE(STATE_MET(BEGCHUNK:ENDCHUNK) , STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING STATE_MET') + + ! INITIALIZE FIELDS OF THE INPUT OPTIONS OBJECT + CALL SET_INPUT_OPT( AM_I_ROOT = MASTERPROC, & + INPUT_OPT = INPUT_OPT, & RC = RC ) ! Set some basic flags @@ -809,12 +806,8 @@ subroutine chem_init(phys_state, pbuf2d) DO I = BEGCHUNK, ENDCHUNK - ! Only treat the first chunk as the "root" - am_I_Root = ((I.EQ.BEGCHUNK) .and. MasterProc) - ! Initialize fields of the Grid State object - CALL Init_State_Grid( am_I_Root = am_I_Root, & - State_Grid = State_Grid(I), & + CALL Init_State_Grid( State_Grid = State_Grid(I), & RC = RC ) IF ( RC /= GC_SUCCESS ) THEN @@ -827,8 +820,7 @@ subroutine chem_init(phys_state, pbuf2d) State_Grid(I)%NZ = nZ ! Initialize GEOS-Chem horizontal grid structure - CALL GC_Init_Grid( am_I_Root = am_I_Root, & - Input_Opt = Input_Opt, & + CALL GC_Init_Grid( Input_Opt = Input_Opt, & State_Grid = State_Grid(I), & RC = RC ) @@ -859,8 +851,7 @@ subroutine chem_init(phys_state, pbuf2d) ! Call the routine GC_Allocate_All (located in module file ! GeosCore/gc_environment_mod.F90) to allocate all lat/lon ! allocatable arrays used by GEOS-Chem. - CALL GC_Allocate_All ( am_I_Root = MasterProc, & - Input_Opt = Input_Opt, & + CALL GC_Allocate_All ( Input_Opt = Input_Opt, & State_Grid = State_Grid(BEGCHUNK), & value_I_Lo = 1, & value_J_Lo = 1, & @@ -884,8 +875,7 @@ subroutine chem_init(phys_state, pbuf2d) ! TODO: Mimic GEOS-Chem's reading of input options !IF (MasterProc) THEN - ! CALL Read_Input_File( am_I_Root = .True., & - ! Input_Opt = Input_Opt(BEGCHUNK), & + ! CALL Read_Input_File( Input_Opt = Input_Opt(BEGCHUNK), & ! srcFile = inputGeosPath, & ! RC = RC ) !ENDIF @@ -1113,8 +1103,7 @@ subroutine chem_init(phys_state, pbuf2d) latEdgeArr(nX+1,J) = REAL((latVal) * PI_180, f4) ENDDO - CALL SetGridFromCtrEdges( am_I_Root = MasterProc, & - State_Grid = State_Grid(L), & + CALL SetGridFromCtrEdges( State_Grid = State_Grid(L), & lonCtr = lonMidArr, & latCtr = latMidArr, & lonEdge = lonEdgeArr, & @@ -1134,8 +1123,7 @@ subroutine chem_init(phys_state, pbuf2d) ! Set the times held by "time_mod" - CALL Accept_External_Date_Time( am_I_Root = MasterProc, & - value_NYMDb = Input_Opt%NYMDb, & + CALL Accept_External_Date_Time( value_NYMDb = Input_Opt%NYMDb, & value_NHMSb = Input_Opt%NHMSb, & value_NYMDe = Input_Opt%NYMDe, & value_NHMSe = Input_Opt%NHMSe, & @@ -1172,13 +1160,11 @@ subroutine chem_init(phys_state, pbuf2d) !ENDIF !!### Print diagnostic list if needed for debugging - !IF ( prtDebug ) CALL Print_DiagList( am_I_Root, Diag_List, RC ) + !IF ( prtDebug ) CALL Print_DiagList( Diag_List, RC ) DO I = BEGCHUNK, ENDCHUNK - am_I_Root = (MasterProc .AND. (I == BEGCHUNK)) - CALL GC_Init_StateObj( am_I_Root = am_I_Root, & ! Root CPU (Y/N)? - & Diag_List = Diag_List, & ! Diagnostic list obj + CALL GC_Init_StateObj( Diag_List = Diag_List, & ! Diagnostic list obj & Input_Opt = Input_Opt, & ! Input Options & State_Chm = State_Chm(I), & ! Chemistry State & State_Diag = State_Diag(I), & ! Diagnostics State @@ -1201,8 +1187,7 @@ subroutine chem_init(phys_state, pbuf2d) IF ( Input_Opt%LDryD ) THEN ! Setup for dry deposition - CALL Init_Drydep( am_I_Root = MasterProc, & - & Input_Opt = Input_Opt, & + CALL Init_Drydep( Input_Opt = Input_Opt, & & State_Chm = State_Chm(BEGCHUNK), & & State_Diag = State_Diag(BEGCHUNK), & & State_Grid = State_Grid(BEGCHUNK), & @@ -1278,8 +1263,7 @@ subroutine chem_init(phys_state, pbuf2d) IF ( Input_Opt%LConv .OR. & Input_Opt%LWetD .OR. & Input_Opt%LChem ) THEN - CALL Init_WetScav( am_I_Root = MasterProc, & - & Input_Opt = Input_Opt, & + CALL Init_WetScav( Input_Opt = Input_Opt, & & State_Chm = State_Chm(BEGCHUNK), & & State_Diag = State_Diag(BEGCHUNK), & & State_Grid = State_Grid(BEGCHUNK), & @@ -1297,8 +1281,7 @@ subroutine chem_init(phys_state, pbuf2d) ! of logical_mod.F and tracer_mod.F.. This has to be called ! after the input.geos file has been read from disk. !----------------------------------------------------------------- - !CALL Set_VDiff_Values( am_I_Root = MasterProc, & - !& Input_Opt = Input_Opt, & + !CALL Set_VDiff_Values( Input_Opt = Input_Opt, & !& State_Chm = State_Chm(BEGCHUNK), & !& RC = RC ) @@ -1310,8 +1293,7 @@ subroutine chem_init(phys_state, pbuf2d) !----------------------------------------------------------------- ! Initialize the GET_NDEP_MOD for soil NOx deposition (bmy, 6/17/16) !----------------------------------------------------------------- - !CALL Init_Get_NDep( am_I_Root = MasterProc, & - !& Input_Opt = Input_Opt, & + !CALL Init_Get_NDep( Input_Opt = Input_Opt, & !& State_Chm = State_Chm(BEGCHUNK), & !& State_Diag = State_Diag(BEGCHUNK), & !& RC = RC ) @@ -1325,8 +1307,7 @@ subroutine chem_init(phys_state, pbuf2d) ! Initialize "carbon_mod.F" !----------------------------------------------------------------- IF ( Input_Opt%LCarb ) THEN - CALL Init_Carbon( am_I_Root = MasterProc, & - & Input_Opt = Input_Opt, & + CALL Init_Carbon( Input_Opt = Input_Opt, & & State_Chm = State_Chm(BEGCHUNK), & & State_Diag = State_Diag(BEGCHUNK), & & State_Grid = State_Grid(BEGCHUNK), & @@ -1339,8 +1320,7 @@ subroutine chem_init(phys_state, pbuf2d) ENDIF IF ( Input_Opt%LDust ) THEN - CALL Init_Dust( am_I_Root = MasterProc, & - & Input_Opt = Input_Opt, & + CALL Init_Dust( Input_Opt = Input_Opt, & & State_Chm = State_Chm(BEGCHUNK), & & State_Diag = State_Diag(BEGCHUNK), & & State_Grid = State_Grid(BEGCHUNK), & @@ -1353,8 +1333,7 @@ subroutine chem_init(phys_state, pbuf2d) ENDIF IF ( Input_Opt%LSSalt ) THEN - CALL Init_Seasalt( am_I_Root = MasterProc, & - & Input_Opt = Input_Opt, & + CALL Init_Seasalt( Input_Opt = Input_Opt, & & State_Chm = State_Chm(BEGCHUNK), & & State_Diag = State_Diag(BEGCHUNK), & & State_Grid = State_Grid(BEGCHUNK), & @@ -1367,8 +1346,7 @@ subroutine chem_init(phys_state, pbuf2d) ENDIF IF ( Input_Opt%LSulf ) THEN - CALL Init_Sulfate( am_I_Root = MasterProc, & - & Input_Opt = Input_Opt, & + CALL Init_Sulfate( Input_Opt = Input_Opt, & & State_Chm = State_Chm(BEGCHUNK), & & State_Diag = State_Diag(BEGCHUNK), & & State_Grid = State_Grid(BEGCHUNK), & @@ -1384,8 +1362,7 @@ subroutine chem_init(phys_state, pbuf2d) Input_Opt%LCarb .OR. & Input_Opt%LDust .OR. & Input_Opt%LSSalt ) THEN - CALL Init_Aerosol( am_I_Root = MasterProc, & - & Input_Opt = Input_Opt, & + CALL Init_Aerosol( Input_Opt = Input_Opt, & & State_Chm = State_Chm(BEGCHUNK), & & State_Diag = State_Diag(BEGCHUNK), & & State_Grid = State_Grid(BEGCHUNK), & @@ -1397,23 +1374,8 @@ subroutine chem_init(phys_state, pbuf2d) ENDIF ENDIF - IF ( Input_Opt%LChem ) THEN - CALL Init_Toms( am_I_Root = MasterProc, & - & Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK), & - & RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_TOMS"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ENDIF - ! This is a bare subroutine - no module - CALL NDXX_Setup( MasterProc, & - & Input_Opt, & + CALL NDXX_Setup( Input_Opt, & & State_Chm(BEGCHUNK), & & State_Grid(BEGCHUNK), & & RC ) @@ -1423,8 +1385,7 @@ subroutine chem_init(phys_state, pbuf2d) CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF - CALL Init_PBL_Mix( am_I_Root = MasterProc, & - State_Grid = State_Grid(BEGCHUNK), & + CALL Init_PBL_Mix( State_Grid = State_Grid(BEGCHUNK), & RC = RC ) IF ( RC /= GC_SUCCESS ) THEN @@ -1476,8 +1437,7 @@ subroutine chem_init(phys_state, pbuf2d) !----------------------------------------------------------------- ! Initialize the hybrid pressure module. Define Ap and Bp. !----------------------------------------------------------------- - CALL Init_Pressure( am_I_Root = MasterProc, & ! Root CPU (Y/N)? - State_Grid = State_Grid(BEGCHUNK), & ! Grid State + CALL Init_Pressure( State_Grid = State_Grid(BEGCHUNK), & ! Grid State RC = RC ) ! Success or failure ! Trapping errors @@ -1489,8 +1449,7 @@ subroutine chem_init(phys_state, pbuf2d) !----------------------------------------------------------------- ! Pass external Ap and Bp to GEOS-Chem's Pressure_Mod !----------------------------------------------------------------- - CALL Accept_External_ApBp( am_I_Root = MasterProc, & ! Root CPU (Y/N)? - State_Grid = State_Grid(BEGCHUNK), & ! Grid State + CALL Accept_External_ApBp( State_Grid = State_Grid(BEGCHUNK), & ! Grid State ApIn = Ap_CAM_Flip, & ! "A" term for hybrid grid BpIn = Bp_CAM_Flip, & ! "B" term for hybrid grid RC = RC ) ! Success or failure @@ -1514,8 +1473,7 @@ subroutine chem_init(phys_state, pbuf2d) DEALLOCATE(Ap_CAM_Flip,Bp_CAM_Flip) !! Initialize HEMCO? - !CALL Emissions_Init ( am_I_Root = MasterProc, & - ! Input_Opt = Input_Opt, & + !CALL Emissions_Init ( Input_Opt = Input_Opt, & ! State_Met = State_Met, & ! State_Chm = State_Chm, & ! State_Grid = State_Grid, & @@ -1531,8 +1489,7 @@ subroutine chem_init(phys_state, pbuf2d) #if ( ALLDDVEL_GEOSCHEM && LANDTYPE_HEMCO ) ! Populate the State_Met%LandTypeFrac field with data from HEMCO - CALL Init_LandTypeFrac( am_I_Root = MasterProc, & - Input_Opt = Input_Opt, & + CALL Init_LandTypeFrac( Input_Opt = Input_Opt, & State_Met = State_Met(BEGCHUNK), & RC = RC ) @@ -1543,8 +1500,7 @@ subroutine chem_init(phys_state, pbuf2d) ! Compute the Olson landmap fields of State_Met ! (e.g. State_Met%IREG, State_Met%ILAND, etc.) - CALL Compute_Olson_Landmap( am_I_Root = MasterProc, & - Input_Opt = Input_Opt, & + CALL Compute_Olson_Landmap( Input_Opt = Input_Opt, & State_Grid = State_Grid(BEGCHUNK), & State_Met = State_Met(BEGCHUNK), & RC = RC ) @@ -1557,8 +1513,7 @@ subroutine chem_init(phys_state, pbuf2d) ! Initialize PBL quantities but do not do mixing ! Add option for non-local PBL (Lin, 03/31/09) - CALL Init_Mixing ( am_I_Root = MasterProc, & - Input_Opt = Input_Opt, & + CALL Init_Mixing ( Input_Opt = Input_Opt, & State_Chm = State_Chm(BEGCHUNK), & State_Diag = State_Diag(BEGCHUNK), & State_Grid = State_Grid(BEGCHUNK), & @@ -1574,8 +1529,7 @@ subroutine chem_init(phys_state, pbuf2d) IF ( Input_Opt%Its_A_FullChem_Sim .OR. & Input_Opt%Its_An_Aerosol_Sim ) THEN ! This also initializes Fast-JX - CALL Init_Chemistry( am_I_Root = MasterProc, & - & Input_Opt = Input_Opt, & + CALL Init_Chemistry( Input_Opt = Input_Opt, & & State_Chm = State_Chm(BEGCHUNK), & & State_Diag = State_Diag(BEGCHUNK), & & State_Grid = State_Grid(BEGCHUNK), & @@ -1589,8 +1543,7 @@ subroutine chem_init(phys_state, pbuf2d) IF ( Input_Opt%LChem .AND. & Input_Opt%LUCX ) THEN - CALL Init_UCX( am_I_Root = MasterProc, & - & Input_Opt = Input_Opt, & + CALL Init_UCX( Input_Opt = Input_Opt, & & State_Chm = State_Chm(BEGCHUNK), & & State_Diag = State_Diag(BEGCHUNK), & & State_Grid = State_Grid(BEGCHUNK) ) @@ -2085,8 +2038,8 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use Drydep_Mod, only: Update_DryDepSav use Mixing_Mod - use Dao_Mod, only: Set_Dry_Surface_Pressure - use Dao_Mod, only: AirQnt + use Calc_Met_Mod, only: Set_Dry_Surface_Pressure + use Calc_Met_Mod, only: AirQnt use GC_Grid_Mod, only: SetGridFromCtr use Pressure_Mod, only: Set_Floating_Pressures use Pressure_Mod, only: Accept_External_Pedge @@ -2271,8 +2224,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDDO ! Update the grid - Call SetGridFromCtr( am_I_Root = rootChunk, & - State_Grid = State_Grid(LCHNK), & + Call SetGridFromCtr( State_Grid = State_Grid(LCHNK), & lonCtr = lonMidArr, & latCtr = latMidArr, & RC = RC ) @@ -2895,8 +2847,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF ! Pass time values obtained from the ESMF environment to GEOS-Chem - CALL Accept_External_Date_Time( am_I_Root = rootChunk, & - value_NYMD = currYMD, & + CALL Accept_External_Date_Time( value_NYMD = currYMD, & value_NHMS = currHMS, & value_YEAR = currYr, & value_MONTH = currMo, & @@ -2913,8 +2864,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF - CALL Accept_External_PEdge( am_I_Root = rootChunk, & - State_Met = State_Met(LCHNK), & + CALL Accept_External_PEdge( State_Met = State_Met(LCHNK), & RC = RC ) IF ( RC /= GC_SUCCESS ) THEN @@ -2945,8 +2895,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) State_Met(LCHNK)%PSC2_WET = State_Met(LCHNK)%PS1_WET State_Met(LCHNK)%PSC2_DRY = State_Met(LCHNK)%PS1_DRY - CALL Set_Floating_Pressures( am_I_Root = rootChunk, & - State_Grid = State_Grid(LCHNK), & + CALL Set_Floating_Pressures( State_Grid = State_Grid(LCHNK), & State_Met = State_Met(LCHNK), & RC = RC ) @@ -2978,8 +2927,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! (13) AIRVOL : Volume of grid box [m^3] ! (14) MOISTMW : Molecular weight of moist air in box [g/mol] ! ==================================================================== - CALL AirQnt( am_I_Root = rootChunk, & - Input_Opt = Input_Opt, & + CALL AirQnt( Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & State_Grid = State_Grid(LCHNK), & State_Met = State_Met(LCHNK), & @@ -2996,8 +2944,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! the first call to AirQnt !IF ( (.not.SCHEM_READY) .and. Input_Opt%LSCHEM ) THEN IF ( (.not.SCHEM_READY) .and. .True. ) THEN !TMMF - CALL Init_Strat_Chem( am_I_Root = rootChunk, & - Input_Opt = Input_Opt, & + CALL Init_Strat_Chem( Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & State_Met = State_Met(LCHNK), & State_Grid = State_Grid(LCHNK), & @@ -3020,8 +2967,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! (ckeller, 4/1/15) !============================================================== ! Run HEMCO Phase 1 - !CALL Emissions_Run ( am_I_Root = MasterProc, & - ! Input_Opt = Input_Opt, & + !CALL Emissions_Run ( Input_Opt = Input_Opt, & ! State_Chm = State_Chm(LCHNK), & ! State_Diag = State_Diag(LCHNK), & ! State_Grid = State_Grid(LCHNK), & @@ -3056,8 +3002,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! ! ! Copy UV Albedo data (for photolysis) into the ! ! State_Met%UVALBEDO field. (bmy, 3/20/15) - ! CALL Get_UvAlbedo( am_I_Root = MasterProc, & - ! Input_Opt = Input_Opt, & + ! CALL Get_UvAlbedo( Input_Opt = Input_Opt, & ! State_Met = State_Met(LCHNK), & ! RC = RC ) ! @@ -3070,8 +3015,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! IF ( Input_Opt%USE_TOMS_O3 ) THEN ! ! Get TOMS overhead O3 columns for photolysis from ! ! the HEMCO data structure (bmy, 3/20/15) - ! CALL Read_TOMS( am_I_Root = MasterProc, & - ! Input_Opt = Input_Opt, & + ! CALL Read_TOMS( Input_Opt = Input_Opt, & ! RC = RC ) ! ! ! Trap potential errors @@ -3086,8 +3030,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! ! Read data required for Hg2 gas-particle partitioning ! ! (H Amos, 25 Oct 2011) ! IF ( ITS_A_MERCURY_SIM ) THEN - ! CALL Read_Hg2_Partitioning( am_I_Root = MasterProc, & - ! Input_Opt = Input_Opt, & + ! CALL Read_Hg2_Partitioning( Input_Opt = Input_Opt, & ! State_Grid = State_Grid(LCHNK), & ! State_Met = State_Met(LCHNK), & ! MONTH = 1, & !TMMF @@ -3107,8 +3050,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) !IF ( ITS_A_FULLCHEM_SIM .and. id_CH4 > 0 ) THEN ! ! ! Set CH4 concentrations - ! CALL SET_CH4( am_I_Root = MasterProc, & - ! Input_Opt = Input_Opt, & + ! CALL SET_CH4( Input_Opt = Input_Opt, & ! State_Chm = State_Chm(LCHNK), & ! State_Diag = State_Diag(LCHNK), & ! State_Grid = State_Grid(LCHNK), & @@ -3124,8 +3066,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Eventually initialize/reset wetdep IF ( Input_Opt%LConv .OR. Input_Opt%LChem .OR. Input_Opt%LWetD ) THEN - CALL Setup_WetScav( am_I_Root = rootChunk, & - Input_Opt = Input_Opt, & + CALL Setup_WetScav( Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & State_Grid = State_Grid(LCHNK), & State_Met = State_Met(LCHNK), & @@ -3154,8 +3095,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! (7) F_UNDER_PBLTOP: Fraction of grid box underneath the PBL top [-] ! (8) PBL_MAX_L : Model level where PBL top occurs [-] ! ==================================================================== - CALL Compute_PBL_Height( am_I_Root = rootChunk, & - State_Grid = State_Grid(LCHNK), & + CALL Compute_PBL_Height( State_Grid = State_Grid(LCHNK), & State_Met = State_Met(LCHNK), & RC = RC ) @@ -3214,8 +3154,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) #if ( LANDTYPE_CLM ) ! Compute the Olson landmap fields of State_Met ! (e.g. State_Met%IREG, State_Met%ILAND, etc.) - CALL Compute_Olson_Landmap( am_I_Root = rootChunk, & - Input_Opt = Input_Opt, & + CALL Compute_Olson_Landmap( Input_Opt = Input_Opt, & State_Grid = State_Grid(LCHNK), & State_Met = State_Met(LCHNK), & RC = RC ) @@ -3228,8 +3167,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Compute State_Met%XLAI (for drydep) and State_Met%MODISLAI, ! which is the average LAI per grid box (for soil NOx emissions) - CALL Compute_Xlai( am_I_Root = rootChunk, & - Input_Opt = Input_Opt, & + CALL Compute_Xlai( Input_Opt = Input_Opt, & State_Grid = State_Grid(LCHNK), & State_Met = State_Met(LCHNK), & RC = RC ) @@ -3244,8 +3182,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) #if ( ALLDDVEL_GEOSCHEM || OCNDDVEL_GEOSCHEM ) ! Compute drydep velocities and update State_Chm%DryDepVel - CALL Do_Drydep( am_I_Root = rootChunk, & - Input_Opt = Input_Opt, & + CALL Do_Drydep( Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & State_Diag = State_Diag(LCHNK), & State_Grid = State_Grid(LCHNK), & @@ -3386,8 +3323,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) CALL ENDRUN('Incorrect definitions for dry deposition velocities') #endif - CALL Update_DryDepSav( am_I_Root = rootChunk, & - Input_Opt = Input_Opt, & + CALL Update_DryDepSav( Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & State_Diag = State_Diag(LCHNK), & State_Grid = State_Grid(LCHNK), & @@ -3410,8 +3346,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) !! only calculates emissions. All data has been read to disk !! in phase 1 at the beginning of the time step. !! (ckeller, 4/1/15) - !CALL Emissions_Run( am_I_Root = rootChunk, & - ! Input_Opt = Input_Opt, & + !CALL Emissions_Run( Input_Opt = Input_Opt, & ! State_Chm = State_Chmk(LCHNK), & ! State_Diag = State_Diag(LCHNK), & ! State_Grid = State_Grid(LCHNK), & @@ -3446,8 +3381,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! ! This requires HEMCO. For now comment out. ! Thibaud M. Fritz - 05/07/20 - !CALL Do_Mixing( am_I_Root = rootChunk, & - ! Input_Opt = Input_Opt, & + !CALL Do_Mixing( Input_Opt = Input_Opt, & ! State_Chm = State_Chm(LCHNK), & ! State_Diag = State_Diag(LCHNK), & ! State_Grid = State_Grid(LCHNK), & @@ -3468,8 +3402,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! ! Call the appropriate convection routine ! ! NOTE: Tracer concentration units are converted locally ! ! to [kg/kg total air] for convection (ewl, 9/18/15) - ! CALL Do_Convection( am_I_Root = rootChunk, & - ! Input_Opt = Input_Opt, & + ! CALL Do_Convection( Input_Opt = Input_Opt, & ! State_Chm = State_Chm(LCHNK), & ! State_Diag = State_Diag(LCHNK), & ! State_Grid = State_Grid(LCHNK), & @@ -3491,16 +3424,14 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) Input_Opt%Its_An_Aerosol_Sim ) THEN IF ( Input_Opt%LChem ) THEN - CALL Compute_Overhead_O3( am_I_Root = rootChunk, & - State_Grid = State_Grid(LCHNK), & + CALL Compute_Overhead_O3( State_Grid = State_Grid(LCHNK), & DAY = currDy, & USE_O3_FROM_MET = Input_Opt%Use_O3_From_Met, & TO3 = State_Met(LCHNK)%TO3 ) ENDIF ENDIF - CALL Do_Chemistry( am_I_Root = rootChunk, & - Input_Opt = Input_Opt, & + CALL Do_Chemistry( Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & State_Diag = State_Diag(LCHNK), & State_Grid = State_Grid(LCHNK), & @@ -3521,8 +3452,7 @@ subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! NOTE: Tracer concentration units are converted locally ! to [kg/m2] in wet deposition to enable calculations ! along the column (ewl, 9/18/15) - CALL Do_WetDep( am_I_Root = rootChunk, & - Input_Opt = Input_Opt, & + CALL Do_WetDep( Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & State_Diag = State_Diag(LCHNK), & State_Grid = State_Grid(LCHNK), & @@ -4038,7 +3968,6 @@ subroutine chem_final use Dust_Mod, only : Cleanup_Dust use Seasalt_Mod, only : Cleanup_Seasalt use Aerosol_Mod, only : Cleanup_Aerosol - use TOMS_Mod, only : Cleanup_Toms use Sulfate_Mod, only : Cleanup_Sulfate use Pressure_Mod, only : Cleanup_Pressure use Strat_Chem_Mod, only : Cleanup_Strat_Chem @@ -4054,7 +3983,6 @@ subroutine chem_final use GC_Emissions_Mod, only: GC_Emissions_Final INTEGER :: I, RC - LOGICAL :: am_I_Root ! Finalize GEOS-Chem IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_FINAL' @@ -4064,7 +3992,7 @@ subroutine chem_final CALL Cleanup_Carbon CALL Cleanup_Drydep CALL Cleanup_Dust - CALL Cleanup_FlexChem( am_I_Root, RC ) + CALL Cleanup_FlexChem( RC ) IF ( RC /= GC_SUCCESS ) THEN ErrMsg = 'Error encountered in "Cleanup_FlexChem"!' CALL Error_Stop( ErrMsg, ThisLoc ) @@ -4075,13 +4003,8 @@ subroutine chem_final CALL Cleanup_Seasalt CALL Cleanup_Sulfate CALL Cleanup_Strat_Chem - CALL Cleanup_Toms( MasterProc, RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Cleanup_Toms"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - CALL Cleanup_WetScav( MasterProc, RC) + CALL Cleanup_WetScav( RC) IF ( RC /= GC_SUCCESS ) THEN ErrMsg = 'Error encountered in "Cleanup_WetScav"!' CALL Error_Stop( ErrMsg, ThisLoc ) @@ -4115,12 +4038,11 @@ subroutine chem_final ! Loop over each chunk and cleanup the variables DO I = BEGCHUNK, ENDCHUNK - am_I_Root = ((I.eq.BEGCHUNK) .and. MasterProc) - CALL Cleanup_State_Chm ( am_I_Root, State_Chm(I), RC ) - CALL Cleanup_State_Diag( am_I_Root, State_Diag(I), RC ) - CALL Cleanup_State_Grid( am_I_Root, State_Grid(I), RC ) - CALL Cleanup_State_Met ( am_I_Root, State_Met(I), RC ) + CALL Cleanup_State_Chm ( State_Chm(I), RC ) + CALL Cleanup_State_Diag( State_Diag(I), RC ) + CALL Cleanup_State_Grid( State_Grid(I), RC ) + CALL Cleanup_State_Met ( State_Met(I), RC ) ENDDO CALL Cleanup_Error From 9a9ead503679507c872b20ce2aa5665c8ea6c974 Mon Sep 17 00:00:00 2001 From: Thibaud Fritz Date: Fri, 31 Jul 2020 18:56:26 -0400 Subject: [PATCH 006/160] Squashed 60+ commits from Thibaud Fritz Feat: Increase nchem_adv Feat: Define GEOS-Chem deposition species in geoschem.xml Feat: Update solsym based on gckpp_Monitor (1) solsym needs to be defined explicitely, as it is parsed at compile time. Feat: Update .exclude to now include input_mod and pops_mod.F90 Feat: Changes required to make GEOS-Chem 13.0 work with CESM Feat: Set State_Met%Salinity and Iodide to 0. Will be read from HEMCO Feat: Compute isLand/Water/Ice/Snow after AirQnt + Get fields from HEMCO (1) Get IODIDE surface concentration and SALINITY from HEMCO Feat: Kludge gaseous species names to match CESM restart file: (1) Bromine, chlorine, iodine and lumped species are not in CESM restart file. We can choose to load these from a GEOS-Chem restart file but this is future work. Feat: Rename CAM's drydep_mod to aer_drydep_mod Feat: Print dep. lists when getting from namelist Feat: Allow MAM to compile with CESM-GC Feat: Remove unused use statement Feat: Updates to make MAM4 interchange data with CESM-GC Compile time changes: (1) prescribe_aerosols is set to FALSE when $chem contains geoschem (2) Replace aerosol deposition species with MAM4 aerosols in nml files (3) Remove pp_geoschem/aero_model. Currently, GEOS-Chem only works with MAM(4) turned on. If MAM is to be switched off in the future, then the compiler should choose to compile pp_geoschem/aero_model (which is just a dummy, almost empty file) over modal_aero/aero_model.F90 Code changes: (1) Make xname_massptr a public and protected variable. It is used to establish a mapping between MAM4 and GEOS-Chem aerosols (2) Add map2MAM4(:,:) in chem_mods and set number of fixed species to 6 rather than 4 (3) Add dummy constituents for GEOS-Chem aerosols. Ideally, aerosols that are inherited from MAM should not need to be defined as a constituent. For instance, BCPI is inherited from bc_a* whereas NIT is not included and needs to be defined as a constituent (in order to be advected) (4) Establish mapping between MAM4 and GEOS-Chem aerosols. Currently, POM and SOA are not mapped. More work is needed here to figure out which GEOS-Chem aerosols should be used to map those. (5) Reverse mapping (aka from GEOS-Chem back to MAM) is not established yet. (6) Clip QI and QL to 1.0E-05 as low values (I have found values as low as 1.0E-141) can make GEOS-Chem blow up in sulfate_mod. (7) Add empty m_spc_id.F90, required by MAM4 (8) In mo_chem_utils, replace tracerNames by tracname. This is required as MAM aerosols are not in tracerNames (which only includes GEOS-Chem species). Add get_inv_ndx. I believe that this change temporarily breaks dry deposition as performed by MOZART. More investigation is needed here. (9) Add subroutine in mo_drydep to load in land types which is required for MAM4 to perform its own dry deposition (10) Add MAM4 aerosols to solsym and define inv_lst (list of fixed species) ---- TODOs: (1) Establish reverse mappings (GEOS-Chem -> MAM4) (2) Check MOZART's dry deposition routines. (3) As of right now, MAM4 performs dry deposition. Would it be possible to let GEOS-Chem perform dry deposition of aerosols? (4) What to do regarding pure GEOS-Chem aerosols (e.g. NIT)? Chore: Fix indentation + capitalization Feat: Add option to get land types from HEMCO Fix: Aerosol mapping requires more indices in MMR_Beg. Remove custom emissions Feat: Add emissions to CESM-GC Fix: Prevent emissions from adding up in CESM-GC. Reset cam_in%cflx Feat: Modify aero_model.F90 to let GEOS-Chem handle its own aerosols Fix: Resolve circular dependency Feat: Rename HCO_surf_salinity to HCO_salinity (1) The physics buffer does not allow to store strings as long as `HCO_surf_salinity` and would, for instance, store `HCO_surf_salinit`. To avoid confusion, we rename it to `HCO_salinity`, same for `HCO_iodide`. Feat: Allow CESM-GC to output dry deposition velocity used by GEOS-Chem (1) Add addfld and outfld statements for each dry deposition species, using State_Chm%DryDepVel (2) Fix to let chemistry.F90 when LANDTYPE_HEMCO is 1. Feat: Uncomment call to DO_MIXING to allow for dry deposition Feat: Change IC condition file (1) Renamed some species into their GEOS-Chem equivalent. This new IC file is a mere copy of the default file, with some species renamed Fix: Replace species number with `gas_pcnst` Feat: Reindexed GEOS-Chem species: tracers, MAM aerosols, SL species (1) This reindexing is necessary as MAM requires that there is a linear mapping (constant offset) between solsym and constituents. (2) adv_mass is now properly defined in mo_sim_dat, using GEOS-Chem values for all species, except MAM aerosols. Feat: Add runtime option to using GEOS-Chem wet deposition Feat: Add files to allow for NEU wet deposition scheme (1) Add mo_neu_wetdep (copied from MOZART) (2) Add additional files (mo_mean_mass, mo_setinv, gas_wetdep_opts) (3) Add new field in mo_neu_wetdep (WDRATE), corresponding to the wet removal rate in kg/s Feat: Add NEU WD routines + MAM gas-aerosol exchange ( 1) Added NEU wet deposition routines. Option to choose between NEU and GEOS-Chem wet deposition scheme is available at runtime. See commit #a8d642c ( 2) Added diagnostic fields for wet deposition. These match the names of the same quantities in MOZART ( 3) Added MAM gas-aerosol exchange ( 4) Rename field DDVel and SurfFlux into DepVel and DepFlux. Might need to change those in the future to match those in MOZART ( 5) Established MAM4 aerosol to GEOS-Chem species mapping based on discussion with Louisa Emmons ( 6) Added inverse mapping map2GCinv hat maps tracers onto constituent. This is now used in chem_emissions. ( 7) Added map2chm which maps solsym onto GEOS-Chem species and constituents ( 8) Remove special handlings when defining constituents. Variable names are now changed in the IC file. ( 9) Compute CSZAmid field (10) Fix bug where qH2O was flipped vertically Feat: Get UVALBEDO from HEMCO *CAM only defines albedo during daytime. However, UVALBEDO is only used for photolysis, which should be fine. Feat: Define MaxTrop/StratLev from grid + Add Set_H2O_Trac Feat: Add OH and JRates diagnostics. Feat: Get H2O mmr from specific humidity (1) GEOS-Chem's water mass mixing ratio is derived from CAM's specific humidity (2) Additionally, the JRates diagnostics are only computed if they are an output field Chore: Remove unnecessary comment Fix: Unit check failed because 'kg/ kg dry' /= 'kg/kg dry' Feat: Remove special handlings as we now use GEOS-Chem IC (1) Previously GEOS-Chem species were modified to account for the species in the CAM restart file (e.g. HNO2 vs HONO). Now, we just use GEOS-Chem initial conditions that have been regridded to ~0.9x1.25 Feat: Add option to pass H2O tendency to Q + change some addfld Feat: Set State_Met%OMEGA equal to state%omega Feat: Allow CESM-GC to compute overhead ozone from State_Chm%Species Feat: Allow CESM-GC runs to be restartable Feat: Implement 3-D emissions. (1) Surface emissions (layer PVER) are passed to cam_in%cflx while the non-surface emissions are added directly to the chemical tendencies (2) Dry deposition fluxes are now passed to cam_in%cflx such that: cam_in%cflx = eflx - dflx (3) Remove call to DO_MIXING as this is now handled by CAM. Feat: Replace tracerNames with solsym in chem_implements_cnst Feat: Changes required by GEOS-Chem 13.0.0 Feat: Move compile time flags to run time flags for DD velocities Feat: Read OMOC from HEMCO and store in State_Chm Feat: Move all GEOS-Chem related diagnostics to cesmgc_diag_mod.F90 Feat: Add missing initialization of ThisLoc and ErrMsg Feat: Add option to output State_Met in cesmgc_diag_mod.F90 Feat: Update GEOS-Chem branch in Externals_CAM.cfg to be `CESM` Feat: Replace pp_geoschem with geoschem Feat: Reset MAM-inherited aerosols to 0 before mapping (1) Resetting MAM-inherited aerosols in State_Chm%Species allows these aerosols to not accumulate over time. Otherwise, we would have for instance: BCPI = BCPI + MAM4, which would accumulate overtime if BCPI was not reset (2) Lowered the threshold on QI and QL to 1.0E-10 rather than 1.0E-05 Feat: Add MAM aerosols to cesmgc_diag_mod Feat: Add lightning emissions Feat: Add MEGAN emissions Feat: Symbolic link to mozart/mo_lightning Feat: Add symbolic link to MOZART files, rather than copy Feat: Add lightning, MEGAN, aerosol and fire emissions Feat: Remote WDRATE_* from CAM history fields Fix: Molar weight pFe Fix: Add to_upper to tracerNames, required since 'pFe' /= 'PFE' Chore: Try lower and uppercase tracernames when getting data from pbuf Fix: Handle cases where ncol /= pcols Chore: Add note explaining why DQRLSAN needs to be zero in top layer Feat: Pass GEOS-Chem aerosol emissions to MAM tendencies Fix: Fix typo SO4S vs SOAS Feat: Enforce lq('Q') to be true if passing H2O tendencies: (1) lq(cQ) = .True. if applyQTend is True (2) iFirstCnst is now a variable in chem_mods (3) Reset cam_in%cflx for all species (including MAM aerosols) Feat: Only diagnose wet deposition rates of soluble species Feat: Skip emissions on first time step before HEMCO fills in data Feat: Add chem_is-like function in mo_chm_utls Fix: Fix typo Feat: Add or rename some output fields: (1) Add option to save out chemical tendencies (kg/kg/s or kg/s) (2) Rename output fluxes to match CAM-Chem Feat: Add _CLFX and other CAM-Chem like diagnostics to CESM-GC Feat: Add new GC compsets that mimic CAM-Chem compsets: (1) New compsets (2) Enforce NTHRDS_ATM to be 1 when running with GEOS-Chem Feat: Add new use_cases XML entries for newly added GC compsets Feat: Turn on rad_prog_ozone for GEOS-Chem chemistry Feat: Implement CAM-Chem like diagnostics for CESM-GC: (1) Rename diagnostics to match CAM-Chem's (2) Only perform diagnostics computations if field is an output. Use hist_fld_active whenever a call to outfld is performed. Feat: Make sure that GC's SOAGX species is not picked up by MAM Fix: Remove debug statement in cesmgc_diag_mod Feat: Add mmr tendencies for MAM aerosols from chemistry Feat: Replace DO loops with array element-wise operations Feat: Set NTHRDS_*=1 when using a GEOS-Chem compset Feat: Make SDYN compset with GEOS-Chem have 56 levs Feat: Pass chemical tendencies to MAM aerosols: (1) Changes in aerosol concentrations due to GEOS-Chem processing is now passed to chemical tendencies for MAM aerosols (2) Wet deposition of MAM-inherited aerosols is not performed in GEOS-Chem. To do so, we define a new logical `WD_ExternalDep` in SpcInfo Feat: Remove mass-weighted OH concentration diagnostics Feat: Add CO2 as constituent Feat: Compute CO2 chemical tendencies: (1) GEOS-Chem overwrites CO2 concentrations at every time step. We thus set State_Chm%Species(:,:,:,iCO2) = 0.0e+00 before chemistry and compute chemical tendencies based on how much CO2 has been produced. (2) Cleanup Feat: Apply CAM-Chem surface boundary conditions for long-lived species Feat: Remove hardwired path to GEOS-Chem CHEM_INPUTS directory Feat: Remove hard-wired paths for GEOS-Chem inputs: (1) All input files are now (one-time) copied from geoschem_src/run/CESM to Buildconf/camconf. Then to the run folder every time builnml is called Feat: Read from input.geos Feat: Read input.geos rather than hard-wiring input options Feat: Add check to make sure that solsym is following list of GC tracer Chore: Clean up in short_lived_species Fix: Fix wrong reference MMR Chore: Cleanup, remove unused MWRatio and longNames Feat: Update .exclude to exclude gosat and tccon from GEOS-Chem folder Feat: Get strat_chem data from HEMCO Feat: Add timers around DO_CHEMISTRY + Fix diagnostic in WetDep Feat: Remove PSO4 diagnostic (write statement) Fix: Fix diagnostics of emissions Feat: Remove option to let GEOS-Chem perform wet scavenging. (1) The only option to perform convective scavenging in CESM-GC is currently to rely on the NEU scheme, which handles large-scale precipitation and convective scavening. Since the variables required by the GEOS-Chem convective routines cannot be extracted easily, we rely on the NEU scheme to perform washout due to both LS precipitation and convective scavenging for gases AND aerosols. (2) A next commit will follow to specify Henry coefficients of aerosols. The best option is to probably set something similar as HNO3 Feat: Make non-MAM GC aerosols "gas-like" species for wet&dry dep (1) Move all GC aerosols from aer_drydep_list to drydep_list and from aer_wetdep_list to gas_wetdep_list (see previous commits too) (2) This allows to remove the 'GC_AER_' terminology for GC aerosols (3) Aerosol emission fluxes (e.g. BCPI) are now passed directly to MAM (e.g. flux to bc_a4). This allows for the removal of some interfacing code in cesmgc_emissions_mod.F90 (4) Fix diagnostic naming issues (e.g. replaced WD_HBR with WD_HBr) (5) Remove extra bit of code in cesmgc_diag_mod dealing with wet dep in GEOS-Chem, which had been removed in previous commits (6) In mo_neu_wetdep.F90, make all GC aerosols be removed like HNO3 (7) Revert previous changes in modal_aero that used to deal with GC aerosols in aer_drydep_list Signed-off-by: Thibaud Fritz --- Externals_CAM.cfg | 4 +- bld/build-namelist | 54 +- bld/config_files/definition.xml | 2 +- bld/configure | 35 +- bld/namelist_files/namelist_definition.xml | 12 +- bld/namelist_files/use_cases/geoschem.xml | 37 +- .../use_cases/hist_geoschem.xml | 172 + bld/namelist_files/use_cases/sd_geoschem.xml | 177 + bld/perl5lib/Build/ChemNamelist.pm | 12 +- cime_config/buildnml | 48 +- cime_config/config_component.xml | 29 +- cime_config/config_compsets.xml | 35 +- cime_config/config_pes.xml | 12 + .../{drydep_mod.F90 => aer_drydep_mod.F90} | 4 +- src/chemistry/bulk_aero/aero_model.F90 | 22 +- .../{pp_geoschem => geoschem}/.exclude | 8 +- src/chemistry/geoschem/cesmgc_diag_mod.F90 | 1460 ++++++ .../geoschem/cesmgc_emissions_mod.F90 | 540 +++ .../charge_neutrality.F90 | 0 .../{pp_geoschem => geoschem}/chem_mods.F90 | 50 +- .../chem_prod_loss_diags.F90 | 0 src/chemistry/geoschem/chemistry.F90 | 4215 +++++++++++++++++ .../{pp_geoschem => geoschem}/clybry_fam.F90 | 0 .../epp_ionization.F90 | 0 src/chemistry/geoschem/fire_emissions.F90 | 1 + src/chemistry/geoschem/gas_wetdep_opts.F90 | 79 + .../getLandTypes.F90 | 0 src/chemistry/geoschem/m_spc_id.F90 | 3 + .../{pp_geoschem => geoschem}/mo_apex.F90 | 0 src/chemistry/geoschem/mo_chem_utls.F90 | 180 + .../{pp_geoschem => geoschem}/mo_drydep.F90 | 191 + .../mo_gas_phase_chemdr.F90 | 0 src/chemistry/geoschem/mo_ghg_chem.F90 | 1 + src/chemistry/geoschem/mo_lightning.F90 | 1 + src/chemistry/geoschem/mo_mean_mass.F90 | 1 + src/chemistry/geoschem/mo_neu_wetdep.F90 | 1798 +++++++ src/chemistry/geoschem/mo_setinv.F90 | 1 + .../{pp_geoschem => geoschem}/mo_sim_dat.F90 | 335 +- .../{pp_geoschem => geoschem}/mo_tracname.F90 | 2 +- .../{pp_geoschem => geoschem}/rate_diags.F90 | 0 .../short_lived_species.F90 | 8 - src/chemistry/geoschem/tracer_cnst.F90 | 1 + src/chemistry/geoschem/tracer_srcs.F90 | 1 + .../{pp_geoschem => geoschem}/upper_bc.F90 | 0 src/chemistry/modal_aero/aero_model.F90 | 10 +- src/chemistry/modal_aero/modal_aero_data.F90 | 4 +- src/chemistry/mozart/mo_chem_utls.F90 | 12 + src/chemistry/pp_geoschem/aero_model.F90 | 1150 ----- src/chemistry/pp_geoschem/chemistry.F90 | 4160 ---------------- src/chemistry/pp_geoschem/gc_emissions.F90 | 76 - src/chemistry/pp_geoschem/mo_chem_utls.F90 | 162 - src/chemistry/pp_geoschem/mo_lightning.F90 | 182 - 52 files changed, 9287 insertions(+), 6000 deletions(-) create mode 100644 bld/namelist_files/use_cases/hist_geoschem.xml create mode 100644 bld/namelist_files/use_cases/sd_geoschem.xml rename src/chemistry/aerosol/{drydep_mod.F90 => aer_drydep_mod.F90} (99%) rename src/chemistry/{pp_geoschem => geoschem}/.exclude (84%) create mode 100644 src/chemistry/geoschem/cesmgc_diag_mod.F90 create mode 100644 src/chemistry/geoschem/cesmgc_emissions_mod.F90 rename src/chemistry/{pp_geoschem => geoschem}/charge_neutrality.F90 (100%) rename src/chemistry/{pp_geoschem => geoschem}/chem_mods.F90 (71%) rename src/chemistry/{pp_geoschem => geoschem}/chem_prod_loss_diags.F90 (100%) create mode 100644 src/chemistry/geoschem/chemistry.F90 rename src/chemistry/{pp_geoschem => geoschem}/clybry_fam.F90 (100%) rename src/chemistry/{pp_geoschem => geoschem}/epp_ionization.F90 (100%) create mode 120000 src/chemistry/geoschem/fire_emissions.F90 create mode 100644 src/chemistry/geoschem/gas_wetdep_opts.F90 rename src/chemistry/{pp_geoschem => geoschem}/getLandTypes.F90 (100%) create mode 100644 src/chemistry/geoschem/m_spc_id.F90 rename src/chemistry/{pp_geoschem => geoschem}/mo_apex.F90 (100%) create mode 100644 src/chemistry/geoschem/mo_chem_utls.F90 rename src/chemistry/{pp_geoschem => geoschem}/mo_drydep.F90 (94%) rename src/chemistry/{pp_geoschem => geoschem}/mo_gas_phase_chemdr.F90 (100%) create mode 120000 src/chemistry/geoschem/mo_ghg_chem.F90 create mode 120000 src/chemistry/geoschem/mo_lightning.F90 create mode 120000 src/chemistry/geoschem/mo_mean_mass.F90 create mode 100644 src/chemistry/geoschem/mo_neu_wetdep.F90 create mode 120000 src/chemistry/geoschem/mo_setinv.F90 rename src/chemistry/{pp_geoschem => geoschem}/mo_sim_dat.F90 (81%) rename src/chemistry/{pp_geoschem => geoschem}/mo_tracname.F90 (90%) rename src/chemistry/{pp_geoschem => geoschem}/rate_diags.F90 (100%) rename src/chemistry/{pp_geoschem => geoschem}/short_lived_species.F90 (96%) create mode 120000 src/chemistry/geoschem/tracer_cnst.F90 create mode 120000 src/chemistry/geoschem/tracer_srcs.F90 rename src/chemistry/{pp_geoschem => geoschem}/upper_bc.F90 (100%) delete mode 100644 src/chemistry/pp_geoschem/aero_model.F90 delete mode 100644 src/chemistry/pp_geoschem/chemistry.F90 delete mode 100644 src/chemistry/pp_geoschem/gc_emissions.F90 delete mode 100644 src/chemistry/pp_geoschem/mo_chem_utls.F90 delete mode 100644 src/chemistry/pp_geoschem/mo_lightning.F90 diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 906d81c24c..f7ccf98a07 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -27,9 +27,9 @@ tag = v2.0.3cesm/src required = True [geoschem] -local_path = src/chemistry/pp_geoschem/geoschem_src +local_path = src/chemistry/geoschem/geoschem_src protocol = git -branch = feature/13.0.0+CESM +branch = CESM repo_url = https://github.com/CESM-GC/geos-chem required = True diff --git a/bld/build-namelist b/bld/build-namelist index 7d8374fe81..c0e4bc0a25 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -665,7 +665,7 @@ my $rad_prog_bcarb = (($prog_species =~ "BC" or $aero_chem) and !($chem_rad_pa my $rad_prog_sulf = (($prog_species =~ "SO4" or $aero_chem) and !($chem_rad_passive)); my $rad_prog_dust = (($prog_species =~ "DST" or $aero_chem) and !($chem_rad_passive)); my $rad_prog_sslt = (($prog_species =~ "SSLT" or $aero_chem) and !($chem_rad_passive)); -my $rad_prog_ozone = (($chem =~ "mozart" or $chem =~ "waccm_ma" or $chem =~ "tsmlt" or $chem =~ "trop_strat") and !($chem_rad_passive)); +my $rad_prog_ozone = (($chem =~ "mozart" or $chem =~ "waccm_ma" or $chem =~ "tsmlt" or $chem =~ "trop_strat" or $chem =~ /geoschem/) and !($chem_rad_passive)); # Check for eruptive volcano emissions. These will be radiatively active by default, but # only if using BAM and the camrt radiation package @@ -707,6 +707,11 @@ if ( ($chem ne 'none') or ( $prog_species ) ){ add_default($nl, 'gas_wetdep_method' ); add_default($nl, 'gas_wetdep_list', 'val'=>$gas_wetdep_list ); } + + if ($chem =~ /geoschem/) { + $prescribe_aerosols = $FALSE; + } + if (length($aer_wetdep_list)>2){ # determine if prescribed aerosols are not needed ... if ($aer_wetdep_list =~ /so4/i && @@ -740,6 +745,10 @@ if ( ($chem ne 'none') or ( $prog_species ) ){ if (length($aer_drydep_list)>2){ add_default($nl, 'aer_drydep_list', 'val'=>$aer_drydep_list ); } + $nl->set_variable_value('aerosol_nl', 'aer_drydep_list', $aer_drydep_list); + $nl->set_variable_value('aerosol_nl', 'aer_wetdep_list', $aer_wetdep_list); + $nl->set_variable_value('drydep_inparm', 'drydep_list', $gas_drydep_list); + $nl->set_variable_value('wetdep_inparm', 'gas_wetdep_list', $gas_wetdep_list); } if ($chem) { # Dry Deposition -- The responsibility for dry deposition is shared between CAM and CLM. @@ -981,7 +990,7 @@ my $radval = "'A:Q:H2O'"; if (($chem =~ /waccm_ma/ or $chem =~ /waccm_tsmlt/) and !$chem_rad_passive) { $radval .= ",'A:O2:O2','A:CO2:CO2'"; } -elsif ($chem =~ /trop_strat/ and !$chem_rad_passive) { +elsif (($chem =~ /trop_strat/ or $chem =~ /geoschem/) and !$chem_rad_passive) { $radval .= ",'N:O2:O2','A:CO2:CO2'"; } elsif ($co2_cycle and !$co2_cycle_rad_passive) { @@ -2070,7 +2079,38 @@ if (($chem =~ /geoschem/ or $chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $ } } -if ($chem =~ /geoschem/ or $chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) { +if ($chem =~ /geoschem/) { + + my $val; + + # Species with fixed lower boundary + $val = "'CH4','OCS','N2O','CO2','CFC11','CFC12'"; + + if ($chem_has_ocs) { + $val .= ",'OCS'"; + } + if (chem_has_species($cfg, 'SF6')) { + $val .= ",'SF6'"; + } + add_default($nl, 'flbc_list', 'val'=>$val); + unless (defined $nl->get_value('flbc_type')) { + add_default($nl, 'flbc_type', 'val'=>'CYCLICAL'); + add_default($nl, 'flbc_cycle_yr', 'val'=>'2000'); + } + + my @files; + # Datasets + #@files = ( 'soil_erod_file', 'flbc_file', + # 'xs_coef_file','xs_short_file', + # 'xs_long_file', 'rsf_file', + # 'exo_coldens_file', 'sulf_file' ); + @files = ( 'soil_erod_file', 'flbc_file' ); + foreach my $file (@files) { + add_default($nl, $file); + } +} + +if ($chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) { my $val; @@ -2085,8 +2125,6 @@ if ($chem =~ /geoschem/ or $chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $c if ($chem =~ /_tsmlt_mam/ or $chem =~ /trop_strat/) { $val = "'CCL4','CF2CLBR','CF3BR','CFC11','CFC113','CFC12','CH3BR','CH3CCL3','CH3CL','CH4','CO2'" .",'H2','HCFC22','N2O','CFC114','CFC115','HCFC141B','HCFC142B','CH2BR2','CHBR3','H2402'"; - } elsif ($chem =~ /geoschem/) { - $val = "'CH4','OCS','N2O','CO2','CFC11','CFC12'"; } else { $val = "'CH4','H2','N2O','CO2','CFC11','CFC12'"; } @@ -2367,7 +2405,7 @@ if ($chem =~ /_mam4/ and $phys =~ /cam6/) { 'num_a2_cv_ext_file' => 'num_a2', ); - # air craft emissions + # aircraft emissions if ($chem !~ /trop_mam/ and $chem !~ /waccm_sc/) { %species = (%species, 'bc_a4_ar_ext_file' => 'bc_a4', @@ -2422,7 +2460,7 @@ if ($chem =~ /_mam4/ and $phys =~ /cam6/) { } # MEGAN emissions - if ($chem =~ /trop_strat/ or $chem =~ /_tsmlt/) { + if ($chem =~ /trop_strat/ or $chem =~ /_tsmlt/ or $chem =~ /geoschem/) { my $val = "'ISOP = isoprene'," . "'MTERP = pinene_a + carene_3 + thujene_a + 2met_styrene + cymene_p + cymene_o + terpinolene + bornene " . "+ fenchene_a + ocimene_al + pinene_b + sabinene + camphene + limonene + phellandrene_a + terpinene_g " @@ -2863,7 +2901,7 @@ if (!$simple_phys) { } # tropopause level used in gas-phase / aerosol processes -if (($chem ne 'none') and ($chem ne 'terminator')) { +if (($chem ne 'none') and ($chem ne 'terminator') and !($chem =~ /geoschem/)) { add_default($nl, 'chem_use_chemtrop'); } diff --git a/bld/config_files/definition.xml b/bld/config_files/definition.xml index e6a6055002..e9d8c38697 100644 --- a/bld/config_files/definition.xml +++ b/bld/config_files/definition.xml @@ -97,7 +97,7 @@ test_radiative (Radiatively Active Dust), test_swelling (Sea Salt), test_tracers Chemistry package: trop_mam3 trop_mam4 trop_mam7 trop_mozart trop_strat_mam4_vbs trop_strat_mam4_vbsext waccm_ma waccm_mad waccm_mad_mam4 waccm_ma_mam4 waccm_ma_sulfur waccm_sc waccm_sc_mam4 waccm_tsmlt_mam4 terminator none - + Chemistry package: trop_mam3 trop_mam4 trop_mam7 trop_mozart trop_strat_mam4_vbs trop_strat_mam4_vbsext waccm_ma waccm_mad waccm_mad_mam4 waccm_ma_mam4 waccm_ma_sulfur waccm_sc waccm_sc_mam4 waccm_tsmlt_mam4 terminator GEOS-Chem none diff --git a/bld/configure b/bld/configure index 459fda9916..56673cb754 100755 --- a/bld/configure +++ b/bld/configure @@ -124,7 +124,7 @@ OPTIONS [ trop_mam3 | trop_mam4 | trop_mam7 | trop_mozart | trop_strat_mam4_vbs | trop_strat_mam4_vbsext | waccm_ma | waccm_mad | waccm_mad_mam4 | waccm_ma_mam4 | waccm_ma_sulfur | waccm_sc | waccm_sc_mam4 | waccm_tsmlt_mam4 | - terminator | geoschem | none ]. + terminator | geoschem | geoschem_mam4 | none ]. Default: trop_mam4 for cam6 and trop_mam3 for cam5. -clm_vers Version of land model to use. This option is only used when chem is set to 'geoschem'. @@ -673,7 +673,7 @@ if (defined $opts{'chem'}) { # If the user has specified a simple physics package... if ($simple_phys) { # the only valid chemistry options are 'none', 'terminator' and 'geoschem' - if (($chem_pkg ne 'none') and ($chem_pkg ne 'terminator') and ($chem_pkg ne 'geoschem')) { + if (($chem_pkg ne 'none') and ($chem_pkg ne 'terminator') and !($chem_pkg =~ 'geoschem')) { die "configure ERROR: -phys=$phys_pkg -chem=$chem_pkg\n". " -chem can only be set to 'none', 'terminator' or 'geoschem'.\n"; } @@ -1392,7 +1392,11 @@ my $chem_cppdefs = ''; my $chem_src_dir = ''; if (!$prog_species) { - $chem_src_dir = "$cam_dir/src/chemistry/pp_$chem_pkg"; + if ($chem_pkg =~ 'geoschem') { + $chem_src_dir = "$cam_dir/src/chemistry/geoschem"; + } else { + $chem_src_dir = "$cam_dir/src/chemistry/pp_$chem_pkg"; + } $cfg_ref->set('chem_src_dir', $chem_src_dir); } @@ -1438,7 +1442,7 @@ if ($chem_pkg =~ '_mam3') { if ($chem_pkg =~ 'geoschem') { $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING -DLINUX_IFORT -DUSE_REAL8 -DMODEL_ -DMODEL_CESM'; # TMMF - Temporary fix - $chem_nadv = 200; + $chem_nadv = 250; if (defined $opts{'clm_vers'}) { if ($opts{'clm_vers'} =~ 'CLM4.0') { $chem_cppdefs .= ' -DCLM40' @@ -2826,13 +2830,17 @@ sub write_filepath } if ($chem_src_dir) { print $fh "$chem_src_dir\n"; - if ($chem_pkg eq 'geoschem') { + if ($chem_pkg =~ 'geoschem') { print $fh "$chem_src_dir/geoschem_src/GeosCore\n"; print $fh "$chem_src_dir/geoschem_src/GeosUtil\n"; print $fh "$chem_src_dir/geoschem_src/Headers\n"; print $fh "$chem_src_dir/geoschem_src/ISORROPIA\n"; - print $fh "$chem_src_dir/geoschem_src/KPP/Standard\n"; } -# print $fh "$camsrcdir/cam/src/chemistry/pp_geoschem\n"; } + print $fh "$chem_src_dir/geoschem_src/KPP/fullchem\n"; + if ($chem =~ /_mam/) { + print $fh "$camsrcdir/src/chemistry/modal_aero\n"; + print $fh "$camsrcdir/src/chemistry/aerosol\n"; + } + } } if ($waccmx) { @@ -2872,17 +2880,14 @@ sub write_filepath # -- Added by MSL - 1/2018 # -- Updated by TMMF - 11/2019 - if ($chem_pkg ne 'geoschem') { - print $fh "$camsrcdir/cam/src/chemistry/mozart\n"; + if (!($chem_pkg =~ 'geoschem')) { + print $fh "$camsrcdir/src/chemistry/mozart\n"; if ($chem =~ /_mam/) { - print $fh "$camsrcdir/cam/src/chemistry/modal_aero\n"; + print $fh "$camsrcdir/src/chemistry/modal_aero\n"; } else { - print $fh "$camsrcdir/cam/src/chemistry/bulk_aero\n"; + print $fh "$camsrcdir/src/chemistry/bulk_aero\n"; } - print $fh "$camsrcdir/cam/src/chemistry/aerosol\n"; -# } -# else { -# print $fh "$camsrcdir/cam/src/chemistry/mozart\n"; + print $fh "$camsrcdir/src/chemistry/aerosol\n"; } # -- print $fh "$camsrcdir/src/chemistry/utils\n"; diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 3424886ca4..92d0a579b6 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4009,11 +4009,17 @@ Full pathname of AMIE inputs for southern hemisphere. Default: NONE. + + +Full pathname to GEOS-Chem chemistry inputs directory +Default: set by build-namelist. + + -Full pathname of dataset for coefficient data used in Weimer05 -high latitude electric potential model. +Full pathname to HEMCO_Config.rc, which prescribes emission inventories Default: set by build-namelist. @@ -4736,7 +4742,7 @@ radiatively passive. Default: FALSE - Wet deposition method used MOZ --> mozart scheme is used diff --git a/bld/namelist_files/use_cases/geoschem.xml b/bld/namelist_files/use_cases/geoschem.xml index 14e8f7a9ba..ce495dbfb2 100644 --- a/bld/namelist_files/use_cases/geoschem.xml +++ b/bld/namelist_files/use_cases/geoschem.xml @@ -1,54 +1,56 @@ - - + 00010101 367.0e-6 -atm/cam/inic/fv/cami-chem_1990-01-01_1.9x2.5_L26_c080114.nc +/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ + +/glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f09_f09.134.1975.009.cam.i.2010-01-01_32L_c170403.nc - +/glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f19_f19.134.1975.009.cam.i.2010-01-01_32L_c170403.nc + +>&gt; Solar constant from Lean (via Caspar Ammann) &lt;/!</! atm/cam/solar/spectral_irradiance_Lean_1610-2009_ann_c100405.nc 20000101 FIXED - +>&gt; Prescribed BAM data is from Jean-Francois Lamarque &lt;/!</! atm/cam/chem/trop_mozart_aero/aero aero_1.9x2.5_L26_1850-2005_c091112.nc CYCLICAL 2000 - +>&gt; aerosol deposition &lt;/!</! atm/cam/chem/trop_mozart_aero/aero aerosoldep_monthly_2000_mean_1.9x2.5_c090421.nc CYCLICAL 2000 - +>&gt; Prescribed ozone data is from Jean-Francois Lamarque &lt;/!</! atm/cam/ozone ozone_1.9x2.5_L26_1850-2005_c090803.nc O3 CYCLICAL 2000 -.true. 'xactive_lnd' - +>&gt; sim_year used for CLM datasets &lt;/!</! 2000 - +>&gt; fixed lower boundary data &lt;/!</! 2000 atm/waccm/lb/LBC_1765-2500_1.9x2.5_CMIP5_RCP45_za_c120204.nc CYCLICAL - +>&gt; emissions timing &lt;/!</! - +>&gt; &amp;lt;ext_frc_type&amp;gt;'SERIAL'&amp;lt;/ext_frc_type&amp;gt; &lt;/!</! 'CYCLICAL' 2000 - +>&gt; History Files &lt;/!</! 1, 24 0, -1 @@ -63,20 +65,19 @@ - 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','BR2','BRNO3','CH2O','HCHO','CLNO3','DHDN','EOH','ETHLN','GLYC','GLYX','H2O2','HAC','HBR','HC187','HCL','HCOOH','HNO3','HOBR','HOCL','HONIT','HPALD','IEPOXA','IEPOXB','IEPOXD','IMAE','IPMN','ISN1','ISN1OG','ISOPNB','ISOPND','LIMO','LVOC','MACR','MACRN','MAP','MGLY','MONITS','MONITU','MTPA','MTPO','MVK','MVKN','N2O5','NH3','NO2','NPMN','O3','OPOG1','OPOG2','PAN','POG1','POG2','PPN','PROPNN','R4N2','RIPA','RIPB','RIPD','SO2','HOI','I2','IBR','ICL','HI','IONO','IONO2','I2O2','I2O3','I2O4','H2SO4','TSOG0','TSOG1','TSOG2','TSOG3' + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','BrNO3','CH2O','Cl2','ClNO2','ClNO3','ClO','ClOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg0','Hg0_ANT','Hg0_ARC','Hg0_ATL','Hg0_BB','Hg0_CAM','Hg0_CAN','Hg0_EAF','Hg0_EAS','Hg0_EEU','Hg0_EUR','Hg0_GEO','Hg0_JPN','Hg0_MDE','Hg0_NAF','Hg0_NAT','Hg0_NPA','Hg0_OCE','Hg0_OCN','Hg0_SAF','Hg0_SAM','Hg0_SAS','Hg0_SAT','Hg0_SEA','Hg0_SO','Hg0_SOV','Hg0_STR','Hg0_USA','Hg0_WAF','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3Strat','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', - 'ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','DST1','DSTAL1','NITD1','SO4D1','DST2','DSTAL2','NITD2','SO4D2','DST3','DSTAL3','NITD3','SO4D3','DST4','DSTAL4','NITD4','SO4D4','INDIOL','IONITA','ISN1OA','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITS','OCPI','OCPO','OPOA1','OPOA2','PFE','POA1','POA2','SALA','SALC','SO4','SO4S','SOAIE','SOAGX','SOAME','SOAMG','SOAS','TSOA0','TSOA1','TSOA2','TSOA3','BRSALA','BRSALC','ISALA','ISALC','AERI' + 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','BR2','CH2O','HCHO','DHDN','EOH','ETHLN','GLYC','GLYX','H2O2','HAC','HBR','HCL','HCOOH','HNO3','HOBR','HOCL','HONIT','IEPOXA','IEPOXB','IEPOXD','IMAE','ISN1','ISN1OG','ISOPNB','ISOPND','LIMO','LVOC','MACRN','MAP','MGLY','MOBA','MONITS','MONITU','MP','CH3OOH','MTPA','MTPO','MVKN','NH3','OPOG1','OPOG2','POG1','POG2','PROPNN','RIPA','RIPB','RIPD','SO2','TSOG0','TSOG1','TSOG2','TSOG3','HOI','I2','IBR','ICL','HI','IONO','IONO2','I2O2','I2O3','I2O4','H2SO4' + 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', - 'ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','DST1','DSTAL1','NITD1','SO4D1','DST2','DSTAL2','NITD2','SO4D2','DST3','DSTAL3','NITD3','SO4D3','DST4','DSTAL4','NITD4','SO4D4','INDIOL','IONITA','ISN1OA','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITS','OCPI','OCPO','OPOA1','OPOA2','PFE','POA1','POA2','SALA','SALC','SO4','SO4S','SOAIE','SOAGX','SOAME','SOAMG','SOAS','TSOA0','TSOA1','TSOA2','TSOA3','BRSALA','BRSALC','ISALA','ISALC','AERI' + 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml new file mode 100644 index 0000000000..606e409b36 --- /dev/null +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -0,0 +1,172 @@ + + + + +00010101 + +/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ + +/glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f09_f09.134.1975.009.cam.i.2010-01-01_32L_c170403.nc + +/glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f19_f19.134.1975.009.cam.i.2010-01-01_32L_c170403.nc + + +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc + + +.true. +.true. +.false. +0.25D0 + +SERIAL +atm/waccm/lb/LBC_1750-2014_CMIP6_0p5degLat_c170126.nc + + SERIAL + + + +INTERP_MISSING_MONTHS + +INTERP_MISSING_MONTHS + +'noy', 'nhx' + + + + 1,30,365,240,240,480,365,73,30 + 0,-24,-24,-3,-1,1,-24,-120,-240 +'A','A','A','A','A','A','A','A','I' + +.true. +.false. +.false. +.false. +.false. +.false. +.false. +.false. +.false. + + + + 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', + 'LNO_COL_PROD', 'NO2_CLXF', 'SFNO', 'SFNH3', 'BRO', + 'CH3CL', 'CLO', 'CO2', 'HCL', 'HO2', 'HOCL', 'H2O', 'PHIS', 'Z3', + 'BENZ', 'C2H6', 'C3H8', 'CCL4', 'CFC11', 'CFC113', 'CFC12', + 'CH2O', 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'ACET', 'MOH', 'CH4', + 'CO', 'H2O2', 'HCFC22', 'HNO3', 'ISOP', 'MTPA', 'N2O', 'O3', + 'PAN', 'SO2', 'OH', 'ALK4', 'PRPE', 'BR', 'BRCL', 'BRO', 'BRNO3', + 'EOH', 'ETP', 'PRPE', 'RA3P', 'CCL4', 'H1211', 'H1301', + 'CFC11', 'CFC113', 'CFC114', 'CFC115', 'CFC12', 'CH2BR2', 'CH2O', + 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'MGLY', 'ACTA', 'MAP', 'MP', + 'CH4', 'CHBR3', 'CL', 'CL2', 'CL2O2', 'CLO', 'CLNO3', 'CO', + 'CO2', 'DMS', 'GLYC', 'GLYX', + 'H', 'H2', 'H2402', 'H2O2', 'HBR', 'HCFC141B', 'HCFC142B', 'HCFC22', + 'HCL', 'HNO3', 'HNO4', 'HOBR', 'HOCL', 'HONIT', 'HPALD1', 'HPALD2', 'HPALD3', + 'HPALD4', 'HAC', 'HC5A', 'IEPOXA', 'IEPOXB', 'IEPOXD', 'ISOP', 'IHN1', 'IHN2', 'IHN3', + 'IHN4', 'INO2B', 'INO2D', 'INPB', 'INPD', 'RIPA', 'RIPB', 'RIPC', 'RIPD', + 'MACR', 'MVKHP', 'MEK', 'MCRDH', 'MPAN', 'MVK', 'N', 'N2O', 'N2O5', 'ICN', + 'NH3', 'NH4', 'NO', 'NO2', 'NO3', 'PROPNN', 'OLND', 'OLNN', 'O', 'OCLO', + 'OCS', 'PAN', 'SO2', 'SO4', 'SOAP', 'TOLU', 'XYLE', + 'R4O2', 'BRO2', 'ETO2', 'A3O2', 'MCO3', 'MO2', 'HO2', 'O1D', 'OH', + 'H2O', 'SAD_PSC', 'SAD_SULFC', 'SAD_TROP', 'SAD_AERO', 'REFF_AERO', + 'PDELDRY', 'RAD_PSC', 'RAD_SULFC', + 'HNO3_GAS', 'HNO3_STS', 'HNO3_NAT', 'NOX', 'NOY', 'CLOX', 'CLOY', + 'BROX', 'BROY', 'TCLY', 'TOTH', 'MASS', 'TBRY', 'HCL_GAS', + 'HCL_GAS', 'dgnumwet1', 'dgnumwet2', 'dgnumwet3', 'ABSORB', + 'AODVISdn', 'AODdnMODE1', 'AODVISstdn', 'AODNIRstdn', + 'AODUVstdn', 'AODdnMODE2', 'AODdnMODE3', 'AODdnDUST1', 'AODdnDUST2', + 'AODdnDUST3', 'AODVISstdn', 'AODUVstdn', 'AODNIRstdn', + 'AODNIRstdn', 'AODVISdn', 'AODUVdn', 'EXTINCTdn', 'EXTxASYMdn', + 'EXTINCTNIRdn', 'EXTINCTUVdn', + 'WD_EOH', 'WD_ETP', 'WD_RA3P', 'WD_CH2O', 'WD_ALD2', + 'WD_MGLY', 'WD_ACTA', 'WD_MAP', 'WD_MOH', 'WD_MP', + 'WD_GLYC', 'WD_H2O2', 'WD_SO4', 'WD_HBr', 'WD_HCl', + 'WD_HNO3', 'WD_HOBr', 'WD_HOCl', 'WD_HONIT', 'WD_HAC', 'WD_IEPOXA', + 'WD_IEPOXB', 'WD_IEPOXD', 'WD_MVK', 'WD_NH3', 'WD_NH4', 'WD_SO2', + 'DF_EOH', 'DF_ETP', 'DF_RA3P', 'DF_CH2O', 'DF_ALD2', 'DF_ACET', + 'DF_MGLY', 'DF_ACTA', 'DF_MAP', 'DF_MOH', 'DF_MP', 'DF_CO', + 'DF_GLYC', 'DF_H2O2', 'DF_SO4', 'DF_HNO3', 'DF_HNO4', + 'DF_HONIT', 'DF_HPALD1', 'DF_HPALD2', 'DF_HPALD3', 'DF_HPALD4', + 'DF_HAC', 'DF_IEPOXA', 'DF_IEPOXB', 'DF_IEPOXD', + 'DF_MPAN', 'DF_NH3', 'DF_NH4', 'DF_NO', + 'DF_NO2', 'DF_O3', 'DF_PAN', 'DF_SO2', + 'DF_SOAP', 'SO2_CLXF', 'SO2_XFRC', + 'CO_CLXF', 'NO2_CLXF', 'LNO_PROD', 'LNO_COL_PROD', 'SOAP_CLXF', + 'SFEOH', 'SFALD2', 'SFMEK', 'SFCH2O', 'SFC2H6', 'SFC3H8', + 'SFALK4', 'SFPRPE', 'SFBENZ', 'SFTOLU', 'SFXYLE', + 'SFNO', 'SFACTA', 'SFDMS', 'SFMEK', 'SFSO2', 'SFNH3', + 'SFISOP', 'SFMTPA', 'SFMOH', 'SFACET', 'SFCO', 'SFSOAP', + 'MEG_ISOP', 'MEG_MTERP', 'MEG_BCARY', 'MEG_CH3OH', 'MEG_C2H5OH', 'MEG_CH2O', + 'MEG_CH3CHO', 'MEG_CH3COOH', 'MEG_CH3COCH3', 'MEG_HCOOH', 'MEG_HCN', 'MEG_CO', + 'MEG_C2H6', 'MEG_C2H4', 'MEG_C3H8', 'MEG_C3H6', 'MEG_BIGALK', 'MEG_BIGENE', + 'MEG_TOLUENE', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', + 'DHNO3CHM', 'DH2O2CHM', 'DO3CHM', 'DCOCHM', 'AQ_SO2', 'GS_SO2', 'SO2_CLXF', + 'MASS', 'ABSORB', + 'Jval_O3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', + 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a1', + 'ncl_a2', 'ncl_a3', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', + 'soa1_a1', 'soa2_a1', 'soa3_a1', 'soa4_a1', 'soa5_a1', 'soa1_a2', 'soa2_a2', 'soa3_a2', + 'soa4_a2', 'soa5_a2', 'bc_c1', 'bc_c4', 'dst_c1', 'dst_c2', 'dst_c3', 'ncl_c1', 'ncl_c1', + 'ncl_c2', 'ncl_c3', 'pom_c1', 'pom_c4', 'so4_c1', 'so4_c2', 'so4_c3', 'soa1_c1', 'soa2_c1', + 'soa3_c1', 'soa4_c1', 'soa5_c1', 'soa1_c2', 'soa2_c2', 'soa3_c2', 'soa4_c2', 'soa5_c2', + 'bc_a1SFWET', 'num_a1','num_a2','num_a3','num_a4','num_c1','num_c2','num_c3','num_c4', + 'bc_a1SFWET', 'bc_a4SFWET', 'dst_a1SFWET', 'dst_a2SFWET', 'dst_a3SFWET', 'ncl_a1SFWET', + 'ncl_a2SFWET', 'ncl_a3SFWET', 'pom_a1SFWET', 'pom_a4SFWET', + 'so4_a1SFWET', 'so4_a2SFWET', 'so4_a3SFWET', 'soa1_a1SFWET', 'soa1_a2SFWET', + 'soa2_a1SFWET', 'soa2_a2SFWET', 'soa3_a1SFWET', 'soa3_a2SFWET', + 'soa4_a1SFWET', 'soa4_a2SFWET', 'soa5_a1SFWET', 'soa5_a2SFWET', 'bc_c1SFWET', + 'bc_c4SFWET', 'dst_c1SFWET', 'dst_c2SFWET', 'dst_c3SFWET', + 'ncl_c1SFWET', 'ncl_c2SFWET', 'ncl_c3SFWET', 'pom_c1SFWET', 'pom_c4SFWET', + 'so4_c1SFWET', 'so4_c2SFWET', 'so4_c3SFWET', 'soa1_c1SFWET', + 'soa1_c2SFWET', 'soa2_c1SFWET', 'soa2_c2SFWET', 'soa3_c1SFWET', 'soa3_c2SFWET', + 'soa4_c1SFWET', 'soa4_c2SFWET', 'soa5_c1SFWET', 'soa5_c2SFWET', + 'bc_a1DDF', 'bc_a4DDF', 'dst_a1DDF', 'dst_a2DDF', 'dst_a3DDF', 'ncl_a1DDF', + 'ncl_a2DDF', 'ncl_a3DDF', 'pom_a1DDF', + 'pom_a4DDF', 'so4_a1DDF', 'so4_a2DDF', 'so4_a3DDF', 'soa1_a1DDF', + 'soa1_a2DDF', 'soa2_a1DDF', 'soa2_a2DDF', 'soa3_a1DDF', + 'soa3_a2DDF', 'soa4_a1DDF', 'soa4_a2DDF', 'soa5_a1DDF', 'soa5_a2DDF', + 'bc_c1DDF', 'bc_c4DDF', 'dst_c1DDF', 'dst_c2DDF', + 'dst_c3DDF', 'ncl_c1DDF', 'ncl_c2DDF', 'ncl_c3DDF', 'pom_c1DDF', + 'pom_c4DDF', 'so4_c1DDF', 'so4_c2DDF', 'so4_c3DDF', + 'soa1_c1DDF', 'soa1_c2DDF', 'soa2_c1DDF', 'soa2_c2DDF', 'soa3_c1DDF', + 'soa3_c2DDF', 'soa4_c1DDF', 'soa4_c2DDF', 'soa5_c1DDF', + 'soa5_c2DDF', 'num_a1DDF', 'num_a2DDF', 'num_a3DDF', 'num_a4DDF', + 'num_c1DDF', 'num_c2DDF', 'num_c3DDF', 'num_c4DDF', + 'bc_a4_CLXF', 'pom_a4_CLXF', 'so4_a1_CLXF', 'so4_a2_CLXF', + 'num_a1_CLXF', 'num_a2_CLXF', 'SFbc_a4', 'SFpom_a4', 'SFso4_a1', + 'SFso4_a2', 'SFnum_a1', 'SFnum_a2', 'SFnum_a3', 'so4_a1_sfgaex1', + 'so4_a2_sfgaex1', 'so4_a3_sfgaex1', 'soa1_a1_sfgaex1', 'soa1_a2_sfgaex1', + 'soa2_a1_sfgaex1', 'soa2_a2_sfgaex1', 'soa3_a1_sfgaex1', 'soa3_a2_sfgaex1', + 'soa4_a1_sfgaex1', 'soa4_a2_sfgaex1', 'soa5_a1_sfgaex1', 'soa5_a2_sfgaex1', + 'so4_a2_sfnnuc1', 'so4_c1AQH2SO4', 'so4_c2AQH2SO4', 'so4_c3AQH2SO4', + 'so4_c1AQSO4', 'so4_c2AQSO4', 'so4_c3AQSO4', 'SFdst_a1', 'SFdst_a2', 'SFdst_a3', + 'SFncl_a1', 'SFncl_a2', 'SFncl_a3', + 'TMOCS', 'TMSO2', 'TMso4_a1', 'TMso4_a2', 'TMso4_a3', + 'BURDENDUSTdn', 'BURDENPOMdn', 'BURDENSO4dn', 'BURDENSOAdn', + 'BURDENSEASALTdn','BURDENBCdn', 'PM25' + + + + + + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','BrNO3','CH2O','Cl2','ClNO2','ClNO3','ClO','ClOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg0','Hg0_ANT','Hg0_ARC','Hg0_ATL','Hg0_BB','Hg0_CAM','Hg0_CAN','Hg0_EAF','Hg0_EAS','Hg0_EEU','Hg0_EUR','Hg0_GEO','Hg0_JPN','Hg0_MDE','Hg0_NAF','Hg0_NAT','Hg0_NPA','Hg0_OCE','Hg0_OCN','Hg0_SAF','Hg0_SAM','Hg0_SAS','Hg0_SAT','Hg0_SEA','Hg0_SO','Hg0_SOV','Hg0_STR','Hg0_USA','Hg0_WAF','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3Strat','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + + + + 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + + 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + + + + 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml new file mode 100644 index 0000000000..40d1799727 --- /dev/null +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -0,0 +1,177 @@ + + + + +20050101 + +/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ + +/glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f09_f09.134.1975.009.cam.i.2010-01-01_56L_c170403.nc +atm/cam/met/MERRA2/0.9x1.25/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_MERRA2_c171218.nc + +atm/cam/met/MERRA2/0.5x0.63/fv_0.47x0.63_nc3000_Co030_Fi001_PF_nullRR_Nsw021_MERRA2_c180612.nc + +50. +.true. + +2005/MERRA2_0.9x1.25_20050101.nc +atm/cam/met/MERRA2/0.9x1.25 +atm/cam/met/MERRA2/0.9x1.25/filenames_1975-2017_c190125.txt + +2010/MERRA2_0.5x0.63_20100101.nc +atm/cam/met/MERRA2/0.5x0.63 +atm/cam/met/MERRA2/0.5x0.63/filenames_list_c180612 + + +atm/cam/solar/SolarForcingNRLSSI2_daily_s18820101_e20171231_c191122.nc +SERIAL + + +.true. +.true. +.false. +0.25D0 + + +SERIAL +atm/waccm/lb/LBC_1750-2014_CMIP6_0p5degLat_c170126.nc + + + +INTERP_MISSING_MONTHS + +INTERP_MISSING_MONTHS + + + + 1,30,365,240,240,480,365,73,30 + 0,-24,-24,-3,-1,1,-24,-120,-240 +'A','A','A','A','A','A','A','A','I' + +.true. +.false. +.false. +.false. +.false. +.false. +.false. +.false. +.false. + + + + 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', + 'LNO_COL_PROD', 'NO2_CLXF', 'SFNO', 'SFNH3', 'BRO', + 'CH3CL', 'CLO', 'CO2', 'HCL', 'HO2', 'HOCL', 'H2O', 'PHIS', 'Z3', + 'BENZ', 'C2H6', 'C3H8', 'CCL4', 'CFC11', 'CFC113', 'CFC12', + 'CH2O', 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'ACET', 'MOH', 'CH4', + 'CO', 'H2O2', 'HCFC22', 'HNO3', 'ISOP', 'MTPA', 'N2O', 'O3', + 'PAN', 'SO2', 'OH', 'ALK4', 'PRPE', 'BR', 'BRCL', 'BRO', 'BRNO3', + 'EOH', 'ETP', 'PRPE', 'RA3P', 'CCL4', 'H1211', 'H1301', + 'CFC11', 'CFC113', 'CFC114', 'CFC115', 'CFC12', 'CH2BR2', 'CH2O', + 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'MGLY', 'ACTA', 'MAP', 'MP', + 'CH4', 'CHBR3', 'CL', 'CL2', 'CL2O2', 'CLO', 'CLNO3', 'CO', + 'CO2', 'DMS', 'GLYC', 'GLYX', + 'H', 'H2', 'H2402', 'H2O2', 'HBR', 'HCFC141B', 'HCFC142B', 'HCFC22', + 'HCL', 'HNO3', 'HNO4', 'HOBR', 'HOCL', 'HONIT', 'HPALD1', 'HPALD2', 'HPALD3', + 'HPALD4', 'HAC', 'HC5A', 'IEPOXA', 'IEPOXB', 'IEPOXD', 'ISOP', 'IHN1', 'IHN2', 'IHN3', + 'IHN4', 'INO2B', 'INO2D', 'INPB', 'INPD', 'RIPA', 'RIPB', 'RIPC', 'RIPD', + 'MACR', 'MVKHP', 'MEK', 'MCRDH', 'MPAN', 'MVK', 'N', 'N2O', 'N2O5', 'ICN', + 'NH3', 'NH4', 'NO', 'NO2', 'NO3', 'PROPNN', 'OLND', 'OLNN', 'O', 'OCLO', + 'OCS', 'PAN', 'SO2', 'SO4', 'SOAP', 'TOLU', 'XYLE', + 'R4O2', 'BRO2', 'ETO2', 'A3O2', 'MCO3', 'MO2', 'HO2', 'O1D', 'OH', + 'H2O', 'SAD_PSC', 'SAD_SULFC', 'SAD_TROP', 'SAD_AERO', 'REFF_AERO', + 'PDELDRY', 'RAD_PSC', 'RAD_SULFC', + 'HNO3_GAS', 'HNO3_STS', 'HNO3_NAT', 'NOX', 'NOY', 'CLOX', 'CLOY', + 'BROX', 'BROY', 'TCLY', 'TOTH', 'MASS', 'TBRY', 'HCL_GAS', + 'HCL_GAS', 'dgnumwet1', 'dgnumwet2', 'dgnumwet3', 'ABSORB', + 'AODVISdn', 'AODdnMODE1', 'AODVISstdn', 'AODNIRstdn', + 'AODUVstdn', 'AODdnMODE2', 'AODdnMODE3', 'AODdnDUST1', 'AODdnDUST2', + 'AODdnDUST3', 'AODVISstdn', 'AODUVstdn', 'AODNIRstdn', + 'AODNIRstdn', 'AODVISdn', 'AODUVdn', 'EXTINCTdn', 'EXTxASYMdn', + 'EXTINCTNIRdn', 'EXTINCTUVdn', + 'WD_EOH', 'WD_ETP', 'WD_RA3P', 'WD_CH2O', 'WD_ALD2', + 'WD_MGLY', 'WD_ACTA', 'WD_MAP', 'WD_MOH', 'WD_MP', + 'WD_GLYC', 'WD_H2O2', 'WD_SO4', 'WD_HBr', 'WD_HCl', + 'WD_HNO3', 'WD_HOBr', 'WD_HOCl', 'WD_HONIT', 'WD_HAC', 'WD_IEPOXA', + 'WD_IEPOXB', 'WD_IEPOXD', 'WD_MVK', 'WD_NH3', 'WD_NH4', 'WD_SO2', + 'DF_EOH', 'DF_ETP', 'DF_RA3P', 'DF_CH2O', 'DF_ALD2', 'DF_ACET', + 'DF_MGLY', 'DF_ACTA', 'DF_MAP', 'DF_MOH', 'DF_MP', 'DF_CO', + 'DF_GLYC', 'DF_H2O2', 'DF_SO4', 'DF_HNO3', 'DF_HNO4', + 'DF_HONIT', 'DF_HPALD1', 'DF_HPALD2', 'DF_HPALD3', 'DF_HPALD4', + 'DF_HAC', 'DF_IEPOXA', 'DF_IEPOXB', 'DF_IEPOXD', + 'DF_MPAN', 'DF_NH3', 'DF_NH4', 'DF_NO', + 'DF_NO2', 'DF_O3', 'DF_PAN', 'DF_SO2', + 'DF_SOAP', 'SO2_CLXF', 'SO2_XFRC', + 'CO_CLXF', 'NO2_CLXF', 'LNO_PROD', 'LNO_COL_PROD', 'SOAP_CLXF', + 'SFEOH', 'SFALD2', 'SFMEK', 'SFCH2O', 'SFC2H6', 'SFC3H8', + 'SFALK4', 'SFPRPE', 'SFBENZ', 'SFTOLU', 'SFXYLE', + 'SFNO', 'SFACTA', 'SFDMS', 'SFMEK', 'SFSO2', 'SFNH3', + 'SFISOP', 'SFMTPA', 'SFMOH', 'SFACET', 'SFCO', 'SFSOAP', + 'MEG_ISOP', 'MEG_MTERP', 'MEG_BCARY', 'MEG_CH3OH', 'MEG_C2H5OH', 'MEG_CH2O', + 'MEG_CH3CHO', 'MEG_CH3COOH', 'MEG_CH3COCH3', 'MEG_HCOOH', 'MEG_HCN', 'MEG_CO', + 'MEG_C2H6', 'MEG_C2H4', 'MEG_C3H8', 'MEG_C3H6', 'MEG_BIGALK', 'MEG_BIGENE', + 'MEG_TOLUENE', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', + 'DHNO3CHM', 'DH2O2CHM', 'DO3CHM', 'DCOCHM', 'AQ_SO2', 'GS_SO2', 'SO2_CLXF', + 'MASS', 'ABSORB', + 'Jval_O3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', + 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a1', + 'ncl_a2', 'ncl_a3', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', + 'soa1_a1', 'soa2_a1', 'soa3_a1', 'soa4_a1', 'soa5_a1', 'soa1_a2', 'soa2_a2', 'soa3_a2', + 'soa4_a2', 'soa5_a2', 'bc_c1', 'bc_c4', 'dst_c1', 'dst_c2', 'dst_c3', 'ncl_c1', 'ncl_c1', + 'ncl_c2', 'ncl_c3', 'pom_c1', 'pom_c4', 'so4_c1', 'so4_c2', 'so4_c3', 'soa1_c1', 'soa2_c1', + 'soa3_c1', 'soa4_c1', 'soa5_c1', 'soa1_c2', 'soa2_c2', 'soa3_c2', 'soa4_c2', 'soa5_c2', + 'bc_a1SFWET', 'num_a1','num_a2','num_a3','num_a4','num_c1','num_c2','num_c3','num_c4', + 'bc_a1SFWET', 'bc_a4SFWET', 'dst_a1SFWET', 'dst_a2SFWET', 'dst_a3SFWET', 'ncl_a1SFWET', + 'ncl_a2SFWET', 'ncl_a3SFWET', 'pom_a1SFWET', 'pom_a4SFWET', + 'so4_a1SFWET', 'so4_a2SFWET', 'so4_a3SFWET', 'soa1_a1SFWET', 'soa1_a2SFWET', + 'soa2_a1SFWET', 'soa2_a2SFWET', 'soa3_a1SFWET', 'soa3_a2SFWET', + 'soa4_a1SFWET', 'soa4_a2SFWET', 'soa5_a1SFWET', 'soa5_a2SFWET', 'bc_c1SFWET', + 'bc_c4SFWET', 'dst_c1SFWET', 'dst_c2SFWET', 'dst_c3SFWET', + 'ncl_c1SFWET', 'ncl_c2SFWET', 'ncl_c3SFWET', 'pom_c1SFWET', 'pom_c4SFWET', + 'so4_c1SFWET', 'so4_c2SFWET', 'so4_c3SFWET', 'soa1_c1SFWET', + 'soa1_c2SFWET', 'soa2_c1SFWET', 'soa2_c2SFWET', 'soa3_c1SFWET', 'soa3_c2SFWET', + 'soa4_c1SFWET', 'soa4_c2SFWET', 'soa5_c1SFWET', 'soa5_c2SFWET', + 'bc_a1DDF', 'bc_a4DDF', 'dst_a1DDF', 'dst_a2DDF', 'dst_a3DDF', 'ncl_a1DDF', + 'ncl_a2DDF', 'ncl_a3DDF', 'pom_a1DDF', + 'pom_a4DDF', 'so4_a1DDF', 'so4_a2DDF', 'so4_a3DDF', 'soa1_a1DDF', + 'soa1_a2DDF', 'soa2_a1DDF', 'soa2_a2DDF', 'soa3_a1DDF', + 'soa3_a2DDF', 'soa4_a1DDF', 'soa4_a2DDF', 'soa5_a1DDF', 'soa5_a2DDF', + 'bc_c1DDF', 'bc_c4DDF', 'dst_c1DDF', 'dst_c2DDF', + 'dst_c3DDF', 'ncl_c1DDF', 'ncl_c2DDF', 'ncl_c3DDF', 'pom_c1DDF', + 'pom_c4DDF', 'so4_c1DDF', 'so4_c2DDF', 'so4_c3DDF', + 'soa1_c1DDF', 'soa1_c2DDF', 'soa2_c1DDF', 'soa2_c2DDF', 'soa3_c1DDF', + 'soa3_c2DDF', 'soa4_c1DDF', 'soa4_c2DDF', 'soa5_c1DDF', + 'soa5_c2DDF', 'num_a1DDF', 'num_a2DDF', 'num_a3DDF', 'num_a4DDF', + 'num_c1DDF', 'num_c2DDF', 'num_c3DDF', 'num_c4DDF', + 'bc_a4_CLXF', 'pom_a4_CLXF', 'so4_a1_CLXF', 'so4_a2_CLXF', + 'num_a1_CLXF', 'num_a2_CLXF', 'SFbc_a4', 'SFpom_a4', 'SFso4_a1', + 'SFso4_a2', 'SFnum_a1', 'SFnum_a2', 'SFnum_a3', 'so4_a1_sfgaex1', + 'so4_a2_sfgaex1', 'so4_a3_sfgaex1', 'soa1_a1_sfgaex1', 'soa1_a2_sfgaex1', + 'soa2_a1_sfgaex1', 'soa2_a2_sfgaex1', 'soa3_a1_sfgaex1', 'soa3_a2_sfgaex1', + 'soa4_a1_sfgaex1', 'soa4_a2_sfgaex1', 'soa5_a1_sfgaex1', 'soa5_a2_sfgaex1', + 'so4_a2_sfnnuc1', 'so4_c1AQH2SO4', 'so4_c2AQH2SO4', 'so4_c3AQH2SO4', + 'so4_c1AQSO4', 'so4_c2AQSO4', 'so4_c3AQSO4', 'SFdst_a1', 'SFdst_a2', 'SFdst_a3', + 'SFncl_a1', 'SFncl_a2', 'SFncl_a3', + 'TMOCS', 'TMSO2', 'TMso4_a1', 'TMso4_a2', 'TMso4_a3', + 'BURDENDUSTdn', 'BURDENPOMdn', 'BURDENSO4dn', 'BURDENSOAdn', + 'BURDENSEASALTdn','BURDENBCdn', 'PM25' + + + + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','BrNO3','CH2O','Cl2','ClNO2','ClNO3','ClO','ClOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg0','Hg0_ANT','Hg0_ARC','Hg0_ATL','Hg0_BB','Hg0_CAM','Hg0_CAN','Hg0_EAF','Hg0_EAS','Hg0_EEU','Hg0_EUR','Hg0_GEO','Hg0_JPN','Hg0_MDE','Hg0_NAF','Hg0_NAT','Hg0_NPA','Hg0_OCE','Hg0_OCN','Hg0_SAF','Hg0_SAM','Hg0_SAS','Hg0_SAT','Hg0_SEA','Hg0_SO','Hg0_SOV','Hg0_STR','Hg0_USA','Hg0_WAF','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3Strat','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + + + + 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + + 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + + + + 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + diff --git a/bld/perl5lib/Build/ChemNamelist.pm b/bld/perl5lib/Build/ChemNamelist.pm index 0cf0114337..5f95ad9f2f 100644 --- a/bld/perl5lib/Build/ChemNamelist.pm +++ b/bld/perl5lib/Build/ChemNamelist.pm @@ -66,31 +66,35 @@ sub set_dep_lists if ($print_lvl>=2) {print "Chemistry species : @species_list \n" ;} if (!defined $nl->get_value('gas_wetdep_list')) { - $gas_wetdep_list = get_gas_wetdep_list( $cfgdir, $print_lvl, @species_list ); + $gas_wetdep_list = get_gas_wetdep_list( $cfgdir, $print_lvl, @species_list ); } else { $gas_wetdep_list = $nl->get_value('gas_wetdep_list'); $gas_wetdep_list = filter_dep_list( $gas_wetdep_list, $print_lvl, @species_list ); + if ($print_lvl>=2) {print " gas wet dep list : $gas_wetdep_list \n" ;} } if (!defined $nl->get_value('aer_wetdep_list')) { - $aer_wetdep_list = get_aer_wetdep_list( $cfgdir, $print_lvl, @species_list ); + $aer_wetdep_list = get_aer_wetdep_list( $cfgdir, $print_lvl, @species_list ); } else { $aer_wetdep_list = $nl->get_value('aer_wetdep_list'); $aer_wetdep_list = filter_dep_list( $aer_wetdep_list, $print_lvl, @species_list ); + if ($print_lvl>=2) {print " aer wet dep list : $aer_wetdep_list \n" ;} } if (!defined $nl->get_value('drydep_list')) { - $gas_drydep_list = get_gas_drydep_list( $cfgdir, $print_lvl, @species_list ); + $gas_drydep_list = get_gas_drydep_list( $cfgdir, $print_lvl, @species_list ); } else { $gas_drydep_list = $nl->get_value('drydep_list'); $gas_drydep_list = filter_dep_list( $gas_drydep_list, $print_lvl, @species_list ); + if ($print_lvl>=2) {print " dry dep list : $gas_drydep_list \n" ;} } if (!defined $nl->get_value('aer_drydep_list')) { - $aer_drydep_list = get_aer_drydep_list( $cfgdir, $print_lvl, @species_list ); + $aer_drydep_list = get_aer_drydep_list( $cfgdir, $print_lvl, @species_list ); } else { $aer_drydep_list = $nl->get_value('aer_drydep_list'); $aer_drydep_list = filter_dep_list( $aer_drydep_list, $print_lvl, @species_list ); + if ($print_lvl>=2) {print " aer dry dep list : $aer_drydep_list \n" ;} } # set solubility factors for aerosols diff --git a/cime_config/buildnml b/cime_config/buildnml index b12f690263..cb3a9412e9 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -36,6 +36,7 @@ def buildnml(case, caseroot, compname): din_loc_root = case.get_value("DIN_LOC_ROOT") atm_ncpl = case.get_value("ATM_NCPL") CAM_NAMELIST_OPTS = case.get_value("CAM_NAMELIST_OPTS") + CAM_CONFIG_OPTS = case.get_value("CAM_CONFIG_OPTS") CAM_NML_USE_CASE = case.get_value("CAM_NML_USE_CASE") DEBUG = case.get_value("DEBUG") NINST_ATM = case.get_value("NINST_ATM") @@ -175,17 +176,52 @@ def buildnml(case, caseroot, compname): rc, out, err = run_cmd(cmd, from_dir=camconf) expect(rc==0,"Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) + # ----------------------------------------------------- + # For GEOS-Chem / HEMCO only: + # Copy input files from storage location into Buildconf/camconf + # This only needs to be done once + # ----------------------------------------------------- + + # We use this to figure out if we are using the GEOS-Chem chemistry + # mechanism. + # Might have to do something else with HEMCO_CESM? + if '-chem geoschem' in CAM_CONFIG_OPTS: + geoschem_src = os.path.join(srcroot, "src/chemistry/geoschem/geoschem_src") + if not os.path.isdir(geoschem_src): + raise SystemExit("ERROR: Did not find path to GEOS-Chem source code at {:s}".format(geoschem_src)) + if os.path.isdir(rundir): + for fileName in ['species_database.yml', 'input.geos', + 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc']: + file1 = os.path.join(geoschem_src, "run/CESM", fileName) + file2 = os.path.join(camconf, fileName) + if not os.path.exists(file2): + logger.info("CAM namelist one-time copy: file1 %s file2 %s ", file1, file2) + shutil.copy(file1,file2) + # ----------------------------------------------------- # copy resolved namelist, atm_in, to rundir # ----------------------------------------------------- if os.path.isdir(rundir): - file1 = os.path.join(camconf, "atm_in") - file2 = os.path.join(rundir, "atm_in") - if ninst > 1: - file2 += inst_string - logger.info("CAM namelist copy: file1 %s file2 %s ", file1, file2) - shutil.copy(file1,file2) + for fileName in ['atm_in', 'species_database.yml', 'input.geos', + 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc']: + file1 = os.path.join(camconf, fileName) + file2 = os.path.join(rundir, fileName) + if fileName == 'atm_in' and ninst > 1: + file2 += inst_string + if os.path.exists(file1) or fileName == 'atm_in': + logger.info("CAM namelist copy: file1 %s file2 %s ", file1, file2) + shutil.copy(file1,file2) + + if fileName == 'input.geos': + # We need to replace the simulation name by "Standard" + # in input.geos + # This should already be the case, but just making sure + with open(file2, 'r') as file: + inputGC = file.read() + inputGC = inputGC.replace('{SIM}', 'Standard') + with open(file2, 'w') as file: + file.write(inputGC) # ----------------------------------------------------- # copy drv_flds_in to rundir if it does not exist diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index fdc00f964b..c700a521ea 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -8,10 +8,10 @@ CAM =============== --> - CAM cam6 physics: - CAM cam5 physics: - CAM cam4 physics: - CAM simplified and non-versioned physics : + CAM cam6 physics: + CAM cam5 physics: + CAM cam4 physics: + CAM simplified and non-versioned physics : CAM-Chem troposphere/stratosphere chem with simplified volatility basis set SOA scheme and modal aersols : + GEOS-Chem troposphere/stratosphere chemistry : CAM-Chem troposphere/stratosphere chem with simplified volatility basis set SOA scheme and fire emissons : CAM CLUBB - turned on by default in CAM60: - CAM-Chem troposphere/stratosphere chem with extended volatility basis set SOA scheme and modal aersols : + CAM-Chem troposphere/stratosphere chem with extended volatility basis set SOA scheme and modal aerosols : CAM CO2 ramp: CAM super-parameterized CAM one moment SAM microphysics CAM super-parameterized CAM one moment SAM microphysics using CLUBB CAM super-parameterized CAM double moment m2005 SAM microphysics + CAM super-parameterized CAM double moment m2005 SAM microphysics using GEOS-Chem CAM super-parameterized CAM double moment m2005 SAM microphysics using CLUBB CAM tropospheric chemistry with bulk aerosols: @@ -65,7 +67,6 @@ CAM dry adiabatic baroclinic instability (Polvani et al., 2004): CAM moist Held-Suarez forcing (Thatcher and Jablonowski, 2016): CAM dry Held-Suarez forcing (Held and Suarez (1994)): - CAM with GEOS-Chem: CAM with GEOS-Chem dycore test: CAM moist dynamical core test with Ullrich et al. (2014) baroclinic wave IC, Kessler physics and terminator chemistry: @@ -119,12 +120,14 @@ -chem trop_strat_mam4_vbs + -chem geoschem_mam4 -chem trop_strat_mam4_vbsext -clubb_sgs -dyn eul -scam -rad camrt -chem none -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_sam1mom -rad camrt -chem none -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_sam1mom -spcam_clubb_sgs -rad rrtmg -chem trop_mam3 -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_m2005 + -rad rrtmg -chem geoschem_mam3 -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_m2005 -rad rrtmg -chem trop_mam3 -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_m2005 -spcam_clubb_sgs -chem trop_mozart @@ -147,6 +150,7 @@ -offline_dyn -nlev 56 -nlev 56 + -nlev 56 -nlev 88 -nlev 145 @@ -157,6 +161,7 @@ -phys tj2016 -analytic_ic -phys held_suarez -chem geoschem + -chem geoschem_mam4 -phys held_suarez -chem geoschem -analytic_ic -phys kessler -chem terminator -analytic_ic @@ -195,11 +200,17 @@ 2000_cam4_trop_chem waccmxie_ma_2000_cam4 + geoschem + geoschem + geoschem + geoschem_baro_moist + 2000_cam6 waccm_tsmlt_2000_cam6 waccm_ma_2000_cam6 waccm_sc_2000_cam6 2000_trop_strat_vbs_cam6 + geoschem_2000 aquaplanet_cam4 aquaplanet_cam4 @@ -212,6 +223,7 @@ 2010_trop_strat_vbs_cam6 waccm_tsmlt_2010_cam6 waccm_sc_2010_cam6 + geoschem_2010 1850-2005_cam5 1850-2005_cam4 @@ -229,6 +241,7 @@ hist_trop_strat_vbs_cam6 hist_trop_strat_vbsext_cam6 hist_trop_strat_vbsfire_cam6 + hist_geoschem 1850-PD_cam5 @@ -250,6 +263,7 @@ sd_waccm_ma_cam6 sd_waccm_ma_cam4 sd_trop_strat_vbs_cam6 + sd_geoschem sd_cam6 dabi_p2004 @@ -260,9 +274,6 @@ scam_arm97 - geoschem - geoschem - geoschem_baro_moist run_component_cam env_run.xml diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 1c637f1d73..70b41adfe5 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -382,30 +382,35 @@ + + + + + - GEOSCHEM - 2000_CAM40%GC_SLND_SICE_SOCN_SROF_SGLC_SWAV + FSPCAMM_GC + 2000_CAM%SPCAMMGC_CLM50%SP_CICE%PRES_DOCN%DOM_RTM_SGLC_SWAV - GEOSCHEMTEST - 2000_CAM%GCHS_SLND_SICE_SOCN_SROF_SGLC_SWAV + FC2000climo_GC + 2000_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV - FGC - 2000_CAM40%GC_CLM40%SP_CICE%PRES_DOCN%DOM_RTM_SGLC_SWAV + FC2010climo_GC + 2010_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV - FGC_CLM45 - 2000_CAM40%GC_CLM45%SP_CICE%PRES_DOCN%DOM_RTM_SGLC_SWAV + FCHIST_GC + HIST_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV - FGC_CLM50 - 2000_CAM40%GC_CLM50%SP_CICE%PRES_DOCN%DOM_RTM_SGLC_SWAV + FCSD_GC + HIST_CAM60%GC%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV @@ -595,6 +600,7 @@ 1 1 + 1 @@ -602,6 +608,7 @@ 1 1 + 1 @@ -609,6 +616,7 @@ 1 1 + 1 @@ -616,6 +624,7 @@ 1 1 + 1 @@ -623,6 +632,7 @@ 1 1 + 1 @@ -630,6 +640,7 @@ 1 1 + 1 @@ -637,6 +648,7 @@ 1 1 + 1 @@ -644,6 +656,7 @@ 1 1 + 1 @@ -651,6 +664,7 @@ 1 1 + 1 @@ -658,6 +672,7 @@ 1 1 + 1 diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index d4e7ae45c8..89b4290731 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -1698,6 +1698,18 @@ 1 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + diff --git a/src/chemistry/aerosol/drydep_mod.F90 b/src/chemistry/aerosol/aer_drydep_mod.F90 similarity index 99% rename from src/chemistry/aerosol/drydep_mod.F90 rename to src/chemistry/aerosol/aer_drydep_mod.F90 index 1e83641d71..512a8bdc5b 100644 --- a/src/chemistry/aerosol/drydep_mod.F90 +++ b/src/chemistry/aerosol/aer_drydep_mod.F90 @@ -1,4 +1,4 @@ -module drydep_mod +module aer_drydep_mod use shr_kind_mod, only: r8 => shr_kind_r8 use ppgrid @@ -265,4 +265,4 @@ end subroutine calcram !############################################################################## -end module drydep_mod +end module aer_drydep_mod diff --git a/src/chemistry/bulk_aero/aero_model.F90 b/src/chemistry/bulk_aero/aero_model.F90 index 4c3d0ab80e..c5c25abc74 100644 --- a/src/chemistry/bulk_aero/aero_model.F90 +++ b/src/chemistry/bulk_aero/aero_model.F90 @@ -124,16 +124,16 @@ end subroutine aero_model_register !============================================================================= subroutine aero_model_init( pbuf2d ) - use mo_chem_utls, only: get_inv_ndx, get_spc_ndx - use cam_history, only: addfld, add_default, horiz_only - use phys_control, only: phys_getopts - use mo_aerosols, only: aerosols_inti - use mo_setsoa, only: soa_inti - use dust_model, only: dust_init - use seasalt_model, only: seasalt_init - use drydep_mod, only: inidrydep - use wetdep, only: wetdep_init - use mo_setsox, only: has_sox + use mo_chem_utls, only: get_inv_ndx, get_spc_ndx + use cam_history, only: addfld, add_default, horiz_only + use phys_control, only: phys_getopts + use mo_aerosols, only: aerosols_inti + use mo_setsoa, only: soa_inti + use dust_model, only: dust_init + use seasalt_model, only: seasalt_init + use aer_drydep_mod, only: inidrydep + use wetdep, only: wetdep_init + use mo_setsox, only: has_sox ! args type(physics_buffer_desc), pointer :: pbuf2d(:,:) @@ -384,7 +384,7 @@ end subroutine aero_model_init subroutine aero_model_drydep ( state, pbuf, obklen, ustar, cam_in, dt, cam_out, ptend ) use dust_sediment_mod, only: dust_sediment_tend - use drydep_mod, only: d3ddflux, calcram + use aer_drydep_mod, only: d3ddflux, calcram use dust_model, only: dust_depvel, dust_nbin, dust_names use seasalt_model, only: sslt_depvel=>seasalt_depvel, sslt_nbin=>seasalt_nbin, sslt_names=>seasalt_names diff --git a/src/chemistry/pp_geoschem/.exclude b/src/chemistry/geoschem/.exclude similarity index 84% rename from src/chemistry/pp_geoschem/.exclude rename to src/chemistry/geoschem/.exclude index 313c41158c..b0c26be3ef 100644 --- a/src/chemistry/pp_geoschem/.exclude +++ b/src/chemistry/geoschem/.exclude @@ -4,20 +4,20 @@ tpcore_window_mod.F90 tpcore_fvdas_mod.F90 flexgrid_read_mod.F90 get_met_mod.F90 -pops_mod.F90 planeflight_mod.F90 -diag51_mod.F90 diag1.F90 diag03_mod.F90 diag3.F90 +diag51_mod.F90 diag51b_mod.F90 diag53_mod.F90 emissions_mod.F90 gamap_mod.F90 +gosat_ch4_mod.F90 +tccon_ch4_mod.F90 initialize.F90 -input_mod.F90 cleanup.F90 main.F90 hcoi_gc_diagn_include.H hcoi_gc_diagn_mod.F90 -hco_interface_gc_mod.F90 \ No newline at end of file +hco_interface_gc_mod.F90 diff --git a/src/chemistry/geoschem/cesmgc_diag_mod.F90 b/src/chemistry/geoschem/cesmgc_diag_mod.F90 new file mode 100644 index 0000000000..7c3180ddd6 --- /dev/null +++ b/src/chemistry/geoschem/cesmgc_diag_mod.F90 @@ -0,0 +1,1460 @@ +!------------------------------------------------------------------------------ +! "GEOS-Chem" chemistry diagnostics interface ! +!------------------------------------------------------------------------------ +!BOP +! +! !MODULE: cesmgc_diag_mod.F90 +! +! !DESCRIPTION: Module cesmgc\_diag\_mod contains routines which aim to +! diagnose variables from GEOS-Chem +!\\ +!\\ +! !INTERFACE: +! +MODULE CESMGC_Diag_Mod +! +! !USES: +! + USE SHR_KIND_MOD, ONLY : r8 => shr_kind_r8 + USE SHR_CONST_MOD, ONLY : pi => shr_const_pi + USE CAM_HISTORY, ONLY : fieldname_len + USE CONSTITUENTS, ONLY : pcnst + USE CHEM_MODS, ONLY : gas_pcnst, map2chm + USE CHEM_MODS, ONLY : iFirstCnst + USE MO_TRACNAME, ONLY : solsym + USE SPMD_UTILS, ONLY : MasterProc + USE PPGRID, ONLY : begchunk, pver + USE CAM_LOGFILE, ONLY : iulog + USE STRING_UTILS, ONLY : to_upper + USE Error_Mod ! For error checking + USE ErrCode_Mod ! Error codes for success or failure + + IMPLICIT NONE + + PRIVATE + +! +! !PUBLIC MEMBER FUNCTIONS: +! + PUBLIC :: CESMGC_Diag_Init + PUBLIC :: CESMGC_Diag_Calc + PUBLIC :: wetdep_name, wtrate_name + + INTEGER :: nPhotol ! Number of diagnosed photolytic reactions + CHARACTER(LEN=fieldname_len) :: srcnam(gas_pcnst) ! Names of source/sink tendencies + CHARACTER(LEN=fieldname_len) :: wetdep_name(gas_pcnst) ! Wet deposition tendencies + CHARACTER(LEN=fieldname_len) :: wtrate_name(gas_pcnst) ! Column tendencies for wet dep + CHARACTER(LEN=fieldname_len) :: dtchem_name(gas_pcnst) ! Chemical tendencies + CHARACTER(LEN=16) :: sflxnam_loc(pcnst) ! Names of surface fluxes + + ! Chemical families + INTEGER :: NOx_species(3) + INTEGER :: NOy_species(63) + INTEGER :: HOx_species(4) + INTEGER :: ClOx_species(6) + INTEGER :: ClOy_species(11) + INTEGER :: tCly_species(30) + INTEGER :: BrOx_species(4) + INTEGER :: BrOy_species(9) + INTEGER :: tBry_species(18) + INTEGER :: SOx_species(2) + INTEGER :: NHx_species(2) + INTEGER :: TOTH_species(3) + REAL(r8) :: NOx_MWs(3) + REAL(r8) :: NOy_MWs(64) + REAL(r8) :: HOx_MWs(4) + REAL(r8) :: ClOx_MWs(6) + REAL(r8) :: ClOy_MWs(11) + REAL(r8) :: tCly_MWs(30) + REAL(r8) :: BrOx_MWs(4) + REAL(r8) :: BrOy_MWs(9) + REAL(r8) :: tBry_MWs(18) + REAL(r8) :: SOx_MWs(2) + REAL(r8) :: NHx_MWs(2) + REAL(r8) :: TOTH_MWs(3) + + REAL(r8), PARAMETER :: MW_NIT = 62.01 + REAL(r8), PARAMETER :: MW_HNO3 = 63.01 + REAL(r8), PARAMETER :: MW_HCl = 36.45 + REAL(r8), PARAMETER :: MW_H2O = 18.02 + + ! NOx species + INTEGER :: i_NO, i_NO2, i_N + ! NOy \ NOx species + INTEGER :: i_BrNO2, i_BrNO3, i_ClNO2, i_ClNO3, i_ETHLN, i_ETNO3, & + i_HNO2, i_HNO3, i_HNO4, i_ICN, i_ICNOO, i_IDHNBOO, & + i_IDHNDOO1, i_IDN, i_IDNOO, i_IHN1, i_IHN2, & + i_IHN3, i_IHN4, i_IHPNBOO, i_IHPNDOO, i_INA, i_INO, & + i_INO2B, i_INO2D, i_INPB, i_INPD, i_IONO, i_IONO2, & + i_IPRNO3, i_ISOPNOO1, i_ISOPNOO2, i_ITCN, i_ITHN, & + i_MACRNO2, i_MCRHN, i_MCRHNB, i_MENO3, i_MONITS, i_MONITU, & + i_MPAN, i_MPN, i_MVKN, i_N2O5, i_NO3, i_NPRNO3, i_OLND, & + i_OLNN, i_PAN, i_PPN, i_PRN1, i_PROPNN, i_PRPN, i_R4N1, & + i_R4N2, i_HONIT, i_IONITA, i_NIT, i_NITs, i_NH4 + ! HOx + INTEGER :: i_H, i_OH, i_HO2, i_H2O2 + ! ClOx + INTEGER :: i_Cl, i_ClO, i_HOCl, i_Cl2, i_Cl2O2, i_OClO + ! tCly \ ClOx + INTEGER :: i_ClOO, i_HCl, i_BrCl, i_ICl, i_H1211, & + i_CFC115, i_CH3Cl, i_HCFC142b, i_HCFC22, i_CH2ICl, & + i_CFC114, i_CFC12, i_HCFC141b, i_HCFC123, i_CH2Cl2, & + i_CFC11, i_CH3CCl3, i_CHCl3, i_CCl4, i_CFC113, i_SALACL, & + i_SALCCL !ClNO2, ClNO3 already defined in NOy_species + ! BrOx + INTEGER :: i_Br, i_BrO, i_HOBr !BrCl already defined in tCly_species + ! Bry \ BrOx + INTEGER :: i_HBr, i_IBr, i_Br2, i_CH3Br, & + i_H1301, i_H2402, i_CH2Br2, i_CHBr3, i_BrSALA, i_BrSALC, & + i_CH2IBr + !BrNO2, BrNO3 already defined in NOy_speies + !H1211 already defined in tCly_species + ! SOx + INTEGER :: i_SO2, i_SO4 + ! NHx + INTEGER :: i_NH3 !NH4 already defined in NOy_species + ! TOTH + INTEGER :: i_CH4, i_H2O, i_H2 +! +! !REVISION HISTORY: +! 28 Oct 2020 - T. M. Fritz - Initial version +!EOP +!------------------------------------------------------------------------------ +!BOC +! +CONTAINS +! +!EOC +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: cesmgc_diag_init +! +! !DESCRIPTION: Subroutine CESMGC\_Diag\_Init declares the variables to +! diagnosethe +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) +! +! !USES: +! + USE Input_Opt_Mod, ONLY : OptInput + USE State_Chm_Mod, ONLY : ChmState + USE State_Met_Mod, ONLY : MetState + USE State_Diag_Mod, ONLY : get_TagInfo + USE Species_Mod, ONLY : Species + USE Registry_Mod, ONLY : MetaRegItem, RegItem + USE State_Chm_Mod, ONLY : Ind_ + USE CONSTITUENTS, ONLY : cnst_name, sflxnam + USE CONSTITUENTS, ONLY : cnst_get_ind + USE CAM_HISTORY, ONLY : addfld, add_default, horiz_only + USE DRYDEP_MOD, ONLY : depName +! +! !INPUT PARAMETERS: +! + TYPE(OptInput), INTENT(IN) :: Input_Opt ! Input options + TYPE(ChmState), INTENT(IN) :: State_Chm ! Chemistry State object + TYPE(MetState), INTENT(IN) :: State_Met ! Meteorology State object +! +! !REVISION HISTORY: +! 20 Oct 2020 - T. M. Fritz - Initial version +!EOP +!------------------------------------------------------------------------------ +!BOC +! + ! Integer + INTEGER :: M, N, SM + INTEGER :: idx + INTEGER :: RC + + ! Logical + LOGICAL :: Found + + ! Strings + CHARACTER(LEN=255) :: SpcName + CHARACTER(LEN=255) :: tagName + CHARACTER(LEN=255) :: ThisLoc + CHARACTER(LEN=255) :: ErrMsg + CHARACTER(LEN=2) :: unit_basename ! Units 'kg' or '1' + + ! Objects + TYPE(Species), POINTER :: SpcInfo + TYPE(MetaRegItem), POINTER :: Current + TYPE(RegItem ), POINTER :: Item + + !================================================================= + ! CESMGC_Diag_Init begins here! + !================================================================= + + ! Initialize pointers + SpcInfo => NULL() + Current => NULL() + Item => NULL() + + ! Assume a successful return until otherwise + RC = GC_SUCCESS + + CALL Addfld( 'MASS', (/ 'lev' /), 'A', 'kg', 'Mass of grid box' ) + CALL Addfld( 'AREA', horiz_only, 'A', 'm2', 'Area of grid box' ) + CALL Addfld( 'HEIGHT', (/ 'ilev' /),'A','m', 'Geopotential height above surface at interfaces' ) + + ! Note that constituents are already output by default + ! Add all species as output fields if desired + DO N = 1, gas_pcnst + M = map2chm(N) + IF ( M > 0 ) THEN + ! It's a GEOS-Chem species + SpcName = to_upper(TRIM(solsym(N))) + CALL AddFld( TRIM(SpcName), (/ 'lev' /), 'A', 'mol/mol', & + TRIM(SpcName)//' volume mixing ratio') + CALL AddFld( TRIM(SpcName)//'_SRF', horiz_only, 'A', 'mol/mol', & + TRIM(SpcName)//' in bottom layer') + IF (TRIM(SpcName) == 'O3') CALL Add_Default( TRIM(SpcName), 2, ' ' ) + ELSE + ! MAM aerosols + SpcName = TRIM(solsym(N)) + unit_basename = 'kg' + IF ( SpcName(1:3) == 'num' ) unit_basename = ' 1' + CALL AddFld( TRIM(SpcName), (/ 'lev' /), 'A', unit_basename//'/kg', & + TRIM(SpcName)//' concentration' ) + CALL AddFld( TRIM(SpcName)//'_SRF', horiz_only, 'A', unit_basename//'/kg', & + TRIM(SpcName)//' in bottom layer' ) + ENDIF + ENDDO + + IF ( Input_Opt%LDryD ) THEN + DO N = 1, State_Chm%nDryDep + SpcName = 'DV_'//to_upper(TRIM(depName(N))) + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'm/s', & + TRIM(SpcName)//' dry deposition velocity') + ENDDO + + DO N = 1, State_Chm%nAdvect + ! Get the species ID from the advected species ID + M = State_Chm%Map_Advect(N) + + ! Get info about this species from the species database + SpcInfo => State_Chm%SpcData(M)%Info + SpcName = 'DF_'//to_upper(TRIM(SpcInfo%Name)) + CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'kg/m2/s', & + TRIM(SpcName)//' dry deposition flux') + + ! Free pointer + SpcInfo => NULL() + ENDDO + ENDIF + + sflxnam_loc(:) = '' + ! Chemical tendencies and surface fluxes + DO N = 1, gas_pcnst + IF ( map2chm(N) > 0 ) THEN + ! If this is a GEOS-Chem species then capitalize. This avoids + ! issues where Br2 /= BR2 + srcnam(N) = 'CT_'//to_upper(TRIM(solsym(N))) ! chem tendency (source/sink) + ELSE + ! For MAM aerosols, keep as it is (i.e. bc_a1) + srcnam(N) = 'CT_'//TRIM(solsym(N)) ! chem tendency (source/sink) + ENDIF + SpcName = srcnam(N) + CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', 'kg/kg/s', TRIM(SpcName)//' source/sink' ) + + SpcName = TRIM(solsym(N)) + CALL cnst_get_ind( SpcName, M, abort=.false. ) + IF ( M > 0 ) THEN + IF (sflxnam(M)(3:5) == 'num') then ! name is in the form of "SF****" + unit_basename = ' 1' + ELSE + unit_basename = 'kg' + ENDIF + IF ( map2chm(N) > 0 ) THEN + sflxnam_loc(M) = to_upper(sflxnam(M)) + ELSE + sflxnam_loc(M) = sflxnam(M) + ENDIF + SpcName = sflxnam_loc(M) + CALL Addfld ( TRIM(SpcName), horiz_only, 'A', unit_basename//'/m2/s', & + TRIM(solsym(N))//' surface flux') + ENDIF + ENDDO + + CALL get_TagInfo( Input_Opt = Input_Opt, & + tagID = 'PHO', & + State_Chm = State_Chm, & + Found = Found, & + RC = RC, & + nTags = nPhotol ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Abnormal exit from routine "Get_TagInfo", could not ' // & + ' get nTags!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + DO M = 1, nPhotol + CALL get_TagInfo( Input_Opt = Input_Opt, & + tagID = 'PHO', & + State_Chm = State_Chm, & + Found = Found, & + RC = RC, & + N = M, & + tagName = tagName ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Abnormal exit from routine "Get_TagInfo"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + SpcName = 'Jval_' // TRIM( tagName ) + CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & + TRIM(tagName) // ' photolysis rate' ) + ENDDO + ! Add Jval_O3O1D and Jval_O3O3P + SpcName = 'Jval_O3O1D' + CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & + TRIM(tagName) // ' photolysis rate' ) + SpcName = 'Jval_O3O3P' + CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & + TRIM(tagName) // ' photolysis rate' ) + + ! ========================================== + ! Now add fields corresponding to State_Met + ! ========================================== + + ! Copied from Headers/registry_mod.F90 + ! Point to the head node of the Registry + Current => State_Met%Registry + + ! As long as the current node isn't NULL + DO WHILE( ASSOCIATED( Current ) ) + + ! Get the REGISTRY ITEM belonging to this node of the Registry + Item => Current%Item + + ! Only print on the root CPU + IF ( ASSOCIATED( Item ) ) THEN + + !IF (( TRIM(Item%FullName(1:8)) /= 'MET_XLAI' ) .AND. & + ! ( TRIM(Item%FullName(1:8)) /= 'MET_IUSE' ) .AND. & + ! ( TRIM(Item%FullName(1:9)) /= 'MET_ILAND' )) THEN + ! IF ( TRIM(Item%DimNames) == 'xy' ) THEN + ! CALL Addfld( TRIM( Item%FullName ), horiz_only, 'A', & + ! TRIM( Item%Units ), TRIM( Item%Description ) ) + ! ELSE + ! CALL Addfld( TRIM( Item%FullName ), (/ 'lev' /), 'A', & + ! TRIM( Item%Units ), TRIM( Item%Description ) ) + ! ENDIF + !ENDIF + + ENDIF + + ! Point to next node of the Registry + Current => Current%Next + + ENDDO + + ! Chemical tendencies + DO N = 1, gas_pcnst + M = map2chm(N) + IF ( M > 0 ) THEN + dtchem_name(N) = 'D'//to_upper(TRIM(solsym(N)))//'CHM' + ELSE + dtchem_name(N) = 'D'//TRIM(solsym(N))//'CHM' + ENDIF + SpcName = TRIM(dtchem_name(N)) + CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', 'kg/s', & + 'net tendency from chemistry' ) + ENDDO + + i_NO = Ind_('NO') + i_NO2 = Ind_('NO2') + i_N = Ind_('N') + i_BrNO2 = Ind_('BrNO2') + i_BrNO3 = Ind_('BrNO3') + i_ClNO2 = Ind_('ClNO2') + i_ClNO3 = Ind_('ClNO3') + i_ETHLN = Ind_('ETHLN') + i_ETNO3 = Ind_('ETNO3') + i_HNO2 = Ind_('HNO2') + i_HNO3 = Ind_('HNO3') + i_HNO4 = Ind_('HNO4') + i_ICN = Ind_('ICN') + i_ICNOO = Ind_('ICNOO') + i_IDHNBOO = Ind_('IDHNBOO') + i_IDHNDOO1 = Ind_('IDHNDOO1') + i_IDN = Ind_('IDN') + i_IDNOO = Ind_('IDNOO') + i_IHN1 = Ind_('IHN1') + i_IHN2 = Ind_('IHN2') + i_IHN3 = Ind_('IHN3') + i_IHN4 = Ind_('IHN4') + i_IHPNBOO = Ind_('IHPNBOO') + i_IHPNDOO = Ind_('IHPNDOO') + i_INA = Ind_('INA') + i_INO = Ind_('INO') + i_INO2B = Ind_('INO2B') + i_INO2D = Ind_('INO2D') + i_INPB = Ind_('INPB') + i_INPD = Ind_('INPD') + i_IONO = Ind_('IONO') + i_IONO2 = Ind_('IONO2') + i_IPRNO3 = Ind_('IPRNO3') + i_ISOPNOO1 = Ind_('ISOPNOO1') + i_ISOPNOO2 = Ind_('ISOPNOO2') + i_ITCN = Ind_('ITCN') + i_ITHN = Ind_('ITHN') + i_MACRNO2 = Ind_('MACRNO2') + i_MCRHN = Ind_('MCRHN') + i_MCRHNB = Ind_('MCRHNB') + i_MENO3 = Ind_('MENO3') + i_MONITS = Ind_('MONITS') + i_MONITU = Ind_('MONITU') + i_MPAN = Ind_('MPAN') + i_MPN = Ind_('MPN') + i_MVKN = Ind_('MVKN') + i_N2O5 = Ind_('N2O5') + i_NO3 = Ind_('NO3') + i_NPRNO3 = Ind_('NPRNO3') + i_OLND = Ind_('OLND') + i_OLNN = Ind_('OLNN') + i_PAN = Ind_('PAN') + i_PPN = Ind_('PPN') + i_PRN1 = Ind_('PRN1') + i_PROPNN = Ind_('PROPNN') + i_PRPN = Ind_('PRPN') + i_R4N1 = Ind_('R4N1') + i_R4N2 = Ind_('R4N2') + i_HONIT = Ind_('HONIT') + i_IONITA = Ind_('IONITA') + i_NIT = Ind_('NIT') + i_NITs = Ind_('NITs') + i_H = Ind_('H') + i_OH = Ind_('OH') + i_HO2 = Ind_('HO2') + i_H2O2 = Ind_('H2O2') + i_Cl = Ind_('Cl') + i_ClO = Ind_('ClO') + i_HOCl = Ind_('HOCl') + i_Cl2 = Ind_('Cl2') + i_Cl2O2 = Ind_('Cl2O2') + i_OClO = Ind_('OClO') + i_ClOO = Ind_('ClOO') + i_HCl = Ind_('HCl') + i_ClNO2 = Ind_('ClNO2') + i_ClNO3 = Ind_('ClNO3') + i_BrCl = Ind_('BrCl') + i_ICl = Ind_('ICl') + i_H1211 = Ind_('H1211') + i_CFC115 = Ind_('CFC115') + i_CH3Cl = Ind_('CH3Cl') + i_HCFC142b = Ind_('HCFC142b') + i_HCFC22 = Ind_('HCFC22') + i_CH2ICl = Ind_('CH2ICl') + i_CFC114 = Ind_('CFC114') + i_CFC12 = Ind_('CFC12') + i_HCFC141b = Ind_('HCFC141b') + i_HCFC123 = Ind_('HCFC123') + i_CH2Cl2 = Ind_('CH2Cl2') + i_CFC11 = Ind_('CFC11') + i_CH3CCl3 = Ind_('CH3CCl3') + i_CHCl3 = Ind_('CHCl3') + i_CCl4 = Ind_('CCl4') + i_CFC113 = Ind_('CFC113') + i_SALACL = Ind_('SALACL') + i_SALCCL = Ind_('SALCCL') + i_Br = Ind_('Br') + i_BrO = Ind_('BrO') + i_BrCl = Ind_('BrCl') + i_HOBr = Ind_('HOBr') + i_HBr = Ind_('HBr') + i_BrNO2 = Ind_('BrNO2') + i_BrNO3 = Ind_('BrNO3') + i_IBr = Ind_('IBr') + i_Br2 = Ind_('Br2') + i_CH3Br = Ind_('CH3Br') + i_H1211 = Ind_('H1211') + i_H1301 = Ind_('H1301') + i_H2402 = Ind_('H2402') + i_CH2Br2 = Ind_('CH2Br2') + i_CHBr3 = Ind_('CHBr3') + i_BrSALA = Ind_('BrSALA') + i_BrSALC = Ind_('BrSALC') + i_CH2IBr = Ind_('CH2IBr') + i_SO2 = Ind_('SO2') + i_SO4 = Ind_('SO4') + i_NH3 = Ind_('NH3') + i_NH4 = Ind_('NH4') + i_CH4 = Ind_('CH4') + i_H2O = Ind_('H2O') + i_H2 = Ind_('H2') + + NOx_species = (/ i_N, i_NO, i_NO2 /) + NOy_species = (/ i_N, i_NO, i_NO2, i_BrNO2, i_BrNO3, i_ClNO2, i_ClNO3,& + i_ETHLN, i_ETNO3, i_HNO2, i_HNO3, i_HNO4, i_ICN, & + i_ICNOO, i_IDHNBOO, i_IDHNDOO1, i_IDN, & + i_IDNOO, i_IHN1, i_IHN2, i_IHN3, i_IHN4, i_IHPNBOO, & + i_IHPNDOO, i_INA, i_INO, i_INO2B, i_INO2D, i_INPB, & + i_INPD, i_IONO, i_IONO2, i_IPRNO3, i_ISOPNOO1, & + i_ISOPNOO2, i_ITCN, i_ITHN, i_MACRNO2, i_MCRHN, & + i_MCRHNB, i_MENO3, i_MONITS, i_MONITU, i_MPAN, i_MPN,& + i_MVKN, i_N2O5, i_NO3, i_NPRNO3, i_OLND, i_OLNN, & + i_PAN, i_PPN, i_PRN1, i_PROPNN, i_PRPN, i_R4N1, & + i_R4N2, i_HONIT, i_IONITA, i_NIT, i_NITs, i_NH4 /) + HOx_species = (/ i_H, i_OH, i_HO2, i_H2O2 /) + ClOx_species = (/ i_Cl, i_ClO, i_HOCl, i_Cl2, i_Cl2O2, i_OClO /) + ClOy_species = (/ i_Cl, i_ClO, i_HOCl, i_Cl2, i_Cl2O2, i_OClO, & + i_HCl, i_ClNO3, i_BrCl, i_ICl, i_ClNO2 /) + tCly_species = (/ i_Cl, i_ClO, i_HOCl, i_Cl2, i_Cl2O2, i_OClO, i_ClOO, & + i_HCl, i_ClNO2, i_ClNO3, i_BrCl, i_ICl, i_H1211, & + i_CFC115, i_CH3Cl, i_HCFC142b, i_HCFC22, i_CH2ICl, & + i_CFC114, i_CFC12, i_HCFC141b, i_HCFC123, i_CH2Cl2, & + i_CFC11, i_CH3CCl3, i_CHCl3, i_CCl4, i_CFC113, & + i_SALACL, i_SALCCL /) + BrOx_species = (/ i_Br, i_BrO, i_BrCl, i_HOBr /) + BrOy_species = (/ i_Br, i_BrO, i_BrCl, i_HOBr, i_HBr, i_BrNO2, & + i_BrNO3, i_IBr, i_Br2 /) + tBry_species = (/ i_Br, i_BrO, i_BrCl, i_HOBr, i_HBr, i_BrNO2, & + i_BrNO3, i_IBr, i_Br2, i_CH3Br, i_H1211, i_H1301, & + i_H2402, i_CH2Br2, i_CHBr3, i_BrSALA, i_BrSALC, & + i_CH2IBr /) + SOx_species = (/ i_SO2, i_SO4 /) + NHx_species = (/ i_NH3, i_NH4 /) + TOTH_species = (/ i_CH4, i_H2O, i_H2 /) + + DO N = 1, SIZE(NOx_species) + idx = NOx_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + NOx_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + NOx_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(NOy_species) + idx = NOy_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + NOy_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + NOy_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(HOx_species) + idx = HOx_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + HOx_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + HOx_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(ClOx_species) + idx = ClOx_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + ClOx_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + ClOx_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(ClOy_species) + idx = ClOy_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + ClOy_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + ClOy_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(tCly_species) + idx = tCly_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + tCly_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + tCly_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(BrOx_species) + idx = BrOx_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + BrOx_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + BrOx_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(BrOy_species) + idx = BrOy_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + BrOy_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + BrOy_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(tBry_species) + idx = tBry_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + tBry_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + tBry_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(SOx_species) + idx = SOx_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + SOx_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + SOx_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(NHx_species) + idx = NHx_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + NHx_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + NHx_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + DO N = 1, SIZE(TOTH_species) + idx = TOTH_species(N) + IF ( idx > 0 ) THEN + SpcInfo => State_Chm%SpcData(idx)%Info + TOTH_MWs(N) = REAL(SpcInfo%MW_g,r8) + SpcInfo => NULL() + ELSE + TOTH_MWs(N) = -1.0e+00_r8 + ENDIF + ENDDO + + IF ( ANY(NOx_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "NOx indices: ", NOx_species + ENDIF + IF ( ANY(NOy_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "NOy indices: ", NOy_species + ENDIF + IF ( ANY(HOx_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "HOx indices: ", HOx_species + ENDIF + IF ( ANY(ClOx_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "ClOx indices: ", ClOx_species + ENDIF + IF ( ANY(ClOy_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "ClOy indices: ", ClOy_species + ENDIF + IF ( ANY(tCly_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "tCly indices: ", tCly_species + ENDIF + IF ( ANY(BrOx_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "BrOx indices: ", BrOx_species + ENDIF + IF ( ANY(BrOy_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "BrOy indices: ", BrOy_species + ENDIF + IF ( ANY(tBry_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "tBry indices: ", tBry_species + ENDIF + IF ( ANY(SOx_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "SOx indices: ", SOx_species + ENDIF + IF ( ANY(NHx_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "NHx indices: ", NHx_species + ENDIF + IF ( ANY(TOTH_species <= 0 ) ) THEN + IF ( MasterProc ) Write(iulog,*) "TOTH indices: ", TOTH_species + ENDIF + + CALL Addfld( 'NOX', (/ 'lev' /), 'A', 'mol/mol', & + 'NOx molar mixing ratio' ) + CALL Addfld( 'NOY', (/ 'lev' /), 'A', 'mol/mol', & + 'NOy molar mixing ratio' ) + CALL Addfld( 'NOY_mmr', (/ 'lev' /), 'A', 'kg/kg', & + 'NOy mass mixing ratio' ) + CALL Addfld( 'NOY_SRF', horiz_only, 'A', 'mol/mol', & + 'Surface NOy molar mixing ratio' ) + CALL Addfld( 'HOX', (/ 'lev' /), 'A', 'mol/mol', & + 'HOx molar mixing ratio' ) + CALL Addfld( 'CLOX', (/ 'lev' /), 'A', 'mol/mol', & + 'ClOx molar mixing ratio' ) + CALL Addfld( 'CLOY', (/ 'lev' /), 'A', 'mol/mol', & + 'Total inorganic chlorine (ClOy) molar mixing ratio' ) + CALL Addfld( 'TCLY', (/ 'lev' /), 'A', 'mol/mol', & + 'Total Cl molar mixing ratio' ) + CALL Addfld( 'BROX', (/ 'lev' /), 'A', 'mol/mol', & + 'BrOx molar mixing ratio' ) + CALL Addfld( 'BROY', (/ 'lev' /), 'A', 'mol/mol', & + 'Total inorganic bromine (BrOy) molar mixing ratio' ) + CALL Addfld( 'TBRY', (/ 'lev' /), 'A', 'mol/mol', & + 'Total Br molar mixing ratio' ) + CALL Addfld( 'SOX', (/ 'lev' /), 'A', 'mol/mol', & + 'SOx molar mixing ratio' ) + CALL Addfld( 'SOX_mmr', (/ 'lev' /), 'A', 'kg/kg', & + 'SOx mass mixing ratio' ) + CALL Addfld( 'NHX', (/ 'lev' /), 'A', 'mol/mol', & + 'NHx molar mixing ratio' ) + CALL Addfld( 'NHX_mmr', (/ 'lev' /), 'A', 'kg/kg', & + 'NHx mass mixing ratio' ) + CALL Addfld( 'TOTH', (/ 'lev' /), 'A', 'mol/mol', & + 'Total H2 molar mixing ratio' ) + + CALL Addfld( 'SAD_STRAT', (/ 'lev' /), 'I', 'cm2/cm3', 'Stratospheric aerosol SAD' ) + CALL Addfld( 'SAD_SULFC', (/ 'lev' /), 'I', 'cm2/cm3', 'Chemical sulfate aerosol SAD' ) + CALL Addfld( 'SAD_PSC', (/ 'lev' /), 'I', 'cm2/cm3', 'PSC aerosol SAD' ) + CALL Addfld( 'RAD_SULFC', (/ 'lev' /), 'I', 'cm', 'Chemical sulfate radius' ) + CALL Addfld( 'RAD_PSC', (/ 'lev' /), 'I', 'cm', 'PSC aerosol radius' ) + CALL Addfld( 'SAD_TROP', (/ 'lev' /), 'I', 'cm2/cm3', 'Tropospheric aerosol SAD' ) + CALL Addfld( 'SAD_AERO', (/ 'lev' /), 'I', 'cm2/cm3', 'Aerosol surface area density' ) + CALL Addfld( 'REFF_AERO', (/ 'lev' /), 'I', 'cm', 'Aerosol effective radius') + CALL Addfld( 'SULF_TROP', (/ 'lev' /), 'I', 'cm2/cm3', 'Tropospheric sulfate area density') + + CALL Addfld( 'HNO3_TOTAL', (/ 'lev' /), 'I', 'mol/mol', 'Total HNO3' ) + CALL Addfld( 'HNO3_STS', (/ 'lev' /), 'I', 'mol/mol', 'STS condensed HNO3' ) + CALL Addfld( 'HNO3_NAT', (/ 'lev' /), 'I', 'mol/mol', 'NAT condensed HNO3' ) + CALL Addfld( 'HNO3_GAS', (/ 'lev' /), 'I', 'mol/mol', 'Gas phase HNO3' ) + CALL Addfld( 'H2O_GAS', (/ 'lev' /), 'I', 'mol/mol', 'Gas phase H2O' ) + CALL Addfld( 'HCL_TOTAL', (/ 'lev' /), 'I', 'mol/mol', 'Total HCl' ) + CALL Addfld( 'HCL_GAS', (/ 'lev' /), 'I', 'mol/mol', 'Gas phase HCl' ) + CALL Addfld( 'HCL_STS', (/ 'lev' /), 'I', 'mol/mol', 'STS condensend HCl' ) + + CALL Addfld( 'SZA', horiz_only, 'I', 'degrees', 'Solar Zenith Angle' ) + CALL Addfld( 'U_SRF', horiz_only, 'I', 'm/s', 'Horizontal wind velocity' ) + CALL Addfld( 'V_SRF', horiz_only, 'I', 'm/s', 'Vertical wind velocity' ) + CALL Addfld( 'Q_SRF', horiz_only, 'I', 'kg/kg', 'Specific humidity' ) + + CALL Addfld( 'CT_H2O_GHG', (/ 'lev' /), 'A','kg/kg/s', 'ghg-chem h2o source/sink' ) + + !======================================================================= + ! Cleanup and quit + !======================================================================= + Current => NULL() + Item => NULL() + + END SUBROUTINE CESMGC_Diag_Init +!EOC +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: cesmgc_diag_calc +! +! !DESCRIPTION: Subroutine CESMGC\_Diag\_Calc passes the diagnostics variable +! to the CAM History routines +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & + State_Grid, State_Met, cam_in, state, & + mmr_tend, LCHNK ) +! +! !USES: +! + USE Input_Opt_Mod, ONLY : OptInput + USE State_Chm_Mod, ONLY : ChmState + USE State_Met_Mod, ONLY : MetState + USE State_Diag_Mod, ONLY : DgnState + USE State_Diag_Mod, ONLY : get_TagInfo + USE State_Grid_Mod, ONLY : GrdState + USE Species_Mod, ONLY : Species + USE Registry_Mod, ONLY : MetaRegItem, RegItem + USE Registry_Mod, ONLY : Registry_Lookup + USE Registry_Params_Mod + USE PRECISION_MOD + USE CHEM_MODS, ONLY : adv_mass + USE CAM_HISTORY, ONLY : outfld, hist_fld_active + USE CONSTITUENTS, ONLY : cnst_name, sflxnam + USE DRYDEP_MOD, ONLY : depName, Ndvzind + USE CAMSRFEXCH, ONLY : cam_in_t + USE PHYSICS_TYPES, ONLY : physics_state + USE SPMD_UTILS, ONLY : MasterProc + USE PHYSCONST, ONLY : MWDry + USE UCX_MOD, ONLY : GET_STRAT_OPT!, AERFRAC + USE CMN_SIZE_MOD, ONLY : NDUST +! +! !INPUT PARAMETERS: +! + TYPE(OptInput), INTENT(IN) :: Input_Opt ! Input options + TYPE(ChmState), INTENT(IN) :: State_Chm ! Chemistry State object + TYPE(DgnState), INTENT(IN) :: State_Diag ! Diag State object + TYPE(GrdState), INTENT(IN) :: State_Grid ! Grid State object + TYPE(MetState), INTENT(IN) :: State_Met ! Meteorology State object + TYPE(cam_in_t), INTENT(IN) :: cam_in ! import state + TYPE(physics_state), INTENT(IN) :: state ! Physics state variables + REAL(r8), INTENT(IN) :: mmr_tend(state%ncol,pver,gas_pcnst) + ! Net tendency from chemistry in kg/s + INTEGER, INTENT(IN) :: LCHNK ! Chunk number +! +! !REVISION HISTORY: +! 20 Oct 2020 - T. M. Fritz - Initial version +!EOP +!------------------------------------------------------------------------------ +!BOC +! + ! Integers + INTEGER :: I, J, L, M, N, ND, SM + INTEGER :: idx + INTEGER :: RC + INTEGER :: Source_KindVal ! KIND value of data + INTEGER :: Output_KindVal ! KIND value for output + INTEGER :: Rank ! Size of data + + INTEGER :: nY, nZ + + ! Logicals + LOGICAL :: Found + LOGICAL :: rootChunk + LOGICAL :: OnLevelEdges ! Is the data defined + ! on level edges (T/F) + + ! Strings + CHARACTER(LEN=255) :: ThisLoc + CHARACTER(LEN=255) :: ErrMsg + CHARACTER(LEN=255) :: SpcName + CHARACTER(LEN=255) :: tagName + + ! Real + REAL(r8) :: wgt + REAL(r8) :: MW + REAL(r8) :: RAER, REFF, SADSTRAT, XSASTRAT + + ! Arrays + REAL(r8) :: outTmp(State_Grid%nY,State_Grid%nZ) + REAL(r8) :: radTmp(State_Grid%nY,State_Grid%nZ) + + ! Floating-point data pointers (8-byte precision) + REAL(f8), POINTER :: Ptr0d_8 ! 0D 8-byte data + REAL(f8), POINTER :: Ptr1d_8(: ) ! 1D 8-byte data + REAL(f8), POINTER :: Ptr2d_8(:,: ) ! 2D 8-byte data + REAL(f8), POINTER :: Ptr3d_8(:,:,:) ! 3D 8-byte data + + ! Objects + TYPE(Species), POINTER :: SpcInfo + TYPE(MetaRegItem), POINTER :: Current + TYPE(RegItem ), POINTER :: Item + + !================================================================= + ! CESMGC_Diag_Calc begins here! + !================================================================= + + nY = State_Grid%nY + nZ = State_Grid%nZ + + ! Initialize pointers + SpcInfo => NULL() + Current => NULL() + Item => NULL() + + ! For error trapping + ErrMsg = '' + ThisLoc = ' -> at CESMGC_Diag_Calc (in chemistry/geoschem/cesmgc_diag_mod.F90)' + + ! Define rootChunk + rootChunk = ( MasterProc.and.(LCHNK==BEGCHUNK) ) + + CALL OutFld( 'AREA', State_Grid%Area_M2(1,:nY), nY, LCHNK) + CALL OutFld( 'MASS', State_Met%AD(1,:nY,nZ:1:-1), nY, LCHNK) + CALL Outfld( 'HEIGHT', state%zi(:nY,:), nY, LCHNK ) + + ! =============================================== + ! Diagnose chemical species (constituents and short-lived) + ! =============================================== + + DO N = 1, gas_pcnst + M = map2chm(N) + IF ( M > 0 ) THEN + ! It's a GEOS-Chem species + SpcName = to_upper(TRIM(solsym(N))) + ELSE + ! MAM aerosols + SpcName = TRIM(solsym(N)) + ENDIF + outTmp = 0.0e+00_r8 + IF ( adv_mass(N) > 0.0e+00_r8 .AND. M /= 0 .AND. hist_fld_active(TRIM(SpcName)) ) THEN + IF ( M > 0 ) THEN + outTmp(:nY,:) = REAL(State_Chm%Species(1,:nY,nZ:1:-1,M),r8) * MWDry / adv_mass(N) + ELSE + outTmp(:nY,:) = state%q(:nY,:nZ,-M) + ENDIF + CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + CALL OutFld( TRIM(SpcName)//'_SRF', outTmp(:nY,nZ), nY, LCHNK ) + ENDIF + ENDDO + + ! =============================================== + ! Diagnose chemical families (NOx, NOy, ...) + ! =============================================== + + SpcName = 'NOX' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(NOx_species) + idx = NOx_species(N) + MW = NOx_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'NOY' + IF ( hist_fld_active(TRIM(SpcName)) .OR. hist_fld_active(TRIM(SpcName)//'_SRF') ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(NOy_species) + idx = NOy_species(N) + MW = NOy_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + IF ( idx == i_N2O5 .OR. idx == i_IDN .OR. idx == i_IDNOO ) THEN + wgt = 2.0E+00_r8 + ENDIF + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + SpcName = 'NOY_SRF' + IF ( hist_fld_active(TRIM(SpcName)) ) CALL Outfld( TRIM(SpcName), outTmp(:nY,nZ), nY, LCHNK ) + + SpcName = 'NOY_mmr' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(NOy_species) + idx = NOy_species(N) + MW = NOy_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + IF ( idx == i_N2O5 .OR. idx == i_IDN .OR. idx == i_IDNOO ) THEN + wgt = 2.0E+00_r8 + ENDIF + outTmp(:nY,:) = outTmp(:nY,:) + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'HOX' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(HOx_species) + idx = HOx_species(N) + MW = HOx_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + IF ( idx == i_H2O2 ) THEN + wgt = 2.0E+00_r8 + ENDIF + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'CLOX' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(ClOx_species) + idx = ClOx_species(N) + MW = ClOx_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + IF ( idx == i_Cl2 .OR. idx == i_Cl2O2 ) THEN + wgt = 2.0E+00_r8 + ENDIF + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'CLOY' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(ClOy_species) + idx = ClOy_species(N) + MW = ClOy_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + IF ( idx == i_Cl2 .OR. idx == i_Cl2O2 ) THEN + wgt = 2.0E+00_r8 + ENDIF + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'TCLY' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(tCly_species) + idx = tCly_species(N) + MW = tCly_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + IF ( idx == i_Cl2 .OR. idx == i_Cl2O2 .OR. idx == i_CFC114 .OR. & + idx == i_CFC12 .OR. idx == i_CH2Cl2 .OR. idx == i_HCFC123 .OR. & + idx == i_HCFC141b ) THEN + wgt = 2.0E+00_r8 + ELSEIF ( idx == i_CFC11 .OR. idx == i_CFC113 .OR. idx == i_CH3CCl3 .OR. & + idx == i_CHCl3 ) THEN + wgt = 3.0E+00_r8 + ELSEIF ( idx == i_CCl4 ) THEN + wgt = 4.0E+00_r8 + ENDIF + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'BROX' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(BrOx_species) + idx = BrOx_species(N) + MW = BrOx_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'BROY' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(BrOy_species) + idx = BrOy_species(N) + MW = BrOy_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + IF ( idx == i_Br2 ) THEN + wgt = 2.0E+00_r8 + ENDIF + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'TBRY' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(tBry_species) + idx = tBry_species(N) + MW = tBry_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + IF ( idx == i_Br2 .OR. idx == i_H2402 .OR. idx == i_CH2Br2 ) THEN + wgt = 2.0E+00_r8 + ENDIF + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'SOX' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(SOx_species) + idx = SOx_species(N) + MW = SOx_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'SOX_mmr' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(SOx_species) + idx = SOx_species(N) + MW = SOx_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + outTmp(:nY,:) = outTmp(:nY,:) + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'NHX' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(NHx_species) + idx = NHx_species(N) + MW = NHx_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'NHX_mmr' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(NHx_species) + idx = NHx_species(N) + MW = NHx_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + outTmp(:nY,:) = outTmp(:nY,:) + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + SpcName = 'TOTH' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp = 0.0e+00_r8 + DO N = 1, SIZE(TOTH_species) + idx = TOTH_species(N) + MW = TOTH_MWs(N) + IF ( idx <= 0 .OR. MW <= 0.0e+00_r8 ) CYCLE + wgt = 1.0E+00_r8 + IF ( idx == i_CH4 ) THEN + wgt = 2.0E+00_r8 + ENDIF + outTmp(:nY,:) = outTmp(:nY,:) & + + wgt * REAL(State_Chm%Species(1,:nY,nZ:1:-1,idx),r8) * MWDry / MW + ENDDO + CALL Outfld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + + ! =============================================== + ! Diagnose GEOS-Chem aerosol quantities + ! =============================================== + + IF ( hist_fld_active('SAD_PSC') .OR. hist_fld_active('RAD_PSC') ) THEN + outTmp = 0.0e+00_r8 + radTmp = 0.0e+00_r8 + DO J = 1, nY + DO L = 1, nZ + CALL GET_STRAT_OPT(1,J,L,1,RAER,REFF,SADSTRAT,XSASTRAT) + outTmp(J,nZ+1-L) = SADSTRAT + radTmp(J,nZ+1-L) = RAER + ENDDO + ENDDO + CALL Outfld( 'SAD_PSC', outTmp(:nY,:), nY, LCHNK ) + CALL Outfld( 'RAD_PSC', radTmp(:nY,:), nY, LCHNK ) + ENDIF + + IF ( hist_fld_active('SAD_SULFC') .OR. hist_fld_active('RAD_SULFC') ) THEN + outTmp = 0.0e+00_r8 + DO J = 1, nY + DO L = 1, nZ + CALL GET_STRAT_OPT(1,J,L,2,RAER,REFF,SADSTRAT,XSASTRAT) + outTmp(J,nZ+1-L) = SADSTRAT + radTmp(J,nZ+1-L) = RAER + ENDDO + ENDDO + CALL Outfld( 'SAD_SULFC', outTmp(:nY,:), nY, LCHNK ) + CALL Outfld( 'RAD_SULFC', radTmp(:nY,:), nY, LCHNK ) + ENDIF + + IF ( hist_fld_active('SAD_AERO') .OR. hist_fld_active('SAD_TROP') ) THEN + outTmp(:nY,:) = SUM(State_Chm%AeroArea(1,:nY,nZ:1:-1,:), DIM=3) + CALL Outfld( 'SAD_AERO', outTmp(:nY,:), nY, LCHNK ) + ENDIF + + IF ( hist_fld_active('SAD_TROP') ) THEN + DO J = 1, nY + DO L = 1, nZ + IF ( .NOT. State_Met%InTroposphere(1,J,nZ+1-L) ) THEN + outTmp(J,L) = 0.0e+00_r8 + ENDIF + ENDDO + ENDDO + CALL Outfld( 'SAD_TROP', outTmp(:nY,:), nY, LCHNK ) + ENDIF + + IF ( hist_fld_active('REFF_AERO') ) THEN + !outTmp(:nY,:) = State_Chm%AeroRadi(1,:nY,nZ:1:-1,:) + !CALL Outfld( 'REFF_AERO', outTmp(:nY,:), nY, LCHNK ) + ENDIF + + IF ( hist_fld_active('SULF_TROP') ) THEN + outTmp(:nY,:) = State_Chm%AeroArea(1,:nY,nZ:1:-1,NDUST+1) + CALL Outfld( 'SULF_TROP', outTmp(:nY,:), nY, LCHNK ) + ENDIF + + ! =============================================== + ! Diagnose stratospheric quantities + ! =============================================== + + outTmp(:nY,:) = State_Chm%Species(1,:nY,nZ:1:-1,i_HNO3) * MWDry / MW_HNO3 + CALL Outfld( 'HNO3_GAS', outTmp(:nY,:), nY, LCHNK ) + + ! TMMF, this requires to have access to the AERFRAC variable in ucx_mod. + !outTmp(:nY,:) = AERFRAC(1,:nY,nZ:1:-1,2) + !CALL Outfld( 'HNO3_STS', outTmp(:nY,:), nY, LCHNK ) + + outTmp = 0.0e+00_r8 + DO J = 1, nY + DO L = 1, nZ + IF ( State_Met%InTroposphere(1,J,nZ+1-L) ) CYCLE + outTmp(J,L) = State_Chm%Species(1,J,nZ+1-L,i_NIT) * MWDry / MW_NIT + ENDDO + ENDDO + CALL Outfld( 'HNO3_NAT', outTmp(:nY,:), nY, LCHNK ) + + outTmp(:nY,:) = outTmp(:nY,:) + & + ! AERFRAC(1,:nY,nZ:1:-1,2) + & + State_Chm%Species(1,:nY,nZ:1:-1,i_HNO3) * MWDry / MW_HNO3 + CALL Outfld( 'HNO3_TOTAL', outTmp(:nY,:), nY, LCHNK ) + + outTmp(:nY,:) = State_Chm%Species(1,:nY,nZ:1:-1,i_H2O) * MWDry / MW_H2O + CALL Outfld( 'H2O_GAS', outTmp(:nY,:), nY, LCHNK ) + + outTmp(:nY,:) = State_Chm%Species(1,:nY,nZ:1:-1,i_HCl) * MWDry / MW_HCl + CALL Outfld( 'HCL_GAS', outTmp(:nY,:), nY, LCHNK ) + + !outTmp(:nY,:) = AERFRAC(1,:nY,nZ:1:-1,3) + !CALL Outfld( 'HCL_STS', outTmp(:nY,:), nY, LCHNK ) + + outTmp(:nY,:) = 0.0e+00_r8 + !outTmp(:nY,:) = AERFRAC(1,:nY,nZ:1:-1,3) + outTmp(:nY,:) = outTmp(:nY,:) + & + State_Chm%Species(1,:nY,nZ:1:-1,i_HCl) * MWDry / MW_HCl + CALL Outfld( 'HCL_TOTAL', outTmp(:nY,:), nY, LCHNK ) + + ! =============================================== + ! Diagnose dry deposition velocities and fluxes + ! =============================================== + + IF ( Input_Opt%LDryD ) THEN + DO N = 1, State_Chm%nDryDep + ND = NDVZIND(N) + SpcName = 'DV_'//to_upper(TRIM(depName(N))) + IF ( .NOT. hist_fld_active(TRIM(SpcName)) ) CYCLE + CALL OutFld( TRIM(SpcName), State_Chm%DryDepVel(1,:nY,ND), nY, LCHNK ) + ENDDO + + DO N = 1, State_Chm%nAdvect + ! Get the species ID from the advected species ID + L = State_Chm%Map_Advect(N) + + ! Get info about this species from the species database + SpcInfo => State_Chm%SpcData(L)%Info + SpcName = 'DF_'//to_upper(TRIM(SpcInfo%Name)) + + IF ( .NOT. hist_fld_active(TRIM(SpcName)) ) CYCLE + ! SurfaceFlux is Emissions - Drydep, but Emissions = 0, as it is applied + ! externally + CALL OutFld( TRIM(SpcName), -State_Chm%SurfaceFlux(1,:nY,N), nY, LCHNK ) + + ! Free pointer + SpcInfo => NULL() + ENDDO + ENDIF + + ! =============================================== + ! Diagnose surface fluxes (emissions - drydep) + ! =============================================== + + DO N = iFirstCnst, pcnst + SpcName = TRIM(sflxnam_loc(N)) + IF ( TRIM(SpcName) == '' ) CYCLE + IF ( .NOT. hist_fld_active(TRIM(SpcName)) ) CYCLE + CALL OutFld( TRIM(SpcName), cam_in%cflx(:nY,N), nY, LCHNK ) + ENDDO + + ! =============================================== + ! Diagnose chemical tendencies + ! =============================================== + + ! Chemical tendencies in kg/kg/s + DO N = 1, gas_pcnst + SpcName = TRIM(srcnam(N)) + IF ( TRIM(SpcName) == '' ) CYCLE + IF ( .NOT. hist_fld_active(TRIM(SpcName)) ) CYCLE + CALL OutFld( TRIM(SpcName), mmr_tend(:nY,:nZ,N), nY, LCHNK ) + ENDDO + + ! Chemical tendencies in kg/s + DO N = 1, gas_pcnst + SpcName = TRIM(dtchem_name(N)) + IF ( .NOT. hist_fld_active(TRIM(SpcName)) ) CYCLE + outTmp = 0.0e+0_r8 + outTmp(:nY,:nZ) = mmr_tend(:nY,:nZ,N) * REAL(State_Met%AD(1,:nY,nZ:1:-1),r8) + CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDDO + + ! =============================================== + ! Diagnose photolysis rates + ! =============================================== + + IF ( ASSOCIATED(State_Diag%Jval) ) THEN + DO M = 1, nPhotol + CALL get_TagInfo( Input_Opt = Input_Opt, & + tagID = 'PHO', & + State_Chm = State_Chm, & + Found = Found, & + RC = RC, & + N = M, & + tagName = tagName ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Abnormal exit from routine "Get_TagInfo"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + SpcName = 'Jval_' // TRIM( tagName ) + IF ( .NOT. hist_fld_active(TRIM(SpcName)) ) CYCLE + outTmp(:nY,:nZ) = REAL(State_Diag%Jval(1,:nY,nZ:1:-1,M),r8) + CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDDO + ENDIF + IF ( ASSOCIATED(State_Diag%JvalO3O1D) ) THEN + SpcName = 'Jval_O3O1D' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp(:nY,:nZ) = REAL(State_Diag%JvalO3O1D(1,:nY,nZ:1:-1),r8) + CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + ENDIF + IF ( ASSOCIATED(State_Diag%JvalO3O3P) ) THEN + SpcName = 'Jval_O3O3P' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp(:nY,:nZ) = REAL(State_Diag%JvalO3O3P(1,:nY,nZ:1:-1),r8) + CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ENDIF + ENDIF + + ! =============================================== + ! Diagnose fields corresponding to State_Met + ! =============================================== + + ! Copied from Headers/registry_mod.F90 + ! Point to the head node of the Registry + Current => State_Met%Registry + + Source_KindVal = KINDVAL_F8 + Output_KindVal = KINDVAL_F8 + + ! As long as the current node isn't NULL + DO WHILE( ASSOCIATED( Current ) ) + + ! Get the REGISTRY ITEM belonging to this node of the Registry + Item => Current%Item + + ! Only print on the root CPU + IF ( ASSOCIATED( Item ) ) THEN + + SpcName = TRIM(Item%FullName) + IF (( TRIM(Item%FullName(1:8)) /= 'MET_XLAI' ) .AND. & + ( TRIM(Item%FullName(1:8)) /= 'MET_IUSE' ) .AND. & + ( TRIM(Item%FullName(1:9)) /= 'MET_ILAND' )) THEN + CALL Registry_Lookup( am_I_Root = Input_Opt%amIRoot, & + Registry = State_Met%Registry, & + RegDict = State_Met%RegDict, & + State = State_Met%State, & + Variable = Item%FullName, & + Source_KindVal = Source_KindVal, & + Output_KindVal = Output_KindVal, & + Rank = Rank, & + OnLevelEdges = OnLevelEdges, & + Ptr0d_8 = Ptr0d_8, & + Ptr1d_8 = Ptr1d_8, & + Ptr2d_8 = Ptr2d_8, & + Ptr3d_8 = Ptr3d_8, & + RC = RC ) + + !IF ( hist_fld_active(TRIM(SpcName)) ) THEN + ! IF ( Source_KindVal /= KINDVAL_I4 ) THEN + ! IF ( Rank == 2 ) THEN + ! outTmp(:nY,nZ) = REAL(Ptr2d_8(1,:nY),r8) + ! CALL Outfld( TRIM( Item%FullName ), outTmp(:nY,nZ), nY, LCHNK ) + ! ELSEIF ( Rank == 3 ) THEN + ! ! For now, treat variables defined on level edges by ignoring top + ! ! most layer + ! outTmp(:nY,:nZ) = REAL(Ptr3d_8(1,:nY,nZ:1:-1),r8) + ! CALL Outfld( TRIM( Item%FullName ), outTmp(:nY,:), nY, LCHNK ) + ! ELSE + ! IF ( rootChunk ) Write(iulog,*) " Item ", TRIM(Item%FullName), & + ! " is of rank ", Rank, " and will not be diagnosed!" + ! ENDIF + ! ENDIF + !ENDIF + ENDIF + + ENDIF + + ! Point to next node of the Registry + Current => Current%Next + + ENDDO + + SpcName = 'SZA' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp(:nY,1) = ACOS(MIN(MAX(State_Met%SUNCOS(1,:nY),-1._r8),1._r8))/pi*180.e+0_r8 + CALL Outfld( TRIM(SpcName), outTmp(:nY,1) , nY, LCHNK ) + ENDIF + + SpcName = 'U_SRF' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp(:nY,:) = state%u(:nY,:) + CALL Outfld( TRIM(SpcName), outTmp(:nY,:) , nY, LCHNK ) + ENDIF + + SpcName = 'V_SRF' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp(:nY,:) = state%v(:nY,:) + CALL Outfld( TRIM(SpcName), outTmp(:nY,:) , nY, LCHNK ) + ENDIF + + SpcName = 'Q_SRF' + IF ( hist_fld_active(TRIM(SpcName)) ) THEN + outTmp(:nY,:) = State_Chm%Species(1,:nY,nZ:1:-1,i_H2O) + CALL Outfld( TRIM(SpcName), outTmp(:nY,:) , nY, LCHNK ) + ENDIF + + !======================================================================= + ! Cleanup and quit + !======================================================================= + Current => NULL() + Item => NULL() + Ptr0d_8 => NULL() + Ptr1d_8 => NULL() + Ptr2d_8 => NULL() + Ptr3d_8 => NULL() + + END SUBROUTINE CESMGC_Diag_Calc +!EOC +!------------------------------------------------------------------------------ + END MODULE CESMGC_Diag_Mod + diff --git a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 new file mode 100644 index 0000000000..2a1ff841b2 --- /dev/null +++ b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 @@ -0,0 +1,540 @@ +!------------------------------------------------------------------------------ +! "GEOS-Chem" chemistry emissions interface ! +!------------------------------------------------------------------------------ +!BOP +! +! !MODULE: cesmgc_emissions_mod.F90 +! +! !DESCRIPTION: Module cesmgc\_emissions\_mod contains routines which retrieve +! emission fluxes from HEMCO and transfers it back to the CESM-GC interface +!\\ +!\\ +! !INTERFACE: +! +MODULE CESMGC_Emissions_Mod +! +! !USES: +! + USE SHR_KIND_MOD, ONLY : r8 => shr_kind_r8 + USE SPMD_UTILS, ONLY : MasterProc + USE CAM_ABORTUTILS, ONLY : endrun + USE CHEM_MODS, ONLY : iFirstCnst + USE CONSTITUENTS, ONLY : pcnst, cnst_name + USE SHR_MEGAN_MOD, ONLY : shr_megan_mechcomps, shr_megan_mechcomps_n + USE CAM_LOGFILE, ONLY : iulog + + IMPLICIT NONE + + PRIVATE + +! +! !PUBLIC MEMBER FUNCTIONS: +! + PUBLIC :: CESMGC_Emissions_Init + PUBLIC :: CESMGC_Emissions_Calc + PUBLIC :: CESMGC_Emissions_Final + + ! Constituent number for NO + INTEGER :: iNO + + ! Aerosol constituent number + INTEGER :: iBC1 + INTEGER :: iBC4 + INTEGER :: iH2SO4 + INTEGER :: iSOA11 + INTEGER :: iSOA12 + INTEGER :: iSOA21 + INTEGER :: iSOA22 + INTEGER :: iSOA31 + INTEGER :: iSOA32 + INTEGER :: iSOA41 + INTEGER :: iSOA42 + INTEGER :: iSOA51 + INTEGER :: iSOA52 + INTEGER :: iPOM1 + INTEGER :: iPOM4 + + INTEGER :: iBCPI + INTEGER :: iBCPO + INTEGER :: iOCPI + INTEGER :: iOCPO + INTEGER :: iSO4 + INTEGER :: iSOAS + + ! MEGAN Emissions + INTEGER, ALLOCATABLE :: megan_indices_map(:) + REAL(r8), ALLOCATABLE :: megan_wght_factors(:) + +! +! !REVISION HISTORY: +! 07 Oct 2020 - T. M. Fritz - Initial version +!EOP +!------------------------------------------------------------------------------ +!BOC +! +CONTAINS +! +!EOC +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: cesmgc_emissions_init +! +! !DESCRIPTION: Subroutine CESMGC\_Emissions\_Init initializes the emissions +! routine +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) +! +! !USES: +! + USE PHYSICS_TYPES, ONLY : physics_state + USE CONSTITUENTS, ONLY : cnst_get_ind + USE MO_CHEM_UTLS, ONLY : get_spc_ndx + USE CAM_HISTORY, ONLY : addfld, add_default, horiz_only + USE MO_LIGHTNING, ONLY : lightning_inti + USE FIRE_EMISSIONS, ONLY : fire_emissions_init + USE CHEM_MODS, ONLY : adv_mass + USE INFNAN, ONLY : NaN, assignment(=) +! +! !INPUT PARAMETERS: +! + REAL(r8), INTENT(IN ) :: lght_no_prd_factor ! Lightning scaling factor +! +! !REVISION HISTORY: +! 07 Oct 2020 - T. M. Fritz - Initial version +!EOP +!------------------------------------------------------------------------------ +!BOC +! + ! Integers + INTEGER :: IERR + INTEGER :: N, II + + ! Strings + CHARACTER(LEN=255) :: SpcName + CHARACTER(LEN=255) :: Description + + ! Real + REAL(r8) :: MW + + !================================================================= + ! CESMGC_Emissions_Init begins here! + !================================================================= + + ! Get constituent index for NO + CALL cnst_get_ind('NO', iNO, abort=.True.) + +#if defined( MODAL_AERO_4MODE ) + ! Get constituent index for aerosols + CALL cnst_get_ind('soa1_a1', iSOA11, abort=.True.) + CALL cnst_get_ind('soa1_a2', iSOA12, abort=.True.) + CALL cnst_get_ind('soa2_a1', iSOA21, abort=.True.) + CALL cnst_get_ind('soa2_a2', iSOA22, abort=.True.) + CALL cnst_get_ind('soa3_a1', iSOA31, abort=.True.) + CALL cnst_get_ind('soa3_a2', iSOA32, abort=.True.) + CALL cnst_get_ind('soa4_a1', iSOA41, abort=.True.) + CALL cnst_get_ind('soa4_a2', iSOA42, abort=.True.) + CALL cnst_get_ind('soa5_a1', iSOA51, abort=.True.) + CALL cnst_get_ind('soa5_a2', iSOA52, abort=.True.) + + CALL cnst_get_ind('SOAS', iSOAS, abort=.True.) +#endif + + !----------------------------------------------------------------------- + ! ... initialize the lightning module + !----------------------------------------------------------------------- + CALL lightning_inti(lght_no_prd_factor) + + !----------------------------------------------------------------------- + ! ... MEGAN emissions + !----------------------------------------------------------------------- + IF ( shr_megan_mechcomps_n > 0 ) THEN + + ALLOCATE( megan_indices_map(shr_megan_mechcomps_n), STAT=IERR ) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating megan_indices_map') + ALLOCATE( megan_wght_factors(shr_megan_mechcomps_n), STAT=IERR ) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating megan_wght_factors') + megan_wght_factors(:) = NaN + + DO N = 1, shr_megan_mechcomps_n + SpcName = TRIM(shr_megan_mechcomps(N)%name) + ! Special handlings for GEOS-Chem species + IF ( TRIM(SpcName) == 'MTERP' ) THEN + SpcName = 'MTPA' + ELSEIF ( TRIM(SpcName) == 'BCARY' ) THEN + SpcName = 'None' + MW = 204.342600_r8 ! Taken from pp_trop_strat_mam4_vbs + ELSEIF ( TRIM(SpcName) == 'CH3OH' ) THEN + SpcName = 'MOH' + ELSEIF ( TRIM(SpcName) == 'C2H5OH' ) THEN + SpcName = 'EOH' + ELSEIF ( TRIM(SpcName) == 'CH3CHO' ) THEN + SpcName = 'ALD2' + ELSEIF ( TRIM(SpcName) == 'CH3COOH' ) THEN + SpcName = 'ACTA' + ELSEIF ( TRIM(SpcName) == 'CH3COCH3' ) THEN + SpcName = 'ACET' + ELSEIF ( TRIM(SpcName) == 'HCN' ) THEN + SpcName = 'None' + MW = 27.025140_r8 ! Taken from pp_trop_strat_mam4_vbs + ELSEIF ( TRIM(SpcName) == 'C2H4' ) THEN + SpcName = 'None' + MW = 28.051600_r8 ! Taken from pp_trop_strat_mam4_vbs + ELSEIF ( TRIM(SpcName) == 'C3H6' ) THEN + SpcName = 'PRPE' + ELSEIF ( TRIM(SpcName) == 'BIGALK' ) THEN + ! BIGALK = Pentane + Hexane + Heptane + Tricyclene + SpcName = 'ALK4' + ELSEIF ( TRIM(SpcName) == 'BIGENE' ) THEN + ! BIGENE = butene (C4H8) + SpcName = 'PRPE' ! Lumped >= C3 alkenes + ELSEIF ( TRIM(SpcName) == 'TOLUENE' ) THEN + SpcName = 'TOLU' + ENDIF + + CALL cnst_get_ind (SpcName, megan_indices_map(N), abort=.False.) + II = get_spc_ndx(SpcName) + IF ( II > 0 ) THEN + SpcName = TRIM(shr_megan_mechcomps(N)%name) + megan_wght_factors(N) = adv_mass(II)*1.e-3_r8 ! kg/moles (to convert moles/m2/sec to kg/m2/sec) + Description = TRIM(SpcName)//' MEGAN emissions flux (released as '//TRIM(SpcName)//' in GEOS-Chem)' + ELSEIF ( TRIM(SpcName) == 'None' ) THEN + SpcName = TRIM(shr_megan_mechcomps(N)%name) + megan_wght_factors(N) = MW*1.e-3_r8 ! kg/moles + IF ( MasterProc ) Write(iulog,*) " MEGAN ", TRIM(SpcName), & + " emissions will be ignored as no species match in GEOS-Chem." + Description = TRIM(SpcName)//' MEGAN emissions flux (not released in GEOS-Chem)' + ELSE + SpcName = TRIM(shr_megan_mechcomps(N)%name) + CALL ENDRUN( 'chem_init: MEGAN compound not in chemistry mechanism : '//TRIM(SpcName)) + ENDIF + + ! MEGAN history fields + CALL Addfld( 'MEG_'//TRIM(SpcName), horiz_only, 'A', 'kg/m2/s', & + Description ) + + !if (history_chemistry) then + CALL Add_default('MEG_'//TRIM(SpcName), 1, ' ') + !endif + ENDDO + ENDIF + + DO N = iFirstCnst, pcnst + SpcName = TRIM(cnst_name(N))//'_XFRC' + CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', 'molec/cm3/s', & + 'External forcing for '//TRIM(cnst_name(N))) + SpcName = TRIM(cnst_name(N))//'_CLXF' + CALL Addfld( TRIM(SpcName), horiz_only, 'A', 'molec/cm2/s', & + 'Vertically-integrated external forcing for '//TRIM(cnst_name(N))) + SpcName = TRIM(cnst_name(N))//'_CMXF' + CALL Addfld( TRIM(SpcName), horiz_only, 'A', 'kg/m2/s', & + 'Vertically-integrated external forcing for '//TRIM(cnst_name(N))) + ENDDO + + CALL Addfld( 'NO_Lightning', (/ 'lev' /), 'A','molec/cm3/s', & + 'lightning NO source' ) + + !----------------------------------------------------------------------- + ! ... Fire emissions + !----------------------------------------------------------------------- + CALL fire_emissions_init() + + END SUBROUTINE CESMGC_Emissions_Init +!EOC +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: cesmgc_emissions_calc +! +! !DESCRIPTION: Subroutine CESMGC\_Emissions\_Calc retrieves emission fluxes +! from HEMCO and returns a 3-D array of emission flux to the CESM-GC +! interface. On top of passing data, this routine handles a number of checks. +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iStep ) +! +! !USES: +! + USE State_Met_Mod, ONLY : MetState + USE CAMSRFEXCH, ONLY : cam_in_t + USE CONSTITUENTS, ONLY : cnst_get_ind, cnst_mw + USE PHYSICS_TYPES, ONLY : physics_state + USE PHYSICS_BUFFER, ONLY : pbuf_get_index, pbuf_get_chunk + USE PHYSICS_BUFFER, ONLY : physics_buffer_desc, pbuf_get_field + USE PPGRID, ONLY : pcols, pver, begchunk + USE CAM_HISTORY, ONLY : outfld + USE STRING_UTILS, ONLY : to_upper + + ! Data from CLM + USE CAM_CPL_INDICES, ONLY : index_x2a_Fall_flxvoc + + ! Lightning emissions + USE MO_LIGHTNING, ONLY : prod_NO + + ! Fire emissions + USE FIRE_EMISSIONS, ONLY : fire_emissions_srf + USE FIRE_EMISSIONS, ONLY : fire_emissions_vrt + + ! Aerosol emissions + USE AERO_MODEL, ONLY : aero_model_emissions + + ! GEOS-Chem version of physical constants + USE PHYSCONSTANTS, ONLY : AVO + ! CAM version of physical constants + USE PHYSCONST, ONLY : rga, avogad +! +! !INPUT PARAMETERS: +! + TYPE(physics_state), INTENT(IN ) :: state ! Physics state variables + TYPE(physics_buffer_desc), POINTER, INTENT(IN ) :: hco_pbuf2d(:,:) ! Pointer to 2-D pbuf + TYPE(MetState), INTENT(IN ) :: State_Met ! Meteorology State object + INTEGER, INTENT(IN ) :: iStep +! +! !OUTPUT PARAMETERS: +! + TYPE(cam_in_t), INTENT(INOUT) :: cam_in ! import state + REAL(r8), INTENT( OUT) :: eflx(pcols,pver,pcnst) ! 3-D emissions in kg/m2/s +! +! !REVISION HISTORY: +! 07 Oct 2020 - T. M. Fritz - Initial version +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + ! Integers + INTEGER :: LCHNK + INTEGER :: nY, nZ + INTEGER :: J, L, N + INTEGER :: RC ! return code + INTEGER :: tmpIdx ! pbuf field id + + ! Logical + LOGICAL :: rootChunk + + ! Objects + TYPE(physics_buffer_desc), POINTER :: pbuf_chnk(:) ! slice of pbuf in current chunk + + ! Real + REAL(r8), POINTER :: pbuf_ik(:,:) ! pointer to pbuf data (/pcols,pver/) + REAL(r8), DIMENSION(state%NCOL,PVER+1) :: zint ! Interface geopotential in km + REAL(r8), DIMENSION(state%NCOL) :: zsurf ! Surface height + REAL(r8) :: SCALFAC ! Multiplying factor + REAL(r8) :: megflx(pcols) ! For MEGAN emissions + REAL(r8), PARAMETER :: m2km = 1.e-3_r8 + + ! Strings + CHARACTER(LEN=255) :: SpcName + CHARACTER(LEN=255) :: fldname_ns ! field name HCO_* + + !================================================================= + ! CESMGC_Emissions_Calc begins here! + !================================================================= + + ! Initialize pointers + pbuf_chnk => NULL() + pbuf_ik => NULL() + + ! LCHNK: which chunk we have on this process + LCHNK = state%LCHNK + ! nY: number of atmospheric columns on this chunk + nY = state%NCOL + nZ = PVER + rootChunk = ( MasterProc .AND. ( LCHNK.EQ.BEGCHUNK ) ) + + ! Initialize emission flux + eflx(:,:,:) = 0.0e+0_r8 + + DO N = iFirstCnst, pcnst + fldname_ns = 'HCO_'//TRIM(cnst_name(N)) + tmpIdx = pbuf_get_index(fldname_ns, RC) + + IF ( tmpIdx < 0 .OR. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,'(a,a)') " CESMGC_Emissions_Calc: Field not found ", & + TRIM(fldname_ns) + ELSE + ! This is already in chunk, retrieve it + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + + IF ( .NOT. ASSOCIATED(pbuf_ik) ) THEN ! Sanity check + CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_ik not associated") + ENDIF + + eflx(1:nY,:nZ,N) = pbuf_ik(1:nY,:nZ) + + ! Reset pointers + pbuf_ik => NULL() + pbuf_chnk => NULL() + + IF ( MINVAL(eflx(:nY,:nZ,N)) < 0.0e+00_r8 ) THEN + Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO emission flux is negative for ", & + TRIM(cnst_name(N)), " with value ", MINVAL(eflx(:nY,:nZ,N)), " at ", & + MINLOC(eflx(:nY,:nZ,N)) + ENDIF + + IF ( rootChunk .and. ( MAXVAL(eflx(:nY,:nZ,N)) > 0.0e+0_r8 ) ) THEN + Write(iulog,'(a,a,a,a)') " CESMGC_Emissions_Calc: HEMCO flux ", & + TRIM(fldname_ns), " added to ", TRIM(cnst_name(N)) + Write(iulog,'(a,a,E16.4)') " CESMGC_Emissions_Calc: Maximum flux ", & + TRIM(fldname_ns), MAXVAL(eflx(:nY,:nZ,N)) + ENDIF + ENDIF + ENDDO + +#if defined( MODAL_AERO_4MODE ) + !----------------------------------------------------------------------- + ! Aerosol emissions (dust + seasalt) ... + !----------------------------------------------------------------------- + call aero_model_emissions( state, cam_in ) + + ! Since GEOS-Chem DST* aerosols are inherited from MAM's DST, we do not + ! need to feed MAM dust emissions into the GEOS-Chem DST* constituents + ! Same thing applies for sea salt. + + ! HEMCO aerosol emissions are fed to MAM through the HEMCO_Config.rc + ! where all GEOS-Chem aerosols (BCPI, BCPO, OCPI, OCPO, SO4) have been + ! replaced with the corresponding MAM aerosols + + ! For SOA emission, split evently GEOS-Chem SOAS emission into each + ! VBS bin. + eflx(:nY,:nZ,iSOA11) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 + eflx(:nY,:nZ,iSOA12) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 + eflx(:nY,:nZ,iSOA21) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 + eflx(:nY,:nZ,iSOA22) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 + eflx(:nY,:nZ,iSOA31) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 + eflx(:nY,:nZ,iSOA32) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 + eflx(:nY,:nZ,iSOA41) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 + eflx(:nY,:nZ,iSOA42) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 + eflx(:nY,:nZ,iSOA51) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 + eflx(:nY,:nZ,iSOA52) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 + eflx(:nY,:nZ,iSOAS) = 0.0e+00_r8 + +#endif + + ! Output fields before lightning NO emissions are applied to eflx + DO N = iFirstCnst, pcnst + SpcName = TRIM(cnst_name(N))//'_XFRC' + CALL Outfld( TRIM(SpcName), eflx(:nY,:nZ,N) / State_Met%BXHEIGHT(1,:nY,nZ:1:-1) * 1.0E-06 / cnst_mw(N) * avogad, nY, LCHNK ) + + SpcName = TRIM(cnst_name(N))//'_CLXF' + ! Convert from kg/m2/s to molec/cm2/s + ! Note 1: cnst_mw is in kg/kmole + ! Note 2: avogad is in molecules/kmole + CALL Outfld( TRIM(SpcName), SUM(eflx(:nY,:nZ,N), DIM=2) * 1.0E-04 / cnst_mw(N) * avogad, nY, LCHNK ) + + SpcName = TRIM(cnst_name(N))//'_CMXF' + CALL Outfld( TRIM(SpcName), SUM(eflx(:nY,:nZ,N), DIM=2), nY, LCHNK ) + ENDDO + + !----------------------------------------------------------------------- + ! Lightning NO emissions + !----------------------------------------------------------------------- + N = iNO + + ! prod_NO is in atom N cm^-3 s^-1 <=> molec cm^-3 s^-1 + ! We need to convert this to kg NO/m2/s + ! Multiply by MWNO * BXHEIGHT * 1.0E+06 / AVO + ! = mole/molec * kg NO/mole * m * cm^3/m^3 + ! cnst_mw(N) is in g/mole + SCALFAC = cnst_mw(N) * 1.0E-03 * 1.0E+06 / AVO + DO J = 1, nY + DO L = 1, nZ + eflx(J,L,N) = eflx(J,L,N) & + + prod_NO(J,L,LCHNK) & + * State_Met%BXHEIGHT(1,J,nZ+1-L) & + * SCALFAC + ENDDO + ENDDO + + CALL Outfld( 'NO_Lightning', prod_NO(:nY,:nZ,LCHNK), nY, LCHNK ) + + !----------------------------------------------------------------------- + ! MEGAN emissions ... + !----------------------------------------------------------------------- + + IF ( index_x2a_Fall_flxvoc > 0 .AND. shr_megan_mechcomps_n > 0 ) THEN + ! set MEGAN fluxes + DO N = 1, shr_megan_mechcomps_n + DO J = 1, nY + megflx(J) = -cam_in%meganflx(J,N) * megan_wght_factors(N) + ENDDO + IF ( ( megan_indices_map(N) > 0 ) .AND. ( megan_wght_factors(N) > 0.0e+00_r8 ) ) THEN + DO J = 1, nY + cam_in%cflx(J,megan_indices_map(N)) = cam_in%cflx(J,megan_indices_map(N)) & + + megflx(J) + ENDDO + ENDIF + ! output MEGAN emis fluxes to history + CALL Outfld('MEG_'//TRIM(shr_megan_mechcomps(N)%name), megflx(:nY), nY, LCHNK) + ENDDO + ENDIF + + !----------------------------------------------------------------------- + ! Fire surface emissions if not elevated forcing + !----------------------------------------------------------------------- + + CALL fire_emissions_srf( LCHNK, nY, cam_in%fireflx, cam_in%cflx ) + + !----------------------------------------------------------------------- + ! Apply CLM emissions (for elevated forcing) + !----------------------------------------------------------------------- + + ! Compute geopotential height in km (needed for vertical distribution of + ! fire emissions + zsurf(:nY) = rga * state%phis(:nY) + DO L = 1, nZ + zint(:nY,L) = m2km * ( state%zi(:nY,L) + zsurf(:nY) ) + ENDDO + L = nZ+1 + zint(:nY,L) = m2km * ( state%zi(:nY,L) + zsurf(:nY) ) + + ! Distributed fire emissions if elevated forcing + ! extfrc is in molec/cm3/s + ! TMMF - vertical distribution of fire emissions is not implemented yet + !CALL fire_emissions_vrt( nY, LCHNK, zint, cam_in%fireflx, cam_in%fireztop, extfrc ) + + !----------------------------------------------------------------------- + ! Add near-surface emissions to surface flux boundary condition + !----------------------------------------------------------------------- + cam_in%cflx(1:nY,:) = cam_in%cflx(1:nY,:) + eflx(1:nY,nZ,:) + eflx(1:nY,nZ,:) = 0.0e+00_r8 + + END SUBROUTINE CESMGC_Emissions_Calc +!EOC +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: cesmgc_emissions_final +! +! !DESCRIPTION: Subroutine CESMGC\_Emissions\_Final cleans up the module +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE CESMGC_Emissions_Final +! +! !REVISION HISTORY: +! 07 Oct 2020 - T. M. Fritz - Initial version +!EOP +!------------------------------------------------------------------------------ +!BOC +! + !================================================================= + ! CESMGC_Emissions_Final begins here! + !================================================================= + + IF ( ALLOCATED( megan_indices_map ) ) DEALLOCATE( megan_indices_map ) + IF ( ALLOCATED( megan_wght_factors ) ) DEALLOCATE( megan_wght_factors ) + + END SUBROUTINE CESMGC_Emissions_Final +!EOC +!------------------------------------------------------------------------------ +!EOC + END MODULE CESMGC_Emissions_Mod diff --git a/src/chemistry/pp_geoschem/charge_neutrality.F90 b/src/chemistry/geoschem/charge_neutrality.F90 similarity index 100% rename from src/chemistry/pp_geoschem/charge_neutrality.F90 rename to src/chemistry/geoschem/charge_neutrality.F90 diff --git a/src/chemistry/pp_geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 similarity index 71% rename from src/chemistry/pp_geoschem/chem_mods.F90 rename to src/chemistry/geoschem/chem_mods.F90 index af430ac0ca..c2b9919a94 100644 --- a/src/chemistry/pp_geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -7,7 +7,7 @@ module chem_mods implicit none save - INTEGER, PARAMETER :: nTracersMax = 200 ! Must be equal to nadv_chem + INTEGER, PARAMETER :: nTracersMax = 250 ! Must be equal to nadv_chem INTEGER :: nTracers CHARACTER(LEN=255) :: tracerNames(nTracersMax) CHARACTER(LEN=255) :: tracerLongNames(nTracersMax) @@ -15,18 +15,38 @@ module chem_mods REAL(r8) :: MWRatio(nTracersMax) REAL(r8) :: ref_MMR(nTracersMax) + ! Index of first constituent + INTEGER :: iFirstCnst + ! Short-lived species (i.e. not advected) - INTEGER, PARAMETER :: nSlsMax = 500 ! UNadvected species only - INTEGER :: nSls - CHARACTER(LEN=255) :: slsNames(nSlsMax) - CHARACTER(LEN=255) :: slsLongnames(nSlsMax) - REAL(r8) :: sls_Ref_MMR(nSlsMax) - REAL(r8) :: slsMWRatio(nSlsMax) + INTEGER, PARAMETER :: nSlsMax = 500 ! UNadvected species only + INTEGER :: nSls + CHARACTER(LEN=255) :: slsNames(nSlsMax) + CHARACTER(LEN=255) :: slsLongnames(nSlsMax) + REAL(r8) :: sls_Ref_MMR(nSlsMax) ! Mapping between constituents and GEOS-Chem tracers INTEGER :: map2GC(pcnst) + INTEGER :: map2GCinv(nTracersMax) INTEGER :: map2GC_Sls(nSlsMax) + ! Mapping constituent onto chemical species (as listed in solsym) + INTEGER :: mapCnst(pcnst) + + ! Aerosols + INTEGER, PARAMETER :: nAerMax = 35 + INTEGER :: nAer + CHARACTER(LEN=16) :: aerNames(nAerMax) + REAL(r8) :: aerAdvMass(nAerMax) + + !----------------------------- + ! Aerosol index mapping + !----------------------------- + ! map2MAM4 maps aerNames onto the GEOS-Chem Species array such + ! that + ! State_Chm%Species(1,:,:,map2MAM4(:,:)) = state%q(:,:,MAM4_Indices) + INTEGER, ALLOCATABLE :: map2MAM4(:,:) + !----------------------------- ! Dry deposition index mapping !----------------------------- @@ -39,20 +59,16 @@ module chem_mods ! State_Chm%DryDepVel(1,:,map2GC_dryDep(:)) = cam_in%depVel(:,:) INTEGER, ALLOCATABLE :: map2GC_dryDep(:) - - ! Mapping from constituents to raw index - INTEGER :: map2Idx(pcnst) - INTEGER, PARAMETER :: phtcnt = 40, & ! number of photolysis reactions rxntot = 212, & ! number of total reactions gascnt = 172, & ! number of gas phase reactions nabscol = 2, & ! number of absorbing column densities - gas_pcnst = 103, & ! number of "gas phase" species - nfs = 4, & ! number of "fixed" species + gas_pcnst = 318, & ! number of "gas phase" species + nfs = 6, & ! number of "fixed" species relcnt = 0, & ! number of relationship species grpcnt = 0, & ! number of group members nzcnt = 824, & ! number of non-zero matrix entries - extcnt = 4, & ! number of species with external forcing + extcnt = 0, & ! number of species with external forcing clscnt1 = 8, & ! number of species in explicit class clscnt2 = 0, & ! number of species in hov class clscnt3 = 0, & ! number of species in ebi class @@ -69,7 +85,7 @@ module chem_mods integer :: clsmap(gas_pcnst,5) = 0 integer :: permute(gas_pcnst,5) = 0 integer :: diag_map(clscnt4) = 0 - !real(r8) :: adv_mass(gas_pcnst) = 0._r8 + real(r8) :: adv_mass(gas_pcnst) = 0._r8 real(r8) :: crb_mass(gas_pcnst) = 0._r8 real(r8) :: fix_mass(max(1,nfs)) real(r8), allocatable :: cph_enthalpy(:) @@ -88,4 +104,8 @@ module chem_mods integer :: nslvd character(len=255), allocatable :: slvd_lst(:) real(r8), allocatable :: slvd_ref_mmr(:) + + ! Mapping between chemical species and GEOS-Chem species/other tracers + INTEGER :: map2chm(gas_pcnst) + end module chem_mods diff --git a/src/chemistry/pp_geoschem/chem_prod_loss_diags.F90 b/src/chemistry/geoschem/chem_prod_loss_diags.F90 similarity index 100% rename from src/chemistry/pp_geoschem/chem_prod_loss_diags.F90 rename to src/chemistry/geoschem/chem_prod_loss_diags.F90 diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 new file mode 100644 index 0000000000..ec97c95ec1 --- /dev/null +++ b/src/chemistry/geoschem/chemistry.F90 @@ -0,0 +1,4215 @@ +!================================================================================================ +! This is the "GEOS-Chem" chemistry module. +!================================================================================================ + +module chemistry + use shr_kind_mod, only : r8 => shr_kind_r8, shr_kind_cl + use physics_types, only : physics_state, physics_ptend, physics_ptend_init + use physics_buffer, only : physics_buffer_desc + use ppgrid, only : begchunk, endchunk, pcols + use ppgrid, only : pver, pverp + use constituents, only : pcnst, cnst_add, cnst_get_ind + use constituents, only : cnst_name + use shr_const_mod, only : molw_dryair=>SHR_CONST_MWDAIR + use seq_drydep_mod, only : nddvels => n_drydep, drydep_list + use spmd_utils, only : MasterProc, myCPU=>Iam, nCPUs=>npes + use cam_logfile, only : iulog + use string_utils, only : to_upper + + !-------------------------------------------------------------------- + ! Basic GEOS-Chem modules + !-------------------------------------------------------------------- + USE DiagList_Mod, ONLY : DgnList ! Derived type for diagnostics list + USE TaggedDiagList_Mod, ONLY : TaggedDgnList ! Derived type for tagged diagnostics list + USE Input_Opt_Mod, ONLY : OptInput ! Derived type for Input Options + USE State_Chm_Mod, ONLY : ChmState ! Derived type for Chemistry State object + USE State_Diag_Mod, ONLY : DgnState ! Derived type for Diagnostics State object + USE State_Grid_Mod, ONLY : GrdState ! Derived type for Grid State object + USE State_Met_Mod, ONLY : MetState ! Derived type for Meteorology State object + USE Species_Mod, ONLY : Species ! Derived type for Species object + USE GC_Environment_Mod ! Runtime GEOS-Chem environment + USE ErrCode_Mod ! Error codes for success or failure + USE Error_Mod ! For error checking + + !----------------------------------------------------------------- + ! Parameters to define floating-point variables + !----------------------------------------------------------------- + USE PRECISION_MOD, ONLY : fp, f4 ! Flexible precision + + use chem_mods, only : nSlvd, slvd_Lst, slvd_ref_MMR + + ! Exit routine in CAM + use cam_abortutils, only : endrun + + use chem_mods, only : nTracersMax + use chem_mods, only : nTracers + use chem_mods, only : gas_pcnst + use chem_mods, only : tracerNames + use chem_mods, only : adv_mass + use chem_mods, only : ref_MMR + use chem_mods, only : iFirstCnst + use chem_mods, only : nSlsMax + use chem_mods, only : nSls + use chem_mods, only : slsNames + use chem_mods, only : sls_ref_MMR + use chem_mods, only : nAerMax + use chem_mods, only : nAer + use chem_mods, only : aerNames + use chem_mods, only : aerAdvMass + use chem_mods, only : map2GC, map2GCinv + use chem_mods, only : map2GC_Sls + use chem_mods, only : mapCnst + use chem_mods, only : map2chm + use chem_mods, only : map2MAM4 + + use mo_tracname, only : solsym + + IMPLICIT NONE + PRIVATE + SAVE + ! + ! Public interfaces + ! + public :: chem_is ! identify which chemistry is being used + public :: chem_register ! register consituents + public :: chem_is_active ! returns true if this package is active (ghg_chem=.true.) + public :: chem_implements_cnst ! returns true if consituent is implemented by this package + public :: chem_init_cnst ! initialize mixing ratios if not read from initial file + public :: chem_init ! initialize (history) variables + public :: chem_timestep_tend ! interface to tendency computation + public :: chem_final + public :: chem_write_restart + public :: chem_read_restart + public :: chem_init_restart + public :: chem_readnl ! read chem namelist + + public :: chem_emissions + public :: chem_timestep_init + + ! Location of valid input.geos and species_database.yml + ! Use local files in run folder + CHARACTER(LEN=500) :: inputGeos = 'input.geos' + CHARACTER(LEN=500) :: speciesDB = 'species_database.yml' + + ! Location of chemistry input + CHARACTER(LEN=256) :: gc_cheminputs + + !----------------------------- + ! Derived type objects + !----------------------------- + TYPE(OptInput) :: Input_Opt ! Input Options object + TYPE(ChmState),ALLOCATABLE :: State_Chm(:) ! Chemistry State object + TYPE(DgnState),ALLOCATABLE :: State_Diag(:) ! Diagnostics State object + TYPE(GrdState),ALLOCATABLE :: State_Grid(:) ! Grid State object + TYPE(MetState),ALLOCATABLE :: State_Met(:) ! Meteorology State object + TYPE(DgnList ) :: Diag_List ! Diagnostics list object + TYPE(TaggedDgnList ) :: TaggedDiag_List ! Tagged diagnostics list object + + type(physics_buffer_desc), pointer :: hco_pbuf2d(:,:) ! Pointer to 2D pbuf + + ! Indices of critical species in GEOS-Chem + INTEGER :: iH2O, iO3, iCO2 + INTEGER :: iO, iH, iO2, iPSO4 + REAL(r8) :: MWPSO4, MWO3 + ! Indices of critical species in the constituent list + INTEGER :: cQ, cH2O + + ! Indices in the physics buffer + INTEGER :: NDX_PBLH ! PBL height [m] + INTEGER :: NDX_FSDS ! Downward shortwave flux at surface [W/m2] + INTEGER :: NDX_CLDTOP ! Cloud top height [index] + INTEGER :: NDX_CLDFRC ! Cloud fraction [-] + INTEGER :: NDX_PRAIN ! Rain production rate [kg/kg/s] + INTEGER :: NDX_NEVAPR ! Total rate of precipitation evaporation [kg/kg/s] + INTEGER :: NDX_LSFLXPRC ! Large-scale precip. at interface (liq + snw) [kg/m2/s] + INTEGER :: NDX_LSFLXSNW ! Large-scale precip. at interface (snow only) [kg/m2/s] + INTEGER :: NDX_CMFDQR ! Convective total precip. production rate [kg/kg/s] + + ! Get constituent indices + INTEGER :: ixCldLiq ! Cloud liquid water + INTEGER :: ixCldIce ! Cloud ice + INTEGER :: ixNDrop ! Cloud droplet number index + + ! ghg + + LOGICAL :: ghg_chem = .false. ! .true. => use ghg chem package + CHARACTER(len=shr_kind_cl) :: bndtvg = ' ' ! pathname for greenhouse gas loss rate + CHARACTER(len=shr_kind_cl) :: h2orates = ' ' ! pathname for greenhouse gas (lyman-alpha H2O loss) + + ! lightning + REAL(r8) :: lght_no_prd_factor = 1._r8 + + ! Strings + CHARACTER(LEN=255) :: ThisLoc + CHARACTER(LEN=255) :: ErrMsg + + ! Filenames to compute dry deposition velocities similarly to MOZART + character(len=shr_kind_cl) :: clim_soilw_file = 'clim_soilw_file' + character(len=shr_kind_cl) :: depvel_file = '' + character(len=shr_kind_cl) :: depvel_lnd_file = 'depvel_lnd_file' + character(len=shr_kind_cl) :: season_wes_file = 'season_wes_file' + + character(len=shr_kind_cl) :: srf_emis_specifier(pcnst) = '' + character(len=shr_kind_cl) :: ext_frc_specifier(pcnst) = '' + + character(len=24) :: srf_emis_type = 'CYCLICAL' ! 'CYCLICAL' | 'SERIAL' | 'INTERP_MISSING_MONTHS' + integer :: srf_emis_cycle_yr = 0 + integer :: srf_emis_fixed_ymd = 0 + integer :: srf_emis_fixed_tod = 0 + + character(len=24) :: ext_frc_type = 'CYCLICAL' ! 'CYCLICAL' | 'SERIAL' | 'INTERP_MISSING_MONTHS' + integer :: ext_frc_cycle_yr = 0 + integer :: ext_frc_fixed_ymd = 0 + integer :: ext_frc_fixed_tod = 0 + + +!================================================================================================ +contains +!================================================================================================ + + logical function chem_is (name) + + use mo_chem_utls, only : utls_chem_is + + chem_is = .false. + IF ( to_upper(name) == 'GEOSCHEM' ) THEN + chem_is = .true. + ENDIF + + end function chem_is + +!================================================================================================ + + subroutine chem_register + + use physics_buffer, only : pbuf_add_field, dtype_r8 + use PhysConst, only : MWDry + + use Short_Lived_Species, only : Register_Short_Lived_Species + + use State_Grid_Mod, only : Init_State_Grid, Cleanup_State_Grid + use State_Chm_Mod, only : Init_State_Chm, Cleanup_State_Chm + use State_Chm_Mod, only : Ind_ + use Input_Opt_Mod, only : Set_Input_Opt, Cleanup_Input_Opt + use CMN_SIZE_Mod, only : Init_CMN_SIZE + + use mo_sim_dat, only : set_sim_dat + use mo_chem_utls, only : get_spc_ndx + use chem_mods, only : drySpc_ndx +#if defined( MODAL_AERO_4MODE ) + use aero_model, only : aero_model_register + use modal_aero_data, only : nspec_max + use modal_aero_data, only : ntot_amode, nspec_amode + use modal_aero_data, only : xname_massptr +#endif + + !----------------------------------------------------------------------- + ! + ! Purpose: register advected constituents for chemistry + ! + !----------------------------------------------------------------------- + ! Need to generate a temporary species database + TYPE(ChmState) :: SC + TYPE(GrdState) :: SG + TYPE(OptInput) :: IO + TYPE(Species), POINTER :: ThisSpc + + INTEGER :: I, N, M, L + INTEGER :: nIgnored + REAL(r8) :: cptmp + REAL(r8) :: MWTmp + REAL(r8) :: qmin + REAL(r8) :: refmmr, refvmr + CHARACTER(LEN=128) :: mixtype + CHARACTER(LEN=128) :: molectype + CHARACTER(LEN=128) :: lngName + CHARACTER(LEN=64) :: cnstName + CHARACTER(LEN=64) :: trueName + LOGICAL :: camout + LOGICAL :: ic_from_cam2 + LOGICAL :: has_fixed_ubc + LOGICAL :: has_fixed_ubflx + + INTEGER :: RC, IERR + + ! Assume a successful return until otherwise + RC = GC_SUCCESS + + ! For error trapping + ErrMsg = '' + ThisLoc = ' -> at GEOS-Chem (in chemistry/geoschem/chemistry.F90)' + + ! Initialize pointer + ThisSpc => NULL() + + ! SDE 2018-05-02: This seems to get called before anything else + ! that includes CHEM_INIT + ! At this point, mozart calls SET_SIM_DAT, which is specified by each + ! mechanism separately (ie mozart/chemistry.F90 calls the subroutine + ! set_sim_dat which is in pp_[mechanism]/mo_sim_dat.F90. That sets a lot of + ! data in other places, notably in "chem_mods" + + ! hplin 2020-05-16: Call set_sim_dat to populate chemistry constituent information + ! from mo_sim_dat.F90 in other places. This is needed for HEMCO_CESM. + CALL Set_sim_dat() + IF ( MasterProc ) Write(iulog,*) 'GCCALL after set_sim_dat' + + ! Prevent Reporting + IO%amIRoot = .False. + IO%thisCpu = MyCPU + + CALL Set_Input_Opt( am_I_Root = MasterProc, & + Input_Opt = IO, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Could not generate reference input options object!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Options needed by Init_State_Chm + IO%ITS_A_FULLCHEM_SIM = .True. + IO%LLinoz = .True. + IO%LUCX = .True. + IO%LPRT = .False. + IO%N_Advect = nTracers + DO I = 1, nTracers + IO%AdvectSpc_Name(I) = TRIM(tracerNames(I)) + ENDDO + IO%SALA_rEdge_um(1) = 0.01e+0_fp + IO%SALA_rEdge_um(2) = 0.50e+0_fp + IO%SALC_rEdge_um(1) = 0.50e+0_fp + IO%SALC_rEdge_um(2) = 8.00e+0_fp + + IO%SpcDatabaseFile = TRIM(speciesDB) + + CALL Init_State_Grid( Input_Opt = IO, & + State_Grid = SG, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "Init_State_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + SG%NX = 1 + SG%NY = 1 + SG%NZ = 1 + + CALL GC_Init_Grid( Input_Opt = IO, & + State_Grid = SG, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error in GC_Init_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Init_CMN_SIZE( Input_Opt = IO, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "Init_CMN_SIZE"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Init_State_Chm( Input_Opt = IO, & + State_Chm = SC, & + State_Grid = SG, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "Init_State_Chm"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + iFirstCnst = -1 + mapCnst = -1 + map2GC = -1 + map2GCinv = -1 + map2chm = -1 + ref_MMR(:) = 0.0e+0_r8 + + DO I = 1, nTracersMax + IF ( I .LE. nTracers ) THEN + cnstName = TRIM(tracerNames(I)) + trueName = cnstName + N = Ind_(cnstName) + ThisSpc => SC%SpcData(N)%Info + lngName = TRIM(ThisSpc%FullName) + MWTmp = REAL(ThisSpc%MW_g,r8) + refvmr = REAL(ThisSpc%BackgroundVV,r8) + refmmr = refvmr / (MWDry / MWTmp) + ! Make sure that solsym is following the list of tracers as listed in input.geos + IF ( to_upper(TRIM(tracerNames(I))) /= to_upper(TRIM(solsym(I))) ) THEN + Write(iulog,*) "tracerNames (", TRIM(tracerNames(I)), ") /= solsym (", & + TRIM(solsym(I)), ")" + CALL ENDRUN('Solsym must be following GEOS-Chem tracer. Check geoschem/mo_sim.dat') + ENDIF + ! Nullify pointer + ThisSpc => NULL() + ELSEIF ( I .LE. (nTracers + nAer) ) THEN + ! Add MAM4 aerosols + cnstName = TRIM(aerNames(I - nTracers)) + trueName = cnstName + lngName = cnstName + MWTmp = aerAdvMass(I - nTracers) + refmmr = 1.0e-38_r8 + ELSEIF ( I .EQ. (nTracers + nAer + 1) ) THEN + ! Add CO2 (which is not a GEOS-Chem tracer) + cnstName = 'CO2' + trueName = cnstName + lngName = cnstName + MWTmp = 44.009800_r8 + refmmr = 1.0e-38_r8 + ELSE + cnstName = TRIM(tracerNames(I)) + trueName = cnstName + lngName = cnstName + MWTmp = 1000.0e+0_r8 * (0.001e+0_r8) + refmmr = 1.0e-38_r8 + ENDIF + + ! dummy value for specific heat of constant pressure (Cp) + cptmp = 666._r8 + ! minimum mixing ratio + qmin = 1.e-38_r8 + ! mixing ratio type + mixtype = 'dry' + ! Used for ionospheric WACCM (WACCM-X) + molectype = 'minor' + ! Is an output field (?) + camout = .false. + ! Not true for O2(1-delta) or O2(1-sigma) + ic_from_cam2 = .true. + ! Use a fixed value at the upper boundary + has_fixed_ubc = .false. + ! Use a fixed flux condition at the upper boundary + has_fixed_ubflx = .false. + + ! TMMF - 8/20/2020 + ! Note: I had to modify the IC file to rename variables such as + ! CH3COCH3 into ACET. Using that new IC file, we can thus remove + ! the unnecessary special handlings. + ! Another option would have been to modify cnst_add and read_inidat + ! to use a load_name the first time IC are read. Constituent names + ! would be stored in cnst_name, while read_inidat would load from + ! load_name. load_name would be an optional argument to cnst_add, such + ! that, by default, load_name = cnst_name. + ! However, this would be tricky to handle with restart files that + ! would save cnst_name rather than load_name. + + ! Special handlings + IF ( cnstName == 'HCHO' ) THEN + cnstName = 'CH2O' + !ELSEIF ( cnstName == 'HNO4' ) THEN + ! cnstName = 'HO2NO2' + !ELSEIF ( cnstName == 'HNO2' ) THEN + ! cnstName = 'HONO' + !ELSEIF ( cnstName == 'ACET' ) THEN + ! cnstName = 'CH3COCH3' + !ELSEIF ( cnstName == 'ALD2' ) THEN + ! cnstName = 'CH3CHO' + !ELSEIF ( cnstName == 'PRPE' ) THEN + ! cnstName = 'C3H6' + !ELSEIF ( cnstName == 'MP' ) THEN + ! cnstName = 'CH3OOH' + !ELSEIF ( cnstName == 'HAC' ) THEN + ! cnstName = 'HYAC' + !ELSEIF ( cnstName == 'GLYC' ) THEN + ! cnstName = 'GLYALD' + !ELSEIF ( cnstName == 'MAP' ) THEN + ! cnstName = 'CH3COOOH' + !ELSEIF ( cnstName == 'EOH' ) THEN + ! cnstName = 'C2H5OH' + !ELSEIF ( cnstName == 'MGLY' ) THEN + ! cnstName = 'CH3COCHO' + !ELSEIF ( cnstName == 'GLYX' ) THEN + ! cnstName = 'GLYOXAL' + !ELSEIF ( cnstName == 'ACTA' ) THEN + ! cnstName = 'CH3COOH' + !ELSEIF ( cnstName == 'TOLU' ) THEN + ! cnstName = 'TOLUENE' + ENDIF + + ! For debug, only + !If ( MasterProc ) Write(iulog,*) " Species = ", TRIM(cnstName) + + CALL cnst_add( cnstName, MWtmp, cptmp, qmin, N, & + readiv=ic_from_cam2, mixtype=mixtype, & + cam_outfld=camout, molectype=molectype, & + fixed_ubc=has_fixed_ubc, & + fixed_ubflx=has_fixed_ubflx, & + longname=TRIM(lngName) ) + + IF ( iFirstCnst < 0 ) iFirstCnst = N + + ref_MMR(N) = refmmr + + ! Add to GC mapping. When starting a timestep, we will want to update the + ! concentration of State_Chm(x)%Species(1,iCol,iLev,m) with data from + ! constituent n + M = Ind_(TRIM(trueName)) + IF ( M > 0 ) THEN + ! Map constituent onto GEOS-Chem tracer as indexed in State_Chm(LCHNK)%Species + map2GC(N) = M + ! Map GEOS-Chem tracer onto constituent + map2GCinv(M) = N + ENDIF + ! Map constituent onto chemically-active species (aka as indexed in solsym) + M = get_spc_ndx(TRIM(trueName)) + IF ( M > 0 ) THEN + mapCnst(N) = M + ENDIF + ENDDO + + ! Now unadvected species + map2GC_Sls = 0 + sls_ref_MMR(:) = 0.0e+0_r8 + DO I = 1, nSls + N = Ind_(slsNames(I)) + IF ( N .GT. 0 ) THEN + ThisSpc => SC%SpcData(N)%Info + MWTmp = REAL(ThisSpc%MW_g,r8) + refvmr = REAL(ThisSpc%BackgroundVV,r8) + lngName = TRIM(ThisSpc%FullName) + sls_ref_MMR(I) = refvmr / (MWDry / MWTmp) + map2GC_Sls(I) = N + ThisSpc => NULL() + ENDIF + ENDDO + + ! Pass information to "short_lived_species" module + slvd_ref_MMR(1:nSls) = sls_ref_MMR(1:nSls) + CALL Register_Short_Lived_Species() + ! More information: + ! http://www.cesm.ucar.edu/models/atm-cam/docs/phys-interface/node5.html + + DO N = 1, gas_pcnst + ! Map solsym onto GEOS-Chem species + map2chm(N) = Ind_(TRIM(solsym(N))) + IF ( map2chm(N) < 0 ) THEN + ! This is not a GEOS-Chem species and we thus map on constituents + ! Most likely, these will be MAM aerosols + ! We store the index as the opposite to not confuse with GEOS-Chem + ! indices. + CALL cnst_get_ind(TRIM(solsym(N)), I, abort=.True.) + map2chm(N) = -I + ENDIF + ENDDO + ! Get constituent index of specific humidity + CALL cnst_get_ind('Q', cQ, abort=.True.) + CALL cnst_get_ind('H2O', cH2O, abort=.True.) + + !============================================================== + ! Get mapping between dry deposition species and species set + !============================================================== + + nIgnored = 0 + + DO N = 1, nddvels + + ! The species names need to be convert to upper case as, + ! for instance, BR2 != Br2 + drySpc_ndx(N) = get_spc_ndx( to_upper(drydep_list(N)) ) + + IF ( MasterProc .AND. ( drySpc_ndx(N) < 0 ) ) THEN + Write(iulog,'(a,a)') ' ## Ignoring dry deposition of ', & + TRIM(drydep_list(N)) + nIgnored = nIgnored + 1 + ENDIF + ENDDO + + IF ( MasterProc .AND. ( nIgnored > 0 ) ) THEN + Write(iulog,'(a,a)') ' The species listed above have dry', & + ' deposition turned off for one of the following reasons:' + Write(iulog,'(a)') ' - They are not present in the GEOS-Chem tracer list.' + Write(iulog,'(a)') ' - They have a synonym (e.g. CH2O and HCHO).' + ENDIF + +#if defined( MODAL_AERO_4MODE ) + ! add fields to pbuf needed by aerosol models + CALL aero_model_register() + + ! Mode | \sigma_g | Dry diameter (micrometers) + ! -----------------------|----------|-------------------------- + ! a2 - Aitken mode | 1.6 | 0.015 - 0.053 + ! a1 - Accumulation mode | 1.8 | 0.058 - 0.27 + ! a3 - Coarse mode | 1.8 | 0.80 - 3.65 + ! a4 - Primary carbon | 1.6 | 0.039 - 0.13 + ! -----------------------|----------|-------------------------- + ! Ref: Liu, Xiaohong, et al. "Toward a minimal representation of aerosols in + ! climate models: Description and evaluation in the Community Atmosphere + ! Model CAM5." Geoscientific Model Development 5.3 (2012): 709. + + ALLOCATE(map2MAM4(nspec_max,ntot_amode), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate map2MAM4') + + ! Initialize indices + map2MAM4(:,:) = -1 + + DO M = 1, ntot_amode + DO L = 1, nspec_amode(M) + SELECT CASE ( to_upper(xname_massptr(L,M)(:3)) ) + CASE ( 'BC_' ) + SELECT CASE ( to_upper(xname_massptr(L,M)(4:5)) ) + CASE ( 'A1' ) + map2MAM4(L,M) = Ind_('BCPI') + CASE ( 'A4' ) + map2MAM4(L,M) = Ind_('BCPO') + END SELECT + CASE ( 'DST' ) + SELECT CASE ( to_upper(xname_massptr(L,M)(5:6)) ) + ! DST1 - Dust aerosol, Reff = 0.7 micrometers + ! DST2 - Dust aerosol, Reff = 1.4 micrometers + ! DST3 - Dust aerosol, Reff = 2.4 micrometers + ! DST4 - Dust aerosol, Reff = 4.5 micrometers + CASE ( 'A1' ) + map2MAM4(L,M) = Ind_('DST1') + CASE ( 'A2' ) + map2MAM4(L,M) = Ind_('DST1') + CASE ( 'A3' ) + map2MAM4(L,M) = Ind_('DST4') + END SELECT + CASE ( 'SOA' ) + map2MAM4(L,M) = Ind_('SOAS') + CASE ( 'SO4' ) + map2MAM4(L,M) = Ind_('SO4') + CASE ( 'NCL' ) + SELECT CASE ( to_upper(xname_massptr(L,M)(5:6)) ) + ! SALA - Fine (0.01-0.05 micros) sea salt aerosol + ! SALC - Coarse (0.5-8 micros) sea salt aerosol + CASE ( 'A1' ) + map2MAM4(L,M) = Ind_('SALA') + CASE ( 'A2' ) + map2MAM4(L,M) = Ind_('SALA') + CASE ( 'A3' ) + map2MAM4(L,M) = Ind_('SALC') + END SELECT + CASE ( 'POM' ) + SELECT CASE ( to_upper(xname_massptr(L,M)(5:6)) ) + CASE ( 'A1' ) + map2MAM4(L,M) = Ind_('OCPI') + CASE ( 'A4' ) + map2MAM4(L,M) = Ind_('OCPO') + END SELECT + END SELECT + ENDDO + ENDDO + +#endif + + !============================================================== + ! Print summary + !============================================================== + + IF ( MasterProc ) THEN + Write(iulog,'(/, a)') '### Summary of GEOS-Chem species: ' + Write(iulog,'( a)') REPEAT( '-', 50 ) + Write(iulog,'( a)') '+ List of advected species: ' + Write(iulog,100) 'ID', 'Tracer', ''!'Dry deposition (T/F)' + DO N = 1, nTracers + Write(iulog,120) N, TRIM(tracerNames(N))!, ANY(drySpc_ndx .eq. N) + ENDDO + IF ( nAer > 0 ) THEN + Write(iulog,'(/, a)') '+ List of aerosols: ' + Write(iulog,110) 'ID', 'MAM4 Aerosol' + DO N = 1, nAer + Write(iulog,130) N, TRIM(aerNames(N)) + ENDDO + ENDIF + Write(iulog,'(/, a)') '+ List of short-lived species: ' + DO N = 1, nSls + Write(iulog,130) N, TRIM(slsNames(N)) + ENDDO + ENDIF + +100 FORMAT( 1x, A3, 3x, A10, 1x, A25 ) +110 FORMAT( 1x, A3, 3x, A15 ) +!120 FORMAT( 1x, I3, 3x, A10, 1x, L15 ) +120 FORMAT( 1x, I3, 3x, A10 ) +130 FORMAT( 1x, I3, 3x, A10 ) + + ! Clean up + Call Cleanup_State_Chm ( SC, RC ) + Call Cleanup_State_Grid( SG, RC ) + Call Cleanup_Input_Opt ( IO, RC ) + + end subroutine chem_register + +!=============================================================================== + + subroutine chem_readnl(nlfile) + + use cam_abortutils, only : endrun + use units, only : getunit, freeunit + use namelist_utils, only : find_group_name +#if defined( MODAL_AERO_4MODE ) + use aero_model, only : aero_model_readnl + use dust_model, only : dust_readnl +#endif + use gas_wetdep_opts, only : gas_wetdep_readnl +#ifdef SPMD + use mpishorthand +#endif + use gckpp_Model, only : nSpec, Spc_Names + use chem_mods, only : drySpc_ndx + + ! args + CHARACTER(LEN=*), INTENT(IN) :: nlfile ! filepath for file containing namelist input + + ! Local variables + INTEGER :: I, N + INTEGER :: UNITN, IERR + CHARACTER(LEN=500) :: line + LOGICAL :: menuFound + LOGICAL :: validSLS + + ! The following files are required to compute land maps, required to perform + ! aerosol dry deposition + namelist /chem_inparm/ clim_soilw_file, & + depvel_file, & + lght_no_prd_factor, & + depvel_lnd_file, & + ext_frc_specifier, & + ext_frc_type, & + ext_frc_cycle_yr, & + ext_frc_fixed_ymd, & + ext_frc_fixed_tod, & + season_wes_file, & + srf_emis_specifier, & + srf_emis_cycle_yr, & + srf_emis_fixed_ymd, & + srf_emis_fixed_tod, & + srf_emis_type + + nIgnored = 0 + + ALLOCATE(drySpc_ndx(nddvels), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate drySpc_ndx') + +#if defined( MODAL_AERO_4MODE ) + !============================================================== + ! Get names and molar weights of aerosols in MAM4 + !============================================================== + + nAer = 33 + + aerNames(:nAer) = (/ 'bc_a1 ','bc_a4 ','dst_a1 ', & + 'dst_a2 ','dst_a3 ','ncl_a1 ', & + 'ncl_a2 ','ncl_a3 ','num_a1 ', & + 'num_a2 ','num_a3 ','num_a4 ', & + 'pom_a1 ','pom_a4 ','so4_a1 ', & + 'so4_a2 ','so4_a3 ','soa1_a1 ', & + 'soa1_a2 ','soa2_a1 ','soa2_a2 ', & + 'soa3_a1 ','soa3_a2 ','soa4_a1 ', & + 'soa4_a2 ','soa5_a1 ','soa5_a2 ', & + 'H2SO4 ','SOAG0 ','SOAG1 ', & + 'SOAG2 ','SOAG3 ','SOAG4 ' /) + + aerAdvMass(:nAer) = (/ 12.011000_r8, 12.011000_r8, 135.064039_r8, & + 135.064039_r8, 135.064039_r8, 58.442468_r8, & + 58.442468_r8, 58.442468_r8, 1.007400_r8, & + 1.007400_r8, 1.007400_r8, 1.007400_r8, & + 12.011000_r8, 12.011000_r8, 115.107340_r8, & + 115.107340_r8, 115.107340_r8, 250.445000_r8, & + 250.445000_r8, 250.445000_r8, 250.445000_r8, & + 250.445000_r8, 250.445000_r8, 250.445000_r8, & + 250.445000_r8, 250.445000_r8, 250.445000_r8, & + 98.078400_r8, 250.445000_r8, 250.445000_r8, & + 250.445000_r8, 250.445000_r8, 250.445000_r8 /) + + CALL aero_model_readnl(nlfile) + CALL dust_readnl(nlfile) +#endif + + DO I = (nAer+1), nAerMax + aerNames(I) = 'EMPTY_AER ' + aerAdvMass(I) = -1.00_r8 + ENDDO + + CALL gas_wetdep_readnl(nlfile) + + CALL gc_readnl(nlfile) + + IF ( MasterProc ) THEN + + Write(iulog,'(/,a)') REPEAT( '=', 50 ) + Write(iulog,'(a)') REPEAT( '=', 50 ) + Write(iulog,'(a)') 'This is the GEOS-CHEM / CESM interface' + Write(iulog,'(a)') REPEAT( '=', 50 ) + Write(iulog,'(a)') ' + Routines written by Thibaud M. Fritz' + Write(iulog,'(a)') ' + Laboratory for Aviation and the Environment,' + Write(iulog,'(a)') ' + Department of Aeronautics and Astronautics,' + Write(iulog,'(a)') ' + Massachusetts Institute of Technology' + Write(iulog,'(a)') REPEAT( '=', 50 ) + + Write(iulog,'(/,a,/)') 'Now defining GEOS-Chem tracers and dry deposition mapping...' + + unitn = getunit() + + !============================================================== + ! Opening input.geos and go to ADVECTED SPECIES MENU + !============================================================== + + OPEN( unitn, FILE=TRIM(inputGeos), STATUS='OLD', IOSTAT=IERR ) + IF (IERR .NE. 0) THEN + CALL ENDRUN('chem_readnl: ERROR opening input.geos') + ENDIF + + ! Go to ADVECTED SPECIES MENU + menuFound = .False. + DO WHILE ( .NOT. menuFound ) + READ( unitn, '(a)', IOSTAT=IERR ) line + IF ( IERR .NE. 0 ) THEN + CALL ENDRUN('chem_readnl: ERROR finding advected species menu') + ELSEIF ( INDEX(line, 'ADVECTED SPECIES MENU') > 0 ) THEN + menuFound = .True. + ENDIF + ENDDO + + !============================================================== + ! Read list of GEOS-Chem tracers + !============================================================== + + ! Mimic GEOS-Chem's READ_ADVECTED_SPECIES_MENU + DO + ! Read line + READ(unitn,'(26x,a)', IOSTAT=IERR) line + + IF ( INDEX( TRIM(line), '---' ) > 0 ) EXIT + + nTracers = nTracers + 1 + tracerNames(nTracers) = TRIM(line) + ENDDO + + CLOSE(unitn) + CALL freeunit(unitn) + + ! Assign remaining tracers dummy names + DO I = (nTracers+1), nTracersMax + WRITE(tracerNames(I),'(a,I0.4)') 'GCTRC_', I + ENDDO + + !============================================================== + ! Now go through the KPP mechanism and add any species not + ! implemented by the tracer list in input.geos + !============================================================== + + IF ( nSpec > nSlsMax ) THEN + CALL ENDRUN('chem_readnl: too many species - increase nSlsmax') + ENDIF + + nSls = 0 + DO I = 1, nSpec + ! Get the name of the species from KPP + line = ADJUSTL(TRIM(Spc_Names(I))) + ! Only add short-lived KPP species, except from CO2 + validSLS = (( .NOT. ANY(TRIM(line) .EQ. tracerNames) ) & + .AND. TRIM(line) /= 'CO2' ) + IF ( validSLS ) THEN + ! Genuine new short-lived species + nSls = nSls + 1 + slsNames(nSls) = TRIM(line) + ENDIF + ENDDO + + !============================================================== + + unitn = getunit() + OPEN( unitn, FILE=TRIM(nlfile), STATUS='old' ) + CALL find_group_name(unitn, 'chem_inparm', STATUS=IERR) + IF (IERR == 0) THEN + READ(unitn, chem_inparm, IOSTAT=IERR) + IF (IERR /= 0) THEN + CALL endrun('chem_readnl: ERROR reading namelist') + ENDIF + ENDIF + CLOSE(unitn) + CALL freeunit(unitn) + + ENDIF + + !================================================================== + ! Broadcast to all processors + !================================================================== + +#if defined( SPMD ) + CALL MPIBCAST ( nTracers, 1, MPIINT, 0, MPICOM ) + CALL MPIBCAST ( tracerNames, LEN(tracerNames(1))*nTracersMax, MPICHAR, 0, MPICOM ) + CALL MPIBCAST ( nSls, 1, MPIINT, 0, MPICOM ) + CALL MPIBCAST ( slsNames, LEN(slsNames(1))*nSlsMax, MPICHAR, 0, MPICOM ) + + ! Broadcast namelist variables + + ! The following files are required to compute land maps, required to perform + ! aerosol dry deposition + CALL MPIBCAST (depvel_lnd_file, LEN(depvel_lnd_file), MPICHAR, 0, MPICOM) + CALL MPIBCAST (clim_soilw_file, LEN(clim_soilw_file), MPICHAR, 0, MPICOM) + CALL MPIBCAST (season_wes_file, LEN(season_wes_file), MPICHAR, 0, MPICOM) + + CALL MPIBCAST (lght_no_prd_factor, 1, MPIR8, 0, MPICOM) + CALL MPIBCAST (depvel_file, LEN(depvel_file), MPICHAR, 0, MPICOM) + CALL MPIBCAST (srf_emis_specifier, LEN(srf_emis_specifier(1))*pcnst, MPICHAR, 0, MPICOM) + CALL MPIBCAST (srf_emis_type, LEN(srf_emis_type), MPICHAR, 0, MPICOM) + CALL MPIBCAST (srf_emis_cycle_yr, 1, MPIINT, 0, MPICOM) + CALL MPIBCAST (srf_emis_fixed_ymd, 1, MPIINT, 0, MPICOM) + CALL MPIBCAST (srf_emis_fixed_tod, 1, MPIINT, 0, MPICOM) + CALL MPIBCAST (ext_frc_specifier, LEN(ext_frc_specifier(1))*pcnst, MPICHAR, 0, MPICOM) + CALL MPIBCAST (ext_frc_type, LEN(ext_frc_type), MPICHAR, 0, MPICOM) + CALL MPIBCAST (ext_frc_cycle_yr, 1, MPIINT, 0, MPICOM) + CALL MPIBCAST (ext_frc_fixed_ymd, 1, MPIINT, 0, MPICOM) + CALL MPIBCAST (ext_frc_fixed_tod, 1, MPIINT, 0, MPICOM) + + CALL MPIBCAST (ghg_chem, 1, MPILOG, 0, MPICOM) + CALL MPIBCAST (bndtvg, LEN(bndtvg), MPICHAR, 0, MPICOM) + CALL MPIBCAST (h2orates, LEN(h2orates), MPICHAR, 0, MPICOM) +#endif + + ! Update "short_lived_species" arrays + nSlvd = nSls + ALLOCATE(slvd_Lst(nSlvd), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating slvd_Lst') + ALLOCATE(slvd_ref_MMR(nSlvd), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating slvd_ref_MMR') + DO I = 1, nSls + slvd_Lst(I) = TRIM(slsNames(I)) + ENDDO + + end subroutine chem_readnl + +!================================================================================================ + + function chem_is_active() + !----------------------------------------------------------------------- + logical :: chem_is_active + !----------------------------------------------------------------------- + chem_is_active = .true. + + end function chem_is_active + +!================================================================================================ + + function chem_implements_cnst(name) + !----------------------------------------------------------------------- + ! + ! Purpose: return true if specified constituent is implemented by this package + ! + ! Author: B. Eaton + ! + !----------------------------------------------------------------------- + IMPLICIT NONE + !-----------------------------Arguments--------------------------------- + + CHARACTER(LEN=*), INTENT(IN) :: name ! constituent name + LOGICAL :: chem_implements_cnst ! return value + + INTEGER :: M + + chem_implements_cnst = .false. + + DO M = 1, gas_pcnst + IF (TRIM(solsym(M)) .eq. TRIM(name)) THEN + chem_implements_cnst = .true. + EXIT + ENDIF + ENDDO + + end function chem_implements_cnst + +!=============================================================================== + + subroutine chem_init(phys_state, pbuf2d) + !----------------------------------------------------------------------- + ! + ! Purpose: initialize GEOS-Chem parts (state objects, mainly) + ! (and declare history variables) + ! + !----------------------------------------------------------------------- + use physics_buffer, only : physics_buffer_desc, pbuf_get_index + use chem_mods, only : map2GC_dryDep, drySpc_ndx + +#ifdef SPMD + use mpishorthand +#endif + use cam_abortutils, only : endrun + use mo_chem_utls, only : get_spc_ndx + + use Phys_Grid, only : get_Area_All_p + use hycoef, only : ps0, hyai, hybi, hyam + + use seq_drydep_mod, only : drydep_method, DD_XLND + use gas_wetdep_opts, only : gas_wetdep_method + use mo_neu_wetdep, only : neu_wetdep_init + +#if defined( MODAL_AERO_4MODE ) + use aero_model, only : aero_model_init + use mo_setsox, only : sox_inti + use mo_drydep, only : drydep_inti_landuse + use modal_aero_data, only : ntot_amode, nspec_amode + use modal_aero_data, only : xname_massptr +#endif + + use Input_Opt_Mod + use State_Chm_Mod + use State_Grid_Mod + use State_Met_Mod + use DiagList_Mod, only : Init_DiagList, Print_DiagList + use TaggedDiagList_Mod, only : Init_TaggedDiagList, Print_TaggedDiagList + use GC_Grid_Mod, only : SetGridFromCtrEdges + + ! Use GEOS-Chem versions of physical constants + use PhysConstants, only : PI, PI_180, Re + + use Time_Mod, only : Accept_External_Date_Time + use Linoz_Mod, only : Linoz_Read + + use CMN_Size_Mod + + use Drydep_Mod, only : depName, Ndvzind + use Pressure_Mod, only : Accept_External_ApBp + use Chemistry_Mod, only : Init_Chemistry + use Ucx_Mod, only : Init_Ucx + use Strat_chem_Mod, only : Init_Strat_Chem + use isorropiaII_Mod, only : Init_IsorropiaII + use Input_Mod, only : Read_Input_File + use Input_Mod, only : Validate_Directories + use Olson_Landmap_Mod + use Vdiff_Mod + + use mo_setinv, only : setinv_inti + use mo_mean_mass, only : init_mean_mass + use mo_ghg_chem, only : ghg_chem_init + use tracer_cnst, only : tracer_cnst_init + use tracer_srcs, only : tracer_srcs_init + + use CESMGC_Emissions_Mod, only : CESMGC_Emissions_Init + use CESMGC_Diag_Mod, only : CESMGC_Diag_Init + + TYPE(physics_state), INTENT(IN ) :: phys_state(BEGCHUNK:ENDCHUNK) + TYPE(physics_buffer_desc), POINTER, INTENT(INOUT) :: pbuf2d(:,:) + + ! Local variables + + !---------------------------- + ! Scalars + !---------------------------- + + ! Integers + INTEGER :: LCHNK(BEGCHUNK:ENDCHUNK), NCOL(BEGCHUNK:ENDCHUNK) + INTEGER :: IWAIT, IERR + INTEGER :: nX, nY, nZ + INTEGER :: nStrat, nTrop + INTEGER :: I, J, L, N, M + INTEGER :: RC + INTEGER :: nLinoz + + ! Logicals + LOGICAL :: prtDebug + LOGICAL :: Found + + ! Strings + CHARACTER(LEN=255) :: historyConfigFile + CHARACTER(LEN=255) :: SpcName + + ! Objects + TYPE(Species), POINTER :: SpcInfo + + ! Grid setup + REAL(fp) :: lonVal, latVal + REAL(fp) :: dLonFix, dLatFix + REAL(f4), ALLOCATABLE :: lonMidArr(:,:), latMidArr(:,:) + REAL(f4), ALLOCATABLE :: lonEdgeArr(:,:), latEdgeArr(:,:) + REAL(r8), ALLOCATABLE :: linozData(:,:,:,:) + + ! Grid with largest number of columns + TYPE(GrdState) :: maxGrid ! Grid State object + + REAL(r8), ALLOCATABLE :: Col_Area(:) + REAL(fp), ALLOCATABLE :: Ap_CAM_Flip(:), Bp_CAM_Flip(:) + + !REAL(r8), POINTER :: SlsPtr(:,:,:) + + ! Assume a successful return until otherwise + RC = GC_SUCCESS + + ! For error trapping + ErrMsg = '' + ThisLoc = ' -> at GEOS-Chem (in chemistry/geoschem/chemistry.F90)' + + ! Initialize pointers + SpcInfo => NULL() + + ! LCHNK: which chunks we have on this process + LCHNK = phys_state%LCHNK + ! NCOL: number of atmospheric columns for each chunk + NCOL = phys_state%NCOL + + ! The GEOS-Chem grids on every "chunk" will all be the same size, to avoid + ! the possibility of having differently-sized chunks + nX = 1 + !nY = MAXVAL(NCOL) + nY = PCOLS + nZ = PVER + + !! Add short lived speies to buffers + !CALL Pbuf_add_field(Trim(SLSBuffer),'global',dtype_r8,(/PCOLS,PVER,nSls/),Sls_Pbf_Idx) + !! Initialize + !ALLOCATE(SlsPtr(PCOLS,PVER,BEGCHUNK:ENDCHUNK), STAT=IERR) + !IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating SlsPtr') + !SlsPtr(:,:,:) = 0.0e+0_r8 + !DO I=1,nSls + ! SlsPtr(:,:,:) = sls_ref_MMR(I) + ! CALL pbuf_set_field(pbuf2d,Sls_Pbf_Idx,SlsPtr,start=(/1,1,i/),kount=(/PCOLS,PVER,1/)) + !ENDDO + !DEALLOCATE(SlsPtr) + + ! This ensures that each process allocates everything needed for its chunks + ALLOCATE(State_Chm(BEGCHUNK:ENDCHUNK) , STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Chm') + ALLOCATE(State_Diag(BEGCHUNK:ENDCHUNK) , STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Diag') + ALLOCATE(State_Grid(BEGCHUNK:ENDCHUNK), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Grid') + ALLOCATE(State_Met(BEGCHUNK:ENDCHUNK) , STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating State_Met') + + ! Initialize fields of the Input Options object + CALL Set_Input_Opt( am_I_Root = MasterProc, & + Input_Opt = Input_Opt, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "Set_Input_Opt"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Find maximum tropopause level, set at 40 hPa (based on GEOS-Chem 72 and 47 + ! layer grids) + nTrop = nZ + DO WHILE ( hyam(nZ+1-nTrop) * ps0 < 4000.0 ) + nTrop = nTrop-1 + ENDDO + ! Find stratopause level, defined at 1 hPa + nStrat = nZ + DO WHILE ( hyam(nZ+1-nStrat) * ps0 < 100.0 ) + nStrat = nStrat-1 + ENDDO + + ! Initialize grid with largest number of columns + ! This is required as State_Grid(LCHNK) can have different + ! number of columns, but GEOS-Chem arrays are defined based + ! on State_Grid(BEGCHUNK). + ! To go around this, we define all of GEOS-Chem arrays with + ! size PCOLS x PVER, which is the largest possible number of + ! grid cells. + CALL Init_State_Grid( Input_Opt = Input_Opt, & + State_Grid = maxGrid, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "Init_State_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + maxGrid%NX = nX + maxGrid%NY = nY + maxGrid%NZ = nZ + + Input_Opt%thisCPU = myCPU + Input_Opt%amIRoot = MasterProc + + !IF ( MasterProc ) THEN + IF ( .True. ) THEN + CALL Read_Input_File( Input_Opt = Input_Opt, & + State_Grid = maxGrid, & + RC = RC ) + + ! First setup directories + Input_Opt%Chem_Inputs_Dir = TRIM(gc_cheminputs) + Input_Opt%SpcDatabaseFile = TRIM(speciesDB) + Input_Opt%FAST_JX_DIR = TRIM(gc_cheminputs)//'FAST_JX/v2020-02/' + + !================================================================== + ! CESM-specific input flags + !================================================================== + + ! onlineAlbedo -> True (use CLM albedo) + ! -> False (read monthly-mean albedo from HEMCO) + Input_Opt%onlineAlbedo = .True. + + ! onlineLandTypes -> True (use CLM landtypes) + ! -> False (read landtypes from HEMCO) + Input_Opt%onlineLandTypes = .True. + + ! ddVel_CLM -> True (use CLM dry deposition velocities) + ! -> False (let GEOS-Chem compute dry deposition velocities) + Input_Opt%ddVel_CLM = .False. + + ! applyQtend: apply tendencies of water vapor to specific humidity + Input_Opt%applyQtend = .False. + ENDIF + + CALL Validate_Directories( Input_Opt, RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Validation_Directories"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Initialize GEOS-Chem horizontal grid structure + CALL GC_Init_Grid( Input_Opt = Input_Opt, & + State_Grid = maxGrid, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "GC_Init_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Define more variables for maxGrid + maxGrid%MaxTropLev = nTrop + maxGrid%MaxStratLev = nStrat + IF ( Input_Opt%LUCX ) THEN + maxGrid%MaxChemLev = maxGrid%MaxStratLev + ELSE + maxGrid%MaxChemLev = maxGrid%MaxTropLev + ENDIF + + DO I = BEGCHUNK, ENDCHUNK + + ! Initialize fields of the Grid State object + CALL Init_State_Grid( Input_Opt = Input_Opt, & + State_Grid = State_Grid(I), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "Init_State_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + State_Grid(I)%NX = nX + State_Grid(I)%NY = NCOL(I) + State_Grid(I)%NZ = nZ + + ! Initialize GEOS-Chem horizontal grid structure + CALL GC_Init_Grid( am_I_Root = am_I_Root, & + Input_Opt = Input_Opt, & + State_Grid = State_Grid(I), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "GC_Init_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Define more variables for State_Grid + State_Grid(I)%MaxTropLev = nTrop + State_Grid(I)%MaxStratLev = nStrat + + ! Set maximum number of levels in the chemistry grid + IF ( Input_Opt%LUCX ) THEN + State_Grid(I)%MaxChemLev = State_Grid(I)%MaxStratLev + ELSE + State_Grid(I)%MaxChemLev = State_Grid(I)%MaxTropLev + ENDIF + + ENDDO + + ! Note - this is called AFTER chem_readnl, after X, and after + ! every constituent has had its initial conditions read. Any + ! constituent which is not found in the CAM restart file will + ! then have already had a call to chem_implements_cnst, and will + ! have then had a call to chem_init_cnst to set a default VMR + ! Call the routine GC_Allocate_All (located in module file + ! GeosCore/gc_environment_mod.F90) to allocate all lat/lon + ! allocatable arrays used by GEOS-Chem. + CALL GC_Allocate_All ( Input_Opt = Input_Opt, & + State_Grid = maxGrid, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "GC_Allocate_All"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Read in data for Linoz. All CPUs allocate one array to hold the data. Only + ! the root CPU reads in the data; then we copy it out to a temporary array, + ! broadcast to all other CPUs, and finally duplicate the data into every + ! copy of Input_Opt + IF ( Input_Opt%LLinoz ) THEN + ! Allocate array for broadcast + nLinoz = Input_Opt%Linoz_NLevels * & + Input_Opt%Linoz_NLat * & + Input_Opt%Linoz_NMonths * & + Input_Opt%Linoz_NFields + ALLOCATE( linozData( Input_Opt%Linoz_NLevels, & + Input_Opt%Linoz_NLat, & + Input_Opt%Linoz_NMonths, & + Input_Opt%Linoz_NFields ), STAT=IERR) + IF (IERR .NE. 0) CALL ENDRUN('Failure while allocating linozData') + linozData = 0.0e+0_r8 + + IF ( MasterProc ) THEN + ! Read data in to Input_Opt%Linoz_TParm + CALL Linoz_Read( MasterProc, Input_Opt, RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Linoz_Read"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ! Copy the data to a temporary array + linozData = REAL(Input_Opt%LINOZ_TPARM, r8) + ENDIF +#if defined( SPMD ) + CALL MPIBCAST( linozData, nLinoz, MPIR8, 0, MPICOM ) +#endif + IF ( .NOT. MasterProc ) THEN + Input_Opt%LINOZ_TPARM = REAL(linozData,fp) + ENDIF + IF ( ALLOCATED( linozData ) ) DEALLOCATE(linozData) + ENDIF + + + ! Note: The following calculations do not setup the gridcell areas. + ! In any case, we will need to be constantly updating this grid + ! to compensate for the "multiple chunks per processor" element + ALLOCATE(lonMidArr(maxGrid%nX,maxGrid%nY), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating lonMidArr') + ALLOCATE(lonEdgeArr(maxGrid%nX+1,maxGrid%nY+1), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating lonEdgeArr') + ALLOCATE(latMidArr(maxGrid%nX,maxGrid%nY), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating latMidArr') + ALLOCATE(latEdgeArr(maxGrid%nX+1,maxGrid%nY+1), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating latEdgeArr') + + ! We could try and get the data from CAM.. but the goal is to make this GC + ! component completely grid independent. So for now, we set to arbitrary + ! values + ! TODO: This needs more refinement. For now, this generates identical + ! State_Grid for all chunks + DO L = BEGCHUNK, ENDCHUNK + lonMidArr = 0.0e+0_f4 + latMidArr = 0.0e+0_f4 + dLonFix = 360.0e+0_fp / REAL(nX,fp) + dLatFix = 180.0e+0_fp / REAL(NCOL(L),fp) + DO I = 1, nX + ! Center of box, assuming dateline edge + lonVal = -180.0e+0_fp + (REAL(I-1,fp)*dLonFix) + DO J = 1, NCOL(L) + ! Center of box, assuming regular cells + latVal = -90.0e+0_fp + (REAL(J-1,fp)*dLatFix) + lonMidArr(I,J) = REAL((lonVal + (0.5e+0_fp * dLonFix)) * PI_180, f4) + latMidArr(I,J) = REAL((latVal + (0.5e+0_fp * dLatFix)) * PI_180, f4) + + ! Edges of box, assuming regular cells + lonEdgeArr(I,J) = REAL(lonVal * PI_180, f4) + latEdgeArr(I,J) = REAL(latVal * PI_180, f4) + ENDDO + ! Edges of box, assuming regular cells + lonEdgeArr(I,NCOL(L)+1) = REAL((lonVal + dLonFix) * PI_180, f4) + latEdgeArr(I,NCOL(L)+1) = REAL((latVal + dLatFix) * PI_180, f4) + ENDDO + DO J = 1, NCOL(L)+1 + ! Edges of box, assuming regular cells + latVal = -90.0e+0_fp + (REAL(J-1,fp)*dLatFix) + lonEdgeArr(nX+1,J) = REAL((lonVal + dLonFix) * PI_180, f4) + latEdgeArr(nX+1,J) = REAL((latVal) * PI_180, f4) + ENDDO + + CALL SetGridFromCtrEdges( am_I_Root = MasterProc, & + State_Grid = State_Grid(L), & + lonCtr = lonMidArr, & + latCtr = latMidArr, & + lonEdge = lonEdgeArr, & + latEdge = latEdgeArr, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "SetGridFromCtrEdges"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ENDDO + IF ( ALLOCATED( lonMidArr ) ) DEALLOCATE( lonMidArr ) + IF ( ALLOCATED( latMidArr ) ) DEALLOCATE( latMidArr ) + IF ( ALLOCATED( lonEdgeArr ) ) DEALLOCATE( lonEdgeArr ) + IF ( ALLOCATED( latEdgeArr ) ) DEALLOCATE( latEdgeArr ) + + + ! Set the times held by "time_mod" + CALL Accept_External_Date_Time( value_NYMDb = Input_Opt%NYMDb, & + value_NHMSb = Input_Opt%NHMSb, & + value_NYMDe = Input_Opt%NYMDe, & + value_NHMSe = Input_Opt%NHMSe, & + value_NYMD = Input_Opt%NYMDb, & + value_NHMS = Input_Opt%NHMSb, & + RC = RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Accept_External_Date_Time"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Start by setting some dummy timesteps + CALL GC_Update_Timesteps(300.0E+0_r8) + + ! Initialize error module + CALL Init_Error( Input_Opt, RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Error"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Set a flag to denote if we should print ND70 debug output + prtDebug = ( Input_Opt%LPRT .and. MasterProc ) + + historyConfigFile = 'HISTORY.rc' + ! This requires input.geos and HISTORY.rc to be in the run directory + ! This is the current way chosen to diagnose photolysis rates! + CALL Init_DiagList( MasterProc, historyConfigFile, Diag_List, RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_DiagList"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Initialize the TaggedDiag_List (list of wildcards/tags per diagnostic) + CALL Init_TaggedDiagList( Input_Opt%amIroot, Diag_List, & + TaggedDiag_List, RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_TaggedDiagList"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + IF ( prtDebug ) THEN + CALL Print_DiagList( Input_Opt%amIRoot, Diag_List, RC ) + CALL Print_TaggedDiagList( Input_Opt%amIRoot, TaggedDiag_List, RC ) + ENDIF + + DO I = BEGCHUNK, ENDCHUNK + am_I_Root = (MasterProc .AND. (I == BEGCHUNK)) + + CALL GC_Init_StateObj( Diag_List = Diag_List, & ! Diagnostic list obj + TaggedDiag_List = TaggedDiag_List, & ! TaggedDiag list obj + Input_Opt = Input_Opt, & ! Input Options + State_Chm = State_Chm(I), & ! Chemistry State + State_Diag = State_Diag(I), & ! Diagnostics State + State_Grid = maxGrid, & ! Grid State + State_Met = State_Met(I), & ! Meteorology State + RC = RC ) ! Success or failure + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "GC_Init_StateObj"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Start with v/v dry (CAM standard) + State_Chm(I)%Spc_Units = 'v/v dry' + + ENDDO + Input_Opt%amIRoot = MasterProc + + CALL GC_Init_Extra( Diag_List = Diag_List, & ! Diagnostic list obj + & Input_Opt = Input_Opt, & ! Input Options + & State_Chm = State_Chm(BEGCHUNK), & ! Chemistry State + & State_Diag = State_Diag(BEGCHUNK), & ! Diagnostics State + & State_Grid = maxGrid, & ! Grid State + & RC = RC ) ! Success or failure + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "GC_Init_Extra"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + IF ( Input_Opt%LDryD ) THEN + !============================================================== + ! Get mapping between CESM dry deposited species and the + ! indices of State_Chm%DryDepVel. This needs to be done after + ! Init_Drydep + ! Thibaud M. Fritz - 04 Mar 2020 + !============================================================== + + ALLOCATE(map2GC_dryDep(nddvels), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate map2GC_dryDep') + + DO N = 1, nddvels + ! Initialize index to -1 + map2GC_dryDep(N) = -1 + + IF ( drySpc_ndx(N) > 0 ) THEN + + ! Convert to upper case + SpcName = to_upper(drydep_list(N)) + + DO I = 1, State_Chm(BEGCHUNK)%nDryDep + IF ( TRIM( SpcName ) == TRIM( to_upper(depName(I)) ) ) THEN + map2GC_dryDep(N) = nDVZind(I) + EXIT + ENDIF + ENDDO + + ! Print out debug information + IF ( masterProc ) THEN + IF ( N == 1 ) Write(iulog,*) " ++ GEOS-Chem Dry deposition ++ " + IF ( map2GC_dryDep(N) > 0 ) THEN + Write(iulog,*) " CESM species: ", TRIM(drydep_list(N)), & + ' is matched with ', depName(map2GC_dryDep(N)) + ELSE + Write(iulog,*) " CESM species: ", TRIM(drydep_list(N)), & + ' has no match' + ENDIF + ENDIF + + ENDIF + ENDDO + ENDIF + +#if defined( MODAL_AERO_4MODE ) + ! Initialize aqueous chem + CALL SOx_inti() + + ! Initialize aerosols + CALL aero_model_init( pbuf2d ) + + ! Initialize land maps for aerosol dry deposition + IF ( drydep_method == DD_XLND ) THEN + CALL drydep_inti_landuse( depvel_lnd_file, & + clim_soilw_file ) + ELSE + Write(iulog,'(a,a)') ' drydep_method is set to: ', TRIM(drydep_method) + CALL ENDRUN('drydep_method must be DD_XLND to compute land maps for aerosol' // & + ' dry deposition!') + ENDIF +#endif + + IF ( gas_wetdep_method == 'NEU' ) THEN + ! Initialize MOZART's wet deposition + CALL Neu_wetdep_init() + ENDIF + + ! Set grid-cell area + DO N = BEGCHUNK, ENDCHUNK + ALLOCATE(Col_Area(State_Grid(N)%nY), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating Col_Area') + + CALL Get_Area_All_p(N, State_Grid(N)%nY, Col_Area) + + ! Set default value (in case of chunks with fewer columns) + State_Grid(N)%Area_M2 = 1.0e+10_fp + DO I = 1, State_Grid(N)%nX + DO J = 1, State_Grid(N)%nY + State_Grid(N)%Area_M2(I,J) = REAL(Col_Area(J) * Re**2,fp) + State_Met(N)%Area_M2(I,J) = State_Grid(N)%Area_M2(I,J) + ENDDO + ENDDO + + IF ( ALLOCATED( Col_Area ) ) DEALLOCATE(Col_Area) + ENDDO + + ! Initialize (mostly unused) diagnostic arrays + ! WARNING: This routine likely calls on modules which are currently + ! excluded from the GC-CESM build (eg diag03) + ! CALL Initialize( MasterProc, Input_Opt, 2, RC ) + ! CALL Initialize( Masterproc, Input_Opt, 3, RC ) + + ! Get Ap and Bp from CAM at pressure edges + ALLOCATE(Ap_CAM_Flip(nZ+1), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating Ap_CAM_Flip') + ALLOCATE(Bp_CAM_Flip(nZ+1), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating Bp_CAM_Flip') + + Ap_CAM_Flip = 0.0e+0_fp + Bp_CAM_Flip = 0.0e+0_fp + DO I = 1, nZ+1 + Ap_CAM_Flip(I) = hyai(nZ+2-I) * ps0 * 0.01e+0_r8 + Bp_CAM_Flip(I) = hybi(nZ+2-I) + ENDDO + + !----------------------------------------------------------------- + ! Pass external Ap and Bp to GEOS-Chem's Pressure_Mod + !----------------------------------------------------------------- + CALL Accept_External_ApBp( State_Grid = maxGrid, & ! Grid State + ApIn = Ap_CAM_Flip, & ! "A" term for hybrid grid + BpIn = Bp_CAM_Flip, & ! "B" term for hybrid grid + RC = RC ) ! Success or failure + + ! Print vertical coordinates + IF ( MasterProc ) THEN + WRITE( 6, '(a)' ) REPEAT( '=', 79 ) + WRITE( 6, '(a,/)' ) 'V E R T I C A L G R I D S E T U P' + WRITE( 6, '( ''Ap '', /, 6(f11.6,1x) )' ) Ap_CAM_Flip(1:maxGrid%nZ+1) + WRITE( 6, '(a)' ) + WRITE( 6, '( ''Bp '', /, 6(f11.6,1x) )' ) Bp_CAM_Flip(1:maxGrid%nZ+1) + WRITE( 6, '(a)' ) REPEAT( '=', 79 ) + ENDIF + + ! Trapping errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Accept_External_ApBp"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + IF ( ALLOCATED( Ap_CAM_Flip ) ) DEALLOCATE( Ap_CAM_Flip ) + IF ( ALLOCATED( Bp_CAM_Flip ) ) DEALLOCATE( Bp_CAM_Flip ) + + !! Initialize HEMCO? + !CALL Emissions_Init ( am_I_Root = MasterProc, & + ! Input_Opt = Input_Opt, & + ! State_Met = State_Met, & + ! State_Chm = State_Chm, & + ! State_Grid = State_Grid, & + ! State_Met = State_Met, & + ! RC = RC, & + ! HcoConfig = HcoConfig ) + ! + !IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Error encountered in "Emissions_Init"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + !ENDIF + ! + +!#if ( ALLDDVEL_GEOSCHEM && LANDTYPE_HEMCO ) +! ! Populate the State_Met%LandTypeFrac field with data from HEMCO +! CALL Init_LandTypeFrac( am_I_Root = MasterProc, & +! Input_Opt = Input_Opt, & +! State_Met = State_Met(BEGCHUNK), & +! RC = RC ) +! +! IF ( RC /= GC_SUCCESS ) THEN +! ErrMsg = 'Error encountered in "Init_LandTypeFrac"!' +! CALL Error_Stop( ErrMsg, ThisLoc ) +! ENDIF +! +! ! Compute the Olson landmap fields of State_Met +! ! (e.g. State_Met%IREG, State_Met%ILAND, etc.) +! CALL Compute_Olson_Landmap( am_I_Root = MasterProc, & +! Input_Opt = Input_Opt, & +! State_Grid = State_Grid(BEGCHUNK), & +! State_Met = State_Met(BEGCHUNK), & +! RC = RC ) +! +! IF ( RC /= GC_SUCCESS ) THEN +! ErrMsg = 'Error encountered in "Compute_Olson_Landmap"!' +! CALL Error_Stop( ErrMsg, ThisLoc ) +! ENDIF +!#endif + + IF ( Input_Opt%Its_A_FullChem_Sim .OR. & + Input_Opt%Its_An_Aerosol_Sim ) THEN + ! This also initializes Fast-JX + CALL Init_Chemistry( Input_Opt = Input_Opt, & + & State_Chm = State_Chm(BEGCHUNK), & + & State_Diag = State_Diag(BEGCHUNK), & + & State_Grid = State_Grid(BEGCHUNK), & + & RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Chemistry"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + IF ( Input_Opt%LChem .AND. & + Input_Opt%LUCX ) THEN + CALL Init_UCX( Input_Opt = Input_Opt, & + State_Chm = State_Chm(BEGCHUNK), & + State_Diag = State_Diag(BEGCHUNK), & + State_Grid = maxGrid ) + ENDIF + + IF ( Input_Opt%LSCHEM ) THEN + CALL Init_Strat_Chem( Input_Opt = Input_Opt, & + State_Chm = State_Chm(BEGCHUNK), & + State_Met = State_Met(BEGCHUNK), & + State_Grid = maxGrid, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Init_Strat_Chem"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + IF ( Input_Opt%LSSalt ) THEN + CALL INIT_ISORROPIAII( State_Grid = maxGrid ) + ENDIF + + ! Get some indices + iH2O = Ind_('H2O') + iO3 = Ind_('O3') + iCO2 = Ind_('CO2') + ! The following indices are needed to compute invariants + iO = Ind_('O') + iH = Ind_('H') + iO2 = Ind_('O2') + + ! This is used to compute gas-phase H2SO4 production + iPSO4 = Ind_('PSO4') + SpcInfo => State_Chm(BEGCHUNK)%SpcData(iPSO4)%Info + MWPSO4 = REAL(SpcInfo%MW_g,r8) + ! Free pointer + SpcInfo => NULL() + + ! This is used to compute overhead ozone column + SpcInfo => State_Chm(BEGCHUNK)%SpcData(iO3)%Info + MWO3 = REAL(SpcInfo%MW_g,r8) + ! Free pointer + SpcInfo => NULL() + + ! Get indices for physical fields in physics buffer + NDX_PBLH = pbuf_get_index('pblh' ) + NDX_FSDS = pbuf_get_index('FSDS' ) + NDX_CLDTOP = pbuf_get_index('CLDTOP' ) + NDX_CLDFRC = pbuf_get_index('CLD' ) + NDX_PRAIN = pbuf_get_index('PRAIN' ) + NDX_NEVAPR = pbuf_get_index('NEVAPR' ) + NDX_LSFLXPRC = pbuf_get_index('LS_FLXPRC') + NDX_LSFLXSNW = pbuf_get_index('LS_FLXSNW') + NDX_CMFDQR = pbuf_get_index('RPRDTOT' ) + + ! Get cloud water indices + CALL cnst_get_ind( 'CLDLIQ', ixCldLiq) + CALL cnst_get_ind( 'CLDICE', ixCldIce) + CALL cnst_get_ind( 'NUMLIQ', ixNDrop, abort=.False. ) + + CALL init_mean_mass() + CALL setinv_inti() + + !----------------------------------------------------------------------- + ! ... initialize tracer modules + !----------------------------------------------------------------------- + CALL tracer_cnst_init() + CALL tracer_srcs_init() + + IF ( ghg_chem ) THEN + CALL ghg_chem_init(phys_state, bndtvg, h2orates) + ENDIF + + ! Initialize diagnostics interface + CALL CESMGC_Diag_Init( Input_Opt = Input_Opt, & + State_Chm = State_Chm(BEGCHUNK), & + State_Met = State_Met(BEGCHUNK) ) + + ! Initialize emissions interface + CALL CESMGC_Emissions_Init( lght_no_prd_factor = lght_no_prd_factor ) + + hco_pbuf2d => pbuf2d + + If ( MasterProc ) Write(iulog,*) "hco_pbuf2d now points to pbuf2d" + + ! Cleanup + Call Cleanup_State_Grid( maxGrid, RC ) + + end subroutine chem_init + +!=============================================================================== + + subroutine chem_timestep_init(phys_state, pbuf2d) + + use physics_buffer, only : physics_buffer_desc + use mo_flbc, only : flbc_chk + use mo_ghg_chem, only : ghg_chem_timestep_init + + TYPE(physics_state), INTENT(IN):: phys_state(begchunk:endchunk) + TYPE(physics_buffer_desc), POINTER :: pbuf2d(:,:) + + ! Not sure what we would realistically do here rather than in tend + + !----------------------------------------------------------------------- + ! Set fixed lower boundary timing factors + !----------------------------------------------------------------------- + CALL flbc_chk + + IF ( ghg_chem ) THEN + CALL ghg_chem_timestep_init(phys_state) + ENDIF + + end subroutine chem_timestep_init + +!=============================================================================== + + subroutine GC_Update_Timesteps(DT) + + use Time_Mod, only : Set_Timesteps + + REAL(r8), INTENT(IN) :: DT + INTEGER :: DT_MIN + INTEGER, SAVE :: DT_MIN_LAST = -1 + + DT_MIN = NINT(DT) + + Input_Opt%TS_CHEM = DT_MIN + Input_Opt%TS_EMIS = DT_MIN + Input_Opt%TS_CONV = DT_MIN + Input_Opt%TS_DYN = DT_MIN + Input_Opt%TS_RAD = DT_MIN + + ! Only bother updating the module information if there's been a change + IF (DT_MIN .NE. DT_MIN_LAST) THEN + CALL Set_Timesteps( Input_Opt = Input_Opt, & + CHEMISTRY = DT_MIN, & + EMISSION = DT_MIN, & + DYNAMICS = DT_MIN, & + UNIT_CONV = DT_MIN, & + CONVECTION = DT_MIN, & + DIAGNOS = DT_MIN, & + RADIATION = DT_MIN ) + DT_MIN_LAST = DT_MIN + ENDIF + + end subroutine + +!=============================================================================== + +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: gc_readnl +! +! !DESCRIPTION: Reads the namelist from cam/src/control/runtime_opts. +!\\ +!\\ +! !INTERFACE: +! + subroutine gc_readnl(nlfile) +! +! !USES: +! + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit + use mpishorthand +! +! !INPUT PARAMETERS: +! + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input +! +! !REVISION HISTORY: +! 21 Jan 2021 - T.M. Fritz - Initial version +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + integer :: unitn, ierr + character(len=*), parameter :: subname = 'gc_readnl' + + namelist /gc_nl/ gc_cheminputs + + !----------------------------------------------------------------------------- + + ! Read namelist + IF ( MasterProc ) THEN + unitn = getunit() + OPEN( unitn, FILE=TRIM(nlfile), STATUS='old' ) + CALL find_group_name(unitn, 'gc_nl', STATUS=ierr) + IF ( ierr == 0 ) THEN + READ(unitn, gc_nl, IOSTAT=ierr) + IF ( ierr /= 0 ) THEN + CALL ENDRUN(subname // ':: ERROR reading namelist') + ENDIF + ENDIF + CLOSE(unitn) + CALL freeunit(unitn) + ENDIF + +#ifdef SPMD + ! Broadcast namelist variables + CALL MPIBCAST(gc_cheminputs, LEN(gc_cheminputs), MPICHAR, 0, MPICOM) +#endif + + end subroutine +!EOC + +!=============================================================================== + + subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) + + use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx + use physics_buffer, only : pbuf_get_chunk, pbuf_get_index + use perf_mod, only : t_startf, t_stopf + use cam_history, only : outfld, hist_fld_active + use camsrfexch, only : cam_in_t, cam_out_t + +#ifdef SPMD + use mpishorthand +#endif + + use phys_grid, only : get_ncols_p, get_rlat_all_p, get_rlon_all_p + + use chem_mods, only : drySpc_ndx, map2GC_dryDep + use chem_mods, only : nfs, indexm, gas_pcnst + use mo_mean_mass, only : set_mean_mass + use mo_setinv, only : setinv + use mo_flbc, only : flbc_set + use mo_ghg_chem, only : ghg_chem_set_flbc + use mo_neu_wetdep, only : neu_wetdep_tend + use gas_wetdep_opts, only : gas_wetdep_method +#if defined( MODAL_AERO_4MODE ) + use modal_aero_data, only : ntot_amode, nspec_amode + use modal_aero_data, only : lmassptr_amode + use modal_aero_data, only : xname_massptr +#endif + + use Olson_Landmap_Mod, only : Compute_Olson_Landmap + use Modis_LAI_Mod, only : Compute_XLAI + use CMN_Size_Mod, only : NSURFTYPE + use Drydep_Mod, only : Do_Drydep + use Drydep_Mod, only : DEPNAME, NDVZIND + use Drydep_Mod, only : Update_DryDepFreq + + use Calc_Met_Mod, only : Set_Dry_Surface_Pressure + use Calc_Met_Mod, only : AirQnt + use GC_Grid_Mod, only : SetGridFromCtr + use Pressure_Mod, only : Set_Floating_Pressures + use Pressure_Mod, only : Accept_External_Pedge + use Time_Mod, only : Accept_External_Date_Time + use Toms_Mod, only : Compute_Overhead_O3 + use Chemistry_Mod, only : Do_Chemistry + use Wetscav_Mod, only : Setup_Wetscav + use CMN_Size_Mod, only : PTop + use PBL_Mix_Mod, only : Compute_PBL_Height + use UCX_Mod, only : Set_H2O_Trac + use CMN_FJX_MOD, only : ZPJ + use State_Diag_Mod, only : get_TagInfo + use Unitconv_Mod, only : Convert_Spc_Units + + use Strat_Chem_Mod, only : Strat_TrID_GC, GC_Bry_TrID, NSCHEM + use Strat_Chem_Mod, only : BrPtrDay, BrPtrNight, PLVEC, STRAT_OH + + use CESMGC_Emissions_Mod,only : CESMGC_Emissions_Calc + use CESMGC_Diag_Mod, only : CESMGC_Diag_Calc + use CESMGC_Diag_Mod, only : wetdep_name, wtrate_name + + use Tropopause, only : Tropopause_findChemTrop, Tropopause_Find + use HCO_Utilities_GC_Mod ! Utility routines for GC-HEMCO interface + + ! For calculating SZA + use Orbit, only : zenith + use Time_Manager, only : Get_Curr_Calday, Get_Curr_Date + + ! Calculating relative humidity + use WV_Saturation, only : QSat + + ! Grid area + use Phys_Grid, only : get_area_all_p, get_lat_all_p, get_lon_all_p + + use short_lived_species, only : get_short_lived_species + use short_lived_species, only : set_short_lived_species + +#if defined( MODAL_AERO ) + ! Aqueous chemistry and aerosol growth + use aero_model, only : aero_model_gasaerexch +#endif + + use rad_constituents, only : rad_cnst_get_info + + ! GEOS-Chem version of physical constants + use PhysConstants, only : PI, PI_180, g0, AVO, Re, g0_100 + ! CAM version of physical constants + use PhysConst, only : MWDry, Gravit + + REAL(r8), INTENT(IN) :: dT ! Time step + TYPE(physics_state), INTENT(IN) :: state ! Physics State variables + TYPE(physics_ptend), INTENT(OUT) :: ptend ! indivdual parameterization tendencies + TYPE(cam_in_t), INTENT(INOUT) :: cam_in + TYPE(cam_out_t), INTENT(IN) :: cam_out + TYPE(physics_buffer_desc), POINTER :: pbuf(:) + REAL(r8), OPTIONAL, INTENT(OUT) :: fh2o(PCOLS) ! h2o flux to balance source from chemistry + + ! Initial MMR for all species + REAL(r8) :: MMR_Beg(PCOLS,PVER,MAXVAL(map2GC(:))) + REAL(r8) :: MMR_End(PCOLS,PVER,MAXVAL(map2GC(:))) + + ! Logical to apply tendencies to mixing ratios + LOGICAL :: lq(pcnst) + + ! Indexing + INTEGER :: N, M, P, SM, ND + INTEGER :: I, J, L, nX, nY, nZ + + INTEGER :: LCHNK, NCOL + + REAL(r8), DIMENSION(state%NCOL) :: & + CSZA, & ! Cosine of solar zenith angle + CSZAmid, & ! Cosine of solar zenith angle at the mid timestep + Rlats, Rlons ! Chunk latitudes and longitudes (radians) + + REAL(fp) :: O3col(state%NCOL) ! Overhead O3 column (DU) + + REAL(r8), POINTER :: PblH(:) ! PBL height on each chunk [m] + REAL(r8), POINTER :: cldTop(:) ! Cloud top height [?] + REAL(r8), POINTER :: cldFrc(:,:) ! Cloud fraction [-] + REAL(r8), POINTER :: Fsds(:) ! Downward shortwave flux at surface [W/m2] + REAL(r8), POINTER :: PRain(:,:) ! Total stratiform precip. prod. (rain + snow) [kg/kg/s] + REAL(r8), POINTER :: NEvapr(:,:) ! Evaporation of total precipitation (rain + snow) [kg/kg/s] + REAL(r8), POINTER :: LsFlxPrc(:,:) ! Large-scale downward precip. flux at interface (rain + snow) [kg/m2/s] + REAL(r8), POINTER :: LsFlxSnw(:,:) ! Large-scale downward precip. flux at interface (snow only) [kg/m2/s] + REAL(r8), POINTER :: cmfdqr(:,:) ! Total convective precip. prod. (rain + snow) [kg/kg/s] + + REAL(r8) :: tmpMass + REAL(r8) :: cldW (state%NCOL,PVER) ! Cloud water (kg/kg) + REAL(r8) :: nCldWtr(state%NCOL,PVER) ! Droplet number concentration (#/kg) + + REAL(r8) :: relHum (state%NCOL,PVER) ! Relative humidity [0-1] + REAL(r8) :: satV (state%NCOL,PVER) ! Work arrays + REAL(r8) :: satQ (state%NCOL,PVER) ! Work arrays + REAL(r8) :: qH2O (state%NCOL,PVER) ! Specific humidity [kg/kg] + REAL(r8) :: h2ovmr (state%NCOL,PVER) ! H2O volume mixing ratio + REAL(r8) :: mBar (state%NCOL,PVER) ! Mean wet atmospheric mass [amu] + REAL(r8) :: invariants(state%NCOL,PVER,nfs) + REAL(r8) :: reaction_rates(1,1,1) ! Reaction rates (unused) + + ! For aerosol formation + REAL(r8) :: del_h2so4_gasprod(state%NCOL,PVER) + REAL(r8) :: vmr0(state%NCOL,PVER,gas_pcnst) + REAL(r8) :: vmr1(state%NCOL,PVER,gas_pcnst) + REAL(r8) :: wetdepflx(pcols,pcnst) ! Wet deposition fluxes (kg/m2/s) + +#if defined( MODAL_AERO ) + REAL(r8) :: binRatio(MAXVAL(nspec_amode(:)),ntot_amode,state%NCOL,PVER) +#endif + + ! For emissions + REAL(r8) :: eflx(pcols,pver,pcnst) ! 3-D emissions in kg/m2/s + + ! For GEOS-Chem diagnostics + REAL(r8) :: mmr_tend(state%NCOL,PVER,gas_pcnst) + REAL(r8) :: wk_out(state%NCOL) + LOGICAL :: Found + CHARACTER(LEN=255) :: tagName + + REAL(r8), PARAMETER :: zlnd = 0.01_r8 ! Roughness length for soil [m] + REAL(r8), PARAMETER :: zslnd = 0.0024_r8 ! Roughness length for snow [m] + REAL(r8), PARAMETER :: zsice = 0.0400_r8 ! Roughness length for sea ice [m] + REAL(r8), PARAMETER :: zocn = 0.0001_r8 ! Roughness length for oean [m] + + REAL(f4) :: lonMidArr(1,PCOLS), latMidArr(1,PCOLS) + INTEGER :: iMaxLoc(1) + + REAL(r8) :: Col_Area(state%NCOL) + + ! Intermediate arrays + INTEGER :: Trop_Lev (PCOLS) + REAL(r8) :: Trop_P (PCOLS) + REAL(r8) :: Trop_T (PCOLS) + REAL(r8) :: Trop_Ht (PCOLS) + REAL(r8) :: SnowDepth(PCOLS) + REAL(r8) :: cld2D (PCOLS) + REAL(r8) :: Z0 (PCOLS) + REAL(r8) :: Sd_Ice, Sd_Lnd, Sd_Avg, Frc_Ice + + ! Estimating cloud optical depth + REAL(r8) :: cld(PCOLS,PVER) + REAL(r8) :: TauCli(PCOLS,PVER) + REAL(r8) :: TauClw(PCOLS,PVER) + REAL(r8), PARAMETER :: re_m = 1.0e-05_r8 ! Cloud drop radius in m + REAL(r8), PARAMETER :: cldMin = 1.0e-02_r8 ! Minimum cloud cover + REAL(r8), PARAMETER :: cnst = 1.5e+00_r8 / (re_m * 1.0e+03_r8 * g0) + + ! Calculating SZA + REAL(r8) :: Calday + + CHARACTER(LEN=255) :: SpcName + CHARACTER(LEN=255) :: Prefix, FieldName + LOGICAL :: FND + INTEGER :: SpcId + TYPE(Species), POINTER :: SpcInfo + + CHARACTER(LEN=63) :: OrigUnit + + REAL(r8) :: SlsData(PCOLS, PVER, nSls) + + INTEGER :: currYr, currMo, currDy, currTOD + INTEGER :: currYMD, currHMS, currHr, currMn, currSc + REAL(f4) :: currUTC + + TYPE(physics_buffer_desc), POINTER :: pbuf_chnk(:) ! slice of pbuf in chnk + REAL(r8), POINTER :: pbuf_ik(:,:) ! ptr to pbuf data (/pcols,pver/) + INTEGER :: tmpIdx ! pbuf field id + CHARACTER(LEN=255) :: fldname_ns ! field name + + INTEGER :: TIM_NDX + INTEGER :: IERR + + INTEGER, SAVE :: iStep = 0 + LOGICAL :: rootChunk + LOGICAL :: lastChunk + INTEGER :: RC + + + ! Initialize pointers + SpcInfo => NULL() + PblH => NULL() + cldTop => NULL() + cldFrc => NULL() + Fsds => NULL() + PRain => NULL() + NEvapr => NULL() + LsFlxPrc => NULL() + LsFlxSnw => NULL() + cmfdqr => NULL() + pbuf_chnk=> NULL() + pbuf_ik => NULL() + + ! LCHNK: which chunk we have on this process + LCHNK = state%LCHNK + ! NCOL: number of atmospheric columns on this chunk + NCOL = state%NCOL + + ! Root Chunk + rootChunk = ( MasterProc .and. (LCHNK==BEGCHUNK) ) + ! Last Chunk + lastChunk = ( MasterProc .and. (LCHNK==ENDCHUNK) ) + + ! Count the number of steps which have passed + IF ( LCHNK .EQ. BEGCHUNK ) iStep = iStep + 1 + + ! Need to update the timesteps throughout the code + CALL GC_Update_Timesteps(dT) + + ! For safety's sake + PTop = state%pint(1,1)*0.01e+0_fp + + ! Need to be super careful that the module arrays are updated and correctly + ! set. NOTE: First thing - you'll need to flip all the data vertically + + nX = 1 + nY = NCOL + nZ = PVER + + ! Update the grid lat/lons since they are module variables + ! Assume (!) that area hasn't changed for now, as GEOS-Chem will + ! retrieve this from State_Met which is chunked + !CALL get_rlat_all_p( LCHNK, NCOL, Rlats ) + !CALL get_rlon_all_p( LCHNK, NCOL, Rlons ) + Rlats(1:nY) = state%Lat(1:nY) + Rlons(1:nY) = state%Lon(1:nY) + + lonMidArr = 0.0e+0_f4 + latMidArr = 0.0e+0_f4 + DO I = 1, nX + DO J = 1, nY + lonMidArr(I,J) = REAL(Rlons(J), f4) + latMidArr(I,J) = REAL(Rlats(J), f4) + ENDDO + ENDDO + + ! Update the grid + CALL SetGridFromCtr( Input_Opt = Input_Opt, & + State_Grid = State_Grid(LCHNK), & + lonCtr = lonMidArr, & + latCtr = latMidArr, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered within call to "SetGridFromCtr"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Set area + CALL Get_Area_All_p( LCHNK, nY, Col_Area ) + + ! Field : AREA_M2 + ! Description: Grid box surface area + ! Unit : - + ! Dimensions : nX, nY + ! Note : Set default value (in case of chunks with fewer columns) + State_Grid(LCHNK)%Area_M2 = -1.0e+10_fp + State_Met(LCHNK)%Area_M2 = -1.0e+10_fp + State_Grid(LCHNK)%Area_M2(1,:nY) = REAL(Col_Area(:nY) * Re**2,fp) + State_Met(LCHNK)%Area_M2(1,:nY) = State_Grid(LCHNK)%Area_M2(1,:nY) + + ! 2. Copy tracers into State_Chm + ! Data was received in kg/kg dry + State_Chm(LCHNK)%Spc_Units = 'kg/kg dry' + ! Initialize ALL State_Chm species data to zero, not just tracers + State_Chm(LCHNK)%Species = 0.0e+0_fp + + lq(:) = .False. + + ! Map and flip gaseous species + MMR_Beg = 0.0e+0_r8 + MMR_End = 0.0e+0_r8 + DO N = 1, pcnst + M = map2GC(N) + IF ( M <= 0 ) CYCLE + MMR_Beg(:nY,:nZ,M) = state%q(:nY,nZ:1:-1,N) + State_Chm(LCHNK)%Species(1,:nY,:nZ,M) = REAL(MMR_Beg(:nY,:nZ,M),fp) + lq(N) = .True. + ENDDO + + ! We need to let CAM know that 'H2O' and 'Q' are identical + MMR_Beg(:nY,:nZ,iH2O) = state%q(:nY,nZ:1:-1,cQ) + State_Chm(LCHNK)%Species(1,:nY,:nZ,iH2O) = REAL(MMR_Beg(:nY,:nZ,iH2O),fp) + + ! Retrieve previous value of species data + SlsData(:,:,:) = 0.0e+0_r8 + CALL get_short_lived_species( SlsData, LCHNK, nY, pbuf ) + + !----------------------------------------------------------------------- + ! ... Set atmosphere mean mass + !----------------------------------------------------------------------- + ! This is not meant for simulations of the ionosphere. mBar will then just + ! be set to mwdry and does not require to pass anything besides NCOL. We + ! can then just past a dummy array as the second argument + !CALL Set_mean_mass( NCOL, mmr, mBar ) + CALL Set_mean_mass( NCOL, vmr0, mBar ) + + ! Map and flip gaseous short-lived species + DO N = 1, nSls + M = map2GC_Sls(N) + IF ( M <= 0 ) CYCLE + State_Chm(LCHNK)%Species(1,:nY,:nZ,M) = REAL(SlsData(:nY,nZ:1:-1,N),fp) + ENDDO + + DO N = 1, gas_pcnst + ! See definition of map2chm + M = map2chm(N) + IF ( M > 0 ) THEN + vmr0(:nY,:nZ,N) = State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,M) * & + MWDry / adv_mass(N) + ! We'll substract concentrations after chemistry later + mmr_tend(:nY,:nZ,N) = REAL(State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,M),r8) + ELSEIF ( M < 0 ) THEN + vmr0(:nY,:nZ,N) = state%q(:nY,:nZ,-M) * & + MWDry / adv_mass(N) + mmr_tend(:nY,:nZ,N) = state%q(:nY,:nZ,-M) + ENDIF + ENDDO + +#if defined( MODAL_AERO_4MODE ) + ! First reset State_Chm%Species to zero for aerosols + DO M = 1, ntot_amode + DO SM = 1, nspec_amode(M) + P = map2MAM4(SM,M) + IF ( P > 0 ) State_Chm(LCHNK)%Species(1,:nY,:nZ,P) = 0.0e+00_fp + ENDDO + ENDDO + + ! Map and flip aerosols + DO M = 1, ntot_amode + DO SM = 1, nspec_amode(M) + ! TMMF - Should there be a ratio of molar weights involved? + P = map2MAM4(SM,M) + IF ( P <= 0 ) CYCLE + N = lmassptr_amode(SM,M) + ! Multiple MAM4 bins are mapped to same GEOS-Chem species + State_Chm(LCHNK)%Species(1,:nY,:nZ,P) = State_Chm(LCHNK)%Species(1,:nY,:nZ,P) & + + REAL(state%q(:nY,nZ:1:-1,N),fp) + ENDDO + ENDDO + DO M = 1, ntot_amode + DO SM = 1, nspec_amode(M) + P = map2MAM4(SM,M) + IF ( P <= 0 ) CYCLE + N = lmassptr_amode(SM,M) + DO J = 1, nY + DO L = 1, nZ + IF ( State_Chm(LCHNK)%Species(1,J,nZ+1-L,P) > 0.0e+00_r8 ) THEN + binRatio(SM,M,J,L) = REAL(state%q(J,L,N),r8) & + / State_Chm(LCHNK)%Species(1,J,nZ+1-L,P) + ELSE + binRatio(SM,M,J,L) = 0.0e+00_r8 + ENDIF + ENDDO + ENDDO + ENDDO + ENDDO +#endif + + ! If H2O tendencies are propagated to specific humidity, then make sure + ! that Q actually applies tendencies + IF ( Input_Opt%applyQtend ) lq(cQ) = .True. + + IF ( ghg_chem ) lq(1) = .True. + + ! Initialize tendency array + CALL Physics_ptend_init(ptend, state%psetcols, 'chemistry', lq=lq) + + ! Reset chemical tendencies + ptend%q(:,:,:) = 0.0e+0_r8 + + ! Determine current date and time + CALL Get_Curr_Date( yr = currYr, & + mon = currMo, & + day = currDy, & + tod = currTOD ) + + currYMD = (currYr*1000) + (currMo*100) + (currDy) + ! Deal with subdaily + currUTC = REAL(currTOD,f4)/3600.0e+0_f4 + currSc = 0 + currMn = 0 + currHr = 0 + DO WHILE (currTOD >= 3600) + currTOD = currTOD - 3600 + currHr = currHr + 1 + ENDDO + DO WHILE (currTOD >= 60) + currTOD = currTOD - 60 + currMn = currMn + 1 + ENDDO + currSc = currTOD + currHMS = (currHr*1000) + (currMn*100) + (currSc) + + ! Calculate COS(SZA) + Calday = Get_Curr_Calday( INT(dT/2) ) + CALL Zenith( Calday, Rlats, Rlons, CSZAmid, nY ) + + Calday = Get_Curr_Calday( ) + CALL Zenith( Calday, Rlats, Rlons, CSZA, nY ) + + ! Get all required data from physics buffer + TIM_NDX = pbuf_old_tim_idx() + CALL pbuf_get_field( pbuf, NDX_PBLH, PblH ) + CALL pbuf_get_field( pbuf, NDX_FSDS, Fsds ) + CALL pbuf_get_field( pbuf, NDX_CLDTOP, cldTop ) + CALL pbuf_get_field( pbuf, NDX_CLDFRC, cldFrc, START=(/1,1,TIM_NDX/), KOUNT=(/NCOL,PVER,1/) ) + CALL pbuf_get_field( pbuf, NDX_NEVAPR, NEvapr, START=(/1,1/), KOUNT=(/NCOL,PVER/)) + CALL pbuf_get_field( pbuf, NDX_PRAIN, PRain, START=(/1,1/), KOUNT=(/NCOL,PVER/)) + CALL pbuf_get_field( pbuf, NDX_LSFLXPRC, LsFlxPrc, START=(/1,1/), KOUNT=(/NCOL,PVERP/)) + CALL pbuf_get_field( pbuf, NDX_LSFLXSNW, LsFlxSnw, START=(/1,1/), KOUNT=(/NCOL,PVERP/)) + CALL pbuf_get_field( pbuf, NDX_CMFDQR, cmfdqr, START=(/1,1/), KOUNT=(/NCOL,PVER/)) + + ! Get VMR and MMR of H2O + h2ovmr = 0.0e0_fp + qH2O = 0.0e0_fp + ! Note MWDry = 28.966 g/mol + DO J = 1, nY + DO L = 1, nZ + qH2O(J,L) = REAL(state%q(J,L,cQ),r8) + ! Set GEOS-Chem's H2O mixing ratio to CAM's specific humidity 'q' + State_Chm(LCHNK)%Species(1,J,nZ+1-L,iH2O) = qH2O(J,L) + h2ovmr(J,L) = qH2O(J,L) * MWDry / 18.016e+0_fp + ENDDO + ENDDO + + !----------------------------------------------------------------------- + ! ... Set the "invariants" + !----------------------------------------------------------------------- + CALL Setinv( invariants, state%t(:,:), h2ovmr, vmr0, & + state%pmid(:,:), nY, LCHNK, pbuf ) + + ! Calculate RH (range 0-1, note still level 1 = TOA) + relHum(:,:) = 0.0e+0_r8 + CALL QSat(state%t(:nY,:), state%pmid(:nY,:), satV, satQ) + DO J = 1, nY + DO L = 1, nZ + relHum(J,L) = 0.622e+0_r8 * h2ovmr(J,L) / satQ(J,L) + relHum(J,L) = MAX( 0.0e+0_r8, MIN( 1.0e+0_r8, relHum(J,L) ) ) + ENDDO + ENDDO + + Z0 = 0.0e+0_r8 + DO J = 1, nY + Z0(J) = cam_in%landFrac(J) * zlnd & + + cam_in%iceFrac(J) * zsice & + + cam_in%ocnFrac(J) * zocn + IF (( cam_in%snowhLand(J) > 0.01_r8 ) .OR. & + ( cam_in%snowhIce(J) > 0.01_r8 )) THEN + ! Land is covered in snow + Z0(J) = zslnd + ENDIF + ENDDO + + ! Estimate cloud liquid water content and OD + TauCli = 0.0e+0_r8 + TauClw = 0.0e+0_r8 + + ! Note: all using CAM vertical convention (1 = TOA) + ! Calculation is based on that done for MOZART + DO J = 1, nY + DO L = nZ, 1, -1 + cldW(J,L) = state%q(J,L,ixCldLiq) + state%q(J,L,ixCldIce) + ! Convert water mixing ratio [kg/kg] to water content [g/m^3] + IF ( cldW(J,L) * state%pmid(J,L) / & + (state%T(J,L) * 287.0e+00_r8) * 1.0e+03_r8 <= 0.01_r8 .AND. & + cldFrc(J,L) /= 0.0e+00_r8 ) THEN + cld(J,L) = 0.0e+00_r8 + ELSE + cld(J,L) = cldFrc(J,L) + ENDIF + IF ( ixNDrop > 0 ) nCldWtr(J,L) = state%q(J,L,ixNDrop) + ENDDO + ENDDO + + DO J = 1, nY + IF ( COUNT( cld(J,:nZ) > cldMin ) > 0 ) THEN + DO L = nZ, 1, -1 + ! ================================================================= + ! =========== Compute cloud optical depth based on ============ + ! =========== Liao et al. JGR, 104, 23697, 1999 ============ + ! ================================================================= + ! + ! Tau = 3/2 * LWC * dZ / ( \rho_w * r_e ) + ! dZ = - dP / ( \rho_air * g ) + ! since Pint is ascending, we can neglect the minus sign + ! + ! Tau = 3/2 * LWC * dP / ( \rho_air * r_e * \rho_w * g ) + ! LWC / \rho_air = Q + ! + ! Tau = 3/2 * Q * dP / ( r_e * rho_w * g ) + ! Tau(L) = 3/2 * Q(L) * (Pint(L+1) - Pint(L)) / (re * rho_w * g ) + ! Tau(L) = Q(L) * (Pint(L+1) - Pint(L)) * Cnst + ! + ! Unit check: | + ! Q : [kg H2O/kg air] | + ! Pint : [Pa]=[kg air/m/s^2] | + ! re : [m] | = 1.0e-5 + ! rho_w: [kg H2O/m^3] | = 1.0e+3 + ! g : [m/s^2] | = 9.81 + TauClw(J,L) = state%q(J,L,ixCldLiq) & + * (state%pint(J,L+1)-state%pint(J,L)) & + * cnst + TauClw(J,L) = MAX(TauClw(J,L), 0.0e+00_r8) + TauCli(J,L) = state%q(J,L,ixCldIce) & + * (state%pint(J,L+1)-state%pint(J,L)) & + * cnst + TauCli(J,L) = MAX(TauCli(J,L), 0.0e+00_r8) + ENDDO + ENDIF + ENDDO + + ! Retrieve tropopause level + Trop_Lev = 0.0e+0_r8 + CALL Tropopause_FindChemTrop(state, Trop_Lev) + ! Back out the pressure + Trop_P = 1000.0e+0_r8 + DO J = 1, nY + Trop_P(J) = state%pmid(J,Trop_Lev(J)) * 0.01e+0_r8 + ENDDO + + ! Calculate snow depth + snowDepth = 0.0e+0_r8 + DO J = 1, nY + Sd_Ice = MAX(0.0e+0_r8,cam_in%snowhIce(J)) + Sd_Lnd = MAX(0.0e+0_r8,cam_in%snowhLand(J)) + Frc_Ice = MAX(0.0e+0_r8,cam_in%iceFrac(J)) + IF (Frc_Ice > 0.0e+0_r8) THEN + Sd_Avg = (Sd_Lnd*(1.0e+0_r8 - Frc_Ice)) + (Sd_Ice * Frc_Ice) + ELSE + Sd_Avg = Sd_Lnd + ENDIF + snowDepth(J) = Sd_Avg + ENDDO + + ! Field : ALBD + ! Description: Visible surface albedo + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%ALBD (1,:nY) = cam_in%asdir(:nY) + + ! Field : CLDFRC + ! Description: Column cloud fraction + ! Unit : - + ! Dimensions : nX, nY + ! Note : Estimate column cloud fraction as the maximum cloud + ! fraction in the column (pessimistic assumption) + DO J = 1, nY + State_Met(LCHNK)%CLDFRC(1,J) = MAXVAL(cldFrc(J,:)) + ENDDO + + ! Field : EFLUX, HFLUX + ! Description: Latent heat flux, sensible heat flux + ! Unit : W/m^2 + ! Dimensions : nX, nY + State_Met(LCHNK)%EFLUX (1,:nY) = cam_in%Lhf(:nY) + State_Met(LCHNK)%HFLUX (1,:nY) = cam_in%Shf(:nY) + + ! Field : LandTypeFrac + ! Description: Olson fraction per type + ! Unit : - (between 0 and 1) + ! Dimensions : nX, nY, NSURFTYPE + ! Note : Index 1 is water + IF ( Input_Opt%onlineLandTypes ) THEN + ! Fill in water + State_Met(LCHNK)%LandTypeFrac(1,:nY,1) = cam_in%ocnFrac(:nY) & + + cam_in%iceFrac(:nY) + IF ( .NOT. Input_Opt%ddVel_CLM ) THEN + CALL getLandTypes( cam_in, & + nY, & + State_Met(LCHNK) ) + ENDIF + ELSE + DO N = 1, NSURFTYPE + Write(fldname_ns, '(a,i2.2)') 'HCO_LANDTYPE', N-1 + tmpIdx = pbuf_get_index(fldname_ns, rc) + IF ( tmpIdx < 0 ) THEN + ! there is an error here and the field was not found + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + ELSE + CALL pbuf_get_field(pbuf, tmpIdx, pbuf_ik) + DO J = 1, nY + State_Met(LCHNK)%LandTypeFrac(1,J,N) = pbuf_ik(J,nZ) + ! 2-D data is stored in the 1st level of a + ! 3-D array due to laziness + ENDDO + pbuf_ik => NULL() + ENDIF + + Write(fldname_ns, '(a,i2.2)') 'HCO_XLAI', N-1 + tmpIdx = pbuf_get_index(fldname_ns, rc) + IF ( tmpIdx < 0 ) THEN + ! there is an error here and the field was not found + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + + ELSE + CALL pbuf_get_field(pbuf, tmpIdx, pbuf_ik) + DO J = 1, nY + State_Met(LCHNK)%XLAI_NATIVE(1,J,N) = pbuf_ik(J,nZ) + ! 2-D data is stored in the 1st level of a + ! 3-D array due to laziness + ENDDO + pbuf_ik => NULL() + ENDIF + ENDDO +#endif + + ! Field : FRCLND, FRLAND, FROCEAN, FRSEAICE, FRLAKE, FRLANDIC + ! Description: Olson land fraction + ! Fraction of land + ! Fraction of ocean + ! Fraction of sea ice + ! Fraction of lake + ! Fraction of land ice + ! Fraction of snow + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%FRCLND (1,:ny) = 1.e+0_fp - & + State_Met(LCHNK)%LandTypeFrac(1,:nY,1) ! Olson Land Fraction + State_Met(LCHNK)%FRLAND (1,:nY) = cam_in%landFrac(:nY) + State_Met(LCHNK)%FROCEAN (1,:nY) = cam_in%ocnFrac(:nY) + cam_in%iceFrac(:nY) + State_Met(LCHNK)%FRSEAICE (1,:nY) = cam_in%iceFrac(:nY) + IF ( Input_Opt%onlineLandTypes ) THEN + State_Met(LCHNK)%FRLAKE (1,:nY) = cam_in%lwtgcell(:,3) + & + cam_in%lwtgcell(:,4) + State_Met(LCHNK)%FRLANDIC (1,:nY) = cam_in%lwtgcell(:,2) + State_Met(LCHNK)%FRSNO (1,:nY) = 0.0e+0_fp + ELSE + State_Met(LCHNK)%FRLAKE (1,:nY) = 0.0e+0_fp + State_Met(LCHNK)%FRLANDIC (1,:nY) = 0.0e+0_fp + State_Met(LCHNK)%FRSNO (1,:nY) = 0.0e+0_fp + ENDIF + + ! Field : GWETROOT, GWETTOP + ! Description: Root and top soil moisture + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%GWETROOT (1,:nY) = 0.0e+0_fp + State_Met(LCHNK)%GWETTOP (1,:nY) = 0.0e+0_fp + + ! Field : LAI + ! Description: Leaf area index + ! Unit : m^2/m^2 + ! Dimensions : nX, nY + State_Met(LCHNK)%LAI (1,:nY) = 0.0e+0_fp + + ! Field : PARDR, PARDF + ! Description: Direct and diffuse photosynthetically active radiation + ! Unit : W/m^2 + ! Dimensions : nX, nY + State_Met(LCHNK)%PARDR (1,:nY) = 0.0e+0_fp + State_Met(LCHNK)%PARDF (1,:nY) = 0.0e+0_fp + + ! Field : PBLH + ! Description: PBL height + ! Unit : m + ! Dimensions : nX, nY + State_Met(LCHNK)%PBLH (1,:nY) = PblH(:nY) + + ! Field : PHIS + ! Description: Surface geopotential height + ! Unit : m + ! Dimensions : nX, nY + State_Met(LCHNK)%PHIS (1,:nY) = state%Phis(:nY) + + ! Field : PRECANV, PRECCON, PRECLSC, PRECTOT + ! Description: Anvil precipitation @ ground + ! Convective precipitation @ ground + ! Large-scale precipitation @ ground + ! Total precipitation @ ground + ! Unit : kg/m^2/s + ! Dimensions : nX, nY + State_Met(LCHNK)%PRECANV (1,:nY) = 0.0e+0_fp + State_Met(LCHNK)%PRECCON (1,:nY) = cam_out%Precc(:nY) + State_Met(LCHNK)%PRECLSC (1,:nY) = cam_out%Precl(:nY) + State_Met(LCHNK)%PRECTOT (1,:nY) = cam_out%Precc(:nY) + cam_out%Precl(:nY) + + ! Field : TROPP + ! Description: Tropopause pressure + ! Unit : hPa + ! Dimensions : nX, nY + State_Met(LCHNK)%TROPP (1,:nY) = Trop_P(:nY) + + ! Field : PS1_WET, PS2_WET + ! Description: Wet surface pressure at start and end of timestep + ! Unit : hPa + ! Dimensions : nX, nY + State_Met(LCHNK)%PS1_WET (1,:nY) = state%ps(:nY)*0.01e+0_fp + State_Met(LCHNK)%PS2_WET (1,:nY) = state%ps(:nY)*0.01e+0_fp + + ! Field : SLP + ! Description: Sea level pressure + ! Unit : hPa + ! Dimensions : nX, nY + State_Met(LCHNK)%SLP (1,:nY) = state%ps(:nY)*0.01e+0_fp + + ! Field : TS, TSKIN + ! Description: Surface temperature, surface skin temperature + ! Unit : K + ! Dimensions : nX, nY + State_Met(LCHNK)%TS (1,:nY) = cam_in%TS(:nY) + State_Met(LCHNK)%TSKIN (1,:nY) = cam_in%TS(:nY) + + ! Field : SWGDN + ! Description: Incident radiation @ ground + ! Unit : W/m^2 + ! Dimensions : nX, nY + State_Met(LCHNK)%SWGDN (1,:nY) = fsds(:nY) + + ! Field : SNODP, SNOMAS + ! Description: Snow depth, snow mass + ! Unit : m, kg/m^2 + ! Dimensions : nX, nY + ! Note : Conversion from m to kg/m^2 + ! \rho_{ice} = 916.7 kg/m^3 + State_Met(LCHNK)%SNODP (1,:nY) = snowDepth(:nY) + State_Met(LCHNK)%SNOMAS (1,:nY) = snowDepth(:nY) * 916.7e+0_r8 + + ! Field : SUNCOS, SUNCOSmid + ! Description: COS(solar zenith angle) at current time and midpoint + ! of chemistry timestep + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%SUNCOS (1,:nY) = CSZA(:nY) + State_Met(LCHNK)%SUNCOSmid (1,:nY) = CSZAmid(:nY) + + ! Field : UVALBEDO + ! Description: UV surface albedo + ! Unit : - + ! Dimensions : nX, nY + IF ( Input_Opt%onlineAlbedo ) THEN + State_Met(LCHNK)%UVALBEDO(1,:nY) = cam_in%asdir(:nY) + ELSE + fldname_ns = 'HCO_UV_ALBEDO' + tmpIdx = pbuf_get_index(fldname_ns, RC) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + State_Met(LCHNK)%UVALBEDO(1,:nY) = 0.0e+0_fp + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + State_Met(LCHNK)%UVALBEDO(1,:nY) = pbuf_ik(:nY,nZ) + pbuf_chnk => NULL() + pbuf_ik => NULL() + ENDIF + ENDIF + + ! Field : U10M, V10M + ! Description: E/W and N/S wind speed @ 10m height + ! Unit : m/s + ! Dimensions : nX, nY + State_Met(LCHNK)%U10M (1,:nY) = state%U(:nY,nZ) + State_Met(LCHNK)%V10M (1,:nY) = state%V(:nY,nZ) + + ! Field : USTAR + ! Description: Friction velocity + ! Unit : m/s + ! Dimensions : nX, nY + ! Note : We here combine the land friction velocity (fv) with + ! the ocean friction velocity (ustar) + DO J = 1, nY + State_Met(LCHNK)%USTAR (1,J) = & + cam_in%fv(J) * ( cam_in%landFrac(J)) & + + cam_in%uStar(J) * ( 1.0e+0_fp - cam_in%landFrac(J)) + ENDDO + + ! Field : Z0 + ! Description: Surface roughness length + ! Unit : m + ! Dimensions : nX, nY + State_Met(LCHNK)%Z0 (1,:nY) = Z0(:nY) + + ! Field : IODIDE + ! Description: Surface iodide concentration + ! Unit : nM + ! Dimensions : nX, nY + fldname_ns = 'HCO_iodide' + tmpIdx = pbuf_get_index(fldname_ns, RC) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + State_Chm(LCHNK)%IODIDE(1,:nY) = 0.0e+0_fp + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + State_Chm(LCHNK)%IODIDE(1,:nY) = pbuf_ik(:nY,nZ) + pbuf_chnk => NULL() + pbuf_ik => NULL() + ENDIF + + ! Field : SALINITY + ! Description: Ocean salinity + ! Unit : PSU + ! Dimensions : nX, nY + ! Note : Possibly get ocean salinity from POP? + fldname_ns = 'HCO_salinity' + tmpIdx = pbuf_get_index(fldname_ns, RC) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + State_Chm(LCHNK)%SALINITY(1,:nY) = 0.0e+0_fp + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + State_Chm(LCHNK)%SALINITY(1,:nY) = pbuf_ik(:nY,nZ) + pbuf_chnk => NULL() + pbuf_ik => NULL() + ENDIF + + ! Field : OMOC + ! Description: OM/OC ratio + ! Unit : - + ! Dimensions : nX, nY + IF ( currMo == 12 .or. currMo == 1 .or. currMo == 2 ) THEN + fldname_ns = 'HCO_OMOC_DJF' + ELSE IF ( currMo == 3 .or. currMo == 4 .or. currMo == 5 ) THEN + fldname_ns = 'HCO_OMOC_MAM' + ELSE IF ( currMo == 6 .or. currMo == 7 .or. currMo == 8 ) THEN + fldname_ns = 'HCO_OMOC_JJA' + ELSE IF ( currMo == 9 .or. currMo == 10 .or. currMo == 11 ) THEN + fldname_ns = 'HCO_OMOC_SON' + ENDIF + tmpIdx = pbuf_get_index(fldname_ns, rc) + IF ( tmpIdx < 0 ) THEN + ! there is an error here and the field was not found + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + ELSE + CALL pbuf_get_field(pbuf, tmpIdx, pbuf_ik) + DO J = 1, nY + State_Chm(LCHNK)%OMOC(1,J) = pbuf_ik(J,nZ) + ! 2-D data is stored in the 1st level of a + ! 3-D array due to laziness + ENDDO + pbuf_ik => NULL() + ENDIF + + ! Three-dimensional fields on level edges + DO J = 1, nY + DO L = 1, nZ+1 + ! Field : PEDGE + ! Description: Wet air pressure at (vertical) level edges + ! Unit : hPa + ! Dimensions : nX, nY, nZ+1 + State_Met(LCHNK)%PEDGE (1,J,L) = state%pint(J,nZ+2-L)*0.01e+0_fp + + ! Field : CMFMC + ! Description: Upward moist convective mass flux + ! Unit : kg/m^2/s + ! Dimensions : nX, nY, nZ+1 + State_Met(LCHNK)%CMFMC (1,J,L) = 0.0e+0_fp + + ! Field : PFICU, PFLCU + ! Description: Downward flux of ice/liquid precipitation (convective) + ! Unit : kg/m^2/s + ! Dimensions : nX, nY, nZ+1 + State_Met(LCHNK)%PFICU (1,J,L) = 0.0e+0_fp + State_Met(LCHNK)%PFLCU (1,J,L) = 0.0e+0_fp + + ! Field : PFILSAN, PFLLSAN + ! Description: Downward flux of ice/liquid precipitation (Large-scale & anvil) + ! Unit : kg/m^2/s + ! Dimensions : nX, nY, nZ+1 + State_Met(LCHNK)%PFILSAN (1,J,L) = LsFlxSnw(J,nZ+2-L) ! kg/m2/s + State_Met(LCHNK)%PFLLSAN (1,J,L) = MAX(0.0e+0_fp,LsFlxPrc(J,nZ+2-L) - LsFlxSnw(J,nZ+2-L)) ! kg/m2/s + ENDDO + ENDDO + + DO J = 1, nY + ! Field : CLDTOPS + ! Description: Max cloud top height + ! Unit : level + ! Dimensions : nX, nY + State_Met(LCHNK)%CLDTOPS(1,J) = nZ + 1 - NINT(cldTop(J)) + ENDDO + + ! Three-dimensional fields on level centers + DO J = 1, nY + DO L = 1, nZ + ! Field : U, V + ! Description: E/W and N/S component of wind + ! Unit : m/s + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%U (1,J,L) = state%U(J,nZ+1-L) + State_Met(LCHNK)%V (1,J,L) = state%V(J,nZ+1-L) + + ! Field : OMEGA + ! Description: Updraft velocity + ! Unit : Pa/s + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%OMEGA (1,J,L) = state%Omega(J,nZ+1-L) + + ! Field : CLDF + ! Description: 3-D cloud fraction + ! Unit : - + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%CLDF (1,J,L) = cldFrc(J,nZ+1-L) + + ! Field : DTRAIN + ! Description: Detrainment flux + ! Unit : kg/m^2/s + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%DTRAIN (1,J,L) = 0.0e+0_fp ! Used in convection + + ! Field : DQRCU + ! Description: Convective precipitation production rate + ! Unit : kg/kg dry air/s + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%DQRCU (1,J,L) = 0.0e+0_fp ! Used in convection + + ! Field : DQRLSAN + ! Description: Large-scale precipitation production rate + ! Unit : kg/kg dry air/s + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%DQRLSAN (1,J,L) = PRain(J,nZ+1-L) ! kg/kg/s + + ! Field : QI, QL + ! Description: Cloud ice/water mixing ratio + ! Unit : kg/kg dry air + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%QI (1,J,L) = MAX(1.0e-10_fp, state%q(J,nZ+1-L,ixCldIce)) ! kg ice / kg dry air + State_Met(LCHNK)%QL (1,J,L) = MAX(1.0e-10_fp, state%q(J,nZ+1-L,ixCldLiq)) ! kg water / kg dry air + + ! Field : RH + ! Description: Relative humidity + ! Unit : % + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%RH (1,J,L) = relHum(J,nZ+1-L) * 100.0e+0_fp + + ! Field : TAUCLI, TAUCLW + ! Description: Optical depth of ice/H2O clouds + ! Unit : - + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%TAUCLI (1,J,L) = TauCli(J,nZ+1-L) + State_Met(LCHNK)%TAUCLW (1,J,L) = TauClw(J,nZ+1-L) + + ! Field : REEVAPCN + ! Description: Evaporation of convective precipitation + ! (w/r/t dry air) + ! Unit : kg + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%REEVAPCN (1,J,L) = 0.0e+0_fp + + ! Field : REEVAPLS + ! Description: Evaporation of large-scale + anvil precipitation + ! (w/r/t dry air) + ! Unit : kg/kg/s + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%REEVAPLS (1,J,L) = NEvapr(J,nZ+1-L) ! kg/kg/s + + ! Field : SPHU1, SPHU2 + ! Description: Specific humidity at current and next timestep + ! Unit : g H2O/ kg air + ! Dimensions : nX, nY, nZ + ! Note : Since we are using online meteorology, we do not have + ! access to the data at the next time step + ! Compute tendency in g H2O/kg air/s (tmmf, 1/13/20) ? + State_Met(LCHNK)%SPHU1 (1,J,L) = qH2O(J,nZ+1-L) * 1.0e+3_fp ! g/kg + State_Met(LCHNK)%SPHU2 (1,J,L) = qH2O(J,nZ+1-L) * 1.0e+3_fp ! g/kg + + ! Field : TMPU1, TMPU2 + ! Description: Temperature at current and next timestep + ! Unit : K + ! Dimensions : nX, nY, nZ + ! Note : Since we are using online meteorology, we do not have + ! access to the data at the next time step + ! Compute tendency in K/s (tmmf, 1/13/20) ? + State_Met(LCHNK)%TMPU1 (1,J,L) = state%t(J,nZ+1-L) + State_Met(LCHNK)%TMPU2 (1,J,L) = state%t(J,nZ+1-L) + ENDDO + ENDDO + ! Note: Setting DQRLSAN to zero in the top layer prevents upcoming NaNs + ! in the GEOS-Chem wet deposition routines. Given the altitude, it should + ! be zero anyway, this is just to prevent any numerical artifacts from + ! creeping in. + State_Met(LCHNK)%DQRLSAN (1,:nY,nZ) = 0.0e+00_fp + + ! Field : T + ! Description: Temperature at current time + ! Unit : K + ! Dimensions : nX, nY, nZ + ! Note : Since we are using online meteorology, we do not have + ! access to the data at the next time step + ! Compute tendency in K/s (tmmf, 1/13/20) ? + State_Met(LCHNK)%T = (State_Met(LCHNK)%TMPU1 + State_Met(LCHNK)%TMPU2)*0.5e+0_fp + + ! Field : SPHU + ! Description: Specific humidity at current time + ! Unit : g H2O/ kg air + ! Dimensions : nX, nY, nZ + ! Note : Since we are using online meteorology, we do not have + ! access to the data at the next time step + ! Compute tendency in g H2O/kg air/s (tmmf, 1/13/20) ? + State_Met(LCHNK)%SPHU = (State_Met(LCHNK)%SPHU1 + State_Met(LCHNK)%SPHU2)*0.5e+0_fp + + ! Field : OPTD + ! Description: Total in-cloud optical depth (visible band) + ! Unit : - + ! Dimensions : nX, nY, nZ + State_Met(LCHNK)%OPTD = State_Met(LCHNK)%TAUCLI + State_Met(LCHNK)%TAUCLW + + ! Determine current date and time + CALL Get_Curr_Date( yr = currYr, & + mon = currMo, & + day = currDy, & + tod = currTOD ) + + ! For now, force year to be 2000 + currYr = 2000 + currYMD = (currYr*1000) + (currMo*100) + (currDy) + ! Deal with subdaily + currUTC = REAL(currTOD,f4)/3600.0e+0_f4 + currSc = 0 + currMn = 0 + currHr = 0 + DO WHILE (currTOD > 3600) + currTOD = currTOD - 3600 + currHr = currHr + 1 + ENDDO + DO WHILE (currTOD > 60) + currTOD = currTOD - 60 + currMn = currMn + 1 + ENDDO + currSc = currTOD + currHMS = (currHr*1000) + (currMn*100) + (currSc) + + IF ( firstDay ) THEN + newDay = .True. + newMonth = .True. + firstDay = .False. + ELSE IF ( currHMS < dT ) THEN + newDay = .True. + IF ( currDy == 1 ) THEN + newMonth = .True. + ELSE + newMonth = .False. + ENDIF + ELSE + newDay = .False. + newMonth = .False. + ENDIF + + ! Pass time values obtained from the ESMF environment to GEOS-Chem + CALL Accept_External_Date_Time( value_NYMD = currYMD, & + value_NHMS = currHMS, & + value_YEAR = currYr, & + value_MONTH = currMo, & + value_DAY = currDy, & + value_DAYOFYR = INT(FLOOR(Calday)), & + value_HOUR = currHr, & + value_MINUTE = currMn, & + value_HELAPSED = 0.0e+0_f4, & + value_UTC = currUTC, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Failed to update time in GEOS-Chem!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Accept_External_PEdge( State_Met = State_Met(LCHNK), & + State_Grid = State_Grid(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Failed to update pressure edges!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Field : PS1_DRY, PS2_DRY + ! Description: Dry surface pressure at current and next timestep + ! Unit : hPa + ! Dimensions : nX, nY, nZ+1 + ! Note : 1. Use the CAM PSDry fields instead of using the + ! GEOS-Chem calculation + ! 2. As we are using online meteorology, we do not + ! have access to the fields at the next time step + ! Compute Pa/s tendency? (tmmf, 1/13/20) + State_Met(LCHNK)%PS1_DRY (1,:nY) = state%PSDry(:nY) * 0.01e+0_fp + State_Met(LCHNK)%PS2_DRY (1,:nY) = state%PSDry(:nY) * 0.01e+0_fp + + ! Field : PSC2_WET, PSC2_DRY + ! Description: Interpolated wet and dry surface pressure at the + ! current time + ! Unit : hPa + ! Dimensions : nX, nY, nZ+1 + ! Note : As we are using online meteorology, we do not + ! have access to the fields at the next time step + ! Compute Pa/s tendency? (tmmf, 1/13/20) + State_Met(LCHNK)%PSC2_WET = State_Met(LCHNK)%PS1_WET + State_Met(LCHNK)%PSC2_DRY = State_Met(LCHNK)%PS1_DRY + + CALL Set_Floating_Pressures( State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Failed to set floating pressures!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Set quantities of interest but do not change VMRs + ! This function updates: + ! ==================================================================== + ! (1) PEDGE : Moist air pressure at grid box bottom [hPa] + ! (2) PEDGE_DRY : Dry air partial pressure at box bottom [hPa] + ! (3) PMID : Moist air pressure at grid box centroid [hPa] + ! (4) PMID_DRY : Dry air partial pressure at box centroid [hPa] + ! (5) PMEAN : Altitude-weighted mean moist air pressure [hPa] + ! (6) PMEAN_DRY : Alt-weighted mean dry air partial pressure [hPa] + ! (7) DELP : Delta-P extent of grid box [hPa] + ! (Same for both moist and dry air since we + ! assume constant water vapor pressure + ! across box) + ! (8) AIRDEN : Mean grid box dry air density [kg/m^3] + ! (defined as total dry air mass/box vol) + ! (9) AIRNUMDEN : Mean grid box dry air number density [molec/m^3] + ! (10) MAIRDEN : Mean grid box moist air density [kg/m^3] + ! (defined as total moist air mass/box vol) + ! (11) AD : Total dry air mass in grid box [kg] + ! (12) ADMOIST : Total moist air mass in grid box [kg] + ! (13) BXHEIGHT : Vertical height of grid box [m] + ! (14) AIRVOL : Volume of grid box [m^3] + ! (15) MOISTMW : Molecular weight of moist air in box [g/mol] + ! (16) IsLand : Logical for grid cells over land [-] + ! (17) IsWater : Logical for grid cells over water [-] + ! (18) IsIce : Logical for grid cells over ice [-] + ! (19) IsSnow : Logical for grid cells over snow [-] + ! (20) InTroposph: Logical for tropospheric grid cells [-] + ! (21) InStratMes: Logical for non-tropospheric grid cells [-] + ! (22) InStratosp: Logical for stratospheric grid cells [-] + ! (23) InChemGrid: Logical for chemistry grid cells [-] + ! (24) LocalSolar: Local solar time [-] + ! (25) IsLocalNoo: Logical for local noon [-] + ! (26) TropLev : Maximum tropopause level [-] + ! (27) TropHt : Maximum tropopause height [km] + ! ==================================================================== + CALL AirQnt( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC, & + Update_Mixing_Ratio = .False. ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Failed to calculate air properties!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! SDE 05/28/13: Set H2O to State_Chm tracer if relevant and, + ! if LUCX=T and LSETH2O=F and LACTIVEH2O=T, update specific humidity + ! in the stratosphere + ! + ! NOTE: Specific humidity may change in SET_H2O_TRAC and + ! therefore this routine may call AIRQNT again to update + ! air quantities and tracer concentrations (ewl, 10/28/15) + IF ( Input_Opt%Its_A_Fullchem_Sim .and. iH2O > 0 ) THEN + CALL Set_H2O_Trac( SETSTRAT = ( ( .not. Input_Opt%LUCX ) & + .or. Input_Opt%LSETH2O ), & + Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Set_H2O_Trac" #1!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Only force strat once if using UCX + IF (Input_Opt%LSETH2O) Input_Opt%LSETH2O = .FALSE. + ENDIF + + ! Do this after AirQnt, such that we overwrite GEOS-Chem isLand, isWater and + ! isIce, which are based on albedo. Rather, we use CLM landFranc, ocnFrac + ! and iceFrac. We also compute isSnow + DO J = 1, nY + iMaxLoc = MAXLOC( (/ State_Met(LCHNK)%FRLAND(1,J) + & + State_Met(LCHNK)%FRLANDIC(1,J) + & + State_Met(LCHNK)%FRLAKE(1,J), & + State_Met(LCHNK)%FRSEAICE(1,J), & + State_Met(LCHNK)%FROCEAN(1,J) - & + State_Met(LCHNK)%FRSEAICE(1,J) /) ) + IF ( iMaxLoc(1) == 3 ) iMaxLoc(1) = 0 + ! reset ocean to 0 + + ! Field : LWI + ! Description: Land/water indices + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%LWI(1,J) = FLOAT( iMaxLoc(1) ) + + IF ( iMaxLoc(1) == 0 ) THEN + State_Met(LCHNK)%isLand(1,J) = .False. + State_Met(LCHNK)%isWater(1,J) = .True. + State_Met(LCHNK)%isIce(1,J) = .False. + ELSEIF ( iMaxLoc(1) == 1 ) THEN + State_Met(LCHNK)%isLand(1,J) = .True. + State_Met(LCHNK)%isWater(1,J) = .False. + State_Met(LCHNK)%isIce(1,J) = .False. + ELSEIF ( iMaxLoc(1) == 2 ) THEN + State_Met(LCHNK)%isLand(1,J) = .False. + State_Met(LCHNK)%isWater(1,J) = .False. + State_Met(LCHNK)%isIce(1,J) = .True. + ELSE + Write(iulog,*) " iMaxLoc gets value: ", iMaxLoc + ErrMsg = 'Failed to figure out land/water' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + State_Met(LCHNK)%isSnow(1,J) = ( State_Met(LCHNK)%FRSEAICE(1,J) > 0.0e+0_fp & + .or. State_Met(LCHNK)%SNODP(1,J) > 0.01 ) + + ENDDO + + ! Do this after AirQnt in order to use AIRDEN and BXHEIGHT + DO J = 1, nY + O3col(J) = 0.0e+0_fp + DO L = 1, nZ + O3col(J) = O3col(J) & + + State_Chm(LCHNK)%Species(1,J,L,iO3) & + * State_Met(LCHNK)%AIRDEN(1,J,L) & + * State_Met(LCHNK)%BXHEIGHT(1,J,L) + ENDDO + O3col(J) = O3col(J) * ( AVO / MWO3 ) / 1e+1_fp / 2.69e+16_fp + ENDDO + + ! Field : TO3 + ! Description: Total overhead ozone column + ! Unit : DU + ! Dimensions : nX, nY + State_Met(LCHNK)%TO3 (1,:nY) = O3col(:nY) + + IF ( Input_Opt%LSCHEM .AND. & + State_Grid(LCHNK)%MaxChemLev /= State_Grid(LCHNK)%nZ ) THEN + IF ( iStep == 1 ) THEN + ALLOCATE( BrPtrDay ( 6 ), STAT=IERR ) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating BrPtrDay') + ALLOCATE( BrPtrNight( 6 ), STAT=IERR ) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating BrPtrNight') + DO N = 1, 6 + ! Skip if species is not defined + IF ( GC_Bry_TrID(N) <= 0 ) CYCLE + + ! Get Bry name + SpcName = State_Chm(LCHNK)%SpcData(GC_Bry_TrID(N))%Info%Name + + ! Construct field name using Bry name + PREFIX = 'GEOSCCM_'//TRIM(SpcName) + + ALLOCATE( BrPtrDay(N)%MR(1,PCOLS,nZ), STAT=IERR ) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating BrPtrDay%MR') + ALLOCATE( BrPtrNight(N)%MR(1,PCOLS,nZ), STAT=IERR ) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating BrPtrNight%MR') + + ! Get pointer to this field. These are the mixing ratios (pptv). + + ! Day + FIELDNAME = TRIM(PREFIX) // '_DAY' + fldname_ns = FIELDNAME + tmpIdx = pbuf_get_index(fldname_ns, RC) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + BrPtrDay(N)%MR(1,:nY,nZ:1:-1) = 0.0e+0_f4 + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + BrPtrDay(N)%MR(1,:nY,nZ:1:-1) = REAL(pbuf_ik(:nY,:nZ), f4) + pbuf_chnk => NULL() + pbuf_ik => NULL() + ENDIF + !CALL HCO_GetPtr( HcoState, FIELDNAME, BrPtrDay(N)%MR, RC ) + + ! Night + FIELDNAME = TRIM(PREFIX) // '_NIGHT' + tmpIdx = pbuf_get_index(fldname_ns, RC) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + BrPtrDay(N)%MR(1,:nY,nZ:1:-1) = 0.0e+0_f4 + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + BrPtrNight(N)%MR(1,:nY,nZ:1:-1) = REAL(pbuf_ik(:nY,:nZ), f4) + pbuf_chnk => NULL() + pbuf_ik => NULL() + ENDIF + !CALL HCO_GetPtr( HcoState, FIELDNAME, BrPtrNight(N)%MR, RC ) + + ENDDO + + DO N = 1,NSCHEM + + ! Get GEOS-Chem species index + M = Strat_TrID_GC(N) + + ! Skip if species is not defined + IF ( M <= 0 ) CYCLE + + ! Get species name + SpcName = State_Chm(LCHNK)%SpcData(M)%Info%Name + + ! --------------------------------------------------------------- + ! Get pointers to fields + ! --------------------------------------------------------------- + + ! Production rates [v/v/s] + IF ( Input_Opt%LUCX ) THEN + FIELDNAME = 'GMI_PROD_'//TRIM(SpcName) + ELSE + FIELDNAME = 'UCX_PROD_'//TRIM(SpcName) + ENDIF + + ALLOCATE( PLVEC(N)%PROD(1,PCOLS,nZ), STAT=IERR ) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating PLVEC%PROD') + ALLOCATE( PLVEC(N)%LOSS(1,PCOLS,nZ), STAT=IERR ) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating PLVEC%PROD') + + ! Get pointer from HEMCO + tmpIdx = pbuf_get_index(fldname_ns, RC) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + PLVEC(N)%PROD(1,:nY,nZ:1:-1) = 0.0e+0_f4 + FND = .False. + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + PLVEC(N)%PROD(1,:nY,nZ:1:-1) = REAL(pbuf_ik(:nY,:nZ),f4) + FND = .True. + pbuf_chnk => NULL() + pbuf_ik => NULL() + ENDIF + !CALL HCO_GetPtr( HcoState, FIELDNAME, PLVEC(N)%PROD, RC, FOUND=FND ) + + ! Warning message + IF ( .NOT. FND .AND. Input_Opt%amIRoot ) THEN + ErrMsg = 'Cannot find archived production rates for ' // & + TRIM(SpcName) // ' - will use value of 0.0. ' // & + 'To use archived rates, add the following field ' // & + 'to the HEMCO configuration file: '// TRIM( FIELDNAME ) + CALL GC_Warning( ErrMsg, RC, ThisLoc ) + ENDIF + + ! Loss frequency [s-1] + IF ( Input_Opt%LUCX ) THEN + FIELDNAME = 'GMI_LOSS_'//TRIM(SpcName) + ELSE + FIELDNAME = 'UCX_LOSS_'//TRIM(SpcName) + ENDIF + + ! Get pointer from HEMCO + tmpIdx = pbuf_get_index(fldname_ns, RC) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + PLVEC(N)%LOSS(1,:nY,nZ:1:-1) = 0.0e+0_f4 + FND = .False. + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + PLVEC(N)%LOSS(1,:nY,nZ:1:-1) = REAL(pbuf_ik(:nY,:nZ), f4) + FND = .True. + pbuf_chnk => NULL() + pbuf_ik => NULL() + ENDIF + !CALL HCO_GetPtr( HcoState, FIELDNAME, PLVEC(N)%LOSS, RC, FOUND=FND ) + + ! Warning message + IF ( .NOT. FND .AND. Input_Opt%amIRoot ) THEN + ErrMsg= 'Cannot find archived loss frequencies for ' // & + TRIM(SpcName) // ' - will use value of 0.0. ' // & + 'To use archived rates, add the following field ' // & + 'to the HEMCO configuration file: '//TRIM(FIELDNAME) + CALL GC_Warning( ErrMsg, RC, ThisLoc ) + ENDIF + + ENDDO !N + + ! Get pointer to STRAT_OH + + ALLOCATE( STRAT_OH(1,PCOLS,nZ), STAT=IERR ) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating STRAT_OH') + + tmpIdx = pbuf_get_index(fldname_ns, RC) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + STRAT_OH(1,:nY,nZ:1:-1) = 0.0e+0_f4 + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + STRAT_OH(1,:nY,nZ:1:-1) = REAL(pbuf_ik(:nY,:nZ), f4) + pbuf_chnk => NULL() + pbuf_ik => NULL() + ENDIF + !CALL HCO_GetPtr( HcoState, 'STRAT_OH', STRAT_OH, RC, FOUND=FND ) + ENDIF + + ENDIF + + ! This is not necessary as we prescribe CH4 surface mixing ratios + ! through CAM. + !! Prescribe methane surface concentrations throughout PBL + !IF ( ITS_A_FULLCHEM_SIM .and. id_CH4 > 0 ) THEN + ! + ! ! Set CH4 concentrations + ! CALL SET_CH4( Input_Opt = Input_Opt, & + ! State_Chm = State_Chm(LCHNK), & + ! State_Diag = State_Diag(LCHNK), & + ! State_Grid = State_Grid(LCHNK), & + ! State_Met = State_Met(LCHNK), & + ! RC = RC ) + ! + ! ! Trap potential errors + ! IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Error encountered in call to "SET_CH4"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + ! ENDIF + !ENDIF + + ! Eventually initialize/reset wetdep + IF ( Input_Opt%LConv .OR. Input_Opt%LChem .OR. Input_Opt%LWetD ) THEN + CALL Setup_WetScav( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Setup_WetScav"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + !============================================================== + ! ***** C O M P U T E P B L H E I G H T etc. ***** + !============================================================== + ! Move this call from the PBL mixing routines because the PBL + ! height is used by drydep and some of the emissions routines. + ! (ckeller, 3/5/15) + ! This function updates: + ! ==================================================================== + ! (1) InPbl : Logical indicating if we are in the PBL [-] + ! (2) PBL_TOP_L : Number of layers in the PBL [-] + ! (3) PBL_TOP_hPa: Pressure at the top of the PBL [hPa] + ! (4) PBL_TOP_m : PBL height [m] + ! (5) PBL_THICK : PBL thickness [hPa] + ! (6) F_OF_PBL : Fraction of grid box within the PBL [-] + ! (7) F_UNDER_PBLTOP: Fraction of grid box underneath the PBL top [-] + ! (8) PBL_MAX_L : Model level where PBL top occurs [-] + ! ==================================================================== + CALL Compute_PBL_Height( Input_Opt = Input_Opt, & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Compute_PBL_Height"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + !-------------------------------------------------------------- + ! Test for emission timestep + ! Now always do emissions here, even for full-mixing + ! (ckeller, 3/5/15) + !-------------------------------------------------------------- + !================================================================== + ! ***** D R Y D E P O S I T I O N ***** + !================================================================== + !================================================================== + ! Compute dry deposition velocities + ! + ! CLM computes dry deposition velocities over land. + ! We need to merge the land component passed through cam_in and + ! the ocn/ice dry deposition velocities. + ! + ! If using the CLM velocities, then use GEOS-Chem's dry deposition + ! module to compute velocities and then scale them with the ocean + ! fraction (Input_Opt%ddVel_CLM) + ! + ! A second option would be to let GEOS-Chem compute dry deposition + ! velocity, thus overwriting the input from CLM + ! + ! drydep_method must be set to DD_XLND. + ! + ! The GEOS-Chem option (.not. Input_Opt%ddVel_CLM) option coupled + ! with Input_Opt%onlineLandTypes requires that CLM passes land + ! type information (land type and leaf area index). + !================================================================== + ! + ! State_Chm expects dry deposition velocities in m/s, whereas + ! CLM returns land deposition velocities in cm/s! + ! + ! For now, dry deposition velocities are only computed for gases + ! (which is what CLM deals with). Dry deposition for aerosols is + ! work in progress. + ! + ! Thibaud M. Fritz - 27 Feb 2020 + !================================================================== + + IF ( Input_Opt%LDryD ) THEN + ! Compute the Olson landmap fields of State_Met + ! (e.g. State_Met%IREG, State_Met%ILAND, etc.) + CALL Compute_Olson_Landmap( Input_Opt = Input_Opt, & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Compute_Olson_Landmap"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Compute State_Met%XLAI (for drydep) and State_Met%MODISLAI, + ! which is the average LAI per grid box (for soil NOx emissions) + CALL Compute_Xlai( Input_Opt = Input_Opt, & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Compute_Xlai"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ! Compute drydep velocities and update State_Chm%DryDepVel + CALL Do_Drydep( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Do_Drydep"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + +#if ( OCNDDVEL_GEOSCHEM ) + + DO N = 1, nddvels + + !! Print debug + !IF ( rootChunk ) THEN + ! IF ( N == 1 ) THEN + ! Write(iulog,*) "Number of GC dry deposition species = ", & + ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) + ! Write(iulog,*) "Number of CESM dry deposition species = ", & + ! nddvels + ! ENDIF + ! Write(iulog,*) "N = ", N + ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) + ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) + ! IF ( map2GC_dryDep(N) > 0 ) THEN + ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) + ! ENDIF + ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) + ! IF ( drySpc_ndx(N) > 0 ) THEN + ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) + ! ENDIF + ! Write(iulog,*) "CLM-depVel = ", & + ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]" + ! IF ( map2GC_dryDep(N) > 0 ) THEN + ! Write(iulog,*) "GC-depVel = ", & + ! MAXVAL(State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N))), " [m/s]" + ! ENDIF + !ENDIF + + IF ( map2GC_dryDep(N) > 0 ) THEN + ! State_Chm%DryDepVel is in m/s + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & + ! This first bit corresponds to the dry deposition + ! velocities over land as computed from CLM and + ! converted to m/s. This is scaled by the fraction + ! of land. + cam_in%depVel(:nY,N) * 1.0e-02_fp & + * MAX(0._fp, 1.0_fp - State_Met(LCHNK)%FROCEAN(1,:nY)) & + ! This second bit corresponds to the dry deposition + ! velocities over ocean and sea ice as computed from + ! GEOS-Chem. This is scaled by the fraction of ocean + ! and sea ice. + + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) & + * State_Met(LCHNK)%FROCEAN(1,:nY) + ENDIF + ENDDO + +#endif + +#elif ( OCNDDVEL_MOZART ) + ! This routine updates the deposition velocities from CLM in the + ! pointer lnd(LCHNK)%dvel as long as drydep_method == DD_XLND is + ! True. + CALL drydep_update( State, cam_in ) + + windSpeed(:nY) = SQRT( state%U(:nY,nZ)*state%U(:nY,nZ) + & + state%V(:nY,nZ)*state%V(:nY,nZ) ) + potT(:nY) = state%t(:nY,nZ) * (1._fp + qH2O(:nY,nZ)) + + CALL get_lat_all_p( LCHNK, nY, latndx ) + CALL get_lon_all_p( LCHNK, nY, lonndx ) + + CALL drydep_fromlnd( ocnfrac = cam_in%ocnfrac(:), & + icefrac = cam_in%icefrac(:), & + ncdate = currYMD, & + sfc_temp = cam_in%TS(:), & + pressure_sfc = state%PS(:), & + wind_speed = windSpeed(:), & + spec_hum = qH2O(:,nZ), & + air_temp = state%t(:,nZ), & + pressure_10m = state%pmid(:,nZ), & + rain = State_Met(LCHNK)%PRECTOT(1,:), & + snow = cam_in%Snowhland(:), & + solar_flux = State_Met(LCHNK)%SWGDN(1,:), & + dvelocity = MOZART_depVel(:,:), & + dflx = MOZART_depFlx(:,:), & + State_Chm = State_Chm(LCHNK), & + tv = potT(:), & + soilw = -99._fp, & + rh = relHum(:,nZ), & + ncol = nY, & + lonndx = lonndx(:), & + latndx = latndx(:), & + lchnk = LCHNK ) + + DO N = 1, nddvels + + !! Print debug + !IF ( rootChunk ) THEN + ! IF ( N == 1 ) THEN + ! Write(iulog,*) "Number of GC dry deposition species = ", & + ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) + ! Write(iulog,*) "Number of CESM dry deposition species = ", & + ! nddvels + ! ENDIF + ! Write(iulog,*) "N = ", N + ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) + ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) + ! IF ( map2GC_dryDep(N) > 0 ) THEN + ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) + ! ENDIF + ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) + ! IF ( drySpc_ndx(N) > 0 ) THEN + ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) + ! ENDIF + ! Write(iulog,*) "CLM-depVel = ", & + ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]", LCHNK + ! IF ( drySpc_ndx(N) > 0 ) THEN + ! Write(iulog,*) "Merged depVel = ", & + ! MAXVAL(MOZART_depVel(:nY,drySpc_ndx(N))) * 1.0e-02_fp, " [m/s]", LCHNK + ! ENDIF + !ENDIF + + IF ( ( map2GC_dryDep(N) > 0 ) .AND. ( drySpc_ndx(N) > 0 ) ) THEN + ! State_Chm%DryDepVel is in m/s + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & + MOZART_depVel(:nY,drySpc_ndx(N)) * 1.0e-02_fp + ENDIF + + ENDDO + + !TMMF, Here set dry deposition velocities to zero if MAM performs its + !own deposition... + + CALL Update_DryDepFreq( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ENDIF + + !!=========================================================== + !! ***** E M I S S I O N S ***** + !! + !! NOTE: For a complete description of how emissions from + !! HEMCO are added into GEOS-Chem (and how they are mixed + !! into the boundary layer), please see the wiki page: + !! + !! http://wiki-geos-chem.org/Distributing_emissions_in_the_PBL + !!=========================================================== + ! + !! EMISSIONS_RUN will call HEMCO run phase 2. HEMCO run phase + !! only calculates emissions. All data has been read to disk + !! in phase 1 at the beginning of the time step. + !! (ckeller, 4/1/15) + !CALL Emissions_Run( Input_Opt = Input_Opt, & + ! State_Chm = State_Chmk(LCHNK), & + ! State_Diag = State_Diag(LCHNK), & + ! State_Grid = State_Grid(LCHNK), & + ! State_Met = State_Met(LCHNK), & + ! TimeForEmis = TimeForEmis, & + ! Phase = 2, & + ! RC = RC ) + ! + !! Trap potential errors + !IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = + ! 'Error encountered in "Emissions_Run"! after drydep!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + !ENDIF + + !=========================================================== + ! ***** M I X E D L A Y E R M I X I N G ***** + !=========================================================== + + ! Updates from Bob Yantosca, 06/2020 + ! Compute the surface flux for the non-local mixing, + ! (which means getting emissions & drydep from HEMCO) + ! and store it in State_Chm%Surface_Flux + ! + ! For CESM-GC, Surface_Flux will be equal to the opposite of the + ! dry deposition flux since emissions are loaded externally + ! ( SurfaceFlux = eflx - dflx = - dflx ) + IF ( Input_Opt%LTURB .and. Input_Opt%LNLPBL ) THEN + CALL Compute_Sflx_For_Vdiff( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Compute_Sflx_for_Vdiff"!' + CALL Error_Stop( errMsg, thisLoc ) + ENDIF + ENDIF + + !----------------------------------------------------------------------- + ! Get emissions from HEMCO + Lightning + Fire + ! Add surface emissions to cam_in + !----------------------------------------------------------------------- + + CALL CESMGC_Emissions_Calc( state = state, & + hco_pbuf2d = hco_pbuf2d, & + State_Met = State_Met(LCHNK), & + cam_in = cam_in, & + eflx = eflx, & + iStep = iStep ) + + !----------------------------------------------------------------------- + ! Add dry deposition flux + ! (stored as SurfaceFlux = -dflx) + !----------------------------------------------------------------------- + + DO ND = 1, State_Chm(BEGCHUNK)%nDryDep + ! Get the species ID from the drydep ID + N = State_Chm(BEGCHUNK)%Map_DryDep(ND) + IF ( N <= 0 ) CYCLE + + M = map2GCinv(N) + IF ( M <= 0 ) CYCLE + + cam_in%cflx(1:nY,M) = cam_in%cflx(1:nY,M) & + + State_Chm(LCHNK)%SurfaceFlux(1,1:nY,N) + ENDDO + + !----------------------------------------------------------------------- + ! Add non-surface emissions + !----------------------------------------------------------------------- + + ! Use units of kg/m2 as State_Chm%Species to add emissions fluxes + CALL Convert_Spc_Units( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + OutUnit = 'kg/m2', & + RC = RC, & + OrigUnit = OrigUnit ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Convert_Spc_Units"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + DO N = 1, pcnst + M = map2GC(N) + IF ( M > 0 ) THEN + ! Add to GEOS-Chem species + State_Chm(LCHNK)%Species(1,:nY,:nZ,M) = State_Chm(LCHNK)%Species(1,:nY,:nZ,M) & + + eflx(:nY,nZ:1:-1,N) * dT + ELSEIF ( M < 0 ) THEN + ! Add to constituent (mostly for MAM4 aerosols) + ! Convert from kg/m2/s to kg/kg/s + ptend%q(:nY,nZ:1:-1,N) = ptend%q(:nY,nZ:1:-1,N) & + + eflx(:nY,nZ:1:-1,N) & + / ( g0_100 * State_Met(LCHNK)%DELP_DRY(1,:nY,:nZ) ) + ENDIF + ENDDO + + ! Convert back to original unit + CALL Convert_Spc_Units( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + OutUnit = OrigUnit, & + RC = RC ) + + ! Convert State_Chm%Species back to original units + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Convert_Spc_Units"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + !============================================================== + ! ***** C H E M I S T R Y ***** + !============================================================== + + call t_startf( 'chemdr' ) + + ! Get the overhead column O3 for use with FAST-J + IF ( Input_Opt%Its_A_FullChem_Sim .OR. & + Input_Opt%Its_An_Aerosol_Sim ) THEN + + IF ( Input_Opt%LChem ) THEN + CALL Compute_Overhead_O3( Input_Opt = Input_Opt, & + State_Grid = State_Grid(LCHNK), & + State_Chm = State_Chm(LCHNK), & + DAY = currDy, & + USE_O3_FROM_MET = Input_Opt%Use_O3_From_Met, & + TO3 = State_Met(LCHNK)%TO3, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Compute_Overhead_O3"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + ENDIF + + IF ( Input_Opt%Its_A_Fullchem_Sim .and. iH2O > 0 ) THEN + CALL Set_H2O_Trac( SETSTRAT = (.not. Input_Opt%LUCX), & + Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + ! Trap potential errors + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Set_H2O_Trac" #2!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF + + ! Reset photolysis rates + ZPJ = 0.0e+0_r8 + + ! Perform chemistry + CALL Do_Chemistry( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Do_Chemistry"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + + ! Make sure State_Chm(LCHNK) is back in kg/kg dry! + IF ( TRIM(State_Chm(LCHNK)%Spc_Units) /= 'kg/kg dry' ) THEN + Write(iulog,*) 'Current unit = ', TRIM(State_Chm(LCHNK)%Spc_Units) + Write(iulog,*) 'Expected unit = kg/ kg dry' + CALL ENDRUN('Incorrect unit in GEOS-Chem State_Chm%Species') + ENDIF + + ! GEOS-Chem considers CO2 as a dead species and resets its concentration + ! internally. Right after the call to `Do_Chemistry`, State_Chm%Species(iCO2) + ! corresponds to the chemically-produced CO2. The real CO2 concentration + ! is thus the concentration before chemistry + the chemically-produced CO2. + State_Chm(LCHNK)%Species(1,:nY,:nZ,iCO2) = State_Chm(LCHNK)%Species(1,:nY,:nZ,iCO2) & + + MMR_Beg(:nY,:nZ,iCO2) + + call t_stopf( 'chemdr' ) + + !============================================================== + ! ***** W E T D E P O S I T I O N (rainout + washout) ***** + !============================================================== + IF ( Input_Opt%LWetD ) THEN + + IF ( gas_wetdep_method == 'NEU' ) THEN + CALL Neu_wetdep_tend( LCHNK = LCHNK, & + NCOL = NCOL, & + mmr = state%q, & + pmid = state%pmid, & + pdel = state%pdel, & + zint = state%zi, & + tfld = state%t, & + delt = dT, & + prain = PRain, & + nevapr = NEvapr, & + cld = cldFrc, & + cmfdqr = cmfdqr, & + wd_tend = ptend%q, & + wd_tend_int = wetdepflx ) + ELSE + ErrMsg = 'Unknown gas_wetdep_method '//TRIM(gas_wetdep_method) + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ENDIF + + DO N = 1, gas_pcnst + ! See definition of map2chm + M = map2chm(N) + IF ( M > 0 ) THEN + vmr1(:nY,:nZ,N) = State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,M) * & + MWDry / adv_mass(N) + ELSEIF ( M < 0 ) THEN + vmr1(:nY,:nZ,N) = state%q(:nY,:nZ,-M) * & + MWDry / adv_mass(N) + ENDIF + ENDDO + + !============================================================== + ! ***** M A M G A S - A E R O S O L E X C H A N G E ***** + !============================================================== + +#if defined( MODAL_AERO ) + + del_h2so4_gasprod = 0.0e+00_fp + ! This needs to be in mol/mol over this timestep + IF ( ( iPSO4 > 0 ) .and. ( MWPSO4 > 0.0e+00_fp ) ) THEN + DO L = 1, nZ + ! Convert from kg SO4/kg to mol/mol + del_h2so4_gasprod(:nY,L) = & + State_Chm(LCHNK)%Species(1,:nY,nZ+1-L,iPSO4) * MWDry / MWPSO4 + ENDDO + ENDIF + + call aero_model_gasaerexch( loffset = iFirstCnst - 1, & + ncol = NCOL, & + lchnk = LCHNK, & + troplev = Trop_Lev(:), & + delt = dT, & + reaction_rates = reaction_rates, & + tfld = state%t(:,:), & + pmid = state%pmid(:,:), & + pdel = state%pdel(:,:), & + mbar = mBar, & + relhum = relHum(:,:), & + zm = state%zm(:,:), & + qh2o = qH2O(:,:), & + cwat = cldW, & + cldfr = cldFrc, & + cldnum = nCldWtr, & + airdens = invariants(:,:,indexm), & + invariants = invariants, & + del_h2so4_gasprod = del_h2so4_gasprod, & + vmr0 = vmr0, & + vmr = vmr1, & + pbuf = pbuf ) +#endif + + ! Set boundary conditions of long-lived species (most likely + ! CH4, OCS, N2O, CFC11, CFC12). + ! Note: This will overwrite the UCX boundary conditions + + CALL flbc_set( vmr1(:nY,:nZ,:), nY, LCHNK, mapCnst ) + + IF ( ghg_chem ) THEN + CALL ghg_chem_set_flbc( vmr1, nY ) + ENDIF + + DO N = 1, gas_pcnst + ! See definition of map2chm + M = map2chm(N) + IF ( M <= 0 ) CYCLE + State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,M) = vmr1(:nY,:nZ,N) * & + adv_mass(N) / MWDry + ENDDO + + ! Make sure State_Chm(LCHNK) is back in kg/kg dry! + IF ( TRIM(State_Chm(LCHNK)%Spc_Units) /= 'kg/kg dry' ) THEN + Write(iulog,*) 'Current unit = ', TRIM(State_Chm(LCHNK)%Spc_Units) + Write(iulog,*) 'Expected unit = kg/ kg dry' + CALL ENDRUN('Incorrect unit in GEOS-Chem State_Chm%Species') + ENDIF + + ! Reset H2O MMR to the initial value (no chemistry tendency in H2O just yet) + State_Chm(LCHNK)%Species(1,:,:,iH2O) = MMR_Beg(:,:,iH2O) + + ! Store unadvected species data + SlsData = 0.0e+0_r8 + DO N = 1, nSls + M = map2GC_Sls(N) + IF ( M <= 0 ) CYCLE + SlsData(:nY,nZ:1:-1,N) = REAL(State_Chm(LCHNK)%Species(1,:nY,:nZ,M),r8) + ENDDO + CALL set_short_lived_species( SlsData, LCHNK, nY, pbuf ) + + DO N = 1, pcnst + M = map2GC(N) + IF ( M <= 0 ) CYCLE + ! Add change in mass mixing ratio to tendencies. + ! For NEU wet deposition, the wet removal rates are added to + ! ptend. + MMR_End(:nY,:nZ,M) = REAL(State_Chm(LCHNK)%Species(1,:nY,:nZ,M),r8) + ptend%q(:nY,nZ:1:-1,N) = ptend%q(:nY,nZ:1:-1,N) & + + (MMR_End(:nY,:nZ,M)-MMR_Beg(:nY,:nZ,M))/dT + ENDDO + +#if defined( MODAL_AERO_4MODE ) + ! Here apply tendencies to MAM aerosols + ! Initial mass in bin SM is stored as state%q(N) + ! Final mass in bin SM is stored as binRatio(SM,M) * State_Chm(P) + ! + ! We decide to apply chemical tendencies to all MAM aerosols, + ! except so4, for which the chemically-produced sulfate gets + ! partitioned in aero_model_gasaerexch + DO M = 1, ntot_amode + DO SM = 1, nspec_amode(M) + P = map2MAM4(SM,M) + IF ( P <= 0 .OR. to_upper(xname_massptr(SM,M)(:3)) == 'SO4' ) CYCLE + N = lmassptr_amode(SM,M) + ! Apply MAM4 chemical tendencies owing to GEOS-Chem aerosol processing + ptend%q(:nY,:nZ,N) = ptend%q(:nY,:nZ,N) & + + (binRatio(SM,M,:nY,:nZ) * & + REAL(State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,P),r8) & + - state%q(:nY,:nZ,N))/dT + ENDDO + ENDDO +#endif + + DO N = 1, gas_pcnst + ! See definition of map2chm + M = map2chm(N) + IF ( M > 0 ) THEN + mmr_tend(:nY,:nZ,N) = ( REAL(State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,M),r8) - mmr_tend(:nY,:nZ,N) ) / dT + ELSEIF ( M < 0 ) THEN + mmr_tend(:nY,:nZ,N) = ptend%q(:nY,:nZ,-M) + ENDIF + ENDDO + + IF ( Input_Opt%applyQtend ) THEN + ! Apply GEOS-Chem's H2O mixing ratio tendency to CAM's specific humidity + ! This requires to set lq(cQ) = lq(cH2O) ( = .True. ) + ptend%q(:,:,cQ) = ptend%q(:,:,cH2O) + ENDIF + + CALL CESMGC_Diag_Calc( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + cam_in = cam_in, & + state = state, & + mmr_tend = mmr_tend, & + LCHNK = LCHNK ) + + IF ( ghg_chem ) THEN + ptend%lq(1) = .True. + CALL outfld( 'CT_H2O_GHG', ptend%q(:,:,1), PCOLS, LCHNK ) + ENDIF + + ! Debug statements + ! Ozone tendencies + IF ( rootChunk ) THEN + Write(iulog,*) " MMR_Beg = ", MMR_Beg(1,:,iO3) + Write(iulog,*) " MMR_End = ", MMR_End(1,:,iO3) + ENDIF + + IF (PRESENT(fh2o)) THEN + fh2o(:nY) = 0.0e+0_r8 + !DO L = 1, nZ + ! fh2o(:nY) = fh2o(:nY) + ptend%q(:nY,L,iH2O)*state%pdel(:nY,L)/Gravit + !ENDDO + ENDIF + + ! Nullify all pointers + Nullify(PblH ) + Nullify(Fsds ) + Nullify(PRain ) + Nullify(LsFlxSnw) + Nullify(LsFlxPrc) + Nullify(cldTop ) + Nullify(cldFrc ) + Nullify(NEvapr ) + Nullify(cmfdqr ) + + IF ( rootChunk ) WRITE(iulog,*) ' GEOS-Chem Chemistry step ', iStep, ' completed' + IF ( lastChunk ) WRITE(iulog,*) ' Chemistry completed on all chunks completed of MasterProc' + + end subroutine chem_timestep_tend + +!=============================================================================== + + subroutine chem_init_cnst(name, latvals, lonvals, mask, q) + + CHARACTER(LEN=*), INTENT(IN) :: name ! constituent name + REAL(r8), INTENT(IN) :: latvals(:) ! lat in degrees (NCOL) + REAL(r8), INTENT(IN) :: lonvals(:) ! lon in degrees (NCOL) + LOGICAL, INTENT(IN) :: mask(:) ! Only initialize where .true. + REAL(r8), INTENT(OUT) :: q(:,:) ! kg tracer/kg dry air (NCOL, PVER) + ! Used to initialize tracer fields if desired. + ! Will need a simple mapping structure as well as the CAM tracer registration + ! routines. + + INTEGER :: ILEV, NLEV, I + REAL(r8) :: QTemp, Min_MMR + + nlev = SIZE(q, 2) + + ! Retrieve a "background value" for this from the database + Min_MMR = 1.0e-38_r8 + CALL cnst_get_ind(TRIM(name), M, abort=.False.) + IF ( M > 0 ) Min_MMR = ref_MMR(M) + + DO ilev = 1, nlev + WHERE(mask) + ! Set to the minimum mixing ratio + q(:,ilev) = Min_MMR + END WHERE + ENDDO + + end subroutine chem_init_cnst + +!=============================================================================== + + subroutine chem_final + + use Input_Opt_Mod, only : Cleanup_Input_Opt + use State_Chm_Mod, only : Cleanup_State_Chm + use State_Diag_Mod, only : Cleanup_State_Diag + use State_Grid_Mod, only : Cleanup_State_Grid + use State_Met_Mod, only : Cleanup_State_Met + use Error_Mod, only : Cleanup_Error + + use FlexChem_Mod, only : Cleanup_FlexChem + use UCX_Mod, only : Cleanup_UCX + use Drydep_Mod, only : Cleanup_Drydep + use Carbon_Mod, only : Cleanup_Carbon + use Dust_Mod, only : Cleanup_Dust + use Seasalt_Mod, only : Cleanup_Seasalt + use Aerosol_Mod, only : Cleanup_Aerosol + use Sulfate_Mod, only : Cleanup_Sulfate + use Pressure_Mod, only : Cleanup_Pressure + use Strat_Chem_Mod, only : Cleanup_Strat_Chem + + use CMN_Size_Mod, only : Cleanup_CMN_Size + use CMN_FJX_Mod, only : Cleanup_CMN_FJX + +#ifdef BPCH_DIAG + use CMN_O3_Mod, only : Cleanup_CMN_O3 + ! Special: cleans up after NDXX_Setup + use Diag_Mod, only : Cleanup_Diag +#endif + + use CESMGC_Emissions_Mod, only: CESMGC_Emissions_Final + + ! Local variables + INTEGER :: I, RC + + ! Finalize GEOS-Chem + + CALL Cleanup_UCX + CALL Cleanup_Aerosol + CALL Cleanup_Carbon + CALL Cleanup_Drydep + CALL Cleanup_Dust + CALL Cleanup_FlexChem( RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Cleanup_FlexChem"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Cleanup_Pressure + CALL Cleanup_Seasalt + CALL Cleanup_Sulfate + CALL Cleanup_Strat_Chem + + CALL CESMGC_Emissions_Final + + CALL Cleanup_CMN_SIZE( RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Cleanup_CMN_SIZE"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + CALL Cleanup_CMN_FJX( RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Cleanup_CMN_FJX"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + +#ifdef BPCH_DIAG + CALL Cleanup_Diag + + ! Call extra cleanup routines, from modules in Headers/ + CALL Cleanup_CMN_O3( RC ) + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Cleanup_CMN_O3"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF +#endif + + ! Cleanup Input_Opt + CALL Cleanup_Input_Opt( Input_Opt, RC ) + + ! Loop over each chunk and cleanup the variables + DO I = BEGCHUNK, ENDCHUNK + CALL Cleanup_State_Chm ( State_Chm(I), RC ) + CALL Cleanup_State_Diag( State_Diag(I), RC ) + CALL Cleanup_State_Grid( State_Grid(I), RC ) + CALL Cleanup_State_Met ( State_Met(I), RC ) + ENDDO + CALL Cleanup_Error + + ! Finally deallocate state variables + IF ( ALLOCATED( State_Chm ) ) DEALLOCATE( State_Chm ) + IF ( ALLOCATED( State_Diag ) ) DEALLOCATE( State_Diag ) + IF ( ALLOCATED( State_Grid ) ) DEALLOCATE( State_Grid ) + IF ( ALLOCATED( State_Met ) ) DEALLOCATE( State_Met ) + + IF ( ALLOCATED( slvd_Lst ) ) DEALLOCATE( slvd_Lst ) + IF ( ALLOCATED( slvd_ref_MMR ) ) DEALLOCATE( slvd_ref_MMR ) + + + RETURN + + end subroutine chem_final + +!=============================================================================== + + subroutine chem_init_restart(File) + use tracer_cnst, only: init_tracer_cnst_restart + use tracer_srcs, only: init_tracer_srcs_restart + use pio, only : file_desc_t + + IMPLICIT NONE + + TYPE(file_desc_t) :: File + + IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_INIT_RESTART' + + ! + ! data for offline tracers + ! + call init_tracer_cnst_restart(File) + call init_tracer_srcs_restart(File) + !call init_linoz_data_restart(File) + + end subroutine chem_init_restart + +!=============================================================================== + + subroutine chem_write_restart( File ) + use tracer_cnst, only: write_tracer_cnst_restart + use tracer_srcs, only: write_tracer_srcs_restart + !use linoz_data, only: write_linoz_data_restart + use pio, only : file_desc_t + + IMPLICIT NONE + + TYPE(file_desc_t) :: File + + IF ( MasterProc ) WRITE(iulog,'(a)') 'GCCALL CHEM_WRITE_RESTART' + ! + ! data for offline tracers + ! + call write_tracer_cnst_restart(File) + call write_tracer_srcs_restart(File) + !call write_linoz_data_restart(File) + end subroutine chem_write_restart + +!=============================================================================== + + subroutine chem_read_restart( File ) + use tracer_cnst, only: read_tracer_cnst_restart + use tracer_srcs, only: read_tracer_srcs_restart + !use linoz_data, only: read_linoz_data_restart + use pio, only : file_desc_t + + IMPLICIT NONE + + TYPE(file_desc_t) :: File + + IF ( MasterProc ) WRITE(iulog,'(a)') 'GCCALL CHEM_READ_RESTART' + ! + ! data for offline tracers + ! + call read_tracer_cnst_restart(File) + call read_tracer_srcs_restart(File) + !call read_linoz_data_restart(File) + end subroutine chem_read_restart + +!================================================================================ + + subroutine chem_emissions( state, cam_in ) + + use camsrfexch, only : cam_in_t + + ! Arguments: + + TYPE(physics_state), INTENT(IN) :: state ! Physics state variables + TYPE(cam_in_t), INTENT(INOUT) :: cam_in ! import state + + INTEGER :: M, N + INTEGER :: LCHNK, nY + LOGICAL :: rootChunk + + + ! LCHNK: which chunk we have on this process + LCHNK = state%LCHNK + ! NCOL: number of atmospheric columns on this chunk + nY = state%NCOL + rootChunk = ( MasterProc.and.(LCHNK.EQ.BEGCHUNK) ) + + sflx(:,:) = 0.0e+0_r8 + + DO N = 1, nTracers + + fldname_ns = 'HCO_' // TRIM(tracerNames(N)) + tmpIdx = pbuf_get_index(fldname_ns, RC) + IF ( tmpIdx < 0 ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_emissions hemco: Field not found ", TRIM(fldname_ns) + ELSE + ! This is already in chunk, retrieve it + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + + IF ( .NOT. ASSOCIATED(pbuf_ik) ) THEN ! Sanity check + CALL ENDRUN("chem_emissions: FATAL - tmpIdx > 0 but pbuf_ik not associated") + ENDIF + + ! For each column retrieve data from pbuf_ik(I,K) + sflx(1:ncol,N) = pbuf_ik(1:ncol,pver) ! Only surface emissions for now, + + ! Reset pointers + pbuf_ik => NULL() + pbuf_chnk => NULL() + + M = map2GCinv(N) + + IF ( M <= 0 ) CYCLE + + cam_in%cflx(1:ncol,M) = sflx(1:ncol,N) + If ( MAXVAL(sflx(1:ncol,N)) > 0.0e+0_fp ) & + Write(iulog,*) "chem_emissions: debug added emiss for ", & + TRIM(cnst_name(M)), MAXVAL(sflx(1:ncol,N)), " from ", TRIM(fldname_ns), & + ". Total emission flux is: ", MAXVAL(cam_in%cflx(1:ncol,M)) + ENDIF + ENDDO + + end subroutine chem_emissions + +!=============================================================================== + +end module chemistry diff --git a/src/chemistry/pp_geoschem/clybry_fam.F90 b/src/chemistry/geoschem/clybry_fam.F90 similarity index 100% rename from src/chemistry/pp_geoschem/clybry_fam.F90 rename to src/chemistry/geoschem/clybry_fam.F90 diff --git a/src/chemistry/pp_geoschem/epp_ionization.F90 b/src/chemistry/geoschem/epp_ionization.F90 similarity index 100% rename from src/chemistry/pp_geoschem/epp_ionization.F90 rename to src/chemistry/geoschem/epp_ionization.F90 diff --git a/src/chemistry/geoschem/fire_emissions.F90 b/src/chemistry/geoschem/fire_emissions.F90 new file mode 120000 index 0000000000..7b9f50ff22 --- /dev/null +++ b/src/chemistry/geoschem/fire_emissions.F90 @@ -0,0 +1 @@ +../mozart/fire_emissions.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/gas_wetdep_opts.F90 b/src/chemistry/geoschem/gas_wetdep_opts.F90 new file mode 100644 index 0000000000..908e352239 --- /dev/null +++ b/src/chemistry/geoschem/gas_wetdep_opts.F90 @@ -0,0 +1,79 @@ +!----------------------------------------------------------------------- +! Reads namelist options for gas-phase wet deposition +! +! Created by Francis Vitt -- 22 Apr 2011 +!----------------------------------------------------------------------- +module gas_wetdep_opts + + use constituents, only : pcnst + use cam_logfile, only : iulog + use constituents, only : pcnst + use spmd_utils, only : masterproc + use cam_abortutils, only : endrun + + implicit none + + character(len=16), protected :: gas_wetdep_list(pcnst) = ' ' + character(len=9), protected :: gas_wetdep_method = 'MOZ' + integer, protected :: gas_wetdep_cnt = 0 + +contains + + !----------------------------------------------------------------------- + !----------------------------------------------------------------------- + + subroutine gas_wetdep_readnl(nlfile) + + use cam_abortutils, only: endrun + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit +#ifdef SPMD + use mpishorthand, only: mpichar, mpicom +#endif + + implicit none + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + + integer :: unitn, i, ierr + + namelist /wetdep_inparm/ gas_wetdep_list + namelist /wetdep_inparm/ gas_wetdep_method + + if (masterproc) then + unitn = getunit() + open( unitn, file=trim(nlfile), status='old' ) + call find_group_name(unitn, 'wetdep_inparm', status=ierr) + if (ierr == 0) then + read(unitn, wetdep_inparm, iostat=ierr) + if (ierr /= 0) then + call endrun('mo_neu_wetdep->wetdep_readnl: ERROR reading wetdep_inparm namelist') + end if + end if + close(unitn) + call freeunit(unitn) + end if + +#ifdef SPMD + call mpibcast (gas_wetdep_list, len(gas_wetdep_list(1))*pcnst, mpichar, 0, mpicom) + call mpibcast (gas_wetdep_method, len(gas_wetdep_method), mpichar, 0, mpicom) +#endif + + gas_wetdep_cnt = 0 + do i = 1,pcnst + if ( len_trim(gas_wetdep_list(i)) > 0 ) then + gas_wetdep_cnt = gas_wetdep_cnt + 1 + endif + enddo + + if (( gas_wetdep_cnt>0 ).and. & + ( .not.(gas_wetdep_method=='MOZ' .or. & + gas_wetdep_method=='NEU' .or. & + gas_wetdep_method=='GEOS-CHEM' .or. & + gas_wetdep_method=='OFF') )) then + call endrun('gas_wetdep_readnl; gas_wetdep_method must be set to either MOZ, NEU or GEOS-CHEM') + endif + + end subroutine gas_wetdep_readnl + +end module gas_wetdep_opts diff --git a/src/chemistry/pp_geoschem/getLandTypes.F90 b/src/chemistry/geoschem/getLandTypes.F90 similarity index 100% rename from src/chemistry/pp_geoschem/getLandTypes.F90 rename to src/chemistry/geoschem/getLandTypes.F90 diff --git a/src/chemistry/geoschem/m_spc_id.F90 b/src/chemistry/geoschem/m_spc_id.F90 new file mode 100644 index 0000000000..14a949048d --- /dev/null +++ b/src/chemistry/geoschem/m_spc_id.F90 @@ -0,0 +1,3 @@ + module m_spc_id + implicit none + end module m_spc_id diff --git a/src/chemistry/pp_geoschem/mo_apex.F90 b/src/chemistry/geoschem/mo_apex.F90 similarity index 100% rename from src/chemistry/pp_geoschem/mo_apex.F90 rename to src/chemistry/geoschem/mo_apex.F90 diff --git a/src/chemistry/geoschem/mo_chem_utls.F90 b/src/chemistry/geoschem/mo_chem_utls.F90 new file mode 100644 index 0000000000..43e2d7317e --- /dev/null +++ b/src/chemistry/geoschem/mo_chem_utls.F90 @@ -0,0 +1,180 @@ + +module mo_chem_utls + + private + public :: get_spc_ndx + public :: get_inv_ndx + public :: get_extfrc_ndx + public :: get_rxt_ndx + public :: utls_chem_is + !, get_het_ndx + + save + +contains + + integer function get_spc_ndx( spc_name ) + !----------------------------------------------------------------------- + ! ... return overall species index associated with spc_name + !----------------------------------------------------------------------- + + use chem_mods, only : gas_pcnst + use mo_tracname, only : tracnam => solsym + use string_utils, only : to_upper + + implicit none + + !----------------------------------------------------------------------- + ! ... dummy arguments + !----------------------------------------------------------------------- + character(len=*), intent(in) :: spc_name + + !----------------------------------------------------------------------- + ! ... local variables + !----------------------------------------------------------------------- + integer :: m + + get_spc_ndx = -1 + do m = 1, gas_pcnst + if( trim( to_upper( spc_name ) ) == trim( to_upper( tracnam(m) ) ) ) then + get_spc_ndx = m + exit + end if + end do + + end function get_spc_ndx + + integer function get_inv_ndx( invariant ) + !----------------------------------------------------------------------- + ! ... return overall external frcing index associated with spc_name + !----------------------------------------------------------------------- + + use chem_mods, only : nfs, inv_lst + + implicit none + + !----------------------------------------------------------------------- + ! ... dummy arguments + !----------------------------------------------------------------------- + character(len=*), intent(in) :: invariant + + !----------------------------------------------------------------------- + ! ... local variables + !----------------------------------------------------------------------- + integer :: m + + get_inv_ndx = -1 + do m = 1,nfs + if( trim( invariant ) == trim( inv_lst(m) ) ) then + get_inv_ndx = m + exit + end if + end do + + end function get_inv_ndx + + logical function utls_chem_is (name) result(chem_is) + use string_utils, only : to_lower + + character(len=*), intent(in) :: name + chem_is = .false. + if (( to_lower(name) == 'geoschem' ) .or. & + ( to_lower(name) == 'geos-chem' )) then + chem_is = .true. + endif + + end function utls_chem_is +! +! integer function get_het_ndx( het_name ) +! !----------------------------------------------------------------------- +! ! ... return overall het process index associated with spc_name +! !----------------------------------------------------------------------- +! +! use gas_wetdep_opts,only : gas_wetdep_method, gas_wetdep_list, gas_wetdep_cnt +! +! implicit none +! +! !----------------------------------------------------------------------- +! ! ... dummy arguments +! !----------------------------------------------------------------------- +! character(len=*), intent(in) :: het_name +! +! !----------------------------------------------------------------------- +! ! ... local variables +! !----------------------------------------------------------------------- +! integer :: m +! +! get_het_ndx=-1 +! +! do m=1,gas_wetdep_cnt +! +! if( trim( het_name ) == trim( gas_wetdep_list(m) ) ) then +! get_het_ndx = get_spc_ndx( gas_wetdep_list(m) ) +! return +! endif +! +! enddo +! +! end function get_het_ndx +! + integer function get_extfrc_ndx( frc_name ) + !----------------------------------------------------------------------- + ! ... return overall external frcing index associated with spc_name + !----------------------------------------------------------------------- + + use chem_mods, only : extcnt, extfrc_lst + + implicit none + + !----------------------------------------------------------------------- + ! ... dummy arguments + !----------------------------------------------------------------------- + character(len=*), intent(in) :: frc_name + + !----------------------------------------------------------------------- + ! ... local variables + !----------------------------------------------------------------------- + integer :: m + + get_extfrc_ndx = -1 + if( extcnt > 0 ) then + do m = 1,max(1,extcnt) + if( trim( frc_name ) == trim( extfrc_lst(m) ) ) then + get_extfrc_ndx = m + exit + end if + end do + end if + + end function get_extfrc_ndx + + integer function get_rxt_ndx( rxt_tag ) + !----------------------------------------------------------------------- + ! ... return overall external frcing index associated with spc_name + !----------------------------------------------------------------------- + + use chem_mods, only : rxt_tag_cnt, rxt_tag_lst, rxt_tag_map + + implicit none + + !----------------------------------------------------------------------- + ! ... dummy arguments + !----------------------------------------------------------------------- + character(len=*), intent(in) :: rxt_tag + + !----------------------------------------------------------------------- + ! ... local variables + !----------------------------------------------------------------------- + integer :: m + + get_rxt_ndx = -1 + do m = 1,rxt_tag_cnt + if( trim( rxt_tag ) == trim( rxt_tag_lst(m) ) ) then + get_rxt_ndx = rxt_tag_map(m) + exit + end if + end do + + end function get_rxt_ndx + +end module mo_chem_utls diff --git a/src/chemistry/pp_geoschem/mo_drydep.F90 b/src/chemistry/geoschem/mo_drydep.F90 similarity index 94% rename from src/chemistry/pp_geoschem/mo_drydep.F90 rename to src/chemistry/geoschem/mo_drydep.F90 index 50656ef30b..66f4b122f0 100644 --- a/src/chemistry/pp_geoschem/mo_drydep.F90 +++ b/src/chemistry/geoschem/mo_drydep.F90 @@ -37,6 +37,10 @@ module mo_drydep module procedure dvel_inti_fromlnd end interface + interface drydep_inti_landuse + module procedure dvel_inti_xactive_landuse + end interface + interface drydep !module procedure drydep_table module procedure drydep_xactive @@ -45,6 +49,7 @@ module mo_drydep private public :: drydep_inti, drydep, set_soilw, chk_soilw, has_drydep + public :: drydep_inti_landuse public :: drydep_update public :: drydep_fromlnd public :: n_land_type, fraction_landuse, drydep_srf_file @@ -2043,6 +2048,192 @@ subroutine dvel_inti_xactive( depvel_lnd_file, clim_soilw_file, season_wes_file end subroutine dvel_inti_xactive + subroutine dvel_inti_xactive_landuse( depvel_lnd_file, clim_soilw_file ) + !------------------------------------------------------------------------------------- + ! ... intialize interactive drydep + !------------------------------------------------------------------------------------- + use dycore, only : dycore_is + use mo_constants, only : r2d + use chem_mods, only : adv_mass + use mo_chem_utls, only : get_spc_ndx ! Replaced, TMMF + use seq_drydep_mod,only : drydep_method, DD_XATM, DD_XLND + use phys_control, only : phys_getopts + + implicit none + + !------------------------------------------------------------------------------------- + ! ... dummy arguments + !------------------------------------------------------------------------------------- + character(len=*), intent(in) :: depvel_lnd_file, clim_soilw_file + + !------------------------------------------------------------------------------------- + ! ... local variables + !------------------------------------------------------------------------------------- + integer :: i, j, ii, jj, jl, ju + integer :: nlon_veg, nlat_veg, npft_veg + integer :: nlat_lai, npft_lai, pos_min, imin + integer :: dimid + integer :: m, n, l, id + integer :: length1, astat + integer :: k, num_max, k_max + integer :: num_seas(5) + integer :: plon, plat + integer :: ierr, ndx + + real(r8) :: spc_mass + real(r8) :: diff_min, target_lat + real(r8), allocatable :: vegetation_map(:,:,:) + real(r8), pointer :: soilw_map(:,:,:) + real(r8), allocatable :: work(:,:) + real(r8), allocatable :: landmask(:,:) + real(r8), allocatable :: urban(:,:) + real(r8), allocatable :: lake(:,:) + real(r8), allocatable :: wetland(:,:) + real(r8), allocatable :: lon_veg(:) + real(r8), allocatable :: lon_veg_edge(:) + real(r8), allocatable :: lat_veg(:) + real(r8), allocatable :: lat_veg_edge(:) + character(len=32) :: test_name + character(len=4) :: tag_name + type(file_desc_t) :: piofile + type(var_desc_t) :: vid + logical :: do_soilw + + character(len=shr_kind_cl) :: locfn + logical :: prog_modal_aero + + ! determine if modal aerosols are active so that fraction_landuse array is initialized for modal aerosal dry dep + call phys_getopts(prog_modal_aero_out=prog_modal_aero) + + call dvel_inti_fromlnd() + + !--------------------------------------------------------------------------- + ! ... allocate module variables + !--------------------------------------------------------------------------- + if (drydep_method == DD_XLND .and. (.not.prog_modal_aero)) then + return + endif + + do_soilw = .not. dyn_soilw + allocate( fraction_landuse(pcols,n_land_type, begchunk:endchunk),stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate fraction_landuse; error = ',astat + call endrun + end if + if(do_soilw) then + allocate(soilw_3d(pcols,12,begchunk:endchunk),stat=astat) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate soilw_3d error = ',astat + call endrun + end if + end if + + plon = get_dyn_grid_parm('plon') + plat = get_dyn_grid_parm('plat') + if(dycore_is('UNSTRUCTURED') ) then + call get_landuse_and_soilw_from_file(do_soilw) + else + !--------------------------------------------------------------------------- + ! ... read landuse map + !--------------------------------------------------------------------------- + call getfil (depvel_lnd_file, locfn, 0) + call cam_pio_openfile (piofile, trim(locfn), PIO_NOWRITE) + !--------------------------------------------------------------------------- + ! ... get the dimensions + !--------------------------------------------------------------------------- + ierr = pio_inq_dimid( piofile, 'lon', dimid ) + ierr = pio_inq_dimlen( piofile, dimid, nlon_veg ) + ierr = pio_inq_dimid( piofile, 'lat', dimid ) + ierr = pio_inq_dimlen( piofile, dimid, nlat_veg ) + ierr = pio_inq_dimid( piofile, 'pft', dimid ) + ierr = pio_inq_dimlen( piofile, dimid, npft_veg ) + !--------------------------------------------------------------------------- + ! ... allocate arrays + !--------------------------------------------------------------------------- + allocate( vegetation_map(nlon_veg,nlat_veg,npft_veg), work(nlon_veg,nlat_veg), stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate vegation_map; error = ',astat + call endrun + end if + allocate( urban(nlon_veg,nlat_veg), lake(nlon_veg,nlat_veg), & + landmask(nlon_veg,nlat_veg), wetland(nlon_veg,nlat_veg), stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate vegation_map; error = ',astat + call endrun + end if + allocate( lon_veg(nlon_veg), lat_veg(nlat_veg), & + lon_veg_edge(nlon_veg+1), lat_veg_edge(nlat_veg+1), stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'dvel_inti: failed to allocate vegation lon, lat arrays; error = ',astat + call endrun + end if + !--------------------------------------------------------------------------- + ! ... read the vegetation map and landmask + !--------------------------------------------------------------------------- + ierr = pio_inq_varid( piofile, 'PCT_PFT', vid ) + ierr = pio_get_var( piofile, vid, vegetation_map ) + + ierr = pio_inq_varid( piofile, 'LANDMASK', vid ) + ierr = pio_get_var( piofile, vid, landmask ) + + ierr = pio_inq_varid( piofile, 'PCT_URBAN', vid ) + ierr = pio_get_var( piofile, vid, urban ) + + ierr = pio_inq_varid( piofile, 'PCT_LAKE', vid ) + ierr = pio_get_var( piofile, vid, lake ) + + ierr = pio_inq_varid( piofile, 'PCT_WETLAND', vid ) + ierr = pio_get_var( piofile, vid, wetland ) + + call cam_pio_closefile( piofile ) + + !--------------------------------------------------------------------------- + ! scale vegetation, urban, lake, and wetland to fraction + !--------------------------------------------------------------------------- + vegetation_map(:,:,:) = .01_r8 * vegetation_map(:,:,:) + wetland(:,:) = .01_r8 * wetland(:,:) + lake(:,:) = .01_r8 * lake(:,:) + urban(:,:) = .01_r8 * urban(:,:) +#ifdef DEBUG + if(masterproc) then + write(iulog,*) 'minmax vegetation_map ',minval(vegetation_map),maxval(vegetation_map) + write(iulog,*) 'minmax wetland ',minval(wetland),maxval(wetland) + write(iulog,*) 'minmax landmask ',minval(landmask),maxval(landmask) + end if +#endif + !--------------------------------------------------------------------------- + ! ... define lat-lon of vegetation map (1x1) + !--------------------------------------------------------------------------- + lat_veg(:) = (/ (-89.5_r8 + (i-1),i=1,nlat_veg ) /) + lon_veg(:) = (/ ( 0.5_r8 + (i-1),i=1,nlon_veg ) /) + lat_veg_edge(:) = (/ (-90.0_r8 + (i-1),i=1,nlat_veg+1) /) + lon_veg_edge(:) = (/ ( 0.0_r8 + (i-1),i=1,nlon_veg+1) /) + !--------------------------------------------------------------------------- + ! ... read soilw table if necessary + !--------------------------------------------------------------------------- + + if( do_soilw ) then + call soilw_inti( clim_soilw_file, nlon_veg, nlat_veg, soilw_map ) + end if + + !--------------------------------------------------------------------------- + ! ... regrid to model grid + !--------------------------------------------------------------------------- + + call interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_veg_edge, & + lon_veg, lon_veg_edge, landmask, urban, lake, & + wetland, vegetation_map, soilw_map, do_soilw ) + + deallocate( vegetation_map, work, stat=astat ) + deallocate( lon_veg, lat_veg, lon_veg_edge, lat_veg_edge, stat=astat ) + deallocate( landmask, urban, lake, wetland, stat=astat ) + if( do_soilw ) then + deallocate( soilw_map, stat=astat ) + end if + endif ! Unstructured grid + + end subroutine dvel_inti_xactive_landuse + !------------------------------------------------------------------------------------- subroutine get_landuse_and_soilw_from_file(do_soilw) use ncdio_atm, only : infld diff --git a/src/chemistry/pp_geoschem/mo_gas_phase_chemdr.F90 b/src/chemistry/geoschem/mo_gas_phase_chemdr.F90 similarity index 100% rename from src/chemistry/pp_geoschem/mo_gas_phase_chemdr.F90 rename to src/chemistry/geoschem/mo_gas_phase_chemdr.F90 diff --git a/src/chemistry/geoschem/mo_ghg_chem.F90 b/src/chemistry/geoschem/mo_ghg_chem.F90 new file mode 120000 index 0000000000..f8a8b4ba4c --- /dev/null +++ b/src/chemistry/geoschem/mo_ghg_chem.F90 @@ -0,0 +1 @@ +../mozart/mo_ghg_chem.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/mo_lightning.F90 b/src/chemistry/geoschem/mo_lightning.F90 new file mode 120000 index 0000000000..8b731ae98f --- /dev/null +++ b/src/chemistry/geoschem/mo_lightning.F90 @@ -0,0 +1 @@ +../mozart/mo_lightning.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/mo_mean_mass.F90 b/src/chemistry/geoschem/mo_mean_mass.F90 new file mode 120000 index 0000000000..e4231e65f7 --- /dev/null +++ b/src/chemistry/geoschem/mo_mean_mass.F90 @@ -0,0 +1 @@ +../mozart/mo_mean_mass.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/mo_neu_wetdep.F90 b/src/chemistry/geoschem/mo_neu_wetdep.F90 new file mode 100644 index 0000000000..c48af5cc0c --- /dev/null +++ b/src/chemistry/geoschem/mo_neu_wetdep.F90 @@ -0,0 +1,1798 @@ +! +! code written by J.-F. Lamarque, S. Walters and F. Vitt +! based on the original code from J. Neu developed for UC Irvine +! model +! +! LKE 2/23/2018 - correct setting flag for mass-limited (HNO3,etc.) vs Henry's Law washout +! +module mo_neu_wetdep +! + use shr_kind_mod, only : r8 => shr_kind_r8 + use cam_logfile, only : iulog + use constituents, only : pcnst + use spmd_utils, only : masterproc + use cam_abortutils, only : endrun + use seq_drydep_mod, only : n_species_table, species_name_table, dheff + use gas_wetdep_opts, only : gas_wetdep_method, gas_wetdep_list, gas_wetdep_cnt +! + implicit none +! + private + public :: neu_wetdep_init + public :: neu_wetdep_tend +! + save +! + integer, allocatable, dimension(:) :: mapping_to_heff,mapping_to_mmr + real(r8),allocatable, dimension(:) :: mol_weight + logical ,allocatable, dimension(:) :: ice_uptake + integer :: index_cldice,index_cldliq,nh3_ndx,co2_ndx + logical :: debug = .false. + integer :: hno3_ndx = 0 + integer :: h2o2_ndx = 0 +! +! diagnostics +! + logical :: do_diag = .false. + integer, parameter :: kdiag = 18 +! + real(r8), parameter :: zero = 0._r8 + real(r8), parameter :: one = 1._r8 +! + logical :: do_neu_wetdep +! + real(r8), parameter :: TICE=263._r8 + +contains + +!----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! +subroutine neu_wetdep_init +! + use constituents, only : cnst_get_ind,cnst_mw + use cam_history, only : addfld, add_default, horiz_only + use phys_control, only : phys_getopts +! + integer :: m,l + character*20 :: test_name + + logical :: history_chemistry + + call phys_getopts(history_chemistry_out=history_chemistry) + + do_neu_wetdep = gas_wetdep_method == 'NEU' .and. gas_wetdep_cnt>0 + + if (.not.do_neu_wetdep) return + + allocate( mapping_to_heff(gas_wetdep_cnt) ) + allocate( mapping_to_mmr(gas_wetdep_cnt) ) + allocate( ice_uptake(gas_wetdep_cnt) ) + allocate( mol_weight(gas_wetdep_cnt) ) + +! +! find mapping to heff table +! + if ( debug ) then + print '(a,i4)','gas_wetdep_cnt=',gas_wetdep_cnt + print '(a,i4)','n_species_table=',n_species_table + end if + mapping_to_heff = -99 + do m=1,gas_wetdep_cnt +! + test_name = gas_wetdep_list(m) + if ( debug ) print '(i4,a)',m,trim(test_name) +! +! mapping based on the MOZART4 wet removal subroutine; +! this might need to be redone (JFL: Sep 2010) +! + select case( trim(test_name) ) +! +! CCMI: added SO2t and NH_50W +! + case( 'HYAC', 'CH3COOH' , 'HCOOH', 'EOOH', 'IEPOX' ) + test_name = 'CH2O' + case ( 'SOGB','SOGI','SOGM','SOGT','SOGX' ) + test_name = 'H2O2' + case ( 'SO2t' ) + test_name = 'SO2' + case ( 'CLONO2','BRONO2','HCL','HOCL','HOBR','HBR', 'Pb', 'MACROOH', 'ISOPOOH', 'XOOH', 'H2SO4', 'HF', 'COF2', 'COFCL') + test_name = 'HNO3' + case ( 'NH_50W', 'NDEP', 'NHDEP', 'NH4NO3' ) + test_name = 'HNO3' + case ( 'ALKOOH', 'MEKOOH', 'TOLOOH' ) + test_name = 'CH3OOH' + case( 'PHENOOH', 'BENZOOH', 'C6H5OOH', 'BZOOH', 'XYLOLOOH', 'XYLENOOH', 'HPALD' ) + test_name = 'CH3OOH' + case( 'TERPOOH', 'TERP2OOH', 'MBOOOH' ) + test_name = 'HNO3' + case( 'TERPROD1', 'TERPROD2' ) + test_name = 'CH2O' + case( 'HMPROP' ) + test_name = 'GLYALD' + case( 'NOA', 'ALKNIT', 'ISOPNITA', 'ISOPNITB', 'HONITR', 'ISOPNOOH' ) + test_name = 'H2O2' + case( 'NC4CHO', 'NC4CH2OH', 'TERPNIT', 'NTERPOOH' ) + test_name = 'H2O2' + case( 'SOAGbb0' ) ! Henry's Law coeff. added for VBS SOA's, biomass burning is the same as fossil fuels + test_name = 'SOAGff0' + case( 'SOAGbb1' ) + test_name = 'SOAGff1' + case( 'SOAGbb2' ) + test_name = 'SOAGff2' + case( 'SOAGbb3' ) + test_name = 'SOAGff3' + case( 'SOAGbb4' ) + test_name = 'SOAGff4' + case( 'H2O2' ) + test_name = 'GC_H2O2' + case( 'HCHO' ) + test_name = 'GC_CH2O' + case( 'CH2O' ) + test_name = 'GC_CH2O' + case( 'NO2' ) + test_name = 'GC_NO2' + case( 'HNO3' ) + test_name = 'GC_HNO3' + case( 'NH3' ) + test_name = 'GC_NH3' + case( 'N2O5' ) + test_name = 'GC_N2O5' + case( 'PAN' ) + test_name = 'GC_PAN' + case( 'SO2' ) + test_name = 'GC_SO2' + ! Now list all non-MAM GEOS-Chem aerosols. These will be scavenged similarly + ! to HNO3 + case( 'AERI', 'BrSALA', 'BrSALC', 'DMS', 'INDIOL', & + 'IONITA', 'ISALA', 'ISALC', 'LVOCOA', 'MONITA', & + 'MSA', 'NH4', 'NIT', 'NITs', 'pFe', & + 'SALAAL', 'SALACL', 'SALCAL', 'SALCCL', 'SO4s', & + 'SOAGX', 'SOAIE' ) + test_name = 'HNO3' + end select +! + do l = 1,n_species_table +! +! if ( debug ) print '(i4,a)',l,trim(species_name_table(l)) +! + if( trim(test_name) == trim( species_name_table(l) ) ) then + mapping_to_heff(m) = l + if ( debug ) print '(a,a,i4)','mapping to heff of ',trim(species_name_table(l)),l + exit + end if + end do + if ( mapping_to_heff(m) == -99 ) then + if (masterproc) print *,'problem with mapping_to_heff of ',trim(test_name) +! call endrun() + end if +! +! special cases for NH3 and CO2 +! + if ( trim(test_name) == 'NH3' ) then + nh3_ndx = m + end if + if ( trim(test_name) == 'CO2' ) then + co2_ndx = m + end if + if ( trim(gas_wetdep_list(m)) == 'HNO3' ) then + hno3_ndx = m + end if +! + end do + + if (any ( mapping_to_heff(:) == -99 )) call endrun('mo_neu_wet->depwetdep_init: unmapped species error' ) +! + if ( debug ) then + print '(a,i4)','co2_ndx',co2_ndx + print '(a,i4)','nh3_ndx',nh3_ndx + end if +! +! find mapping to species +! + mapping_to_mmr = -99 + do m=1,gas_wetdep_cnt + if ( debug ) print '(i4,a)',m,trim(gas_wetdep_list(m)) + call cnst_get_ind(gas_wetdep_list(m), mapping_to_mmr(m), abort=.false. ) + if ( debug ) print '(a,i4)','mapping_to_mmr ',mapping_to_mmr(m) + if ( mapping_to_mmr(m) <= 0 ) then + print *,'problem with mapping_to_mmr of ',gas_wetdep_list(m) + call endrun('problem with mapping_to_mmr of '//trim(gas_wetdep_list(m))) + end if + end do +! +! define species-dependent arrays +! + do m=1,gas_wetdep_cnt +! + mol_weight(m) = cnst_mw(mapping_to_mmr(m)) + if ( debug ) print '(i4,a,f8.4)',m,' mol_weight ',mol_weight(m) + ice_uptake(m) = .false. + if ( trim(gas_wetdep_list(m)) == 'HNO3' ) then + ice_uptake(m) = .true. + end if +! +! + end do +! +! indices for cloud quantities +! + call cnst_get_ind( 'CLDICE', index_cldice ) + call cnst_get_ind( 'CLDLIQ', index_cldliq ) +! +! define output +! + do m=1,gas_wetdep_cnt + call addfld ('DTWR_'//trim(gas_wetdep_list(m)),(/ 'lev' /), 'A','kg/kg/s','wet removal Neu scheme tendency') + call addfld ('WD_'//trim(gas_wetdep_list(m)),horiz_only, 'A','kg/m2/s','vertical integrated wet deposition flux') + call addfld ('HEFF_'//trim(gas_wetdep_list(m)),(/ 'lev' /), 'A','M/atm','Effective Henrys Law coeff.') + call add_default('DTWR_'//trim(gas_wetdep_list(m)), 4, ' ') + call add_default('WD_'//trim(gas_wetdep_list(m)), 4, ' ') + !if (history_chemistry) then + ! call add_default('DTWR_'//trim(gas_wetdep_list(m)), 1, ' ') + ! call add_default('WD_'//trim(gas_wetdep_list(m)), 1, ' ') + !end if + end do +! + if ( do_diag ) then + call addfld ('QT_RAIN_HNO3',(/ 'lev' /), 'A','mol/mol/s','wet removal Neu scheme rain tendency') + call addfld ('QT_RIME_HNO3',(/ 'lev' /), 'A','mol/mol/s','wet removal Neu scheme rain tendency') + call addfld ('QT_WASH_HNO3',(/ 'lev' /), 'A','mol/mol/s','wet removal Neu scheme rain tendency') + call addfld ('QT_EVAP_HNO3',(/ 'lev' /), 'A','mol/mol/s','wet removal Neu scheme rain tendency') + if (history_chemistry) then + call add_default('QT_RAIN_HNO3',1,' ') + call add_default('QT_RIME_HNO3',1,' ') + call add_default('QT_WASH_HNO3',1,' ') + call add_default('QT_EVAP_HNO3',1,' ') + end if + end if +! + return +! +end subroutine neu_wetdep_init +! +subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & + prain, nevapr, cld, cmfdqr, wd_tend, wd_tend_int) +! + use ppgrid, only : pcols, pver +!!DEK + use phys_grid, only : get_area_all_p, get_rlat_all_p + use shr_const_mod, only : SHR_CONST_REARTH,SHR_CONST_G + use cam_history, only : outfld +! + implicit none +! + integer, intent(in) :: lchnk,ncol + real(r8), intent(in) :: mmr(pcols,pver,pcnst) ! mass mixing ratio (kg/kg) + real(r8), intent(in) :: pmid(pcols,pver) ! midpoint pressures (Pa) + real(r8), intent(in) :: pdel(pcols,pver) ! pressure delta about midpoints (Pa) + real(r8), intent(in) :: zint(pcols,pver+1) ! interface geopotential height above the surface (m) + real(r8), intent(in) :: tfld(pcols,pver) ! midpoint temperature (K) + real(r8), intent(in) :: delt ! timestep (s) +! + real(r8), intent(in) :: prain(ncol, pver) + real(r8), intent(in) :: nevapr(ncol, pver) + real(r8), intent(in) :: cld(ncol, pver) + real(r8), intent(in) :: cmfdqr(ncol, pver) + real(r8), intent(inout) :: wd_tend(pcols,pver,pcnst) + real(r8), intent(inout) :: wd_tend_int(pcols,pcnst) +! +! local arrays and variables +! + integer :: i,k,l,kk,m,id + real(r8), parameter :: rearth = SHR_CONST_REARTH ! radius earth (m) + real(r8), parameter :: gravit = SHR_CONST_G ! m/s^2 + real(r8), dimension(ncol) :: area, wk_out + real(r8), dimension(ncol,pver) :: cldice,cldliq,cldfrc,totprec,totevap,delz,delp,p + real(r8), dimension(ncol,pver) :: rls,evaprate,mass_in_layer,temp + real(r8), dimension(ncol,pver,gas_wetdep_cnt) :: trc_mass,heff,dtwr + real(r8), dimension(ncol,pver,gas_wetdep_cnt) :: wd_mmr + logical , dimension(gas_wetdep_cnt) :: tckaqb + integer , dimension(ncol) :: test_flag +! +! arrays for HNO3 diagnostics +! + real(r8), dimension(ncol,pver) :: qt_rain,qt_rime,qt_wash,qt_evap +! +! for Henry's law calculations +! + real(r8), parameter :: t0 = 298._r8 + real(r8), parameter :: ph = 1.e-5_r8 + real(r8), parameter :: ph_inv = 1._r8/ph + real(r8) :: e298, dhr + real(r8), dimension(ncol) :: dk1s,dk2s,wrk +!!DEK + real(r8) :: pi + real(r8) :: lats(pcols) +! +! from cam/src/physics/cam/stratiform.F90 +! +!!DEK + pi = 4._r8*atan(1.0_r8) + + if (.not.do_neu_wetdep) return +! +! don't do anything if there are no species to be removed +! + if ( gas_wetdep_cnt == 0 ) return +! +! reset output variables +! + wd_tend_int = 0._r8 +! +! get area (in radians square) +! + call get_area_all_p(lchnk, ncol, area) + area = area * rearth**2 ! in m^2 +! +! reverse order along the vertical before calling +! J. Neu's wet removal subroutine +! + do k=1,pver + kk = pver - k + 1 + do i=1,ncol +! + mass_in_layer(i,k) = area(i) * pdel(i,kk)/gravit ! kg +! + cldice (i,k) = mmr(i,kk,index_cldice) ! kg/kg + cldliq (i,k) = mmr(i,kk,index_cldliq) ! kg/kg + cldfrc (i,k) = cld(i,kk) ! unitless +! + totprec(i,k) = (prain(i,kk)+cmfdqr(i,kk)) & + * mass_in_layer(i,k) ! kg/s + totevap(i,k) = nevapr(i,kk) * mass_in_layer(i,k) ! kg/s +! + delz(i,k) = zint(i,kk) - zint(i,kk+1) ! in m +! + temp(i,k) = tfld(i,kk) +! +! convert tracer mass to kg to kg/kg +! + trc_mass(i,k,:) = mmr(i,kk,mapping_to_mmr(:)) * mass_in_layer(i,k) +! + delp(i,k) = pdel(i,kk) * 0.01_r8 ! in hPa + p (i,k) = pmid(i,kk) * 0.01_r8 ! in hPa +! + end do + end do +! +! define array for tendency calculation (on model grid) +! + dtwr(1:ncol,:,:) = mmr(1:ncol,:,mapping_to_mmr(:)) +! +! compute 1) integrated precipitation flux across the interfaces (rls) +! 2) evaporation rate +! + rls (:,pver) = 0._r8 + evaprate (:,pver) = 0._r8 + do k=pver-1,1,-1 + rls (:,k) = max(0._r8,totprec(:,k)-totevap(:,k)+rls(:,k+1)) + !evaprate(:,k) = min(1._r8,totevap(:,k)/(rls(:,k+1)+totprec(:,k)+1.e-36_r8)) + evaprate(:,k) = min(1._r8,totevap(:,k)/(rls(:,k+1)+1.e-36_r8)) + end do +! +! compute effective Henry's law coefficients +! code taken from models/drv/shr/seq_drydep_mod.F90 +! + heff = 0._r8 + do k=1,pver +! + kk = pver - k + 1 +! + wrk(:) = (t0-tfld(1:ncol,kk))/(t0*tfld(1:ncol,kk)) +! + do m=1,gas_wetdep_cnt +! + l = mapping_to_heff(m) + id = 6*(l - 1) + e298 = dheff(id+1) + dhr = dheff(id+2) + heff(:,k,m) = e298*exp( dhr*wrk(:) ) + test_flag = -99 + if( dheff(id+3) /= 0._r8 .and. dheff(id+5) == 0._r8 ) then + e298 = dheff(id+3) + dhr = dheff(id+4) + dk1s(:) = e298*exp( dhr*wrk(:) ) + where( heff(:,k,m) /= 0._r8 ) + heff(:,k,m) = heff(:,k,m)*(1._r8 + dk1s(:)*ph_inv) + elsewhere + test_flag = 1 + heff(:,k,m) = dk1s(:)*ph_inv + endwhere + end if +! + if (k.eq.1 .and. maxval(test_flag) > 0 .and. debug ) print '(a,i4)','heff for m=',m +! + if( dheff(id+5) /= 0._r8 ) then + if( nh3_ndx > 0 .or. co2_ndx > 0 ) then + e298 = dheff(id+3) + dhr = dheff(id+4) + dk1s(:) = e298*exp( dhr*wrk(:) ) + e298 = dheff(id+5) + dhr = dheff(id+6) + dk2s(:) = e298*exp( dhr*wrk(:) ) + if( m == co2_ndx ) then + heff(:,k,m) = heff(:,k,m)*(1._r8 + dk1s(:)*ph_inv)*(1._r8 + dk2s(:)*ph_inv) + else if( m == nh3_ndx ) then + heff(:,k,m) = heff(:,k,m)*(1._r8 + dk1s(:)*ph/dk2s(:)) + else + write(iulog,*) 'error in assigning henrys law coefficients' + write(iulog,*) 'species ',m + end if + end if + end if +! + end do + end do +! + if ( debug ) then + print '(a,50f8.2)','tckaqb ',tckaqb + print '(a,50e12.4)','heff ',heff(1,1,:) + print '(a,50i4)' ,'ice_uptake ',ice_uptake + print '(a,50f8.2)','mol_weight ',mol_weight(:) + print '(a,50f8.2)','temp ',temp(1,:) + print '(a,50f8.2)','p ',p (1,:) + end if +! +! call J. Neu's subroutine +! + do i=1,ncol +! + call washo(pver,gas_wetdep_cnt,delt,trc_mass(i,:,:),mass_in_layer(i,:),p(i,:),delz(i,:) & + ,rls(i,:),cldliq(i,:),cldice(i,:),cldfrc(i,:),temp(i,:),evaprate(i,:) & + ,area(i),heff(i,:,:),mol_weight(:),tckaqb(:),ice_uptake(:) & + ,qt_rain(i,:),qt_rime(i,:),qt_wash(i,:),qt_evap(i,:) ) +! + end do +! +! compute tendencies and convert back to mmr +! on original vertical grid +! + do k=1,pver + kk = pver - k + 1 + do i=1,ncol +! +! convert tracer mass from kg +! + wd_mmr(i,kk,:) = trc_mass(i,k,:) / mass_in_layer(i,k) +! + end do + end do +! +! tendency calculation (on model grid) +! + dtwr(1:ncol,:,:) = wd_mmr(1:ncol,:,:) - dtwr(1:ncol,:,:) + dtwr(1:ncol,:,:) = dtwr(1:ncol,:,:) / delt + +!!DEK polarward of 60S, 60N and <200hPa set to zero! + call get_rlat_all_p(lchnk, pcols, lats ) + do k = 1, pver + do i= 1, ncol + if ( abs( lats(i)*180._r8/pi ) > 60._r8 ) then + if ( pmid(i,k) < 20000._r8) then + dtwr(i,k,:) = 0._r8 + endif + endif + end do + end do +! +! output tendencies +! + do m=1,gas_wetdep_cnt + wd_tend(1:ncol,:,mapping_to_mmr(m)) = wd_tend(1:ncol,:,mapping_to_mmr(m)) + dtwr(1:ncol,:,m) + call outfld( 'DTWR_'//trim(gas_wetdep_list(m)),dtwr(:,:,m),ncol,lchnk ) + + call outfld( 'HEFF_'//trim(gas_wetdep_list(m)),heff(:,pver:1:-1,m),ncol,lchnk ) +! +! vertical integrated wet deposition rate [kg/m2/s] +! + wk_out = 0._r8 + do k=1,pver + kk = pver - k + 1 + wk_out(1:ncol) = wk_out(1:ncol) + (dtwr(1:ncol,k,m) * mass_in_layer(1:ncol,kk)/area(1:ncol)) + end do + call outfld( 'WD_'//trim(gas_wetdep_list(m)),wk_out,ncol,lchnk ) +! +! to be used in mo_chm_diags to compute wet_deposition_NOy_as_N and wet_deposition_NHx_as_N (units: kg/m2/s) +! + if ( debug) print *,'mo_neu ',mapping_to_mmr(m),(wk_out(1:ncol)) + wd_tend_int(1:ncol,mapping_to_mmr(m)) = wk_out(1:ncol) +! + end do +! + if ( do_diag ) then + call outfld('QT_RAIN_HNO3', qt_rain, ncol, lchnk ) + call outfld('QT_RIME_HNO3', qt_rime, ncol, lchnk ) + call outfld('QT_WASH_HNO3', qt_wash, ncol, lchnk ) + call outfld('QT_EVAP_HNO3', qt_evap, ncol, lchnk ) + end if +! + return +end subroutine neu_wetdep_tend + +!----------------------------------------------------------------------- +! +! Original code from Jessica Neu +! Updated by S. Walters and J.-F. Lamarque (March-April 2011) +! +!----------------------------------------------------------------------- + + subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & + RLS,CLWC,CIWC,CFR,TEM,EVAPRATE,GAREA,HSTAR,TCMASS,TCKAQB, & + TCNION, qt_rain, qt_rime, qt_wash, qt_evap) +! + implicit none + +!----------------------------------------------------------------------- +!---p-conde 5.4 (2007) -----called from main----- +!---called from pmain to calculate rainout and washout of tracers +!---revised by JNEU 8/2007 +!--- +!-LAER has been removed - no scavenging for aerosols +!-LAER could be used as LWASHTYP +!---WILL THIS WORK FOR T42->T21??????????? +!----------------------------------------------------------------------- + + integer LPAR, NTRACE + real(r8), intent(inout) :: QTTJFL(LPAR,NTRACE) + real(r8), intent(in) :: DTSCAV, QM(LPAR),POFL(LPAR),DELZ(LPAR),GAREA + real(r8), intent(in) :: RLS(LPAR),CLWC(LPAR),CIWC(LPAR),CFR(LPAR),TEM(LPAR), & + EVAPRATE(LPAR) + real(r8), intent(in) :: HSTAR(LPAR,NTRACE),TCMASS(NTRACE) + logical , intent(in) :: TCKAQB(NTRACE),TCNION(NTRACE) +! + real(r8), intent(inout) :: qt_rain(lpar) + real(r8), intent(inout) :: qt_rime(lpar) + real(r8), intent(inout) :: qt_wash(lpar) + real(r8), intent(inout) :: qt_evap(lpar) +! + integer I,J,L,N,LE, LM1 + real(r8), dimension(LPAR) :: CFXX + real(r8), dimension(LPAR) :: QTT, QTTNEW + + real(r8) WRK, RNEW_TST + real(r8) CLWX + real(r8) RNEW,RPRECIP,DELTARIMEMASS,DELTARIME,RAMPCT + real(r8) MASSLOSS + real(r8) DOR,DNEW,DEMP,COLEFFSNOW,RHOSNOW + real(r8) WEMP,REMP,RRAIN,RWASH + real(r8) QTPRECIP,QTRAIN,QTCXA,QTAX,QTOC + + real(r8) FAMA,RAMA,DAMA,FCA,RCA,DCA + real(r8) FAX,RAX,DAX,FCXA,RCXA,DCXA,FCXB,RCXB,DCXB + real(r8) RAXADJ,FAXADJ,RAXADJF + real(r8) QTDISCF,QTDISRIME,QTDISCXA + real(r8) QTEVAPAXP,QTEVAPAXW,QTEVAPAX + real(r8) QTWASHAX + real(r8) QTEVAPCXAP,QTEVAPCXAW,QTEVAPCXA + real(r8) QTWASHCXA,QTRIMECXA + real(r8) QTRAINCXA,QTRAINCXB + real(r8) QTTOPCA,QTTOPAA,QTTOPCAX,QTTOPAAX + + real(r8) AMPCT,AMCLPCT,CLNEWPCT,CLNEWAMPCT,CLOLDPCT,CLOLDAMPCT + real(r8) RAXLOC,RCXALOC,RCXBLOC,RCALOC,RAMALOC,RCXPCT + + real(r8) QTNETLCXA,QTNETLCXB,QTNETLAX,QTNETL + real(r8) QTDISSTAR + + + real(r8), parameter :: CFMIN=0.1_r8 + real(r8), parameter :: CWMIN=1.0e-5_r8 + real(r8), parameter :: DMIN=1.0e-1_r8 !mm + real(r8), parameter :: VOLPOW=1._r8/3._r8 + real(r8), parameter :: RHORAIN=1.0e3_r8 !kg/m3 + real(r8), parameter :: RHOSNOWFIX=1.0e2_r8 !kg/m3 + real(r8), parameter :: COLEFFRAIN=0.7_r8 + real(r8), parameter :: TMIX=258._r8 + real(r8), parameter :: TFROZ=240._r8 + real(r8), parameter :: COLEFFAER=0.05_r8 +! +! additional work arrays and diagnostics +! + real(r8) :: rls_wrk(lpar) + real(r8) :: rnew_wrk(lpar) + real(r8) :: rca_wrk(lpar) + real(r8) :: fca_wrk(lpar) + real(r8) :: rcxa_wrk(lpar) + real(r8) :: fcxa_wrk(lpar) + real(r8) :: rcxb_wrk(lpar) + real(r8) :: fcxb_wrk(lpar) + real(r8) :: rax_wrk(lpar,2) + real(r8) :: fax_wrk(lpar,2) + real(r8) :: rama_wrk(lpar) + real(r8) :: fama_wrk(lpar) + real(r8) :: deltarime_wrk(lpar) + real(r8) :: clwx_wrk(lpar) + real(r8) :: frc(lpar,3) + real(r8) :: rlsog(lpar) +! + logical :: is_hno3 + logical :: rls_flag(lpar) + logical :: rnew_flag(lpar) + logical :: cf_trigger(lpar) + logical :: freezing(lpar) +! + real(r8), parameter :: four = 4._r8 + real(r8), parameter :: adj_factor = one + 10._r8*epsilon( one ) +! + integer :: LWASHTYP,LICETYP +! + if ( debug ) then + print '(a,50f8.2)','tckaqb ',tckaqb + print '(a,50e12.4)','hstar ',hstar(1,:) + print '(a,50i4)' ,'ice_uptake ',TCNION + print '(a,50f8.2)','mol_weight ',TCMASS(:) + print '(a,50f8.2)','temp ',tem(:) + print '(a,50f8.2)','p ',pofl(:) + end if + +!----------------------------------------------------------------------- + LE = LPAR-1 +! + rls_flag(1:le) = rls(1:le) > zero + freezing(1:le) = tem(1:le) < tice + rlsog(1:le) = rls(1:le)/garea +! +species_loop : & + do N = 1,NTRACE + QTT(:lpar) = QTTJFL(:lpar,N) + QTTNEW(:lpar) = QTTJFL(:lpar,N) + is_hno3 = n == hno3_ndx + if( is_hno3 ) then + qt_rain(:lpar) = zero + qt_rime(:lpar) = zero + qt_wash(:lpar) = zero + qt_evap(:lpar) = zero + rca_wrk(:lpar) = zero + fca_wrk(:lpar) = zero + rcxa_wrk(:lpar) = zero + fcxa_wrk(:lpar) = zero + rcxb_wrk(:lpar) = zero + fcxb_wrk(:lpar) = zero + rls_wrk(:lpar) = zero + rnew_wrk(:lpar) = zero + cf_trigger(:lpar) = .false. + clwx_wrk(:lpar) = -9999._r8 + deltarime_wrk(:lpar) = -9999._r8 + rax_wrk(:lpar,:) = zero + fax_wrk(:lpar,:) = zero + endif + +!----------------------------------------------------------------------- +! check whether soluble in ice +!----------------------------------------------------------------------- + if( TCNION(N) ) then + LICETYP = 1 + else + LICETYP = 2 + end if + +!----------------------------------------------------------------------- +! initialization +!----------------------------------------------------------------------- + QTTOPAA = zero + QTTOPCA = zero + + RCA = zero + FCA = zero + DCA = zero + RAMA = zero + FAMA = zero + DAMA = zero + + AMPCT = zero + AMCLPCT = zero + CLNEWPCT = zero + CLNEWAMPCT = zero + CLOLDPCT = zero + CLOLDAMPCT = zero + + +!----------------------------------------------------------------------- +! Check whether precip in top layer - if so, require CF ge 0.2 +!----------------------------------------------------------------------- + if( RLS(LE) > zero ) then + CFXX(LE) = max( CFMIN,CFR(LE) ) + else + CFXX(LE) = CFR(LE) + endif + + rnew_flag(1:le) = .false. + +level_loop : & + do L = LE,1,-1 + LM1 = L - 1 + FAX = zero + RAX = zero + DAX = zero + FCXA = zero + FCXB = zero + DCXA = zero + DCXB = zero + RCXA = zero + RCXB = zero + + QTDISCF = zero + QTDISRIME = zero + QTDISCXA = zero + + QTEVAPAXP = zero + QTEVAPAXW = zero + QTEVAPAX = zero + QTWASHAX = zero + + QTEVAPCXAP = zero + QTEVAPCXAW = zero + QTEVAPCXA = zero + QTRIMECXA = zero + QTWASHCXA = zero + QTRAINCXA = zero + QTRAINCXB = zero + + RAMPCT = zero + RCXPCT = zero + + RCXALOC = zero + RCXBLOC = zero + RAXLOC = zero + RAMALOC = zero + RCALOC = zero + + RPRECIP = zero + DELTARIMEMASS = zero + DELTARIME = zero + DOR = zero + DNEW = zero + + QTTOPAAX = zero + QTTOPCAX = zero + +has_rls : & + if( rls_flag(l) ) then +!----------------------------------------------------------------------- +!-----Evaporate ambient precip and decrease area------------------------- +!-----If ice, diam=diam falling from above If rain, diam=4mm (not used) +!-----Evaporate tracer contained in evaporated precip +!-----Can't evaporate more than we start with----------------------------- +!-----Don't do washout until we adjust ambient precip to match Rbot if needed +!------(after RNEW if statements) +!----------------------------------------------------------------------- + FAX = max( zero,FAMA*(one - evaprate(l)) ) + RAX = RAMA !kg/m2/s + if ( debug ) then + if( (l == 3 .or. l == 2) ) then + write(*,*) 'washout: l,rls,fax = ',l,rls(l),fax + endif + endif + if( FAMA > zero ) then + if( freezing(l) ) then + DAX = DAMA !mm + else + DAX = four !mm - not necessary + endif + else + DAX = zero + endif + + if( RAMA > zero ) then + QTEVAPAXP = min( QTTOPAA,EVAPRATE(L)*QTTOPAA ) + else + QTEVAPAXP = zero + endif + if( is_hno3 ) then + rax_wrk(l,1) = rax + fax_wrk(l,1) = fax + endif + + +!----------------------------------------------------------------------- +! Determine how much the in-cloud precip rate has increased------ +!----------------------------------------------------------------------- + WRK = RAX*FAX + RCA*FCA + if( WRK > 0._r8 ) then + RNEW_TST = RLS(L)/(GAREA * WRK) + else + RNEW_TST = 10._r8 + endif + RNEW = RLSOG(L) - (RAX*FAX + RCA*FCA) !GBA*CF + rnew_wrk(l) = rnew_tst + if ( debug ) then + if( is_hno3 .and. l == kdiag-1 ) then + write(*,*) ' ' + write(*,*) 'washout: rls,rax,fax,rca,fca' + write(*,'(1p,5g15.7)') rls(l),rax,fax,rca,fca + write(*,*) ' ' + endif + endif +!----------------------------------------------------------------------- +! if RNEW>0, there is growth and/or new precip formation +!----------------------------------------------------------------------- +has_rnew: if( rlsog(l) > adj_factor*(rax*fax + rca*fca) ) then +!----------------------------------------------------------------------- +! Min cloudwater requirement for cloud with new precip +! Min CF is set at top for LE, at end for other levels +! CWMIN is only needed for new precip formation - do not need for RNEW<0 +!----------------------------------------------------------------------- + if( cfxx(l) == zero ) then + if ( do_diag ) then + write(*,*) 'cfxx(l) == zero',l + write(*,*) qttjfl(:,n) + write(*,*) qm(:) + write(*,*) pofl(:) + write(*,*) delz(:) + write(*,*) rls(:) + write(*,*) clwc(:) + write(*,*) ciwc(:) + write(*,*) cfr(:) + write(*,*) tem(:) + write(*,*) evaprate(:) + write(*,*) hstar(:,n) + end if +! +! if we are here,, that means that there is +! a inconsistency and this will lead to a division +! by 0 later on! This column should then be skipped +! + QTTJFL(:lpar,n) = QTT(:lpar) + cycle species_loop +! +! call endrun() +! + endif + rnew_flag(l) = .true. + CLWX = max( CLWC(L)+CIWC(L),CWMIN*CFXX(L) ) + if( is_hno3 ) then + clwx_wrk(l) = clwx + endif +!----------------------------------------------------------------------- +! Area of old cloud and new cloud +!----------------------------------------------------------------------- + FCXA = FCA + FCXB = max( zero,CFXX(L)-FCXA ) +!----------------------------------------------------------------------- +! ICE +! For ice and mixed phase, grow precip in old cloud by riming +! Use only portion of cloudwater in old cloud fraction +! and rain above old cloud fraction +! COLEFF from Lohmann and Roeckner (1996), Loss rate from Rotstayn (1997) +!----------------------------------------------------------------------- +is_freezing : & + if( freezing(l) ) then + COLEFFSNOW = exp( 2.5e-2_r8*(TEM(L) - TICE) ) + if( TEM(L) <= TFROZ ) then + RHOSNOW = RHOSNOWFIX + else + RHOSNOW = 0.303_r8*(TEM(L) - TFROZ)*RHOSNOWFIX + endif + if( FCXA > zero ) then + if( DCA > zero ) then + DELTARIMEMASS = CLWX*QM(L)*(FCXA/CFXX(L))* & + (one - exp( (-COLEFFSNOW/(DCA*1.e-3_r8))*((RCA)/(2._r8*RHOSNOW))*DTSCAV )) !uses GBA R + else + DELTARIMEMASS = zero + endif + else + DELTARIMEMASS = zero + endif +!----------------------------------------------------------------------- +! Increase in precip rate due to riming (kg/m2/s): +! Limit to total increase in R in cloud +!----------------------------------------------------------------------- + if( FCXA > zero ) then + DELTARIME = min( RNEW/FCXA,DELTARIMEMASS/(FCXA*GAREA*DTSCAV) ) !GBA + else + DELTARIME = zero + endif + if( is_hno3 ) then + deltarime_wrk(l) = deltarime + endif +!----------------------------------------------------------------------- +! Find diameter of rimed precip, must be at least .1mm +!----------------------------------------------------------------------- + if( RCA > zero ) then + DOR = max( DMIN,(((RCA+DELTARIME)/RCA)**VOLPOW)*DCA ) + else + DOR = zero + endif +!----------------------------------------------------------------------- +! If there is some in-cloud precip left, we have new precip formation +! Will be spread over whole cloud fraction +!----------------------------------------------------------------------- +! Calculate precip rate in old and new cloud fractions +!----------------------------------------------------------------------- + RPRECIP = (RNEW-(DELTARIME*FCXA))/CFXX(L) !kg/m2/s !GBA +!----------------------------------------------------------------------- +! Calculate precip rate in old and new cloud fractions +!----------------------------------------------------------------------- + RCXA = RCA + DELTARIME + RPRECIP !kg/m2/s GBA + RCXB = RPRECIP !kg/m2/s GBA + +!----------------------------------------------------------------------- +! Find diameter of new precip from empirical relation using Rprecip +! in given area of box- use density of water, not snow, to convert kg/s +! to mm/s -> as given in Field and Heymsfield +! Also calculate diameter of mixed precip,DCXA, from empirical relation +! using total R in FCXA - this will give larger particles than averaging DOR and +! DNEW in the next level +! DNEW and DCXA must be at least .1mm +!----------------------------------------------------------------------- + if( RPRECIP > zero ) then + WEMP = (CLWX*QM(L))/(GAREA*CFXX(L)*DELZ(L)) !kg/m3 + REMP = RPRECIP/((RHORAIN/1.e3_r8)) !mm/s local + DNEW = DEMPIRICAL( WEMP, REMP ) + if ( debug ) then + if( is_hno3 .and. l >= 15 ) then + write(*,*) ' ' + write(*,*) 'washout: wemp,remp.dnew @ l = ',l + write(*,'(1p,3g15.7)') wemp,remp,dnew + write(*,*) ' ' + endif + endif + DNEW = max( DMIN,DNEW ) + if( FCXB > zero ) then + DCXB = DNEW + else + DCXB = zero + endif + else + DCXB = zero + endif + + if( FCXA > zero ) then + WEMP = (CLWX*QM(L)*(FCXA/CFXX(L)))/(GAREA*FCXA*DELZ(L)) !kg/m3 + REMP = RCXA/((RHORAIN/1.e3_r8)) !mm/s local + DEMP = DEMPIRICAL( WEMP, REMP ) + DCXA = ((RCA+DELTARIME)/RCXA)*DOR + (RPRECIP/RCXA)*DNEW + DCXA = max( DEMP,DCXA ) + DCXA = max( DMIN,DCXA ) + else + WEMP = zero + REMP = zero + DEMP = zero + DCXA = zero + endif + if ( debug ) then + if( is_hno3 .and. l >= 15 ) then + write(*,*) ' ' + write(*,*) 'washout: rca,rcxa,deltarime,dor,rprecip,dnew @ l = ',l + write(*,'(1p,6g15.7)') rca,rcxa,deltarime,dor,rprecip,dnew + write(*,*) 'washout: dcxa,dcxb,wemp,remp,demp' + write(*,'(1p,5g15.7)') dcxa,dcxb,wemp,remp,demp + write(*,*) ' ' + end if + endif + + if( QTT(L) > zero ) then +!----------------------------------------------------------------------- +! ICE SCAVENGING +!----------------------------------------------------------------------- +! For ice, rainout only hno3/aerosols using new precip +! Tracer dissolved given by Kaercher and Voigt (2006) for T<258K +! For T>258K, use Henry's Law with Retention coefficient +! Rain out in whole CF +!----------------------------------------------------------------------- + if( RPRECIP > zero ) then + if( LICETYP == 1 ) then + RRAIN = RPRECIP*GAREA !kg/s local + call DISGAS( CLWX, CFXX(L), TCMASS(N), HSTAR(L,N), & + TEM(L),POFL(L),QM(L), & + QTT(L)*CFXX(L),QTDISCF ) + call RAINGAS( RRAIN, DTSCAV, CLWX, CFXX(L), & + QM(L), QTT(L), QTDISCF, QTRAIN ) + WRK = QTRAIN/CFXX(L) + QTRAINCXA = FCXA*WRK + QTRAINCXB = FCXB*WRK + elseif( LICETYP == 2 ) then + QTRAINCXA = zero + QTRAINCXB = zero + endif + if( debug .and. is_hno3 .and. l == kdiag ) then + write(*,*) ' ' + write(*,*) 'washout: Ice Scavenging' + write(*,*) 'washout: qtraincxa, qtraincxb, fcxa, fcxb, qt_rain, cfxx(l), wrk @ level = ',l + write(*,'(1p,7g15.7)') qtraincxa, qtraincxb, fcxa, fcxb, qt_rain(l), cfxx(l), wrk + write(*,*) ' ' + endif + endif +!----------------------------------------------------------------------- +! For ice, accretion removal for hno3 and aerosols is propotional to riming, +! no accretion removal for gases +! remove only in mixed portion of cloud +! Limit DELTARIMEMASS to RNEW*DTSCAV for ice - evaporation of rimed ice to match +! RNEW precip rate would result in HNO3 escaping from ice (no trapping) +!----------------------------------------------------------------------- + if( DELTARIME > zero ) then + if( LICETYP == 1 ) then + if( TEM(L) <= TFROZ ) then + RHOSNOW = RHOSNOWFIX + else + RHOSNOW = 0.303_r8*(TEM(L) - TFROZ)*RHOSNOWFIX + endif + QTCXA = QTT(L)*FCXA + call DISGAS( CLWX*(FCXA/CFXX(L)), FCXA, TCMASS(N), & + HSTAR(L,N), TEM(L), POFL(L), & + QM(L), QTCXA, QTDISRIME ) + QTDISSTAR = (QTDISRIME*QTCXA)/(QTDISRIME + QTCXA) + if ( debug ) then + if( is_hno3 .and. l >= 15 ) then + write(*,*) ' ' + write(*,*) 'washout: fcxa,dca,rca,qtdisstar @ l = ',l + write(*,'(1p,4g15.7)') fcxa,dca,rca,qtdisstar + write(*,*) ' ' + endif + endif + QTRIMECXA = QTCXA* & + (one - exp((-COLEFFSNOW/(DCA*1.e-3_r8))* & + (RCA/(2._r8*RHOSNOW))* & !uses GBA R + (QTDISSTAR/QTCXA)*DTSCAV)) + QTRIMECXA = min( QTRIMECXA, & + ((RNEW*GAREA*DTSCAV)/(CLWX*QM(L)*(FCXA/CFXX(L))))*QTDISSTAR) + elseif( LICETYP == 2 ) then + QTRIMECXA = zero + endif + endif + else + QTRAINCXA = zero + QTRAINCXB = zero + QTRIMECXA = zero + endif +!----------------------------------------------------------------------- +! For ice, no washout in interstitial cloud air +!----------------------------------------------------------------------- + QTWASHCXA = zero + QTEVAPCXA = zero + +!----------------------------------------------------------------------- +! RAIN +! For rain, accretion increases rain rate but diameter remains constant +! Diameter is 4mm (not used) +!----------------------------------------------------------------------- + else is_freezing + if( FCXA > zero ) then + DELTARIMEMASS = (CLWX*QM(L))*(FCXA/CFXX(L))* & + (one - exp( -0.24_r8*COLEFFRAIN*((RCA)**0.75_r8)*DTSCAV )) !local + else + DELTARIMEMASS = zero + endif +!----------------------------------------------------------------------- +! Increase in precip rate due to riming (kg/m2/s): +! Limit to total increase in R in cloud +!----------------------------------------------------------------------- + if( FCXA > zero ) then + DELTARIME = min( RNEW/FCXA,DELTARIMEMASS/(FCXA*GAREA*DTSCAV) ) !GBA + else + DELTARIME = zero + endif +!----------------------------------------------------------------------- +! If there is some in-cloud precip left, we have new precip formation +!----------------------------------------------------------------------- + RPRECIP = (RNEW-(DELTARIME*FCXA))/CFXX(L) !GBA + + RCXA = RCA + DELTARIME + RPRECIP !kg/m2/s GBA + RCXB = RPRECIP !kg/m2/s GBA + DCXA = FOUR + if( FCXB > zero ) then + DCXB = FOUR + else + DCXB = zero + endif +!----------------------------------------------------------------------- +! RAIN SCAVENGING +! For rain, rainout both hno3/aerosols and gases using new precip +!----------------------------------------------------------------------- + if( QTT(L) > zero ) then + if( RPRECIP > zero ) then + RRAIN = (RPRECIP*GAREA) !kg/s local + call DISGAS( CLWX, CFXX(L), TCMASS(N), HSTAR(L,N), & + TEM(L), POFL(L), QM(L), & + QTT(L)*CFXX(L), QTDISCF ) + call RAINGAS( RRAIN, DTSCAV, CLWX, CFXX(L), & + QM(L), QTT(L), QTDISCF, QTRAIN ) + WRK = QTRAIN/CFXX(L) + QTRAINCXA = FCXA*WRK + QTRAINCXB = FCXB*WRK + if( debug .and. is_hno3 .and. l == kdiag ) then + write(*,*) ' ' + write(*,*) 'washout: Rain Scavenging' + write(*,*) 'washout: qtraincxa, qtraincxb, fcxa, fcxb, qt_rain, cfxx(l), wrk @ level = ',l + write(*,'(1p,7g15.7)') qtraincxa, qtraincxb, fcxa, fcxb, qt_rain(l), cfxx(l), wrk + write(*,*) ' ' + endif + endif +!----------------------------------------------------------------------- +! For rain, accretion removal is propotional to riming +! caclulate for hno3/aerosols and gases +! Remove only in mixed portion of cloud +! Limit DELTARIMEMASS to RNEW*DTSCAV +!----------------------------------------------------------------------- + if( DELTARIME > zero ) then + QTCXA = QTT(L)*FCXA + call DISGAS( CLWX*(FCXA/CFXX(L)), FCXA, TCMASS(N), & + HSTAR(L,N), TEM(L), POFL(L), & + QM(L), QTCXA, QTDISRIME ) + QTDISSTAR = (QTDISRIME*QTCXA)/(QTDISRIME + QTCXA) + QTRIMECXA = QTCXA* & + (one - exp(-0.24_r8*COLEFFRAIN* & + ((RCA)**0.75_r8)* & !local + (QTDISSTAR/QTCXA)*DTSCAV)) + QTRIMECXA = min( QTRIMECXA, & + ((RNEW*GAREA*DTSCAV)/(CLWX*QM(L)*(FCXA/CFXX(L))))*QTDISSTAR) + else + QTRIMECXA = zero + endif + else + QTRAINCXA = zero + QTRAINCXB = zero + QTRIMECXA = zero + endif +!----------------------------------------------------------------------- +! For rain, washout gases and HNO3/aerosols using rain from above old cloud +! Washout for HNO3/aerosols is only on non-dissolved portion, impaction-style +! Washout for gases is on non-dissolved portion, limited by QTTOP+QTRIME +!----------------------------------------------------------------------- + if( RCA > zero ) then + QTPRECIP = FCXA*QTT(L) - QTDISRIME + if( HSTAR(L,N) > 1.e4_r8 ) then + if( QTPRECIP > zero ) then + QTWASHCXA = QTPRECIP*(one - exp( -0.24_r8*COLEFFAER*((RCA)**0.75_r8)*DTSCAV )) !local + else + QTWASHCXA = zero + endif + QTEVAPCXA = zero + else + RWASH = RCA*GAREA !kg/s local + if( QTPRECIP > zero ) then + call WASHGAS( RWASH, FCA, DTSCAV, QTTOPCA+QTRIMECXA, & + HSTAR(L,N), TEM(L), POFL(L), & + QM(L), QTPRECIP, QTWASHCXA, QTEVAPCXA ) + else + QTWASHCXA = zero + QTEVAPCXA = zero + endif + endif + endif + endif is_freezing +!----------------------------------------------------------------------- +! If RNEW zero ) then + RCXA = min( RCA,RLS(L)/(GAREA*FCXA) ) !kg/m2/s GBA + if( FAX > zero .and. ((RCXA+1.e-12_r8) < RLS(L)/(GAREA*FCXA)) ) then + RAXADJF = RLS(L)/GAREA - RCXA*FCXA + RAMPCT = RAXADJF/(RAX*FAX) + FAXADJ = RAMPCT*FAX + if( FAXADJ > zero ) then + RAXADJ = RAXADJF/FAXADJ + else + RAXADJ = zero + endif + else + RAXADJ = zero + RAMPCT = zero + FAXADJ = zero + endif + else + RCXA = zero + if( FAX > zero ) then + RAXADJF = RLS(L)/GAREA + RAMPCT = RAXADJF/(RAX*FAX) + FAXADJ = RAMPCT*FAX + if( FAXADJ > zero ) then + RAXADJ = RAXADJF/FAXADJ + else + RAXADJ = zero + endif + else + RAXADJ = zero + RAMPCT = zero + FAXADJ = zero + endif + endif + + QTEVAPAXP = min( QTTOPAA,QTTOPAA - (RAMPCT*(QTTOPAA-QTEVAPAXP)) ) + FAX = FAXADJ + RAX = RAXADJ + if ( debug ) then + if( (l == 3 .or. l == 2) ) then + write(*,*) 'washout: l,fcxa,fax = ',l,fcxa,fax + endif + endif + +!----------------------------------------------------------------------- +! IN-CLOUD EVAPORATION/WASHOUT +! If precip out the bottom of the cloud is 0, evaporate everything +! If there is no cloud, QTTOPCA=0, so nothing happens +!----------------------------------------------------------------------- + if( RCXA <= zero ) then + QTEVAPCXA = QTTOPCA + RCXA = zero + DCXA = zero + else +!----------------------------------------------------------------------- +! If rain out the bottom of the cloud is >0 (but .le. RCA): +! For ice, decrease particle size, +! no washout +! no evap for non-ice gases (b/c there is nothing in ice) +! TTmix, hno3&aerosols are incorporated into ice structure: +! do not release +! For rain, assume full evaporation of some raindrops +! proportional evaporation for all species +! washout for gases using Rbot +! impact washout for hno3/aerosol portion in gas phase +!----------------------------------------------------------------------- +! if (TEM(L) < TICE ) then +is_freezing_a : & + if( freezing(l) ) then + QTWASHCXA = zero + DCXA = ((RCXA/RCA)**VOLPOW)*DCA + if( LICETYP == 1 ) then + if( TEM(L) <= TMIX ) then + MASSLOSS = (RCA-RCXA)*FCXA*GAREA*DTSCAV +!----------------------------------------------------------------------- +! note-QTT doesn't matter b/c T<258K +!----------------------------------------------------------------------- + call DISGAS( (MASSLOSS/QM(L)), FCXA, TCMASS(N), & + HSTAR(L,N), TEM(L), POFL(L), & + QM(L), QTT(L), QTEVAPCXA ) + QTEVAPCXA = min( QTTOPCA,QTEVAPCXA ) + else + QTEVAPCXA = zero + endif + elseif( LICETYP == 2 ) then + QTEVAPCXA = zero + endif + else is_freezing_a + QTEVAPCXAP = (RCA - RCXA)/RCA*QTTOPCA + DCXA = FOUR + QTCXA = FCXA*QTT(L) + if( HSTAR(L,N) > 1.e4_r8 ) then + if( QTT(L) > zero ) then + call DISGAS( CLWX*(FCXA/CFXX(L)), FCXA, TCMASS(N), & + HSTAR(L,N), TEM(L), POFL(L), & + QM(L), QTCXA, QTDISCXA ) + if( QTCXA > QTDISCXA ) then + QTWASHCXA = (QTCXA - QTDISCXA)*(one - exp( -0.24_r8*COLEFFAER*((RCXA)**0.75_r8)*DTSCAV )) !local + else + QTWASHCXA = zero + endif + QTEVAPCXAW = zero + else + QTWASHCXA = zero + QTEVAPCXAW = zero + endif + else + RWASH = RCXA*GAREA !kg/s local + call WASHGAS( RWASH, FCXA, DTSCAV, QTTOPCA, HSTAR(L,N), & + TEM(L), POFL(L), QM(L), & + QTCXA-QTDISCXA, QTWASHCXA, QTEVAPCXAW ) + endif + QTEVAPCXA = QTEVAPCXAP + QTEVAPCXAW + endif is_freezing_a + endif + endif has_rnew + +!----------------------------------------------------------------------- +! AMBIENT WASHOUT +! Ambient precip is finalized - if it is rain, washout +! no ambient washout for ice, since gases are in vapor phase +!----------------------------------------------------------------------- + if( RAX > zero ) then + if( .not. freezing(l) ) then + QTAX = FAX*QTT(L) + if( HSTAR(L,N) > 1.e4_r8 ) then + QTWASHAX = QTAX* & + (one - exp(-0.24_r8*COLEFFAER* & + ((RAX)**0.75_r8)*DTSCAV)) !local + QTEVAPAXW = zero + else + RWASH = RAX*GAREA !kg/s local + call WASHGAS( RWASH, FAX, DTSCAV, QTTOPAA, HSTAR(L,N), & + TEM(L), POFL(L), QM(L), QTAX, & + QTWASHAX, QTEVAPAXW ) + endif + else + QTEVAPAXW = zero + QTWASHAX = zero + endif + else + QTEVAPAXW = zero + QTWASHAX = zero + endif + QTEVAPAX = QTEVAPAXP + QTEVAPAXW + +!----------------------------------------------------------------------- +! END SCAVENGING +! Require CF if our ambient evaporation rate would give less +! precip than R from model. +!----------------------------------------------------------------------- + if( do_diag .and. is_hno3 ) then + rls_wrk(l) = rls(l)/garea + rca_wrk(l) = rca + fca_wrk(l) = fca + rcxa_wrk(l) = rcxa + fcxa_wrk(l) = fcxa + rcxb_wrk(l) = rcxb + fcxb_wrk(l) = fcxb + rax_wrk(l,2) = rax + fax_wrk(l,2) = fax + endif +upper_level : & + if( L > 1 ) then + FAMA = max( FCXA + FCXB + FAX - CFR(LM1),zero ) + if( FAX > zero ) then + RAXLOC = RAX/FAX + else + RAXLOC = zero + endif + if( FCXA > zero ) then + RCXALOC = RCXA/FCXA + else + RCXALOC = zero + endif + if( FCXB > zero ) then + RCXBLOC = RCXB/FCXB + else + RCXBLOC = zero + endif + + if( CFR(LM1) >= CFMIN ) then + CFXX(LM1) = CFR(LM1) + else + if( adj_factor*RLSOG(LM1) >= (RCXA*FCXA + RCXB*FCXB + RAX*FAX)*(one - EVAPRATE(LM1)) ) then + CFXX(LM1) = CFMIN + cf_trigger(lm1) = .true. + else + CFXX(LM1) = CFR(LM1) + endif + if( is_hno3 .and. lm1 == kdiag .and. debug ) then + write(*,*) ' ' + write(*,*) 'washout: rls,garea,rcxa,fcxa,rcxb,fcxb,rax,fax' + write(*,'(1p,8g15.7)') rls(lm1),garea,rcxa,fcxa,rcxb,fcxb,rax,fax + write(*,*) ' ' + endif + endif +!----------------------------------------------------------------------- +! Figure out what will go into ambient and cloud below +! Don't do for lowest level +!----------------------------------------------------------------------- + if( FAX > zero ) then + RAXLOC = RAX/FAX + AMPCT = max( zero,min( one,(CFXX(L) + FAX - CFXX(LM1))/FAX ) ) + AMCLPCT = one - AMPCT + else + RAXLOC = zero + AMPCT = zero + AMCLPCT = zero + endif + if( FCXB > zero ) then + RCXBLOC = RCXB/FCXB + CLNEWPCT = max( zero,min( (CFXX(LM1) - FCXA)/FCXB,one ) ) + CLNEWAMPCT = one - CLNEWPCT + else + RCXBLOC = zero + CLNEWPCT = zero + CLNEWAMPCT = zero + endif + if( FCXA > zero ) then + RCXALOC = RCXA/FCXA + CLOLDPCT = max( zero,min( CFXX(LM1)/FCXA,one ) ) + CLOLDAMPCT = one - CLOLDPCT + else + RCXALOC = zero + CLOLDPCT = zero + CLOLDAMPCT = zero + endif +!----------------------------------------------------------------------- +! Remix everything for the next level +!----------------------------------------------------------------------- + FCA = min( CFXX(LM1),FCXA*CLOLDPCT + CLNEWPCT*FCXB + AMCLPCT*FAX ) + if( FCA > zero ) then +!----------------------------------------------------------------------- +! Maintain cloud core by reducing NC and AM area going into cloud below +!----------------------------------------------------------------------- + RCA = (RCXA*FCXA*CLOLDPCT + RCXB*FCXB*CLNEWPCT + RAX*FAX*AMCLPCT)/FCA + if ( debug ) then + if( is_hno3 ) then + write(*,*) ' ' + write(*,*) 'washout: rcxa,fcxa,cloldpctrca,rca,fca,dcxa @ l = ',l + write(*,'(1p,6g15.7)') rcxa,fcxa,cloldpct,rca,fca,dcxa + write(*,*) 'washout: rcxb,fcxb,clnewpct,dcxb' + write(*,'(1p,4g15.7)') rcxb,fcxb,clnewpct,dcxb + write(*,*) 'washout: rax,fax,amclpct,dax' + write(*,'(1p,4g15.7)') rax,fax,amclpct,dax + write(*,*) ' ' + endif + endif + + if (RCA > zero) then + DCA = (RCXA*FCXA*CLOLDPCT)/(RCA*FCA)*DCXA + & + (RCXB*FCXB*CLNEWPCT)/(RCA*FCA)*DCXB + & + (RAX*FAX*AMCLPCT)/(RCA*FCA)*DAX + else + DCA = zero + FCA = zero + endif + + else + FCA = zero + DCA = zero + RCA = zero + endif + + FAMA = FCXA + FCXB + FAX - CFXX(LM1) + if( FAMA > zero ) then + RAMA = (RCXA*FCXA*CLOLDAMPCT + RCXB*FCXB*CLNEWAMPCT + RAX*FAX*AMPCT)/FAMA + if( RAMA > zero ) then + DAMA = (RCXA*FCXA*CLOLDAMPCT)/(RAMA*FAMA)*DCXA + & + (RCXB*FCXB*CLNEWAMPCT)/(RAMA*FAMA)*DCXB + & + (RAX*FAX*AMPCT)/(RAMA*FAMA)*DAX + else + FAMA = zero + DAMA = zero + endif + else + FAMA = zero + DAMA = zero + RAMA = zero + endif + else upper_level + AMPCT = zero + AMCLPCT = zero + CLNEWPCT = zero + CLNEWAMPCT = zero + CLOLDPCT = zero + CLOLDAMPCT = zero + endif upper_level + else has_rls + RNEW = zero + QTEVAPCXA = QTTOPCA + QTEVAPAX = QTTOPAA + if( L > 1 ) then + if( RLS(LM1) > zero ) then + CFXX(LM1) = max( CFMIN,CFR(LM1) ) +! if( CFR(LM1) >= CFMIN ) then +! CFXX(LM1) = CFR(LM1) +! else +! CFXX(LM1) = CFMIN +! endif + else + CFXX(LM1) = CFR(LM1) + endif + endif + AMPCT = zero + AMCLPCT = zero + CLNEWPCT = zero + CLNEWAMPCT = zero + CLOLDPCT = zero + CLOLDAMPCT = zero + RCA = zero + RAMA = zero + FCA = zero + FAMA = zero + DCA = zero + DAMA = zero + endif has_rls + + if( do_diag .and. is_hno3 ) then + fama_wrk(l) = fama + rama_wrk(l) = rama + endif +!----------------------------------------------------------------------- +! Net loss can not exceed QTT in each region +!----------------------------------------------------------------------- + QTNETLCXA = QTRAINCXA + QTRIMECXA + QTWASHCXA - QTEVAPCXA + QTNETLCXA = min( QTT(L)*FCXA,QTNETLCXA ) + + QTNETLCXB =QTRAINCXB + QTNETLCXB = min( QTT(L)*FCXB,QTNETLCXB ) + + QTNETLAX = QTWASHAX - QTEVAPAX + QTNETLAX = min( QTT(L)*FAX,QTNETLAX ) + + QTTNEW(L) = QTT(L) - (QTNETLCXA + QTNETLCXB + QTNETLAX) + + if( do_diag .and. is_hno3 ) then + qt_rain(l) = qtraincxa + qtraincxb + qt_rime(l) = qtrimecxa + qt_wash(l) = qtwashcxa + qtwashax + qt_evap(l) = qtevapcxa + qtevapax + frc(l,1) = qtnetlcxa + frc(l,2) = qtnetlcxb + frc(l,3) = qtnetlax + endif + if( debug .and. is_hno3 .and. l == kdiag ) then + write(*,*) ' ' + write(*,*) 'washout: qtraincxa, qtraincxb, qtrimecxa @ level = ',l + write(*,'(1p,3g15.7)') qtraincxa, qtraincxb, qtrimecxa + write(*,*) ' ' + endif + if ( debug ) then + if( (l == 3 .or. l == 2) ) then + write(*,*) 'washout: hno3, hno3, qtnetlca,b, qtnetlax @ level = ',l + write(*,'(1p,5g15.7)') qttnew(l), qtt(l), qtnetlcxa, qtnetlcxb, qtnetlax + write(*,*) 'washout: qtwashax, qtevapax,fax,fama' + write(*,'(1p,5g15.7)') qtwashax, qtevapax, fax, fama + endif + endif + + QTTOPCAX = (QTTOPCA + QTNETLCXA)*CLOLDPCT + QTNETLCXB*CLNEWPCT + (QTTOPAA + QTNETLAX)*AMCLPCT + QTTOPAAX = (QTTOPCA + QTNETLCXA)*CLOLDAMPCT + QTNETLCXB*CLNEWAMPCT + (QTTOPAA + QTNETLAX)*AMPCT + QTTOPCA = QTTOPCAX + QTTOPAA = QTTOPAAX + end do level_loop + + if ( debug ) then + if( is_hno3 ) then + write(*,*) ' ' + write(*,*) 'washout: clwx_wrk' + write(*,'(1p,5g15.7)') clwx_wrk(1:le) + write(*,*) 'washout: cfr' + write(*,'(1p,5g15.7)') cfr(1:le) + write(*,*) 'washout: cfxx' + write(*,'(1p,5g15.7)') cfxx(1:le) + write(*,*) 'washout: cf trigger' + write(*,'(10l4)') cf_trigger(1:le) + write(*,*) 'washout: evaprate' + write(*,'(1p,5g15.7)') evaprate(1:le) + write(*,*) 'washout: rls' + write(*,'(1p,5g15.7)') rls(1:le) + write(*,*) 'washout: rls/garea' + write(*,'(1p,5g15.7)') rls_wrk(1:le) + write(*,*) 'washout: rnew_wrk' + write(*,'(1p,5g15.7)') rnew_wrk(1:le) + write(*,*) 'washout: rnew_flag' + write(*,'(10l4)') rnew_flag(1:le) + write(*,*) 'washout: deltarime_wrk' + write(*,'(1p,5g15.7)') deltarime_wrk(1:le) + write(*,*) 'washout: rama_wrk' + write(*,'(1p,5g15.7)') rama_wrk(1:le) + write(*,*) 'washout: fama_wrk' + write(*,'(1p,5g15.7)') fama_wrk(1:le) + write(*,*) 'washout: rca_wrk' + write(*,'(1p,5g15.7)') rca_wrk(1:le) + write(*,*) 'washout: fca_wrk' + write(*,'(1p,5g15.7)') fca_wrk(1:le) + write(*,*) 'washout: rcxa_wrk' + write(*,'(1p,5g15.7)') rcxa_wrk(1:le) + write(*,*) 'washout: fcxa_wrk' + write(*,'(1p,5g15.7)') fcxa_wrk(1:le) + write(*,*) 'washout: rcxb_wrk' + write(*,'(1p,5g15.7)') rcxb_wrk(1:le) + write(*,*) 'washout: fcxb_wrk' + write(*,'(1p,5g15.7)') fcxb_wrk(1:le) + write(*,*) 'washout: rax1_wrk' + write(*,'(1p,5g15.7)') rax_wrk(1:le,1) + write(*,*) 'washout: fax1_wrk' + write(*,'(1p,5g15.7)') fax_wrk(1:le,1) + write(*,*) 'washout: rax2_wrk' + write(*,'(1p,5g15.7)') rax_wrk(1:le,2) + write(*,*) 'washout: fax2_wrk' + write(*,'(1p,5g15.7)') fax_wrk(1:le,2) + write(*,*) 'washout: rls_flag' + write(*,'(1p,10l4)') rls_flag(1:le) + write(*,*) 'washout: freezing' + write(*,'(1p,10l4)') freezing(1:le) + write(*,*) 'washout: qtnetlcxa' + write(*,'(1p,5g15.7)') frc(1:le,1) + write(*,*) 'washout: qtnetlcxb' + write(*,'(1p,5g15.7)') frc(1:le,2) + write(*,*) 'washout: qtnetlax' + write(*,'(1p,5g15.7)') frc(1:le,3) + write(*,*) ' ' + endif + endif +!----------------------------------------------------------------------- +! reload new tracer mass and rescale moments: check upper limits (LE) +!----------------------------------------------------------------------- + QTTJFL(:le,N) = QTTNEW(:le) + + end do species_loop +! + return + end subroutine washo +!--------------------------------------------------------------------- + subroutine DISGAS (CLWX,CFX,MOLMASS,HSTAR,TM,PR,QM,QT,QTDIS) +!--------------------------------------------------------------------- + implicit none + real(r8), intent(in) :: CLWX,CFX !cloud water,cloud fraction + real(r8), intent(in) :: MOLMASS !molecular mass of tracer + real(r8), intent(in) :: HSTAR !Henry's Law coeffs A*exp(-B/T) + real(r8), intent(in) :: TM !temperature of box (K) + real(r8), intent(in) :: PR !pressure of box (hPa) + real(r8), intent(in) :: QM !air mass in box (kg) + real(r8), intent(in) :: QT !tracer in box (kg) + real(r8), intent(out) :: QTDIS !tracer dissolved in aqueous phase + + real(r8) MUEMP + real(r8), parameter :: INV298 = 1._r8/298._r8 + real(r8), parameter :: TMIX=258._r8 + real(r8), parameter :: RETEFF=0.5_r8 +!---Next calculate rate of uptake of tracer + +!---effective Henry's Law constant: H* = moles-T / liter-precip / press(atm-T) +!---p(atm of tracer-T) = (QT/QM) * (.029/MolWt-T) * pressr(hPa)/1000 +!---limit temperature effects to T above freezing +!----MU from fit to Kaercher and Voigt (2006) + + if(TM .ge. TICE) then + QTDIS=(HSTAR*(QT/(QM*CFX))*0.029_r8*(PR/1.0e3_r8))*(CLWX*QM) + elseif (TM .le. TMIX) then + MUEMP=exp(-14.2252_r8+(1.55704e-1_r8*TM)-(7.1929e-4_r8*(TM**2.0_r8))) + QTDIS=MUEMP*(MOLMASS/18._r8)*(CLWX*QM) + else + QTDIS=RETEFF*((HSTAR*(QT/(QM*CFX))*0.029_r8*(PR/1.0e3_r8))*(CLWX*QM)) + endif + + return + end subroutine DISGAS + +!----------------------------------------------------------------------- + subroutine RAINGAS (RRAIN,DTSCAV,CLWX,CFX,QM,QT,QTDIS,QTRAIN) +!----------------------------------------------------------------------- +!---New trace-gas rainout from large-scale precip with two time scales, +!---one based on precip formation from cloud water and one based on +!---Henry's Law solubility: correct limit for delta-t +!--- +!---NB this code does not consider the aqueous dissociation (eg, C-q) +!--- that makes uptake of HNO3 and H2SO4 so complete. To do so would +!--- require that we keep track of the pH of the falling rain. +!---THUS the Henry's Law coefficient KHA needs to be enhanced to incldue this! +!---ALSO the possible formation of other soluble species from, eg, CH2O, H2O2 +!--- can be considered with enhanced values of KHA. +!--- +!---Does NOT now use RMC (moist conv rain) but could, assuming 30% coverage +!----------------------------------------------------------------------- + implicit none + real(r8), intent(in) :: RRAIN !new rain formation in box (kg/s) + real(r8), intent(in) :: DTSCAV !time step (s) + real(r8), intent(in) :: CLWX,CFX !cloud water and cloud fraction + real(r8), intent(in) :: QM !air mass in box (kg) + real(r8), intent(in) :: QT !tracer in box (kg) + real(r8), intent(in) :: QTDIS !tracer in aqueous phase (kg) + real(r8), intent(out) :: QTRAIN !tracer picked up by new rain + + real(r8) QTLF,QTDISSTAR + + + + + + QTDISSTAR=(QTDIS*(QT*CFX))/(QTDIS+(QT*CFX)) + +!---Tracer Loss frequency (1/s) within cloud fraction: + QTLF = (RRAIN*QTDISSTAR)/(CLWX*QM*QT*CFX) + +!---in time = DTSCAV, the amount of QTT scavenged is calculated +!---from CF*AMOUNT OF UPTAKE + QTRAIN = QT*CFX*(1._r8 - exp(-DTSCAV*QTLF)) + + return + end subroutine RAINGAS + + +!----------------------------------------------------------------------- + subroutine WASHGAS (RWASH,BOXF,DTSCAV,QTRTOP,HSTAR,TM,PR,QM, & + QT,QTWASH,QTEVAP) +!----------------------------------------------------------------------- +!---for most gases below-cloud washout assume Henry-Law equilib with precip +!---assumes that precip is liquid, if frozen, do not call this sub +!---since solubility is moderate, fraction of box with rain does not matter +!---NB this code does not consider the aqueous dissociation (eg, C-q) +!--- that makes uptake of HNO3 and H2SO4 so complete. To do so would +!--- require that we keep track of the pH of the falling rain. +!---THUS the Henry's Law coefficient KHA needs to be enhanced to incldue this! +!---ALSO the possible formation of other soluble species from, eg, CH2O, H2O2 +!--- can be considered with enhanced values of KHA. +!----------------------------------------------------------------------- + implicit none + real(r8), intent(in) :: RWASH ! precip leaving bottom of box (kg/s) + real(r8), intent(in) :: BOXF ! fraction of box with washout + real(r8), intent(in) :: DTSCAV ! time step (s) + real(r8), intent(in) :: QTRTOP ! tracer-T in rain entering top of box +! over time step (kg) + real(r8), intent(in) :: HSTAR ! Henry's Law coeffs A*exp(-B/T) + real(r8), intent(in) :: TM ! temperature of box (K) + real(r8), intent(in) :: PR ! pressure of box (hPa) + real(r8), intent(in) :: QT ! tracer in box (kg) + real(r8), intent(in) :: QM ! air mass in box (kg) + real(r8), intent(out) :: QTWASH ! tracer picked up by precip (kg) + real(r8), intent(out) :: QTEVAP ! tracer evaporated from precip (kg) + + real(r8), parameter :: INV298 = 1._r8/298._r8 + real(r8) :: FWASH, QTMAX, QTDIF + +!---effective Henry's Law constant: H* = moles-T / liter-precip / press(atm-T) +!---p(atm of tracer-T) = (QT/QM) * (.029/MolWt-T) * pressr(hPa)/1000 +!---limit temperature effects to T above freezing + +! +! jfl +! +! added test for BOXF = 0. +! + if ( BOXF == 0._r8 ) then + QTWASH = 0._r8 + QTEVAP = 0._r8 + return + end if + +!---effective washout frequency (1/s): + FWASH = (RWASH*HSTAR*29.e-6_r8*PR)/(QM*BOXF) +!---equilib amount of T (kg) in rain thru bottom of box over time step + QTMAX = QT*FWASH*DTSCAV + if (QTMAX .gt. QTRTOP) then +!---more of tracer T can go into rain + QTDIF = min (QT, QTMAX-QTRTOP) + QTWASH = QTDIF * (1._r8 - exp(-DTSCAV*FWASH)) + QTEVAP=0._r8 + else +!--too much of T in rain, must degas/evap T + QTWASH = 0._r8 + QTEVAP = QTRTOP - QTMAX + endif + + return + end subroutine WASHGAS + +!----------------------------------------------------------------------- + function DEMPIRICAL (CWATER,RRATE) +!----------------------------------------------------------------------- + use shr_spfn_mod, only: shr_spfn_gamma + + implicit none + real(r8), intent(in) :: CWATER + real(r8), intent(in) :: RRATE + + real(r8) :: DEMPIRICAL + + real(r8) RRATEX,WX,THETA,PHI,ETA,BETA,ALPHA,BEE + real(r8) GAMTHETA,GAMBETA + + + + RRATEX=RRATE*3600._r8 !mm/hr + WX=CWATER*1.0e3_r8 !g/m3 + + if(RRATEX .gt. 0.04_r8) then + THETA=exp(-1.43_r8*dlog10(7._r8*RRATEX))+2.8_r8 + else + THETA=5._r8 + endif + PHI=RRATEX/(3600._r8*10._r8) !cgs units + ETA=exp((3.01_r8*THETA)-10.5_r8) + BETA=THETA/(1._r8+0.638_r8) + ALPHA=exp(4._r8*(BETA-3.5_r8)) + BEE=(.638_r8*THETA/(1._r8+.638_r8))-1.0_r8 + GAMTHETA = shr_spfn_gamma(THETA) + GAMBETA = shr_spfn_gamma(BETA+1._r8) + DEMPIRICAL=(((WX*ETA*GAMTHETA)/(1.0e6_r8*ALPHA*PHI*GAMBETA))** & + (-1._r8/BEE))*10._r8 ! in mm (wx/1e6 for cgs) + + + return + end function DEMPIRICAL +! +end module mo_neu_wetdep diff --git a/src/chemistry/geoschem/mo_setinv.F90 b/src/chemistry/geoschem/mo_setinv.F90 new file mode 120000 index 0000000000..eeca85151d --- /dev/null +++ b/src/chemistry/geoschem/mo_setinv.F90 @@ -0,0 +1 @@ +../mozart/mo_setinv.F90 \ No newline at end of file diff --git a/src/chemistry/pp_geoschem/mo_sim_dat.F90 b/src/chemistry/geoschem/mo_sim_dat.F90 similarity index 81% rename from src/chemistry/pp_geoschem/mo_sim_dat.F90 rename to src/chemistry/geoschem/mo_sim_dat.F90 index 1e9005c437..44997c160e 100644 --- a/src/chemistry/pp_geoschem/mo_sim_dat.F90 +++ b/src/chemistry/geoschem/mo_sim_dat.F90 @@ -36,143 +36,198 @@ subroutine set_sim_dat ! cls_rxt_cnt(:,1) = (/ 37, 61, 0, 30 /) ! cls_rxt_cnt(:,4) = (/ 23, 174, 326, 191 /) - solsym(:273) = (/ 'CH2I2 ','CH2ICL ','CH2IBR ', & - 'NITs ','NIT ','AERI ', & - 'CO2 ','INDIOL ','ISALA ', & - 'ISALC ','ISN1OA ','ISN1OG ', & + ! GEOS-Chem tracers (advected species) are placed first along MAM + ! aerosols, as those will be constituents. MAM requires that there + ! is a linear mapping between solsym and constituents + + solsym(:318) = (/ 'ACET ','ACTA ','AERI ', & + 'ALD2 ','ALK4 ','ATOOH ', & + 'BCPI ','BCPO ','BENZ ', & + 'Br ','Br2 ','BrCl ', & + 'BrNO2 ','BrNO3 ','BrO ', & + 'BrSALA ','BrSALC ','C2H6 ', & + 'C3H8 ','CCl4 ','CFC11 ', & + 'CFC113 ','CFC114 ','CFC115 ', & + 'CFC12 ','CH2Br2 ','CH2Cl2 ', & + 'CH2I2 ','CH2IBr ','CH2ICl ', & + 'CH2O ','CH3Br ','CH3CCl3 ', & + 'CH3Cl ','CH3I ','CH4 ', & + 'CHBr3 ','CHCl3 ','Cl ', & + 'Cl2 ','Cl2O2 ','ClNO2 ', & + 'ClNO3 ','ClO ','ClOO ', & + 'CLOCK ', & + 'CO ','DMS ','DST1 ', & + 'DST2 ','DST3 ','DST4 ', & + 'EOH ','ETHLN ','ETNO3 ', & + 'ETP ','GLYC ','GLYX ', & + 'H1211 ','H1301 ','H2402 ', & + 'H2O ','H2O2 ','HAC ', & + 'HBr ','HC5A ','HCFC123 ', & + 'HCFC141b ','HCFC142b ','HCFC22 ', & + 'HCl ','HCOOH ','HI ', & + 'HMHP ','HMML ','HNO2 ', & + 'HNO3 ','HNO4 ','HOBr ', & + 'HOCl ','HOI ','HONIT ', & + 'HPALD1 ','HPALD2 ','HPALD3 ', & + 'HPALD4 ','HPETHNL ','I ', & + 'I2 ','I2O2 ','I2O3 ', & + 'I2O4 ','IBr ','ICHE ', & + 'ICl ','ICN ','ICPDH ', & + 'IDC ','IDCHP ','IDHDP ', & + 'IDHPE ','IDN ','IEPOXA ', & + 'IEPOXB ','IEPOXD ','IHN1 ', & + 'IHN2 ','IHN3 ','IHN4 ', & + 'INDIOL ','INO ','INPB ', & + 'INPD ','IO ','IONITA ', & + 'IONO ','IONO2 ','IPRNO3 ', & + 'ISALA ','ISALC ','ISOP ', & + 'ITCN ','ITHN ','LIMO ', & + 'LVOC ','LVOCOA ','MACR ', & + 'MACR1OOH ','MAP ','MCRDH ', & + 'MCRENOL ','MCRHN ','MCRHNB ', & + 'MCRHP ','MEK ','MENO3 ', & + 'MGLY ','MOH ','MONITA ', & + 'MONITS ','MONITU ','MP ', & + 'MPAN ','MPN ','MSA ', & + 'MTPA ','MTPO ','MVK ', & + 'MVKDH ','MVKHC ','MVKHCB ', & + 'MVKHP ','MVKN ','MVKPC ', & + 'N2O ','N2O5 ','NH3 ', & + 'NH4 ','NIT ','NITs ', & + 'NO ','NO2 ','NO3 ', & + 'NPRNO3 ','O3 ','OClO ', & + 'OCPI ','OCPO ','OCS ', & + 'OIO ','PAN ','pFe ', & + 'PIP ','PP ','PPN ', & + 'PROPNN ','PRPE ','PRPN ', & + 'PYAC ','R4N2 ','R4P ', & + 'RA3P ','RB3P ','RCHO ', & + 'RIPA ','RIPB ','RIPC ', & + 'RIPD ','RP ','SALA ', & + 'SALAAL ','SALACL ','SALC ', & + 'SALCAL ','SALCCL ','SO2 ', & + 'SO4 ','SO4s ','SOAGX ', & + 'SOAIE ','SOAP ','SOAS ', & + 'TOLU ','XYLE ','bc_a1 ', & + 'bc_a4 ','dst_a1 ','dst_a2 ', & + 'dst_a3 ','ncl_a1 ','ncl_a2 ', & + 'ncl_a3 ','num_a1 ','num_a2 ', & + 'num_a3 ','num_a4 ','pom_a1 ', & + 'pom_a4 ','so4_a1 ','so4_a2 ', & + 'so4_a3 ','soa1_a1 ','soa1_a2 ', & + 'soa2_a1 ','soa2_a2 ','soa3_a1 ', & + 'soa3_a2 ','soa4_a1 ','soa4_a2 ', & + 'soa5_a1 ','soa5_a2 ','H2SO4 ', & + 'SOAG0 ','SOAG1 ','SOAG2 ', & + 'SOAG3 ','SOAG4 ','CO2 ', & 'LBRO2H ','LBRO2N ','LISOPOH ', & 'LISOPNO3 ','LTRO2H ','LTRO2N ', & - 'LVOCOA ','LVOC ','LXRO2H ', & - 'LXRO2N ','MSA ','PYAC ', & - 'SO4H1 ','SO4H2 ','SOAGX ', & - 'SOAIE ','SOAME ','IMAE ', & - 'SOAMG ','POx ','LOx ', & - 'PCO ','LCO ','PSO4 ', & - 'LCH4 ','PH2O2 ','I2O4 ', & - 'DHDN ','DHDC ','I2O2 ', & - 'MONITA ','BENZ ','CH3CCL3 ', & - 'H1301 ','H2402 ','I2O3 ', & - 'PMNN ','PPN ','TOLU ', & - 'BRNO2 ','CCL4 ','CFC11 ', & - 'CFC12 ','CFC113 ','CFC114 ', & - 'CFC115 ','CH3I ','H1211 ', & - 'IBR ','IEPOXD ','INO ', & - 'N2O ','TRO2 ','BRO2 ', & - 'IEPOXA ','IEPOXB ','IONITA ', & - 'N ','OCS ','XRO2 ', & - 'HI ','MAP ','ICL ', & - 'IMAO3 ','MPN ','CHBR3 ', & - 'CHCL3 ','CL2O2 ','CH2BR2 ', & - 'CH2CL2 ','HCFC141b ','HCFC142b ', & - 'IONO ','HCFC123 ','HCFC22 ', & - 'OIO ','RA3P ','RB3P ', & - 'XYLE ','DMS ','CLNO2 ', & - 'ETP ','CH3BR ','CH3CL ', & - 'HNO4 ','CLOO ','OCLO ', & - 'PAN ','RP ','HNO2 ', & - 'ALK4 ','PP ','PRPN ', & - 'SO4 ','BRCL ','PIP ', & - 'R4P ','HPALD ','C3H8 ', & - 'DHPCARP ','HOI ','HC187 ', & - 'HPC52O2 ','VRP ','ATOOH ', & - 'BR2 ','IAP ','MOBA ', & - 'HONIT ','DHMOB ','RIPB ', & - 'MP ','ISNP ','BRSALA ', & - 'BRSALC ','MAOP ','MRP ', & - 'RIPA ','RIPD ','EOH ', & - 'ETHLN ','N2O5 ','INPN ', & - 'MTPA ','MTPO ','NPMN ', & - 'C2H6 ','IONO2 ','MOBAOO ', & - 'DIBOO ','LIMO ','IPMN ', & - 'H ','MACRNO2 ','BRNO3 ', & - 'ROH ','MONITS ','CL2 ', & - 'I2 ','ISOPNB ','ISNOHOO ', & - 'CH4 ','MVKOO ','ISNOOB ', & - 'GAOO ','CH3CHOO ','MGLYOO ', & - 'IEPOXOO ','GLYX ','MVKN ', & - 'MGLOO ','PRN1 ','MONITU ', & - 'A3O2 ','PROPNN ','ISNOOA ', & - 'MAN2 ','PO2 ','ISOPNDO2 ', & - 'HCOOH ','B3O2 ','MACROO ', & - 'R4N1 ','MAOPO2 ','ISOP ', & - 'H2O2 ','ATO2 ','I ', & - 'RCO3 ','OLNN ','OLND ', & - 'LIMO2 ','MACRN ','IO ', & - 'KO2 ','HOBR ','ISOPNBO2 ', & - 'HC5OO ','PIO2 ','HNO3 ', & - 'ISOPND ','NMAO3 ','ACTA ', & - 'HOCL ','VRO2 ','ISN1 ', & - 'CH2OO ','GLYC ','CLNO3 ', & - 'MGLY ','ACET ','HC5 ', & - 'RIO2 ','INO2 ','R4O2 ', & - 'ETO2 ','R4N2 ','HAC ', & - 'MRO2 ','BRO ','PRPE ', & - 'RCHO ','MEK ','MACR ', & - 'CH2O ','ALD2 ','MVK ', & - 'MCO3 ','SO2 ','HCL ', & - 'HBR ','H2O ','CLO ', & - 'HO2 ','OH ','BR ', & - 'O ','NO2 ','MO2 ', & - 'NO3 ','NO ','O3 ', & - 'CL ','CO ','O1D ', & - 'H2 ','MOH ','N2 ', & - 'O2 ','RCOOH ','SO4s ', & - 'NH3 ','NH4 ','BCPI ', & - 'OCPI ','BCPO ','OCPO ', & - 'DST1 ','DST2 ','DST3 ', & - 'DST4 ','SALA ','SALC ', & - 'TSOG1 ','TSOG2 ','TSOG3 ', & - 'TSOG0 ','TSOA1 ','TSOA2 ', & - 'TSOA3 ','TSOA0 ','ASOG1 ', & - 'ASOG2 ','ASOG3 ','ASOAN ', & - 'ASOA1 ','ASOA2 ','ASOA3 ', & - 'SOAP ','SOAS ','PFE ' /) + 'LXRO2H ','LXRO2N ','SO4H1 ', & + 'SO4H2 ','SO4H3 ','SO4H4 ', & + 'POx ','LOx ','PCO ', & + 'LCO ','PSO4 ','LCH4 ', & + 'PH2O2 ','BRO2 ','TRO2 ', & + 'N ','XRO2 ','HPALD2OO ', & + 'HPALD1OO ','INA ','C4HVP1 ', & + 'C4HVP2 ','IDNOO ','ICNOO ', & + 'ISOPNOO2 ','ROH ','ISOPNOO1 ', & + 'IDHNDOO1 ','IDHNDOO2 ','H ', & + 'IHPOO2 ','IHPOO1 ','IHPOO3 ', & + 'IHPNDOO ','ICHOO ','R4N1 ', & + 'PRN1 ','MVKOHOO ','MCROHOO ', & + 'MACR1OO ','PO2 ','OLNN ', & + 'OLND ','ETO2 ','IHPNBOO ', & + 'RCO3 ','LIMO2 ','KO2 ', & + 'IEPOXAOO ','IEPOXBOO ','CH3CHOO ', & + 'PIO2 ','IDHNBOO ','A3O2 ', & + 'IHOO4 ','IHOO1 ','INO2D ', & + 'INO2B ','MACRNO2 ','ATO2 ', & + 'OTHRO2 ','R4O2 ','B3O2 ', & + 'CH2OO ','MCO3 ','MO2 ', & + 'O1D ','OH ','HO2 ', & + 'O ','H2 ','N2 ', & + 'O2 ','RCOOH ' /) + + inv_lst(: 6) = (/ 'M ', 'N2 ', 'O2 ', & + 'H2 ', 'MOH ', 'RCOOH ' /) + + fix_mass(: 6) = (/ 0.00000000_r8, 28.0134800_r8, 31.9988000_r8, 2.020000_r8, 32.050000_r8, & + 74.090000_r8 /) + + adv_mass(:318) = (/ 58.090000_r8, 60.060000_r8, 126.900000_r8, 44.060000_r8, 58.120000_r8, & + 90.090000_r8, 12.010000_r8, 12.010000_r8, 78.120000_r8, 79.900000_r8, & + 159.800000_r8, 115.450000_r8, 125.910000_r8, 141.910000_r8, 95.900000_r8, & + 79.900000_r8, 79.900000_r8, 30.080000_r8, 44.110000_r8, 153.820000_r8, & + 137.370000_r8, 187.380000_r8, 170.920000_r8, 154.470000_r8, 120.910000_r8, & + 173.830000_r8, 84.930000_r8, 267.840000_r8, 220.840000_r8, 176.380000_r8, & + 30.030000_r8, 94.940000_r8, 133.350000_r8, 50.450000_r8, 141.940000_r8, & + 16.050000_r8, 252.730000_r8, 119.350000_r8, 35.450000_r8, 70.900000_r8, & + 102.910000_r8, 81.450000_r8, 97.450000_r8, 51.450000_r8, 67.450000_r8, & + 1.000000_r8, & + 28.010000_r8, 62.130000_r8, 29.000000_r8, 29.000000_r8, 29.000000_r8, & + 29.000000_r8, 46.080000_r8, 105.060000_r8, 91.080000_r8, 62.080000_r8, & + 60.060000_r8, 58.040000_r8, 165.360000_r8, 148.910000_r8, 259.820000_r8, & + 18.020000_r8, 34.020000_r8, 74.080000_r8, 80.910000_r8, 100.130000_r8, & + 152.930000_r8, 116.940000_r8, 100.500000_r8, 86.470000_r8, 36.450000_r8, & + 46.030000_r8, 127.910000_r8, 64.050000_r8, 102.100000_r8, 47.010000_r8, & + 63.010000_r8, 79.010000_r8, 96.910000_r8, 52.450000_r8, 143.890000_r8, & + 215.000000_r8, 116.130000_r8, 116.130000_r8, 116.130000_r8, 116.130000_r8, & + 76.060000_r8, 126.900000_r8, 253.800000_r8, 285.800000_r8, 301.800000_r8, & + 317.800000_r8, 206.900000_r8, 116.130000_r8, 162.450000_r8, 145.130000_r8, & + 150.150000_r8, 98.110000_r8, 148.130000_r8, 168.170000_r8, 150.150000_r8, & + 192.150000_r8, 106.140000_r8, 106.140000_r8, 106.140000_r8, 147.150000_r8, & + 147.150000_r8, 147.150000_r8, 147.150000_r8, 102.000000_r8, 156.910000_r8, & + 163.150000_r8, 163.150000_r8, 142.900000_r8, 14.010000_r8, 172.910000_r8, & + 188.910000_r8, 105.110000_r8, 126.900000_r8, 126.900000_r8, 68.130000_r8, & + 195.150000_r8, 197.170000_r8, 136.260000_r8, 154.190000_r8, 154.190000_r8, & + 70.100000_r8, 102.100000_r8, 76.060000_r8, 104.120000_r8, 86.100000_r8, & + 149.110000_r8, 149.110000_r8, 120.120000_r8, 72.110000_r8, 77.050000_r8, & + 72.070000_r8, 32.050000_r8, 14.010000_r8, 215.280000_r8, 215.280000_r8, & + 48.050000_r8, 147.100000_r8, 93.050000_r8, 96.100000_r8, 136.260000_r8, & + 136.260000_r8, 70.090000_r8, 105.130000_r8, 102.100000_r8, 102.100000_r8, & + 120.120000_r8, 149.120000_r8, 118.100000_r8, 44.020000_r8, 108.020000_r8, & + 17.040000_r8, 18.050000_r8, 62.010000_r8, 31.400000_r8, 30.010000_r8, & + 46.010000_r8, 62.010000_r8, 105.110000_r8, 48.000000_r8, 67.450000_r8, & + 12.010000_r8, 12.010000_r8, 60.070000_r8, 158.900000_r8, 121.060000_r8, & + 55.850000_r8, 186.280000_r8, 92.110000_r8, 135.080000_r8, 119.080000_r8, & + 42.090000_r8, 137.110000_r8, 88.070000_r8, 119.100000_r8, 90.140000_r8, & + 76.110000_r8, 76.110000_r8, 58.090000_r8, 118.150000_r8, 118.150000_r8, & + 118.150000_r8, 118.150000_r8, 90.090000_r8, 31.400000_r8, 31.400000_r8, & + 35.450000_r8, 31.400000_r8, 31.400000_r8, 35.450000_r8, 64.040000_r8, & + 96.060000_r8, 31.400000_r8, 58.040000_r8, 118.150000_r8, 150.000000_r8, & + 150.000000_r8, 92.150000_r8, 106.180000_r8, 12.011000_r8, 12.011000_r8, & + 135.064039_r8, 135.064039_r8, 135.064039_r8, 58.442468_r8, 58.442468_r8, & + 58.442468_r8, 1.007400_r8, 1.007400_r8, 1.007400_r8, 1.007400_r8, & + 12.011000_r8, 12.011000_r8, 115.107340_r8, 115.107340_r8, 115.107340_r8, & + 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & + 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & + 98.078400_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & + 250.445000_r8, 44.010000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, & + -1.000000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, & + 96.060000_r8, 96.060000_r8, 96.060000_r8, 96.060000_r8, -1.000000_r8, & + -1.000000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, & + -1.000000_r8, 159.130000_r8, 173.160000_r8, 14.010000_r8, 187.190000_r8, & + 147.120000_r8, 147.120000_r8, 146.140000_r8, 103.110000_r8, 103.110000_r8, & + 241.140000_r8, 194.140000_r8, 196.160000_r8, 60.110000_r8, 196.160000_r8, & + 196.160000_r8, 196.160000_r8, 1.010000_r8, 167.160000_r8, 167.160000_r8, & + 167.160000_r8, 212.160000_r8, 149.140000_r8, 150.130000_r8, 136.090000_r8, & + 119.110000_r8, 119.110000_r8, 101.090000_r8, 91.100000_r8, 230.270000_r8, & + 230.270000_r8, 61.070000_r8, 212.160000_r8, 89.080000_r8, 185.270000_r8, & + 101.090000_r8, 149.140000_r8, 149.140000_r8, 60.060000_r8, 185.270000_r8, & + 196.160000_r8, 75.100000_r8, 117.140000_r8, 117.140000_r8, 162.140000_r8, & + 162.140000_r8, 180.100000_r8, 89.080000_r8, 61.070000_r8, 89.130000_r8, & + 75.100000_r8, 46.030000_r8, 75.050000_r8, 47.040000_r8, 16.000000_r8, & + 17.010000_r8, 33.010000_r8, 16.000000_r8, 2.020000_r8, 28.020000_r8, & + 32.000000_r8, 74.090000_r8 /) + + extfrc_lst(: 1) = (/ ' ' /) - ! adv_mass(:221) = (/ 133.141340_r8, 104.142600_r8, 28.010400_r8, 12.011000_r8, 12.011000_r8, & - ! 204.342600_r8, 78.110400_r8, 160.122200_r8, 126.108600_r8, 98.098200_r8, & - ! 84.072400_r8, 98.098200_r8, 98.098200_r8, 112.124000_r8, 72.143800_r8, & - ! 56.103200_r8, 79.904000_r8, 115.356700_r8, 95.903400_r8, 141.908940_r8, & - ! 99.716850_r8, 106.120800_r8, 124.135000_r8, 26.036800_r8, 28.051600_r8, & - ! 46.065800_r8, 62.065200_r8, 30.066400_r8, 42.077400_r8, 76.091000_r8, & - ! 44.092200_r8, 110.109200_r8, 153.821800_r8, 165.364506_r8, 148.910210_r8, & - ! 137.367503_r8, 187.375310_r8, 170.921013_r8, 154.466716_r8, 120.913206_r8, & - ! 173.833800_r8, 30.025200_r8, 94.937200_r8, 133.402300_r8, 44.051000_r8, & - ! 50.485900_r8, 41.050940_r8, 58.076800_r8, 72.061400_r8, 60.050400_r8, & - ! 76.049800_r8, 32.040000_r8, 48.039400_r8, 16.040600_r8, 252.730400_r8, & - ! 35.452700_r8, 70.905400_r8, 102.904200_r8, 51.452100_r8, 97.457640_r8, & - ! 100.916850_r8, 28.010400_r8, 44.009800_r8, 66.007206_r8, 82.461503_r8, & - ! 108.135600_r8, 62.132400_r8, 135.064039_r8, 135.064039_r8, 135.064039_r8, & - ! 28.010400_r8, 78.064600_r8, 18.998403_r8, 60.050400_r8, 58.035600_r8, & - ! 1.007400_r8, 2.014800_r8, 259.823613_r8, 34.013600_r8, 98.078400_r8, & - ! 80.911400_r8, 116.948003_r8, 100.493706_r8, 86.467906_r8, 36.460100_r8, & - ! 27.025140_r8, 46.024600_r8, 20.005803_r8, 63.012340_r8, 79.011740_r8, & - ! 96.910800_r8, 52.459500_r8, 135.114940_r8, 116.112400_r8, 74.076200_r8, & - ! 100.113000_r8, 118.127200_r8, 68.114200_r8, 147.125940_r8, 147.125940_r8, & - ! 162.117940_r8, 163.125340_r8, 118.127200_r8, 184.350200_r8, 70.087800_r8, & - ! 120.100800_r8, 72.102600_r8, 104.101400_r8, 147.084740_r8, 136.228400_r8, & - ! 70.087800_r8, 14.006740_r8, 44.012880_r8, 108.010480_r8, 147.125940_r8, & - ! 145.111140_r8, 58.442468_r8, 58.442468_r8, 58.442468_r8, 17.028940_r8, & - ! 18.036340_r8, 28.010400_r8, 28.010400_r8, 30.006140_r8, 46.005540_r8, & - ! 62.004940_r8, 119.074340_r8, 231.239540_r8, 1.007400_r8, 1.007400_r8, & - ! 1.007400_r8, 1.007400_r8, 15.999400_r8, 47.998200_r8, 67.451500_r8, & - ! 60.076400_r8, 133.100140_r8, 121.047940_r8, 183.117740_r8, 93.102400_r8, & - ! 94.109800_r8, 176.121600_r8, 12.011000_r8, 12.011000_r8, 92.090400_r8, & - ! 90.075600_r8, 32.066000_r8, 146.056419_r8, 48.065400_r8, 64.064800_r8, & - ! 80.064200_r8, 115.107340_r8, 115.107340_r8, 115.107340_r8, 250.445000_r8, & - ! 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & - ! 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & - ! 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 28.010400_r8, & - ! 310.582400_r8, 140.134400_r8, 186.241400_r8, 215.240140_r8, 186.241400_r8, & - ! 168.227200_r8, 154.201400_r8, 174.148000_r8, 92.136200_r8, 150.126000_r8, & - ! 106.162000_r8, 188.173800_r8, 122.161400_r8, 204.173200_r8, 14.006740_r8, & - ! 14.006740_r8, 137.112200_r8, 103.135200_r8, 159.114800_r8, 123.127600_r8, & - ! 61.057800_r8, 75.083600_r8, 109.101800_r8, 75.042400_r8, 47.032000_r8, & - ! 129.089600_r8, 105.108800_r8, 61.057800_r8, 77.057200_r8, 33.006200_r8, & - ! 63.031400_r8, 117.119800_r8, 117.119800_r8, 119.093400_r8, 115.063800_r8, & - ! 101.079200_r8, 117.078600_r8, 103.094000_r8, 230.232140_r8, 15.999400_r8, & - ! 17.006800_r8, 175.114200_r8, 91.083000_r8, 89.068200_r8, 199.218600_r8, & - ! 185.234000_r8, 173.140600_r8, 149.118600_r8, 187.166400_r8, 203.165800_r8, & - ! 18.014200_r8 /) + frc_from_dataset(: 1) = (/ .false. /) + + !extfrc_lst(: 17) = (/ 'so4_a2 ','NO ','NO2 ','SO2 ','SVOC ', & + ! 'pom_a1 ','pom_a4 ','so4_a1 ','CO ','bc_a1 ', & + ! 'bc_a4 ','num_a1 ','num_a2 ','num_a4 ','OH ', & + ! 'N ','AOA_NH ' /) ! crb_mass(:221) = (/ 60.055000_r8, 60.055000_r8, 12.011000_r8, 12.011000_r8, 12.011000_r8, & ! 180.165000_r8, 72.066000_r8, 72.066000_r8, 72.066000_r8, 60.055000_r8, & @@ -288,18 +343,6 @@ subroutine set_sim_dat ! 1621,1672,1699,1734,1776,1837,1862,1893,1917,1996, & ! 2022 /) - ! extfrc_lst(: 17) = (/ 'so4_a2 ','NO ','NO2 ','SO2 ','SVOC ', & - ! 'pom_a1 ','pom_a4 ','so4_a1 ','CO ','bc_a1 ', & - ! 'bc_a4 ','num_a1 ','num_a2 ','num_a4 ','OH ', & - ! 'N ','AOA_NH ' /) - - ! frc_from_dataset(: 17) = (/ .true., .true., .true., .true., .true., & - ! .true., .true., .true., .true., .true., & - ! .true., .true., .true., .true., .false., & - ! .false., .false. /) - - ! inv_lst(: 3) = (/ 'M ', 'N2 ', 'O2 ' /) - ! slvd_lst(: 34) = (/ 'ACBZO2 ', 'ALKO2 ', 'BENZO2 ', 'BZOO ', 'C2H5O2 ', & ! 'C3H7O2 ', 'C6H5O2 ', 'CH3CO3 ', 'CH3O2 ', 'DICARBO2 ', & ! 'ENEO2 ', 'EO ', 'EO2 ', 'HO2 ', 'HOCH2OO ', & diff --git a/src/chemistry/pp_geoschem/mo_tracname.F90 b/src/chemistry/geoschem/mo_tracname.F90 similarity index 90% rename from src/chemistry/pp_geoschem/mo_tracname.F90 rename to src/chemistry/geoschem/mo_tracname.F90 index 5d470483d1..be9c474506 100644 --- a/src/chemistry/pp_geoschem/mo_tracname.F90 +++ b/src/chemistry/geoschem/mo_tracname.F90 @@ -12,6 +12,6 @@ module mo_tracname ! modified to an arbitrary high #, was gas_pcnst. this would cause a memory ! overflow overwrite in mo_sim_dat, which allocates :273 larger than ! the default specified gas_pcnst (hplin, 5/16/20) - character(len=16) :: solsym(273) ! species names + character(len=16) :: solsym(318) ! species names end module mo_tracname diff --git a/src/chemistry/pp_geoschem/rate_diags.F90 b/src/chemistry/geoschem/rate_diags.F90 similarity index 100% rename from src/chemistry/pp_geoschem/rate_diags.F90 rename to src/chemistry/geoschem/rate_diags.F90 diff --git a/src/chemistry/pp_geoschem/short_lived_species.F90 b/src/chemistry/geoschem/short_lived_species.F90 similarity index 96% rename from src/chemistry/pp_geoschem/short_lived_species.F90 rename to src/chemistry/geoschem/short_lived_species.F90 index b4dc6d55ff..293aaa65cd 100644 --- a/src/chemistry/pp_geoschem/short_lived_species.F90 +++ b/src/chemistry/geoschem/short_lived_species.F90 @@ -17,7 +17,6 @@ module short_lived_species save private - !public :: map public :: register_short_lived_species public :: short_lived_species_initic public :: short_lived_species_writeic @@ -28,7 +27,6 @@ module short_lived_species public :: pbf_idx integer :: pbf_idx - !integer :: map(nslvd) character(len=16), parameter :: pbufname = 'ShortLivedSpecies' @@ -129,8 +127,6 @@ subroutine initialize_short_lived_species(ncid_ini, pbuf2d) allocate(tmpptr(pcols,pver,begchunk:endchunk)) do m=1,nslvd - !n = map(m) - !fieldname = solsym(n) write(fieldname,'(a,a)') trim(slvd_lst(m)) call infld( fieldname,ncid_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & tmpptr, found, gridname='physgrid') @@ -170,8 +166,6 @@ subroutine set_short_lived_species( q, lchnk, ncol, pbuf ) if ( nslvd < 1 ) return do m=1,nslvd - !n = map(m) - !call pbuf_set_field(pbuf, pbf_idx, q(:,:,m), start=(/1,1,n/),kount=(/pcols,pver,1/)) call pbuf_set_field(pbuf, pbf_idx, q(:,:,m), start=(/1,1,m/),kount=(/pcols,pver,1/)) enddo @@ -195,9 +189,7 @@ subroutine get_short_lived_species( q, lchnk, ncol, pbuf ) if ( nslvd < 1 ) return do m=1,nslvd - !n = map(m) call pbuf_get_field(pbuf, pbf_idx, tmpptr, start=(/1,1,m/), kount=(/ pcols,pver,1 /)) - !q(:ncol,:,n) = tmpptr(:ncol,:) q(:ncol,:,m) = tmpptr(:ncol,:) enddo diff --git a/src/chemistry/geoschem/tracer_cnst.F90 b/src/chemistry/geoschem/tracer_cnst.F90 new file mode 120000 index 0000000000..be79edec09 --- /dev/null +++ b/src/chemistry/geoschem/tracer_cnst.F90 @@ -0,0 +1 @@ +../mozart/tracer_cnst.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/tracer_srcs.F90 b/src/chemistry/geoschem/tracer_srcs.F90 new file mode 120000 index 0000000000..136404bf05 --- /dev/null +++ b/src/chemistry/geoschem/tracer_srcs.F90 @@ -0,0 +1 @@ +../mozart/tracer_srcs.F90 \ No newline at end of file diff --git a/src/chemistry/pp_geoschem/upper_bc.F90 b/src/chemistry/geoschem/upper_bc.F90 similarity index 100% rename from src/chemistry/pp_geoschem/upper_bc.F90 rename to src/chemistry/geoschem/upper_bc.F90 diff --git a/src/chemistry/modal_aero/aero_model.F90 b/src/chemistry/modal_aero/aero_model.F90 index 23fa250357..8603420b87 100644 --- a/src/chemistry/modal_aero/aero_model.F90 +++ b/src/chemistry/modal_aero/aero_model.F90 @@ -179,13 +179,13 @@ subroutine aero_model_init( pbuf2d ) use mo_chem_utls, only: get_inv_ndx use cam_history, only: addfld, add_default, horiz_only - use mo_chem_utls, only: get_rxt_ndx, get_spc_ndx + use mo_chem_utls, only: get_spc_ndx use modal_aero_data, only: cnst_name_cw use modal_aero_data, only: modal_aero_data_init use rad_constituents,only: rad_cnst_get_info use dust_model, only: dust_init, dust_names, dust_active, dust_nbin, dust_nnum use seasalt_model, only: seasalt_init, seasalt_names, seasalt_active,seasalt_nbin - use drydep_mod, only: inidrydep + use aer_drydep_mod, only: inidrydep use wetdep, only: wetdep_init use modal_aero_calcsize, only: modal_aero_calcsize_init @@ -388,7 +388,7 @@ subroutine aero_model_init( pbuf2d ) call pbuf_set_field(pbuf2d, rate1_cw2pr_st_idx, 0.0_r8) do m = 1,ndrydep - + ! units if (drydep_list(m)(1:3) == 'num') then unit_basename = ' 1' @@ -418,7 +418,7 @@ subroutine aero_model_init( pbuf2d ) enddo do m = 1,nwetdep - + ! units if (wetdep_list(m)(1:3) == 'num') then unit_basename = ' 1' @@ -666,7 +666,7 @@ end subroutine aero_model_init subroutine aero_model_drydep ( state, pbuf, obklen, ustar, cam_in, dt, cam_out, ptend ) use dust_sediment_mod, only: dust_sediment_tend - use drydep_mod, only: d3ddflux, calcram + use aer_drydep_mod, only: d3ddflux, calcram use modal_aero_data, only: qqcw_get_field use modal_aero_data, only: cnst_name_cw use modal_aero_data, only: alnsg_amode diff --git a/src/chemistry/modal_aero/modal_aero_data.F90 b/src/chemistry/modal_aero/modal_aero_data.F90 index e45d254dcc..1f23b28f18 100644 --- a/src/chemistry/modal_aero/modal_aero_data.F90 +++ b/src/chemistry/modal_aero/modal_aero_data.F90 @@ -110,7 +110,7 @@ module modal_aero_data logical, public, protected :: soa_multi_species = .false. - character(len=16), allocatable :: xname_massptr(:,:) ! names of species in each mode + character(len=16), public, protected, allocatable :: xname_massptr(:,:) ! names of species in each mode character(len=16), allocatable :: xname_massptrcw(:,:) ! names of cloud-borne species in each mode complex(r8), allocatable :: & @@ -451,7 +451,7 @@ subroutine modal_aero_data_init(pbuf2d) lptr2_soa_g_amode(:) = -1 soa_ndx = 0 do i = 1, pcnst - if (cnst_name(i)(:4) == 'SOAG') then + if (cnst_name(i)(:4) == 'SOAG' .and. cnst_name(i)(:5) /= 'SOAGX') then soa_ndx = soa_ndx+1 lptr2_soa_g_amode(soa_ndx) = i endif diff --git a/src/chemistry/mozart/mo_chem_utls.F90 b/src/chemistry/mozart/mo_chem_utls.F90 index 1620422e12..6d47ed3a0a 100644 --- a/src/chemistry/mozart/mo_chem_utls.F90 +++ b/src/chemistry/mozart/mo_chem_utls.F90 @@ -3,6 +3,7 @@ module mo_chem_utls private public :: get_spc_ndx, get_het_ndx, get_extfrc_ndx, get_rxt_ndx, get_inv_ndx + public :: utls_chem_is save @@ -159,4 +160,15 @@ integer function get_rxt_ndx( rxt_tag ) end function get_rxt_ndx + logical function utls_chem_is (name) result(chem_is) + use string_utils, only : to_lower + + character(len=*), intent(in) :: name + chem_is = .false. + if ( to_lower(name) == 'mozart' ) then + chem_is = .true. + endif + + end function utls_chem_is + end module mo_chem_utls diff --git a/src/chemistry/pp_geoschem/aero_model.F90 b/src/chemistry/pp_geoschem/aero_model.F90 deleted file mode 100644 index 3c9133adf6..0000000000 --- a/src/chemistry/pp_geoschem/aero_model.F90 +++ /dev/null @@ -1,1150 +0,0 @@ -!=============================================================================== -! Bulk Aerosol Model -!=============================================================================== -module aero_model - use shr_kind_mod, only: r8 => shr_kind_r8 - use constituents, only: pcnst, cnst_name, cnst_get_ind - use ppgrid, only: pcols, pver, pverp - use cam_abortutils, only: endrun - use cam_logfile, only: iulog - use perf_mod, only: t_startf, t_stopf - use camsrfexch, only: cam_in_t, cam_out_t - use physics_types, only: physics_state, physics_ptend, physics_ptend_init - use physics_buffer, only: physics_buffer_desc - use physconst, only: gravit, rair - use spmd_utils, only: masterproc - use physics_buffer, only: pbuf_get_field, pbuf_get_index - use cam_history, only: outfld - use infnan, only: nan, assignment(=) - - implicit none - private - - public :: aero_model_readnl - public :: aero_model_register - public :: aero_model_init - public :: aero_model_gasaerexch ! create, grow, change, and shrink aerosols. - public :: aero_model_drydep ! aerosol dry deposition and sediment - public :: aero_model_wetdep ! aerosol wet removal - public :: aero_model_emissions ! aerosol emissions - public :: aero_model_surfarea ! tropospheric aerosol wet surface area for chemistry - public :: aero_model_strat_surfarea ! stub - - ! Misc private data - - integer :: so4_ndx, cb2_ndx, oc2_ndx, nit_ndx - integer :: soa_ndx, soai_ndx, soam_ndx, soab_ndx, soat_ndx, soax_ndx - - ! Namelist variables - character(len=16) :: wetdep_list(pcnst) = ' ' - character(len=16) :: drydep_list(pcnst) = ' ' - - integer :: ndrydep = 0 - integer,allocatable :: drydep_indices(:) - integer :: nwetdep = 0 - integer,allocatable :: wetdep_indices(:) - logical :: drydep_lq(pcnst) - logical :: wetdep_lq(pcnst) - - integer :: fracis_idx = 0 - - real(r8) :: aer_sol_facti(pcnst) ! in-cloud solubility factor - real(r8) :: aer_sol_factb(pcnst) ! below-cloud solubility factor - real(r8) :: aer_scav_coef(pcnst) - -contains - - !============================================================================= - ! reads aerosol namelist options - !============================================================================= - subroutine aero_model_readnl(nlfile) - - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use mpishorthand - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - - ! Local variables - integer :: unitn, ierr - character(len=*), parameter :: subname = 'aero_model_readnl' - - ! Namelist variables - character(len=16) :: aer_wetdep_list(pcnst) = ' ' - character(len=16) :: aer_drydep_list(pcnst) = ' ' - - namelist /aerosol_nl/ aer_wetdep_list, aer_drydep_list - namelist /aerosol_nl/ aer_sol_facti, aer_sol_factb, aer_scav_coef - !----------------------------------------------------------------------------- - !aer_sol_facti = nan - !aer_sol_factb = nan - !aer_scav_coef = nan - - !! Read namelist - !if (masterproc) then - ! unitn = getunit() - ! open( unitn, file=trim(nlfile), status='old' ) - ! call find_group_name(unitn, 'aerosol_nl', status=ierr) - ! if (ierr == 0) then - ! read(unitn, aerosol_nl, iostat=ierr) - ! if (ierr /= 0) then - ! call endrun(subname // ':: ERROR reading namelist') - ! end if - ! end if - ! close(unitn) - ! call freeunit(unitn) - !end if - -#ifdef SPMD - ! Broadcast namelist variables - !call mpibcast(aer_wetdep_list, len(aer_wetdep_list(1))*pcnst, mpichar, 0, mpicom) - !call mpibcast(aer_drydep_list, len(aer_drydep_list(1))*pcnst, mpichar, 0, mpicom) - !call mpibcast(aer_sol_facti, pcnst, mpir8, 0, mpicom) - !call mpibcast(aer_sol_factb, pcnst, mpir8, 0, mpicom) - !call mpibcast(aer_scav_coef, pcnst, mpir8, 0, mpicom) -#endif - - !wetdep_list = aer_wetdep_list - !drydep_list = aer_drydep_list - - end subroutine aero_model_readnl - - !============================================================================= - !============================================================================= - subroutine aero_model_register() - !use mo_setsoa, only : soa_register - - !call soa_register() - end subroutine aero_model_register - - !============================================================================= - !============================================================================= - subroutine aero_model_init( pbuf2d ) - - !use mo_chem_utls, only: get_inv_ndx, get_spc_ndx - use cam_history, only: addfld, add_default, horiz_only - use phys_control, only: phys_getopts - !use mo_aerosols, only: aerosols_inti - !use mo_setsoa, only: soa_inti - !use dust_model, only: dust_init - !use seasalt_model, only: seasalt_init - !use drydep_mod, only: inidrydep - !use wetdep, only: wetdep_init - !use mo_setsox, only: has_sox - - ! args - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - - ! local vars - character(len=12), parameter :: subrname = 'aero_model_init' - integer :: m, id - character(len=20) :: dummy - logical :: history_aerosol ! Output MAM or SECT aerosol tendencies - - !call phys_getopts( history_aerosol_out=history_aerosol ) - !call aerosols_inti() - !call soa_inti(pbuf2d) - !call dust_init() - !call seasalt_init() - !call wetdep_init() - - !fracis_idx = pbuf_get_index('FRACIS') - - !nwetdep = 0 - !ndrydep = 0 - - !count_species: do m = 1,pcnst - ! if ( len_trim(wetdep_list(m)) /= 0 ) then - ! nwetdep = nwetdep+1 - ! endif - ! if ( len_trim(drydep_list(m)) /= 0 ) then - ! ndrydep = ndrydep+1 - ! endif - !enddo count_species - ! - !if (nwetdep>0) & - ! allocate(wetdep_indices(nwetdep)) - !if (ndrydep>0) & - ! allocate(drydep_indices(ndrydep)) - - !do m = 1,ndrydep - ! call cnst_get_ind ( drydep_list(m), id, abort=.false. ) - ! if (id>0) then - ! drydep_indices(m) = id - ! else - ! call endrun(subrname//': invalid drydep species: '//trim(drydep_list(m)) ) - ! endif - - ! if (masterproc) then - ! write(iulog,*) subrname//': '//drydep_list(m)//' will have drydep applied' - ! endif - !enddo - !do m = 1,nwetdep - ! call cnst_get_ind ( wetdep_list(m), id, abort=.false. ) - ! if (id>0) then - ! wetdep_indices(m) = id - ! else - ! call endrun(subrname//': invalid wetdep species: '//trim(wetdep_list(m)) ) - ! endif - ! - ! if (masterproc) then - ! write(iulog,*) subrname//': '//wetdep_list(m)//' will have wet removal' - ! endif - !enddo - ! - !! set flags for drydep tendencies - !drydep_lq(:) = .false. - !do m=1,ndrydep - ! id = drydep_indices(m) - ! drydep_lq(id) = .true. - !enddo - - !! set flags for wetdep tendencies - !wetdep_lq(:) = .false. - !do m=1,nwetdep - ! id = wetdep_indices(m) - ! wetdep_lq(id) = .true. - !enddo - - !do m = 1,ndrydep - ! - ! dummy = trim(drydep_list(m)) // 'TB' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s',trim(drydep_list(m))//' turbulent dry deposition flux') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - ! dummy = trim(drydep_list(m)) // 'GV' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s',trim(drydep_list(m)) //' gravitational dry deposition flux') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - ! dummy = trim(drydep_list(m)) // 'DD' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s',trim(drydep_list(m)) //' dry deposition flux at bottom (grav + turb)') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - ! dummy = trim(drydep_list(m)) // 'DT' - ! call addfld (dummy,(/ 'lev' /), 'A','kg/kg/s',trim(drydep_list(m))//' dry deposition') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - ! dummy = trim(drydep_list(m)) // 'DV' - ! call addfld (dummy,(/ 'lev' /), 'A','m/s',trim(drydep_list(m))//' deposition velocity') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - - !enddo - ! - !if (ndrydep>0) then - - ! call inidrydep(rair, gravit) - - ! dummy = 'RAM1' - ! call addfld (dummy,horiz_only, 'A','frac','RAM1') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - ! dummy = 'airFV' - ! call addfld (dummy,horiz_only, 'A','frac','FV') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - - ! if (sslt_active) then - ! dummy = 'SSTSFDRY' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Sea salt deposition flux at surface') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - ! endif - ! if (dust_active) then - ! dummy = 'DSTSFDRY' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Dust deposition flux at surface') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - ! endif - - !endif - - !do m = 1,nwetdep - - ! call addfld (trim(wetdep_list(m))//'SFWET', horiz_only, 'A','kg/m2/s', & - ! 'Wet deposition flux at surface') - ! call addfld (trim(wetdep_list(m))//'SFSIC', horiz_only, 'A','kg/m2/s', & - ! 'Wet deposition flux (incloud, convective) at surface') - ! call addfld (trim(wetdep_list(m))//'SFSIS', horiz_only, 'A','kg/m2/s', & - ! 'Wet deposition flux (incloud, stratiform) at surface') - ! call addfld (trim(wetdep_list(m))//'SFSBC', horiz_only, 'A','kg/m2/s', & - ! 'Wet deposition flux (belowcloud, convective) at surface') - ! call addfld (trim(wetdep_list(m))//'SFSBS', horiz_only, 'A','kg/m2/s', & - ! 'Wet deposition flux (belowcloud, stratiform) at surface') - ! call addfld (trim(wetdep_list(m))//'WET', (/ 'lev' /), 'A','kg/kg/s', & - ! 'wet deposition tendency') - ! call addfld (trim(wetdep_list(m))//'SIC', (/ 'lev' /), 'A','kg/kg/s', & - ! trim(wetdep_list(m))//' ic wet deposition') - ! call addfld (trim(wetdep_list(m))//'SIS', (/ 'lev' /), 'A','kg/kg/s', & - ! trim(wetdep_list(m))//' is wet deposition') - ! call addfld (trim(wetdep_list(m))//'SBC', (/ 'lev' /), 'A','kg/kg/s', & - ! trim(wetdep_list(m))//' bc wet deposition') - ! call addfld (trim(wetdep_list(m))//'SBS', (/ 'lev' /), 'A','kg/kg/s', & - ! trim(wetdep_list(m))//' bs wet deposition') - !enddo - ! - !if (nwetdep>0) then - ! if (sslt_active) then - ! dummy = 'SSTSFWET' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Sea salt wet deposition flux at surface') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - ! endif - ! if (dust_active) then - ! dummy = 'DSTSFWET' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Dust wet deposition flux at surface') - ! if ( history_aerosol ) then - ! call add_default (dummy, 1, ' ') - ! endif - ! endif - !endif - ! - !if (dust_active) then - ! ! emissions diagnostics .... - - ! do m = 1, dust_nbin - ! dummy = trim(dust_names(m)) // 'SF' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s',trim(dust_names(m))//' dust surface emission') - ! if (history_aerosol) then - ! call add_default (dummy, 1, ' ') - ! endif - ! enddo - - ! dummy = 'DSTSFMBL' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Mobilization flux at surface') - ! if (history_aerosol) then - ! call add_default (dummy, 1, ' ') - ! endif - - ! dummy = 'LND_MBL' - ! call addfld (dummy,horiz_only, 'A','frac','Soil erodibility factor') - ! if (history_aerosol) then - ! call add_default (dummy, 1, ' ') - ! endif - - !endif - ! - !if (sslt_active) then - - ! dummy = 'SSTSFMBL' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s','Mobilization flux at surface') - ! if (history_aerosol) then - ! call add_default (dummy, 1, ' ') - ! endif - - ! do m = 1, seasalt_nbin - ! dummy = trim(seasalt_names(m)) // 'SF' - ! call addfld (dummy,horiz_only, 'A','kg/m2/s',trim(seasalt_names(m))//' seasalt surface emission') - ! if (history_aerosol) then - ! call add_default (dummy, 1, ' ') - ! endif - ! enddo - - !endif - - !if( has_sox ) then - ! call addfld( 'XPH_LWC',(/ 'lev' /), 'A','kg/kg', 'pH value multiplied by lwc') - - ! if ( history_aerosol ) then - ! call add_default ('XPH_LWC', 1, ' ') - ! endif - !endif - - !so4_ndx = get_spc_ndx( 'SO4' ) - !soa_ndx = get_spc_ndx( 'SOA' ) - !soai_ndx = get_spc_ndx( 'SOAI' ) - !soam_ndx = get_spc_ndx( 'SOAM' ) - !soab_ndx = get_spc_ndx( 'SOAB' ) - !soat_ndx = get_spc_ndx( 'SOAT' ) - !soax_ndx = get_spc_ndx( 'SOAX' ) - !cb2_ndx = get_spc_ndx( 'CB2' ) - !oc2_ndx = get_spc_ndx( 'OC2' ) - !nit_ndx = get_spc_ndx( 'NH4NO3' ) - - end subroutine aero_model_init - - !============================================================================= - !============================================================================= - subroutine aero_model_drydep ( state, pbuf, obklen, ustar, cam_in, dt, cam_out, ptend ) - - !use dust_sediment_mod, only: dust_sediment_tend - !use drydep_mod, only: d3ddflux, calcram - !use dust_model, only: dust_depvel, dust_nbin, dust_names - !use seasalt_model, only: sslt_depvel=>seasalt_depvel, sslt_nbin=>seasalt_nbin, sslt_names=>seasalt_names - - ! args - type(physics_state), intent(in) :: state ! Physics state variables - real(r8), intent(in) :: obklen(:) - real(r8), intent(in) :: ustar(:) ! sfc fric vel - type(cam_in_t), target, intent(in) :: cam_in ! import state - real(r8), intent(in) :: dt ! time step - type(cam_out_t), intent(inout) :: cam_out ! export state - type(physics_ptend), intent(out) :: ptend ! indivdual parameterization tendencies - type(physics_buffer_desc), pointer :: pbuf(:) - - ! local vars - real(r8), pointer :: landfrac(:) ! land fraction - real(r8), pointer :: icefrac(:) ! ice fraction - real(r8), pointer :: ocnfrac(:) ! ocean fraction - real(r8), pointer :: fvin(:) ! - real(r8), pointer :: ram1in(:) ! for dry dep velocities from land model for progseasalts - - real(r8) :: fv(pcols) ! for dry dep velocities, from land modified over ocean & ice - real(r8) :: ram1(pcols) ! for dry dep velocities, from land modified over ocean & ice - - ! local decarations - - !integer, parameter :: naero = sslt_nbin+dust_nbin - !integer, parameter :: begslt = 1 - !integer, parameter :: endslt = sslt_nbin - !integer, parameter :: begdst = sslt_nbin+1 - !integer, parameter :: enddst = sslt_nbin+dust_nbin - - !integer :: ncol, lchnk - - !character(len=6) :: aeronames(naero) ! = (/ sslt_names, dust_names /) - - !real(r8) :: vlc_trb(pcols,naero) !Turbulent deposn velocity (m/s) - !real(r8) :: vlc_grv(pcols,pver,naero) !grav deposn velocity (m/s) - !real(r8) :: vlc_dry(pcols,pver,naero) !dry deposn velocity (m/s) - - !real(r8) :: dep_trb(pcols) !kg/m2/s - !real(r8) :: dep_grv(pcols) !kg/m2/s (total of grav and trb) - - !real(r8) :: tsflx_dst(pcols) - !real(r8) :: tsflx_slt(pcols) - !real(r8) :: pvaeros(pcols,pverp) ! sedimentation velocity in Pa - !real(r8) :: sflx(pcols) - - !real(r8) :: tvs(pcols,pver) - !real(r8) :: rho(pcols,pver) ! air density in kg/m3 - - !integer :: m,mm, i, im - ! - !if (ndrydep<1) return - - !landfrac => cam_in%landfrac(:) - !icefrac => cam_in%icefrac(:) - !ocnfrac => cam_in%ocnfrac(:) - !fvin => cam_in%fv(:) - !ram1in => cam_in%ram1(:) - - !lchnk = state%lchnk - !ncol = state%ncol - - !! calc ram and fv over ocean and sea ice ... - !call calcram( ncol,landfrac,icefrac,ocnfrac,obklen,& - ! ustar,ram1in,ram1,state%t(:,pver),state%pmid(:,pver),& - ! state%pdel(:,pver),fvin,fv) - - !call outfld( 'airFV', fv(:), pcols, lchnk ) - !call outfld( 'RAM1', ram1(:), pcols, lchnk ) - - !! note that tendencies are not only in sfc layer (because of sedimentation) - !! and that ptend is updated within each subroutine for different species - ! - !call physics_ptend_init(ptend, state%psetcols, 'aero_model_drydep', lq=drydep_lq) - - !aeronames(:sslt_nbin) = sslt_names(:) - !aeronames(sslt_nbin+1:) = dust_names(:) - - !lchnk = state%lchnk - !ncol = state%ncol - - !tvs(:ncol,:) = state%t(:ncol,:) - !rho(:ncol,:) = state%pmid(:ncol,:)/(rair*state%t(:ncol,:)) - - !! compute dep velocities for sea salt and dust... - !if (sslt_active) then - ! call sslt_depvel( state%t(:,:), state%pmid(:,:), state%q(:,:,1), ram1, fv, ncol, lchnk, & - ! vlc_dry(:,:,begslt:endslt), vlc_trb(:,begslt:endslt), vlc_grv(:,:,begslt:endslt)) - !endif - !if (dust_active) then - ! call dust_depvel( state%t(:,:), state%pmid(:,:), ram1, fv, ncol, & - ! vlc_dry(:,:,begdst:enddst), vlc_trb(:,begdst:enddst), vlc_grv(:,:,begdst:enddst) ) - !endif - - !tsflx_dst(:)=0._r8 - !tsflx_slt(:)=0._r8 - - !! do drydep for each of the bins of dust and seasalt - !do m=1,ndrydep - - ! mm = drydep_indices(m) - ! findindex: do im = 1,naero - ! if (trim(cnst_name(mm))==trim(aeronames(im))) exit findindex - ! enddo findindex - - ! pvaeros(:ncol,1)=0._r8 - ! pvaeros(:ncol,2:pverp) = vlc_dry(:ncol,:,im) - - ! call outfld( trim(cnst_name(mm))//'DV', pvaeros(:,2:pverp), pcols, lchnk ) - - ! if(.true.) then ! use phil's method - ! ! convert from meters/sec to pascals/sec - ! ! pvaeros(:,1) is assumed zero, use density from layer above in conversion - ! pvaeros(:ncol,2:pverp) = pvaeros(:ncol,2:pverp) * rho(:ncol,:)*gravit - - ! ! calculate the tendencies and sfc fluxes from the above velocities - ! call dust_sediment_tend( & - ! ncol, dt, state%pint(:,:), state%pmid, state%pdel, state%t , & - ! state%q(:,:,mm) , pvaeros , ptend%q(:,:,mm), sflx ) - ! else !use charlie's method - ! call d3ddflux(ncol, vlc_dry(:,:,im), state%q(:,:,mm),state%pmid,state%pdel, tvs,sflx,ptend%q(:,:,mm),dt) - ! endif - ! ! apportion dry deposition into turb and gravitational settling for tapes - ! do i=1,ncol - ! dep_trb(i)=sflx(i)*vlc_trb(i,im)/vlc_dry(i,pver,im) - ! dep_grv(i)=sflx(i)*vlc_grv(i,pver,im)/vlc_dry(i,pver,im) - ! enddo - - ! if ( any( sslt_names(:)==trim(cnst_name(mm)) ) ) & - ! tsflx_slt(:ncol)=tsflx_slt(:ncol)+sflx(:ncol) - ! if ( any( dust_names(:)==trim(cnst_name(mm)) ) ) & - ! tsflx_dst(:ncol)=tsflx_dst(:ncol)+sflx(:ncol) - - ! ! if the user has specified prescribed aerosol dep fluxes then - ! ! do not set cam_out dep fluxes according to the prognostic aerosols - ! if (.not. aerodep_flx_prescribed()) then - ! ! set deposition in export state - ! if (im==begdst) then - ! cam_out%dstdry1(:ncol) = max(sflx(:ncol), 0._r8) - ! elseif(im==begdst+1) then - ! cam_out%dstdry2(:ncol) = max(sflx(:ncol), 0._r8) - ! elseif(im==begdst+2) then - ! cam_out%dstdry3(:ncol) = max(sflx(:ncol), 0._r8) - ! elseif(im==begdst+3) then - ! cam_out%dstdry4(:ncol) = max(sflx(:ncol), 0._r8) - ! endif - ! endif - - ! call outfld( trim(cnst_name(mm))//'DD', sflx, pcols, lchnk) - ! call outfld( trim(cnst_name(mm))//'TB', dep_trb, pcols, lchnk ) - ! call outfld( trim(cnst_name(mm))//'GV', dep_grv, pcols, lchnk ) - ! call outfld( trim(cnst_name(mm))//'DT', ptend%q(:,:,mm), pcols, lchnk) - - !end do - ! - !! output the total dry deposition - !if (sslt_active) then - ! call outfld( 'SSTSFDRY', tsflx_slt, pcols, lchnk) - !endif - !if (dust_active) then - ! call outfld( 'DSTSFDRY', tsflx_dst, pcols, lchnk) - !endif - - endsubroutine aero_model_drydep - - !============================================================================= - !============================================================================= - subroutine aero_model_wetdep( state, dt, dlf, cam_out, ptend, pbuf) - - !use wetdep, only : wetdepa_v1, wetdep_inputs_set, wetdep_inputs_t - !use dust_model, only : dust_names - !use seasalt_model, only : sslt_names=>seasalt_names - - ! args - - type(physics_state), intent(in) :: state ! Physics state variables - real(r8), intent(in) :: dt ! time step - real(r8), intent(in) :: dlf(:,:) ! shallow+deep convective detrainment [kg/kg/s] - type(cam_out_t), intent(inout) :: cam_out ! export state - type(physics_ptend), intent(out) :: ptend ! indivdual parameterization tendencies - type(physics_buffer_desc), pointer :: pbuf(:) - - !! local vars - - !integer :: ncol ! number of atmospheric columns - !integer :: lchnk ! chunk identifier - !integer :: m,mm, i,k - - !real(r8) :: sflx_tot_dst(pcols) - !real(r8) :: sflx_tot_slt(pcols) - - !real(r8) :: iscavt(pcols, pver) - !real(r8) :: scavt(pcols, pver) - !real(r8) :: scavcoef(pcols,pver) ! Dana and Hales coefficient (/mm) (0.1) - !real(r8) :: sflx(pcols) ! deposition flux - - !real(r8) :: icscavt(pcols, pver) - !real(r8) :: isscavt(pcols, pver) - !real(r8) :: bcscavt(pcols, pver) - !real(r8) :: bsscavt(pcols, pver) - - !real(r8) :: sol_factb, sol_facti - - !real(r8) :: rainmr(pcols,pver) ! mixing ratio of rain within cloud volume - !real(r8) :: cldv(pcols,pver) ! cloudy volume undergoing scavenging - !real(r8) :: cldvcu(pcols,pver) ! Convective precipitation area at the top interface of current layer - !real(r8) :: cldvst(pcols,pver) ! Stratiform precipitation area at the top interface of current layer - - !real(r8), pointer :: fracis(:,:,:) ! fraction of transported species that are insoluble - - !type(wetdep_inputs_t) :: dep_inputs ! obj that contains inputs to wetdepa routine - - !if (nwetdep<1) return - - !call pbuf_get_field(pbuf, fracis_idx, fracis, start=(/1,1,1/), kount=(/pcols, pver, pcnst/) ) - - !call physics_ptend_init(ptend, state%psetcols, 'aero_model_wetdep', lq=wetdep_lq) - - !call wetdep_inputs_set( state, pbuf, dep_inputs ) - - !lchnk = state%lchnk - !ncol = state%ncol - - !sflx_tot_dst(:) = 0._r8 - !sflx_tot_slt(:) = 0._r8 - - !do m = 1, nwetdep - - ! mm = wetdep_indices(m) - - ! sol_factb = aer_sol_factb(m) - ! sol_facti = aer_sol_facti(m) - - ! scavcoef(:ncol,:) = aer_scav_coef(m) - - ! call wetdepa_v1( state%t, state%pmid, state%q(:,:,1), state%pdel, & - ! dep_inputs%cldt, dep_inputs%cldcu, dep_inputs%cmfdqr, & - ! dep_inputs%conicw, dep_inputs%prain, dep_inputs%qme, & - ! dep_inputs%evapr, dep_inputs%totcond, state%q(:,:,mm), dt, & - ! scavt, iscavt, dep_inputs%cldv, & - ! fracis(:,:,mm), sol_factb, ncol, & - ! scavcoef, & - ! sol_facti_in=sol_facti, & - ! icscavt=icscavt, isscavt=isscavt, bcscavt=bcscavt, bsscavt=bsscavt ) - - ! ptend%q(:ncol,:,mm)=scavt(:ncol,:) - - ! call outfld( trim(cnst_name(mm))//'WET', ptend%q(:,:,mm), pcols, lchnk) - ! call outfld( trim(cnst_name(mm))//'SIC', icscavt , pcols, lchnk) - ! call outfld( trim(cnst_name(mm))//'SIS', isscavt, pcols, lchnk) - ! call outfld( trim(cnst_name(mm))//'SBC', bcscavt, pcols, lchnk) - ! call outfld( trim(cnst_name(mm))//'SBS', bsscavt, pcols, lchnk) - - ! sflx(:)=0._r8 - - ! do k=1,pver - ! do i=1,ncol - ! sflx(i)=sflx(i)+ptend%q(i,k,mm)*state%pdel(i,k)/gravit - ! enddo - ! enddo - ! call outfld( trim(cnst_name(mm))//'SFWET', sflx, pcols, lchnk) - ! - ! if ( any( sslt_names(:)==trim(cnst_name(mm)) ) ) & - ! sflx_tot_slt(:ncol) = sflx_tot_slt(:ncol) + sflx(:ncol) - ! if ( any( dust_names(:)==trim(cnst_name(mm)) ) ) & - ! sflx_tot_dst(:ncol) = sflx_tot_dst(:ncol) + sflx(:ncol) - - ! ! if the user has specified prescribed aerosol dep fluxes then - ! ! do not set cam_out dep fluxes according to the prognostic aerosols - ! if (.not.aerodep_flx_prescribed()) then - ! ! export deposition fluxes to coupler ??? why "-" sign ??? - ! if (trim(cnst_name(mm))=='CB2') then - ! cam_out%bcphiwet(:) = max(-sflx(:), 0._r8) - ! elseif (trim(cnst_name(mm))=='OC2') then - ! cam_out%ocphiwet(:) = max(-sflx(:), 0._r8) - ! elseif (trim(cnst_name(mm))==trim(dust_names(1))) then - ! cam_out%dstwet1(:) = max(-sflx(:), 0._r8) - ! elseif (trim(cnst_name(mm))==trim(dust_names(2))) then - ! cam_out%dstwet2(:) = max(-sflx(:), 0._r8) - ! elseif (trim(cnst_name(mm))==trim(dust_names(3))) then - ! cam_out%dstwet3(:) = max(-sflx(:), 0._r8) - ! elseif (trim(cnst_name(mm))==trim(dust_names(4))) then - ! cam_out%dstwet4(:) = max(-sflx(:), 0._r8) - ! endif - ! endif - - !enddo - ! - !if (sslt_active) then - ! call outfld( 'SSTSFWET', sflx_tot_slt, pcols, lchnk) - !endif - !if (dust_active) then - ! call outfld( 'DSTSFWET', sflx_tot_dst, pcols, lchnk) - !endif - - endsubroutine aero_model_wetdep - - !------------------------------------------------------------------------- - ! provides aerosol surface area info for sectional aerosols - ! called from mo_usrrxt - !------------------------------------------------------------------------- - subroutine aero_model_surfarea( & - mmr, radmean, relhum, pmid, temp, strato_sad, sulfate, m, ltrop, & - dlat, het1_ndx, pbuf, ncol, sfc, dm_aer, sad_total, reff_trop ) - - !use mo_constants, only : pi, avo => avogadro - - ! dummy args - real(r8), intent(in) :: pmid(:,:) - real(r8), intent(in) :: temp(:,:) - real(r8), intent(in) :: mmr(:,:,:) - real(r8), intent(in) :: radmean ! mean radii in cm - real(r8), intent(in) :: strato_sad(:,:) - integer, intent(in) :: ncol - integer, intent(in) :: ltrop(:) - real(r8), intent(in) :: dlat(:) ! degrees latitude - integer, intent(in) :: het1_ndx - real(r8), intent(in) :: relhum(:,:) - real(r8), intent(in) :: m(:,:) ! total atm density (/cm^3) - real(r8), intent(in) :: sulfate(:,:) - type(physics_buffer_desc), pointer :: pbuf(:) - - real(r8), intent(inout) :: sfc(:,:,:) - real(r8), intent(inout) :: dm_aer(:,:,:) - real(r8), intent(inout) :: sad_total(:,:) - real(r8), intent(out) :: reff_trop(:,:) - - !! local vars - - !integer :: i,k - !real(r8) :: rho_air - !real(r8) :: v, n, n_exp, r_rd, r_sd - !real(r8) :: dm_sulf, dm_sulf_wet, log_sd_sulf, sfc_sulf, sfc_nit - !real(r8) :: dm_orgc, dm_orgc_wet, log_sd_orgc, sfc_oc, sfc_soa - !real(r8) :: sfc_soai, sfc_soam, sfc_soab, sfc_soat, sfc_soax - !real(r8) :: dm_bc, dm_bc_wet, log_sd_bc, sfc_bc - !real(r8) :: rxt_sulf, rxt_nit, rxt_oc, rxt_soa - !real(r8) :: c_n2o5, c_ho2, c_no2, c_no3 - !real(r8) :: s_exp - - !!----------------------------------------------------------------- - !! ... parameters for log-normal distribution by number - !! references: - !! Chin et al., JAS, 59, 461, 2003 - !! Liao et al., JGR, 108(D1), 4001, 2003 - !! Martin et al., JGR, 108(D3), 4097, 2003 - !!----------------------------------------------------------------- - !real(r8), parameter :: rm_sulf = 6.95e-6_r8 ! mean radius of sulfate particles (cm) (Chin) - !real(r8), parameter :: sd_sulf = 2.03_r8 ! standard deviation of radius for sulfate (Chin) - !real(r8), parameter :: rho_sulf = 1.7e3_r8 ! density of sulfate aerosols (kg/m3) (Chin) - - !real(r8), parameter :: rm_orgc = 2.12e-6_r8 ! mean radius of organic carbon particles (cm) (Chin) - !real(r8), parameter :: sd_orgc = 2.20_r8 ! standard deviation of radius for OC (Chin) - !real(r8), parameter :: rho_orgc = 1.8e3_r8 ! density of OC aerosols (kg/m3) (Chin) - - !real(r8), parameter :: rm_bc = 1.18e-6_r8 ! mean radius of soot/BC particles (cm) (Chin) - !real(r8), parameter :: sd_bc = 2.00_r8 ! standard deviation of radius for BC (Chin) - !real(r8), parameter :: rho_bc = 1.0e3_r8 ! density of BC aerosols (kg/m3) (Chin) - - !real(r8), parameter :: mw_so4 = 98.e-3_r8 ! so4 molecular wt (kg/mole) - - !integer :: irh, rh_l, rh_u - !real(r8) :: factor, rfac_sulf, rfac_oc, rfac_bc, rfac_ss - !logical :: zero_aerosols - - !!----------------------------------------------------------------- - !! ... table for hygroscopic growth effect on radius (Chin et al) - !! (no growth effect for mineral dust) - !!----------------------------------------------------------------- - !real(r8), dimension(7) :: table_rh, table_rfac_sulf, table_rfac_bc, table_rfac_oc, table_rfac_ss - - !data table_rh(1:7) / 0.0_r8, 0.5_r8, 0.7_r8, 0.8_r8, 0.9_r8, 0.95_r8, 0.99_r8/ - !data table_rfac_sulf(1:7) / 1.0_r8, 1.4_r8, 1.5_r8, 1.6_r8, 1.8_r8, 1.9_r8, 2.2_r8/ - !data table_rfac_oc(1:7) / 1.0_r8, 1.2_r8, 1.4_r8, 1.5_r8, 1.6_r8, 1.8_r8, 2.2_r8/ - !data table_rfac_bc(1:7) / 1.0_r8, 1.0_r8, 1.0_r8, 1.2_r8, 1.4_r8, 1.5_r8, 1.9_r8/ - !data table_rfac_ss(1:7) / 1.0_r8, 1.6_r8, 1.8_r8, 2.0_r8, 2.4_r8, 2.9_r8, 4.8_r8/ - - !!----------------------------------------------------------------- - !! ... exponent for calculating number density - !!----------------------------------------------------------------- - !n_exp = exp( -4.5_r8*log(sd_sulf)*log(sd_sulf) ) - - !dm_sulf = 2._r8 * rm_sulf - !dm_orgc = 2._r8 * rm_orgc - !dm_bc = 2._r8 * rm_bc - - !log_sd_sulf = log(sd_sulf) - !log_sd_orgc = log(sd_orgc) - !log_sd_bc = log(sd_bc) - - !reff_trop(:,:) = 0._r8 - - !ver_loop: do k = 1,pver - ! col_loop: do i = 1,ncol - ! !------------------------------------------------------------------------- - ! ! ... air density (kg/m3) - ! !------------------------------------------------------------------------- - ! rho_air = pmid(i,k)/(temp(i,k)*287.04_r8) - ! !------------------------------------------------------------------------- - ! ! ... aerosol growth interpolated from M.Chin's table - ! !------------------------------------------------------------------------- - ! if (relhum(i,k) >= table_rh(7)) then - ! rfac_sulf = table_rfac_sulf(7) - ! rfac_oc = table_rfac_oc(7) - ! rfac_bc = table_rfac_bc(7) - ! else - ! do irh = 2,7 - ! if (relhum(i,k) <= table_rh(irh)) then - ! exit - ! end if - ! end do - ! rh_l = irh-1 - ! rh_u = irh - - ! factor = (relhum(i,k) - table_rh(rh_l))/(table_rh(rh_u) - table_rh(rh_l)) - - ! rfac_sulf = table_rfac_sulf(rh_l) + factor*(table_rfac_sulf(rh_u) - table_rfac_sulf(rh_l)) - ! rfac_oc = table_rfac_oc(rh_u) + factor*(table_rfac_oc(rh_u) - table_rfac_oc(rh_l)) - ! rfac_bc = table_rfac_bc(rh_u) + factor*(table_rfac_bc(rh_u) - table_rfac_bc(rh_l)) - ! end if - - ! dm_sulf_wet = dm_sulf * rfac_sulf - ! dm_orgc_wet = dm_orgc * rfac_oc - ! dm_bc_wet = dm_bc * rfac_bc - - ! dm_bc_wet = min(dm_bc_wet ,50.e-6_r8) ! maximum size is 0.5 micron (Chin) - ! dm_orgc_wet = min(dm_orgc_wet,50.e-6_r8) ! maximum size is 0.5 micron (Chin) - - - ! !------------------------------------------------------------------------- - ! ! ... sulfate aerosols - ! !------------------------------------------------------------------------- - ! zero_aerosols = k < ltrop(i) - ! if ( abs( dlat(i) ) > 50._r8 ) then - ! zero_aerosols = pmid(i,k) < 30000._r8 - ! endif - ! !------------------------------------------------------------------------- - ! ! ... use ubvals climatology for stratospheric sulfate surface area density - ! !------------------------------------------------------------------------- - ! if( zero_aerosols ) then - ! sfc_sulf = strato_sad(i,k) - ! if ( het1_ndx > 0 ) then - ! sfc_sulf = 0._r8 ! reaction already taken into account in mo_strato_rates.F90 - ! end if - ! sfc_nit = 0._r8 - ! sfc_soa = 0._r8 - ! sfc_oc = 0._r8 - ! sfc_bc = 0._r8 - ! else - - ! if( so4_ndx > 0 ) then - ! !------------------------------------------------------------------------- - ! ! convert mass mixing ratio of aerosol to cm3/cm3 (cm^3_aerosol/cm^3_air) - ! ! v=volume density (m^3/m^3) - ! ! rho_aer=density of aerosol (kg/m^3) - ! ! v=m*rho_air/rho_aer [kg/kg * (kg/m3)_air/(kg/m3)_aer] - ! !------------------------------------------------------------------------- - ! v = mmr(i,k,so4_ndx) * rho_air/rho_sulf - ! !------------------------------------------------------------------------- - ! ! calculate the number density of aerosol (aerosols/cm3) - ! ! assuming a lognormal distribution - ! ! n = (aerosols/cm3) - ! ! dm = geometric mean diameter - ! ! - ! ! because only the dry mass of the aerosols is known, we - ! ! use the mean dry radius - ! !------------------------------------------------------------------------- - ! n = v * (6._r8/pi)*(1._r8/(dm_sulf**3._r8))*n_exp - ! !------------------------------------------------------------------------- - ! ! find surface area of aerosols using dm_wet, log_sd - ! ! (increase of sd due to RH is negligible) - ! ! and number density calculated above as distribution - ! ! parameters - ! ! sfc = surface area of wet aerosols (cm^2/cm^3) - ! !------------------------------------------------------------------------- - ! s_exp = exp(2._r8*log_sd_sulf*log_sd_sulf) - ! sfc_sulf = n * pi * (dm_sulf_wet**2._r8) * s_exp - - ! else - ! !------------------------------------------------------------------------- - ! ! if so4 not simulated, use off-line sulfate and calculate as above - ! ! convert sulfate vmr to volume density of aerosol (cm^3_aerosol/cm^3_air) - ! !------------------------------------------------------------------------- - ! v = sulfate(i,k) * m(i,k) * mw_so4 / (avo * rho_sulf) *1.e6_r8 - ! n = v * (6._r8/pi)*(1._r8/(dm_sulf**3._r8))*n_exp - ! s_exp = exp(2._r8*log_sd_sulf*log_sd_sulf) - ! sfc_sulf = n * pi * (dm_sulf_wet**2._r8) * s_exp - - ! end if - ! - ! !------------------------------------------------------------------------- - ! ! ammonium nitrate (follow same procedure as sulfate, using size and density of sulfate) - ! !------------------------------------------------------------------------- - ! if( nit_ndx > 0 ) then - ! v = mmr(i,k,nit_ndx) * rho_air/rho_sulf - ! n = v * (6._r8/pi)*(1._r8/(dm_sulf**3._r8))*n_exp - ! s_exp = exp(2._r8*log_sd_sulf*log_sd_sulf) - ! sfc_nit = n * pi * (dm_sulf_wet**2._r8) * s_exp - ! else - ! sfc_nit = 0._r8 - ! end if - - ! !------------------------------------------------------------------------- - ! ! hydrophylic organic carbon (follow same procedure as sulfate) - ! !------------------------------------------------------------------------- - ! if( oc2_ndx > 0 ) then - ! v = mmr(i,k,oc2_ndx) * rho_air/rho_orgc - ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3))*n_exp - ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) - ! sfc_oc = n * pi * (dm_orgc_wet**2._r8) * s_exp - ! else - ! sfc_oc = 0._r8 - ! end if - - ! !------------------------------------------------------------------------- - ! ! secondary organic carbon (follow same procedure as sulfate) - ! !------------------------------------------------------------------------- - ! if( soa_ndx > 0 ) then - ! v = mmr(i,k,soa_ndx) * rho_air/rho_orgc - ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp - ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) - ! sfc_soa = n * pi * (dm_orgc_wet**2._r8) * s_exp - ! else - ! sfc_soa = 0._r8 - ! end if - - ! !------------------------------------------------------------------------- - ! ! black carbon (follow same procedure as sulfate) - ! !------------------------------------------------------------------------- - ! if( cb2_ndx > 0 ) then - ! v = mmr(i,k,cb2_ndx) * rho_air/rho_bc - ! n = v * (6._r8/pi)*(1._r8/(dm_bc**3._r8))*n_exp - ! s_exp = exp(2._r8*log_sd_bc*log_sd_bc) - ! sfc_bc = n * pi * (dm_bc_wet**2._r8) * s_exp - ! else - ! sfc_bc = 0._r8 - ! end if - ! if( soai_ndx > 0 ) then - ! v = mmr(i,k,soai_ndx) * rho_air/rho_orgc - ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp - ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) - ! sfc_soai = n * pi * (dm_orgc_wet**2._r8) * s_exp - ! else - ! sfc_soai = 0._r8 - ! end if - ! if( soam_ndx > 0 ) then - ! v = mmr(i,k,soam_ndx) * rho_air/rho_orgc - ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp - ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) - ! sfc_soam = n * pi * (dm_orgc_wet**2._r8) * s_exp - ! else - ! sfc_soam = 0._r8 - ! end if - ! if( soab_ndx > 0 ) then - ! v = mmr(i,k,soab_ndx) * rho_air/rho_orgc - ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp - ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) - ! sfc_soab = n * pi * (dm_orgc_wet**2._r8) * s_exp - ! else - ! sfc_soab = 0._r8 - ! end if - ! if( soat_ndx > 0 ) then - ! v = mmr(i,k,soat_ndx) * rho_air/rho_orgc - ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp - ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) - ! sfc_soat = n * pi * (dm_orgc_wet**2._r8) * s_exp - ! else - ! sfc_soat = 0._r8 - ! end if - ! if( soax_ndx > 0 ) then - ! v = mmr(i,k,soax_ndx) * rho_air/rho_orgc - ! n = v * (6._r8/pi)*(1._r8/(dm_orgc**3._r8))*n_exp - ! s_exp = exp(2._r8*log_sd_orgc*log_sd_orgc) - ! sfc_soax = n * pi * (dm_orgc_wet**2._r8) * s_exp - ! else - ! sfc_soax = 0._r8 - ! end if - ! sfc_soa = sfc_soa + sfc_soai + sfc_soam + sfc_soab + sfc_soat + sfc_soax - - ! end if - - ! sfc(i,k,:) = (/ sfc_sulf, sfc_nit, sfc_oc, sfc_soa, sfc_bc /) - ! dm_aer(i,k,:) = (/ dm_sulf_wet,dm_sulf_wet,dm_orgc_wet,dm_orgc_wet,dm_bc_wet /) - - ! !------------------------------------------------------------------------- - ! ! ... add up total surface area density for output - ! !------------------------------------------------------------------------- - ! sad_total(i,k) = sfc_sulf + sfc_nit + sfc_oc + sfc_soa + sfc_bc - - ! enddo col_loop - !enddo ver_loop - - end subroutine aero_model_surfarea - - !------------------------------------------------------------------------- - ! stub - !------------------------------------------------------------------------- - subroutine aero_model_strat_surfarea( ncol, mmr, pmid, temp, ltrop, pbuf, strato_sad, reff_strat ) - - ! dummy args - integer, intent(in) :: ncol - real(r8), intent(in) :: mmr(:,:,:) - real(r8), intent(in) :: pmid(:,:) - real(r8), intent(in) :: temp(:,:) - integer, intent(in) :: ltrop(:) ! tropopause level indices - type(physics_buffer_desc), pointer :: pbuf(:) - real(r8), intent(out) :: strato_sad(:,:) - real(r8), intent(out) :: reff_strat(:,:) - - strato_sad(:,:) = 0._r8 - reff_strat(:,:) = 0._r8 - - end subroutine aero_model_strat_surfarea - - !============================================================================= - !============================================================================= - subroutine aero_model_gasaerexch( loffset, ncol, lchnk, troplev, delt, reaction_rates, & - tfld, pmid, pdel, mbar, relhum, & - zm, qh2o, cwat, cldfr, cldnum, & - airdens, invariants, del_h2so4_gasprod, & - vmr0, vmr, pbuf ) - - use chem_mods, only : gas_pcnst - !use mo_aerosols, only : aerosols_formation, has_aerosols - !use mo_setsox, only : setsox, has_sox - !use mo_setsoa, only : setsoa, has_soa - - !----------------------------------------------------------------------- - ! ... dummy arguments - !----------------------------------------------------------------------- - integer, intent(in) :: loffset ! offset applied to modal aero "pointers" - integer, intent(in) :: ncol ! number columns in chunk - integer, intent(in) :: lchnk ! chunk index - integer, intent(in) :: troplev(:) - real(r8), intent(in) :: delt ! time step size (sec) - real(r8), intent(in) :: reaction_rates(:,:,:) ! reaction rates - real(r8), intent(in) :: tfld(:,:) ! temperature (K) - real(r8), intent(in) :: pmid(:,:) ! pressure at model levels (Pa) - real(r8), intent(in) :: pdel(:,:) ! pressure thickness of levels (Pa) - real(r8), intent(in) :: mbar(:,:) ! mean wet atmospheric mass ( amu ) - real(r8), intent(in) :: relhum(:,:) ! relative humidity - real(r8), intent(in) :: airdens(:,:) ! total atms density (molec/cm**3) - real(r8), intent(in) :: invariants(:,:,:) - real(r8), intent(in) :: del_h2so4_gasprod(:,:) - real(r8), intent(in) :: zm(:,:) - real(r8), intent(in) :: qh2o(:,:) - real(r8), intent(in) :: cwat(:,:) ! cloud liquid water content (kg/kg) - real(r8), intent(in) :: cldfr(:,:) - real(r8), intent(in) :: cldnum(:,:) ! droplet number concentration (#/kg) - real(r8), intent(in) :: vmr0(:,:,:) ! initial mixing ratios (before gas-phase chem changes) - real(r8), intent(inout) :: vmr(:,:,:) ! mixing ratios ( vmr ) - - type(physics_buffer_desc), pointer :: pbuf(:) - - !! local vars - - !real(r8) :: vmrcw(ncol,pver,gas_pcnst) ! cloud-borne aerosol (vmr) - - !real(r8) :: aqso4(ncol,1) ! aqueous phase chemistry - !real(r8) :: aqh2so4(ncol,1) ! aqueous phase chemistry - !real(r8) :: aqso4_h2o2(ncol) ! SO4 aqueous phase chemistry due to H2O2 - !real(r8) :: aqso4_o3(ncol) ! SO4 aqueous phase chemistry due to O3 - !real(r8) :: xphlwc(ncol,pver) ! pH value multiplied by lwc - - - ! !aqueous chemistry ... - - !if( has_sox ) then - ! call setsox( & - ! ncol, & - ! lchnk, & - ! loffset, & - ! delt, & - ! pmid, & - ! pdel, & - ! tfld, & - ! mbar, & - ! cwat, & - ! cldfr, & - ! cldnum, & - ! airdens, & - ! invariants, & - ! vmrcw, & - ! vmr, & - ! xphlwc, & - ! aqso4, & - ! aqh2so4, & - ! aqso4_h2o2,& - ! aqso4_o3 & - ! ) - ! call outfld( 'XPH_LWC',xphlwc(:ncol,:), ncol , lchnk ) - !endif - - !if( has_soa ) then - ! call setsoa( ncol, lchnk, delt, reaction_rates, tfld, airdens, vmr, pbuf) - !endif - - !if( has_aerosols ) then - ! call aerosols_formation( ncol, lchnk, tfld, relhum, vmr ) - !endif - - - end subroutine aero_model_gasaerexch - - !============================================================================= - !============================================================================= - subroutine aero_model_emissions( state, cam_in ) - !use seasalt_model, only: seasalt_emis, seasalt_indices - !use dust_model, only: dust_emis, dust_indices - use physics_types, only: physics_state - - ! Arguments: - - type(physics_state), intent(in) :: state ! Physics state variables - type(cam_in_t), intent(inout) :: cam_in ! import state - - !! local vars - - !integer :: lchnk, ncol - !integer :: m, mm - !real(r8) :: soil_erod_tmp(pcols) - !real(r8) :: sflx(pcols) ! accumulate over all bins for output - !real(r8) :: u10cubed(pcols) - !real (r8), parameter :: z0=0.0001_r8 ! m roughness length over oceans--from ocean model - - !lchnk = state%lchnk - !ncol = state%ncol - - !if (dust_active) then - - ! call dust_emis( ncol, lchnk, cam_in%dstflx, cam_in%cflx, soil_erod_tmp ) - - ! ! some dust emis diagnostics ... - ! sflx(:)=0._r8 - ! do m=1,dust_nbin - ! mm = dust_indices(m) - ! sflx(:ncol)=sflx(:ncol)+cam_in%cflx(:ncol,mm) - ! call outfld(trim(dust_names(m))//'SF',cam_in%cflx(:,mm),pcols, lchnk) - ! enddo - ! call outfld('DSTSFMBL',sflx(:),pcols,lchnk) - ! call outfld('LND_MBL',soil_erod_tmp(:),pcols, lchnk ) - !endif - - !if (sslt_active) then - ! u10cubed(:ncol)=sqrt(state%u(:ncol,pver)**2+state%v(:ncol,pver)**2) - ! ! move the winds to 10m high from the midpoint of the gridbox: - ! ! follows Tie and Seinfeld and Pandis, p.859 with math. - - ! u10cubed(:ncol)=u10cubed(:ncol)*log(10._r8/z0)/log(state%zm(:ncol,pver)/z0) - - ! ! we need them to the 3.41 power, according to Gong et al., 1997: - ! u10cubed(:ncol)=u10cubed(:ncol)**3.41_r8 - - ! sflx(:)=0._r8 - - ! call seasalt_emis( u10cubed, cam_in%sst, cam_in%ocnfrac, ncol, cam_in%cflx ) - - ! do m=1,seasalt_nbin - ! mm = seasalt_indices(m) - ! sflx(:ncol)=sflx(:ncol)+cam_in%cflx(:ncol,mm) - ! call outfld(trim(seasalt_names(m))//'SF',cam_in%cflx(:,mm),pcols,lchnk) - ! enddo - ! call outfld('SSTSFMBL',sflx(:),pcols,lchnk) - !endif - - end subroutine aero_model_emissions - -end module aero_model diff --git a/src/chemistry/pp_geoschem/chemistry.F90 b/src/chemistry/pp_geoschem/chemistry.F90 deleted file mode 100644 index 2914f1ae38..0000000000 --- a/src/chemistry/pp_geoschem/chemistry.F90 +++ /dev/null @@ -1,4160 +0,0 @@ -!================================================================================================ -! This is the "GEOS-Chem" chemistry module. -!================================================================================================ - -module chemistry - use shr_kind_mod, only: r8 => shr_kind_r8 - use physics_types, only: physics_state, physics_ptend, physics_ptend_init - use ppgrid, only: begchunk, endchunk, pcols - use ppgrid, only: pver, pverp - use constituents, only: pcnst, cnst_add, cnst_get_ind - !use mo_gas_phase_chemdr, only: map2chm - !use mo_constants, only: pi - use shr_const_mod, only: molw_dryair=>SHR_CONST_MWDAIR - !use chem_mods, only : gas_pcnst, adv_mass - !use mo_sim_dat, only: set_sim_dat - use seq_drydep_mod, only : nddvels => n_drydep, drydep_list - use spmd_utils, only : MasterProc, myCPU=>Iam, nCPUs=>npes - use cam_logfile, only : iulog - use string_utils, only : to_upper - - !-------------------------------------------------------------------- - ! Basic GEOS-Chem modules - !-------------------------------------------------------------------- - USE DiagList_Mod, ONLY : DgnList ! Derived type for diagnostics list - USE Input_Opt_Mod, ONLY : OptInput ! Derived type for Input Options - USE State_Chm_Mod, ONLY : ChmState ! Derived type for Chemistry State object - USE State_Diag_Mod, ONLY : DgnState ! Derived type for Diagnostics State object - USE State_Grid_Mod, ONLY : GrdState ! Derived type for Grid State object - USE State_Met_Mod, ONLY : MetState ! Derived type for Meteorology State object - USE ErrCode_Mod ! Error codes for success or failure - USE Error_Mod ! For error checking - - !----------------------------------------------------------------- - ! Parameters to define floating-point variables - !----------------------------------------------------------------- - USE PRECISION_MOD, ONLY : fp, f4 ! Flexible precision - - use Chem_Mods, only : nSlvd, slvd_Lst, slvd_ref_MMR - - ! Exit routine in CAM - use cam_abortutils, only : endrun - - use chem_mods, only : nTracersMax - use chem_mods, only : nTracers - use chem_mods, only : tracerNames - use chem_mods, only : tracerLongNames - use chem_mods, only : adv_Mass - use chem_mods, only : mwRatio - use chem_mods, only : ref_mmr - use chem_mods, only : nSlsMax - use chem_mods, only : nSls - use chem_mods, only : slsNames - use chem_mods, only : slsLongNames - use chem_mods, only : sls_ref_MMR - use chem_mods, only : slsmwRatio - use chem_mods, only : map2GC - use chem_mods, only : map2GC_Sls - use chem_mods, only : map2Idx - - IMPLICIT NONE - PRIVATE - SAVE - ! - ! Public interfaces - ! - public :: chem_is ! identify which chemistry is being used - public :: chem_register ! register consituents - public :: chem_is_active ! returns true if this package is active (ghg_chem=.true.) - public :: chem_implements_cnst ! returns true if consituent is implemented by this package - public :: chem_init_cnst ! initialize mixing ratios if not read from initial file - public :: chem_init ! initialize (history) variables - public :: chem_timestep_tend ! interface to tendency computation - public :: chem_final - public :: chem_write_restart - public :: chem_read_restart - public :: chem_init_restart - public :: chem_readnl ! read chem namelist - - public :: chem_emissions - public :: chem_timestep_init - - ! Location of valid input.geos - CHARACTER(LEN=500) :: inputGeosPath - - ! Location of chemistry input (for now) - CHARACTER(LEN=500) :: chemInputsDir - - !----------------------------- - ! Derived type objects - !----------------------------- - TYPE(OptInput) :: Input_Opt ! Input Options object - TYPE(ChmState),ALLOCATABLE :: State_Chm(:) ! Chemistry State object - TYPE(DgnState),ALLOCATABLE :: State_Diag(:) ! Diagnostics State object - TYPE(GrdState),ALLOCATABLE :: State_Grid(:) ! Grid State object - TYPE(MetState),ALLOCATABLE :: State_Met(:) ! Meteorology State object - TYPE(DgnList ) :: Diag_List ! Diagnostics list object - - ! Indices of critical species - INTEGER :: iH2O, iO3, iCH4, iCO, iNO - - ! Indices in the physics buffer - INTEGER :: NDX_PBLH ! PBL height [m] - INTEGER :: NDX_FSDS ! Downward shortwave flux at surface [W/m2] - INTEGER :: NDX_CLDTOP ! Cloud top height [index] - INTEGER :: NDX_CLDFRC ! Cloud fraction [-] - INTEGER :: NDX_PRAIN ! Rain production rate [kg/kg/s] - INTEGER :: NDX_NEVAPR ! Total rate of precipitation evaporation [kg/kg/s] - INTEGER :: NDX_RPRDTOT ! Convective total precip. production rate [kg/kg/s] - INTEGER :: NDX_LSFLXPRC ! Large-scale precip. at interface (liq + snw) [kg/m2/s] - INTEGER :: NDX_LSFLXSNW ! Large-scale precip. at interface (snow only) [kg/m2/s] - - ! Get constituent indices - INTEGER :: ixCldLiq - INTEGER :: ixCldIce - - ! Strings - CHARACTER(LEN=255) :: ThisLoc - CHARACTER(LEN=255) :: ErrMsg - -#define ALLDDVEL_GEOSCHEM 1 -#define OCNDDVEL_GEOSCHEM 0 -#define OCNDDVEL_MOZART 0 - -! The following flags are only used if ALLDDVEL_GEOSCHEM is on -#define LANDTYPE_HEMCO 0 -#define LANDTYPE_CLM 1 - -#if ( OCNDDVEL_MOZART ) - ! Filenames to compute dry deposition velocities similarly to MOZART - CHARACTER(LEN=255) :: MOZART_depvel_lnd_file = 'depvel_lnd_file' - CHARACTER(LEN=255) :: MOZART_clim_soilw_file = 'clim_soilw_file' - CHARACTER(LEN=255) :: MOZART_season_wes_file = 'season_wes_file' -#endif - -!================================================================================================ -contains -!================================================================================================ - - LOGICAL function chem_is (NAME) - - CHARACTER(LEN=*), INTENT(IN) :: NAME - - chem_is = .false. - IF (NAME == 'geoschem' ) THEN - chem_is = .true. - ENDIF - IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_IS' - - end function chem_is - -!================================================================================================ - - subroutine chem_register - - use physics_buffer, only : pbuf_add_field, dtype_r8 - use PhysConst, only : MWDry - - use Short_Lived_Species, only : Register_Short_Lived_Species - - use State_Grid_Mod, only : Init_State_Grid, Cleanup_State_Grid - use State_Chm_Mod, only : Init_State_Chm, Cleanup_State_Chm - use State_Chm_Mod, only : Ind_ - use Input_Opt_Mod, only : Set_Input_Opt, Cleanup_Input_Opt - use Species_Mod, only : Species - - use mo_sim_dat, only : set_sim_dat - - !----------------------------------------------------------------------- - ! - ! Purpose: register advected constituents for chemistry - ! - !----------------------------------------------------------------------- - ! Need to generate a temporary species database - Type(ChmState) :: SC - Type(GrdState) :: SG - Type(OptInput) :: IO - TYPE(Species), POINTER :: ThisSpc - - INTEGER :: I, N, M - REAL(r8) :: cptmp - REAL(r8) :: mwtmp - REAL(r8) :: qmin - REAL(r8) :: ref_VMR - CHARACTER(LEN=128) :: mixtype - CHARACTER(LEN=128) :: molectype - CHARACTER(LEN=128) :: lng_Name - LOGICAL :: camout - LOGICAL :: ic_from_cam2 - LOGICAL :: has_fixed_ubc - LOGICAL :: has_fixed_ubflx - - INTEGER :: RC - - ! SDE 2018-05-02: This seems to get called before anything else - ! that includes CHEM_INIT - ! At this point, mozart calls SET_SIM_DAT, which is specified by each - ! mechanism separately (ie mozart/chemistry.F90 calls the subroutine - ! set_sim_dat which is in pp_[mechanism]/mo_sim_dat.F90. That sets a lot of - ! data in other places, notably in "chem_mods" - - IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_REGISTER' - - ! hplin 2020-05-16: Call set_sim_dat to populate chemistry constituent information - ! from mo_sim_dat.F90 in other places. This is needed for HEMCO_CESM. - call set_sim_dat() - if(masterproc) write(iulog,*) 'GCCALL after set_sim_dat' - - ! Generate fake state_chm - IO%Max_BPCH_Diag = 1000 - IO%Max_AdvectSpc = 500 - IO%Max_Families = 250 - - IO%RootCPU = .False. - - CALL Set_Input_Opt( Am_I_Root = MasterProc, & - INPUT_OPT = IO, & - RC = RC ) - - IF(MASTERPROC) WRITE(IULOG,*) 'GCCALL AFTER SET_INPUT_OPT' - - IF ( RC /= GC_SUCCESS ) THEN - ERRMSG = 'COULD NOT GENERATE REFERENCE INPUT OPTIONS OBJECT!' - CALL ERROR_STOP( ERRMSG, THISLOC ) - ENDIF - - ! OPTIONS NEEDED BY INIT_STATE_CHM - IO%ITS_A_FULLCHEM_SIM = .TRUE. - IO%LLINOZ = .TRUE. - IO%LUCX = .TRUE. - IO%LPRT = .FALSE. - IO%N_ADVECT = NTRACERS - DO I = 1, NTRACERS - IO%ADVECTSPC_NAME(I) = TRIM(TRACERNAMES(I)) - ENDDO - IO%SALA_REDGE_UM(1) = 0.01E+0_FP - IO%SALA_REDGE_UM(2) = 0.50E+0_FP - IO%SALC_REDGE_UM(1) = 0.50E+0_FP - IO%SALC_REDGE_UM(2) = 8.00E+0_FP - - ! PREVENT REPORTING - IO%ROOTCPU = .FALSE. - IO%MYCPU = MYCPU - - CALL INIT_STATE_GRID( STATE_GRID = SG , & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ERRMSG = 'ERROR ENCOUNTERED WITHIN CALL TO "INIT_STATE_GRID"!' - CALL ERROR_STOP( ERRMSG, THISLOC ) - ENDIF - - SG%NX = 1 - SG%NY = 1 - SG%NZ = 1 - - CALL INIT_STATE_CHM( INPUT_OPT = IO, & - STATE_CHM = SC, & - STATE_GRID = SG, & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ERRMSG = 'ERROR ENCOUNTERED WITHIN CALL TO "INIT_STATE_CHM"!' - CALL ERROR_STOP( ERRMSG, THISLOC ) - ENDIF - - ! AT THE MOMENT, WE FORCE NADV_CHEM=200 IN THE SETUP FILE - ! DEFAULT - MAP2GC = -1 - REF_MMR(:) = 0.0E+0_R8 - MWRATIO(:) = 1.0E+0_R8 - TRACERLONGNAMES = '' - - DO I = 1, NTRACERSMAX - IF (I.LE.NTRACERS) THEN - N = IND_(TRACERNAMES(I)) - THISSPC => SC%SPCDATA(N)%INFO - LNG_NAME = TRIM(THISSPC%FULLNAME) - MWTMP = REAL(THISSPC%MW_G,R8) - REF_VMR = REAL(THISSPC%BACKGROUNDVV,R8) - ADV_MASS(I) = MWTMP - REF_MMR(I) = REF_VMR / (MWDRY / MWTMP) - ELSE - LNG_NAME = TRIM(TRACERNAMES(I)) - MWTMP = 1000.0E+0_R8 * (0.001E+0_R8) - ADV_MASS(I) = MWTMP - REF_MMR(I) = 1.0E-38_R8 - ENDIF - MWRATIO(I) = MWDRY/MWTMP - TRACERLONGNAMES(I) = TRIM(LNG_NAME) - - ! DUMMY VALUE FOR SPECIFIC HEAT OF CONSTANT PRESSURE (CP) - CPTMP = 666._R8 - ! MINIMUM MIXING RATIO - QMIN = 1.E-38_R8 - ! MIXING RATIO TYPE - MIXTYPE = 'DRY' - ! USED FOR IONOSPHERIC WACCM (WACCM-X) - MOLECTYPE = 'MINOR' - ! IS AN OUTPUT FIELD (?) - CAMOUT = .FALSE. - ! NOT TRUE FOR O2(1-DELTA) OR O2(1-SIGMA) - IC_FROM_CAM2 = .TRUE. - ! USE A FIXED VALUE AT THE UPPER BOUNDARY - HAS_FIXED_UBC = .FALSE. - ! USE A FIXED FLUX CONDITION AT THE UPPER BOUNDARY - HAS_FIXED_UBFLX = .FALSE. - !WRITE(TRACERNAMES(I),'(A,I0.4)') 'GCTRC_', I - ! NOTE: IN MOZART, THIS ONLY GETS CALLED FOR TRACERS - ! THIS IS THE CALL TO ADD A "CONSTITUENT" - CALL CNST_ADD( TRIM(TRACERNAMES(I)), ADV_MASS(I), CPTMP, QMIN, N, & - READIV=IC_FROM_CAM2, MIXTYPE=MIXTYPE, CAM_OUTFLD=CAMOUT, & - MOLECTYPE=MOLECTYPE, FIXED_UBC=HAS_FIXED_UBC, & - FIXED_UBFLX=HAS_FIXED_UBFLX, LONGNAME=TRIM(LNG_NAME) ) - - ! ADD TO GC MAPPING. WHEN STARTING A TIMESTEP, WE WILL WANT TO UPDATE THE - ! CONCENTRATION OF STATE_CHM(X)%SPECIES(1,ICOL,ILEV,M) WITH DATA FROM - ! CONSTITUENT N - M = IND_(TRIM(TRACERNAMES(I))) - IF ( M > 0 ) THEN - MAP2GC(N) = M - MAP2IDX(N) = I - ENDIF - ! NULLIFY POINTER - THISSPC => NULL() - ENDDO - - ! NOW UNADVECTED SPECIES - MAP2GC_SLS = 0 - SLS_REF_MMR(:) = 0.0E+0_R8 - SLSMWRATIO(:) = -1.0E+0_R8 - SLSLONGNAMES = '' - DO I = 1, NSLS - N = IND_(SLSNAMES(I)) - IF ( N .GT. 0 ) THEN - THISSPC => SC%SPCDATA(N)%INFO - MWTMP = REAL(THISSPC%MW_G,R8) - REF_VMR = REAL(THISSPC%BACKGROUNDVV,R8) - LNG_NAME = TRIM(THISSPC%FULLNAME) - SLSLONGNAMES(I) = LNG_NAME - SLS_REF_MMR(I) = REF_VMR / (MWDRY / MWTMP) - SLSMWRATIO(I) = MWDRY / MWTMP - MAP2GC_SLS(I) = N - THISSPC => NULL() - ENDIF - ENDDO - - ! PASS INFORMATION TO "SHORT_LIVED_SPECIES" MODULE - SLVD_REF_MMR(1:NSLS) = SLS_REF_MMR(1:NSLS) - CALL REGISTER_SHORT_LIVED_SPECIES() - ! MORE INFORMATION: - ! HTTP://WWW.CESM.UCAR.EDU/MODELS/ATM-CAM/DOCS/PHYS-INTERFACE/NODE5.HTML - - ! CLEAN UP - CALL CLEANUP_STATE_CHM ( .FALSE., SC, RC ) - CALL CLEANUP_STATE_GRID( .FALSE., SG, RC ) - CALL CLEANUP_INPUT_OPT ( .FALSE., IO, RC ) - - END SUBROUTINE CHEM_REGISTER - - SUBROUTINE CHEM_READNL(NLFILE) - ! THIS IS THE FIRST ROUTINE TO GET CALLED - SO IT SHOULD READ IN - ! GEOS-CHEM OPTIONS FROM INPUT.GEOS WITHOUT ACTUALLY DOING ANY - ! INITIALIZATION - - USE CAM_ABORTUTILS, ONLY : ENDRUN - USE UNITS, ONLY : GETUNIT, FREEUNIT - USE MPISHORTHAND - USE GCKPP_MODEL, ONLY : NSPEC, SPC_NAMES - USE MO_CHEM_UTLS, ONLY : GET_SPC_NDX - USE CHEM_MODS, ONLY : DRYSPC_NDX - - ! ARGS - CHARACTER(LEN=*), INTENT(IN) :: NLFILE ! FILEPATH FOR FILE CONTAINING NAMELIST INPUT - - ! LOCAL VARIABLES - INTEGER :: I, N, NIGNORED - INTEGER :: UNITN, IERR - CHARACTER(LEN=500) :: LINE - LOGICAL :: MENUFOUND - LOGICAL :: VALIDSLS - -#IF ( OCNDDVEL_MOZART ) - NAMELIST /CHEM_INPARM/ MOZART_DEPVEL_LND_FILE, & - MOZART_CLIM_SOILW_FILE, & - MOZART_SEASON_WES_FILE -#ENDIF - - NIGNORED = 0 - - ! SET PATHS - ! MIT PATH - !INPUTGEOSPATH='/HOME/FRITZT/INPUT.GEOS.TEMPLATE' - !CHEMINPUTSDIR='/NET/D06/DATA/GCDATA/EXTDATA/CHEM_INPUTS/' - ! CHEYENNE PATH - INPUTGEOSPATH='/GLADE/U/HOME/FRITZT/INPUT.GEOS.TEMPLATE' - CHEMINPUTSDIR='/GLADE/P/UNIV/UMIT0034/EXTDATA/CHEM_INPUTS/' - - -#IF ( ALLDDVEL_GEOSCHEM + OCNDDVEL_GEOSCHEM + OCNDDVEL_MOZART != 1 ) - IF (MASTERPROC) THEN - WRITE(IULOG,'(/,A)') REPEAT( "=", 79 ) - WRITE(IULOG,'(A)') " PREPROCESSOR FLAGS ARE NOT SET CORRECTLY IN CHEMISTRY.F90" - WRITE(IULOG,'(A)') " THE USER NEEDS TO DECIDE HOW TO COMPUTE DRY DEPOSITION VELOCITIES" - WRITE(IULOG,'(A)') " THREE OPTIONS APPEAR: " - WRITE(IULOG,'(A)') " + LET GEOS-CHEM CALCULATE ALL DRY DEPOSITION VELOCITIES." - WRITE(IULOG,'(A)') " REQUIRED SETUP:" - WRITE(IULOG,'(A)') " ALLDDVEL_GEOSCHEM == 1" - WRITE(IULOG,'(A)') " OCNDDVEL_GEOSCHEM == 0" - WRITE(IULOG,'(A)') " OCNDDVEL_MOZART == 0" - WRITE(IULOG,'(A)') " + LET CLM COMPUTE DRY DEPOSITION VELOCITIES OVER LAND AND LET" - WRITE(IULOG,'(A)') " GEOS-CHEM COMPUTE VELOCITIES OVER OCEAN AND ICE" - WRITE(IULOG,'(A)') " REQUIRED SETUP:" - WRITE(IULOG,'(A)') " ALLDDVEL_GEOSCHEM == 0" - WRITE(IULOG,'(A)') " OCNDDVEL_GEOSCHEM == 1" - WRITE(IULOG,'(A)') " OCNDDVEL_MOZART == 0" - WRITE(IULOG,'(A)') " + LET CLM COMPUTE DRY DEPOSITION VELOCITIES OVER LAND AND" - WRITE(IULOG,'(A)') " COMPUTE VELOCITIES OVER OCEAN AND ICE IN A SIMILAR WAY AS" - WRITE(IULOG,'(A)') " MOZART" - WRITE(IULOG,'(A)') " REQUIRED SETUP:" - WRITE(IULOG,'(A)') " ALLDDVEL_GEOSCHEM == 0" - WRITE(IULOG,'(A)') " OCNDDVEL_GEOSCHEM == 0" - WRITE(IULOG,'(A)') " OCNDDVEL_MOZART == 1" - WRITE(IULOG,'(A)') REPEAT( "=", 79 ) - CALL ENDRUN('INCORRECT DEFINITIONS FOR DRY DEPOSITION VELOCITIES') - ENDIF -#ENDIF -#IF ( ALLDDVEL_GEOSCHEM && ( LANDTYPE_HEMCO + LANDTYPE_CLM != 1 ) ) - IF (MASTERPROC) THEN - WRITE(IULOG,'(/,A)') REPEAT( "=", 79 ) - WRITE(IULOG,'(A)') REPEAT( "=", 79 ) - WRITE(IULOG,'(A)') " PREPROCESSOR FLAGS ARE NOT SET CORRECTLY IN CHEMISTRY.F90" - WRITE(IULOG,'(A)') " DRY-DEPOSITION VELOCITIES ARE COMPUTED BY GEOS-CHEM" - WRITE(IULOG,'(A)') " THE USER NEEDS TO DECIDE IF LAND TYPES SHOULD BE FROM CLM OR FROM HEMCO" - CALL ENDRUN('INCORRECT DEFINITIONS FOR SOURCE OF LAND TYPE DATA') - ENDIF -#ENDIF - - ALLOCATE(DRYSPC_NDX(NDDVELS), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('FAILED TO ALLOCATE DRYSPC_NDX') - - IF (MASTERPROC) THEN - - WRITE(IULOG,'(/,A)') REPEAT( '=', 50 ) - WRITE(IULOG,'(A)') REPEAT( '=', 50 ) - WRITE(IULOG,'(A)') 'THIS IS THE GEOS-CHEM / CESM INTERFACE' - WRITE(IULOG,'(A)') REPEAT( '=', 50 ) - WRITE(IULOG,'(A)') ' + ROUTINES WRITTEN BY THIBAUD M. FRITZ' - WRITE(IULOG,'(A)') ' + LABORATORY FOR AVIATION AND THE ENVIRONMENT,' - WRITE(IULOG,'(A)') ' + DEPARTMENT OF AERONAUTICS AND ASTRONAUTICS,' - WRITE(IULOG,'(A)') ' + MASSACHUSETTS INSTITUTE OF TECHNOLOGY' - WRITE(IULOG,'(A)') REPEAT( '=', 50 ) - - WRITE(IULOG,'(/,/, A)') 'NOW DEFINING GEOS-CHEM TRACERS AND DRY DEPOSITION MAPPING...' - - UNITN = GETUNIT() - - !============================================================== - ! OPENING INPUT.GEOS AND GO TO ADVECTED SPECIES MENU - !============================================================== - - OPEN( UNITN, FILE=TRIM(INPUTGEOSPATH), STATUS='OLD', IOSTAT=IERR ) - IF (IERR .NE. 0) THEN - CALL ENDRUN('CHEM_READNL: ERROR OPENING INPUT.GEOS') - ENDIF - - ! GO TO ADVECTED SPECIES MENU - MENUFOUND = .FALSE. - DO WHILE ( .NOT. MENUFOUND ) - READ( UNITN, '(A)', IOSTAT=IERR ) LINE - IF ( IERR .NE. 0 ) THEN - CALL ENDRUN('CHEM_READNL: ERROR FINDING ADVECTED SPECIES MENU') - ELSEIF ( INDEX(LINE, 'ADVECTED SPECIES MENU') > 0 ) THEN - MENUFOUND = .TRUE. - ENDIF - ENDDO - - !============================================================== - ! READ LIST OF GEOS-CHEM TRACERS - !============================================================== - - DO - ! READ LINE - READ(UNITN,'(26X,A)', IOSTAT=IERR) LINE - - IF ( INDEX( TRIM(LINE), '---' ) > 0 ) EXIT - - NTRACERS = NTRACERS + 1 - TRACERNAMES(NTRACERS) = TRIM(LINE) - - ENDDO - - CLOSE(UNITN) - CALL FREEUNIT(UNITN) - - ! ASSIGN REMAINING TRACERS DUMMY NAMES - DO I = (NTRACERS+1), NTRACERSMAX - WRITE(TRACERNAMES(I),'(A,I0.4)') 'GCTRC_', I - ENDDO - - !============================================================== - ! NOW GO THROUGH THE KPP MECHANISM AND ADD ANY SPECIES NOT - ! IMPLEMENTED BY THE TRACER LIST IN INPUT.GEOS - !============================================================== - - IF ( NSPEC > NSLSMAX ) THEN - CALL ENDRUN('CHEM_READNL: TOO MANY SPECIES - INCREASE NSLSMAX') - ENDIF - - NSLS = 0 - DO I = 1, NSPEC - ! GET THE NAME OF THE SPECIES FROM KPP - LINE = ADJUSTL(TRIM(SPC_NAMES(I))) - ! ONLY ADD THIS - VALIDSLS = ( .NOT. ANY(TRIM(LINE) .EQ. TRACERNAMES) ) - IF (VALIDSLS) THEN - ! GENUINE NEW SHORT-LIVED SPECIES - NSLS = NSLS + 1 - SLSNAMES(NSLS) = TRIM(LINE) - ENDIF - ENDDO - - !============================================================== - ! GET MAPPING BETWEEN DRY DEPOSITION SPECIES AND SPECIES SET - !============================================================== - - DO N = 1, NDDVELS - - ! THE SPECIES NAMES NEED TO BE CONVERT TO UPPER CASE AS, - ! FOR INSTANCE, BR2 != BR2 - DRYSPC_NDX(N) = GET_SPC_NDX( TO_UPPER(DRYDEP_LIST(N)) ) - - IF ( DRYSPC_NDX(N) < 0 ) THEN - WRITE(IULOG,'(A,A)') ' ## IGNORING DRY DEPOSITION OF ', & - TRIM(DRYDEP_LIST(N)) - NIGNORED = NIGNORED + 1 - ENDIF - ENDDO - - IF ( NIGNORED > 0 ) THEN - WRITE(IULOG,'(A,A)') ' THE SPECIES LISTED ABOVE HAVE DRY', & - ' DEPOSITION TURNED OFF FOR ONE OF THE FOLLOWING REASONS:' - WRITE(IULOG,'(A)') ' - THEY ARE NOT PRESENT IN THE GEOS-CHEM TRACER LIST.' - WRITE(IULOG,'(A)') ' - THEY HAVE A SYNONYM (E.G. CH2O AND HCHO).' - ENDIF - - !============================================================== - ! PRINT SUMMARY - !============================================================== - - WRITE(IULOG,'(/, A)') '### SUMMARY OF GEOS-CHEM SPECIES: ' - WRITE(IULOG,'( A)') REPEAT( '-', 50 ) - WRITE(IULOG,'( A)') '+ LIST OF ADVECTED SPECIES: ' - WRITE(IULOG,100) 'ID', 'TRACER', 'DRY DEPOSITION (T/F)' - DO N = 1, NTRACERS - WRITE(IULOG,110) N, TRIM(TRACERNAMES(N)), ANY(DRYSPC_NDX .EQ. N) - ENDDO - - WRITE(IULOG,'(/, A)') '+ LIST OF SHORT-LIVED SPECIES: ' - DO N = 1, NSLS - WRITE(IULOG,120) N, TRIM(SLSNAMES(N)) - ENDDO - - 100 FORMAT( 1X, A3, 3X, A10, 1X, A25 ) - 110 FORMAT( 1X, I3, 3X, A10, 1X, L15 ) - 120 FORMAT( 1X, I3, 3X, A10 ) - - !============================================================== - - ENDIF - - !================================================================== - ! BROADCAST TO ALL PROCESSORS - !================================================================== - -#IF DEFINED( SPMD ) - CALL MPIBCAST(NTRACERS, 1, MPIINT, 0, MPICOM ) - CALL MPIBCAST(TRACERNAMES, LEN(TRACERNAMES(1))*NTRACERSMAX, MPICHAR, 0, MPICOM ) - CALL MPIBCAST(NSLS, 1, MPIINT, 0, MPICOM ) - CALL MPIBCAST(SLSNAMES, LEN(SLSNAMES(1))*NSLSMAX, MPICHAR, 0, MPICOM ) - CALL MPIBCAST(DRYSPC_NDX, NDDVELS, MPIINT, 0, MPICOM ) - -#IF ( OCNDDVEL_MOZART ) - !============================================================== - ! THE FOLLOWING LINES SHOULD ONLY BE CALLED IF WE COMPUTE - ! VELOCITIES OVER THE OCEAN AND ICE IN A MOZART-LIKE WAY. - ! THIBAUD M. FRITZ - 26 FEB 2020 - !============================================================== - - CALL MPIBCAST(MOZART_DEPVEL_LND_FILE, LEN(MOZART_DEPVEL_LND_FILE), MPICHAR, 0, MPICOM) - CALL MPIBCAST(MOZART_CLIM_SOILW_FILE, LEN(MOZART_CLIM_SOILW_FILE), MPICHAR, 0, MPICOM) - CALL MPIBCAST(MOZART_SEASON_WES_FILE, LEN(MOZART_SEASON_WES_FILE), MPICHAR, 0, MPICOM) -#ENDIF - -#ENDIF - - ! UPDATE "SHORT_LIVED_SPECIES" ARRAYS - WILL EVENTUALLY UNIFY THESE - NSLVD = NSLS - ALLOCATE(SLVD_LST(NSLVD), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING SLVD_LST') - ALLOCATE(SLVD_REF_MMR(NSLVD), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING SLVD_REF_MMR') - DO I = 1, NSLS - SLVD_LST(I) = TRIM(SLSNAMES(I)) - ENDDO - - END SUBROUTINE CHEM_READNL - -!================================================================================================ - - FUNCTION CHEM_IS_ACTIVE() - !----------------------------------------------------------------------- - LOGICAL :: CHEM_IS_ACTIVE - !----------------------------------------------------------------------- - CHEM_IS_ACTIVE = .TRUE. - - END FUNCTION CHEM_IS_ACTIVE - -!================================================================================================ - - FUNCTION CHEM_IMPLEMENTS_CNST(NAME) - !----------------------------------------------------------------------- - ! - ! PURPOSE: RETURN TRUE IF SPECIFIED CONSTITUENT IS IMPLEMENTED BY THIS PACKAGE - ! - ! AUTHOR: B. EATON - ! - !----------------------------------------------------------------------- - IMPLICIT NONE - !-----------------------------ARGUMENTS--------------------------------- - - CHARACTER(LEN=*), INTENT(IN) :: NAME ! CONSTITUENT NAME - LOGICAL :: CHEM_IMPLEMENTS_CNST ! RETURN VALUE - - INTEGER :: I - - CHEM_IMPLEMENTS_CNST = .FALSE. - - DO I = 1, NTRACERS - IF (TRIM(TRACERNAMES(I)) .EQ. TRIM(NAME)) THEN - CHEM_IMPLEMENTS_CNST = .TRUE. - EXIT - ENDIF - ENDDO - - IF (MASTERPROC) WRITE(IULOG,'(A)') 'GCCALL CHEM_IMPLEMENTS_CNST' - - END FUNCTION CHEM_IMPLEMENTS_CNST - -!=============================================================================== - - SUBROUTINE CHEM_INIT(PHYS_STATE, PBUF2D) - !----------------------------------------------------------------------- - ! - ! PURPOSE: INITIALIZE GEOS-CHEM PARTS (STATE OBJECTS, MAINLY) - ! (AND DECLARE HISTORY VARIABLES) - ! - !----------------------------------------------------------------------- - USE PHYSICS_BUFFER, ONLY: PHYSICS_BUFFER_DESC, PBUF_GET_INDEX - USE CAM_HISTORY, ONLY: ADDFLD, ADD_DEFAULT, HORIZ_ONLY - USE CHEM_MODS, ONLY: MAP2GC_DRYDEP, DRYSPC_NDX - - USE MPISHORTHAND - USE CAM_ABORTUTILS, ONLY : ENDRUN - - USE INPUT_OPT_MOD - USE STATE_CHM_MOD - USE STATE_GRID_MOD - USE STATE_MET_MOD - USE DIAGLIST_MOD, ONLY : INIT_DIAGLIST, PRINT_DIAGLIST - USE GC_ENVIRONMENT_MOD - USE GC_GRID_MOD, ONLY : SETGRIDFROMCTREDGES - - ! USE GEOS-CHEM VERSIONS OF PHYSICAL CONSTANTS - USE PHYSCONSTANTS, ONLY : PI, PI_180 - USE PHYSCONSTANTS, ONLY : RE - - USE PHYS_GRID, ONLY : GET_AREA_ALL_P - USE HYCOEF, ONLY : PS0, HYAI, HYBI - - USE TIME_MOD, ONLY : ACCEPT_EXTERNAL_DATE_TIME - !USE TIME_MOD, ONLY : SET_BEGIN_TIME, SET_END_TIME - !USE TIME_MOD, ONLY : SET_CURRENT_TIME, SET_DIAGB - !USE TRANSFER_MOD, ONLY : INIT_TRANSFER - USE LINOZ_MOD, ONLY : LINOZ_READ - -#IF ( OCNDDVEL_MOZART ) - USE SEQ_DRYDEP_MOD, ONLY: DRYDEP_METHOD, DD_XLND - USE MO_DRYDEP, ONLY: DRYDEP_INTI -#ENDIF - - USE CMN_SIZE_MOD - - USE DRYDEP_MOD, ONLY : INIT_DRYDEP, DEPNAME, NDVZIND - USE CARBON_MOD, ONLY : INIT_CARBON - USE DUST_MOD, ONLY : INIT_DUST - USE SEASALT_MOD, ONLY : INIT_SEASALT - USE SULFATE_MOD, ONLY : INIT_SULFATE - USE AEROSOL_MOD, ONLY : INIT_AEROSOL - USE WETSCAV_MOD, ONLY : INIT_WETSCAV - USE PRESSURE_MOD, ONLY : INIT_PRESSURE, ACCEPT_EXTERNAL_APBP - USE CHEMISTRY_MOD, ONLY : INIT_CHEMISTRY - USE UCX_MOD, ONLY : INIT_UCX -#IF ( ALLDDVEL_GEOSCHEM && LANDTYPE_HEMCO ) - USE OLSON_LANDMAP_MOD -#ENDIF - USE MIXING_MOD - - USE PBL_MIX_MOD, ONLY : INIT_PBL_MIX - - USE GC_EMISSIONS_MOD, ONLY : GC_EMISSIONS_INIT - - TYPE(PHYSICS_STATE), INTENT(IN):: PHYS_STATE(BEGCHUNK:ENDCHUNK) - TYPE(PHYSICS_BUFFER_DESC), POINTER :: PBUF2D(:,:) - - ! LOCAL VARIABLES - - !---------------------------- - ! SCALARS - !---------------------------- - - ! INTEGERS - INTEGER :: LCHNK(BEGCHUNK:ENDCHUNK), NCOL(BEGCHUNK:ENDCHUNK) - INTEGER :: IWAIT, IERR - INTEGER :: NX, NY, NZ - INTEGER :: IX, JY - INTEGER :: I, J, L, N - INTEGER :: RC - INTEGER :: NLINOZ - - ! LOGICALS - LOGICAL :: ROOTCHUNK - LOGICAL :: PRTDEBUG - - ! STRINGS - CHARACTER(LEN=255) :: HISTORYCONFIGFILE - CHARACTER(LEN=255) :: SPCNAME - - ! GRID SETUP - REAL(FP) :: LONVAL, LATVAL - REAL(FP) :: DLONFIX, DLATFIX - REAL(F4), ALLOCATABLE :: LONMIDARR(:,:), LATMIDARR(:,:) - REAL(F4), ALLOCATABLE :: LONEDGEARR(:,:), LATEDGEARR(:,:) - REAL(R8), ALLOCATABLE :: LINOZDATA(:,:,:,:) - - REAL(R8), ALLOCATABLE :: COL_AREA(:) - REAL(FP), ALLOCATABLE :: AP_CAM_FLIP(:), BP_CAM_FLIP(:) - - REAL(R8), POINTER :: SLSPTR(:,:,:) - - - ! ASSUME A SUCCESSFUL RETURN UNTIL OTHERWISE - RC = GC_SUCCESS - - ! FOR ERROR TRAPPING - ERRMSG = '' - THISLOC = ' -> AT GEOS-CHEM (IN CHEMISTRY/PP_GEOSCHEM/CHEMISTRY.F90)' - - ! LCHNK: WHICH CHUNKS WE HAVE ON THIS PROCESS - LCHNK = PHYS_STATE%LCHNK - ! NCOL: NUMBER OF ATMOSPHERIC COLUMNS FOR EACH CHUNK - NCOL = PHYS_STATE%NCOL - - WRITE(IULOG,'(2(A,X,I6,X))') 'CHEM_INIT CALLED ON PE ', MYCPU, ' OF ', NCPUS - - ! THE GEOS-CHEM GRIDS ON EVERY "CHUNK" WILL ALL BE THE SAME SIZE, TO AVOID - ! THE POSSIBILITY OF HAVING DIFFERENTLY-SIZED CHUNKS - NX = 1 - !NY = MAXVAL(NCOL) - NY = PCOLS - NZ = PVER - - !! ADD SHORT LIVED SPEIES TO BUFFERS - !CALL PBUF_ADD_FIELD(TRIM(SLSBUFFER),'GLOBAL',DTYPE_R8,(/PCOLS,PVER,NSLS/),SLS_PBF_IDX) - !! INITIALIZE - !ALLOCATE(SLSPTR(PCOLS,PVER,BEGCHUNK:ENDCHUNK), STAT=IERR) - !IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING SLSPTR') - !SLSPTR(:,:,:) = 0.0E+0_R8 - !DO I=1,NSLS - ! SLSPTR(:,:,:) = SLS_REF_MMR(I) - ! CALL PBUF_SET_FIELD(PBUF2D,SLS_PBF_IDX,SLSPTR,START=(/1,1,I/),KOUNT=(/PCOLS,PVER,1/)) - !ENDDO - !DEALLOCATE(SLSPTR) - - ! THIS ENSURES THAT EACH PROCESS ALLOCATES EVERYTHING NEEDED FOR ITS CHUNKS - ALLOCATE(STATE_CHM(BEGCHUNK:ENDCHUNK) , STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING STATE_CHM') - ALLOCATE(STATE_DIAG(BEGCHUNK:ENDCHUNK) , STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING STATE_DIAG') - ALLOCATE(STATE_GRID(BEGCHUNK:ENDCHUNK), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING STATE_GRID') - ALLOCATE(STATE_MET(BEGCHUNK:ENDCHUNK) , STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('FAILURE WHILE ALLOCATING STATE_MET') - - ! INITIALIZE FIELDS OF THE INPUT OPTIONS OBJECT - CALL SET_INPUT_OPT( AM_I_ROOT = MASTERPROC, & - INPUT_OPT = INPUT_OPT, & - RC = RC ) - - ! Set some basic flags - Input_Opt%LUCX = .True. - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered within call to "Set_Input_Opt"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - DO I = BEGCHUNK, ENDCHUNK - - ! Initialize fields of the Grid State object - CALL Init_State_Grid( State_Grid = State_Grid(I), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered within call to "Init_State_Grid"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - State_Grid(I)%NX = nX - State_Grid(I)%NY = nY - State_Grid(I)%NZ = nZ - - ! Initialize GEOS-Chem horizontal grid structure - CALL GC_Init_Grid( Input_Opt = Input_Opt, & - State_Grid = State_Grid(I), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered within call to "GC_Init_Grid"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Define more variables for State_Grid - ! TMMF, might need tweaking - State_Grid(I)%MaxTropLev = MIN(40, nZ) - State_Grid(I)%MaxStratLev = MIN(59, nZ) - - ! Set maximum number of levels in the chemistry grid - IF ( Input_Opt%LUCX ) THEN - State_Grid(I)%MaxChemLev = State_Grid(I)%MaxStratLev - ELSE - State_Grid(I)%MaxChemLev = State_Grid(I)%MaxTropLev - ENDIF - - ENDDO - - ! Note - this is called AFTER chem_readnl, after X, and after - ! every constituent has had its initial conditions read. Any - ! constituent which is not found in the CAM restart file will - ! then have already had a call to chem_implements_cnst, and will - ! have then had a call to chem_init_cnst to set a default VMR - ! Call the routine GC_Allocate_All (located in module file - ! GeosCore/gc_environment_mod.F90) to allocate all lat/lon - ! allocatable arrays used by GEOS-Chem. - CALL GC_Allocate_All ( Input_Opt = Input_Opt, & - State_Grid = State_Grid(BEGCHUNK), & - value_I_Lo = 1, & - value_J_Lo = 1, & - value_I_Hi = nX, & - value_J_Hi = nY, & - value_IM = nX, & - value_JM = nY, & - value_LM = nZ, & - value_IM_WORLD = nX, & - value_JM_WORLD = nY, & - value_LM_WORLD = nZ, & - value_LLSTRAT = 59, & !TMMF - RC = RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "GC_Allocate_All"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - Input_Opt%myCPU = myCPU - Input_Opt%rootCPU = MasterProc - - ! TODO: Mimic GEOS-Chem's reading of input options - !IF (MasterProc) THEN - ! CALL Read_Input_File( Input_Opt = Input_Opt(BEGCHUNK), & - ! srcFile = inputGeosPath, & - ! RC = RC ) - !ENDIF - !CALL - - ! For now just hard-code it - ! First setup directories - Input_Opt%Chem_Inputs_Dir = TRIM(chemInputsDir) - - ! Simulation menu - Input_Opt%NYMDb = 20000101 - Input_Opt%NHMSb = 000000 - Input_Opt%NYMDe = 20010101 - Input_Opt%NHMSe = 000000 - - ! Now READ_SIMULATION_MENU - Input_Opt%ITS_A_CH4_SIM = .False. - Input_Opt%ITS_A_CO2_SIM = .False. - Input_Opt%ITS_A_FULLCHEM_SIM = .True. - Input_Opt%ITS_A_MERCURY_SIM = .False. - Input_Opt%ITS_A_POPS_SIM = .False. - Input_Opt%ITS_A_RnPbBe_SIM = .False. - Input_Opt%ITS_A_TAGO3_SIM = .False. - Input_Opt%ITS_A_TAGCO_SIM = .False. - Input_Opt%ITS_AN_AEROSOL_SIM = .False. - - ! Now READ_ADVECTED_SPECIES_MENU - Input_Opt%N_Advect = nTracers - IF (Input_Opt%N_Advect.GT.Input_Opt%Max_AdvectSpc) THEN - CALL ENDRUN('Number of tracers exceeds max count') - ENDIF - ! Assign tracer names - DO J = 1, Input_Opt%N_Advect - Input_Opt%AdvectSpc_Name(J) = TRIM(tracerNames(J)) - ENDDO - ! No tagged species - Input_Opt%LSplit = .False. - - ! Now READ_TRANSPORT_MENU - Input_Opt%LTran = .True. - Input_Opt%LFill = .True. - Input_Opt%TPCore_IOrd = 3 - Input_Opt%TPCore_JOrd = 3 - Input_Opt%TPCore_KOrd = 3 - - ! Now READ_PHOTOLYSIS_MENU - Input_Opt%FAST_JX_DIR ='/glade/p/univ/umit0034/ExtData/' // & - 'CHEM_INPUTS/FAST_JX/v2019-06/' - - ! Now READ_CONVECTION_MENU - ! For now, TMMF - Input_Opt%LConv = .False. - Input_Opt%LTurb = .True. - Input_Opt%LNLPBL = .True. - - ! Now READ_EMISSIONS_MENU - Input_Opt%LEmis = .False. - Input_Opt%HCOConfigFile = 'HEMCO_Config.rc' - Input_Opt%LFix_PBL_Bro = .False. - - ! Set surface VMRs - turn this off so that CAM can handle it - Input_Opt%LCH4Emis = .False. - Input_Opt%LCH4SBC = .False. - Input_Opt%LOCSEmis = .False. - Input_Opt%LCFCEmis = .False. - Input_Opt%LClEmis = .False. - Input_Opt%LBrEmis = .False. - Input_Opt%LN2OEmis = .False. - Input_Opt%LBasicEmis = .False. - - ! Set initial conditions - Input_Opt%LSetH2O = .True. - - ! CFC control - Input_Opt%CFCYear = 0 - - ! Now READ_AEROSOL_MENU - Input_Opt%LSulf = .True. - Input_Opt%LMetalcatSO2 = .True. - Input_Opt%LCarb = .True. - Input_Opt%LBrC = .False. - Input_Opt%LSOA = .True. - Input_Opt%LSVPOA = .False. - Input_Opt%LOMOC = .False. - Input_Opt%LDust = .True. - Input_Opt%LDstUp = .False. - Input_Opt%LSSalt = .True. - Input_Opt%SalA_rEdge_um(1) = 0.01e+0_fp - Input_Opt%SalA_rEdge_um(2) = 0.50e+0_fp - Input_Opt%SalC_rEdge_um(1) = 0.50e+0_fp - Input_Opt%SalC_rEdge_um(2) = 8.00e+0_fp - Input_Opt%LMPOA = .False. - ! For now, disable solid PSCs and strat aerosol settling - ! Our treatment of the stratosphere isn't really sophisticated - ! enough to warrant it yet - Input_Opt%LGravStrat = .False. - Input_Opt%LSolidPSC = .False. - Input_Opt%LHomNucNAT = .False. - Input_Opt%T_NAT_Supercool = 3.0e+0_fp - Input_Opt%P_Ice_Supersat = 1.2e+0_fp - Input_Opt%LPSCChem = .True. - Input_Opt%LStratOD = .True. - Input_Opt%hvAerNIT = .False. - Input_Opt%hvAerNIT_JNIT = .False. - Input_Opt%hvAerNIT_JNITs = .False. - Input_Opt%JNITChanA = 0e+0_fp - Input_Opt%JNITChanB = 0e+0_fp - - ! Now READ_DEPOSITION_MENU - Input_Opt%LDryD = .True. - !================================================================== - ! Add the following options: - ! + GEOS-Chem computes ALL dry-deposition velocities - ! + CLM computes land velocities. Velocities over ocean and ice are - ! computed in a MOZART-like way - ! + CLM computes land velocities. Velocities over ocean and ice are - ! computed from GEOS-Chem - ! - ! Note: What to do about aerosols? Who should compute the dry - ! deposition velocities - ! - ! Thibaud M. Fritz - 26 Feb 2020 - !================================================================== - Input_Opt%LWetD = .True. - Input_Opt%CO2_Effect = .False. - Input_Opt%CO2_Level = 390.0_fp - Input_Opt%CO2_Ref = 390.0_fp - - ! Now READ_CHEMISTRY_MENU - Input_Opt%LChem = .True. - Input_Opt%LSChem = .False. ! .True. !TMMF - Input_Opt%LLinoz = .True. - Input_Opt%LSynoz = .True. - Input_Opt%LUCX = .True. - Input_Opt%LActiveH2O = .True. - Input_Opt%Use_Online_O3 = .True. - ! Expect to get total overhead ozone, although it shouldn not - ! make too much of a difference since we want to use "full-UCX" - Input_Opt%Use_O3_from_Met = .True. - Input_Opt%Use_TOMS_O3 = .False. - Input_Opt%Gamma_HO2 = 0.2e+0_fp - - Input_Opt%LPRT = .False. - - ! Read in data for Linoz. All CPUs allocate one array to hold the data. Only - ! the root CPU reads in the data; then we copy it out to a temporary array, - ! broadcast to all other CPUs, and finally duplicate the data into every - ! copy of Input_Opt - IF ( Input_Opt%LLinoz ) THEN - ! Allocate array for broadcast - nLinoz = Input_Opt%Linoz_NLevels * & - Input_Opt%Linoz_NLat * & - Input_Opt%Linoz_NMonths * & - Input_Opt%Linoz_NFields - ALLOCATE( linozData( Input_Opt%Linoz_NLevels, & - Input_Opt%Linoz_NLat, & - Input_Opt%Linoz_NMonths, & - Input_Opt%Linoz_NFields ), STAT=IERR) - IF (IERR.NE.0) CALL ENDRUN('Failure while allocating linozData') - linozData = 0.0e+0_r8 - - IF ( MasterProc ) THEN - ! Read data in to Input_Opt%Linoz_TParm - CALL Linoz_Read( MasterProc, Input_Opt, RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Linoz_Read"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ! Copy the data to a temporary array - linozData = REAL(Input_Opt%LINOZ_TPARM,r8) - ENDIF -#if defined( SPMD ) - CALL MPIBCAST( linozData, nLinoz, MPIR8, 0, MPICOM ) -#endif - IF ( .NOT. MasterProc ) THEN - Input_Opt%LINOZ_TPARM = REAL(linozData,fp) - ENDIF - DEALLOCATE(linozData) - ENDIF - - - ! Note: The following calculations do not setup the gridcell areas. - ! In any case, we will need to be constantly updating this grid - ! to compensate for the "multiple chunks per processor" element - ALLOCATE(lonMidArr(nX,nY), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating lonMidArr') - ALLOCATE(lonEdgeArr(nX+1,nY+1), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating lonEdgeArr') - ALLOCATE(latMidArr(nX,nY), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating latMidArr') - ALLOCATE(latEdgeArr(nX+1,nY+1), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating latEdgeArr') - - ! We could try and get the data from CAM.. but the goal is to make this GC - ! component completely grid independent. So for now, we set to arbitrary - ! values - ! TODO: This needs more refinement. For now, this generates identical - ! State_Grid for all chunks - DO L = BEGCHUNK, ENDCHUNK - lonMidArr = 0.0e+0_f4 - latMidArr = 0.0e+0_f4 - dLonFix = 360.0e+0_fp / REAL(nX,fp) - dLatFix = 180.0e+0_fp / REAL(nY,fp) - DO I = 1, nX - ! Center of box, assuming dateline edge - lonVal = -180.0e+0_fp + (REAL(I-1,fp)*dLonFix) - DO J = 1, nY - ! Center of box, assuming regular cells - latVal = -90.0e+0_fp + (REAL(J-1,fp)*dLatFix) - lonMidArr(I,J) = REAL((lonVal + (0.5e+0_fp * dLonFix)) * PI_180, f4) - latMidArr(I,J) = REAL((latVal + (0.5e+0_fp * dLatFix)) * PI_180, f4) - - ! Edges of box, assuming regular cells - lonEdgeArr(I,J) = REAL(lonVal * PI_180, f4) - latEdgeArr(I,J) = REAL(latVal * PI_180, f4) - ENDDO - ! Edges of box, assuming regular cells - lonEdgeArr(I,nY+1) = REAL((lonVal + dLonFix) * PI_180, f4) - latEdgeArr(I,nY+1) = REAL((latVal + dLatFix) * PI_180, f4) - ENDDO - DO J = 1, nY+1 - ! Edges of box, assuming regular cells - latVal = -90.0e+0_fp + (REAL(J-1,fp)*dLatFix) - lonEdgeArr(nX+1,J) = REAL((lonVal + dLonFix) * PI_180, f4) - latEdgeArr(nX+1,J) = REAL((latVal) * PI_180, f4) - ENDDO - - CALL SetGridFromCtrEdges( State_Grid = State_Grid(L), & - lonCtr = lonMidArr, & - latCtr = latMidArr, & - lonEdge = lonEdgeArr, & - latEdge = latEdgeArr, & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "SetGridFromCtrEdges"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ENDDO - DEALLOCATE(lonMidArr) - DEALLOCATE(latMidArr) - DEALLOCATE(lonEdgeArr) - DEALLOCATE(latEdgeArr) - - - ! Set the times held by "time_mod" - CALL Accept_External_Date_Time( value_NYMDb = Input_Opt%NYMDb, & - value_NHMSb = Input_Opt%NHMSb, & - value_NYMDe = Input_Opt%NYMDe, & - value_NHMSe = Input_Opt%NHMSe, & - value_NYMD = Input_Opt%NYMDb, & - value_NHMS = Input_Opt%NHMSb, & - RC = RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Accept_External_Date_Time"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Start by setting some dummy timesteps - CALL GC_Update_Timesteps(300.0E+0_r8) - - ! Initialize error module - CALL Init_Error( MasterProc, Input_Opt, RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Error"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Set a flag to denote if we should print ND70 debug output - prtDebug = ( Input_Opt%LPRT .and. MasterProc ) - - ! Debug output - IF ( prtDebug ) CALL Debug_Msg( '### MAIN: a READ_INPUT_FILE' ) - - historyConfigFile = 'HISTORY.rc' ! InputOpt not yet initialized - !TMMF need to pass input.geos path - !CALL Init_DiagList( MasterProc, historyConfigFile, Diag_List, RC ) - !IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Error encountered in "Init_DiagList"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - !ENDIF - - !!### Print diagnostic list if needed for debugging - !IF ( prtDebug ) CALL Print_DiagList( Diag_List, RC ) - - DO I = BEGCHUNK, ENDCHUNK - - CALL GC_Init_StateObj( Diag_List = Diag_List, & ! Diagnostic list obj - & Input_Opt = Input_Opt, & ! Input Options - & State_Chm = State_Chm(I), & ! Chemistry State - & State_Diag = State_Diag(I), & ! Diagnostics State - & State_Grid = State_Grid(I), & ! Grid State - & State_Met = State_Met(I), & ! Meteorology State - & RC = RC ) ! Success or failure - - ! Trap potential errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "GC_Init_StateObj"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Start with v/v dry (CAM standard) - State_Chm(I)%Spc_Units = 'v/v dry' - - ENDDO - - ! Now replicate GC_Init_Extra - IF ( Input_Opt%LDryD ) THEN - - ! Setup for dry deposition - CALL Init_Drydep( Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK), & - & RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Drydep"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - !============================================================== - ! Get mapping between CESM dry deposited species and the - ! indices of State_Chm%DryDepVel. This needs to be done after - ! Init_Drydep - ! Thibaud M. Fritz - 04 Mar 2020 - !============================================================== - - ALLOCATE(map2GC_dryDep(nddvels), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate map2GC_dryDep') - - DO N = 1, nddvels - - ! Initialize index to -1 - map2GC_dryDep(N) = -1 - - IF ( drySpc_ndx(N) > 0 ) THEN - - ! Convert to upper case - SpcName = to_upper(drydep_list(N)) - - DO I = 1, State_Chm(BEGCHUNK)%nDryDep - IF ( TRIM( SpcName ) == TRIM( to_upper(depName(I)) ) ) THEN - map2GC_dryDep(N) = nDVZind(I) - EXIT - ENDIF - ENDDO - - ENDIF - - ENDDO - -#if ( OCNDDVEL_MOZART ) - !============================================================== - ! The following line should only be called if we compute - ! velocities over the ocean and ice in a MOZART-like way. - ! Thibaud M. Fritz - 26 Feb 2020 - !============================================================== - - IF ( drydep_method == DD_XLND ) THEN - CALL drydep_inti( MOZART_depvel_lnd_file, & - MOZART_clim_soilw_file, & - MOZART_season_wes_file ) - ELSE - Write(iulog,'(a,a)') ' drydep_method is set to: ', TRIM(drydep_method) - CALL ENDRUN('drydep_method must be DD_XLND to compute dry deposition' // & - ' velocities similarly to MOZART over ocean and ice!') - ENDIF -#endif - - ENDIF - - !================================================================= - ! Call setup routines for wet deposition - ! - ! We need to initialize the wetdep module if either wet - ! deposition or convection is turned on, so that we can do the - ! large-scale and convective scavenging. Also initialize the - ! wetdep module if both wetdep and convection are turned off, - ! but chemistry is turned on. The INIT_WETSCAV routine will also - ! allocate the H2O2s and SO2s arrays that are referenced in the - ! convection code. (bmy, 9/23/15) - !================================================================= - IF ( Input_Opt%LConv .OR. & - Input_Opt%LWetD .OR. & - Input_Opt%LChem ) THEN - CALL Init_WetScav( Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK), & - & RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_WetScav"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ENDIF - - !----------------------------------------------------------------- - ! Call SET_VDIFF_VALUES so that we can pass several values from - ! Input_Opt to the vdiff_mod.F90. This replaces the functionality - ! of logical_mod.F and tracer_mod.F.. This has to be called - ! after the input.geos file has been read from disk. - !----------------------------------------------------------------- - !CALL Set_VDiff_Values( Input_Opt = Input_Opt, & - !& State_Chm = State_Chm(BEGCHUNK), & - !& RC = RC ) - - !&IF (RC /= GC_SUCCESS) THEN - ! ErrMsg = 'Error encountered in "Set_VDiff_Values"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - !ENDIF - - !----------------------------------------------------------------- - ! Initialize the GET_NDEP_MOD for soil NOx deposition (bmy, 6/17/16) - !----------------------------------------------------------------- - !CALL Init_Get_NDep( Input_Opt = Input_Opt, & - !& State_Chm = State_Chm(BEGCHUNK), & - !& State_Diag = State_Diag(BEGCHUNK), & - !& RC = RC ) - ! - !IF (RC /= GC_SUCCESS) THEN - ! ErrMsg = 'Error encountered in "Init_Get_NDep"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - !ENDIF - - !----------------------------------------------------------------- - ! Initialize "carbon_mod.F" - !----------------------------------------------------------------- - IF ( Input_Opt%LCarb ) THEN - CALL Init_Carbon( Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK), & - & RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Carbon"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ENDIF - - IF ( Input_Opt%LDust ) THEN - CALL Init_Dust( Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK), & - & RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Dust"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ENDIF - - IF ( Input_Opt%LSSalt ) THEN - CALL Init_Seasalt( Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK), & - & RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Seasalt"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ENDIF - - IF ( Input_Opt%LSulf ) THEN - CALL Init_Sulfate( Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK), & - & RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Sulfate"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ENDIF - - IF ( Input_Opt%LSulf .OR. & - Input_Opt%LCarb .OR. & - Input_Opt%LDust .OR. & - Input_Opt%LSSalt ) THEN - CALL Init_Aerosol( Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK), & - & RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Aerosol"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ENDIF - - ! This is a bare subroutine - no module - CALL NDXX_Setup( Input_Opt, & - & State_Chm(BEGCHUNK), & - & State_Grid(BEGCHUNK), & - & RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_NDXX_Setup"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - CALL Init_PBL_Mix( State_Grid = State_Grid(BEGCHUNK), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_PBL_Mix"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Set grid-cell area - DO I = BEGCHUNK, ENDCHUNK - ALLOCATE(Col_Area(NCOL(I)), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating Col_Area') - - CALL Get_Area_All_p(I, NCOL(I), Col_Area) - - ! Set default value (in case of chunks with fewer columns) - State_Grid(I)%Area_M2 = 1.0e+10_fp - DO iX = 1, nX - DO jY = 1, NCOL(I) - State_Grid(I)%Area_M2(iX,jY) = REAL(Col_Area(jY) * Re**2,fp) - ENDDO - ENDDO - - DEALLOCATE(Col_Area) - - ! Copy to State_Met(I)%Area_M2 - State_Met(I)%Area_M2 = State_Grid(I)%Area_M2 - ENDDO - - - ! Initialize (mostly unused) diagnostic arrays - ! WARNING: This routine likely calls on modules which are currently - ! excluded from the GC-CESM build (eg diag03) - ! CALL Initialize( MasterProc, Input_Opt, 2, RC ) - ! CALL Initialize( Masterproc, Input_Opt, 3, RC ) - - ! Get Ap and Bp from CAM at pressure edges - ALLOCATE(Ap_CAM_Flip(nZ+1), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating Ap_CAM_Flip') - ALLOCATE(Bp_CAM_Flip(nZ+1), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating Bp_CAM_Flip') - - Ap_CAM_Flip = 0.0e+0_fp - Bp_CAM_Flip = 0.0e+0_fp - DO I = 1, (nZ+1) - Ap_CAM_Flip(I) = hyai(nZ+2-I) * ps0 * 0.01e+0_r8 - Bp_CAM_Flip(I) = hybi(nZ+2-I) - ENDDO - - !----------------------------------------------------------------- - ! Initialize the hybrid pressure module. Define Ap and Bp. - !----------------------------------------------------------------- - CALL Init_Pressure( State_Grid = State_Grid(BEGCHUNK), & ! Grid State - RC = RC ) ! Success or failure - - ! Trapping errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Pressure"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - !----------------------------------------------------------------- - ! Pass external Ap and Bp to GEOS-Chem's Pressure_Mod - !----------------------------------------------------------------- - CALL Accept_External_ApBp( State_Grid = State_Grid(BEGCHUNK), & ! Grid State - ApIn = Ap_CAM_Flip, & ! "A" term for hybrid grid - BpIn = Bp_CAM_Flip, & ! "B" term for hybrid grid - RC = RC ) ! Success or failure - - ! Print vertical coordinates - IF ( MasterProc ) THEN - WRITE( 6, '(a)' ) REPEAT( '=', 79 ) - WRITE( 6, '(a,/)' ) 'V E R T I C A L G R I D S E T U P' - WRITE( 6, '( ''Ap '', /, 6(f11.6,1x) )' ) Ap_CAM_Flip(1:State_Grid(BEGCHUNK)%NZ+1) - WRITE( 6, '(a)' ) - WRITE( 6, '( ''Bp '', /, 6(f11.6,1x) )' ) Bp_CAM_Flip(1:State_Grid(BEGCHUNK)%NZ+1) - WRITE( 6, '(a)' ) REPEAT( '=', 79 ) - ENDIF - - ! Trapping errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Accept_External_ApBp"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - DEALLOCATE(Ap_CAM_Flip,Bp_CAM_Flip) - - !! Initialize HEMCO? - !CALL Emissions_Init ( Input_Opt = Input_Opt, & - ! State_Met = State_Met, & - ! State_Chm = State_Chm, & - ! State_Grid = State_Grid, & - ! State_Met = State_Met, & - ! RC = RC, & - ! HcoConfig = HcoConfig ) - ! - !IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Error encountered in "Emissions_Init"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - !ENDIF - ! - -#if ( ALLDDVEL_GEOSCHEM && LANDTYPE_HEMCO ) - ! Populate the State_Met%LandTypeFrac field with data from HEMCO - CALL Init_LandTypeFrac( Input_Opt = Input_Opt, & - State_Met = State_Met(BEGCHUNK), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_LandTypeFrac"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Compute the Olson landmap fields of State_Met - ! (e.g. State_Met%IREG, State_Met%ILAND, etc.) - CALL Compute_Olson_Landmap( Input_Opt = Input_Opt, & - State_Grid = State_Grid(BEGCHUNK), & - State_Met = State_Met(BEGCHUNK), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Compute_Olson_Landmap"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF -#endif - - ! Initialize PBL quantities but do not do mixing - ! Add option for non-local PBL (Lin, 03/31/09) - CALL Init_Mixing ( Input_Opt = Input_Opt, & - State_Chm = State_Chm(BEGCHUNK), & - State_Diag = State_Diag(BEGCHUNK), & - State_Grid = State_Grid(BEGCHUNK), & - State_Met = State_Met(BEGCHUNK), & - RC = RC ) - - ! Trap potential errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in Init_Mixing!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - IF ( Input_Opt%Its_A_FullChem_Sim .OR. & - Input_Opt%Its_An_Aerosol_Sim ) THEN - ! This also initializes Fast-JX - CALL Init_Chemistry( Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK), & - & RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Chemistry"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ENDIF - - IF ( Input_Opt%LChem .AND. & - Input_Opt%LUCX ) THEN - CALL Init_UCX( Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK) ) - ENDIF - - ! Get the index of H2O - iH2O = Ind_('H2O') - iO3 = Ind_('O3') - iCH4 = Ind_('CH4') - iCO = Ind_('CO') - iNO = Ind_('NO') - - ! Get indices for physical fields in physics buffer - NDX_PBLH = Pbuf_Get_Index('pblh' ) - NDX_FSDS = Pbuf_Get_Index('FSDS' ) - NDX_CLDTOP = Pbuf_Get_Index('CLDTOP' ) - NDX_CLDFRC = Pbuf_Get_Index('CLD' ) - NDX_PRAIN = Pbuf_Get_Index('PRAIN' ) - NDX_NEVAPR = Pbuf_Get_Index('NEVAPR' ) - NDX_RPRDTOT = Pbuf_Get_Index('RPRDTOT' ) - NDX_LSFLXPRC = Pbuf_Get_Index('LS_FLXPRC') - NDX_LSFLXSNW = Pbuf_Get_Index('LS_FLXSNW') - - ! Get cloud water indices - CALL Cnst_Get_Ind('CLDLIQ', ixCldLiq) - CALL Cnst_Get_Ind('CLDICE', ixCldIce) - - ! Can add history output here too with the "addfld" & "add_default" routines - ! Note that constituents are already output by default - ! Add all species as output fields if desired - DO I = 1, nTracers - SpcName = TRIM(tracerNames(I)) - CALL AddFld( TRIM(SpcName), (/ 'lev' /), 'A', 'mol/mol', TRIM(tracerLongNames(I))//' concentration') - IF (TRIM(SpcName) == 'O3') THEN - CALL Add_Default ( TRIM(SpcName), 1, ' ') - ENDIF - ENDDO - DO I =1, nSls - SpcName = TRIM(slsNames(I)) - CALL AddFld( TRIM(SpcName), (/ 'lev' /), 'A', 'mol/mol', TRIM(slsLongNames(I))//' concentration') - !CALL Add_Default(TRIM(SpcName), 1, '') - ENDDO - - ! Initialize emissions interface (this will eventually handle HEMCO) - CALL GC_Emissions_Init - - !CALL AddFld ( 'BCPI', (/'lev'/), 'A', 'mole/mole', trim('BCPI')//' mixing ratio' ) - !CALL Add_Default ( 'BCPI', 1, ' ') - -#if defined( CLM40 ) - SpcName = 'lu_soil' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_landice' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_deeplake' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_shallowlake' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_wetland' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_urban' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_icemec' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_crop' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') -#elif defined( CLM45 ) || defined( CLM50 ) - SpcName = 'lu_soil' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_crop' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_landice' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_deeplake' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_wetland' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'lu_urban' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') -#endif - SpcName = 'p_notveg' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_needle_eg_temp' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_needle_eg_bor' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_needle_dd_bor' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_broad_eg_trop' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_broad_eg_temp' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_broad_dd_trop' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_broad_dd_temp' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_broad_dd_bor' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_broad_eg_sh' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_broad_dd_temp_sh' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_broad_dd_bor_sh' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_c3_arctic_grass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_c3_narctic_grass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_c4_grass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_c3_crop' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_c3_irrigated' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') -#if defined( CLM40 ) - SpcName = 'p_c3_corn' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_spring_cereal' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_winter_cereal' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_soybean' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') -#elif defined( CLM45 ) || defined( CLM50 ) - SpcName = 'p_temp_corn' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_temp_corn' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_spring_wheat' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_spring_wheat' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_winter_wheat' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_winter_wheat' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_temp_soybean' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_temp_soybean' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_barley' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_barley' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_winter_barley' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_winter_barley' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_rye' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_rye' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_winter_rye' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_winter_rye' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_cassava' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_cassava' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_citrus' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_citrus' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_cocoa' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_cocoa' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_coffee' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_coffee' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_cotton' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_cotton' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_datepalm' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_datepalm' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_foddergrass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_foddergrass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_grapes' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_grapes' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_groundnuts' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_groundnuts' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_millet' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_millet' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_oilpalm' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_oilpalm' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_potatoes' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_potatoes' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_pulses' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_pulses' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_rapeseed' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_rapessed' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_rice' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_rice' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_sorghum' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_sorghum' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_sugarbeet' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_sugarbeet' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_sugarcane' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_sugarcane' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_sunflower' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_sunflower' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_miscanthus' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_miscanthus' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_switchgrass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_switchgrass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_trop_corn' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_trop_corn' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_trop_soybean' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'p_irr_trop_soybean' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') -#endif - SpcName = 'pla_notveg' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_needle_eg_temp' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_needle_eg_bor' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_needle_dd_bor' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_broad_eg_trop' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_broad_eg_temp' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_broad_dd_trop' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_broad_dd_temp' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_broad_dd_bor' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_broad_eg_sh' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_broad_dd_temp_sh' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_broad_dd_bor_sh' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_c3_arctic_grass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_c3_narctic_grass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_c4_grass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_c3_crop' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_c3_irrigated' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') -#if defined( CLM40 ) - SpcName = 'pla_c3_corn' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_spring_cereal' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_winter_cereal' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_soybean' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') -#elif defined( CLM45 ) || defined( CLM50 ) - SpcName = 'pla_temp_corn' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_temp_corn' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_spring_wheat' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_spring_wheat' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_winter_wheat' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_winter_wheat' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_temp_soybean' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_temp_soybean' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_barley' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_barley' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_winter_barley' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_winter_barley' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_rye' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_rye' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_winter_rye' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_winter_rye' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_cassava' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_cassava' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_citrus' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_citrus' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_cocoa' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_cocoa' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_coffee' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_coffee' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_cotton' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_cotton' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_datepalm' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_datepalm' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_foddergrass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_foddergrass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_grapes' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_grapes' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_groundnuts' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_groundnuts' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_millet' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_millet' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_oilpalm' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_oilpalm' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_potatoes' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_potatoes' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_pulses' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_pulses' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_rapeseed' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_rapessed' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_rice' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_rice' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_sorghum' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_sorghum' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_sugarbeet' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_sugarbeet' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_sugarcane' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_sugarcane' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_sunflower' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_sunflower' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_miscanthus' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_miscanthus' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_switchgrass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_switchgrass' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_trop_corn' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_trop_corn' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_trop_soybean' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') - SpcName = 'pla_irr_trop_soybean' - CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'fraction', TRIM(SpcName)//' surface area') -#endif - - IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_INIT' - - end subroutine chem_init - -!=============================================================================== - - subroutine chem_timestep_init(phys_state, pbuf2d) - use physics_buffer, only: physics_buffer_desc - - TYPE(physics_state), INTENT(IN):: phys_state(begchunk:endchunk) - TYPE(physics_buffer_desc), POINTER :: pbuf2d(:,:) - - ! Not sure what we would realistically do here rather than in tend - - end subroutine chem_timestep_init - -!=============================================================================== - - subroutine GC_Update_Timesteps(DT) - - use Time_Mod, only : Set_Timesteps - - REAL(r8), INTENT(IN) :: DT - INTEGER :: DT_MIN - INTEGER, SAVE :: DT_MIN_LAST = -1 - - DT_MIN = NINT(DT) - - Input_Opt%TS_CHEM = DT_MIN - Input_Opt%TS_EMIS = DT_MIN - Input_Opt%TS_CONV = DT_MIN - Input_Opt%TS_DYN = DT_MIN - Input_Opt%TS_RAD = DT_MIN - - ! Only bother updating the module information if there's been a change - IF (DT_MIN .NE. DT_MIN_LAST) THEN - IF (MasterProc) WRITE(iulog,'(a,F7.1,a)') ' --> GC: updating dt to ', DT, ' seconds' - - CALL Set_Timesteps( MasterProc, & - CHEMISTRY = DT_MIN, & - EMISSION = DT_MIN, & - DYNAMICS = DT_MIN, & - UNIT_CONV = DT_MIN, & - CONVECTION = DT_MIN, & - DIAGNOS = DT_MIN, & - RADIATION = DT_MIN ) - DT_MIN_LAST = DT_MIN - ENDIF - - end subroutine - -!=============================================================================== - - subroutine chem_timestep_tend( State, ptend, cam_in, cam_out, dT, pbuf, fh2o ) - - use physics_buffer, only: physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx - use cam_history, only: outfld - use camsrfexch, only: cam_in_t, cam_out_t - - use phys_grid, only: get_ncols_p, get_rlat_all_p, get_rlon_all_p - - use chem_mods, only: drySpc_ndx, map2GC_dryDep -#if ( LANDTYPE_CLM ) - use Olson_Landmap_Mod, only: Compute_Olson_Landmap - use Modis_LAI_Mod, only: Compute_XLAI -#endif -#if ( ALLDDVEL_GEOSCHEM || OCNDDVEL_GEOSCHEM ) - use Drydep_Mod, only: Do_Drydep -#elif ( OCNDDVEL_MOZART ) - use mo_drydep, only: drydep_update, drydep_fromlnd -#endif - use Drydep_Mod, only: DEPNAME !TMMF, this is just needed for debug - use Drydep_Mod, only: Update_DryDepSav - use Mixing_Mod - - use Calc_Met_Mod, only: Set_Dry_Surface_Pressure - use Calc_Met_Mod, only: AirQnt - use GC_Grid_Mod, only: SetGridFromCtr - use Pressure_Mod, only: Set_Floating_Pressures - use Pressure_Mod, only: Accept_External_Pedge - use Time_Mod, only: Accept_External_Date_Time - use Strat_chem_Mod, only: Init_Strat_Chem - use Toms_Mod, only: Compute_Overhead_O3 - use Chemistry_Mod, only: Do_Chemistry - use Wetscav_Mod, only: Setup_Wetscav, Do_WetDep - use CMN_Size_Mod, only: PTop - use PBL_Mix_Mod, only: Compute_PBL_Height - - use Tropopause, only: Tropopause_findChemTrop, Tropopause_Find - - ! For calculating SZA - use Orbit, only: zenith - use Time_Manager, only: Get_Curr_Calday, Get_Curr_Date - - ! Calculating relative humidity - use WV_Saturation, only: QSat - use PhysConst, only: MWDry - - ! Grid area - use PhysConst, only: Gravit - use PhysConstants, only: Re - use Phys_Grid, only: get_area_all_p, get_lat_all_p, get_lon_all_p - - use Short_Lived_Species, only : Get_Short_Lived_Species - use Short_Lived_Species, only : Set_Short_Lived_Species - - ! Use GEOS-Chem versions of physical constants - use PhysConstants, only: PI, PI_180, g0 - - REAL(r8), INTENT(IN) :: dT ! Time step - TYPE(physics_state), INTENT(IN) :: State ! Physics State variables - TYPE(physics_ptend), INTENT(OUT) :: ptend ! indivdual parameterization tendencies - TYPE(cam_in_t), INTENT(INOUT) :: cam_in - TYPE(cam_out_t), INTENT(IN) :: cam_out - TYPE(physics_buffer_desc), POINTER :: pbuf(:) - REAL(r8), OPTIONAL, INTENT(OUT) :: fh2o(PCOLS) ! h2o flux to balance source from chemistry - - ! Initial MMR for all species - REAL(r8) :: MMR_Beg(PCOLS,PVER,nSls+nTracers) - REAL(r8) :: MMR_End(PCOLS,PVER,nSls+nTracers) - REAL(r8) :: MMR_TEnd(PCOLS,PVER,nSls+nTracers) - - - ! Mapping (?) - LOGICAL :: lq(pcnst) - - ! Indexing - INTEGER :: I, J, K, L, N, M - INTEGER :: nX, nY, nZ - - INTEGER :: LCHNK, NCOL - - REAL(r8), DIMENSION(State%NCOL) :: & - CSZA, & ! Cosine of solar zenith angle - Zsurf, & ! Surface height - Rlats, Rlons ! Chunk latitudes and longitudes (radians) - - REAL(r8), POINTER :: PblH(:) ! PBL height on each chunk [m] - REAL(r8), POINTER :: cldTop(:) ! Cloud top height [?] - REAL(r8), POINTER :: cldFrc(:,:) ! Cloud fraction [-] - REAL(r8), POINTER :: Fsds(:) ! Downward shortwave flux at surface [W/m2] - REAL(r8), POINTER :: PRain(:,:) ! Total stratiform precip. prod. (rain + snow) [kg/kg/s] - REAL(r8), POINTER :: RprdTot(:,:) ! Total convective precip. prod. (rain + snow) [kg/kg/s] - REAL(r8), POINTER :: NEvapr(:,:) ! Evaporation of total precipitation (rain + snow) [kg/kg/s] - REAL(r8), POINTER :: LsFlxPrc(:,:) ! Large-scale downward precip. flux at interface (rain + snow) [kg/m2/s] - REAL(r8), POINTER :: LsFlxSnw(:,:) ! Large-scale downward precip. flux at interface (snow only) [kg/m2/s] - - REAL(r8) :: RelHum(State%NCOL, PVER) ! Relative humidity [0-1] - REAL(r8) :: SatV (State%NCOL, PVER) ! Work arrays - REAL(r8) :: SatQ (State%NCOL, PVER) ! Work arrays - REAL(r8) :: qH2O (State%NCOL, PVER) ! Specific humidity [kg/kg] - REAL(r8) :: H2OVMR(State%NCOL, PVER) ! H2O volume mixing ratio -#if ( OCNDDVEL_MOZART ) - REAL(r8) :: windSpeed(State%NCOL) ! Wind speed at ground level [m/s] - REAL(r8) :: potT(State%NCOL) ! Potential temperature [K] - - INTEGER :: latndx(PCOLS) - INTEGER :: lonndx(PCOLS) - - ! For MOZART's dry deposition over ocean and ice - ! Deposition velocity (cm/s) - REAL(r8) :: MOZART_depVel(State%NCOL, nTracersMax) - ! Deposition flux (/cm^2/s) - REAL(r8) :: MOZART_depFlx(State%NCOL, nTracersMax) -#endif - REAL(r8), PARAMETER :: zlnd = 0.01_r8 ! Roughness length for soil [m] - REAL(r8), PARAMETER :: zslnd = 0.0024_r8 ! Roughness length for snow [m] - REAL(r8), PARAMETER :: zsice = 0.0400_r8 ! Roughness length for sea ice [m] - REAL(r8), PARAMETER :: zocn = 0.0001_r8 ! Roughness length for oean [m] - - ! Because of strat chem - LOGICAL, SAVE :: SCHEM_READY = .FALSE. - - REAL(f4) :: lonMidArr(1,PCOLS), latMidArr(1,PCOLS) - INTEGER :: iMaxLoc(1) - - REAL(r8) :: Col_Area(State%NCOL) - - ! Intermediate arrays - INTEGER :: Trop_Lev (PCOLS) - REAL(r8) :: Trop_P (PCOLS) - REAL(r8) :: Trop_T (PCOLS) - REAL(r8) :: Trop_Ht (PCOLS) - REAL(r8) :: SnowDepth(PCOLS) - REAL(r8) :: cld2D (PCOLS) - REAL(r8) :: Z0 (PCOLS) - REAL(r8) :: Sd_Ice, Sd_Lnd, Sd_Avg, Frc_Ice - - ! Estimating cloud optical depth - REAL(r8) :: cld(PCOLS,PVER) - REAL(r8) :: TauCli(PCOLS,PVER) - REAL(r8) :: TauClw(PCOLS,PVER) - REAL(r8), PARAMETER :: re_m = 1.0e-05_r8 ! Cloud drop radius in m - REAL(r8), PARAMETER :: cldMin = 1.0e-02_r8 ! Minimum cloud cover - REAL(r8), PARAMETER :: cnst = 1.5e+00_r8 / (re_m * 1.0e+03_r8 * g0) - - ! Calculating SZA - REAL(r8) :: Calday - - ! For archiving - CHARACTER(LEN=255) :: SpcName - REAL(r8) :: VMR(State%NCOL,PVER) - - REAL(r8) :: SlsData(State%NCOL, PVER, nSls) - - INTEGER :: currYr, currMo, currDy, currTOD - INTEGER :: currYMD, currHMS, currHr, currMn, currSc - REAL(f4) :: currUTC - LOGICAL :: firstDay = .True. - LOGICAL :: newDay = .False. - LOGICAL :: newMonth = .False. - - INTEGER :: TIM_NDX - - INTEGER, SAVE :: iStep = 0 - LOGICAL :: rootChunk - INTEGER :: RC - - ! LCHNK: which chunk we have on this process - LCHNK = State%LCHNK - ! NCOL: number of atmospheric columns on this chunk - NCOL = State%NCOL - - ! Am I the first chunk on the first CPU? - rootChunk = ( MasterProc.and.(LCHNK==BEGCHUNK) ) - - ! Count the number of steps which have passed - IF (LCHNK.EQ.BEGCHUNK) iStep = iStep + 1 - - ! Need to update the timesteps throughout the code - CALL GC_Update_Timesteps(dT) - - - ! For safety's sake - PTop = State%Pint(1,1)*0.01e+0_fp - - ! Need to be super careful that the module arrays are updated and correctly - ! set. NOTE: First thing - you'll need to flip all the data vertically - - nX = 1 - nY = NCOL - nZ = PVER - - ! Update the grid lat/lons since they are module variables - ! Assume (!) that area hasn't changed for now, as GEOS-Chem will - ! retrieve this from State_Met which is chunked - !CALL get_rlat_all_p( LCHNK, NCOL, Rlats ) - !CALL get_rlon_all_p( LCHNK, NCOL, Rlons ) - Rlats(1:nY) = State%Lat(1:nY) - Rlons(1:nY) = State%Lon(1:nY) - - lonMidArr = 0.0e+0_f4 - latMidArr = 0.0e+0_f4 - DO I = 1, nX - DO J = 1, nY - lonMidArr(I,J) = REAL(Rlons(J), f4) - latMidArr(I,J) = REAL(Rlats(J), f4) - ENDDO - ENDDO - - ! Update the grid - Call SetGridFromCtr( State_Grid = State_Grid(LCHNK), & - lonCtr = lonMidArr, & - latCtr = latMidArr, & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered within call to "SetGridFromCtr"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Set area - CALL Get_Area_All_p( LCHNK, nY, Col_Area ) - - ! Field : AREA_M2 - ! Description: Grid box surface area - ! Unit : - - ! Dimensions : nX, nY - ! Note : Set default value (in case of chunks with fewer columns) - State_Grid(LCHNK)%Area_M2 = 1.0e+10_fp - DO J = 1, nY - State_Grid(LCHNK)%Area_M2(1,J) = REAL(Col_Area(J) * Re**2,fp) - ENDDO - State_Met(LCHNK)%Area_M2 = State_Grid(LCHNK)%Area_M2 - - ! 2. Copy tracers into State_Chm - ! Data was received in kg/kg dry - State_Chm(LCHNK)%Spc_Units = 'kg/kg dry' - ! Initialize ALL State_Chm species data to zero, not just tracers - State_Chm(LCHNK)%Species = 0.0e+0_fp - - lq(:) = .FALSE. - - MMR_Beg = 0.0e+0_r8 - DO N = 1, pcnst - M = map2GC(N) - IF (M > 0) THEN - I = 1 - DO J = 1, nY - DO K = 1, nZ - ! CURRENTLY KG/KG DRY - MMR_Beg(J,K,M) = State%q(J,nZ+1-K,N) - State_Chm(LCHNK)%Species(1,J,K,M) = REAL(MMR_Beg(J,K,M),fp) - ENDDO - ENDDO - lq(N) = .TRUE. - ENDIF - ENDDO - - ! Retrieve previous value of species data - SlsData(:,:,:) = 0.0e+0_r8 - CALL Get_Short_Lived_Species( SlsData, LCHNK, nY, Pbuf ) - - ! Remap and flip them - DO N = 1, nSls - M = map2GC_Sls(N) - IF (M > 0) THEN - DO J = 1, nY - DO K = 1, nZ - State_Chm(LCHNK)%Species(1,J,K,M) = REAL(SlsData(J,nZ+1-K,N),fp) - ENDDO - ENDDO - ENDIF - ENDDO - - ! Initialize tendency array - CALL Physics_ptend_init(ptend, State%psetcols, 'chemistry', lq=lq) - - ! Calculate COS(SZA) - Calday = Get_Curr_Calday( ) - CALL Zenith( Calday, Rlats, Rlons, CSZA, nY ) - - ! Get all required data from physics buffer - TIM_NDX = Pbuf_Old_Tim_Idx() - CALL Pbuf_Get_Field( Pbuf, NDX_PBLH, PblH ) - CALL Pbuf_Get_Field( Pbuf, NDX_FSDS, Fsds ) - CALL Pbuf_Get_Field( Pbuf, NDX_CLDTOP, cldTop ) - CALL Pbuf_Get_Field( Pbuf, NDX_CLDFRC, cldFrc, START=(/1,1,TIM_NDX/), KOUNT=(/NCOL,PVER,1/) ) - CALL Pbuf_Get_Field( Pbuf, NDX_NEVAPR, NEvapr, START=(/1,1/), KOUNT=(/NCOL,PVER/)) - CALL Pbuf_Get_Field( Pbuf, NDX_PRAIN, PRain, START=(/1,1/), KOUNT=(/NCOL,PVER/)) - CALL Pbuf_Get_Field( Pbuf, NDX_RPRDTOT, RprdTot, START=(/1,1/), KOUNT=(/NCOL,PVER/)) - CALL Pbuf_Get_Field( Pbuf, NDX_LSFLXPRC, LsFlxPrc, START=(/1,1/), KOUNT=(/NCOL,PVERP/)) - CALL Pbuf_Get_Field( Pbuf, NDX_LSFLXSNW, LsFlxSnw, START=(/1,1/), KOUNT=(/NCOL,PVERP/)) - - ! Get VMR and MMR of H2O - H2OVMR = 0.0e0_fp - qH2O = 0.0e0_fp - ! Note MWDRY = 28.966 g/mol - DO J = 1, nY - DO L = 1, nZ - qH2O(J,L) = REAL(State_Chm(LCHNK)%Species(1,J,L,iH2O),r8) - H2OVMR(J,L) = qH2O(J,L) * MWDry / 18.016e+0_fp - ENDDO - ENDDO - - ! Calculate RH (range 0-1, note still level 1 = TOA) - relHum(:,:) = 0.0e+0_r8 - CALL QSat(State%T(:nY,:), State%Pmid(:nY,:), SatV, SatQ) - DO J = 1, nY - DO L = 1, nZ - relHum(J,L) = 0.622e+0_r8 * H2OVMR(J,L) / SatQ(J,L) - relHum(J,L) = MAX( 0.0e+0_r8, MIN( 1.0e+0_r8, relHum(J,L) ) ) - ENDDO - ENDDO - - Z0 = 0.0e+0_r8 - DO J = 1, nY - Z0(J) = cam_in%landFrac(J) * zlnd & - + cam_in%iceFrac(J) * zsice & - + cam_in%ocnFrac(J) * zocn - IF (( cam_in%snowhLand(J) > 0.01_r8 ) .OR. & - ( cam_in%snowhIce(J) > 0.01_r8 )) THEN - ! Land is covered in snow - Z0(J) = zslnd - ENDIF - ENDDO - - ! Estimate cloud liquid water content and OD - TauCli = 0.0e+0_r8 - TauClw = 0.0e+0_r8 - - ! Note: all using CAM vertical convention (1 = TOA) - ! Calculation is based on that done for MOZART - DO J = 1, nY - DO L = nZ, 1, -1 - ! Convert water mixing ratio [kg/kg] to water content [g/m^3] - IF ( ( State%Q(J,L,ixCldLiq) + State%Q(J,L,ixCldIce) ) * & - State%PMid(J,L) / (State%T(J,L) * 287.0e+00_r8) * 1.0e+03_r8 <= 0.01_r8 .AND. & - cldFrc(J,L) /= 0.0e+00_r8 ) THEN - cld(J,L) = 0.0e+00_r8 - ELSE - cld(J,L) = cldFrc(J,L) - ENDIF - ENDDO - ENDDO - - DO J = 1, nY - IF ( COUNT( cld(J,:nZ) > cldMin ) > 0 ) THEN - DO L = nZ, 1, -1 - ! ================================================================= - ! =========== Compute cloud optical depth based on ============ - ! =========== Liao et al. JGR, 104, 23697, 1999 ============ - ! ================================================================= - ! - ! Tau = 3/2 * LWC * dZ / ( \rho_w * r_e ) - ! dZ = - dP / ( \rho_air * g ) - ! since Pint is ascending, we can neglect the minus sign - ! - ! Tau = 3/2 * LWC * dP / ( \rho_air * r_e * \rho_w * g ) - ! LWC / \rho_air = Q - ! - ! Tau = 3/2 * Q * dP / ( r_e * rho_w * g ) - ! Tau(K) = 3/2 * Q(K) * (Pint(K+1) - Pint(K)) / (re * rho_w * g ) - ! Tau(K) = Q(K) * (Pint(K+1) - Pint(K)) * Cnst - ! - ! Unit check: | - ! Q : [kg H2O/kg air] | - ! Pint : [Pa]=[kg air/m/s^2] | - ! re : [m] | = 1.0e-5 - ! rho_w: [kg H2O/m^3] | = 1.0e+3 - ! g : [m/s^2] | = 9.81 - ! - TauClw(J,L) = State%Q(J,L,ixCldLiq) & - * (State%Pint(J,L+1)-State%Pint(J,L)) & - * cnst - TauClw(J,L) = MAX(TauClw(J,L), 0.0e+00_r8) - TauCli(J,L) = State%Q(J,L,ixCldIce) & - * (State%Pint(J,L+1)-State%Pint(J,L)) & - * cnst - TauCli(J,L) = MAX(TauCli(J,L), 0.0e+00_r8) - - ENDDO - ENDIF - ENDDO - - ! Retrieve tropopause level - Trop_Lev = 0.0e+0_r8 - CALL Tropopause_FindChemTrop(State, Trop_Lev) - ! Back out the pressure - Trop_P = 1000.0e+0_r8 - DO J = 1, nY - Trop_P(J) = State%PMid(J,Trop_Lev(J)) * 0.01e+0_r8 - ENDDO - - ! Calculate snow depth - snowDepth = 0.0e+0_r8 - DO J = 1, nY - Sd_Ice = MAX(0.0e+0_r8,cam_in%snowhIce(J)) - Sd_Lnd = MAX(0.0e+0_r8,cam_in%snowhLand(J)) - Frc_Ice = MAX(0.0e+0_r8,cam_in%iceFrac(J)) - IF (Frc_Ice > 0.0e+0_r8) THEN - Sd_Avg = (Sd_Lnd*(1.0e+0_r8 - Frc_Ice)) + (Sd_Ice * Frc_Ice) - ELSE - Sd_Avg = Sd_Lnd - ENDIF - snowDepth(J) = Sd_Avg - ENDDO - - ! Field : ALBD - ! Description: Visible surface albedo - ! Unit : - - ! Dimensions : nX, nY - State_Met(LCHNK)%ALBD (1,:) = cam_in%Asdir(:) - - ! Field : CLDFRC - ! Description: Column cloud fraction - ! Unit : - - ! Dimensions : nX, nY - ! Note : Estimate column cloud fraction as the maximum cloud - ! fraction in the column (pessimistic assumption) - DO J = 1, nY - State_Met(LCHNK)%CLDFRC(1,J) = MAXVAL(cldFrc(J,:)) - ENDDO - - ! Field : EFLUX, HFLUX - ! Description: Latent heat flux, sensible heat flux - ! Unit : W/m^2 - ! Dimensions : nX, nY - State_Met(LCHNK)%EFLUX (1,:) = cam_in%Lhf(:) - State_Met(LCHNK)%HFLUX (1,:) = cam_in%Shf(:) - - ! Field : LandTypeFrac - ! Description: Olson fraction per type - ! Unit : - (between 0 and 1) - ! Dimensions : nX, nY, NSURFTYPE - ! Note : Index 1 is water -#if ( LANDTYPE_CLM ) - ! Fill in water - State_Met(LCHNK)%LandTypeFrac(1,:, 1) = cam_in%ocnFrac(:) & - + cam_in%iceFrac(:) -#if ( ALLDDVEL_GEOSCHEM ) - CALL getLandTypes( cam_in, & - nY, & - State_Met(LCHNK) ) -#endif -#endif - - ! Field : FRCLND, FRLAND, FROCEAN, FRSEAICE, FRLAKE, FRLANDIC - ! Description: Olson land fraction - ! Fraction of land - ! Fraction of ocean - ! Fraction of sea ice - ! Fraction of lake - ! Fraction of land ice - ! Fraction of snow - ! Unit : - - ! Dimensions : nX, nY - State_Met(LCHNK)%FRCLND (1,:) = 1.e+0_fp - & - State_Met(LCHNK)%LandTypeFrac(1,:,1) ! Olson Land Fraction - State_Met(LCHNK)%FRLAND (1,:) = cam_in%landFrac(:) - State_Met(LCHNK)%FROCEAN (1,:) = cam_in%ocnFrac(:) + cam_in%iceFrac(:) - State_Met(LCHNK)%FRSEAICE (1,:) = cam_in%iceFrac(:) -#if ( LANDTYPE_CLM ) - State_Met(LCHNK)%FRLAKE (1,:) = cam_in%lwtgcell(:,3) + & - cam_in%lwtgcell(:,4) - State_Met(LCHNK)%FRLANDIC (1,:) = cam_in%lwtgcell(:,2) - State_Met(LCHNK)%FRSNO (1,:) = 0.0e+0_fp -#else - State_Met(LCHNK)%FRLAKE (1,:) = 0.0e+0_fp - State_Met(LCHNK)%FRLANDIC (1,:) = 0.0e+0_fp - State_Met(LCHNK)%FRSNO (1,:) = 0.0e+0_fp -#endif - - ! Field : GWETROOT, GWETTOP - ! Description: Root and top soil moisture - ! Unit : - - ! Dimensions : nX, nY - State_Met(LCHNK)%GWETROOT (1,:) = 0.0e+0_fp - State_Met(LCHNK)%GWETTOP (1,:) = 0.0e+0_fp - - ! Field : LAI - ! Description: Leaf area index - ! Unit : m^2/m^2 - ! Dimensions : nX, nY - State_Met(LCHNK)%LAI (1,:) = 0.0e+0_fp - - ! Field : PARDR, PARDF - ! Description: Direct and diffuse photosynthetically active radiation - ! Unit : W/m^2 - ! Dimensions : nX, nY - State_Met(LCHNK)%PARDR (1,:) = 0.0e+0_fp - State_Met(LCHNK)%PARDF (1,:) = 0.0e+0_fp - - ! Field : PBLH - ! Description: PBL height - ! Unit : m - ! Dimensions : nX, nY - State_Met(LCHNK)%PBLH (1,:) = PblH(:nY) - - ! Field : PHIS - ! Description: Surface geopotential height - ! Unit : m - ! Dimensions : nX, nY - State_Met(LCHNK)%PHIS (1,:) = State%Phis(:) - - ! Field : PRECANV, PRECCON, PRECLSC, PRECTOT - ! Description: Anvil precipitation @ ground - ! Convective precipitation @ ground - ! Large-scale precipitation @ ground - ! Total precipitation @ ground - ! Unit : kg/m^2/s - ! Dimensions : nX, nY - State_Met(LCHNK)%PRECANV (1,:) = 0.0e+0_fp - State_Met(LCHNK)%PRECCON (1,:) = cam_out%Precc(:) - State_Met(LCHNK)%PRECLSC (1,:) = cam_out%Precl(:) - State_Met(LCHNK)%PRECTOT (1,:) = cam_out%Precc(:) + cam_out%Precl(:) - - ! Field : TROPP - ! Description: Tropopause pressure - ! Unit : hPa - ! Dimensions : nX, nY - State_Met(LCHNK)%TROPP (1,:) = Trop_P(:) - - ! Field : PS1_WET, PS2_WET - ! Description: Wet surface pressure at start and end of timestep - ! Unit : hPa - ! Dimensions : nX, nY - State_Met(LCHNK)%PS1_WET (1,:) = State%ps(:)*0.01e+0_fp - State_Met(LCHNK)%PS2_WET (1,:) = State%ps(:)*0.01e+0_fp - - ! Field : SLP - ! Description: Sea level pressure - ! Unit : hPa - ! Dimensions : nX, nY - State_Met(LCHNK)%SLP (1,:) = State%ps(:)*0.01e+0_fp - - ! Field : TS, TSKIN - ! Description: Surface temperature, surface skin temperature - ! Unit : K - ! Dimensions : nX, nY - State_Met(LCHNK)%TS (1,:) = cam_in%TS(:) - State_Met(LCHNK)%TSKIN (1,:) = cam_in%TS(:) - - ! Field : SWGDN - ! Description: Incident radiation @ ground - ! Unit : W/m^2 - ! Dimensions : nX, nY - State_Met(LCHNK)%SWGDN (1,:) = fsds(:) - - ! Field : TO3 - ! Description: Total overhead ozone column - ! Unit : DU - ! Dimensions : nX, nY - State_Met(LCHNK)%TO3 (1,:) = 300.0e+0_fp ! TMMF - - ! Field : SNODP, SNOMAS - ! Description: Snow depth, snow mass - ! Unit : m, kg/m^2 - ! Dimensions : nX, nY - ! Note : Conversion from m to kg/m^2 - ! \rho_{ice} = 916.7 kg/m^3 - State_Met(LCHNK)%SNODP (1,:) = snowDepth(:) - State_Met(LCHNK)%SNOMAS (1,:) = snowDepth(:) * 916.7e+0_r8 - - ! Field : SUNCOS, SUNCOSmid - ! Description: COS(solar zenith angle) at current time and midpoint - ! of chemistry timestep - ! Unit : - - ! Dimensions : nX, nY - ! Note : Compute tendency in -/s (tmmf, 1/13/20) ? - State_Met(LCHNK)%SUNCOS (1,:) = CSZA(:) - State_Met(LCHNK)%SUNCOSmid (1,:) = CSZA(:) - - ! Field : U10M, V10M - ! Description: E/W and N/S wind speed @ 10m height - ! Unit : m/s - ! Dimensions : nX, nY - State_Met(LCHNK)%U10M (1,:) = State%U(:,nZ) - State_Met(LCHNK)%V10M (1,:) = State%V(:,nZ) - - ! Field : USTAR - ! Description: Friction velocity - ! Unit : m/s - ! Dimensions : nX, nY - ! Note : We here combine the land friction velocity (fv) with - ! the ocean friction velocity (ustar) - DO J = 1, nY - State_Met(LCHNK)%USTAR (1,J) = & - cam_in%fv(J) * ( cam_in%landFrac(J)) & - + cam_in%uStar(J) * ( 1.0e+0_fp - cam_in%landFrac(J)) - ENDDO - - ! Field : Z0 - ! Description: Surface roughness length - ! Unit : m - ! Dimensions : nX, nY - State_Met(LCHNK)%Z0 (1,:) = Z0(:) - - DO J = 1, nY - iMaxLoc = MAXLOC( (/ State_Met(LCHNK)%FRLAND(1,J) + & - State_Met(LCHNK)%FRLANDIC(1,J) + & - State_Met(LCHNK)%FRLAKE(1,J), & - State_Met(LCHNK)%FRSEAICE(1,J), & - State_Met(LCHNK)%FROCEAN(1,J) - & - State_Met(LCHNK)%FRSEAICE(1,J) /) ) - IF ( iMaxLoc(1) == 3 ) iMaxLoc(1) = 0 - ! reset ocean to 0 - - ! Field : LWI - ! Description: Land/water indices - ! Unit : - - ! Dimensions : nX, nY - State_Met(LCHNK)%LWI(1,J) = FLOAT( iMaxLoc(1) ) - ENDDO - - ! Three-dimensional fields on level edges - DO J = 1, nY - DO L = 1, nZ+1 - ! Field : PEDGE - ! Description: Wet air pressure at (vertical) level edges - ! Unit : hPa - ! Dimensions : nX, nY, nZ+1 - State_Met(LCHNK)%PEDGE (1,J,L) = State%Pint(J,nZ+2-L)*0.01e+0_fp - - ! Field : CMFMC - ! Description: Upward moist convective mass flux - ! Unit : kg/m^2/s - ! Dimensions : nX, nY, nZ+1 - State_Met(LCHNK)%CMFMC (1,J,L) = 0.0e+0_fp - - ! Field : PFICU, PFLCU - ! Description: Downward flux of ice/liquid precipitation (convective) - ! Unit : kg/m^2/s - ! Dimensions : nX, nY, nZ+1 - State_Met(LCHNK)%PFICU (1,J,L) = 0.0e+0_fp - State_Met(LCHNK)%PFLCU (1,J,L) = 0.0e+0_fp - - ! Field : PFILSAN, PFLLSAN - ! Description: Downward flux of ice/liquid precipitation (Large-scale & anvil) - ! Unit : kg/m^2/s - ! Dimensions : nX, nY, nZ+1 - State_Met(LCHNK)%PFILSAN (1,J,L) = LsFlxSnw(j,nZ+2-L) ! kg/m2/s - State_Met(LCHNK)%PFLLSAN (1,J,L) = MAX(0.0e+0_fp,LsFlxPrc(J,nZ+2-L) - LsFlxSnw(J,nZ+2-L)) ! kg/m2/s - ENDDO - ENDDO - - DO J = 1, nY - ! Field : U, V - ! Description: Max cloud top height - ! Unit : level - ! Dimensions : nX, nY - State_Met(LCHNK)%cldTops(1,J) = nZ + 1 - NINT(cldTop(J)) - ENDDO - - ! Three-dimensional fields on level centers - DO J = 1, nY - DO L = 1, nZ - - ! Field : U, V - ! Description: E/W and N/S component of wind - ! Unit : m/s - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%U (1,J,L) = State%U(J,nZ+1-L) - State_Met(LCHNK)%V (1,J,L) = State%V(J,nZ+1-L) - - ! Field : OMEGA - ! Description: Updraft velocity - ! Unit : Pa/s - ! Dimensions : nX, nY, nZ - !State_Met(LCHNK)%OMEGA (1,J,L) = State%Omega(J,nZ+1-L) - - ! Field : CLDF - ! Description: 3-D cloud fraction - ! Unit : - - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%CLDF (1,J,L) = cldFrc(j,nZ+1-l) - - ! Field : DTRAIN - ! Description: Detrainment flux - ! Unit : kg/m^2/s - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%DTRAIN (1,J,L) = 0.0e+0_fp ! Used in convection - - ! Field : DQRCU - ! Description: Convective precipitation production rate - ! Unit : kg/kg dry air/s - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%DQRCU (1,J,L) = 0.0e+0_fp ! Used in convection - - ! Field : DQRLSAN - ! Description: Large-scale precipitation production rate - ! Unit : kg/kg dry air/s - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%DQRLSAN (1,J,L) = PRain(J,nZ+1-L) ! kg/kg/s - - ! Field : QI, QL - ! Description: Cloud ice/water mixing ratio - ! Unit : kg/kg dry air - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%QI (1,J,L) = State%Q(J,nZ+1-L,ixCldIce) ! kg ice / kg dry air - State_Met(LCHNK)%QL (1,J,L) = State%Q(J,nZ+1-L,ixCldLiq) ! kg water / kg dry air - - ! Field : RH - ! Description: Relative humidity - ! Unit : % - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%RH (1,J,L) = RelHum(J,nZ+1-L) * 100.0e+0_fp - - ! Field : TAUCLI, TAUCLW - ! Description: Optical depth of ice/H2O clouds - ! Unit : - - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%TAUCLI (1,J,L) = TauCli(J,nZ+1-L) - State_Met(LCHNK)%TAUCLW (1,J,L) = TauClw(J,nZ+1-L) - - ! Field : REEVAPCN - ! Description: Evaporation of convective precipitation - ! (w/r/t dry air) - ! Unit : kg - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%REEVAPCN (1,J,L) = 0.0e+0_fp - - ! Field : REEVAPLS - ! Description: Evaporation of large-scale + anvil precipitation - ! (w/r/t dry air) - ! Unit : kg - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%REEVAPLS (1,J,L) = NEvapr(J,nZ+1-L) ! kg/kg/s - - ! Field : SPHU1, SPHU2 - ! Description: Specific humidity at current and next timestep - ! Unit : g H2O/ kg air - ! Dimensions : nX, nY, nZ - ! Note : Since we are using online meteorology, we do not have - ! access to the data at the next time step - ! Compute tendency in g H2O/kg air/s (tmmf, 1/13/20) ? - State_Met(LCHNK)%SPHU1 (1,J,L) = qH2O(J,nZ+1-L) * 1.0e+3_fp ! g/kg - State_Met(LCHNK)%SPHU2 (1,J,L) = qH2O(J,nZ+1-L) * 1.0e+3_fp ! g/kg - - ! Field : TMPU1, TMPU2 - ! Description: Temperature at current and next timestep - ! Unit : K - ! Dimensions : nX, nY, nZ - ! Note : Since we are using online meteorology, we do not have - ! access to the data at the next time step - ! Compute tendency in K/s (tmmf, 1/13/20) ? - State_Met(LCHNK)%TMPU1 (1,J,L) = State%T(J,nZ+1-L) - State_Met(LCHNK)%TMPU2 (1,J,L) = State%T(J,nZ+1-L) - ENDDO - ENDDO - - ! Field : T - ! Description: Temperature at current time - ! Unit : K - ! Dimensions : nX, nY, nZ - ! Note : Since we are using online meteorology, we do not have - ! access to the data at the next time step - ! Compute tendency in K/s (tmmf, 1/13/20) ? - State_Met(LCHNK)%T = (State_Met(LCHNK)%TMPU1 + State_Met(LCHNK)%TMPU2)*0.5e+0_fp - - ! Field : SPHU - ! Description: Specific humidity at current time - ! Unit : g H2O/ kg air - ! Dimensions : nX, nY, nZ - ! Note : Since we are using online meteorology, we do not have - ! access to the data at the next time step - ! Compute tendency in g H2O/kg air/s (tmmf, 1/13/20) ? - State_Met(LCHNK)%SPHU = (State_Met(LCHNK)%SPHU1 + State_Met(LCHNK)%SPHU2)*0.5e+0_fp - - ! Field : OPTD - ! Description: Total in-cloud optical depth (visible band) - ! Unit : - - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%OPTD = State_Met(LCHNK)%TAUCLI + State_Met(LCHNK)%TAUCLW - - ! Nullify all pointers - Nullify(PblH ) - Nullify(Fsds ) - Nullify(PRain ) - Nullify(LsFlxSnw) - Nullify(LsFlxPrc) - Nullify(cldTop ) - Nullify(cldFrc ) - Nullify(NEvapr ) - Nullify(RprdTot ) - - ! Field : InChemGrid - ! Description: Are we in the chemistry grid? - ! Unit : - - ! Dimensions : nX, nY, nZ - State_Met(LCHNK)%InChemGrid(:,:,:) = .True. - - ! Determine current date and time - CALL Get_Curr_Date( yr = currYr, & - mon = currMo, & - day = currDy, & - tod = currTOD ) - - ! For now, force year to be 2000 - currYr = 2000 - currYMD = (currYr*1000) + (currMo*100) + (currDy) - ! Deal with subdaily - currUTC = REAL(currTOD,f4)/3600.0e+0_f4 - currSc = 0 - currMn = 0 - currHr = 0 - DO WHILE (currTOD > 3600) - currTOD = currTOD - 3600 - currHr = currHr + 1 - ENDDO - DO WHILE (currTOD > 60) - currTOD = currTOD - 60 - currMn = currMn + 1 - ENDDO - currSc = currTOD - currHMS = (currHr*1000) + (currMn*100) + (currSc) - - IF ( firstDay ) THEN - newDay = .True. - newMonth = .True. - firstDay = .False. - ELSE IF ( currHMS < dT ) THEN - newDay = .True. - IF ( currDy == 1 ) THEN - newMonth = .True. - ELSE - newMonth = .False. - ENDIF - ELSE - newDay = .False. - newMonth = .False. - ENDIF - - ! Pass time values obtained from the ESMF environment to GEOS-Chem - CALL Accept_External_Date_Time( value_NYMD = currYMD, & - value_NHMS = currHMS, & - value_YEAR = currYr, & - value_MONTH = currMo, & - value_DAY = currDy, & - value_DAYOFYR = INT(FLOOR(Calday)), & - value_HOUR = currHr, & - value_MINUTE = currMn, & - value_HELAPSED = 0.0e+0_f4, & - value_UTC = currUTC, & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Failed to update time in GEOS-Chem!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - CALL Accept_External_PEdge( State_Met = State_Met(LCHNK), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Failed to update pressure edges!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Field : PS1_DRY, PS2_DRY - ! Description: Dry surface pressure at current and next timestep - ! Unit : hPa - ! Dimensions : nX, nY, nZ+1 - ! Note : 1. Use the CAM PSDry fields instead of using the - ! GEOS-Chem calculation - ! 2. As we are using online meteorology, we do not - ! have access to the fields at the next time step - ! Compute Pa/s tendency? (tmmf, 1/13/20) - State_Met(LCHNK)%PS1_DRY (1,:) = State%PSDry(:) * 0.01e+0_fp - State_Met(LCHNK)%PS2_DRY (1,:) = State%PSDry(:) * 0.01e+0_fp - - ! Field : PSC2_WET, PSC2_DRY - ! Description: Interpolated wet and dry surface pressure at the - ! current time - ! Unit : hPa - ! Dimensions : nX, nY, nZ+1 - ! Note : As we are using online meteorology, we do not - ! have access to the fields at the next time step - ! Compute Pa/s tendency? (tmmf, 1/13/20) - State_Met(LCHNK)%PSC2_WET = State_Met(LCHNK)%PS1_WET - State_Met(LCHNK)%PSC2_DRY = State_Met(LCHNK)%PS1_DRY - - CALL Set_Floating_Pressures( State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Failed to set floating pressures!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Set quantities of interest but do not change VMRs - ! This function updates: - ! ==================================================================== - ! (1) PEDGE : Moist air pressure at grid box bottom [hPa] - ! (2) PEDGE_DRY : Dry air partial pressure at box bottom [hPa] - ! (3) PMID : Moist air pressure at grid box centroid [hPa] - ! (4) PMID_DRY : Dry air partial pressure at box centroid [hPa] - ! (5) PMEAN : Altitude-weighted mean moist air pressure [hPa] - ! (6) PMEAN_DRY : Alt-weighted mean dry air partial pressure [hPa] - ! (7) DELP : Delta-P extent of grid box [hPa] - ! (Same for both moist and dry air since we - ! assume constant water vapor pressure - ! across box) - ! (8) AIRDEN : Mean grid box dry air density [kg/m^3] - ! (defined as total dry air mass/box vol) - ! (9) MAIRDEN : Mean grid box moist air density [kg/m^3] - ! (defined as total moist air mass/box vol) - ! (10) AD : Total dry air mass in grid box [kg] - ! (11) ADMOIST : Total moist air mass in grid box [kg] - ! (12) BXHEIGHT : Vertical height of grid box [m] - ! (13) AIRVOL : Volume of grid box [m^3] - ! (14) MOISTMW : Molecular weight of moist air in box [g/mol] - ! ==================================================================== - CALL AirQnt( Input_Opt = Input_Opt, & - State_Chm = State_Chm(LCHNK), & - State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - RC = RC, & - Update_Mixing_Ratio = .False. ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Failed to calculate air properties!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Initialize strat chem if not already done. This has to be done here because - ! it needs to have non-zero values in State_Chm%AD, which only happens after - ! the first call to AirQnt - !IF ( (.not.SCHEM_READY) .and. Input_Opt%LSCHEM ) THEN - IF ( (.not.SCHEM_READY) .and. .True. ) THEN !TMMF - CALL Init_Strat_Chem( Input_Opt = Input_Opt, & - State_Chm = State_Chm(LCHNK), & - State_Met = State_Met(LCHNK), & - State_Grid = State_Grid(LCHNK), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Strat_Chem"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - SCHEM_READY = .True. - ENDIF - - !============================================================== - ! ***** R U N H E M C O P H A S E 1 ***** - ! - ! Phase 1 updates the HEMCO clock and the content of the - ! HEMCO data list. This should be done before writing the - ! diagnostics organized in the HEMCO diagnostics structure, - ! and before using any of the HEMCO data list fields. - ! (ckeller, 4/1/15) - !============================================================== - ! Run HEMCO Phase 1 - !CALL Emissions_Run ( Input_Opt = Input_Opt, & - ! State_Chm = State_Chm(LCHNK), & - ! State_Diag = State_Diag(LCHNK), & - ! State_Grid = State_Grid(LCHNK), & - ! State_Met = State_Met(LCHNK), & - ! EmisTime = EmisTime, & - ! Phase = 1, & - ! RC = RC ) - ! - !! Trap potential errors - !IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Error encountered in "Emissions_Run"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - !ENDIF - - !---------------------------------------------------------- - ! %%% GET SOME NON-EMISSIONS DATA FIELDS VIA HEMCO %%% - ! - ! HEMCO can track non-emission data fields for chemistry - ! simulations. Put these subroutine calls after the - ! call to EMISSIONS_RUN, so that the HEMCO data structure - ! will be initialized. (bmy, 3/20/15) - ! - ! HEMCO data list is now updated further above, so can - ! take these calls out of the emissions sequence. - ! (ckeller, 4/01/15) - !---------------------------------------------------------- - !IF ( LCHEM .and. newMonth ) THEN - ! - ! ! The following only apply when photolysis is used, - ! ! that is for fullchem or aerosol simulations. - ! IF ( ITS_A_FULLCHEM_SIM .or. ITS_AN_AEROSOL_SIM ) THEN - ! - ! ! Copy UV Albedo data (for photolysis) into the - ! ! State_Met%UVALBEDO field. (bmy, 3/20/15) - ! CALL Get_UvAlbedo( Input_Opt = Input_Opt, & - ! State_Met = State_Met(LCHNK), & - ! RC = RC ) - ! - ! ! Trap potential errors - ! IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Error encountered in "Get_UvAlbedo"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - ! ENDIF - ! - ! IF ( Input_Opt%USE_TOMS_O3 ) THEN - ! ! Get TOMS overhead O3 columns for photolysis from - ! ! the HEMCO data structure (bmy, 3/20/15) - ! CALL Read_TOMS( Input_Opt = Input_Opt, & - ! RC = RC ) - ! - ! ! Trap potential errors - ! IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Error encountered in "Read_TOMS"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - ! ENDIF - ! ENDIF - ! - ! ENDIF - ! - ! ! Read data required for Hg2 gas-particle partitioning - ! ! (H Amos, 25 Oct 2011) - ! IF ( ITS_A_MERCURY_SIM ) THEN - ! CALL Read_Hg2_Partitioning( Input_Opt = Input_Opt, & - ! State_Grid = State_Grid(LCHNK), & - ! State_Met = State_Met(LCHNK), & - ! MONTH = 1, & !TMMF - ! RC = RC ) - ! - ! ! Trap potential errors - ! IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = - ! 'Error encountered in "Read_Hg2_Partitioning"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - ! ENDIF - ! - ! ENDIF - !ENDIF - - !! Prescribe methane surface concentrations throughout PBL - !IF ( ITS_A_FULLCHEM_SIM .and. id_CH4 > 0 ) THEN - ! - ! ! Set CH4 concentrations - ! CALL SET_CH4( Input_Opt = Input_Opt, & - ! State_Chm = State_Chm(LCHNK), & - ! State_Diag = State_Diag(LCHNK), & - ! State_Grid = State_Grid(LCHNK), & - ! State_Met = State_Met(LCHNK), & - ! RC = RC ) - ! - ! ! Trap potential errors - ! IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Error encountered in call to "SET_CH4"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - ! ENDIF - !ENDIF - - ! Eventually initialize/reset wetdep - IF ( Input_Opt%LConv .OR. Input_Opt%LChem .OR. Input_Opt%LWetD ) THEN - CALL Setup_WetScav( Input_Opt = Input_Opt, & - State_Chm = State_Chm(LCHNK), & - State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Setup_WetScav"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ENDIF - - !============================================================== - ! ***** C O M P U T E P B L H E I G H T etc. ***** - !============================================================== - ! Move this call from the PBL mixing routines because the PBL - ! height is used by drydep and some of the emissions routines. - ! (ckeller, 3/5/15) - ! This function updates: - ! ==================================================================== - ! (1) InPbl : Logical indicating if we are in the PBL [-] - ! (2) PBL_TOP_L : Number of layers in the PBL [-] - ! (3) PBL_TOP_hPa: Pressure at the top of the PBL [hPa] - ! (4) PBL_TOP_m : PBL height [m] - ! (5) PBL_THICK : PBL thickness [hPa] - ! (6) F_OF_PBL : Fraction of grid box within the PBL [-] - ! (7) F_UNDER_PBLTOP: Fraction of grid box underneath the PBL top [-] - ! (8) PBL_MAX_L : Model level where PBL top occurs [-] - ! ==================================================================== - CALL Compute_PBL_Height( State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - RC = RC ) - - ! Trap potential errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Compute_PBL_Height"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - !-------------------------------------------------------------- - ! Test for emission timestep - ! Now always do emissions here, even for full-mixing - ! (ckeller, 3/5/15) - !-------------------------------------------------------------- - !================================================================== - ! ***** D R Y D E P O S I T I O N ***** - !================================================================== - !================================================================== - ! Compute dry deposition velocities - ! - ! CLM computes dry deposition velocities over land. - ! We need to merge the land component passed through cam_in and - ! the ocn/ice dry deposition velocities. - ! - ! If using the CLM velocities, two options show up: - ! 1. Compute dry deposition velocities over ocean and ice similarly - ! to the way MOZART does it (OCNDDVEL_MOZART) - ! 2. Use GEOS-Chem's dry deposition module to compute velocities - ! and then scale them with the ocean fraction (OCNDDVEL_GEOSCHEM) - ! - ! A third option would be to let GEOS-Chem compute dry deposition - ! velocity (ALLDDVEL_GEOSCHEM), thus overwriting the input from CLM - ! - ! drydep_method must be set to DD_XLND. - ! - ! The following options are currently supported: - ! - ALLDDVEL_GEOSCHEM - ! - OCNDDVEL_GEOSCHEM - ! - OCNDDVEL_MOZART - ! - ! The ALLDDVEL_GEOSCHEM coupled with LANDTYPE_CLM requires that CLM - ! passes land type information (land type and leaf area index). - !================================================================== - ! - ! State_Chm expects dry deposition velocities in m/s, whereas - ! CLM returns land deposition velocities in cm/s! - ! - ! For now, dry deposition velocities are only computed for gases - ! (which is what CLM deals with). Dry deposition for aerosols is - ! work in progress. - ! - ! Thibaud M. Fritz - 27 Feb 2020 - !================================================================== - - IF ( Input_Opt%LDryD ) THEN -#if ( LANDTYPE_CLM ) - ! Compute the Olson landmap fields of State_Met - ! (e.g. State_Met%IREG, State_Met%ILAND, etc.) - CALL Compute_Olson_Landmap( Input_Opt = Input_Opt, & - State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - RC = RC ) - - ! Trap potential errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Compute_Olson_Landmap"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Compute State_Met%XLAI (for drydep) and State_Met%MODISLAI, - ! which is the average LAI per grid box (for soil NOx emissions) - CALL Compute_Xlai( Input_Opt = Input_Opt, & - State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - RC = RC ) - - ! Trap potential errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Compute_Xlai"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF -#endif - -#if ( ALLDDVEL_GEOSCHEM || OCNDDVEL_GEOSCHEM ) - - ! Compute drydep velocities and update State_Chm%DryDepVel - CALL Do_Drydep( Input_Opt = Input_Opt, & - State_Chm = State_Chm(LCHNK), & - State_Diag = State_Diag(LCHNK), & - State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - RC = RC ) - - ! Trap potential errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Do_Drydep"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - -#if ( OCNDDVEL_GEOSCHEM ) - - DO N = 1, nddvels - - !! Print debug - !IF ( rootChunk ) THEN - ! IF ( N == 1 ) THEN - ! Write(iulog,*) "Number of GC dry deposition species = ", & - ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) - ! Write(iulog,*) "Number of CESM dry deposition species = ", & - ! nddvels - ! ENDIF - ! Write(iulog,*) "N = ", N - ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) - ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) - ! IF ( map2GC_dryDep(N) > 0 ) THEN - ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) - ! ENDIF - ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) - ! IF ( drySpc_ndx(N) > 0 ) THEN - ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) - ! ENDIF - ! Write(iulog,*) "CLM-depVel = ", & - ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]" - ! IF ( map2GC_dryDep(N) > 0 ) THEN - ! Write(iulog,*) "GC-depVel = ", & - ! MAXVAL(State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N))), " [m/s]" - ! ENDIF - !ENDIF - - IF ( map2GC_dryDep(N) > 0 ) THEN - ! State_Chm%DryDepVel is in m/s - State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & - ! This first bit corresponds to the dry deposition - ! velocities over land as computed from CLM and - ! converted to m/s. This is scaled by the fraction - ! of land. - cam_in%depVel(:nY,N) * 1.0e-02_fp & - * MAX(0._fp, 1.0_fp - State_Met(LCHNK)%FROCEAN(1,:nY)) & - ! This second bit corresponds to the dry deposition - ! velocities over ocean and sea ice as computed from - ! GEOS-Chem. This is scaled by the fraction of ocean - ! and sea ice. - + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) & - * State_Met(LCHNK)%FROCEAN(1,:nY) - ENDIF - ENDDO - -#endif - -#elif ( OCNDDVEL_MOZART ) - ! This routine updates the deposition velocities from CLM in the - ! pointer lnd(LCHNK)%dvel as long as drydep_method == DD_XLND is - ! True. - CALL drydep_update( State, cam_in ) - - windSpeed(:nY) = SQRT( State%U(:nY,nZ)*State%U(:nY,nZ) + & - State%V(:nY,nZ)*State%V(:nY,nZ) ) - potT(:nY) = State%T(:nY,nZ) * (1._fp + qH2O(:nY,nZ)) - - CALL get_lat_all_p( LCHNK, nY, latndx ) - CALL get_lon_all_p( LCHNK, nY, lonndx ) - - CALL drydep_fromlnd( ocnfrac = cam_in%ocnfrac(:), & - icefrac = cam_in%icefrac(:), & - ncdate = currYMD, & - sfc_temp = cam_in%TS(:), & - pressure_sfc = State%PS(:), & - wind_speed = windSpeed(:), & - spec_hum = qH2O(:,nZ), & - air_temp = State%T(:,nZ), & - pressure_10m = State%PMid(:,nZ), & - rain = State_Met(LCHNK)%PRECTOT(1,:), & - snow = cam_in%Snowhland(:), & - solar_flux = State_Met(LCHNK)%SWGDN(1,:), & - dvelocity = MOZART_depVel(:,:), & - dflx = MOZART_depFlx(:,:), & - State_Chm = State_Chm(LCHNK), & - tv = potT(:), & - soilw = -99._fp, & - rh = relHum(:,nZ), & - ncol = nY, & - lonndx = lonndx(:), & - latndx = latndx(:), & - lchnk = LCHNK ) - - DO N = 1, nddvels - - !! Print debug - !IF ( rootChunk ) THEN - ! IF ( N == 1 ) THEN - ! Write(iulog,*) "Number of GC dry deposition species = ", & - ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) - ! Write(iulog,*) "Number of CESM dry deposition species = ", & - ! nddvels - ! ENDIF - ! Write(iulog,*) "N = ", N - ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) - ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) - ! IF ( map2GC_dryDep(N) > 0 ) THEN - ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) - ! ENDIF - ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) - ! IF ( drySpc_ndx(N) > 0 ) THEN - ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) - ! ENDIF - ! Write(iulog,*) "CLM-depVel = ", & - ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]", LCHNK - ! IF ( drySpc_ndx(N) > 0 ) THEN - ! Write(iulog,*) "Merged depVel = ", & - ! MAXVAL(MOZART_depVel(:nY,drySpc_ndx(N))) * 1.0e-02_fp, " [m/s]", LCHNK - ! ENDIF - !ENDIF - - IF ( ( map2GC_dryDep(N) > 0 ) .AND. ( drySpc_ndx(N) > 0 ) ) THEN - ! State_Chm%DryDepVel is in m/s - State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & - MOZART_depVel(:nY,drySpc_ndx(N)) * 1.0e-02_fp - ENDIF - - ENDDO - -#else - ! We should be in one of the cases above as any exceptions should be - ! caught when running chem_readnl, but just for safety's safe: - CALL ENDRUN('Incorrect definitions for dry deposition velocities') -#endif - - CALL Update_DryDepSav( Input_Opt = Input_Opt, & - State_Chm = State_Chm(LCHNK), & - State_Diag = State_Diag(LCHNK), & - State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - RC = RC ) - - ENDIF - - !!=========================================================== - !! ***** E M I S S I O N S ***** - !! - !! NOTE: For a complete description of how emissions from - !! HEMCO are added into GEOS-Chem (and how they are mixed - !! into the boundary layer), please see the wiki page: - !! - !! http://wiki-geos-chem.org/Distributing_emissions_in_the_PBL - !!=========================================================== - ! - !! EMISSIONS_RUN will call HEMCO run phase 2. HEMCO run phase - !! only calculates emissions. All data has been read to disk - !! in phase 1 at the beginning of the time step. - !! (ckeller, 4/1/15) - !CALL Emissions_Run( Input_Opt = Input_Opt, & - ! State_Chm = State_Chmk(LCHNK), & - ! State_Diag = State_Diag(LCHNK), & - ! State_Grid = State_Grid(LCHNK), & - ! State_Met = State_Met(LCHNK), & - ! TimeForEmis = TimeForEmis, & - ! Phase = 2, & - ! RC = RC ) - ! - !! Trap potential errors - !IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = - ! 'Error encountered in "Emissions_Run"! after drydep!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - !ENDIF - - !=========================================================== - ! ***** M I X E D L A Y E R M I X I N G ***** - !=========================================================== - - ! Note: mixing routine expects tracers in v/v - ! DO_MIXING applies the tracer tendencies (dry deposition, - ! emission rates) to the tracer arrays and performs PBL - ! mixing. - ! In the non-local PBL scheme, dry deposition and emission - ! fluxes below the PBL are handled within the PBL mixing - ! routine. Otherwise, tracer concentrations are first updated - ! and the full-mixing is then applied. - ! (ckeller, 3/5/15) - ! NOTE: Tracer concentration units are converted locally - ! to [v/v dry air] for mixing. Eventually mixing should - ! be updated to use [kg/kg total air] (ewl, 9/18/15) - ! - ! This requires HEMCO. For now comment out. - ! Thibaud M. Fritz - 05/07/20 - !CALL Do_Mixing( Input_Opt = Input_Opt, & - ! State_Chm = State_Chm(LCHNK), & - ! State_Diag = State_Diag(LCHNK), & - ! State_Grid = State_Grid(LCHNK), & - ! State_Met = State_Met(LCHNK), & - ! RC = RC ) - ! - !! Trap potential errors - !IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Error encountered in "Do_Mixing"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - !ENDIF - - !!=========================================================== - !! ***** C L O U D C O N V E C T I O N ***** - !!=========================================================== - !IF ( LCONV ) THEN - ! - ! ! Call the appropriate convection routine - ! ! NOTE: Tracer concentration units are converted locally - ! ! to [kg/kg total air] for convection (ewl, 9/18/15) - ! CALL Do_Convection( Input_Opt = Input_Opt, & - ! State_Chm = State_Chm(LCHNK), & - ! State_Diag = State_Diag(LCHNK), & - ! State_Grid = State_Grid(LCHNK), & - ! State_Met = State_Met(LCHNK), & - ! RC = RC ) - ! - ! ! Trap potential errors - ! IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Error encountered in "Do_Convection"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - ! ENDIF - !ENDIF - - !============================================================== - ! ***** C H E M I S T R Y ***** - !============================================================== - ! Get the overhead column O3 for use with FAST-J - IF ( Input_Opt%Its_A_FullChem_Sim .OR. & - Input_Opt%Its_An_Aerosol_Sim ) THEN - - IF ( Input_Opt%LChem ) THEN - CALL Compute_Overhead_O3( State_Grid = State_Grid(LCHNK), & - DAY = currDy, & - USE_O3_FROM_MET = Input_Opt%Use_O3_From_Met, & - TO3 = State_Met(LCHNK)%TO3 ) - ENDIF - ENDIF - - CALL Do_Chemistry( Input_Opt = Input_Opt, & - State_Chm = State_Chm(LCHNK), & - State_Diag = State_Diag(LCHNK), & - State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Do_Chemistry"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - !============================================================== - ! ***** W E T D E P O S I T I O N (rainout + washout) ***** - !============================================================== - IF ( Input_Opt%LWetD ) THEN - - ! Do wet deposition - ! NOTE: Tracer concentration units are converted locally - ! to [kg/m2] in wet deposition to enable calculations - ! along the column (ewl, 9/18/15) - CALL Do_WetDep( Input_Opt = Input_Opt, & - State_Chm = State_Chm(LCHNK), & - State_Diag = State_Diag(LCHNK), & - State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Do_WetDep"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ENDIF - - ! Make sure State_Chm(lchnk) is back in kg/kg dry! - ! Reset H2O MMR to the initial value (no chemistry tendency in H2O just yet) - State_Chm(LCHNK)%Species(1,:,:,iH2O) = MMR_Beg(:,:,iH2O) - - ! Store unadvected species data - SlsData = 0.0e+0_r8 - DO N = 1, nSls - M = map2GC_Sls(N) - IF ( M > 0 ) THEN - DO J = 1, nY - DO K = 1, nZ - SlsData(J,nZ+1-K,N) = REAL(State_Chm(LCHNK)%Species(1,J,K,M),r8) - ENDDO - ENDDO - ENDIF - ENDDO - CALL Set_Short_Lived_Species( SlsData, LCHNK, nY, Pbuf ) - - ! Write diagnostic output - DO N = 1, pcnst - M = map2GC(N) - I = map2Idx(N) - IF ( M > 0 ) THEN - SpcName = tracerNames(I) - VMR = 0.0e+0_r8 - DO J = 1, nY - DO K = 1, nZ - VMR(J,nZ+1-K) = REAL(State_Chm(LCHNK)%Species(1,J,K,M),r8) * MWRatio(I) - ENDDO - ENDDO - CALL OutFld( TRIM(SpcName), VMR(:nY,:), nY, LCHNK ) - ENDIF - ENDDO - -#if defined( CLM40 ) - SpcName = 'lu_soil' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,1), nY, LCHNK ) - SpcName = 'lu_landice' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,2), nY, LCHNK ) - SpcName = 'lu_deeplake' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,3), nY, LCHNK ) - SpcName = 'lu_shallowlake' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,4), nY, LCHNK ) - SpcName = 'lu_wetland' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,5), nY, LCHNK ) - SpcName = 'lu_urban' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,6), nY, LCHNK ) - SpcName = 'lu_icemec' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,7), nY, LCHNK ) - SpcName = 'lu_crop' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,8), nY, LCHNK ) -#elif defined( CLM45 ) || defined( CLM50 ) - SpcName = 'lu_soil' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,1), nY, LCHNK ) - SpcName = 'lu_crop' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,2), nY, LCHNK ) - SpcName = 'lu_landice' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,4), nY, LCHNK ) - SpcName = 'lu_deeplake' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,5), nY, LCHNK ) - SpcName = 'lu_wetland' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,6), nY, LCHNK ) - SpcName = 'lu_urban' - CALL OutFld( TRIM(SpcName), cam_in%lwtgcell(:,7) & - + cam_in%lwtgcell(:,8) & - + cam_in%lwtgcell(:,9), nY, LCHNK ) -#endif - SpcName = 'p_notveg' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,1), nY, LCHNK ) - SpcName = 'p_needle_eg_temp' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,2), nY, LCHNK ) - SpcName = 'p_needle_eg_bor' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,3), nY, LCHNK ) - SpcName = 'p_needle_dd_bor' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,4), nY, LCHNK ) - SpcName = 'p_broad_eg_trop' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,5), nY, LCHNK ) - SpcName = 'p_broad_eg_temp' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,6), nY, LCHNK ) - SpcName = 'p_broad_dd_trop' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,7), nY, LCHNK ) - SpcName = 'p_broad_dd_temp' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,8), nY, LCHNK ) - SpcName = 'p_broad_dd_bor' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,9), nY, LCHNK ) - SpcName = 'p_broad_eg_sh' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,10), nY, LCHNK ) - SpcName = 'p_broad_dd_temp_sh' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,11), nY, LCHNK ) - SpcName = 'p_broad_dd_bor_sh' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,12), nY, LCHNK ) - SpcName = 'p_c3_arctic_grass' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,13), nY, LCHNK ) - SpcName = 'p_c3_narctic_grass' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,14), nY, LCHNK ) - SpcName = 'p_c4_grass' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,15), nY, LCHNK ) - SpcName = 'p_c3_crop' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,16), nY, LCHNK ) - SpcName = 'p_c3_irrigated' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,17), nY, LCHNK ) -#if defined( CLM40 ) - SpcName = 'p_c3_corn' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,18), nY, LCHNK ) - SpcName = 'p_spring_cereal' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,19), nY, LCHNK ) - SpcName = 'p_winter_cereal' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,20), nY, LCHNK ) - SpcName = 'p_soybean' -#elif defined( CLM45 ) || defined( CLM50 ) - SpcName = 'p_temp_corn' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,18), nY, LCHNK ) - SpcName = 'p_irr_temp_corn' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,19), nY, LCHNK ) - SpcName = 'p_spring_wheat' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,20), nY, LCHNK ) - SpcName = 'p_irr_spring_wheat' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,21), nY, LCHNK ) - SpcName = 'p_winter_wheat' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,22), nY, LCHNK ) - SpcName = 'p_irr_winter_wheat' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,23), nY, LCHNK ) - SpcName = 'p_temp_soybean' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,24), nY, LCHNK ) - SpcName = 'p_irr_temp_soybean' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,25), nY, LCHNK ) - SpcName = 'p_barley' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,26), nY, LCHNK ) - SpcName = 'p_irr_barley' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,27), nY, LCHNK ) - SpcName = 'p_winter_barley' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,28), nY, LCHNK ) - SpcName = 'p_irr_winter_barley' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,29), nY, LCHNK ) - SpcName = 'p_rye' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,30), nY, LCHNK ) - SpcName = 'p_irr_rye' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,31), nY, LCHNK ) - SpcName = 'p_winter_rye' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,32), nY, LCHNK ) - SpcName = 'p_irr_winter_rye' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,33), nY, LCHNK ) - SpcName = 'p_cassava' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,34), nY, LCHNK ) - SpcName = 'p_irr_cassava' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,35), nY, LCHNK ) - SpcName = 'p_citrus' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,36), nY, LCHNK ) - SpcName = 'p_irr_citrus' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,37), nY, LCHNK ) - SpcName = 'p_cocoa' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,38), nY, LCHNK ) - SpcName = 'p_irr_cocoa' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,39), nY, LCHNK ) - SpcName = 'p_coffee' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,40), nY, LCHNK ) - SpcName = 'p_irr_coffee' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,41), nY, LCHNK ) - SpcName = 'p_cotton' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,42), nY, LCHNK ) - SpcName = 'p_irr_cotton' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,43), nY, LCHNK ) - SpcName = 'p_datepalm' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,44), nY, LCHNK ) - SpcName = 'p_irr_datepalm' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,45), nY, LCHNK ) - SpcName = 'p_foddergrass' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,46), nY, LCHNK ) - SpcName = 'p_irr_foddergrass' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,47), nY, LCHNK ) - SpcName = 'p_grapes' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,48), nY, LCHNK ) - SpcName = 'p_irr_grapes' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,49), nY, LCHNK ) - SpcName = 'p_groundnuts' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,50), nY, LCHNK ) - SpcName = 'p_irr_groundnuts' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,51), nY, LCHNK ) - SpcName = 'p_millet' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,52), nY, LCHNK ) - SpcName = 'p_irr_millet' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,53), nY, LCHNK ) - SpcName = 'p_oilpalm' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,54), nY, LCHNK ) - SpcName = 'p_irr_oilpalm' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,55), nY, LCHNK ) - SpcName = 'p_potatoes' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,56), nY, LCHNK ) - SpcName = 'p_irr_potatoes' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,57), nY, LCHNK ) - SpcName = 'p_pulses' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,58), nY, LCHNK ) - SpcName = 'p_irr_pulses' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,59), nY, LCHNK ) - SpcName = 'p_rapeseed' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,60), nY, LCHNK ) - SpcName = 'p_irr_rapessed' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,61), nY, LCHNK ) - SpcName = 'p_rice' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,62), nY, LCHNK ) - SpcName = 'p_irr_rice' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,63), nY, LCHNK ) - SpcName = 'p_sorghum' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,64), nY, LCHNK ) - SpcName = 'p_irr_sorghum' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,65), nY, LCHNK ) - SpcName = 'p_sugarbeet' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,66), nY, LCHNK ) - SpcName = 'p_irr_sugarbeet' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,67), nY, LCHNK ) - SpcName = 'p_sugarcane' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,68), nY, LCHNK ) - SpcName = 'p_irr_sugarcane' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,69), nY, LCHNK ) - SpcName = 'p_sunflower' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,70), nY, LCHNK ) - SpcName = 'p_irr_sunflower' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,71), nY, LCHNK ) - SpcName = 'p_miscanthus' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,72), nY, LCHNK ) - SpcName = 'p_irr_miscanthus' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,73), nY, LCHNK ) - SpcName = 'p_switchgrass' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,74), nY, LCHNK ) - SpcName = 'p_irr_switchgrass' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,75), nY, LCHNK ) - SpcName = 'p_trop_corn' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,76), nY, LCHNK ) - SpcName = 'p_irr_trop_corn' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,77), nY, LCHNK ) - SpcName = 'p_trop_soybean' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,78), nY, LCHNK ) - SpcName = 'p_irr_trop_soybean' - CALL OutFld( TRIM(SpcName), cam_in%pwtgcell(:,79), nY, LCHNK ) -#endif - SpcName = 'pla_notveg' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,1), nY, LCHNK ) - SpcName = 'pla_needle_eg_temp' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,2), nY, LCHNK ) - SpcName = 'pla_needle_eg_bor' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,3), nY, LCHNK ) - SpcName = 'pla_needle_dd_bor' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,4), nY, LCHNK ) - SpcName = 'pla_broad_eg_trop' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,5), nY, LCHNK ) - SpcName = 'pla_broad_eg_temp' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,6), nY, LCHNK ) - SpcName = 'pla_broad_dd_trop' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,7), nY, LCHNK ) - SpcName = 'pla_broad_dd_temp' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,8), nY, LCHNK ) - SpcName = 'pla_broad_dd_bor' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,9), nY, LCHNK ) - SpcName = 'pla_broad_eg_sh' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,10), nY, LCHNK ) - SpcName = 'pla_broad_dd_temp_sh' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,11), nY, LCHNK ) - SpcName = 'pla_broad_dd_bor_sh' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,12), nY, LCHNK ) - SpcName = 'pla_c3_arctic_grass' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,13), nY, LCHNK ) - SpcName = 'pla_c3_narctic_grass' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,14), nY, LCHNK ) - SpcName = 'pla_c4_grass' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,15), nY, LCHNK ) - SpcName = 'pla_c3_crop' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,16), nY, LCHNK ) - SpcName = 'pla_c3_irrigated' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,17), nY, LCHNK ) -#if defined( CLM40 ) - SpcName = 'pla_c3_corn' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,18), nY, LCHNK ) - SpcName = 'pla_spring_cereal' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,19), nY, LCHNK ) - SpcName = 'pla_winter_cereal' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,20), nY, LCHNK ) - SpcName = 'pla_soybean' -#elif defined( CLM45 ) || defined( CLM50 ) - SpcName = 'pla_temp_corn' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,18), nY, LCHNK ) - SpcName = 'pla_irr_temp_corn' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,19), nY, LCHNK ) - SpcName = 'pla_spring_wheat' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,20), nY, LCHNK ) - SpcName = 'pla_irr_spring_wheat' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,21), nY, LCHNK ) - SpcName = 'pla_winter_wheat' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,22), nY, LCHNK ) - SpcName = 'pla_irr_winter_wheat' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,23), nY, LCHNK ) - SpcName = 'pla_temp_soybean' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,24), nY, LCHNK ) - SpcName = 'pla_irr_temp_soybean' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,25), nY, LCHNK ) - SpcName = 'pla_barley' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,26), nY, LCHNK ) - SpcName = 'pla_irr_barley' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,27), nY, LCHNK ) - SpcName = 'pla_winter_barley' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,28), nY, LCHNK ) - SpcName = 'pla_irr_winter_barley' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,29), nY, LCHNK ) - SpcName = 'pla_rye' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,30), nY, LCHNK ) - SpcName = 'pla_irr_rye' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,31), nY, LCHNK ) - SpcName = 'pla_winter_rye' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,32), nY, LCHNK ) - SpcName = 'pla_irr_winter_rye' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,33), nY, LCHNK ) - SpcName = 'pla_cassava' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,34), nY, LCHNK ) - SpcName = 'pla_irr_cassava' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,35), nY, LCHNK ) - SpcName = 'pla_citrus' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,36), nY, LCHNK ) - SpcName = 'pla_irr_citrus' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,37), nY, LCHNK ) - SpcName = 'pla_cocoa' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,38), nY, LCHNK ) - SpcName = 'pla_irr_cocoa' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,39), nY, LCHNK ) - SpcName = 'pla_coffee' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,40), nY, LCHNK ) - SpcName = 'pla_irr_coffee' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,41), nY, LCHNK ) - SpcName = 'pla_cotton' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,42), nY, LCHNK ) - SpcName = 'pla_irr_cotton' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,43), nY, LCHNK ) - SpcName = 'pla_datepalm' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,44), nY, LCHNK ) - SpcName = 'pla_irr_datepalm' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,45), nY, LCHNK ) - SpcName = 'pla_foddergrass' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,46), nY, LCHNK ) - SpcName = 'pla_irr_foddergrass' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,47), nY, LCHNK ) - SpcName = 'pla_grapes' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,48), nY, LCHNK ) - SpcName = 'pla_irr_grapes' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,49), nY, LCHNK ) - SpcName = 'pla_groundnuts' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,50), nY, LCHNK ) - SpcName = 'pla_irr_groundnuts' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,51), nY, LCHNK ) - SpcName = 'pla_millet' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,52), nY, LCHNK ) - SpcName = 'pla_irr_millet' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,53), nY, LCHNK ) - SpcName = 'pla_oilpalm' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,54), nY, LCHNK ) - SpcName = 'pla_irr_oilpalm' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,55), nY, LCHNK ) - SpcName = 'pla_potatoes' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,56), nY, LCHNK ) - SpcName = 'pla_irr_potatoes' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,57), nY, LCHNK ) - SpcName = 'pla_pulses' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,58), nY, LCHNK ) - SpcName = 'pla_irr_pulses' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,59), nY, LCHNK ) - SpcName = 'pla_rapeseed' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,60), nY, LCHNK ) - SpcName = 'pla_irr_rapessed' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,61), nY, LCHNK ) - SpcName = 'pla_rice' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,62), nY, LCHNK ) - SpcName = 'pla_irr_rice' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,63), nY, LCHNK ) - SpcName = 'pla_sorghum' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,64), nY, LCHNK ) - SpcName = 'pla_irr_sorghum' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,65), nY, LCHNK ) - SpcName = 'pla_sugarbeet' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,66), nY, LCHNK ) - SpcName = 'pla_irr_sugarbeet' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,67), nY, LCHNK ) - SpcName = 'pla_sugarcane' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,68), nY, LCHNK ) - SpcName = 'pla_irr_sugarcane' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,69), nY, LCHNK ) - SpcName = 'pla_sunflower' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,70), nY, LCHNK ) - SpcName = 'pla_irr_sunflower' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,71), nY, LCHNK ) - SpcName = 'pla_miscanthus' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,72), nY, LCHNK ) - SpcName = 'pla_irr_miscanthus' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,73), nY, LCHNK ) - SpcName = 'pla_switchgrass' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,74), nY, LCHNK ) - SpcName = 'pla_irr_switchgrass' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,75), nY, LCHNK ) - SpcName = 'pla_trop_corn' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,76), nY, LCHNK ) - SpcName = 'pla_irr_trop_corn' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,77), nY, LCHNK ) - SpcName = 'pla_trop_soybean' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,78), nY, LCHNK ) - SpcName = 'pla_irr_trop_soybean' - CALL OutFld( TRIM(SpcName), cam_in%lai(:,79), nY, LCHNK ) -#endif - - DO N = 1, nSls - SpcName = slsNames(n) - VMR = 0.0e+0_r8 - M = map2GC_Sls(n) - IF ( M > 0 ) THEN - DO J = 1, nY - DO K = 1, nZ - VMR(J,nZ+1-K) = REAL(State_Chm(LCHNK)%Species(1,J,K,M),r8) * SLSMWratio(N) - ENDDO - ENDDO - CALL OutFld( TRIM(SpcName), VMR(:nY,:), nY, LCHNK ) - ENDIF - ENDDO - - ! NOTE: Re-flip all the arrays vertically or suffer the consequences - ! ptend%q dimensions: [column, ?, species] - Ptend%Q(:,:,:) = 0.0e+0_r8 - MMR_End = 0.0e+0_r8 - DO N = 1, pcnst - M = map2GC(N) - IF (M > 0) THEN - I = 1 - DO J = 1, nY - DO K = 1, nZ - ! CURRENTLY KG/KG - MMR_End (J,K,M) = REAL(State_Chm(LCHNK)%Species(1,J,K,M),r8) - MMR_TEnd(J,K,M) = MMR_End(J,K,M) - MMR_Beg(J,K,M) - ptend%q(J,nZ+1-K,N) = (MMR_End(J,K,M)-MMR_Beg(J,K,M))/dT - ENDDO - ENDDO - ENDIF - ENDDO - - IF (PRESENT(fh2o)) THEN - fh2o(:nY) = 0.0e+0_r8 - !DO K = 1, nZ - ! fh2o(:nY) = fh2o(:nY) + Ptend%Q(:nY,K,iH2O)*State%Pdel(:nY,K)/Gravit - !ENDDO - ENDIF - - IF (rootChunk) WRITE(iulog,'(a)') ' GEOS-Chem chemistry step completed' - - end subroutine chem_timestep_tend - -!=============================================================================== - subroutine chem_init_cnst(name, latvals, lonvals, mask, q) - - CHARACTER(LEN=*), INTENT(IN) :: name ! constituent name - REAL(r8), INTENT(IN) :: latvals(:) ! lat in degrees (NCOL) - REAL(r8), INTENT(IN) :: lonvals(:) ! lon in degrees (NCOL) - LOGICAL, INTENT(IN) :: mask(:) ! Only initialize where .true. - REAL(r8), INTENT(OUT) :: q(:,:) ! kg tracer/kg dry air (NCOL, PVER - ! Used to initialize tracer fields if desired. - ! Will need a simple mapping structure as well as the CAM tracer registration - ! routines. - - INTEGER :: ILEV, NLEV, I - REAL(r8) :: QTemp, Min_MMR - - IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_INIT_CNST' - - NLEV = SIZE(Q, 2) - ! Retrieve a "background value" for this from the database - Min_MMR = 1.0e-38_r8 - DO I = 1, nTracers - IF (TRIM(tracerNames(I)).eq.TRIM(name)) THEN - Min_MMR = ref_MMR(i) - EXIT - ENDIF - ENDDO - - DO ILEV = 1, NLEV - WHERE(MASK) - ! Set to the minimum mixing ratio - Q(:,ILEV) = Min_MMR - END WHERE - ENDDO - - end subroutine chem_init_cnst - -!=============================================================================== - subroutine chem_final - - use Input_Opt_Mod, only : Cleanup_Input_Opt - use State_Chm_Mod, only : Cleanup_State_Chm - use State_Diag_Mod, only : Cleanup_State_Diag - use State_Grid_Mod, only : Cleanup_State_Grid - use State_Met_Mod, only : Cleanup_State_Met - use Error_Mod, only : Cleanup_Error - - use FlexChem_Mod, only : Cleanup_FlexChem - use UCX_Mod, only : Cleanup_UCX - use Drydep_Mod, only : Cleanup_Drydep - use WetScav_Mod, only : Cleanup_Wetscav - use Carbon_Mod, only : Cleanup_Carbon - use Dust_Mod, only : Cleanup_Dust - use Seasalt_Mod, only : Cleanup_Seasalt - use Aerosol_Mod, only : Cleanup_Aerosol - use Sulfate_Mod, only : Cleanup_Sulfate - use Pressure_Mod, only : Cleanup_Pressure - use Strat_Chem_Mod, only : Cleanup_Strat_Chem - use PBL_Mix_Mod, only : Cleanup_PBL_Mix - - use CMN_Size_Mod, only : Cleanup_CMN_Size - use CMN_O3_Mod, only : Cleanup_CMN_O3 - use CMN_FJX_Mod, only : Cleanup_CMN_FJX - - ! Special: cleans up after NDXX_Setup - use Diag_Mod, only : Cleanup_Diag - - use GC_Emissions_Mod, only: GC_Emissions_Final - - INTEGER :: I, RC - - ! Finalize GEOS-Chem - IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_FINAL' - - CALL Cleanup_UCX( MasterProc ) - CALL Cleanup_Aerosol - CALL Cleanup_Carbon - CALL Cleanup_Drydep - CALL Cleanup_Dust - CALL Cleanup_FlexChem( RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Cleanup_FlexChem"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - CALL Cleanup_PBL_Mix - CALL Cleanup_Pressure - CALL Cleanup_Seasalt - CALL Cleanup_Sulfate - CALL Cleanup_Strat_Chem - - CALL Cleanup_WetScav( RC) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Cleanup_WetScav"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - CALL GC_Emissions_Final - - ! Call extra cleanup routines, from modules in Headers/ - CALL Cleanup_CMN_O3( MasterProc, RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Cleanup_CMN_O3"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - CALL Cleanup_CMN_SIZE( MasterProc, RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Cleanup_CMN_SIZE"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - CALL Cleanup_CMN_FJX( MasterProc, RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Cleanup_CMN_FJX"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - CALL Cleanup_Diag - - ! Cleanup Input_Opt - CALL Cleanup_Input_Opt( MasterProc, Input_Opt, RC ) - - ! Loop over each chunk and cleanup the variables - DO I = BEGCHUNK, ENDCHUNK - - CALL Cleanup_State_Chm ( State_Chm(I), RC ) - CALL Cleanup_State_Diag( State_Diag(I), RC ) - CALL Cleanup_State_Grid( State_Grid(I), RC ) - CALL Cleanup_State_Met ( State_Met(I), RC ) - ENDDO - CALL Cleanup_Error - - ! Finally deallocate state variables - IF (ALLOCATED(State_Chm)) DEALLOCATE(State_Chm) - IF (ALLOCATED(State_Diag)) DEALLOCATE(State_Diag) - IF (ALLOCATED(State_Grid)) DEALLOCATE(State_Grid) - IF (ALLOCATED(State_Met)) DEALLOCATE(State_Met) - - IF (ALLOCATED(slvd_Lst )) DEALLOCATE(slvd_Lst) - IF (ALLOCATED(slvd_ref_MMR)) DEALLOCATE(slvd_ref_MMR) - - RETURN - - end subroutine chem_final -!=============================================================================== - subroutine chem_init_restart(File) - use pio, only : file_desc_t - TYPE(file_desc_t) :: File - - IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_INIT_RESTART' - - RETURN - - end subroutine chem_init_restart -!=============================================================================== - subroutine chem_write_restart( File ) - !use tracer_cnst, only: write_tracer_cnst_restart - !use tracer_srcs, only: write_tracer_srcs_restart - !use linoz_data, only: write_linoz_data_restart - use pio, only : file_desc_t - IMPLICIT NONE - TYPE(file_desc_t) :: File - - IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_WRITE_RESTART' - ! - ! data for offline tracers - ! - !call write_tracer_cnst_restart(File) - !call write_tracer_srcs_restart(File) - !call write_linoz_data_restart(File) - end subroutine chem_write_restart -!=============================================================================== - subroutine chem_read_restart( File ) - !use tracer_cnst, only: read_tracer_cnst_restart - !use tracer_srcs, only: read_tracer_srcs_restart - !use linoz_data, only: read_linoz_data_restart - - use pio, only : file_desc_t - IMPLICIT NONE - TYPE(file_desc_t) :: File - - if (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_READ_RESTART' - ! - ! data for offline tracers - ! - !call read_tracer_cnst_restart(File) - !call read_tracer_srcs_restart(File) - !call read_linoz_data_restart(File) - end subroutine chem_read_restart -!================================================================================ - subroutine chem_emissions( state, cam_in ) - use camsrfexch, only: cam_in_t - - use PhysConstants, only: PI, PI_180 - - ! Arguments: - - TYPE(physics_state), INTENT(IN) :: state ! Physics state variables - TYPE(cam_in_t), INTENT(INOUT) :: cam_in ! import state - - REAL(r8) :: Rlats(State%NCOL) - REAL(r8) :: Rlons(State%NCOL) - REAL(r8) :: Dlat, Dlon - REAL(r8) :: SFlx(State%NCOL,nTracers) - - INTEGER :: M, N, I - INTEGER :: LCHNK, NCOL - LOGICAL :: rootChunk - - LOGICAL, SAVE :: FIRST = .TRUE. - - ! LCHNK: which chunk we have on this process - LCHNK = State%LCHNK - ! NCOL: number of atmospheric columns on this chunk - NCOL = State%NCOL - rootChunk = ( MasterProc.and.(LCHNK.EQ.BEGCHUNK) ) - - SFlx(:,:) = 0.0e+0_r8 - Rlats(1:ncol) = State%Lat(1:NCOL) - Rlons(1:ncol) = State%Lon(1:NCOL) - - IF (FIRST) THEN - ENDIF - - !TMMF - ! Test: emit 1e-10 kg/m2/s of NO in a square around Europe - DO M = 1, PCNST - N = map2GC(M) - IF ((N>0).and.(N==iNO)) THEN - SFlx(:,N) = 0.0e+0_r8 - DO I = 1, NCOL - Dlat = Rlats(i) / REAL(PI_180,r8) - Dlon = Rlons(i) / REAL(PI_180,r8) - IF ((Dlat > 50.0e+0_r8).and.(Dlat < 60.0e+0_r8).and.(Dlon > -15.0e+0_r8).and.(Dlon < 5.0e+0_r8)) THEN - SFlx(I,N) = SFlx(I,N) + 1.0e-10_r8 - ENDIF - ENDDO - cam_in%CFlx(:NCOL,M) = cam_in%CFlx(:NCOL,M) + SFlx(:NCOL,N) - ENDIF - ENDDO - - end subroutine chem_emissions - -end module chemistry diff --git a/src/chemistry/pp_geoschem/gc_emissions.F90 b/src/chemistry/pp_geoschem/gc_emissions.F90 deleted file mode 100644 index 05841a9e66..0000000000 --- a/src/chemistry/pp_geoschem/gc_emissions.F90 +++ /dev/null @@ -1,76 +0,0 @@ -!================================================================================================ -! This is the "GEOS-Chem" chemistry emissions interface -!================================================================================================ -module GC_Emissions_Mod - - use Shr_kind_mod, only : r8 => shr_kind_r8 - use Spmd_utils, only : MasterProc, myCPU=>iam, nCPUs=>npes - use Cam_logfile, only : iulog - use Cam_abortutils, only : endrun - - use Chem_mods, only : NTracers - use Chem_mods, only : TracerNames - use Chem_mods, only : Map2GC - - use Tracer_data, only : trfld,trfile - - IMPLICIT NONE - - TYPE :: Emission - INTEGER :: Spc_Ndx - REAL(r8) :: MW - REAL(r8) :: Scalefactor - CHARACTER(LEN=256) :: Filename - CHARACTER(LEN=16) :: Species - CHARACTER(LEN=8) :: Units - INTEGER :: Nsectors - CHARACTER(LEN=32), POINTER :: Sectors(:) - TYPE(trfld), POINTER :: Fields(:) - TYPE(trfile) :: File - ENDTYPE Emission - - PRIVATE - - PUBLIC :: GC_Emissions_Init - PUBLIC :: GC_Emissions_Calc - PUBLIC :: GC_Emissions_Final - - ! Stand-in: emissions - TYPE(Emission), ALLOCATABLE :: Emissions(:) - INTEGER :: N_Emis_Files - -!================================================================================================ -contains -!================================================================================================ - - subroutine GC_Emissions_Init - - INTEGER :: Ierr - - N_Emis_Files=1 - ALLOCATE(Emissions(N_Emis_Files), STAT=IERR) - IF (IERR.NE.0) CALL ENDRUN('Could not allocate GC emissions') - - end subroutine GC_Emissions_Init - - subroutine GC_Emissions_Calc(Eflx) - - ! Emissions in kg/m2/s - ! Dimensions: [N columns x K levels x C constituents ] - REAL(r8), INTENT(OUT) :: EFlx(:,:,:) - INTEGER :: I_Trc, I_Emis - - EFlx(:,:,:) = 0.0e+0_r8 - DO I_Emis = 1, N_Emis_Files - ! Read emissions file - DO I_Trc = 1, NTracers - ENDDO - ENDDO - - end subroutine GC_Emissions_Calc - - subroutine GC_Emissions_Final - IF (ALLOCATED(Emissions)) DEALLOCATE(Emissions) - end subroutine GC_Emissions_Final - - end module GC_Emissions_Mod diff --git a/src/chemistry/pp_geoschem/mo_chem_utls.F90 b/src/chemistry/pp_geoschem/mo_chem_utls.F90 deleted file mode 100644 index 1d709c09dc..0000000000 --- a/src/chemistry/pp_geoschem/mo_chem_utls.F90 +++ /dev/null @@ -1,162 +0,0 @@ - -module mo_chem_utls - - private - public :: get_spc_ndx!, get_het_ndx, get_extfrc_ndx, get_rxt_ndx, get_inv_ndx - - save - -contains - - integer function get_spc_ndx( spc_name ) - !----------------------------------------------------------------------- - ! ... return overall species index associated with spc_name - !----------------------------------------------------------------------- - - use chem_mods, only : nTracers, tracnam => tracerNames - use string_utils, only : to_upper - - implicit none - - !----------------------------------------------------------------------- - ! ... dummy arguments - !----------------------------------------------------------------------- - character(len=*), intent(in) :: spc_name - - !----------------------------------------------------------------------- - ! ... local variables - !----------------------------------------------------------------------- - integer :: m - - get_spc_ndx = -1 - do m = 1, nTracers - if( trim( spc_name ) == trim( to_upper( tracnam(m) ) ) ) then - get_spc_ndx = m - exit - end if - end do - - end function get_spc_ndx - -! integer function get_inv_ndx( invariant ) -! !----------------------------------------------------------------------- -! ! ... return overall external frcing index associated with spc_name -! !----------------------------------------------------------------------- -! -! use chem_mods, only : nfs, inv_lst -! -! implicit none -! -! !----------------------------------------------------------------------- -! ! ... dummy arguments -! !----------------------------------------------------------------------- -! character(len=*), intent(in) :: invariant -! -! !----------------------------------------------------------------------- -! ! ... local variables -! !----------------------------------------------------------------------- -! integer :: m -! -! get_inv_ndx = -1 -! do m = 1,nfs -! if( trim( invariant ) == trim( inv_lst(m) ) ) then -! get_inv_ndx = m -! exit -! end if -! end do -! -! end function get_inv_ndx -! -! integer function get_het_ndx( het_name ) -! !----------------------------------------------------------------------- -! ! ... return overall het process index associated with spc_name -! !----------------------------------------------------------------------- -! -! use gas_wetdep_opts,only : gas_wetdep_method, gas_wetdep_list, gas_wetdep_cnt -! -! implicit none -! -! !----------------------------------------------------------------------- -! ! ... dummy arguments -! !----------------------------------------------------------------------- -! character(len=*), intent(in) :: het_name -! -! !----------------------------------------------------------------------- -! ! ... local variables -! !----------------------------------------------------------------------- -! integer :: m -! -! get_het_ndx=-1 -! -! do m=1,gas_wetdep_cnt -! -! if( trim( het_name ) == trim( gas_wetdep_list(m) ) ) then -! get_het_ndx = get_spc_ndx( gas_wetdep_list(m) ) -! return -! endif -! -! enddo -! -! end function get_het_ndx -! -! integer function get_extfrc_ndx( frc_name ) -! !----------------------------------------------------------------------- -! ! ... return overall external frcing index associated with spc_name -! !----------------------------------------------------------------------- -! -! use chem_mods, only : extcnt, extfrc_lst -! -! implicit none -! -! !----------------------------------------------------------------------- -! ! ... dummy arguments -! !----------------------------------------------------------------------- -! character(len=*), intent(in) :: frc_name -! -! !----------------------------------------------------------------------- -! ! ... local variables -! !----------------------------------------------------------------------- -! integer :: m -! -! get_extfrc_ndx = -1 -! if( extcnt > 0 ) then -! do m = 1,max(1,extcnt) -! if( trim( frc_name ) == trim( extfrc_lst(m) ) ) then -! get_extfrc_ndx = m -! exit -! end if -! end do -! end if -! -! end function get_extfrc_ndx -! -! integer function get_rxt_ndx( rxt_tag ) -! !----------------------------------------------------------------------- -! ! ... return overall external frcing index associated with spc_name -! !----------------------------------------------------------------------- -! -! use chem_mods, only : rxt_tag_cnt, rxt_tag_lst, rxt_tag_map -! -! implicit none -! -! !----------------------------------------------------------------------- -! ! ... dummy arguments -! !----------------------------------------------------------------------- -! character(len=*), intent(in) :: rxt_tag -! -! !----------------------------------------------------------------------- -! ! ... local variables -! !----------------------------------------------------------------------- -! integer :: m -! -! get_rxt_ndx = -1 -! do m = 1,rxt_tag_cnt -! if( trim( rxt_tag ) == trim( rxt_tag_lst(m) ) ) then -! get_rxt_ndx = rxt_tag_map(m) -! exit -! end if -! end do -! -! end function get_rxt_ndx - -end module mo_chem_utls diff --git a/src/chemistry/pp_geoschem/mo_lightning.F90 b/src/chemistry/pp_geoschem/mo_lightning.F90 deleted file mode 100644 index 206c1e7fc6..0000000000 --- a/src/chemistry/pp_geoschem/mo_lightning.F90 +++ /dev/null @@ -1,182 +0,0 @@ -module mo_lightning - !---------------------------------------------------------------------- - ! ... the lightning module - !---------------------------------------------------------------------- - - use shr_kind_mod, only : r8 => shr_kind_r8 - use ppgrid, only : begchunk, endchunk, pcols, pver - use phys_grid, only : ngcols_p - use cam_abortutils, only : endrun - use cam_logfile, only : iulog - use spmd_utils, only : masterproc, mpicom - - implicit none - - private - public :: lightning_inti - public :: lightning_no_prod - public :: prod_no - - save - - real(r8) :: csrf - real(r8) :: factor = 0.1_r8 ! user-controlled scaling factor to achieve arbitrary no prod. - real(r8) :: geo_factor ! grid cell area factor - real(r8) :: vdist(16,3) ! vertical distribution of lightning - real(r8), allocatable :: prod_no(:,:,:) - real(r8), allocatable :: glob_prod_no_col(:,:) - real(r8), allocatable :: flash_freq(:,:) - integer :: no_ndx,xno_ndx - logical :: has_no_lightning_prod = .false. - -contains - - subroutine lightning_inti( lght_no_prd_factor ) - !---------------------------------------------------------------------- - ! ... initialize the lightning module - !---------------------------------------------------------------------- - use mo_constants, only : pi - use ioFileMod, only : getfil - !use mo_chem_utls, only : get_spc_ndx - - use cam_history, only : addfld, add_default, horiz_only - use dyn_grid, only : get_dyn_grid_parm - use phys_control, only : phys_getopts - - implicit none - - !---------------------------------------------------------------------- - ! ... dummy args - !---------------------------------------------------------------------- - real(r8), intent(in) :: lght_no_prd_factor ! lightning no production factor - - !!---------------------------------------------------------------------- - !! ... local variables - !!---------------------------------------------------------------------- - !integer :: astat - !integer :: ncid - !integer :: dimid - !integer :: vid - !integer :: gndx - !integer :: jl, ju - !integer :: nlat, nlon - !integer :: plon, plat - !real(r8), allocatable :: lats(:) - !real(r8), allocatable :: lons(:) - !real(r8), allocatable :: landmask(:,:) - !character(len=256) :: locfn - !logical :: history_cesm_forcing - - !call phys_getopts( history_cesm_forcing_out = history_cesm_forcing ) - - !no_ndx = get_spc_ndx('NO') - !xno_ndx = get_spc_ndx('XNO') - - !has_no_lightning_prod = no_ndx>0 .or. xno_ndx>0 - !if (.not.has_no_lightning_prod) return - - ! - !if( lght_no_prd_factor /= 1._r8 ) then - ! factor = factor*lght_no_prd_factor - !end if - - - !if (masterproc) write(iulog,*) 'lght_inti: lightning no production scaling factor = ',factor - - !!---------------------------------------------------------------------- - !! ... vdist(kk,itype) = % of lightning nox between (kk-1) and (kk) - !! km for profile itype - !!---------------------------------------------------------------------- - !vdist(:,1) = (/ 3.0_r8, 3.0_r8, 3.0_r8, 3.0_r8, 3.4_r8, 3.5_r8, 3.6_r8, 4.0_r8, & ! midlat cont - ! 5.0_r8, 7.0_r8, 9.0_r8, 14.0_r8, 16.0_r8, 14.0_r8, 8.0_r8, 0.5_r8 /) - !vdist(:,2) = (/ 2.5_r8, 2.5_r8, 2.5_r8, 2.5_r8, 2.5_r8, 2.5_r8, 2.5_r8, 6.1_r8, & ! trop marine - ! 17.0_r8, 15.4_r8, 14.5_r8, 13.0_r8, 12.5_r8, 2.8_r8, 0.9_r8, 0.3_r8 /) - !vdist(:,3) = (/ 2.0_r8, 2.0_r8, 2.0_r8, 1.5_r8, 1.5_r8, 1.5_r8, 3.0_r8, 5.8_r8, & ! trop cont - ! 7.6_r8, 9.6_r8, 11.0_r8, 14.0_r8, 14.0_r8, 14.0_r8, 8.2_r8, 2.3_r8 /) - - !allocate( prod_no(pcols,pver,begchunk:endchunk),stat=astat ) - !if( astat /= 0 ) then - ! write(iulog,*) 'lght_inti: failed to allocate prod_no; error = ',astat - ! call endrun - !end if - !allocate( flash_freq(pcols,begchunk:endchunk),stat=astat ) - !if( astat /= 0 ) then - ! write(iulog,*) 'lght_inti: failed to allocate flash_freq; error = ',astat - ! call endrun - !end if - !allocate( glob_prod_no_col(pcols,begchunk:endchunk),stat=astat ) - !if( astat /= 0 ) then - ! write(iulog,*) 'lght_inti: failed to allocate glob_prod_no_col; error = ',astat - ! call endrun - !end if - !prod_no(:,:,:) = 0._r8 - !flash_freq(:,:) = 0._r8 - !geo_factor = ngcols_p/(4._r8*pi) - - - !call addfld( 'LNO_COL_PROD', horiz_only, 'I', 'TG N/YR', 'lighting column NO source' ) - !call addfld( 'LNO_PROD', (/ 'lev' /), 'I', '/cm3/s', 'lighting insitu NO source' ) - !call addfld( 'FLASHFRQ', horiz_only, 'I', '1/MIN', 'lighting flash rate' ) ! flash frequency in grid box per minute (PPP) - !call addfld( 'FLASHENGY', horiz_only, 'I', ' ', 'lighting flash rate' ) ! flash frequency in grid box per minute (PPP) - !call addfld( 'CLDHGT', horiz_only, 'I', 'KM', 'cloud top height' ) ! cloud top height - !call addfld( 'DCHGZONE', horiz_only, 'I', 'KM', 'depth of discharge zone' ) ! depth of discharge zone - !call addfld( 'CGIC', horiz_only, 'I', 'RATIO', 'ratio of cloud-ground/intracloud discharges' ) ! ratio of cloud-ground/intracloud discharges - - !if ( history_cesm_forcing ) then - ! call add_default('LNO_COL_PROD',1,' ') - !endif - - end subroutine lightning_inti - - subroutine lightning_no_prod( state, pbuf2d, cam_in ) - !---------------------------------------------------------------------- - ! ... set no production from lightning - !---------------------------------------------------------------------- - use physics_types, only : physics_state - - use physics_buffer, only : pbuf_get_index, physics_buffer_desc, pbuf_get_field, pbuf_get_chunk - use physconst, only : rga - use phys_grid, only : get_rlat_all_p, get_lat_all_p, get_lon_all_p, get_wght_all_p - use cam_history, only : outfld - use camsrfexch, only : cam_in_t - use shr_reprosum_mod, only : shr_reprosum_calc - !use mo_constants, only : rearth, d2r - implicit none - - !---------------------------------------------------------------------- - ! ... dummy args - !---------------------------------------------------------------------- - type(physics_state), intent(in) :: state(begchunk:endchunk) ! physics state - - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - type(cam_in_t), intent(in) :: cam_in(begchunk:endchunk) ! physics state - - !---------------------------------------------------------------------- - ! ... local variables - !---------------------------------------------------------------------- - - !---------------------------------------------------------------------- - ! ... parameters to determine cg/ic ratio [price and rind, 1993] - !---------------------------------------------------------------------- - - if (.not.has_no_lightning_prod) return - - ! < === INSERT CALCULATION HERE === > - - !!-------------------------------------------------------------------------------- - !! ... output lightning no production to history file - !!-------------------------------------------------------------------------------- - !do c = begchunk,endchunk - ! lchnk = state(c)%lchnk - ! call outfld( 'LNO_PROD', prod_no(:,:,c), pcols, lchnk ) - ! call outfld( 'LNO_COL_PROD', glob_prod_no_col(:,c), pcols, lchnk ) - ! call outfld( 'FLASHFRQ', flash_freq(:,c), pcols, lchnk ) - ! call outfld( 'FLASHENGY', flash_energy(:,c), pcols, lchnk ) - ! call outfld( 'CLDHGT', cldhgt(:,c), pcols, lchnk ) - ! call outfld( 'DCHGZONE', dchgzone(:,c), pcols, lchnk ) - ! call outfld( 'CGIC', cgic(:,c), pcols, lchnk ) - !enddo - - end subroutine lightning_no_prod - -end module mo_lightning From 6c3299f1a38262c344ca57fd9d7265ebb5ea44a1 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 24 Feb 2021 13:16:28 -0500 Subject: [PATCH 007/160] Feat: Write ZPJ values for RXN_NO2, RXN_O3_1/2a into HCO_IN_JNO2, HCO_IN_JOH for HEMCO ParaNOx extension. Fix: fldname_ns fix to FIELDNAME --- src/chemistry/geoschem/chemistry.F90 | 66 +++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index ec97c95ec1..ad23371913 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -216,6 +216,7 @@ subroutine chem_register INTEGER :: I, N, M, L INTEGER :: nIgnored + INTEGER :: tmpIdx REAL(r8) :: cptmp REAL(r8) :: MWTmp REAL(r8) :: qmin @@ -635,6 +636,11 @@ subroutine chem_register Call Cleanup_State_Grid( SG, RC ) Call Cleanup_Input_Opt ( IO, RC ) + ! Add data for HEMCO extensions to buffers + call pbuf_add_field('HCO_IN_JNO2', 'global', dtype_r8, (/pcols/), tmpIdx) + call pbuf_add_field('HCO_IN_JOH', 'global', dtype_r8, (/pcols/), tmpIdx) + + end subroutine chem_register !=============================================================================== @@ -1873,6 +1879,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use PBL_Mix_Mod, only : Compute_PBL_Height use UCX_Mod, only : Set_H2O_Trac use CMN_FJX_MOD, only : ZPJ + USE FAST_JX_MOD, only : RXN_NO2, RXN_O3_1, RXN_O3_2a use State_Diag_Mod, only : get_TagInfo use Unitconv_Mod, only : Convert_Spc_Units @@ -3119,10 +3126,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Day FIELDNAME = TRIM(PREFIX) // '_DAY' - fldname_ns = FIELDNAME - tmpIdx = pbuf_get_index(fldname_ns, RC) + tmpIdx = pbuf_get_index(FIELDNAME, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) BrPtrDay(N)%MR(1,:nY,nZ:1:-1) = 0.0e+0_f4 ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) @@ -3135,9 +3141,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Night FIELDNAME = TRIM(PREFIX) // '_NIGHT' - tmpIdx = pbuf_get_index(fldname_ns, RC) + tmpIdx = pbuf_get_index(FIELDNAME, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) BrPtrDay(N)%MR(1,:nY,nZ:1:-1) = 0.0e+0_f4 ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) @@ -3178,9 +3184,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating PLVEC%PROD') ! Get pointer from HEMCO - tmpIdx = pbuf_get_index(fldname_ns, RC) + tmpIdx = pbuf_get_index(FIELDNAME, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) PLVEC(N)%PROD(1,:nY,nZ:1:-1) = 0.0e+0_f4 FND = .False. ELSE @@ -3210,9 +3216,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF ! Get pointer from HEMCO - tmpIdx = pbuf_get_index(fldname_ns, RC) + tmpIdx = pbuf_get_index(FIELDNAME, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) PLVEC(N)%LOSS(1,:nY,nZ:1:-1) = 0.0e+0_f4 FND = .False. ELSE @@ -3241,9 +3247,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ALLOCATE( STRAT_OH(1,PCOLS,nZ), STAT=IERR ) IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating STRAT_OH') - tmpIdx = pbuf_get_index(fldname_ns, RC) + tmpIdx = pbuf_get_index(FIELDNAME, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) STRAT_OH(1,:nY,nZ:1:-1) = 0.0e+0_f4 ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) @@ -3730,6 +3736,44 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) CALL ENDRUN('Incorrect unit in GEOS-Chem State_Chm%Species') ENDIF + ! Save and write J-values to pbuf for HEMCO + ! in HCO_IN_JNO2, HCO_IN_JOH + FIELDNAME = 'HCO_IN_JNO2' + tmpIdx = pbuf_get_index(FIELDNAME, RC) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + + ! RXN_NO2: NO2 + hv --> NO + O + pbuf_ik(:nY,:nZ) = ZPJ(nZ:1:-1, RXN_NO2, 1, :nY) + + pbuf_chnk => NULL() + pbuf_ik => NULL() + ENDIF + + + FIELDNAME = 'HCO_IN_JOH' + tmpIdx = pbuf_get_index(FIELDNAME, RC) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + + IF ( Input_Opt%LUCX ) THEN + ! RXN_O3_1: O3 + hv --> O2 + O + pbuf_ik(:nY,:nZ) = ZPJ(nZ:1:-1, RXN_O3_1, 1, :nY) + ELSE + ! RXN_O3_2a: O3 + hv --> 2OH + pbuf_ik(:nY,:nZ) = ZPJ(nZ:1:-1, RXN_O3_2a, 1, :nY) + ENDIF + + pbuf_chnk => NULL() + pbuf_ik => NULL() + ENDIF + ! GEOS-Chem considers CO2 as a dead species and resets its concentration ! internally. Right after the call to `Do_Chemistry`, State_Chm%Species(iCO2) ! corresponds to the chemically-produced CO2. The real CO2 concentration From edf905677eb53ad73986d673f04ee3e7bec6dc1b Mon Sep 17 00:00:00 2001 From: Thibaud Fritz Date: Wed, 24 Feb 2021 15:17:30 -0500 Subject: [PATCH 008/160] Squashed 4 commits from Thibaud Fritz Feat: Uniformize calls to HEMCO Fix: Replace SO4S with SO4s Fix: Fix XML file name Feat: Capitalize all GC constituents name, and other updates: (1) This is required because boundary conditions are stored with capitalized name. I would rather follow the same terminology as MOZART (with capitalized constituents) rather than modify the interface with flbc. (2) Update geoschem.xml to match FC2000climo compset (3) Fix bug where lght_no_prod_factor was not applied in CESM-GC (4) Set ext_frc_specifier to '' for CESM-GC compsets as we rely on HEMCO --- bld/build-namelist | 9 +- bld/namelist_files/use_cases/geoschem.xml | 49 +++---- .../use_cases/hist_geoschem.xml | 10 +- bld/namelist_files/use_cases/sd_geoschem.xml | 10 +- cime_config/config_component.xml | 2 +- src/chemistry/geoschem/chemistry.F90 | 130 ++++++++---------- src/chemistry/geoschem/mo_neu_wetdep.F90 | 14 +- src/chemistry/geoschem/mo_sim_dat.F90 | 46 +++---- 8 files changed, 123 insertions(+), 147 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index c0e4bc0a25..a14d37639e 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -1898,7 +1898,7 @@ my $megan_emis = defined $nl->get_value('megan_specifier'); if ( $megan_emis ) { add_default($nl, 'megan_factors_file'); } # Tropospheric full chemistry options -if (($chem =~ /geoschem/ or $chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) and ($phys !~ /cam6/)) { +if (($chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) and ($phys !~ /cam6/)) { # Surface emission datasets: my %verhash; @@ -2084,7 +2084,8 @@ if ($chem =~ /geoschem/) { my $val; # Species with fixed lower boundary - $val = "'CH4','OCS','N2O','CO2','CFC11','CFC12'"; + $val = "'CCL4','CH4','N2O','CO2','CFC11','CFC12','CH3BR','CH3CCL3','CH3CL'" + .",'HCFC22','CFC114','CFC115','HCFC141B','HCFC142B','CH2BR2','CHBR3','H2402'"; if ($chem_has_ocs) { $val .= ",'OCS'"; @@ -3009,7 +3010,7 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'clubb_history'); add_default($nl, 'clubb_rad_history'); - if ($nl->get_value('clubb_history') =~ "true" && $nl->get_value('atm_nthreads') != 1) { + if ($nl->get_value('clubb_history') =~ "true" && $nl->get_value('atm_nthreads') > 1) { die "$ProgName - ERROR: clubb_history = .true. with multiple threads is not supported. \n"; } @@ -3185,7 +3186,7 @@ if ( length($nl->get_value('soil_erod_file'))>0 ) { add_default($nl, 'dust_emis_fact', 'tms'=>'1'); } else { - if ($chem =~ /trop_strat/ or $chem =~ /waccm_ma/ or $chem =~ /waccm_tsmlt/ or $chem =~ /trop_mozart/) { + if ($chem =~ /trop_strat/ or $chem =~ /geoschem/ or $chem =~ /waccm_ma/ or $chem =~ /waccm_tsmlt/ or $chem =~ /trop_mozart/) { add_default($nl, 'dust_emis_fact', 'ver'=>'chem'); # set scaling of lightning NOx production add_default($nl, 'lght_no_prd_factor' ); diff --git a/bld/namelist_files/use_cases/geoschem.xml b/bld/namelist_files/use_cases/geoschem.xml index ce495dbfb2..39fc45bf7e 100644 --- a/bld/namelist_files/use_cases/geoschem.xml +++ b/bld/namelist_files/use_cases/geoschem.xml @@ -3,58 +3,41 @@ 00010101 -367.0e-6 - /glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ /glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f09_f09.134.1975.009.cam.i.2010-01-01_32L_c170403.nc /glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f19_f19.134.1975.009.cam.i.2010-01-01_32L_c170403.nc ->&gt; Solar constant from Lean (via Caspar Ammann) &lt;/!</! -atm/cam/solar/spectral_irradiance_Lean_1610-2009_ann_c100405.nc + +atm/cam/solar/SolarForcing1995-2005avg_c160929.nc 20000101 FIXED ->&gt; Prescribed BAM data is from Jean-Francois Lamarque &lt;/!</! -atm/cam/chem/trop_mozart_aero/aero -aero_1.9x2.5_L26_1850-2005_c091112.nc -CYCLICAL -2000 - ->&gt; aerosol deposition &lt;/!</! -atm/cam/chem/trop_mozart_aero/aero -aerosoldep_monthly_2000_mean_1.9x2.5_c090421.nc -CYCLICAL -2000 - ->&gt; Prescribed ozone data is from Jean-Francois Lamarque &lt;/!</! - atm/cam/ozone - ozone_1.9x2.5_L26_1850-2005_c090803.nc - O3 - CYCLICAL - 2000 - 'xactive_lnd' ->&gt; sim_year used for CLM datasets &lt;/!</! -2000 + +.true. +.true. +.false. +0.25D0 ->&gt; fixed lower boundary data &lt;/!</! -2000 -atm/waccm/lb/LBC_1765-2500_1.9x2.5_CMIP5_RCP45_za_c120204.nc + CYCLICAL +2000 +atm/waccm/lb/LBC_2000climo_CMIP6_0p5degLat_c180227.nc >&gt; emissions timing &lt;/!</! >&gt; &amp;lt;ext_frc_type&amp;gt;'SERIAL'&amp;lt;/ext_frc_type&amp;gt; &lt;/!</! 'CYCLICAL' + 2000 >&gt; History Files &lt;/!</! - 1, 24 - 0, -1 - 'A', 'A' + 1,30,365,240,240,480,365,73,30 + 0,-24,-24,-3,-1,1,-24,-120,-240 +'A','A','A','A','A','A','A','A','I' 'Q', 'U', 'V', 'OMEGA', 'T', 'PS', @@ -65,7 +48,7 @@ - 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','BrNO3','CH2O','Cl2','ClNO2','ClNO3','ClO','ClOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg0','Hg0_ANT','Hg0_ARC','Hg0_ATL','Hg0_BB','Hg0_CAM','Hg0_CAN','Hg0_EAF','Hg0_EAS','Hg0_EEU','Hg0_EUR','Hg0_GEO','Hg0_JPN','Hg0_MDE','Hg0_NAF','Hg0_NAT','Hg0_NPA','Hg0_OCE','Hg0_OCN','Hg0_SAF','Hg0_SAM','Hg0_SAS','Hg0_SAT','Hg0_SEA','Hg0_SO','Hg0_SOV','Hg0_STR','Hg0_USA','Hg0_WAF','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3Strat','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', @@ -73,7 +56,7 @@ - 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 606e409b36..8d8dce5377 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -27,7 +27,7 @@ INTERP_MISSING_MONTHS - + INTERP_MISSING_MONTHS 'noy', 'nhx' @@ -82,8 +82,8 @@ 'EXTINCTNIRdn', 'EXTINCTUVdn', 'WD_EOH', 'WD_ETP', 'WD_RA3P', 'WD_CH2O', 'WD_ALD2', 'WD_MGLY', 'WD_ACTA', 'WD_MAP', 'WD_MOH', 'WD_MP', - 'WD_GLYC', 'WD_H2O2', 'WD_SO4', 'WD_HBr', 'WD_HCl', - 'WD_HNO3', 'WD_HOBr', 'WD_HOCl', 'WD_HONIT', 'WD_HAC', 'WD_IEPOXA', + 'WD_GLYC', 'WD_H2O2', 'WD_SO4', 'WD_HBR', 'WD_HCL', + 'WD_HNO3', 'WD_HOBR', 'WD_HOCL', 'WD_HONIT', 'WD_HAC', 'WD_IEPOXA', 'WD_IEPOXB', 'WD_IEPOXD', 'WD_MVK', 'WD_NH3', 'WD_NH4', 'WD_SO2', 'DF_EOH', 'DF_ETP', 'DF_RA3P', 'DF_CH2O', 'DF_ALD2', 'DF_ACET', 'DF_MGLY', 'DF_ACTA', 'DF_MAP', 'DF_MOH', 'DF_MP', 'DF_CO', @@ -154,7 +154,7 @@ 'so4_a2_CHMP', 'so4_a3_CHMP', 'H2SO4_sfnnuc1', 'num_a2_sfnnuc1', --> - 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','BrNO3','CH2O','Cl2','ClNO2','ClNO3','ClO','ClOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg0','Hg0_ANT','Hg0_ARC','Hg0_ATL','Hg0_BB','Hg0_CAM','Hg0_CAN','Hg0_EAF','Hg0_EAS','Hg0_EEU','Hg0_EUR','Hg0_GEO','Hg0_JPN','Hg0_MDE','Hg0_NAF','Hg0_NAT','Hg0_NPA','Hg0_OCE','Hg0_OCN','Hg0_SAF','Hg0_SAM','Hg0_SAS','Hg0_SAT','Hg0_SEA','Hg0_SO','Hg0_SOV','Hg0_STR','Hg0_USA','Hg0_WAF','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3Strat','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', @@ -162,7 +162,7 @@ - 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index 40d1799727..02c3508e54 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -39,7 +39,7 @@ INTERP_MISSING_MONTHS - + INTERP_MISSING_MONTHS @@ -92,8 +92,8 @@ 'EXTINCTNIRdn', 'EXTINCTUVdn', 'WD_EOH', 'WD_ETP', 'WD_RA3P', 'WD_CH2O', 'WD_ALD2', 'WD_MGLY', 'WD_ACTA', 'WD_MAP', 'WD_MOH', 'WD_MP', - 'WD_GLYC', 'WD_H2O2', 'WD_SO4', 'WD_HBr', 'WD_HCl', - 'WD_HNO3', 'WD_HOBr', 'WD_HOCl', 'WD_HONIT', 'WD_HAC', 'WD_IEPOXA', + 'WD_GLYC', 'WD_H2O2', 'WD_SO4', 'WD_HBR', 'WD_HCL', + 'WD_HNO3', 'WD_HOBR', 'WD_HOCL', 'WD_HONIT', 'WD_HAC', 'WD_IEPOXA', 'WD_IEPOXB', 'WD_IEPOXD', 'WD_MVK', 'WD_NH3', 'WD_NH4', 'WD_SO2', 'DF_EOH', 'DF_ETP', 'DF_RA3P', 'DF_CH2O', 'DF_ALD2', 'DF_ACET', 'DF_MGLY', 'DF_ACTA', 'DF_MAP', 'DF_MOH', 'DF_MP', 'DF_CO', @@ -159,7 +159,7 @@ - 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','BrNO3','CH2O','Cl2','ClNO2','ClNO3','ClO','ClOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg0','Hg0_ANT','Hg0_ARC','Hg0_ATL','Hg0_BB','Hg0_CAM','Hg0_CAN','Hg0_EAF','Hg0_EAS','Hg0_EEU','Hg0_EUR','Hg0_GEO','Hg0_JPN','Hg0_MDE','Hg0_NAF','Hg0_NAT','Hg0_NPA','Hg0_OCE','Hg0_OCN','Hg0_SAF','Hg0_SAM','Hg0_SAS','Hg0_SAT','Hg0_SEA','Hg0_SO','Hg0_SOV','Hg0_STR','Hg0_USA','Hg0_WAF','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3Strat','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', @@ -167,7 +167,7 @@ - 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','Br2','BrCl','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBr','HC5A','HCl','HCOOH','Hg2','Hg2_ANT','Hg2_ARC','Hg2_ATL','Hg2_BB','Hg2_CAM','Hg2_CAN','Hg2_EAF','Hg2_EAS','Hg2_EEU','Hg2_EUR','Hg2_GEO','Hg2_JPN','Hg2_MDE','Hg2_NAF','Hg2_NAT','Hg2_NPA','Hg2_OCE','Hg2_OCN','Hg2_SAF','Hg2_SAM','Hg2_SAS','Hg2_SAT','Hg2_SEA','Hg2_SO','Hg2_SOV','Hg2_STR','Hg2_USA','Hg2_WAF','HI','HMHP','HMML','HNO3','HOBr','HOCl','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBr','ICHE','ICl','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','Be10','Be10Strat','Be7','Be7Strat','BrSALA','BrSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HgP','HgP_ANT','HgP_ARC','HgP_ATL','HgP_BB','HgP_CAM','HgP_CAN','HgP_EAF','HgP_EAS','HgP_EEU','HgP_EUR','HgP_GEO','HgP_JPN','HgP_MDE','HgP_NAF','HgP_NAT','HgP_NPA','HgP_OCE','HgP_OCN','HgP_SAF','HgP_SAM','HgP_SAS','HgP_SAT','HgP_SEA','HgP_SO','HgP_SOV','HgP_STR','HgP_USA','HgP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITs','OCPI','OCPO','OPOA1','OPOA2','Pb210','Pb210Strat','pFe','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index c700a521ea..2ba9e9a0e7 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -210,7 +210,7 @@ waccm_ma_2000_cam6 waccm_sc_2000_cam6 2000_trop_strat_vbs_cam6 - geoschem_2000 + geoschem aquaplanet_cam4 aquaplanet_cam4 diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index ad23371913..ef153018e7 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -333,7 +333,7 @@ subroutine chem_register DO I = 1, nTracersMax IF ( I .LE. nTracers ) THEN - cnstName = TRIM(tracerNames(I)) + cnstName = to_upper(TRIM(tracerNames(I))) trueName = cnstName N = Ind_(cnstName) ThisSpc => SC%SpcData(N)%Info @@ -2036,7 +2036,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) TYPE(physics_buffer_desc), POINTER :: pbuf_chnk(:) ! slice of pbuf in chnk REAL(r8), POINTER :: pbuf_ik(:,:) ! ptr to pbuf data (/pcols,pver/) INTEGER :: tmpIdx ! pbuf field id - CHARACTER(LEN=255) :: fldname_ns ! field name INTEGER :: TIM_NDX INTEGER :: IERR @@ -2442,11 +2441,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF ELSE DO N = 1, NSURFTYPE - Write(fldname_ns, '(a,i2.2)') 'HCO_LANDTYPE', N-1 - tmpIdx = pbuf_get_index(fldname_ns, rc) - IF ( tmpIdx < 0 ) THEN - ! there is an error here and the field was not found - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + Write(FieldName, '(a,i2.2)') 'HCO_LANDTYPE', N-1 + tmpIdx = pbuf_get_index(FieldName, rc) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) ELSE CALL pbuf_get_field(pbuf, tmpIdx, pbuf_ik) DO J = 1, nY @@ -2457,23 +2455,21 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) pbuf_ik => NULL() ENDIF - Write(fldname_ns, '(a,i2.2)') 'HCO_XLAI', N-1 - tmpIdx = pbuf_get_index(fldname_ns, rc) - IF ( tmpIdx < 0 ) THEN - ! there is an error here and the field was not found - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) - - ELSE - CALL pbuf_get_field(pbuf, tmpIdx, pbuf_ik) - DO J = 1, nY - State_Met(LCHNK)%XLAI_NATIVE(1,J,N) = pbuf_ik(J,nZ) - ! 2-D data is stored in the 1st level of a - ! 3-D array due to laziness - ENDDO - pbuf_ik => NULL() - ENDIF - ENDDO -#endif + Write(FieldName, '(a,i2.2)') 'HCO_XLAI', N-1 + tmpIdx = pbuf_get_index(FieldName, rc) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) + ELSE + CALL pbuf_get_field(pbuf, tmpIdx, pbuf_ik) + DO J = 1, nY + State_Met(LCHNK)%XLAI_NATIVE(1,J,N) = pbuf_ik(J,nZ) + ! 2-D data is stored in the 1st level of a + ! 3-D array due to laziness + ENDDO + pbuf_ik => NULL() + ENDIF + ENDDO + ENDIF ! Field : FRCLND, FRLAND, FROCEAN, FRSEAICE, FRLAKE, FRLANDIC ! Description: Olson land fraction @@ -2601,10 +2597,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF ( Input_Opt%onlineAlbedo ) THEN State_Met(LCHNK)%UVALBEDO(1,:nY) = cam_in%asdir(:nY) ELSE - fldname_ns = 'HCO_UV_ALBEDO' - tmpIdx = pbuf_get_index(fldname_ns, RC) + FieldName = 'HCO_UV_ALBEDO' + tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) State_Met(LCHNK)%UVALBEDO(1,:nY) = 0.0e+0_fp ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) @@ -2644,11 +2640,11 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Description: Surface iodide concentration ! Unit : nM ! Dimensions : nX, nY - fldname_ns = 'HCO_iodide' - tmpIdx = pbuf_get_index(fldname_ns, RC) + FieldName = 'HCO_iodide' + tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) - State_Chm(LCHNK)%IODIDE(1,:nY) = 0.0e+0_fp + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) + State_Chm(LCHNK)%IODIDE(1,:nY) = 0.0e+0_fp ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) @@ -2662,10 +2658,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Unit : PSU ! Dimensions : nX, nY ! Note : Possibly get ocean salinity from POP? - fldname_ns = 'HCO_salinity' - tmpIdx = pbuf_get_index(fldname_ns, RC) + FieldName = 'HCO_salinity' + tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) State_Chm(LCHNK)%SALINITY(1,:nY) = 0.0e+0_fp ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) @@ -2680,18 +2676,18 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Unit : - ! Dimensions : nX, nY IF ( currMo == 12 .or. currMo == 1 .or. currMo == 2 ) THEN - fldname_ns = 'HCO_OMOC_DJF' + FieldName = 'HCO_OMOC_DJF' ELSE IF ( currMo == 3 .or. currMo == 4 .or. currMo == 5 ) THEN - fldname_ns = 'HCO_OMOC_MAM' + FieldName = 'HCO_OMOC_MAM' ELSE IF ( currMo == 6 .or. currMo == 7 .or. currMo == 8 ) THEN - fldname_ns = 'HCO_OMOC_JJA' + FieldName = 'HCO_OMOC_JJA' ELSE IF ( currMo == 9 .or. currMo == 10 .or. currMo == 11 ) THEN - fldname_ns = 'HCO_OMOC_SON' + FieldName = 'HCO_OMOC_SON' ENDIF - tmpIdx = pbuf_get_index(fldname_ns, rc) - IF ( tmpIdx < 0 ) THEN + tmpIdx = pbuf_get_index(FieldName, rc) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN ! there is an error here and the field was not found - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(fldname_ns) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) ELSE CALL pbuf_get_field(pbuf, tmpIdx, pbuf_ik) DO J = 1, nY @@ -3125,10 +3121,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Get pointer to this field. These are the mixing ratios (pptv). ! Day - FIELDNAME = TRIM(PREFIX) // '_DAY' - tmpIdx = pbuf_get_index(FIELDNAME, RC) + FieldName = TRIM(PREFIX) // '_DAY' + tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) BrPtrDay(N)%MR(1,:nY,nZ:1:-1) = 0.0e+0_f4 ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) @@ -3137,13 +3133,12 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) pbuf_chnk => NULL() pbuf_ik => NULL() ENDIF - !CALL HCO_GetPtr( HcoState, FIELDNAME, BrPtrDay(N)%MR, RC ) ! Night - FIELDNAME = TRIM(PREFIX) // '_NIGHT' - tmpIdx = pbuf_get_index(FIELDNAME, RC) + FieldName = TRIM(PREFIX) // '_NIGHT' + tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) BrPtrDay(N)%MR(1,:nY,nZ:1:-1) = 0.0e+0_f4 ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) @@ -3152,7 +3147,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) pbuf_chnk => NULL() pbuf_ik => NULL() ENDIF - !CALL HCO_GetPtr( HcoState, FIELDNAME, BrPtrNight(N)%MR, RC ) ENDDO @@ -3173,9 +3167,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Production rates [v/v/s] IF ( Input_Opt%LUCX ) THEN - FIELDNAME = 'GMI_PROD_'//TRIM(SpcName) + FieldName = 'GMI_PROD_'//TRIM(SpcName) ELSE - FIELDNAME = 'UCX_PROD_'//TRIM(SpcName) + FieldName = 'UCX_PROD_'//TRIM(SpcName) ENDIF ALLOCATE( PLVEC(N)%PROD(1,PCOLS,nZ), STAT=IERR ) @@ -3184,9 +3178,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating PLVEC%PROD') ! Get pointer from HEMCO - tmpIdx = pbuf_get_index(FIELDNAME, RC) + tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) PLVEC(N)%PROD(1,:nY,nZ:1:-1) = 0.0e+0_f4 FND = .False. ELSE @@ -3197,28 +3191,27 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) pbuf_chnk => NULL() pbuf_ik => NULL() ENDIF - !CALL HCO_GetPtr( HcoState, FIELDNAME, PLVEC(N)%PROD, RC, FOUND=FND ) ! Warning message IF ( .NOT. FND .AND. Input_Opt%amIRoot ) THEN ErrMsg = 'Cannot find archived production rates for ' // & TRIM(SpcName) // ' - will use value of 0.0. ' // & 'To use archived rates, add the following field ' // & - 'to the HEMCO configuration file: '// TRIM( FIELDNAME ) + 'to the HEMCO configuration file: '// TRIM( FieldName ) CALL GC_Warning( ErrMsg, RC, ThisLoc ) ENDIF ! Loss frequency [s-1] IF ( Input_Opt%LUCX ) THEN - FIELDNAME = 'GMI_LOSS_'//TRIM(SpcName) + FieldName = 'GMI_LOSS_'//TRIM(SpcName) ELSE - FIELDNAME = 'UCX_LOSS_'//TRIM(SpcName) + FieldName = 'UCX_LOSS_'//TRIM(SpcName) ENDIF ! Get pointer from HEMCO - tmpIdx = pbuf_get_index(FIELDNAME, RC) + tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) PLVEC(N)%LOSS(1,:nY,nZ:1:-1) = 0.0e+0_f4 FND = .False. ELSE @@ -3229,14 +3222,13 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) pbuf_chnk => NULL() pbuf_ik => NULL() ENDIF - !CALL HCO_GetPtr( HcoState, FIELDNAME, PLVEC(N)%LOSS, RC, FOUND=FND ) ! Warning message IF ( .NOT. FND .AND. Input_Opt%amIRoot ) THEN ErrMsg= 'Cannot find archived loss frequencies for ' // & TRIM(SpcName) // ' - will use value of 0.0. ' // & 'To use archived rates, add the following field ' // & - 'to the HEMCO configuration file: '//TRIM(FIELDNAME) + 'to the HEMCO configuration file: '//TRIM(FieldName) CALL GC_Warning( ErrMsg, RC, ThisLoc ) ENDIF @@ -3247,9 +3239,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ALLOCATE( STRAT_OH(1,PCOLS,nZ), STAT=IERR ) IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating STRAT_OH') - tmpIdx = pbuf_get_index(FIELDNAME, RC) + tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) STRAT_OH(1,:nY,nZ:1:-1) = 0.0e+0_f4 ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) @@ -3738,10 +3730,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Save and write J-values to pbuf for HEMCO ! in HCO_IN_JNO2, HCO_IN_JOH - FIELDNAME = 'HCO_IN_JNO2' - tmpIdx = pbuf_get_index(FIELDNAME, RC) + FieldName = 'HCO_IN_JNO2' + tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) @@ -3754,10 +3746,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF - FIELDNAME = 'HCO_IN_JOH' - tmpIdx = pbuf_get_index(FIELDNAME, RC) + FieldName = 'HCO_IN_JOH' + tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FIELDNAME) + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) diff --git a/src/chemistry/geoschem/mo_neu_wetdep.F90 b/src/chemistry/geoschem/mo_neu_wetdep.F90 index c48af5cc0c..d31ab9d7f4 100644 --- a/src/chemistry/geoschem/mo_neu_wetdep.F90 +++ b/src/chemistry/geoschem/mo_neu_wetdep.F90 @@ -132,22 +132,22 @@ subroutine neu_wetdep_init test_name = 'GC_CH2O' case( 'NO2' ) test_name = 'GC_NO2' - case( 'HNO3' ) - test_name = 'GC_HNO3' + !case( 'HNO3' ) + ! test_name = 'GC_HNO3' case( 'NH3' ) test_name = 'GC_NH3' case( 'N2O5' ) test_name = 'GC_N2O5' case( 'PAN' ) test_name = 'GC_PAN' - case( 'SO2' ) - test_name = 'GC_SO2' + !case( 'SO2' ) + ! test_name = 'GC_SO2' ! Now list all non-MAM GEOS-Chem aerosols. These will be scavenged similarly ! to HNO3 - case( 'AERI', 'BrSALA', 'BrSALC', 'DMS', 'INDIOL', & + case( 'AERI', 'BRSALA', 'BRSALC', 'INDIOL', & 'IONITA', 'ISALA', 'ISALC', 'LVOCOA', 'MONITA', & - 'MSA', 'NH4', 'NIT', 'NITs', 'pFe', & - 'SALAAL', 'SALACL', 'SALCAL', 'SALCCL', 'SO4s', & + 'MSA', 'NH4', 'NIT', 'NITS', 'PFE', & + 'SALAAL', 'SALACL', 'SALCAL', 'SALCCL', 'SO4S', & 'SOAGX', 'SOAIE' ) test_name = 'HNO3' end select diff --git a/src/chemistry/geoschem/mo_sim_dat.F90 b/src/chemistry/geoschem/mo_sim_dat.F90 index 44997c160e..442e2fc4a0 100644 --- a/src/chemistry/geoschem/mo_sim_dat.F90 +++ b/src/chemistry/geoschem/mo_sim_dat.F90 @@ -43,18 +43,18 @@ subroutine set_sim_dat solsym(:318) = (/ 'ACET ','ACTA ','AERI ', & 'ALD2 ','ALK4 ','ATOOH ', & 'BCPI ','BCPO ','BENZ ', & - 'Br ','Br2 ','BrCl ', & - 'BrNO2 ','BrNO3 ','BrO ', & - 'BrSALA ','BrSALC ','C2H6 ', & - 'C3H8 ','CCl4 ','CFC11 ', & + 'BR ','BR2 ','BRCL ', & + 'BRNO2 ','BRNO3 ','BRO ', & + 'BRSALA ','BRSALC ','C2H6 ', & + 'C3H8 ','CCL4 ','CFC11 ', & 'CFC113 ','CFC114 ','CFC115 ', & - 'CFC12 ','CH2Br2 ','CH2Cl2 ', & - 'CH2I2 ','CH2IBr ','CH2ICl ', & - 'CH2O ','CH3Br ','CH3CCl3 ', & - 'CH3Cl ','CH3I ','CH4 ', & - 'CHBr3 ','CHCl3 ','Cl ', & - 'Cl2 ','Cl2O2 ','ClNO2 ', & - 'ClNO3 ','ClO ','ClOO ', & + 'CFC12 ','CH2BR2 ','CH2CL2 ', & + 'CH2I2 ','CH2IBR ','CH2ICL ', & + 'CH2O ','CH3BR ','CH3CCL3 ', & + 'CH3CL ','CH3I ','CH4 ', & + 'CHBR3 ','CHCL3 ','CL ', & + 'CL2 ','CL2O2 ','CLNO2 ', & + 'CLNO3 ','CLO ','CLOO ', & 'CLOCK ', & 'CO ','DMS ','DST1 ', & 'DST2 ','DST3 ','DST4 ', & @@ -62,17 +62,17 @@ subroutine set_sim_dat 'ETP ','GLYC ','GLYX ', & 'H1211 ','H1301 ','H2402 ', & 'H2O ','H2O2 ','HAC ', & - 'HBr ','HC5A ','HCFC123 ', & - 'HCFC141b ','HCFC142b ','HCFC22 ', & - 'HCl ','HCOOH ','HI ', & + 'HBR ','HC5A ','HCFC123 ', & + 'HCFC141B ','HCFC142B ','HCFC22 ', & + 'HCL ','HCOOH ','HI ', & 'HMHP ','HMML ','HNO2 ', & - 'HNO3 ','HNO4 ','HOBr ', & - 'HOCl ','HOI ','HONIT ', & + 'HNO3 ','HNO4 ','HOBR ', & + 'HOCL ','HOI ','HONIT ', & 'HPALD1 ','HPALD2 ','HPALD3 ', & 'HPALD4 ','HPETHNL ','I ', & 'I2 ','I2O2 ','I2O3 ', & - 'I2O4 ','IBr ','ICHE ', & - 'ICl ','ICN ','ICPDH ', & + 'I2O4 ','IBR ','ICHE ', & + 'ICL ','ICN ','ICPDH ', & 'IDC ','IDCHP ','IDHDP ', & 'IDHPE ','IDN ','IEPOXA ', & 'IEPOXB ','IEPOXD ','IHN1 ', & @@ -93,11 +93,11 @@ subroutine set_sim_dat 'MVKDH ','MVKHC ','MVKHCB ', & 'MVKHP ','MVKN ','MVKPC ', & 'N2O ','N2O5 ','NH3 ', & - 'NH4 ','NIT ','NITs ', & + 'NH4 ','NIT ','NITS ', & 'NO ','NO2 ','NO3 ', & - 'NPRNO3 ','O3 ','OClO ', & + 'NPRNO3 ','O3 ','OCLO ', & 'OCPI ','OCPO ','OCS ', & - 'OIO ','PAN ','pFe ', & + 'OIO ','PAN ','PFE ', & 'PIP ','PP ','PPN ', & 'PROPNN ','PRPE ','PRPN ', & 'PYAC ','R4N2 ','R4P ', & @@ -106,7 +106,7 @@ subroutine set_sim_dat 'RIPD ','RP ','SALA ', & 'SALAAL ','SALACL ','SALC ', & 'SALCAL ','SALCCL ','SO2 ', & - 'SO4 ','SO4s ','SOAGX ', & + 'SO4 ','SO4S ','SOAGX ', & 'SOAIE ','SOAP ','SOAS ', & 'TOLU ','XYLE ','bc_a1 ', & 'bc_a4 ','dst_a1 ','dst_a2 ', & @@ -124,7 +124,7 @@ subroutine set_sim_dat 'LISOPNO3 ','LTRO2H ','LTRO2N ', & 'LXRO2H ','LXRO2N ','SO4H1 ', & 'SO4H2 ','SO4H3 ','SO4H4 ', & - 'POx ','LOx ','PCO ', & + 'POX ','LOX ','PCO ', & 'LCO ','PSO4 ','LCH4 ', & 'PH2O2 ','BRO2 ','TRO2 ', & 'N ','XRO2 ','HPALD2OO ', & From 7afe235661871151e7713464a739ac2340c6849a Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 28 Feb 2021 22:51:12 -0500 Subject: [PATCH 009/160] Feat: Now retrieve fields from HEMCO using 2-D pbuf fields --- src/chemistry/geoschem/chemistry.F90 | 39 ++++++++++++---------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index ef153018e7..d01db107cd 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -2035,6 +2035,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) TYPE(physics_buffer_desc), POINTER :: pbuf_chnk(:) ! slice of pbuf in chnk REAL(r8), POINTER :: pbuf_ik(:,:) ! ptr to pbuf data (/pcols,pver/) + REAL(r8), POINTER :: pbuf_i(:) ! ptr to pbuf data (/pcols/) horizontal only (horiz_only) INTEGER :: tmpIdx ! pbuf field id INTEGER :: TIM_NDX @@ -2446,11 +2447,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) ELSE - CALL pbuf_get_field(pbuf, tmpIdx, pbuf_ik) + CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) DO J = 1, nY - State_Met(LCHNK)%LandTypeFrac(1,J,N) = pbuf_ik(J,nZ) - ! 2-D data is stored in the 1st level of a - ! 3-D array due to laziness + State_Met(LCHNK)%LandTypeFrac(1,J,N) = pbuf_i(J) ENDDO pbuf_ik => NULL() ENDIF @@ -2460,11 +2459,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) ELSE - CALL pbuf_get_field(pbuf, tmpIdx, pbuf_ik) + CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) DO J = 1, nY - State_Met(LCHNK)%XLAI_NATIVE(1,J,N) = pbuf_ik(J,nZ) - ! 2-D data is stored in the 1st level of a - ! 3-D array due to laziness + State_Met(LCHNK)%XLAI_NATIVE(1,J,N) = pbuf_i(J) ENDDO pbuf_ik => NULL() ENDIF @@ -2604,10 +2601,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) State_Met(LCHNK)%UVALBEDO(1,:nY) = 0.0e+0_fp ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) - CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) - State_Met(LCHNK)%UVALBEDO(1,:nY) = pbuf_ik(:nY,nZ) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) + State_Met(LCHNK)%UVALBEDO(1,:nY) = pbuf_i(:nY) pbuf_chnk => NULL() - pbuf_ik => NULL() + pbuf_i => NULL() ENDIF ENDIF @@ -2647,10 +2644,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) State_Chm(LCHNK)%IODIDE(1,:nY) = 0.0e+0_fp ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) - CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) - State_Chm(LCHNK)%IODIDE(1,:nY) = pbuf_ik(:nY,nZ) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) + State_Chm(LCHNK)%IODIDE(1,:nY) = pbuf_i(:nY) pbuf_chnk => NULL() - pbuf_ik => NULL() + pbuf_i => NULL() ENDIF ! Field : SALINITY @@ -2665,10 +2662,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) State_Chm(LCHNK)%SALINITY(1,:nY) = 0.0e+0_fp ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) - CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) - State_Chm(LCHNK)%SALINITY(1,:nY) = pbuf_ik(:nY,nZ) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) + State_Chm(LCHNK)%SALINITY(1,:nY) = pbuf_i(:nY) pbuf_chnk => NULL() - pbuf_ik => NULL() + pbuf_i => NULL() ENDIF ! Field : OMOC @@ -2689,13 +2686,11 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! there is an error here and the field was not found IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) ELSE - CALL pbuf_get_field(pbuf, tmpIdx, pbuf_ik) + CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) DO J = 1, nY - State_Chm(LCHNK)%OMOC(1,J) = pbuf_ik(J,nZ) - ! 2-D data is stored in the 1st level of a - ! 3-D array due to laziness + State_Chm(LCHNK)%OMOC(1,J) = pbuf_i(J) ENDDO - pbuf_ik => NULL() + pbuf_i => NULL() ENDIF ! Three-dimensional fields on level edges From de05dff245a7805ef7167839c963d0037b41a58e Mon Sep 17 00:00:00 2001 From: Thibaud Fritz Date: Tue, 2 Mar 2021 17:09:19 -0500 Subject: [PATCH 010/160] Squashed 10 commits from Thibaud Fritz Fix: Pass surface J-Rates to HEMCO for PARANOX Fix: Update MMR_Beg for MAM aerosols: (1) This fix avoids a slow, but steady build up of some MAM aerosols Fix: Make sure GEOS-Chem (aerosol phase) MSA is not picked up by MAM Feat: Diagnose constituents as mol/mol apart from MAM aerosols Feat: Update namelist_defaults s.t. geoschem mimics trop_strat_mam4vbs Feat: Update geoschem.xml to mimic history_* XML variables Feat: Add history_* options to save out fields in cesmgc_diag_mod Feat: Don't make solsym fixed size, but rather of size gas_pcnst Feat: Change nadv_chem from 240 to 238 Feat: Add more history_* options to save out fields (mimic CAM-Chem) Signed-off-by: Thibaud Fritz --- bld/configure | 3 +- bld/namelist_files/namelist_defaults_cam.xml | 6 + bld/namelist_files/use_cases/geoschem.xml | 10 + src/chemistry/geoschem/cesmgc_diag_mod.F90 | 231 +++++++++++++++--- .../geoschem/cesmgc_emissions_mod.F90 | 28 ++- src/chemistry/geoschem/chem_mods.F90 | 12 +- src/chemistry/geoschem/chemistry.F90 | 42 ++-- src/chemistry/geoschem/mo_neu_wetdep.F90 | 15 +- src/chemistry/geoschem/mo_tracname.F90 | 7 +- .../modal_aero/modal_aero_gasaerexch.F90 | 8 +- 10 files changed, 278 insertions(+), 84 deletions(-) diff --git a/bld/configure b/bld/configure index 56673cb754..f026dcd844 100755 --- a/bld/configure +++ b/bld/configure @@ -1441,8 +1441,7 @@ if ($chem_pkg =~ '_mam3') { # TMMF - wedge in GEOS-Chem CPP definitions here if ($chem_pkg =~ 'geoschem') { $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING -DLINUX_IFORT -DUSE_REAL8 -DMODEL_ -DMODEL_CESM'; - # TMMF - Temporary fix - $chem_nadv = 250; + $chem_nadv = 238; if (defined $opts{'clm_vers'}) { if ($opts{'clm_vers'} =~ 'CLM4.0') { $chem_cppdefs .= ' -DCLM40' diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index aa77beaba3..b006ed26d1 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -541,6 +541,7 @@ 0.4D0 0.55D0 0.5D0 +0.5D0 0.5D0 0.5D0 0.0625D0 @@ -553,22 +554,27 @@ atm/waccm/gw/mfspectra_shallow_c140530.nc 0.25d0 0.5d0 +0.5d0 0.5d0 0.5d0 1.d0 2.d0 +2.d0 2.d0 2.d0 .true. .false. +.false. .false. .false. .false. .true. +.true. .true. .true. .true. .false. +.false. .false. .false. diff --git a/bld/namelist_files/use_cases/geoschem.xml b/bld/namelist_files/use_cases/geoschem.xml index 39fc45bf7e..ecdb9aaa06 100644 --- a/bld/namelist_files/use_cases/geoschem.xml +++ b/bld/namelist_files/use_cases/geoschem.xml @@ -39,6 +39,16 @@ 0,-24,-24,-3,-1,1,-24,-120,-240 'A','A','A','A','A','A','A','A','I' +.true. +.false. +.false. +.false. +.false. +.false. +.false. +.false. +.false. + 'Q', 'U', 'V', 'OMEGA', 'T', 'PS', diff --git a/src/chemistry/geoschem/cesmgc_diag_mod.F90 b/src/chemistry/geoschem/cesmgc_diag_mod.F90 index 7c3180ddd6..f27dfa7e53 100644 --- a/src/chemistry/geoschem/cesmgc_diag_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_diag_mod.F90 @@ -45,11 +45,12 @@ MODULE CESMGC_Diag_Mod CHARACTER(LEN=fieldname_len) :: wetdep_name(gas_pcnst) ! Wet deposition tendencies CHARACTER(LEN=fieldname_len) :: wtrate_name(gas_pcnst) ! Column tendencies for wet dep CHARACTER(LEN=fieldname_len) :: dtchem_name(gas_pcnst) ! Chemical tendencies - CHARACTER(LEN=16) :: sflxnam_loc(pcnst) ! Names of surface fluxes + + INTEGER :: aer_species(gas_pcnst) ! Chemical families INTEGER :: NOx_species(3) - INTEGER :: NOy_species(63) + INTEGER :: NOy_species(62) INTEGER :: HOx_species(4) INTEGER :: ClOx_species(6) INTEGER :: ClOy_species(11) @@ -61,7 +62,7 @@ MODULE CESMGC_Diag_Mod INTEGER :: NHx_species(2) INTEGER :: TOTH_species(3) REAL(r8) :: NOx_MWs(3) - REAL(r8) :: NOy_MWs(64) + REAL(r8) :: NOy_MWs(62) REAL(r8) :: HOx_MWs(4) REAL(r8) :: ClOx_MWs(6) REAL(r8) :: ClOy_MWs(11) @@ -90,7 +91,7 @@ MODULE CESMGC_Diag_Mod i_MACRNO2, i_MCRHN, i_MCRHNB, i_MENO3, i_MONITS, i_MONITU, & i_MPAN, i_MPN, i_MVKN, i_N2O5, i_NO3, i_NPRNO3, i_OLND, & i_OLNN, i_PAN, i_PPN, i_PRN1, i_PROPNN, i_PRPN, i_R4N1, & - i_R4N2, i_HONIT, i_IONITA, i_NIT, i_NITs, i_NH4 + i_R4N2, i_HONIT, i_IONITA, i_NIT, i_NITs ! HOx INTEGER :: i_H, i_OH, i_HO2, i_H2O2 ! ClOx @@ -112,9 +113,18 @@ MODULE CESMGC_Diag_Mod ! SOx INTEGER :: i_SO2, i_SO4 ! NHx - INTEGER :: i_NH3 !NH4 already defined in NOy_species + INTEGER :: i_NH3, i_NH4 ! TOTH INTEGER :: i_CH4, i_H2O, i_H2 + + + ! Index in solsym + integer :: id_no,id_no3 + integer :: id_cfc11,id_cfc12 + integer :: id_ch4,id_h2o + integer :: id_o,id_o2,id_h,id_n2o + integer :: id_co2,id_o3,id_oh,id_ho2,id_so4_a1,id_so4_a2,id_so4_a3 + integer :: id_num_a2,id_num_a3,id_dst_a3,id_ncl_a3 ! ! !REVISION HISTORY: ! 28 Oct 2020 - T. M. Fritz - Initial version @@ -150,7 +160,9 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) USE CONSTITUENTS, ONLY : cnst_name, sflxnam USE CONSTITUENTS, ONLY : cnst_get_ind USE CAM_HISTORY, ONLY : addfld, add_default, horiz_only + USE PHYS_CONTROL, ONLY : phys_getopts USE DRYDEP_MOD, ONLY : depName + USE MO_CHEM_UTLS, ONLY : get_spc_ndx ! ! !INPUT PARAMETERS: ! @@ -165,12 +177,35 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) !BOC ! ! Integer - INTEGER :: M, N, SM + INTEGER :: M, N, K, SM INTEGER :: idx INTEGER :: RC + INTEGER :: bulkaero_species(20) + INTEGER :: id_so4, id_nh4no3 + INTEGER :: id_dst01, id_dst02, id_dst03, id_dst04 + INTEGER :: id_sslt01, id_sslt02, id_sslt03, id_sslt04 + INTEGER :: id_soa, id_oc1, id_oc2, id_cb1, id_cb2 + INTEGER :: id_soam,id_soai,id_soat,id_soab,id_soax + INTEGER :: id_bry, id_cly + INTEGER :: history_budget_histfile_num ! output history file number + ! for budget fields ! Logical LOGICAL :: Found + LOGICAL :: history_aerosol ! Output the MAM aerosol + ! tendencies + LOGICAL :: history_chemistry + LOGICAL :: history_cesm_forcing + LOGICAL :: history_scwaccm_forcing + LOGICAL :: history_chemspecies_srf ! Output the chemistry + ! constituents species + ! in the surface layer + LOGICAL :: history_dust + LOGICAL :: history_budget ! output tendencies and state + ! variables for CAM + ! temperature, water vapor, + ! cloud ice and cloud + ! liquid budgets. ! Strings CHARACTER(LEN=255) :: SpcName @@ -196,6 +231,79 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) ! Assume a successful return until otherwise RC = GC_SUCCESS + CALL phys_getopts( history_aerosol_out = history_aerosol, & + history_chemistry_out = history_chemistry, & + history_chemspecies_srf_out = history_chemspecies_srf, & + history_budget_out = history_budget , & + history_budget_histfile_num_out = history_budget_histfile_num, & + history_cesm_forcing_out = history_cesm_forcing, & + history_scwaccm_forcing_out = history_scwaccm_forcing, & + history_dust_out = history_dust ) + + id_no3 = get_spc_ndx( 'NO3' ) + id_o3 = get_spc_ndx( 'O3' ) + id_oh = get_spc_ndx( 'OH' ) + id_ho2 = get_spc_ndx( 'HO2' ) + id_so4_a1 = get_spc_ndx( 'so4_a1' ) + id_so4_a2 = get_spc_ndx( 'so4_a2' ) + id_so4_a3 = get_spc_ndx( 'so4_a3' ) + id_num_a2 = get_spc_ndx( 'num_a2' ) + id_num_a3 = get_spc_ndx( 'num_a3' ) + id_dst_a3 = get_spc_ndx( 'dst_a3' ) + id_ncl_a3 = get_spc_ndx( 'ncl_a3' ) + id_co2 = get_spc_ndx( 'CO2' ) + id_no = get_spc_ndx( 'NO' ) + id_h = get_spc_ndx( 'H' ) + id_o = get_spc_ndx( 'O' ) + id_o2 = get_spc_ndx( 'O2' ) + id_ch4 = get_spc_ndx( 'CH4' ) + id_h2o = get_spc_ndx( 'H2O' ) + id_n2o = get_spc_ndx( 'N2O' ) + id_cfc11 = get_spc_ndx( 'CFC11' ) + id_cfc12 = get_spc_ndx( 'CFC12' ) + + id_bry = get_spc_ndx( 'BRY' ) + id_cly = get_spc_ndx( 'CLY' ) + + id_dst01 = get_spc_ndx( 'DST01' ) + id_dst02 = get_spc_ndx( 'DST02' ) + id_dst03 = get_spc_ndx( 'DST03' ) + id_dst04 = get_spc_ndx( 'DST04' ) + id_sslt01 = get_spc_ndx( 'SSLT01' ) + id_sslt02 = get_spc_ndx( 'SSLT02' ) + id_sslt03 = get_spc_ndx( 'SSLT03' ) + id_sslt04 = get_spc_ndx( 'SSLT04' ) + id_soa = get_spc_ndx( 'SOA' ) + id_so4 = get_spc_ndx( 'SO4' ); id_so4 = -1 ! Don't pick up GEOS-Chem's SO4! + id_oc1 = get_spc_ndx( 'OC1' ) + id_oc2 = get_spc_ndx( 'OC2' ) + id_cb1 = get_spc_ndx( 'CB1' ) + id_cb2 = get_spc_ndx( 'CB2' ) + id_nh4no3 = get_spc_ndx( 'NH4NO3' ) + id_soam = get_spc_ndx( 'SOAM' ) + id_soai = get_spc_ndx( 'SOAI' ) + id_soat = get_spc_ndx( 'SOAT' ) + id_soab = get_spc_ndx( 'SOAB' ) + id_soax = get_spc_ndx( 'SOAX' ) + + bulkaero_species(:) = -1 + bulkaero_species(1:20) = (/ id_dst01, id_dst02, id_dst03, id_dst04, & + id_sslt01, id_sslt02, id_sslt03, id_sslt04, & + id_soa, id_so4, id_oc1, id_oc2, id_cb1, id_cb2, id_nh4no3, & + id_soam,id_soai,id_soat,id_soab,id_soax /) + aer_species(:) = -1 + n = 1 + do m = 1,gas_pcnst + k=0 + if ( any(bulkaero_species(:)==m) ) k=1 + if ( k==0 ) k = index(trim(solsym(m)), '_a') + if ( k==0 ) k = index(trim(solsym(m)), '_c') + if ( k>0 ) then ! must be aerosol species + aer_species(n) = m + n = n+1 + endif + enddo + CALL Addfld( 'MASS', (/ 'lev' /), 'A', 'kg', 'Mass of grid box' ) CALL Addfld( 'AREA', horiz_only, 'A', 'm2', 'Area of grid box' ) CALL Addfld( 'HEIGHT', (/ 'ilev' /),'A','m', 'Geopotential height above surface at interfaces' ) @@ -203,17 +311,7 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) ! Note that constituents are already output by default ! Add all species as output fields if desired DO N = 1, gas_pcnst - M = map2chm(N) - IF ( M > 0 ) THEN - ! It's a GEOS-Chem species - SpcName = to_upper(TRIM(solsym(N))) - CALL AddFld( TRIM(SpcName), (/ 'lev' /), 'A', 'mol/mol', & - TRIM(SpcName)//' volume mixing ratio') - CALL AddFld( TRIM(SpcName)//'_SRF', horiz_only, 'A', 'mol/mol', & - TRIM(SpcName)//' in bottom layer') - IF (TRIM(SpcName) == 'O3') CALL Add_Default( TRIM(SpcName), 2, ' ' ) - ELSE - ! MAM aerosols + IF ( ANY( aer_species == N ) ) THEN SpcName = TRIM(solsym(N)) unit_basename = 'kg' IF ( SpcName(1:3) == 'num' ) unit_basename = ' 1' @@ -221,6 +319,56 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) TRIM(SpcName)//' concentration' ) CALL AddFld( TRIM(SpcName)//'_SRF', horiz_only, 'A', unit_basename//'/kg', & TRIM(SpcName)//' in bottom layer' ) + ELSE + M = map2chm(N) + SpcName = TRIM(solsym(N)) + CALL AddFld( TRIM(SpcName), (/ 'lev' /), 'A', 'mol/mol', & + TRIM(SpcName)//' volume mixing ratio') + CALL AddFld( TRIM(SpcName)//'_SRF', horiz_only, 'A', 'mol/mol', & + TRIM(SpcName)//' in bottom layer') + ENDIF + IF ( ( N /= id_cly ) .AND. ( N /= id_bry ) ) THEN + IF ( history_aerosol .OR. history_chemistry ) THEN + CALL Add_Default( TRIM(SpcName), 1, ' ' ) + ENDIF + IF ( history_chemspecies_srf ) THEN + CALL Add_Default( TRIM(SpcName)//'_SRF', 1, ' ' ) + ENDIF + ENDIF + + IF ( history_cesm_forcing ) THEN + IF ( N == id_o3 ) CALL Add_Default( TRIM(SpcName), 1, ' ') + IF ( N == id_oh ) CALL Add_Default( TRIM(SpcName), 1, ' ') + IF ( N == id_no3 ) CALL Add_Default( TRIM(SpcName), 1, ' ') + IF ( N == id_ho2 ) CALL Add_Default( TRIM(SpcName), 1, ' ') + + IF ( N == id_o3 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_so4_a1 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_so4_a2 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_so4_a3 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + + IF ( N == id_num_a2 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_num_a3 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_dst_a3 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_ncl_a3 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + + ENDIF + IF ( history_scwaccm_forcing ) THEN + IF ( N == id_co2 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_h ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_no ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_o ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_o2 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_o3 ) CALL Add_Default( TRIM(SpcName), 8, ' ') + IF ( N == id_h2o ) CALL Add_Default( TRIM(SpcName), 1, ' ') + IF ( N == id_ch4 ) CALL Add_Default( TRIM(SpcName), 1, ' ') + IF ( N == id_n2o ) CALL Add_Default( TRIM(SpcName), 1, ' ') + IF ( N == id_cfc11 ) CALL Add_Default( TRIM(SpcName), 1, ' ') + IF ( N == id_cfc12 ) CALL Add_Default( TRIM(SpcName), 1, ' ') + ENDIF + + IF (history_dust .AND. (index(TRIM(SpcName),'dst_') > 0)) THEN + CALL Add_Default( TRIM(SpcName), 1, ' ') ENDIF ENDDO @@ -240,13 +388,15 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) SpcName = 'DF_'//to_upper(TRIM(SpcInfo%Name)) CALL AddFld( TRIM(SpcName), horiz_only, 'A', 'kg/m2/s', & TRIM(SpcName)//' dry deposition flux') + IF ( history_chemistry ) THEN + CALL Add_Default( TRIM(SpcName), 1, ' ' ) + ENDIF ! Free pointer SpcInfo => NULL() ENDDO ENDIF - sflxnam_loc(:) = '' ! Chemical tendencies and surface fluxes DO N = 1, gas_pcnst IF ( map2chm(N) > 0 ) THEN @@ -263,22 +413,31 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) SpcName = TRIM(solsym(N)) CALL cnst_get_ind( SpcName, M, abort=.false. ) IF ( M > 0 ) THEN - IF (sflxnam(M)(3:5) == 'num') then ! name is in the form of "SF****" + IF (sflxnam(M)(3:5) == 'num') THEN ! name is in the form of "SF****" unit_basename = ' 1' ELSE unit_basename = 'kg' ENDIF - IF ( map2chm(N) > 0 ) THEN - sflxnam_loc(M) = to_upper(sflxnam(M)) - ELSE - sflxnam_loc(M) = sflxnam(M) - ENDIF - SpcName = sflxnam_loc(M) + SpcName = sflxnam(M) CALL Addfld ( TRIM(SpcName), horiz_only, 'A', unit_basename//'/m2/s', & TRIM(solsym(N))//' surface flux') + IF ( history_aerosol .OR. history_chemistry ) THEN + CALL Add_Default( TRIM(SpcName), 1, ' ' ) + ENDIF + + IF ( history_cesm_forcing ) THEN + IF ( TRIM(SpcName(3:)) == 'NO' .OR. TRIM(SpcName(3:)) == 'NH3' ) THEN + CALL Add_Default( TRIM(SpcName), 1, ' ' ) + ENDIF + ENDIF ENDIF ENDDO + ! Add chemical tendency of water vapor to water budget output + IF ( history_budget ) THEN + CALL Add_Default ('CT_H2O' , history_budget_histfile_num, ' ') + ENDIF + CALL get_TagInfo( Input_Opt = Input_Opt, & tagID = 'PHO', & State_Chm = State_Chm, & @@ -502,7 +661,7 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) i_MCRHNB, i_MENO3, i_MONITS, i_MONITU, i_MPAN, i_MPN,& i_MVKN, i_N2O5, i_NO3, i_NPRNO3, i_OLND, i_OLNN, & i_PAN, i_PPN, i_PRN1, i_PROPNN, i_PRPN, i_R4N1, & - i_R4N2, i_HONIT, i_IONITA, i_NIT, i_NITs, i_NH4 /) + i_R4N2, i_HONIT, i_IONITA, i_NIT, i_NITs /) HOx_species = (/ i_H, i_OH, i_HO2, i_H2O2 /) ClOx_species = (/ i_Cl, i_ClO, i_HOCl, i_Cl2, i_Cl2O2, i_OClO /) ClOy_species = (/ i_Cl, i_ClO, i_HOCl, i_Cl2, i_Cl2O2, i_OClO, & @@ -733,6 +892,9 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) CALL Addfld( 'RAD_PSC', (/ 'lev' /), 'I', 'cm', 'PSC aerosol radius' ) CALL Addfld( 'SAD_TROP', (/ 'lev' /), 'I', 'cm2/cm3', 'Tropospheric aerosol SAD' ) CALL Addfld( 'SAD_AERO', (/ 'lev' /), 'I', 'cm2/cm3', 'Aerosol surface area density' ) + IF ( history_cesm_forcing ) THEN + CALL Add_Default( 'SAD_AERO', 8, ' ' ) + ENDIF CALL Addfld( 'REFF_AERO', (/ 'lev' /), 'I', 'cm', 'Aerosol effective radius') CALL Addfld( 'SULF_TROP', (/ 'lev' /), 'I', 'cm2/cm3', 'Tropospheric sulfate area density') @@ -889,19 +1051,18 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & DO N = 1, gas_pcnst M = map2chm(N) - IF ( M > 0 ) THEN - ! It's a GEOS-Chem species - SpcName = to_upper(TRIM(solsym(N))) - ELSE - ! MAM aerosols - SpcName = TRIM(solsym(N)) - ENDIF + SpcName = TRIM(solsym(N)) outTmp = 0.0e+00_r8 IF ( adv_mass(N) > 0.0e+00_r8 .AND. M /= 0 .AND. hist_fld_active(TRIM(SpcName)) ) THEN IF ( M > 0 ) THEN + ! mol/mol outTmp(:nY,:) = REAL(State_Chm%Species(1,:nY,nZ:1:-1,M),r8) * MWDry / adv_mass(N) - ELSE + ELSEIF ( ANY( aer_species == N ) ) THEN + ! kg/kg outTmp(:nY,:) = state%q(:nY,:nZ,-M) + ELSE + ! mol/mol + outTmp(:nY,:) = state%q(:nY,:nZ,-M) * MWDry / adv_mass(N) ENDIF CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) CALL OutFld( TRIM(SpcName)//'_SRF', outTmp(:nY,nZ), nY, LCHNK ) @@ -1287,7 +1448,7 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & ! =============================================== DO N = iFirstCnst, pcnst - SpcName = TRIM(sflxnam_loc(N)) + SpcName = TRIM(sflxnam(N)) IF ( TRIM(SpcName) == '' ) CYCLE IF ( .NOT. hist_fld_active(TRIM(SpcName)) ) CYCLE CALL OutFld( TRIM(SpcName), cam_in%cflx(:nY,N), nY, LCHNK ) diff --git a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 index 2a1ff841b2..4709699035 100644 --- a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 @@ -92,6 +92,7 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) ! USE PHYSICS_TYPES, ONLY : physics_state USE CONSTITUENTS, ONLY : cnst_get_ind + USE PHYS_CONTROL, ONLY : phys_getopts USE MO_CHEM_UTLS, ONLY : get_spc_ndx USE CAM_HISTORY, ONLY : addfld, add_default, horiz_only USE MO_LIGHTNING, ONLY : lightning_inti @@ -113,6 +114,11 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) INTEGER :: IERR INTEGER :: N, II + ! Logicals + LOGICAL :: history_aerosol + LOGICAL :: history_chemistry + LOGICAL :: history_cesm_forcing + ! Strings CHARACTER(LEN=255) :: SpcName CHARACTER(LEN=255) :: Description @@ -124,6 +130,10 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) ! CESMGC_Emissions_Init begins here! !================================================================= + CALL phys_getopts( history_aerosol_out = history_aerosol, & + history_chemistry_out = history_chemistry, & + history_cesm_forcing_out = history_cesm_forcing ) + ! Get constituent index for NO CALL cnst_get_ind('NO', iNO, abort=.True.) @@ -216,9 +226,9 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) CALL Addfld( 'MEG_'//TRIM(SpcName), horiz_only, 'A', 'kg/m2/s', & Description ) - !if (history_chemistry) then - CALL Add_default('MEG_'//TRIM(SpcName), 1, ' ') - !endif + IF ( history_chemistry ) THEN + CALL Add_default('MEG_'//TRIM(SpcName), 1, ' ') + ENDIF ENDDO ENDIF @@ -229,9 +239,21 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) SpcName = TRIM(cnst_name(N))//'_CLXF' CALL Addfld( TRIM(SpcName), horiz_only, 'A', 'molec/cm2/s', & 'Vertically-integrated external forcing for '//TRIM(cnst_name(N))) + IF ( history_aerosol .OR. history_chemistry ) THEN + CALL Add_Default( TRIM(SpcName), 1, ' ' ) + ENDIF + IF ( history_cesm_forcing .AND. TRIM(cnst_name(N)) == 'NO2' ) THEN + CALL Add_Default( TRIM(SpcName), 1, ' ' ) + ENDIF SpcName = TRIM(cnst_name(N))//'_CMXF' CALL Addfld( TRIM(SpcName), horiz_only, 'A', 'kg/m2/s', & 'Vertically-integrated external forcing for '//TRIM(cnst_name(N))) + IF ( history_aerosol .OR. history_chemistry ) THEN + CALL Add_Default( TRIM(SpcName), 1, ' ' ) + ENDIF + IF ( history_cesm_forcing .AND. TRIM(cnst_name(N)) == 'NO2' ) THEN + CALL Add_Default( TRIM(SpcName), 1, ' ' ) + ENDIF ENDDO CALL Addfld( 'NO_Lightning', (/ 'lev' /), 'A','molec/cm3/s', & diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index c2b9919a94..5e00fddcdb 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -7,13 +7,11 @@ module chem_mods implicit none save - INTEGER, PARAMETER :: nTracersMax = 250 ! Must be equal to nadv_chem - INTEGER :: nTracers - CHARACTER(LEN=255) :: tracerNames(nTracersMax) - CHARACTER(LEN=255) :: tracerLongNames(nTracersMax) - REAL(r8) :: adv_Mass(nTracersMax) - REAL(r8) :: MWRatio(nTracersMax) - REAL(r8) :: ref_MMR(nTracersMax) + INTEGER, PARAMETER :: nTracersMax = 238 ! Must be equal to chem_nadv + INTEGER :: nTracers + CHARACTER(LEN=255) :: tracerNames(nTracersMax) + CHARACTER(LEN=255) :: tracerLongNames(nTracersMax) + REAL(r8) :: ref_MMR(pcnst) ! Index of first constituent INTEGER :: iFirstCnst diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index d01db107cd..7b568b72b8 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -433,9 +433,6 @@ subroutine chem_register ! cnstName = 'TOLUENE' ENDIF - ! For debug, only - !If ( MasterProc ) Write(iulog,*) " Species = ", TRIM(cnstName) - CALL cnst_add( cnstName, MWtmp, cptmp, qmin, N, & readiv=ic_from_cam2, mixtype=mixtype, & cam_outfld=camout, molectype=molectype, & @@ -2212,6 +2209,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) DO SM = 1, nspec_amode(M) P = map2MAM4(SM,M) IF ( P <= 0 ) CYCLE + ! Overwrite MMR_Beg with MAM value + MMR_Beg(:nY,:nZ,P) = State_Chm(LCHNK)%Species(1,:nY,:nZ,P) N = lmassptr_amode(SM,M) DO J = 1, nY DO L = 1, nZ @@ -2451,7 +2450,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) DO J = 1, nY State_Met(LCHNK)%LandTypeFrac(1,J,N) = pbuf_i(J) ENDDO - pbuf_ik => NULL() + pbuf_i => NULL() ENDIF Write(FieldName, '(a,i2.2)') 'HCO_XLAI', N-1 @@ -2463,7 +2462,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) DO J = 1, nY State_Met(LCHNK)%XLAI_NATIVE(1,J,N) = pbuf_i(J) ENDDO - pbuf_ik => NULL() + pbuf_i => NULL() ENDIF ENDDO ENDIF @@ -3715,6 +3714,12 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF + ! GEOS-Chem considers CO2 as a dead species and resets its concentration + ! internally. Right after the call to `Do_Chemistry`, State_Chm%Species(iCO2) + ! corresponds to the chemically-produced CO2. The real CO2 concentration + ! is thus the concentration before chemistry + the chemically-produced CO2. + State_Chm(LCHNK)%Species(1,:nY,:nZ,iCO2) = State_Chm(LCHNK)%Species(1,:nY,:nZ,iCO2) & + + MMR_Beg(:nY,:nZ,iCO2) ! Make sure State_Chm(LCHNK) is back in kg/kg dry! IF ( TRIM(State_Chm(LCHNK)%Spc_Units) /= 'kg/kg dry' ) THEN @@ -3731,43 +3736,34 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) - CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) ! RXN_NO2: NO2 + hv --> NO + O - pbuf_ik(:nY,:nZ) = ZPJ(nZ:1:-1, RXN_NO2, 1, :nY) + pbuf_i(:nY) = ZPJ(1,RXN_NO2,1,:nY) pbuf_chnk => NULL() - pbuf_ik => NULL() + pbuf_i => NULL() ENDIF - FieldName = 'HCO_IN_JOH' tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) - CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) IF ( Input_Opt%LUCX ) THEN - ! RXN_O3_1: O3 + hv --> O2 + O - pbuf_ik(:nY,:nZ) = ZPJ(nZ:1:-1, RXN_O3_1, 1, :nY) + ! RXN_O3_1: O3 + hv --> O2 + O + pbuf_i(:nY) = ZPJ(1,RXN_O3_1,1,:nY) ELSE - ! RXN_O3_2a: O3 + hv --> 2OH - pbuf_ik(:nY,:nZ) = ZPJ(nZ:1:-1, RXN_O3_2a, 1, :nY) + ! RXN_O3_2a: O3 + hv --> 2OH + pbuf_i(:nY) = ZPJ(1,RXN_O3_2a,1,:nY) ENDIF - pbuf_chnk => NULL() - pbuf_ik => NULL() + pbuf_i => NULL() ENDIF - ! GEOS-Chem considers CO2 as a dead species and resets its concentration - ! internally. Right after the call to `Do_Chemistry`, State_Chm%Species(iCO2) - ! corresponds to the chemically-produced CO2. The real CO2 concentration - ! is thus the concentration before chemistry + the chemically-produced CO2. - State_Chm(LCHNK)%Species(1,:nY,:nZ,iCO2) = State_Chm(LCHNK)%Species(1,:nY,:nZ,iCO2) & - + MMR_Beg(:nY,:nZ,iCO2) - call t_stopf( 'chemdr' ) !============================================================== diff --git a/src/chemistry/geoschem/mo_neu_wetdep.F90 b/src/chemistry/geoschem/mo_neu_wetdep.F90 index d31ab9d7f4..49a9acb3a0 100644 --- a/src/chemistry/geoschem/mo_neu_wetdep.F90 +++ b/src/chemistry/geoschem/mo_neu_wetdep.F90 @@ -226,12 +226,13 @@ subroutine neu_wetdep_init call addfld ('DTWR_'//trim(gas_wetdep_list(m)),(/ 'lev' /), 'A','kg/kg/s','wet removal Neu scheme tendency') call addfld ('WD_'//trim(gas_wetdep_list(m)),horiz_only, 'A','kg/m2/s','vertical integrated wet deposition flux') call addfld ('HEFF_'//trim(gas_wetdep_list(m)),(/ 'lev' /), 'A','M/atm','Effective Henrys Law coeff.') - call add_default('DTWR_'//trim(gas_wetdep_list(m)), 4, ' ') - call add_default('WD_'//trim(gas_wetdep_list(m)), 4, ' ') - !if (history_chemistry) then - ! call add_default('DTWR_'//trim(gas_wetdep_list(m)), 1, ' ') - ! call add_default('WD_'//trim(gas_wetdep_list(m)), 1, ' ') - !end if + call add_default('DTWR_'//trim(gas_wetdep_list(m)), 2, ' ') + call add_default('WD_'//trim(gas_wetdep_list(m)), 2, ' ') + !call add_default('HEFF_'//trim(gas_wetdep_list(m)), 2, ' ') + if (history_chemistry) then + call add_default('DTWR_'//trim(gas_wetdep_list(m)), 1, ' ') + call add_default('WD_'//trim(gas_wetdep_list(m)), 1, ' ') + end if end do ! if ( do_diag ) then @@ -481,7 +482,7 @@ subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & do m=1,gas_wetdep_cnt wd_tend(1:ncol,:,mapping_to_mmr(m)) = wd_tend(1:ncol,:,mapping_to_mmr(m)) + dtwr(1:ncol,:,m) call outfld( 'DTWR_'//trim(gas_wetdep_list(m)),dtwr(:,:,m),ncol,lchnk ) - + call outfld( 'HEFF_'//trim(gas_wetdep_list(m)),heff(:,pver:1:-1,m),ncol,lchnk ) ! ! vertical integrated wet deposition rate [kg/m2/s] diff --git a/src/chemistry/geoschem/mo_tracname.F90 b/src/chemistry/geoschem/mo_tracname.F90 index be9c474506..8e8a80b9a3 100644 --- a/src/chemistry/geoschem/mo_tracname.F90 +++ b/src/chemistry/geoschem/mo_tracname.F90 @@ -5,13 +5,10 @@ module mo_tracname ! surface fluxes for the advected species. !----------------------------------------------------------- - use chem_mods, only : nTracersMax + use chem_mods, only : gas_pcnst implicit none -! modified to an arbitrary high #, was gas_pcnst. this would cause a memory -! overflow overwrite in mo_sim_dat, which allocates :273 larger than -! the default specified gas_pcnst (hplin, 5/16/20) - character(len=16) :: solsym(318) ! species names + character(len=16) :: solsym(gas_pcnst) ! species names end module mo_tracname diff --git a/src/chemistry/modal_aero/modal_aero_gasaerexch.F90 b/src/chemistry/modal_aero/modal_aero_gasaerexch.F90 index aa7155a78a..b940757b1d 100644 --- a/src/chemistry/modal_aero/modal_aero_gasaerexch.F90 +++ b/src/chemistry/modal_aero/modal_aero_gasaerexch.F90 @@ -106,6 +106,7 @@ subroutine modal_aero_gasaerexch_sub( & use physconst, only: gravit, mwdry, rair use cam_abortutils, only: endrun use spmd_utils, only: iam, masterproc +use mo_chem_utls, only: utls_chem_is implicit none @@ -260,7 +261,11 @@ subroutine modal_aero_gasaerexch_sub( & ! set gas species indices call cnst_get_ind( 'H2SO4', l_so4g, .false. ) call cnst_get_ind( 'NH3', l_nh4g, .false. ) - call cnst_get_ind( 'MSA', l_msag, .false. ) + if ( .not. utls_chem_is('GEOS-Chem') ) then + call cnst_get_ind( 'MSA', l_msag, .false. ) + else + l_msag = 0 + endif l_so4g = l_so4g - loffset l_nh4g = l_nh4g - loffset l_msag = l_msag - loffset @@ -590,7 +595,6 @@ subroutine modal_aero_gasaerexch_sub( & end do mw_poa_host = 12.0_r8 mw_soa_host = 250.0_r8 - call modal_aero_soaexch( deltat, t(i,k), pmid(i,k), & niter, niter_max, ntot_amode, ntot_soamode, npoa, nsoa, & mw_poa_host, mw_soa_host, & From 2343800365dbd81c3435095d9bdf73a699acabec Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 24 Mar 2021 11:30:20 -0400 Subject: [PATCH 011/160] Feat: Retrieve ParaNOx deposition fluxes from HEMCO --- .../geoschem/cesmgc_emissions_mod.F90 | 96 +++++++++++++++++-- 1 file changed, 87 insertions(+), 9 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 index 4709699035..54d75a01b9 100644 --- a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 @@ -334,26 +334,29 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS INTEGER :: LCHNK INTEGER :: nY, nZ INTEGER :: J, L, N - INTEGER :: RC ! return code - INTEGER :: tmpIdx ! pbuf field id + INTEGER :: RC ! return code + INTEGER :: tmpIdx ! pbuf field id + + INTEGER :: id_O3, id_HNO3 ! Species IDs for reuse ! Logical LOGICAL :: rootChunk ! Objects - TYPE(physics_buffer_desc), POINTER :: pbuf_chnk(:) ! slice of pbuf in current chunk + TYPE(physics_buffer_desc), POINTER :: pbuf_chnk(:) ! slice of pbuf in current chunk ! Real - REAL(r8), POINTER :: pbuf_ik(:,:) ! pointer to pbuf data (/pcols,pver/) - REAL(r8), DIMENSION(state%NCOL,PVER+1) :: zint ! Interface geopotential in km - REAL(r8), DIMENSION(state%NCOL) :: zsurf ! Surface height - REAL(r8) :: SCALFAC ! Multiplying factor - REAL(r8) :: megflx(pcols) ! For MEGAN emissions + REAL(r8), POINTER :: pbuf_ik(:,:) ! pointer to pbuf data (/pcols,pver/) + REAL(r8), POINTER :: pbuf_i(:) ! pointer to 2-D (1-D in CAM) data (/pcols/) + REAL(r8), DIMENSION(state%NCOL,PVER+1) :: zint ! Interface geopotential in km + REAL(r8), DIMENSION(state%NCOL) :: zsurf ! Surface height + REAL(r8) :: SCALFAC ! Multiplying factor + REAL(r8) :: megflx(pcols) ! For MEGAN emissions REAL(r8), PARAMETER :: m2km = 1.e-3_r8 ! Strings CHARACTER(LEN=255) :: SpcName - CHARACTER(LEN=255) :: fldname_ns ! field name HCO_* + CHARACTER(LEN=255) :: fldname_ns ! field name HCO_* !================================================================= ! CESMGC_Emissions_Calc begins here! @@ -362,6 +365,7 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS ! Initialize pointers pbuf_chnk => NULL() pbuf_ik => NULL() + pbuf_i => NULL() ! LCHNK: which chunk we have on this process LCHNK = state%LCHNK @@ -410,6 +414,80 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS ENDIF ENDDO + !----------------------------------------------------------------------- + ! Deposition fluxes from HEMCO + !----------------------------------------------------------------------- + + ! Part 1: Eventually retrieve deposition velocities [1/s] from HEMCO + ! and convert to negative flux and apply. + ! TODO hplin 3/24/21 + + + ! Part 2: Handle special deposition fluxes for the ParaNOx extension + ! for PAR_O3_DEP and PAR_HNO3_DEP + CALL cnst_get_ind('O3', id_O3) + CALL cnst_get_ind('HNO3', id_HNO3) + + ! write(iulog,*) 'id_O3, cnst_name, id_HNO3, cnst_name', id_O3, cnst_name(id_O3), id_HNO3, cnst_name(id_HNO3) + + tmpIdx = pbuf_get_index('HCO_PAR_O3_DEP', RC) + IF(tmpIdx < 0 .OR. ( iStep == 1 )) then + ! No ParaNOx dep flux for O3 + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) + + IF ( .NOT. ASSOCIATED(pbuf_i) ) THEN ! Sanity check + CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_i not associated (2)") + ENDIF + + ! apply loss flux to surface (level nZ) + eflx(1:NY,nZ,id_O3) = eflx(1:NY,nZ,id_O3) - pbuf_i(1:nY) + + IF ( MINVAL(eflx(:nY,nZ,id_O3)) < 0.0e+00_r8 ) THEN + Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO sfc flux after ParaNOx is negative for O3 with value ", MINVAL(eflx(:nY,:nZ,id_O3)), " at ", & + MINLOC(eflx(:nY,nZ,id_O3)) + ENDIF + + IF ( rootChunk .and. ( MINVAL(pbuf_i(1:nY)) < 0.0e+0_r8 ) ) THEN + Write(iulog,'(a,a,a,a)') " CESMGC_Emissions_Calc: HEMCO dflx(paranox) O3 added to ", TRIM(cnst_name(id_O3)) + Write(iulog,'(a,a,E16.4)') " CESMGC_Emissions_Calc: Minval dflx(paranox), eflx(sfc) O3 ", MINVAL(pbuf_i(1:nY)), MINVAL(eflx(:nY,nZ,id_O3)) + ENDIF + + ! Reset pointers + pbuf_i => NULL() + pbuf_chnk => NULL() + ENDIF + + tmpIdx = pbuf_get_index('HCO_PAR_HNO3_DEP', RC) + IF(tmpIdx < 0 .OR. ( iStep == 1 )) then + ! No ParaNOx dep flux for HNO3 + ELSE + pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) + + IF ( .NOT. ASSOCIATED(pbuf_i) ) THEN ! Sanity check + CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_i not associated (3)") + ENDIF + + eflx(1:NY,nZ,id_HNO3) = eflx(1:NY,nZ,id_HNO3) - pbuf_i(1:nY) + + IF ( MINVAL(eflx(:nY,nZ,id_HNO3)) < 0.0e+00_r8 ) THEN + Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO sfc flux after ParaNOx is negative for HNO3 with value ", MINVAL(eflx(:nY,nZ,id_HNO3)), " at ", & + MINLOC(eflx(:nY,nZ,id_HNO3)) + ENDIF + + IF ( rootChunk .and. ( MINVAL(pbuf_i(1:nY)) < 0.0e+0_r8 ) ) THEN + Write(iulog,'(a,a,a,a)') " CESMGC_Emissions_Calc: HEMCO dflx(paranox) HNO3 added to ", TRIM(cnst_name(id_HNO3)) + Write(iulog,'(a,a,E16.4)') " CESMGC_Emissions_Calc: Minval dflx(paranox), eflx(sfc) HNO3 ", MINVAL(pbuf_i(1:nY)), MINVAL(eflx(:nY,nZ,id_HNO3)) + ENDIF + + ! Reset pointers + pbuf_i => NULL() + pbuf_chnk => NULL() + ENDIF + + #if defined( MODAL_AERO_4MODE ) !----------------------------------------------------------------------- ! Aerosol emissions (dust + seasalt) ... From b1d572e117d2380060cd4d49393d16e3a9bbb707 Mon Sep 17 00:00:00 2001 From: Thibaud Fritz Date: Tue, 23 Mar 2021 22:34:39 -0400 Subject: [PATCH 012/160] Squashed 18 commits from Thibaud Fritz Feat: Revert mo_drydep to MOZART's version + Update chemistry.F90 (1) Note that most of the mo_drydep routines are unused. We only need to load in landtypes for MAM Feat: Add aerosol number emissions in CESM-GC (1) Emission diameters are taken from: Emmons, Louisa K., et al. "The chemistry mechanism in the Community Earth System Model version 2 (CESM2)." Journal of Advances in Modeling Earth Systems 12.4 (2020). Feat: Lump GEOS-Chem SO4 with so4_a* and H2SO4 Fix: Remove hard-wired number emissions as this has been moved to HEMCO Feat: Update .xml files with GEOS-Chem chemistry (MEGAN) Feat: Add MEGAN emissions with GEOS-Chem species Fix: Update IF condition for SRF diagnostics Feat: Add hemco_nl in build-namelist Feat: Rename geoschem.xml to 2000_geoscheml.xml (FC2000climo_GC) Feat: Add 2010_geoscheml.xml (FC2010climo_GC) Feat: Update config_component to reflect recent changes to xml files Feat: Add SOA mapping between MAM and GEOS-Chem complex SOA option (1) Add mapping (2) Extend number of constituents Feat: Add AEIC organic species to external forcings list Feat: Add GEOS-Chem surface boundary conditions Feat: Update .gitignore to exclude GEOS-Chem source code Fix: Fix for sulfur mapping between CESM2 and GEOS-Chem (1) SO4_gasRatio and binRatio are in mol/mol, not kg/kg Feat: Update .exclude for GEOS-Chem 13.1 Fix: Update in-cloud opticaldepth with cloud fractions --- .gitignore | 2 +- bld/build-namelist | 3 + bld/configure | 2 +- .../{geoschem.xml => 2000_geoschem.xml} | 29 +- .../use_cases/2010_geoschem.xml | 91 + .../use_cases/hist_geoschem.xml | 49 +- bld/namelist_files/use_cases/sd_geoschem.xml | 62 +- cime_config/config_component.xml | 4 +- src/chemistry/geoschem/.exclude | 3 - src/chemistry/geoschem/cesmgc_diag_mod.F90 | 19 +- .../geoschem/cesmgc_emissions_mod.F90 | 144 +- src/chemistry/geoschem/chem_mods.F90 | 4 +- src/chemistry/geoschem/chemistry.F90 | 800 +++- src/chemistry/geoschem/mo_drydep.F90 | 3495 +---------------- src/chemistry/geoschem/mo_neu_wetdep.F90 | 12 +- src/chemistry/geoschem/mo_sim_dat.F90 | 697 +--- .../pp_trop_strat_mam4_vbs/chem_mods.F90 | 2 +- .../pp_trop_strat_mam4_vbs/mo_sim_dat.F90 | 14 +- .../pp_trop_strat_mam4_vbsext/chem_mods.F90 | 2 +- .../pp_trop_strat_mam4_vbsext/mo_sim_dat.F90 | 10 +- 20 files changed, 1008 insertions(+), 4436 deletions(-) rename bld/namelist_files/use_cases/{geoschem.xml => 2000_geoschem.xml} (89%) create mode 100644 bld/namelist_files/use_cases/2010_geoschem.xml mode change 100644 => 120000 src/chemistry/geoschem/mo_drydep.F90 diff --git a/.gitignore b/.gitignore index fcb95837b8..2ff73275bf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ src/physics/carma/base src/physics/clubb src/physics/cosp2/src src/physics/silhs -src/chemistry/pp_geoschem/geoschem_src +src/chemistry/geoschem/geoschem_src src/hemco # Ignore compiled python diff --git a/bld/build-namelist b/bld/build-namelist index a14d37639e..1558babc94 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -2787,6 +2787,9 @@ else { } } +# HEMCO +$nl->set_variable_value('hemco_nl', 'hemco_config_File', "'HEMCO_Config.rc'"); + # Physics options # Add the name of the physics package based on the info in configure. If the user tries diff --git a/bld/configure b/bld/configure index f026dcd844..9dbb968970 100755 --- a/bld/configure +++ b/bld/configure @@ -1441,7 +1441,7 @@ if ($chem_pkg =~ '_mam3') { # TMMF - wedge in GEOS-Chem CPP definitions here if ($chem_pkg =~ 'geoschem') { $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING -DLINUX_IFORT -DUSE_REAL8 -DMODEL_ -DMODEL_CESM'; - $chem_nadv = 238; + $chem_nadv = 251; if (defined $opts{'clm_vers'}) { if ($opts{'clm_vers'} =~ 'CLM4.0') { $chem_cppdefs .= ' -DCLM40' diff --git a/bld/namelist_files/use_cases/geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml similarity index 89% rename from bld/namelist_files/use_cases/geoschem.xml rename to bld/namelist_files/use_cases/2000_geoschem.xml index ecdb9aaa06..7b4aa03782 100644 --- a/bld/namelist_files/use_cases/geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -5,9 +5,32 @@ /glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ -/glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f09_f09.134.1975.009.cam.i.2010-01-01_32L_c170403.nc - -/glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f19_f19.134.1975.009.cam.i.2010-01-01_32L_c170403.nc +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + + + + 'ISOP = isoprene', + 'MOH = methanol', + 'EOH = ethanol', + 'CH2O = formaldehyde', + 'ALD2 = acetaldehyde', + 'ACTA = acetic_acid', + 'ACET = acetone', + 'HCOOH = formic_acid', + 'HCN = hydrogen_cyanide', + 'CO = carbon_monoxide', + 'C2H6 = ethane', + 'C2H4 = ethene', + 'C3H8 = propane', + 'ALK4 = pentane + hexane + heptane + tricyclene', + 'PRPE = propene + butene', + 'TOLU = toluene', + 'LIMO = limonene', + 'MTPA = pinene_a + pinene_b + sabinene + carene_3', + 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' + atm/cam/solar/SolarForcing1995-2005avg_c160929.nc diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml new file mode 100644 index 0000000000..6d10dd02df --- /dev/null +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -0,0 +1,91 @@ + + + + +00010101 + +/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ + +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + + + + 'ISOP = isoprene', + 'MOH = methanol', + 'EOH = ethanol', + 'CH2O = formaldehyde', + 'ALD2 = acetaldehyde', + 'ACTA = acetic_acid', + 'ACET = acetone', + 'HCOOH = formic_acid', + 'HCN = hydrogen_cyanide', + 'CO = carbon_monoxide', + 'C2H6 = ethane', + 'C2H4 = ethene', + 'C3H8 = propane', + 'ALK4 = pentane + hexane + heptane + tricyclene', + 'PRPE = propene + butene', + 'TOLU = toluene', + 'LIMO = limonene', + 'MTPA = pinene_a + pinene_b + sabinene + carene_3', + 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' + + + +atm/cam/solar/SolarForcing2006-2014avg_c180917.nc +20100101 +FIXED + +'xactive_lnd' + + +.true. +.true. +.false. +0.25D0 + + +CYCLICAL +2010 +atm/waccm/lb/LBC_2010climo_CMIP6_0p5degLat_c180227.nc + + + + + 1,30,365,240,240,480,365,73,30 + 0,-24,-24,-3,-1,1,-24,-120,-240 +'A','A','A','A','A','A','A','A','I' + +.true. +.false. +.false. +.false. +.false. +.false. +.false. +.false. +.false. + + + 'Q', 'U', 'V', 'OMEGA', 'T', 'PS', + + + + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + + + + 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + + 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', + + + + 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 8d8dce5377..9eac1a5be6 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -6,9 +6,32 @@ /glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ -/glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f09_f09.134.1975.009.cam.i.2010-01-01_32L_c170403.nc - -/glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f19_f19.134.1975.009.cam.i.2010-01-01_32L_c170403.nc +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + + + + 'ISOP = isoprene', + 'MOH = methanol', + 'EOH = ethanol', + 'CH2O = formaldehyde', + 'ALD2 = acetaldehyde', + 'ACTA = acetic_acid', + 'ACET = acetone', + 'HCOOH = formic_acid', + 'HCN = hydrogen_cyanide', + 'CO = carbon_monoxide', + 'C2H6 = ethane', + 'C2H4 = ethene', + 'C3H8 = propane', + 'ALK4 = pentane + hexane + heptane + tricyclene', + 'PRPE = propene + butene', + 'TOLU = toluene', + 'LIMO = limonene', + 'MTPA = pinene_a + pinene_b + sabinene + carene_3', + 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' + atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc @@ -52,7 +75,7 @@ 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', 'LNO_COL_PROD', 'NO2_CLXF', 'SFNO', 'SFNH3', 'BRO', - 'CH3CL', 'CLO', 'CO2', 'HCL', 'HO2', 'HOCL', 'H2O', 'PHIS', 'Z3', + 'CH3CL', 'CLO', 'CO2', 'HCL', 'HO2', 'HOCL', 'PHIS', 'Z3', 'BENZ', 'C2H6', 'C3H8', 'CCL4', 'CFC11', 'CFC113', 'CFC12', 'CH2O', 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'ACET', 'MOH', 'CH4', 'CO', 'H2O2', 'HCFC22', 'HNO3', 'ISOP', 'MTPA', 'N2O', 'O3', @@ -68,8 +91,10 @@ 'IHN4', 'INO2B', 'INO2D', 'INPB', 'INPD', 'RIPA', 'RIPB', 'RIPC', 'RIPD', 'MACR', 'MVKHP', 'MEK', 'MCRDH', 'MPAN', 'MVK', 'N', 'N2O', 'N2O5', 'ICN', 'NH3', 'NH4', 'NO', 'NO2', 'NO3', 'PROPNN', 'OLND', 'OLNN', 'O', 'OCLO', - 'OCS', 'PAN', 'SO2', 'SO4', 'SOAP', 'TOLU', 'XYLE', + 'OCS', 'PAN', 'SO2', 'SO4', 'TOLU', 'XYLE', 'R4O2', 'BRO2', 'ETO2', 'A3O2', 'MCO3', 'MO2', 'HO2', 'O1D', 'OH', + 'TSOA0', 'TSOA1', 'TSOA2', 'TSOA3', 'ASOAN', 'ASOA1', 'ASOA2', 'ASOA3', + 'SOAIE', 'SOAGX', 'H2O', 'SAD_PSC', 'SAD_SULFC', 'SAD_TROP', 'SAD_AERO', 'REFF_AERO', 'PDELDRY', 'RAD_PSC', 'RAD_SULFC', 'HNO3_GAS', 'HNO3_STS', 'HNO3_NAT', 'NOX', 'NOY', 'CLOX', 'CLOY', @@ -92,16 +117,16 @@ 'DF_HAC', 'DF_IEPOXA', 'DF_IEPOXB', 'DF_IEPOXD', 'DF_MPAN', 'DF_NH3', 'DF_NH4', 'DF_NO', 'DF_NO2', 'DF_O3', 'DF_PAN', 'DF_SO2', - 'DF_SOAP', 'SO2_CLXF', 'SO2_XFRC', - 'CO_CLXF', 'NO2_CLXF', 'LNO_PROD', 'LNO_COL_PROD', 'SOAP_CLXF', + 'SO2_CLXF', 'SO2_XFRC', + 'CO_CLXF', 'NO2_CLXF', 'LNO_PROD', 'LNO_COL_PROD', 'SFEOH', 'SFALD2', 'SFMEK', 'SFCH2O', 'SFC2H6', 'SFC3H8', 'SFALK4', 'SFPRPE', 'SFBENZ', 'SFTOLU', 'SFXYLE', 'SFNO', 'SFACTA', 'SFDMS', 'SFMEK', 'SFSO2', 'SFNH3', - 'SFISOP', 'SFMTPA', 'SFMOH', 'SFACET', 'SFCO', 'SFSOAP', - 'MEG_ISOP', 'MEG_MTERP', 'MEG_BCARY', 'MEG_CH3OH', 'MEG_C2H5OH', 'MEG_CH2O', - 'MEG_CH3CHO', 'MEG_CH3COOH', 'MEG_CH3COCH3', 'MEG_HCOOH', 'MEG_HCN', 'MEG_CO', - 'MEG_C2H6', 'MEG_C2H4', 'MEG_C3H8', 'MEG_C3H6', 'MEG_BIGALK', 'MEG_BIGENE', - 'MEG_TOLUENE', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', + 'SFISOP', 'SFMTPA', 'SFMOH', 'SFACET', 'SFCO', + 'MEG_ISOP', 'MEG_MOH', 'MEG_EOH', 'MEG_CH2O', 'MEG_ALD2', 'MEG_ACTA', + 'MEG_ACET', 'MEG_HCOOH', 'MEG_HCN', 'MEG_CO', 'MEG_C2H6', 'MEG_C2H4', + 'MEG_C3H8', 'MEG_ALK4', 'MEG_PRPE', 'MEG_TOLU', 'MEG_LIMO', 'MEG_MTPA', + 'MEG_MTPO', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', 'DHNO3CHM', 'DH2O2CHM', 'DO3CHM', 'DCOCHM', 'AQ_SO2', 'GS_SO2', 'SO2_CLXF', 'MASS', 'ABSORB', 'Jval_O3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index 02c3508e54..e420cc20bb 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -6,14 +6,52 @@ /glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ -/glade/p/univ/umit0034/Shared/f.e20.FWAMIP.f09_f09.134.1975.009.cam.i.2010-01-01_56L_c170403.nc +atm/cam/met/MERRA2/0.5x0.63/fv_0.47x0.63_nc3000_Co030_Fi001_PF_nullRR_Nsw021_MERRA2_c180612.nc + +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f09_f09_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc atm/cam/met/MERRA2/0.9x1.25/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_MERRA2_c171218.nc -atm/cam/met/MERRA2/0.5x0.63/fv_0.47x0.63_nc3000_Co030_Fi001_PF_nullRR_Nsw021_MERRA2_c180612.nc +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f19_f19_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc +atm/cam/met/MERRA2/1.9x2.5/fv_1.9x2.5_nc3000_Nsw084_Nrs016_Co120_Fi001_ZR_GRNL_MERRA2_c190617.nc + + + + 'ISOP = isoprene', + 'MOH = methanol', + 'EOH = ethanol', + 'CH2O = formaldehyde', + 'ALD2 = acetaldehyde', + 'ACTA = acetic_acid', + 'ACET = acetone', + 'HCOOH = formic_acid', + 'HCN = hydrogen_cyanide', + 'CO = carbon_monoxide', + 'C2H6 = ethane', + 'C2H4 = ethene', + 'C3H8 = propane', + 'ALK4 = pentane + hexane + heptane + tricyclene', + 'PRPE = propene + butene', + 'TOLU = toluene', + 'LIMO = limonene', + 'MTPA = pinene_a + pinene_b + sabinene + carene_3', + 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' + 50. .true. +2005/MERRA2_1.9x2.5_20050101.nc +atm/cam/met/MERRA2/1.9x2.5 +atm/cam/met/MERRA2/1.9x2.5/filenames_list_c20210302 + +2005/MERRA2_0.9x1.25_20050101.nc +atm/cam/met/MERRA2/0.9x1.25 +atm/cam/met/MERRA2/0.9x1.25/filenames_1975-2017_c190125.txt + +2010/MERRA2_0.5x0.63_20100101.nc +atm/cam/met/MERRA2/0.5x0.63 +atm/cam/met/MERRA2/0.5x0.63/filenames_list_c180612 + 2005/MERRA2_0.9x1.25_20050101.nc atm/cam/met/MERRA2/0.9x1.25 atm/cam/met/MERRA2/0.9x1.25/filenames_1975-2017_c190125.txt @@ -62,7 +100,7 @@ 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', 'LNO_COL_PROD', 'NO2_CLXF', 'SFNO', 'SFNH3', 'BRO', - 'CH3CL', 'CLO', 'CO2', 'HCL', 'HO2', 'HOCL', 'H2O', 'PHIS', 'Z3', + 'CH3CL', 'CLO', 'CO2', 'HCL', 'HO2', 'HOCL', 'PHIS', 'Z3', 'BENZ', 'C2H6', 'C3H8', 'CCL4', 'CFC11', 'CFC113', 'CFC12', 'CH2O', 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'ACET', 'MOH', 'CH4', 'CO', 'H2O2', 'HCFC22', 'HNO3', 'ISOP', 'MTPA', 'N2O', 'O3', @@ -78,8 +116,10 @@ 'IHN4', 'INO2B', 'INO2D', 'INPB', 'INPD', 'RIPA', 'RIPB', 'RIPC', 'RIPD', 'MACR', 'MVKHP', 'MEK', 'MCRDH', 'MPAN', 'MVK', 'N', 'N2O', 'N2O5', 'ICN', 'NH3', 'NH4', 'NO', 'NO2', 'NO3', 'PROPNN', 'OLND', 'OLNN', 'O', 'OCLO', - 'OCS', 'PAN', 'SO2', 'SO4', 'SOAP', 'TOLU', 'XYLE', + 'OCS', 'PAN', 'SO2', 'SO4', 'TOLU', 'XYLE', 'R4O2', 'BRO2', 'ETO2', 'A3O2', 'MCO3', 'MO2', 'HO2', 'O1D', 'OH', + 'TSOA0', 'TSOA1', 'TSOA2', 'TSOA3', 'ASOAN', 'ASOA1', 'ASOA2', 'ASOA3', + 'SOAIE', 'SOAGX', 'H2O', 'SAD_PSC', 'SAD_SULFC', 'SAD_TROP', 'SAD_AERO', 'REFF_AERO', 'PDELDRY', 'RAD_PSC', 'RAD_SULFC', 'HNO3_GAS', 'HNO3_STS', 'HNO3_NAT', 'NOX', 'NOY', 'CLOX', 'CLOY', @@ -102,16 +142,16 @@ 'DF_HAC', 'DF_IEPOXA', 'DF_IEPOXB', 'DF_IEPOXD', 'DF_MPAN', 'DF_NH3', 'DF_NH4', 'DF_NO', 'DF_NO2', 'DF_O3', 'DF_PAN', 'DF_SO2', - 'DF_SOAP', 'SO2_CLXF', 'SO2_XFRC', - 'CO_CLXF', 'NO2_CLXF', 'LNO_PROD', 'LNO_COL_PROD', 'SOAP_CLXF', + 'SO2_CLXF', 'SO2_XFRC', + 'CO_CLXF', 'NO2_CLXF', 'LNO_PROD', 'LNO_COL_PROD', 'SFEOH', 'SFALD2', 'SFMEK', 'SFCH2O', 'SFC2H6', 'SFC3H8', 'SFALK4', 'SFPRPE', 'SFBENZ', 'SFTOLU', 'SFXYLE', 'SFNO', 'SFACTA', 'SFDMS', 'SFMEK', 'SFSO2', 'SFNH3', - 'SFISOP', 'SFMTPA', 'SFMOH', 'SFACET', 'SFCO', 'SFSOAP', - 'MEG_ISOP', 'MEG_MTERP', 'MEG_BCARY', 'MEG_CH3OH', 'MEG_C2H5OH', 'MEG_CH2O', - 'MEG_CH3CHO', 'MEG_CH3COOH', 'MEG_CH3COCH3', 'MEG_HCOOH', 'MEG_HCN', 'MEG_CO', - 'MEG_C2H6', 'MEG_C2H4', 'MEG_C3H8', 'MEG_C3H6', 'MEG_BIGALK', 'MEG_BIGENE', - 'MEG_TOLUENE', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', + 'SFISOP', 'SFMTPA', 'SFMOH', 'SFACET', 'SFCO', + 'MEG_ISOP', 'MEG_MOH', 'MEG_EOH', 'MEG_CH2O', 'MEG_ALD2', 'MEG_ACTA', + 'MEG_ACET', 'MEG_HCOOH', 'MEG_HCN', 'MEG_CO', 'MEG_C2H6', 'MEG_C2H4', + 'MEG_C3H8', 'MEG_ALK4', 'MEG_PRPE', 'MEG_TOLU', 'MEG_LIMO', 'MEG_MTPA', + 'MEG_MTPO', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', 'DHNO3CHM', 'DH2O2CHM', 'DO3CHM', 'DCOCHM', 'AQ_SO2', 'GS_SO2', 'SO2_CLXF', 'MASS', 'ABSORB', 'Jval_O3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 2ba9e9a0e7..10e9370dc5 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -210,7 +210,7 @@ waccm_ma_2000_cam6 waccm_sc_2000_cam6 2000_trop_strat_vbs_cam6 - geoschem + 2000_geoschem aquaplanet_cam4 aquaplanet_cam4 @@ -223,7 +223,7 @@ 2010_trop_strat_vbs_cam6 waccm_tsmlt_2010_cam6 waccm_sc_2010_cam6 - geoschem_2010 + 2010_geoschem 1850-2005_cam5 1850-2005_cam4 diff --git a/src/chemistry/geoschem/.exclude b/src/chemistry/geoschem/.exclude index b0c26be3ef..b8418763c5 100644 --- a/src/chemistry/geoschem/.exclude +++ b/src/chemistry/geoschem/.exclude @@ -18,6 +18,3 @@ tccon_ch4_mod.F90 initialize.F90 cleanup.F90 main.F90 -hcoi_gc_diagn_include.H -hcoi_gc_diagn_mod.F90 -hco_interface_gc_mod.F90 diff --git a/src/chemistry/geoschem/cesmgc_diag_mod.F90 b/src/chemistry/geoschem/cesmgc_diag_mod.F90 index f27dfa7e53..584ab12a07 100644 --- a/src/chemistry/geoschem/cesmgc_diag_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_diag_mod.F90 @@ -471,13 +471,14 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & TRIM(tagName) // ' photolysis rate' ) ENDDO - ! Add Jval_O3O1D and Jval_O3O3P - SpcName = 'Jval_O3O1D' + ! Add JvalO3O1D and JvalO3O3P + SpcName = 'JvalO3O1D' CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & - TRIM(tagName) // ' photolysis rate' ) - SpcName = 'Jval_O3O3P' + 'O3 -> O1D photolysis rate' ) + + SpcName = 'JvalO3O3P' CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & - TRIM(tagName) // ' photolysis rate' ) + 'O3 -> O3P photolysis rate' ) ! ========================================== ! Now add fields corresponding to State_Met @@ -960,6 +961,7 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & USE PHYSCONST, ONLY : MWDry USE UCX_MOD, ONLY : GET_STRAT_OPT!, AERFRAC USE CMN_SIZE_MOD, ONLY : NDUST + USE CMN_FJX_MOD ! ! !INPUT PARAMETERS: ! @@ -1053,7 +1055,8 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & M = map2chm(N) SpcName = TRIM(solsym(N)) outTmp = 0.0e+00_r8 - IF ( adv_mass(N) > 0.0e+00_r8 .AND. M /= 0 .AND. hist_fld_active(TRIM(SpcName)) ) THEN + IF ( adv_mass(N) > 0.0e+00_r8 .AND. M /= 0 .AND. & + (hist_fld_active(TRIM(SpcName)) .OR. hist_fld_active(TRIM(SpcName)//'_SRF')) ) THEN IF ( M > 0 ) THEN ! mol/mol outTmp(:nY,:) = REAL(State_Chm%Species(1,:nY,nZ:1:-1,M),r8) * MWDry / adv_mass(N) @@ -1502,14 +1505,14 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & ENDDO ENDIF IF ( ASSOCIATED(State_Diag%JvalO3O1D) ) THEN - SpcName = 'Jval_O3O1D' + SpcName = 'JvalO3O1D' IF ( hist_fld_active(TRIM(SpcName)) ) THEN outTmp(:nY,:nZ) = REAL(State_Diag%JvalO3O1D(1,:nY,nZ:1:-1),r8) CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) ENDIF ENDIF IF ( ASSOCIATED(State_Diag%JvalO3O3P) ) THEN - SpcName = 'Jval_O3O3P' + SpcName = 'JvalO3O3P' IF ( hist_fld_active(TRIM(SpcName)) ) THEN outTmp(:nY,:nZ) = REAL(State_Diag%JvalO3O3P(1,:nY,nZ:1:-1),r8) CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) diff --git a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 index 54d75a01b9..5489b0f043 100644 --- a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 @@ -41,25 +41,12 @@ MODULE CESMGC_Emissions_Mod INTEGER :: iBC1 INTEGER :: iBC4 INTEGER :: iH2SO4 - INTEGER :: iSOA11 - INTEGER :: iSOA12 - INTEGER :: iSOA21 - INTEGER :: iSOA22 - INTEGER :: iSOA31 - INTEGER :: iSOA32 - INTEGER :: iSOA41 - INTEGER :: iSOA42 - INTEGER :: iSOA51 - INTEGER :: iSOA52 - INTEGER :: iPOM1 - INTEGER :: iPOM4 INTEGER :: iBCPI INTEGER :: iBCPO INTEGER :: iOCPI INTEGER :: iOCPO INTEGER :: iSO4 - INTEGER :: iSOAS ! MEGAN Emissions INTEGER, ALLOCATABLE :: megan_indices_map(:) @@ -137,22 +124,6 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) ! Get constituent index for NO CALL cnst_get_ind('NO', iNO, abort=.True.) -#if defined( MODAL_AERO_4MODE ) - ! Get constituent index for aerosols - CALL cnst_get_ind('soa1_a1', iSOA11, abort=.True.) - CALL cnst_get_ind('soa1_a2', iSOA12, abort=.True.) - CALL cnst_get_ind('soa2_a1', iSOA21, abort=.True.) - CALL cnst_get_ind('soa2_a2', iSOA22, abort=.True.) - CALL cnst_get_ind('soa3_a1', iSOA31, abort=.True.) - CALL cnst_get_ind('soa3_a2', iSOA32, abort=.True.) - CALL cnst_get_ind('soa4_a1', iSOA41, abort=.True.) - CALL cnst_get_ind('soa4_a2', iSOA42, abort=.True.) - CALL cnst_get_ind('soa5_a1', iSOA51, abort=.True.) - CALL cnst_get_ind('soa5_a2', iSOA52, abort=.True.) - - CALL cnst_get_ind('SOAS', iSOAS, abort=.True.) -#endif - !----------------------------------------------------------------------- ! ... initialize the lightning module !----------------------------------------------------------------------- @@ -171,41 +142,50 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) DO N = 1, shr_megan_mechcomps_n SpcName = TRIM(shr_megan_mechcomps(N)%name) + ! Special handlings for GEOS-Chem species - IF ( TRIM(SpcName) == 'MTERP' ) THEN - SpcName = 'MTPA' - ELSEIF ( TRIM(SpcName) == 'BCARY' ) THEN - SpcName = 'None' - MW = 204.342600_r8 ! Taken from pp_trop_strat_mam4_vbs - ELSEIF ( TRIM(SpcName) == 'CH3OH' ) THEN - SpcName = 'MOH' - ELSEIF ( TRIM(SpcName) == 'C2H5OH' ) THEN - SpcName = 'EOH' - ELSEIF ( TRIM(SpcName) == 'CH3CHO' ) THEN - SpcName = 'ALD2' - ELSEIF ( TRIM(SpcName) == 'CH3COOH' ) THEN - SpcName = 'ACTA' - ELSEIF ( TRIM(SpcName) == 'CH3COCH3' ) THEN - SpcName = 'ACET' - ELSEIF ( TRIM(SpcName) == 'HCN' ) THEN + IF ( TRIM(SpcName) == 'HCN' ) THEN SpcName = 'None' MW = 27.025140_r8 ! Taken from pp_trop_strat_mam4_vbs ELSEIF ( TRIM(SpcName) == 'C2H4' ) THEN SpcName = 'None' MW = 28.051600_r8 ! Taken from pp_trop_strat_mam4_vbs - ELSEIF ( TRIM(SpcName) == 'C3H6' ) THEN - SpcName = 'PRPE' - ELSEIF ( TRIM(SpcName) == 'BIGALK' ) THEN - ! BIGALK = Pentane + Hexane + Heptane + Tricyclene - SpcName = 'ALK4' - ELSEIF ( TRIM(SpcName) == 'BIGENE' ) THEN - ! BIGENE = butene (C4H8) - SpcName = 'PRPE' ! Lumped >= C3 alkenes - ELSEIF ( TRIM(SpcName) == 'TOLUENE' ) THEN - SpcName = 'TOLU' ENDIF + !IF ( TRIM(SpcName) == 'MTERP' ) THEN + ! SpcName = 'MTPA' + !ELSEIF ( TRIM(SpcName) == 'BCARY' ) THEN + ! SpcName = 'None' + ! MW = 204.342600_r8 ! Taken from pp_trop_strat_mam4_vbs + !ELSEIF ( TRIM(SpcName) == 'CH3OH' ) THEN + ! SpcName = 'MOH' + !ELSEIF ( TRIM(SpcName) == 'C2H5OH' ) THEN + ! SpcName = 'EOH' + !ELSEIF ( TRIM(SpcName) == 'CH3CHO' ) THEN + ! SpcName = 'ALD2' + !ELSEIF ( TRIM(SpcName) == 'CH3COOH' ) THEN + ! SpcName = 'ACTA' + !ELSEIF ( TRIM(SpcName) == 'CH3COCH3' ) THEN + ! SpcName = 'ACET' + !ELSEIF ( TRIM(SpcName) == 'HCN' ) THEN + ! SpcName = 'None' + ! MW = 27.025140_r8 ! Taken from pp_trop_strat_mam4_vbs + !ELSEIF ( TRIM(SpcName) == 'C2H4' ) THEN + ! SpcName = 'None' + ! MW = 28.051600_r8 ! Taken from pp_trop_strat_mam4_vbs + !ELSEIF ( TRIM(SpcName) == 'C3H6' ) THEN + ! SpcName = 'PRPE' + !ELSEIF ( TRIM(SpcName) == 'BIGALK' ) THEN + ! ! BIGALK = Pentane + Hexane + Heptane + Tricyclene + ! SpcName = 'ALK4' + !ELSEIF ( TRIM(SpcName) == 'BIGENE' ) THEN + ! ! BIGENE = butene (C4H8) + ! SpcName = 'PRPE' ! Lumped >= C3 alkenes + !ELSEIF ( TRIM(SpcName) == 'TOLUENE' ) THEN + ! SpcName = 'TOLU' + !ENDIF CALL cnst_get_ind (SpcName, megan_indices_map(N), abort=.False.) + II = get_spc_ndx(SpcName) IF ( II > 0 ) THEN SpcName = TRIM(shr_megan_mechcomps(N)%name) @@ -291,6 +271,7 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS USE PPGRID, ONLY : pcols, pver, begchunk USE CAM_HISTORY, ONLY : outfld USE STRING_UTILS, ONLY : to_upper + USE PHYSCONSTANTS, ONLY : PI ! Data from CLM USE CAM_CPL_INDICES, ONLY : index_x2a_Fall_flxvoc @@ -399,13 +380,14 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS pbuf_ik => NULL() pbuf_chnk => NULL() - IF ( MINVAL(eflx(:nY,:nZ,N)) < 0.0e+00_r8 ) THEN - Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO emission flux is negative for ", & - TRIM(cnst_name(N)), " with value ", MINVAL(eflx(:nY,:nZ,N)), " at ", & - MINLOC(eflx(:nY,:nZ,N)) - ENDIF + !IF ( MINVAL(eflx(:nY,:nZ,N)) < 0.0e+00_r8 ) THEN + ! Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO emission flux is negative for ", & + ! TRIM(cnst_name(N)), " with value ", MINVAL(eflx(:nY,:nZ,N)), " at ", & + ! MINLOC(eflx(:nY,:nZ,N)) + !ENDIF - IF ( rootChunk .and. ( MAXVAL(eflx(:nY,:nZ,N)) > 0.0e+0_r8 ) ) THEN + IF ( rootChunk .AND. (iStep == 2) .AND. ( MAXVAL(eflx(:nY,:nZ,N)) > 0.0e+0_r8 ) ) THEN + ! Only print this once Write(iulog,'(a,a,a,a)') " CESMGC_Emissions_Calc: HEMCO flux ", & TRIM(fldname_ns), " added to ", TRIM(cnst_name(N)) Write(iulog,'(a,a,E16.4)') " CESMGC_Emissions_Calc: Maximum flux ", & @@ -444,10 +426,10 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS ! apply loss flux to surface (level nZ) eflx(1:NY,nZ,id_O3) = eflx(1:NY,nZ,id_O3) - pbuf_i(1:nY) - IF ( MINVAL(eflx(:nY,nZ,id_O3)) < 0.0e+00_r8 ) THEN - Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO sfc flux after ParaNOx is negative for O3 with value ", MINVAL(eflx(:nY,:nZ,id_O3)), " at ", & - MINLOC(eflx(:nY,nZ,id_O3)) - ENDIF + !IF ( MINVAL(eflx(:nY,nZ,id_O3)) < 0.0e+00_r8 ) THEN + ! Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO sfc flux after ParaNOx is negative for O3 with value ", MINVAL(eflx(:nY,:nZ,id_O3)), " at ", & + ! MINLOC(eflx(:nY,nZ,id_O3)) + !ENDIF IF ( rootChunk .and. ( MINVAL(pbuf_i(1:nY)) < 0.0e+0_r8 ) ) THEN Write(iulog,'(a,a,a,a)') " CESMGC_Emissions_Calc: HEMCO dflx(paranox) O3 added to ", TRIM(cnst_name(id_O3)) @@ -472,10 +454,10 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS eflx(1:NY,nZ,id_HNO3) = eflx(1:NY,nZ,id_HNO3) - pbuf_i(1:nY) - IF ( MINVAL(eflx(:nY,nZ,id_HNO3)) < 0.0e+00_r8 ) THEN - Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO sfc flux after ParaNOx is negative for HNO3 with value ", MINVAL(eflx(:nY,nZ,id_HNO3)), " at ", & - MINLOC(eflx(:nY,nZ,id_HNO3)) - ENDIF + !IF ( MINVAL(eflx(:nY,nZ,id_HNO3)) < 0.0e+00_r8 ) THEN + ! Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO sfc flux after ParaNOx is negative for HNO3 with value ", MINVAL(eflx(:nY,nZ,id_HNO3)), " at ", & + ! MINLOC(eflx(:nY,nZ,id_HNO3)) + !ENDIF IF ( rootChunk .and. ( MINVAL(pbuf_i(1:nY)) < 0.0e+0_r8 ) ) THEN Write(iulog,'(a,a,a,a)') " CESMGC_Emissions_Calc: HEMCO dflx(paranox) HNO3 added to ", TRIM(cnst_name(id_HNO3)) @@ -487,8 +469,8 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS pbuf_chnk => NULL() ENDIF +#if defined( MODAL_AERO ) -#if defined( MODAL_AERO_4MODE ) !----------------------------------------------------------------------- ! Aerosol emissions (dust + seasalt) ... !----------------------------------------------------------------------- @@ -502,35 +484,25 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS ! where all GEOS-Chem aerosols (BCPI, BCPO, OCPI, OCPO, SO4) have been ! replaced with the corresponding MAM aerosols - ! For SOA emission, split evently GEOS-Chem SOAS emission into each - ! VBS bin. - eflx(:nY,:nZ,iSOA11) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 - eflx(:nY,:nZ,iSOA12) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 - eflx(:nY,:nZ,iSOA21) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 - eflx(:nY,:nZ,iSOA22) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 - eflx(:nY,:nZ,iSOA31) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 - eflx(:nY,:nZ,iSOA32) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 - eflx(:nY,:nZ,iSOA41) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 - eflx(:nY,:nZ,iSOA42) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 - eflx(:nY,:nZ,iSOA51) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 - eflx(:nY,:nZ,iSOA52) = eflx(:nY,:nZ,iSOAS) / 10.0e+00_r8 - eflx(:nY,:nZ,iSOAS) = 0.0e+00_r8 - #endif ! Output fields before lightning NO emissions are applied to eflx + ! Make sure that we do not include surface emissions in the diagnostics! DO N = iFirstCnst, pcnst SpcName = TRIM(cnst_name(N))//'_XFRC' + ! Convert from kg/m2/s to molec/cm3/s + ! Note 1: cnst_mw is in kg/kmole + ! Note 2: avogad is in molecules/kmole CALL Outfld( TRIM(SpcName), eflx(:nY,:nZ,N) / State_Met%BXHEIGHT(1,:nY,nZ:1:-1) * 1.0E-06 / cnst_mw(N) * avogad, nY, LCHNK ) SpcName = TRIM(cnst_name(N))//'_CLXF' ! Convert from kg/m2/s to molec/cm2/s ! Note 1: cnst_mw is in kg/kmole ! Note 2: avogad is in molecules/kmole - CALL Outfld( TRIM(SpcName), SUM(eflx(:nY,:nZ,N), DIM=2) * 1.0E-04 / cnst_mw(N) * avogad, nY, LCHNK ) + CALL Outfld( TRIM(SpcName), SUM(eflx(:nY,:nZ-1,N), DIM=2) * 1.0E-04 / cnst_mw(N) * avogad, nY, LCHNK ) SpcName = TRIM(cnst_name(N))//'_CMXF' - CALL Outfld( TRIM(SpcName), SUM(eflx(:nY,:nZ,N), DIM=2), nY, LCHNK ) + CALL Outfld( TRIM(SpcName), SUM(eflx(:nY,:nZ-1,N), DIM=2), nY, LCHNK ) ENDDO !----------------------------------------------------------------------- diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index 5e00fddcdb..08733b6d85 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -7,7 +7,7 @@ module chem_mods implicit none save - INTEGER, PARAMETER :: nTracersMax = 238 ! Must be equal to chem_nadv + INTEGER, PARAMETER :: nTracersMax = 251 ! Must be equal to chem_nadv INTEGER :: nTracers CHARACTER(LEN=255) :: tracerNames(nTracersMax) CHARACTER(LEN=255) :: tracerLongNames(nTracersMax) @@ -61,7 +61,7 @@ module chem_mods rxntot = 212, & ! number of total reactions gascnt = 172, & ! number of gas phase reactions nabscol = 2, & ! number of absorbing column densities - gas_pcnst = 318, & ! number of "gas phase" species + gas_pcnst = 331, & ! number of "gas phase" species nfs = 6, & ! number of "fixed" species relcnt = 0, & ! number of relationship species grpcnt = 0, & ! number of group members diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 7b568b72b8..f1bff359d2 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -61,6 +61,9 @@ module chemistry use chem_mods, only : mapCnst use chem_mods, only : map2chm use chem_mods, only : map2MAM4 +#if defined( MODAL_AERO ) + use modal_aero_data, only : ntot_amode +#endif use mo_tracname, only : solsym @@ -107,12 +110,31 @@ module chemistry type(physics_buffer_desc), pointer :: hco_pbuf2d(:,:) ! Pointer to 2D pbuf + ! Mimic code in sfcvmr_mod.F90 + TYPE :: SfcMrObj + CHARACTER(LEN=63) :: FldName ! Field name + INTEGER :: SpcID ! ID in species database + TYPE(SfcMrObj), POINTER :: Next ! Next element in list + END TYPE SfcMrObj + + ! Heat of linked list with SfcMrObj objects + TYPE(SfcMrObj), POINTER :: SfcMrHead => NULL() + + ! Field prefix + CHARACTER(LEN=63), PARAMETER :: Prefix_SfcVMR = 'VMR_' + + ! Indices of critical species in GEOS-Chem - INTEGER :: iH2O, iO3, iCO2 - INTEGER :: iO, iH, iO2, iPSO4 - REAL(r8) :: MWPSO4, MWO3 + INTEGER :: iH2O, iO3, iCO2, iSO4 + INTEGER :: iO, iH, iO2 + REAL(r8) :: MWO3 ! Indices of critical species in the constituent list - INTEGER :: cQ, cH2O + INTEGER :: cQ, cH2O, cH2SO4 + ! Indices of critical species in the solsym list + INTEGER :: l_H2SO4, l_SO4 +#if defined( MODAL_AERO ) + INTEGER, ALLOCATABLE :: iSulf(:) +#endif ! Indices in the physics buffer INTEGER :: NDX_PBLH ! PBL height [m] @@ -196,7 +218,7 @@ subroutine chem_register use mo_sim_dat, only : set_sim_dat use mo_chem_utls, only : get_spc_ndx use chem_mods, only : drySpc_ndx -#if defined( MODAL_AERO_4MODE ) +#if defined( MODAL_AERO ) use aero_model, only : aero_model_register use modal_aero_data, only : nspec_max use modal_aero_data, only : ntot_amode, nspec_amode @@ -496,9 +518,10 @@ subroutine chem_register ENDIF ENDDO ! Get constituent index of specific humidity - CALL cnst_get_ind('Q', cQ, abort=.True.) - CALL cnst_get_ind('H2O', cH2O, abort=.True.) - + CALL cnst_get_ind('Q', cQ, abort=.True.) + CALL cnst_get_ind('H2O', cH2O, abort=.True.) + CALL cnst_get_ind('H2SO4', cH2SO4, abort=.True.) + !============================================================== ! Get mapping between dry deposition species and species set !============================================================== @@ -543,8 +566,12 @@ subroutine chem_register ALLOCATE(map2MAM4(nspec_max,ntot_amode), STAT=IERR) IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate map2MAM4') + ALLOCATE(iSulf(ntot_amode), STAT=IERR) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate iSulf') + ! Initialize indices map2MAM4(:,:) = -1 + iSulf(:) = -1 DO M = 1, ntot_amode DO L = 1, nspec_amode(M) @@ -552,9 +579,9 @@ subroutine chem_register CASE ( 'BC_' ) SELECT CASE ( to_upper(xname_massptr(L,M)(4:5)) ) CASE ( 'A1' ) - map2MAM4(L,M) = Ind_('BCPI') + CALL cnst_get_ind( 'BCPI', map2MAM4(L,M) ) CASE ( 'A4' ) - map2MAM4(L,M) = Ind_('BCPO') + CALL cnst_get_ind( 'BCPO', map2MAM4(L,M) ) END SELECT CASE ( 'DST' ) SELECT CASE ( to_upper(xname_massptr(L,M)(5:6)) ) @@ -563,33 +590,34 @@ subroutine chem_register ! DST3 - Dust aerosol, Reff = 2.4 micrometers ! DST4 - Dust aerosol, Reff = 4.5 micrometers CASE ( 'A1' ) - map2MAM4(L,M) = Ind_('DST1') + CALL cnst_get_ind( 'DST1', map2MAM4(L,M) ) CASE ( 'A2' ) - map2MAM4(L,M) = Ind_('DST1') + CALL cnst_get_ind( 'DST1', map2MAM4(L,M) ) CASE ( 'A3' ) - map2MAM4(L,M) = Ind_('DST4') + CALL cnst_get_ind( 'DST4', map2MAM4(L,M) ) END SELECT - CASE ( 'SOA' ) - map2MAM4(L,M) = Ind_('SOAS') + !CASE ( 'SOA' ) + ! CALL cnst_get_ind( 'SOAS', map2MAM4(L,M) ) CASE ( 'SO4' ) - map2MAM4(L,M) = Ind_('SO4') + CALL cnst_get_ind( 'SO4', map2MAM4(L,M) ) + iSulf(M) = L CASE ( 'NCL' ) SELECT CASE ( to_upper(xname_massptr(L,M)(5:6)) ) ! SALA - Fine (0.01-0.05 micros) sea salt aerosol ! SALC - Coarse (0.5-8 micros) sea salt aerosol CASE ( 'A1' ) - map2MAM4(L,M) = Ind_('SALA') + CALL cnst_get_ind( 'SALA', map2MAM4(L,M) ) CASE ( 'A2' ) - map2MAM4(L,M) = Ind_('SALA') + CALL cnst_get_ind( 'SALA', map2MAM4(L,M) ) CASE ( 'A3' ) - map2MAM4(L,M) = Ind_('SALC') + CALL cnst_get_ind( 'SALC', map2MAM4(L,M) ) END SELECT CASE ( 'POM' ) SELECT CASE ( to_upper(xname_massptr(L,M)(5:6)) ) CASE ( 'A1' ) - map2MAM4(L,M) = Ind_('OCPI') + CALL cnst_get_ind( 'OCPI', map2MAM4(L,M) ) CASE ( 'A4' ) - map2MAM4(L,M) = Ind_('OCPO') + CALL cnst_get_ind( 'OCPO', map2MAM4(L,M) ) END SELECT END SELECT ENDDO @@ -647,7 +675,7 @@ subroutine chem_readnl(nlfile) use cam_abortutils, only : endrun use units, only : getunit, freeunit use namelist_utils, only : find_group_name -#if defined( MODAL_AERO_4MODE ) +#if defined( MODAL_AERO ) use aero_model, only : aero_model_readnl use dust_model, only : dust_readnl #endif @@ -941,14 +969,14 @@ subroutine chem_init(phys_state, pbuf2d) use Phys_Grid, only : get_Area_All_p use hycoef, only : ps0, hyai, hybi, hyam - use seq_drydep_mod, only : drydep_method, DD_XLND + use seq_drydep_mod, only : drydep_method, DD_XLND, DD_XATM use gas_wetdep_opts, only : gas_wetdep_method use mo_neu_wetdep, only : neu_wetdep_init -#if defined( MODAL_AERO_4MODE ) +#if defined( MODAL_AERO ) use aero_model, only : aero_model_init use mo_setsox, only : sox_inti - use mo_drydep, only : drydep_inti_landuse + use mo_drydep, only : drydep_inti use modal_aero_data, only : ntot_amode, nspec_amode use modal_aero_data, only : xname_massptr #endif @@ -1127,7 +1155,7 @@ subroutine chem_init(phys_state, pbuf2d) CALL Read_Input_File( Input_Opt = Input_Opt, & State_Grid = maxGrid, & RC = RC ) - + ! First setup directories Input_Opt%Chem_Inputs_Dir = TRIM(gc_cheminputs) Input_Opt%SpcDatabaseFile = TRIM(speciesDB) @@ -1139,7 +1167,7 @@ subroutine chem_init(phys_state, pbuf2d) ! onlineAlbedo -> True (use CLM albedo) ! -> False (read monthly-mean albedo from HEMCO) - Input_Opt%onlineAlbedo = .True. + Input_Opt%onlineAlbedo = .False. ! onlineLandTypes -> True (use CLM landtypes) ! -> False (read landtypes from HEMCO) @@ -1151,6 +1179,11 @@ subroutine chem_init(phys_state, pbuf2d) ! applyQtend: apply tendencies of water vapor to specific humidity Input_Opt%applyQtend = .False. + + IF ( .NOT. Input_Opt%LSOA ) THEN + CALL ENDRUN('CESM2-GC requires the complex SOA option to be on!') + ENDIF + ENDIF CALL Validate_Directories( Input_Opt, RC ) @@ -1469,7 +1502,7 @@ subroutine chem_init(phys_state, pbuf2d) ENDDO ENDIF -#if defined( MODAL_AERO_4MODE ) +#if defined( MODAL_AERO ) ! Initialize aqueous chem CALL SOx_inti() @@ -1477,13 +1510,14 @@ subroutine chem_init(phys_state, pbuf2d) CALL aero_model_init( pbuf2d ) ! Initialize land maps for aerosol dry deposition - IF ( drydep_method == DD_XLND ) THEN - CALL drydep_inti_landuse( depvel_lnd_file, & - clim_soilw_file ) + IF ( drydep_method == DD_XATM .OR. drydep_method == DD_XLND ) THEN + CALL drydep_inti( depvel_lnd_file, & + clim_soilw_file, & + season_wes_file ) ELSE - Write(iulog,'(a,a)') ' drydep_method is set to: ', TRIM(drydep_method) - CALL ENDRUN('drydep_method must be DD_XLND to compute land maps for aerosol' // & - ' dry deposition!') + IF ( masterProc ) Write(iulog,'(a,a)') ' drydep_method is set to: ', TRIM(drydep_method) + CALL ENDRUN('drydep_method must be DD_XLND or DD_XATM to compute land '// & + 'maps for aerosol dry deposition!') ENDIF #endif @@ -1643,24 +1677,21 @@ subroutine chem_init(phys_state, pbuf2d) iH2O = Ind_('H2O') iO3 = Ind_('O3') iCO2 = Ind_('CO2') + iSO4 = Ind_('SO4') ! The following indices are needed to compute invariants iO = Ind_('O') iH = Ind_('H') iO2 = Ind_('O2') - ! This is used to compute gas-phase H2SO4 production - iPSO4 = Ind_('PSO4') - SpcInfo => State_Chm(BEGCHUNK)%SpcData(iPSO4)%Info - MWPSO4 = REAL(SpcInfo%MW_g,r8) - ! Free pointer - SpcInfo => NULL() - ! This is used to compute overhead ozone column SpcInfo => State_Chm(BEGCHUNK)%SpcData(iO3)%Info MWO3 = REAL(SpcInfo%MW_g,r8) ! Free pointer SpcInfo => NULL() + l_H2SO4 = get_spc_ndx('H2SO4') + l_SO4 = get_spc_ndx('SO4') + ! Get indices for physical fields in physics buffer NDX_PBLH = pbuf_get_index('pblh' ) NDX_FSDS = pbuf_get_index('FSDS' ) @@ -1700,8 +1731,6 @@ subroutine chem_init(phys_state, pbuf2d) hco_pbuf2d => pbuf2d - If ( MasterProc ) Write(iulog,*) "hco_pbuf2d now points to pbuf2d" - ! Cleanup Call Cleanup_State_Grid( maxGrid, RC ) @@ -1842,6 +1871,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use phys_grid, only : get_ncols_p, get_rlat_all_p, get_rlon_all_p + use mo_chem_utls, only : get_spc_ndx use chem_mods, only : drySpc_ndx, map2GC_dryDep use chem_mods, only : nfs, indexm, gas_pcnst use mo_mean_mass, only : set_mean_mass @@ -1850,10 +1880,12 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use mo_ghg_chem, only : ghg_chem_set_flbc use mo_neu_wetdep, only : neu_wetdep_tend use gas_wetdep_opts, only : gas_wetdep_method -#if defined( MODAL_AERO_4MODE ) +#if defined( MODAL_AERO ) use modal_aero_data, only : ntot_amode, nspec_amode - use modal_aero_data, only : lmassptr_amode - use modal_aero_data, only : xname_massptr + use modal_aero_data, only : nspec_max, nsoa + use modal_aero_data, only : lmassptr_amode, numptr_amode + use modal_aero_data, only : lptr_so4_a_amode + use modal_aero_data, only : lptr2_soa_a_amode, lptr2_soa_g_amode #endif use Olson_Landmap_Mod, only : Compute_Olson_Landmap @@ -1876,9 +1908,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use PBL_Mix_Mod, only : Compute_PBL_Height use UCX_Mod, only : Set_H2O_Trac use CMN_FJX_MOD, only : ZPJ - USE FAST_JX_MOD, only : RXN_NO2, RXN_O3_1, RXN_O3_2a + use FAST_JX_MOD, only : RXN_NO2, RXN_O3_1, RXN_O3_2a use State_Diag_Mod, only : get_TagInfo use Unitconv_Mod, only : Convert_Spc_Units + use State_Chm_Mod, only : Ind_ use Strat_Chem_Mod, only : Strat_TrID_GC, GC_Bry_TrID, NSCHEM use Strat_Chem_Mod, only : BrPtrDay, BrPtrNight, PLVEC, STRAT_OH @@ -1888,7 +1921,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use CESMGC_Diag_Mod, only : wetdep_name, wtrate_name use Tropopause, only : Tropopause_findChemTrop, Tropopause_Find - use HCO_Utilities_GC_Mod ! Utility routines for GC-HEMCO interface + use HCO_Interface_GC_Mod ! Utility routines for GC-HEMCO interface ! For calculating SZA use Orbit, only : zenith @@ -1931,7 +1964,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) LOGICAL :: lq(pcnst) ! Indexing - INTEGER :: N, M, P, SM, ND + INTEGER :: K, N, M, P, SM, ND INTEGER :: I, J, L, nX, nY, nZ INTEGER :: LCHNK, NCOL @@ -1968,12 +2001,28 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! For aerosol formation REAL(r8) :: del_h2so4_gasprod(state%NCOL,PVER) + REAL(r8) :: vmr0(state%NCOL,PVER,gas_pcnst) REAL(r8) :: vmr1(state%NCOL,PVER,gas_pcnst) + REAL(r8) :: vmr2(state%NCOL,PVER,gas_pcnst) + REAL(r8) :: wetdepflx(pcols,pcnst) ! Wet deposition fluxes (kg/m2/s) #if defined( MODAL_AERO ) - REAL(r8) :: binRatio(MAXVAL(nspec_amode(:)),ntot_amode,state%NCOL,PVER) + REAL(r8) :: binRatio(nspec_max,ntot_amode,state%NCOL,PVER) + + REAL(r8) :: SO4_gasRatio(state%NCOL,PVER) + + ! For SOA mapping + REAL(r8) :: totMass(state%NCOL,PVER) + REAL(r8) :: bulkMass(state%NCOL,PVER) + REAL(r8) :: tmpMW_g + CHARACTER(LEN=64) :: speciesName_1, speciesName_2, speciesName_3, speciesName_4 + INTEGER :: speciesId_1, speciesId_2, speciesId_3, speciesId_4 + INTEGER :: iMap, nMapping, iBin, binSOA_1, binSOA_2 + INTEGER :: K1, K2, K3, K4 + LOGICAL :: isSOA_aerosol + #endif ! For emissions @@ -2006,7 +2055,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) REAL(r8) :: Sd_Ice, Sd_Lnd, Sd_Avg, Frc_Ice ! Estimating cloud optical depth - REAL(r8) :: cld(PCOLS,PVER) REAL(r8) :: TauCli(PCOLS,PVER) REAL(r8) :: TauClw(PCOLS,PVER) REAL(r8), PARAMETER :: re_m = 1.0e-05_r8 ! Cloud drop radius in m @@ -2016,11 +2064,12 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Calculating SZA REAL(r8) :: Calday - CHARACTER(LEN=255) :: SpcName - CHARACTER(LEN=255) :: Prefix, FieldName - LOGICAL :: FND - INTEGER :: SpcId - TYPE(Species), POINTER :: SpcInfo + CHARACTER(LEN=255) :: SpcName + CHARACTER(LEN=255) :: Prefix, FieldName + LOGICAL :: FND + INTEGER :: SpcId + TYPE(Species), POINTER :: SpcInfo + TYPE(SfcMrObj), POINTER :: iSfcMrObj CHARACTER(LEN=63) :: OrigUnit @@ -2057,6 +2106,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) cmfdqr => NULL() pbuf_chnk=> NULL() pbuf_ik => NULL() + pbuf_i => NULL() ! LCHNK: which chunk we have on this process LCHNK = state%LCHNK @@ -2138,11 +2188,11 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) MMR_Beg = 0.0e+0_r8 MMR_End = 0.0e+0_r8 DO N = 1, pcnst + IF ( mapCnst(N) > 0 ) lq(N) = .True. M = map2GC(N) IF ( M <= 0 ) CYCLE MMR_Beg(:nY,:nZ,M) = state%q(:nY,nZ:1:-1,N) State_Chm(LCHNK)%Species(1,:nY,:nZ,M) = REAL(MMR_Beg(:nY,:nZ,M),fp) - lq(N) = .True. ENDDO ! We need to let CAM know that 'H2O' and 'Q' are identical @@ -2153,6 +2203,54 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) SlsData(:,:,:) = 0.0e+0_r8 CALL get_short_lived_species( SlsData, LCHNK, nY, pbuf ) + IF ( iStep == 1 ) THEN + ! Retrieve list of species with surface boundary conditions (copied from + ! sfcvmr_mod.F90) + + ! Head of linked list + SfcMrHead => NULL() + iSfcMrObj => NULL() + SpcInfo => NULL() + + ! Loop over all species + DO N = 1, State_Chm(BEGCHUNK)%nSpecies + ! Species information + SpcInfo => State_Chm(BEGCHUNK)%SpcData(N)%Info + + ! Check if field exists (note: this needs to be less than 16 + ! characters long) + FieldName = 'HCO_'//TRIM(Prefix_SfcVMR)//TRIM(to_upper(SpcInfo%Name)) + M = pbuf_get_index(FieldName, RC) + IF ( M > 0 ) THEN + + ! Must have positive, non-zero MW + IF ( SpcInfo%MW_g <= 0.0_fp ) THEN + ErrMsg = 'Cannot use surface boundary condition for species ' & + // TRIM(SpcInfo%Name) // ' due to invalid MW!' + CALL ENDRUN(TRIM(ErrMsg)) + ENDIF + + ! Create new object, add to list + ALLOCATE( iSfcMrObj, STAT=RC ) + CALL GC_CheckVar( 'sfcvmr_mod.F90:iSfcMrObj', 0, RC ) + IF ( RC /= GC_SUCCESS ) CALL ENDRUN('Failure while allocating iSfcMrObj') + + iSfcMrObj%SpcID = N + iSfcMrObj%FldName = FieldName + iSfcMrObj%Next => SfcMrHead + SfcMrHead => iSfcMrObj + IF ( rootChunk ) THEN + WRITE( 6, 110 ) TRIM( SpcInfo%Name ), TRIM( iSfcMrObj%FldName ) + 110 FORMAT( '--> ', a, ' will use prescribed surface boundary ', & + 'conditions from field ', a ) + ENDIF + + ! Free the pointer + iSfcMrObj => NULL() + ENDIF + ENDDO + ENDIF + !----------------------------------------------------------------------- ! ... Set atmosphere mean mass !----------------------------------------------------------------------- @@ -2169,63 +2267,223 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) State_Chm(LCHNK)%Species(1,:nY,:nZ,M) = REAL(SlsData(:nY,nZ:1:-1,N),fp) ENDDO - DO N = 1, gas_pcnst - ! See definition of map2chm - M = map2chm(N) - IF ( M > 0 ) THEN - vmr0(:nY,:nZ,N) = State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,M) * & - MWDry / adv_mass(N) - ! We'll substract concentrations after chemistry later - mmr_tend(:nY,:nZ,N) = REAL(State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,M),r8) - ELSEIF ( M < 0 ) THEN - vmr0(:nY,:nZ,N) = state%q(:nY,:nZ,-M) * & - MWDry / adv_mass(N) - mmr_tend(:nY,:nZ,N) = state%q(:nY,:nZ,-M) - ENDIF - ENDDO - -#if defined( MODAL_AERO_4MODE ) - ! First reset State_Chm%Species to zero for aerosols +#if defined( MODAL_AERO ) + ! First reset State_Chm%Species to zero out MAM-inherited GEOS-Chem aerosols DO M = 1, ntot_amode DO SM = 1, nspec_amode(M) - P = map2MAM4(SM,M) - IF ( P > 0 ) State_Chm(LCHNK)%Species(1,:nY,:nZ,P) = 0.0e+00_fp + P = map2MAM4(SM,M) ! Constituent index for GEOS-Chem + IF ( P > 0 ) K = map2GC(P) ! Index in State_Chm + IF ( K > 0 ) State_Chm(LCHNK)%Species(1,:nY,:nZ,K) = 0.0e+00_fp ENDDO ENDDO - ! Map and flip aerosols + ! Map and vertically flip aerosols DO M = 1, ntot_amode DO SM = 1, nspec_amode(M) - ! TMMF - Should there be a ratio of molar weights involved? - P = map2MAM4(SM,M) + P = map2MAM4(SM,M) ! Constituent index for GEOS-Chem IF ( P <= 0 ) CYCLE N = lmassptr_amode(SM,M) + K = map2GC(P) ! Index in State_Chm + ! /!\ MAM aerosols (with cnst index N) is mapped onto GEOS-Chem + ! species (with cnst index P, which corresponds to index K in + ! State_Chm) + ! Multiple MAM4 bins are mapped to same GEOS-Chem species - State_Chm(LCHNK)%Species(1,:nY,:nZ,P) = State_Chm(LCHNK)%Species(1,:nY,:nZ,P) & - + REAL(state%q(:nY,nZ:1:-1,N),fp) + State_Chm(LCHNK)%Species(1,:nY,:nZ,K) = State_Chm(LCHNK)%Species(1,:nY,:nZ,K) & + + REAL(state%q(:nY,nZ:1:-1,N),fp) * & + adv_mass(mapCnst(P)) / & + adv_mass(mapCnst(N)) ENDDO ENDDO + + ! Compute ratios of bin to bulk mass + binRatio = 0.0e+00_r8 DO M = 1, ntot_amode DO SM = 1, nspec_amode(M) P = map2MAM4(SM,M) IF ( P <= 0 ) CYCLE - ! Overwrite MMR_Beg with MAM value - MMR_Beg(:nY,:nZ,P) = State_Chm(LCHNK)%Species(1,:nY,:nZ,P) + K = map2GC(P) ! Index in State_Chm N = lmassptr_amode(SM,M) + IF ( N < 0 ) CYCLE DO J = 1, nY DO L = 1, nZ - IF ( State_Chm(LCHNK)%Species(1,J,nZ+1-L,P) > 0.0e+00_r8 ) THEN - binRatio(SM,M,J,L) = REAL(state%q(J,L,N),r8) & - / State_Chm(LCHNK)%Species(1,J,nZ+1-L,P) - ELSE - binRatio(SM,M,J,L) = 0.0e+00_r8 + IF ( State_Chm(LCHNK)%Species(1,J,nZ+1-L,K) > 0.0e+00_r8 ) THEN + binRatio(SM,M,J,L) = state%q(J,L,N) & + * adv_mass(mapCnst(P)) / adv_mass(mapCnst(N)) & + / REAL(State_Chm(LCHNK)%Species(1,J,nZ+1-L,K), r8) ENDIF ENDDO ENDDO + ! Overwrite MMR_Beg with value from MAM + MMR_Beg(:nY,:nZ,K) = State_Chm(LCHNK)%Species(1,:nY,:nZ,K) ENDDO ENDDO + + ! Deal with secondary organic aerosols (SOAs). This mapping is using the + ! complex SOA option in GEOS-Chem. + ! MAM uses five volatility bins spanning saturation concentrations from 0.01 + ! to 100 ug/m3 (logarithmically). The complex SOA option has four volatility + ! bins that 0.1 to 100 ug/m3. We lump the lowest two bins in CESM2 to the + ! lowest bin in GEOS-Chem. + ! + ! The mapping goes as follows: + ! TSOA0 + ASOAN + SOAIE + SOAGX <- soa1_a* + soa2_a* + ! TSOA1 + ASOA1 <- soa3_a* + ! TSOA2 + ASOA2 <- soa4_a* + ! TSOA3 + ASOA3 <- soa5_a* + ! TSOG0 <- SOAG0 + SOAG1 + ! TSOG1 + ASOG1 <- SOAG2 + ! TSOG2 + ASOG2 <- SOAG3 + ! TSOG3 + ASOG3 <- SOAG4 + + IF ( iStep > 1 ) THEN + ! Do not perform this mapping on initialization as we first want to + ! overwrite soa*_a* with the GEOS-Chem SOAs. + nMapping = 8 + DO iMap = 1, nMapping + speciesName_1 = '' + speciesName_2 = '' + speciesName_3 = '' + speciesName_4 = '' + IF ( iMap == 1 ) THEN + binSOA_1 = 1 + binSOA_2 = 2 + speciesName_1 = 'TSOA0' + speciesName_2 = 'ASOAN' + speciesName_3 = 'SOAIE' + speciesName_4 = 'SOAGX' + ELSEIF ( iMap == 2 ) THEN + binSOA_1 = 3 + binSOA_2 = 3 + speciesName_1 = 'TSOA1' + speciesName_2 = 'ASOA1' + ELSEIF ( iMap == 3 ) THEN + binSOA_1 = 4 + binSOA_2 = 4 + speciesName_1 = 'TSOA2' + speciesName_2 = 'ASOA2' + ELSEIF ( iMap == 4 ) THEN + binSOA_1 = 5 + binSOA_2 = 5 + speciesName_1 = 'TSOA3' + speciesName_2 = 'ASOA3' + ELSEIF ( iMap == 5 ) THEN + binSOA_1 = 1 + binSOA_2 = 2 + speciesName_1 = 'TSOG0' + speciesName_2 = 'TSOG0' + ELSEIF ( iMap == 6 ) THEN + binSOA_1 = 3 + binSOA_2 = 3 + speciesName_1 = 'TSOG1' + speciesName_2 = 'ASOG1' + ELSEIF ( iMap == 7 ) THEN + binSOA_1 = 4 + binSOA_2 = 4 + speciesName_1 = 'TSOG2' + speciesName_2 = 'ASOG2' + ELSEIF ( iMap == 8 ) THEN + binSOA_1 = 5 + binSOA_2 = 5 + speciesName_1 = 'TSOG3' + speciesName_2 = 'ASOG3' + ELSE + CALL ENDRUN('Unknown SOA mapping!') + ENDIF + isSOA_aerosol = .False. + IF ( iMap <= 4 ) isSOA_aerosol = .True. + + ! Compute total mass from GEOS-Chem species. This sets the ratio between + ! speciesId_1 and speciesId_2 + totMass(:nY,:nZ) = 0.0e+00_r8 + + CALL cnst_get_ind( speciesName_1, speciesId_1, abort=.True. ) + CALL cnst_get_ind( speciesName_2, speciesId_2, abort=.False. ) + CALL cnst_get_ind( speciesName_3, speciesId_3, abort=.False. ) + CALL cnst_get_ind( speciesName_4, speciesId_4, abort=.False. ) + IF ( speciesId_1 > 0 ) totMass(:nY,:nZ) = totMass(:nY,:nZ) + state%q(:nY,:nZ,speciesId_1) + IF ( speciesId_2 > 0 ) totMass(:nY,:nZ) = totMass(:nY,:nZ) + state%q(:nY,:nZ,speciesId_2) + IF ( speciesId_3 > 0 ) totMass(:nY,:nZ) = totMass(:nY,:nZ) + state%q(:nY,:nZ,speciesId_3) + IF ( speciesId_4 > 0 ) totMass(:nY,:nZ) = totMass(:nY,:nZ) + state%q(:nY,:nZ,speciesId_4) + + ! Compute total bulk mass from MAM + bulkMass(:nY,:nZ) = 0.0e+00_r8 + IF ( isSOA_aerosol ) THEN + DO iBin = binSOA_1, binSOA_2 + DO M = 1, ntot_amode + N = lptr2_soa_a_amode(M,iBin) + IF ( N <= 0 ) CYCLE + tmpMW_g = adv_mass(mapCnst(N)) + bulkMass(:nY,:nZ) = bulkMass(:nY,:nZ) + state%q(:nY,:nZ,N) + ENDDO + ENDDO + ELSE + DO iBin = binSOA_1, binSOA_2 + N = lptr2_soa_g_amode(iBin) + IF ( N <= 0 ) CYCLE + tmpMW_g = adv_mass(mapCnst(N)) + bulkMass(:nY,:nZ) = bulkMass(:nY,:nZ) + state%q(:nY,:nZ,N) + ENDDO + ENDIF + + K1 = Ind_(speciesName_1) + K2 = Ind_(speciesName_2) + K3 = Ind_(speciesName_3) + K4 = Ind_(speciesName_4) + DO J = 1, nY + DO L = 1, nZ + IF ( totMass(J,L) > 0.0e+00_r8 ) THEN + IF ( K1 > 0 ) State_Chm(LCHNK)%Species(1,J,L,K1) = state%q(J,nZ+1-L,speciesId_1) / totMass(J,nZ+1-L) * bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_1)) / tmpMW_g + IF ( K2 > 0 ) State_Chm(LCHNK)%Species(1,J,L,K2) = state%q(J,nZ+1-L,speciesId_2) / totMass(J,nZ+1-L) * bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_2)) / tmpMW_g + IF ( K3 > 0 ) State_Chm(LCHNK)%Species(1,J,L,K3) = state%q(J,nZ+1-L,speciesId_3) / totMass(J,nZ+1-L) * bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_3)) / tmpMW_g + IF ( K4 > 0 ) State_Chm(LCHNK)%Species(1,J,L,K4) = state%q(J,nZ+1-L,speciesId_4) / totMass(J,nZ+1-L) * bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_4)) / tmpMW_g + ELSE + IF ( K1 == K2 ) THEN + State_Chm(LCHNK)%Species(1,J,L,K1) = bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_1)) / tmpMW_g + ELSE + State_Chm(LCHNK)%Species(1,J,L,K1) = bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_1)) / tmpMW_g / 2.0_r8 + State_Chm(LCHNK)%Species(1,J,L,K2) = bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_1)) / tmpMW_g / 2.0_r8 + ENDIF + ENDIF + ENDDO + ENDDO + IF ( K1 > 0 ) MMR_Beg(:nY,:nZ,K1) = State_Chm(LCHNK)%Species(1,:nY,:nZ,K1) + IF ( K2 > 0 ) MMR_Beg(:nY,:nZ,K2) = State_Chm(LCHNK)%Species(1,:nY,:nZ,K2) + IF ( K3 > 0 ) MMR_Beg(:nY,:nZ,K4) = State_Chm(LCHNK)%Species(1,:nY,:nZ,K3) + IF ( K4 > 0 ) MMR_Beg(:nY,:nZ,K3) = State_Chm(LCHNK)%Species(1,:nY,:nZ,K4) + ENDDO + ENDIF + + ! Add gas-phase H2SO4 to GEOS-Chem SO4 (which lumps SO4 aerosol and gaseous) + K = iSO4 + N = cH2SO4 + IF ( K > 0 .AND. N > 0 .AND. l_SO4 > 0 ) THEN + State_Chm(LCHNK)%Species(1,:nY,:nZ,K) = State_Chm(LCHNK)%Species(1,:nY,:nZ,K) & + + REAL(state%q(:nY,nZ:1:-1,N),fp) * & + adv_mass(l_SO4) / adv_mass(mapCnst(N)) + ! SO4_gasRatio is in mol/mol + SO4_gasRatio(:nY,:nZ) = state%q(:nY,:nZ,N) & + * adv_mass(l_SO4) / adv_mass(mapCnst(N)) & + / State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,K) + MMR_Beg(:nY,:nZ,K) = State_Chm(LCHNK)%Species(1,:nY,:nZ,K) + ENDIF #endif + DO N = 1, gas_pcnst + ! See definition of map2chm + M = map2chm(N) + IF ( M > 0 ) THEN + vmr0(:nY,:nZ,N) = State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,M) * & + MWDry / adv_mass(N) + ! We'll substract concentrations after chemistry later + mmr_tend(:nY,:nZ,N) = REAL(State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,M),r8) + ELSEIF ( M < 0 ) THEN + vmr0(:nY,:nZ,N) = state%q(:nY,:nZ,-M) * & + MWDry / adv_mass(N) + mmr_tend(:nY,:nZ,N) = state%q(:nY,:nZ,-M) + ENDIF + ENDDO + ! If H2O tendencies are propagated to specific humidity, then make sure ! that Q actually applies tendencies IF ( Input_Opt%applyQtend ) lq(cQ) = .True. @@ -2325,58 +2583,45 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) TauCli = 0.0e+0_r8 TauClw = 0.0e+0_r8 - ! Note: all using CAM vertical convention (1 = TOA) - ! Calculation is based on that done for MOZART + cldW(:nY,:nZ) = state%q(:nY,:nZ,ixCldLiq) + state%q(:nY,:nZ,ixCldIce) + IF ( ixNDrop > 0 ) nCldWtr(:nY,:nZ) = state%q(:nY,:nZ,ixNDrop) + DO J = 1, nY DO L = nZ, 1, -1 - cldW(J,L) = state%q(J,L,ixCldLiq) + state%q(J,L,ixCldIce) - ! Convert water mixing ratio [kg/kg] to water content [g/m^3] - IF ( cldW(J,L) * state%pmid(J,L) / & - (state%T(J,L) * 287.0e+00_r8) * 1.0e+03_r8 <= 0.01_r8 .AND. & - cldFrc(J,L) /= 0.0e+00_r8 ) THEN - cld(J,L) = 0.0e+00_r8 - ELSE - cld(J,L) = cldFrc(J,L) + ! ================================================================= + ! =========== Compute cloud optical depth based on ============ + ! =========== Liao et al. JGR, 104, 23697, 1999 ============ + ! ================================================================= + ! + ! Tau = 3/2 * LWC * dZ / ( \rho_w * r_e ) + ! dZ = - dP / ( \rho_air * g ) + ! since Pint is ascending, we can neglect the minus sign + ! + ! Tau = 3/2 * LWC * dP / ( \rho_air * r_e * \rho_w * g ) + ! LWC / \rho_air = Q + ! + ! Tau = 3/2 * Q * dP / ( r_e * rho_w * g ) + ! Tau(L) = 3/2 * Q(L) * (Pint(L+1) - Pint(L)) / (re * rho_w * g ) + ! Tau(L) = Q(L) * (Pint(L+1) - Pint(L)) * Cnst + ! Then divide by cloud fraction to get the in-cloud optical depth + + ! Unit check: | + ! Q : [kg H2O/kg air] | + ! Pint : [Pa]=[kg air/m/s^2] | + ! re : [m] | = 1.0e-5 + ! rho_w: [kg H2O/m^3] | = 1.0e+3 + ! g : [m/s^2] | = 9.81 + IF ( cldFrc(J,L) > cldMin ) THEN + TauClw(J,L) = state%q(J,L,ixCldLiq) & + * (state%pint(J,L+1)-state%pint(J,L)) & + * cnst / cldFrc(J,L) + TauClw(J,L) = MAX(TauClw(J,L), 0.0e+00_r8) + TauCli(J,L) = state%q(J,L,ixCldIce) & + * (state%pint(J,L+1)-state%pint(J,L)) & + * cnst / cldFrc(J,L) + TauCli(J,L) = MAX(TauCli(J,L), 0.0e+00_r8) ENDIF - IF ( ixNDrop > 0 ) nCldWtr(J,L) = state%q(J,L,ixNDrop) - ENDDO ENDDO - - DO J = 1, nY - IF ( COUNT( cld(J,:nZ) > cldMin ) > 0 ) THEN - DO L = nZ, 1, -1 - ! ================================================================= - ! =========== Compute cloud optical depth based on ============ - ! =========== Liao et al. JGR, 104, 23697, 1999 ============ - ! ================================================================= - ! - ! Tau = 3/2 * LWC * dZ / ( \rho_w * r_e ) - ! dZ = - dP / ( \rho_air * g ) - ! since Pint is ascending, we can neglect the minus sign - ! - ! Tau = 3/2 * LWC * dP / ( \rho_air * r_e * \rho_w * g ) - ! LWC / \rho_air = Q - ! - ! Tau = 3/2 * Q * dP / ( r_e * rho_w * g ) - ! Tau(L) = 3/2 * Q(L) * (Pint(L+1) - Pint(L)) / (re * rho_w * g ) - ! Tau(L) = Q(L) * (Pint(L+1) - Pint(L)) * Cnst - ! - ! Unit check: | - ! Q : [kg H2O/kg air] | - ! Pint : [Pa]=[kg air/m/s^2] | - ! re : [m] | = 1.0e-5 - ! rho_w: [kg H2O/m^3] | = 1.0e+3 - ! g : [m/s^2] | = 9.81 - TauClw(J,L) = state%q(J,L,ixCldLiq) & - * (state%pint(J,L+1)-state%pint(J,L)) & - * cnst - TauClw(J,L) = MAX(TauClw(J,L), 0.0e+00_r8) - TauCli(J,L) = state%q(J,L,ixCldIce) & - * (state%pint(J,L+1)-state%pint(J,L)) & - * cnst - TauCli(J,L) = MAX(TauCli(J,L), 0.0e+00_r8) - ENDDO - ENDIF ENDDO ! Retrieve tropopause level @@ -3244,7 +3489,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) pbuf_chnk => NULL() pbuf_ik => NULL() ENDIF - !CALL HCO_GetPtr( HcoState, 'STRAT_OH', STRAT_OH, RC, FOUND=FND ) ENDIF ENDIF @@ -3698,6 +3942,39 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF ENDIF + ! Here, we apply surface mixing ratios for long-lived species + ! (copied from sfcvmr_mod.F90) + ! Loop over all objects + iSfcMrObj => SfcMrHead + DO WHILE( ASSOCIATED( iSfcMrObj ) ) + + ! Get concentration for this species + tmpIdx = pbuf_get_index(TRIM(iSfcMrObj%FldName), RC) + IF ( tmpIdx < 0 .OR. (iStep == 1) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(iSfcMrObj%FldName) + ELSE + CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) + + ! Set mixing ratio in PBL + SpcInfo => State_Chm(LCHNK)%SpcData(iSfcMrObj%SpcID)%Info + N = SpcInfo%ModelID + IF ( N > 0 ) THEN + DO L = 1, nZ + DO J = 1, nY + IF ( State_Met(LCHNK)%F_UNDER_PBLTOP(1,J,L) > 0.0_fp ) THEN + State_Chm(LCHNK)%Species(1,J,L,N) = & + ( pbuf_i(J) * 1.0e-9_fp ) & + / ( MWDry / SpcInfo%MW_g ) + ENDIF ! end selection of PBL boxes + ENDDO + ENDDO + ENDIF + ENDIF + + ! Point to next element in list + iSfcMrObj => iSfcMrObj%Next + ENDDO + ! Reset photolysis rates ZPJ = 0.0e+0_r8 @@ -3728,6 +4005,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) CALL ENDRUN('Incorrect unit in GEOS-Chem State_Chm%Species') ENDIF + call t_stopf( 'chemdr' ) + ! Save and write J-values to pbuf for HEMCO ! in HCO_IN_JNO2, HCO_IN_JOH FieldName = 'HCO_IN_JNO2' @@ -3764,35 +4043,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) pbuf_i => NULL() ENDIF - call t_stopf( 'chemdr' ) - - !============================================================== - ! ***** W E T D E P O S I T I O N (rainout + washout) ***** - !============================================================== - IF ( Input_Opt%LWetD ) THEN - - IF ( gas_wetdep_method == 'NEU' ) THEN - CALL Neu_wetdep_tend( LCHNK = LCHNK, & - NCOL = NCOL, & - mmr = state%q, & - pmid = state%pmid, & - pdel = state%pdel, & - zint = state%zi, & - tfld = state%t, & - delt = dT, & - prain = PRain, & - nevapr = NEvapr, & - cld = cldFrc, & - cmfdqr = cmfdqr, & - wd_tend = ptend%q, & - wd_tend_int = wetdepflx ) - ELSE - ErrMsg = 'Unknown gas_wetdep_method '//TRIM(gas_wetdep_method) - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ENDIF - DO N = 1, gas_pcnst ! See definition of map2chm M = map2chm(N) @@ -3810,17 +4060,26 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) !============================================================== #if defined( MODAL_AERO ) - - del_h2so4_gasprod = 0.0e+00_fp - ! This needs to be in mol/mol over this timestep - IF ( ( iPSO4 > 0 ) .and. ( MWPSO4 > 0.0e+00_fp ) ) THEN - DO L = 1, nZ - ! Convert from kg SO4/kg to mol/mol - del_h2so4_gasprod(:nY,L) = & - State_Chm(LCHNK)%Species(1,:nY,nZ+1-L,iPSO4) * MWDry / MWPSO4 + ! Repartition SO4 into H2SO4 and so4_a* + IF ( l_H2SO4 > 0 .AND. l_SO4 > 0 ) THEN + P = l_H2SO4 + ! SO4_gasRatio is mol(SO4) (gaseous) / mol(SO4) (gaseous+aerosol) + vmr1(:nY,:nZ,P) = SO4_gasRatio(:nY,:nZ) * vmr1(:nY,:nZ,l_SO4) + ! binRatio is mol(SO4) (current bin) / mol(SO4) (all bins) + DO M = 1, ntot_amode + N = lptr_so4_a_amode(M) + IF ( N <= 0 ) CYCLE + P = mapCnst(N) + vmr1(:nY,:nZ,P) = vmr1(:nY,:nZ,l_SO4) & + * ( 1.0_r8 - SO4_gasRatio(:nY,:nZ) ) & + * binRatio(iSulf(M),M,:nY,:nZ) ENDDO ENDIF + ! Amount of chemically-produced H2SO4 (mol/mol) + del_h2so4_gasprod(:nY,:nZ) = vmr1(:nY,:nZ,l_H2SO4) & + - vmr0(:nY,:nZ,l_H2SO4) + call aero_model_gasaerexch( loffset = iFirstCnst - 1, & ncol = NCOL, & lchnk = LCHNK, & @@ -3843,8 +4102,143 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) vmr0 = vmr0, & vmr = vmr1, & pbuf = pbuf ) + + ! Repartition MAM SOAs following mapping: + ! TSOA0 + ASOAN + SOAIE + SOAGX -> soa1_a* + soa2_a* + ! TSOA1 + ASOA1 -> soa3_a* + ! TSOA2 + ASOA2 -> soa4_a* + ! TSOA3 + ASOA3 -> soa5_a* + ! TSOG0 -> SOAG0 + SOAG1 + ! TSOG1 + ASOG1 -> SOAG2 + ! TSOG2 + ASOG2 -> SOAG3 + ! TSOG3 + ASOG3 -> SOAG4 + + ! Deal with aerosol SOA species + ! First deal with lowest two volatility bins + speciesName_1 = 'TSOA0' + speciesName_2 = 'ASOAN' + speciesName_2 = 'SOAIE' + speciesName_2 = 'SOAGX' + K1 = get_spc_ndx(TRIM(speciesName_1)) + K2 = get_spc_ndx(TRIM(speciesName_2)) + K3 = get_spc_ndx(TRIM(speciesName_3)) + K4 = get_spc_ndx(TRIM(speciesName_4)) + bulkMass(:nY,:nZ) = 0.0e+00_r8 + DO iBin = 1, 2 + DO M = 1, ntot_amode + N = lptr2_soa_a_amode(M,iBin) + IF ( N <= 0 ) CYCLE + bulkMass(:nY,:nZ) = bulkMass(:nY,:nZ) + state%q(:nY,:nZ,N) + ENDDO + ENDDO + DO iBin = 1, 2 + DO M = 1, ntot_amode + N = lptr2_soa_a_amode(M,iBin) + IF ( N <= 0 ) CYCLE + P = mapCnst(N) + IF ( P > 0 .AND. K1 > 0 .AND. K2 > 0 .AND. K3 > 0 .AND. K4 > 0 ) THEN + vmr1(:nY,:nZ,P) = state%q(:nY,:nZ,N) / bulkMass(:nY,:nZ) & + * (vmr1(:nY,:nZ,K1) + vmr1(:nY,:nZ,K2) + & + vmr1(:nY,:nZ,K3) + vmr1(:nY,:nZ,K4)) + ENDIF + ENDDO + ENDDO + + ! Now deal with other volatility bins + DO iBin = 3, nsoa + IF ( iBin == 3 ) THEN + speciesName_1 = 'TSOA1' + speciesName_2 = 'ASOA1' + ELSEIF ( iBin == 4 ) THEN + speciesName_1 = 'TSOA2' + speciesName_2 = 'ASOA2' + ELSEIF ( iBin == 5 ) THEN + speciesName_1 = 'TSOA3' + speciesName_2 = 'ASOA3' + ENDIF + K1 = get_spc_ndx(TRIM(speciesName_1)) + K2 = get_spc_ndx(TRIM(speciesName_2)) + bulkMass(:nY,:nZ) = 0.0e+00_r8 + DO M = 1, ntot_amode + N = lptr2_soa_a_amode(M,iBin) + IF ( N <= 0 ) CYCLE + bulkMass(:nY,:nZ) = bulkMass(:nY,:nZ) + state%q(:nY,:nZ,N) + ENDDO + DO M = 1, ntot_amode + N = lptr2_soa_a_amode(M,iBin) + IF ( N <= 0 ) CYCLE + P = mapCnst(N) + IF ( P > 0 .AND. K1 > 0 .AND. K2 > 0 ) THEN + vmr1(:nY,:nZ,P) = state%q(:nY,:nZ,N) / bulkMass(:nY,:nZ) & + * (vmr1(:nY,:nZ,K1) + vmr1(:nY,:nZ,K2)) + ENDIF + ENDDO + ENDDO + + ! Now deal with gaseous SOA species + ! Deal with lowest two volatility bins + speciesName_1 = 'TSOG0' + K1 = get_spc_ndx(TRIM(speciesName_1)) + N = lptr2_soa_g_amode(1) + P = mapCnst(N) + vmr1(:nY,:nZ,P) = vmr0(:nY,:nZ,P) / (vmr0(:nY,:nZ,P) + vmr0(:nY,:nZ,mapCnst(lptr2_soa_g_amode(2)))) & + * vmr1(:nY,:nZ,K1) + N = lptr2_soa_g_amode(2) + P = mapCnst(N) + vmr1(:nY,:nZ,P) = vmr0(:nY,:nZ,P) / (vmr0(:nY,:nZ,P) + vmr0(:nY,:nZ,mapCnst(lptr2_soa_g_amode(1)))) & + * vmr1(:nY,:nZ,K1) + + ! Deal with other volatility bins + DO iBin = 3, nsoa + N = lptr2_soa_g_amode(iBin) + P = mapCnst(N) + IF ( iBin == 3 ) THEN + speciesName_1 = 'TSOG1' + speciesName_2 = 'ASOG1' + ELSEIF ( iBin == 4 ) THEN + speciesName_1 = 'TSOG2' + speciesName_2 = 'ASOG2' + ELSEIF ( iBin == 5 ) THEN + speciesName_1 = 'TSOG3' + speciesName_2 = 'ASOG3' + ENDIF + K1 = get_spc_ndx(TRIM(speciesName_1)) + K2 = get_spc_ndx(TRIM(speciesName_2)) + IF ( P > 0 .AND. K1 > 0 .AND. K2 > 0 ) vmr1(:nY,:nZ,P) = vmr1(:nY,:nZ,K1) + vmr1(:nY,:nZ,K2) + ENDDO + #endif + !============================================================== + ! ***** W E T D E P O S I T I O N (rainout + washout) ***** + !============================================================== + IF ( Input_Opt%LWetD ) THEN + + IF ( gas_wetdep_method == 'NEU' ) THEN + CALL Neu_wetdep_tend( LCHNK = LCHNK, & + NCOL = NCOL, & + mmr = state%q, & + pmid = state%pmid, & + pdel = state%pdel, & + zint = state%zi, & + tfld = state%t, & + delt = dT, & + prain = PRain, & + nevapr = NEvapr, & + cld = cldFrc, & + cmfdqr = cmfdqr, & + wd_tend = ptend%q, & + wd_tend_int = wetdepflx ) + ELSE + ErrMsg = 'Unknown gas_wetdep_method '//TRIM(gas_wetdep_method) + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + ENDIF + + !============================================================== + ! ***** B O U N D A R Y C O N D I T I O N S ***** + !============================================================== ! Set boundary conditions of long-lived species (most likely ! CH4, OCS, N2O, CFC11, CFC12). ! Note: This will overwrite the UCX boundary conditions @@ -3882,6 +4276,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDDO CALL set_short_lived_species( SlsData, LCHNK, nY, pbuf ) + ! Apply tendencies to GEOS-Chem species DO N = 1, pcnst M = map2GC(N) IF ( M <= 0 ) CYCLE @@ -3893,25 +4288,56 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) + (MMR_End(:nY,:nZ,M)-MMR_Beg(:nY,:nZ,M))/dT ENDDO -#if defined( MODAL_AERO_4MODE ) +#if defined( MODAL_AERO ) ! Here apply tendencies to MAM aerosols ! Initial mass in bin SM is stored as state%q(N) ! Final mass in bin SM is stored as binRatio(SM,M) * State_Chm(P) ! ! We decide to apply chemical tendencies to all MAM aerosols, ! except so4, for which the chemically-produced sulfate gets - ! partitioned in aero_model_gasaerexch + ! partitioned in aero_model_gasaerexch. DO M = 1, ntot_amode DO SM = 1, nspec_amode(M) - P = map2MAM4(SM,M) - IF ( P <= 0 .OR. to_upper(xname_massptr(SM,M)(:3)) == 'SO4' ) CYCLE N = lmassptr_amode(SM,M) - ! Apply MAM4 chemical tendencies owing to GEOS-Chem aerosol processing + P = mapCnst(N) + IF ( P <= 0 ) CYCLE + ! Apply tendency from MAM gasaerexch ptend%q(:nY,:nZ,N) = ptend%q(:nY,:nZ,N) & - + (binRatio(SM,M,:nY,:nZ) * & - REAL(State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,P),r8) & + + (vmr1(:nY,:nZ,P) - vmr0(:nY,:nZ,P))/dT & + * adv_mass(P) / MWDry + P = map2MAM4(SM,M) + IF ( P <= 0 ) CYCLE + K = map2GC(P) + IF ( K <= 0 .or. K == iSO4 ) CYCLE + ! Apply MAM4 chemical tendencies owing to GEOS-Chem aerosol processing + ptend%q(:nY,:nZ,N) = ptend%q(:nY,:nZ,N) & + + (binRatio(SM,M,:nY,:nZ) * & + REAL(State_Chm(LCHNK)%Species(1,:nY,nZ:1:-1,K),r8) & + * adv_mass(mapCnst(N)) / adv_mass(mapCnst(P)) & - state%q(:nY,:nZ,N))/dT ENDDO + N = numptr_amode(M) + P = mapCnst(N) + IF ( P <= 0 ) CYCLE + ptend%q(:nY,:nZ,N) = ptend%q(:nY,:nZ,N) & + + (vmr1(:nY,:nZ,P) - vmr0(:nY,:nZ,P))/dT & + * adv_mass(P) / MWDry + ENDDO + N = cH2SO4 + P = l_H2SO4 + IF ( P > 0 ) THEN + ptend%q(:nY,:nZ,N) = ptend%q(:nY,:nZ,N) & + + (vmr1(:nY,:nZ,P) - vmr0(:nY,:nZ,P))/dT & + * adv_mass(P) / MWDry + ENDIF + DO iBin = 1, nsoa + N = lptr2_soa_g_amode(iBin) + P = mapCnst(N) + IF ( P > 0 ) THEN + ptend%q(:nY,:nZ,N) = ptend%q(:nY,:nZ,N) & + + (vmr1(:nY,:nZ,P) - vmr0(:nY,:nZ,P))/dT & + * adv_mass(P) / MWDry + ENDIF ENDDO #endif @@ -3946,12 +4372,12 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) CALL outfld( 'CT_H2O_GHG', ptend%q(:,:,1), PCOLS, LCHNK ) ENDIF - ! Debug statements - ! Ozone tendencies - IF ( rootChunk ) THEN - Write(iulog,*) " MMR_Beg = ", MMR_Beg(1,:,iO3) - Write(iulog,*) " MMR_End = ", MMR_End(1,:,iO3) - ENDIF + !! Debug statements + !! Ozone tendencies + !IF ( rootChunk ) THEN + ! Write(iulog,*) " MMR_Beg = ", MMR_Beg(1,:,iO3) + ! Write(iulog,*) " MMR_End = ", MMR_End(1,:,iO3) + !ENDIF IF (PRESENT(fh2o)) THEN fh2o(:nY) = 0.0e+0_r8 diff --git a/src/chemistry/geoschem/mo_drydep.F90 b/src/chemistry/geoschem/mo_drydep.F90 deleted file mode 100644 index 66f4b122f0..0000000000 --- a/src/chemistry/geoschem/mo_drydep.F90 +++ /dev/null @@ -1,3494 +0,0 @@ -module mo_drydep - - !--------------------------------------------------------------------- - ! ... Dry deposition velocity input data and code for netcdf input - !--------------------------------------------------------------------- - -!LKE (10/11/2010): added HCN, CH3CN, HCOOH -!LKE (7/30/2015): added new TS1 species (phenooh, iepox, noa, etc.) - - use shr_kind_mod, only : r8 => shr_kind_r8, shr_kind_cl - !use chem_mods, only : gas_pcnst !This needs to be replaced by nTracersMax - use pmgrid, only : plev, plevp - use spmd_utils, only : masterproc, iam - use ppgrid, only : pcols, begchunk, endchunk - !use mo_tracname, only : solsym !This is replaced by tracerNames - use chem_mods, only : tracerNames, nTracersMax, nTracers, drySpc_ndx - use cam_abortutils, only : endrun - use ioFileMod, only : getfil - use pio - use cam_pio_utils, only : cam_pio_openfile, cam_pio_closefile - use cam_logfile, only : iulog - use dyn_grid, only : get_dyn_grid_parm, get_horiz_grid_d - use scamMod, only : single_column - - use seq_drydep_mod, only : nddvels => n_drydep, drydep_list, mapping - use physconst, only : karman - - use State_Chm_Mod, only : ChmState ! Derived type for Chemistry State object - - implicit none - - save - - interface drydep_inti - module procedure dvel_inti_table - module procedure dvel_inti_xactive - module procedure dvel_inti_fromlnd - end interface - - interface drydep_inti_landuse - module procedure dvel_inti_xactive_landuse - end interface - - interface drydep - !module procedure drydep_table - module procedure drydep_xactive - module procedure drydep_fromlnd - end interface - - private - public :: drydep_inti, drydep, set_soilw, chk_soilw, has_drydep - public :: drydep_inti_landuse - public :: drydep_update - public :: drydep_fromlnd - public :: n_land_type, fraction_landuse, drydep_srf_file - - real(r8) :: dels - real(r8), allocatable :: days(:) ! day of year for soilw - real(r8), allocatable :: dvel(:,:,:,:) ! depvel array interpolated to model grid - real(r8), allocatable :: dvel_interp(:,:,:) ! depvel array interpolated to grid and time - integer :: last, next ! day indicies - integer :: ndays ! # of days in soilw file - !integer :: map(gas_pcnst) ! indices for drydep species - integer :: map(nTracersMax) ! indices for drydep species - integer :: nspecies ! number of depvel species in input file - - integer :: pan_ndx, mpan_ndx, no2_ndx, hno3_ndx, o3_ndx, & - h2o2_ndx, onit_ndx, onitr_ndx, ch4_ndx, ch2o_ndx, & - ch3ooh_ndx, pooh_ndx, ch3coooh_ndx, c2h5ooh_ndx, eooh_ndx, & - c3h7ooh_ndx, rooh_ndx, ch3cocho_ndx, co_ndx, ch3coch3_ndx, & - no_ndx, ho2no2_ndx, glyald_ndx, hyac_ndx, ch3oh_ndx, c2h5oh_ndx, & - hydrald_ndx, h2_ndx, Pb_ndx, o3s_ndx, o3inert_ndx, macrooh_ndx, & - xooh_ndx, ch3cho_ndx, isopooh_ndx - integer :: alkooh_ndx, mekooh_ndx, tolooh_ndx, terpooh_ndx, ch3cooh_ndx - integer :: soa_ndx, so4_ndx, cb1_ndx, cb2_ndx, oc1_ndx, oc2_ndx, nh3_ndx, nh4no3_ndx, & - sa1_ndx, sa2_ndx, sa3_ndx, sa4_ndx, nh4_ndx - integer :: soam_ndx, soai_ndx, soat_ndx, soab_ndx, soax_ndx, & - sogm_ndx, sogi_ndx, sogt_ndx, sogb_ndx, sogx_ndx - - logical :: alkooh_dd, mekooh_dd, tolooh_dd, terpooh_dd, ch3cooh_dd - logical :: soa_dd, so4_dd, cb1_dd, cb2_dd, oc1_dd, oc2_dd, nh3_dd, nh4no3_dd, & - sa1_dd, sa2_dd, sa3_dd, sa4_dd, nh4_dd - logical :: soam_dd, soai_dd, soat_dd, soab_dd, soax_dd, & - sogm_dd, sogi_dd, sogt_dd, sogb_dd, sogx_dd - - logical :: pan_dd, mpan_dd, no2_dd, hno3_dd, o3_dd, isopooh_dd, ch4_dd,& - h2o2_dd, onit_dd, onitr_dd, ch2o_dd, macrooh_dd, xooh_dd, & - ch3ooh_dd, pooh_dd, ch3coooh_dd, c2h5ooh_dd, eooh_dd, ch3cho_dd, c2h5oh_dd, & - c3h7ooh_dd, rooh_dd, ch3cocho_dd, co_dd, ch3coch3_dd, & - glyald_dd, hyac_dd, ch3oh_dd, hydrald_dd, h2_dd, Pb_dd, o3s_dd, o3inert_dd - - integer :: so2_ndx - integer :: ch3cn_ndx, hcn_ndx, hcooh_ndx - logical :: ch3cn_dd, hcn_dd, hcooh_dd - - integer :: o3a_ndx,xpan_ndx,xmpan_ndx,xno2_ndx,xhno3_ndx,xonit_ndx,xonitr_ndx,xno_ndx,xho2no2_ndx,xnh4no3_ndx - logical :: o3a_dd, xpan_dd, xmpan_dd, xno2_dd, xhno3_dd, xonit_dd, xonitr_dd, xno_dd, xho2no2_dd, xnh4no3_dd - -!lke-TS1 - integer :: phenooh_ndx, benzooh_ndx, c6h5ooh_ndx, bzooh_ndx, xylolooh_ndx, xylenooh_ndx - integer :: terp2ooh_ndx, terprod1_ndx, terprod2_ndx, hmprop_ndx, mboooh_ndx, hpald_ndx, iepox_ndx - integer :: noa_ndx, alknit_ndx, isopnita_ndx, isopnitb_ndx, honitr_ndx, isopnooh_ndx - integer :: nc4cho_ndx, nc4ch2oh_ndx, terpnit_ndx, nterpooh_ndx - logical :: phenooh_dd, benzooh_dd, c6h5ooh_dd, bzooh_dd, xylolooh_dd, xylenooh_dd - logical :: terp2ooh_dd, terprod1_dd, terprod2_dd, hmprop_dd, mboooh_dd, hpald_dd, iepox_dd - logical :: noa_dd, alknit_dd, isopnita_dd, isopnitb_dd, honitr_dd, isopnooh_dd - logical :: nc4cho_dd, nc4ch2oh_dd, terpnit_dd, nterpooh_dd - - integer :: cohc_ndx=-1, come_ndx=-1 - integer, parameter :: NTAGS = 50 - integer :: cotag_ndx(NTAGS) - integer :: tag_cnt - - integer :: & - o3_tab_ndx = -1, & - h2o2_tab_ndx = -1, & - ch3ooh_tab_ndx = -1, & - co_tab_ndx = -1, & - ch3cho_tab_ndx = -1 - logical :: & - o3_in_tab = .false., & - h2o2_in_tab = .false., & - ch3ooh_in_tab = .false., & - co_in_tab = .false., & - ch3cho_in_tab = .false. - - real(r8), parameter :: small_value = 1.e-36_r8 - real(r8), parameter :: large_value = 1.e36_r8 - real(r8), parameter :: diffm = 1.789e-5_r8 - real(r8), parameter :: diffk = 1.461e-5_r8 - real(r8), parameter :: difft = 2.060e-5_r8 - real(r8), parameter :: vonkar = karman - real(r8), parameter :: ric = 0.2_r8 - real(r8), parameter :: r = 287.04_r8 - real(r8), parameter :: cp = 1004._r8 - real(r8), parameter :: grav = 9.81_r8 - real(r8), parameter :: p00 = 100000._r8 - real(r8), parameter :: wh2o = 18.0153_r8 - real(r8), parameter :: ph = 1.e-5_r8 - real(r8), parameter :: ph_inv = 1._r8/ph - real(r8), parameter :: rovcp = r/cp - - integer, pointer :: index_season_lai(:,:) - - !logical, public :: has_dvel(gas_pcnst) = .false. - !integer :: map_dvel(gas_pcnst) = 0 - logical, public :: has_dvel(nTracersMax) = .false. - integer :: map_dvel(nTracersMax) = 0 - real(r8) , allocatable :: soilw_3d(:,:,:) - - logical, parameter :: dyn_soilw = .false. - - real(r8), allocatable :: fraction_landuse(:,:,:) - real(r8), allocatable, dimension(:,:,:) :: dep_ra ! [s/m] aerodynamic resistance - real(r8), allocatable, dimension(:,:,:) :: dep_rb ! [s/m] resistance across sublayer - integer, parameter :: n_land_type = 11 - - real(r8), public :: crb - - type lnd_dvel_type - real(r8), pointer :: dvel(:,:) ! deposition velocity over land (cm/s) - end type lnd_dvel_type - - type(lnd_dvel_type), allocatable :: lnd(:) - character(len=SHR_KIND_CL) :: drydep_srf_file - -contains - - !--------------------------------------------------------------------------- - !--------------------------------------------------------------------------- - subroutine dvel_inti_fromlnd - use cam_abortutils, only : endrun - use seq_drydep_mod, only : dfoxd - - implicit none - - allocate( lnd(begchunk:endchunk) ) - - crb = (difft/diffm)**(2._r8/3._r8) !.666666_r8 - - endsubroutine dvel_inti_fromlnd - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - subroutine drydep_update( state, cam_in ) - use physics_types, only : physics_state - use camsrfexch, only : cam_in_t - use seq_drydep_mod, only : drydep_method, DD_XLND - - type(physics_state), intent(in) :: state ! Physics state variables - type(cam_in_t), intent(in) :: cam_in - integer :: ispec - - if (nddvels<1) return - if (drydep_method /= DD_XLND) return - - lnd(state%lchnk)%dvel => cam_in%depvel - - end subroutine drydep_update - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - subroutine drydep_fromlnd( ocnfrac, icefrac, ncdate, sfc_temp, pressure_sfc, & - wind_speed, spec_hum, air_temp, pressure_10m, rain, & - snow, solar_flux, dvelocity, dflx, State_Chm, & - tv, soilw, rh, ncol, lonndx, latndx, lchnk ) - - !------------------------------------------------------------------------------------- - ! combines the deposition velocities provided by the land model with deposition - ! velocities over ocean and sea ice - !------------------------------------------------------------------------------------- - - use ppgrid, only : pcols - -#if (defined OFFLINE_DYN) - use metdata, only: get_met_fields -#endif - - implicit none - - !------------------------------------------------------------------------------------- - ! ... dummy arguments - !------------------------------------------------------------------------------------- - - real(r8), intent(in) :: icefrac(pcols) - real(r8), intent(in) :: ocnfrac(pcols) - - integer, intent(in) :: ncol - integer, intent(in) :: ncdate ! present date (yyyymmdd) - real(r8), intent(in) :: sfc_temp(pcols) ! surface temperature (K) - real(r8), intent(in) :: pressure_sfc(pcols) ! surface pressure (Pa) - real(r8), intent(in) :: wind_speed(pcols) ! 10 meter wind speed (m/s) - real(r8), intent(in) :: spec_hum(pcols) ! specific humidity (kg/kg) - real(r8), intent(in) :: rh(ncol,1) ! relative humidity - real(r8), intent(in) :: air_temp(pcols) ! surface air temperature (K) - real(r8), intent(in) :: pressure_10m(pcols) ! 10 meter pressure (Pa) - real(r8), intent(in) :: rain(pcols) - real(r8), intent(in) :: snow(pcols) ! snow height (m) - real(r8), intent(in) :: soilw(pcols) ! soil moisture fraction - real(r8), intent(in) :: solar_flux(pcols) ! direct shortwave radiation at surface (W/m^2) - real(r8), intent(in) :: tv(pcols) ! potential temperature - type(ChmState), intent(in):: State_Chm ! GEOS-Chem State Chem - real(r8), intent(out) :: dvelocity(ncol,nTracersMax) ! deposition velocity (cm/s) - real(r8), intent(inout) :: dflx(pcols,nTracersMax) ! deposition flux (/cm^2/s) - - integer, intent(in) :: latndx(pcols) ! chunk latitude indicies - integer, intent(in) :: lonndx(pcols) ! chunk longitude indicies - integer, intent(in) :: lchnk ! chunk number - - !------------------------------------------------------------------------------------- - ! ... local variables - !------------------------------------------------------------------------------------- - real(r8) :: ocnice_dvel(ncol,nTracersMax) - real(r8) :: ocnice_dflx(pcols,nTracersMax) - - real(r8), dimension(ncol) :: term ! work array - integer :: ispec - real(r8) :: lndfrac(pcols) -#if (defined OFFLINE_DYN) - real(r8) :: met_ocnfrac(pcols) - real(r8) :: met_icefrac(pcols) -#endif - integer :: i - - lndfrac(:ncol) = 1._r8 - ocnfrac(:ncol) - icefrac(:ncol) - - where( lndfrac(:ncol) < 0._r8 ) - lndfrac(:ncol) = 0._r8 - endwhere - -#if (defined OFFLINE_DYN) - call get_met_fields(lndfrac, met_ocnfrac, met_icefrac, lchnk, ncol) -#endif - - !------------------------------------------------------------------------------------- - ! ... initialize - !------------------------------------------------------------------------------------- - dvelocity(:,:) = 0._r8 - - !------------------------------------------------------------------------------------- - ! ... compute the dep velocities over ocean and sea ice - ! land type 7 is used for ocean - ! land type 8 is used for sea ice - !------------------------------------------------------------------------------------- - call drydep_xactive( ncdate, sfc_temp, pressure_sfc, & - wind_speed, spec_hum, air_temp, pressure_10m, rain, & - snow, solar_flux, ocnice_dvel, ocnice_dflx, & - State_Chm, tv, soilw, & - rh, ncol, lonndx, latndx, lchnk, & -#if (defined OFFLINE_DYN) - ocnfrc=met_ocnfrac,icefrc=met_icefrac, beglandtype=7, endlandtype=8 ) -#else - ocnfrc=ocnfrac,icefrc=icefrac, beglandtype=7, endlandtype=8 ) -#endif - term(:ncol) = 1.e-2_r8 * pressure_10m(:ncol) / (r*tv(:ncol)) - - do ispec = 1, nddvels - !------------------------------------------------------------------------------------- - ! ... merge the land component with the non-land component - ! ocn and ice already have fractions factored in - !------------------------------------------------------------------------------------- - if ( drySpc_ndx(ispec) > 0 ) then - !Write(6,*) " Spec = ", drydep_list(iSpec), lchnk - !Write(6,*) " lndfrac = ", MAXVAL(lndfrac(:)), lchnk - !Write(6,*) " lndfrac = ", MINVAL(lndfrac(:)), lchnk - !Write(6,*) " lndvel = ", MAXVAL(lnd(lchnk)%dvel(:,iSpec)), " [cm/s]", lchnk - !Write(6,*) " ocnvel = ", MAXVAL(ocnice_dvel(:,drySpc_ndx(iSpec))), " [cm/s]", lchnk - dvelocity(:ncol,drySpc_ndx(ispec)) = lnd(lchnk)%dvel(:ncol,ispec)*lndfrac(:ncol) & - + ocnice_dvel(:ncol,drySpc_ndx(ispec)) - !Write(6,*) " dvel = ", MAXVAL(dvelocity(:,drySpc_ndx(iSpec))), " [cm/s]", lchnk - endif - enddo - - !------------------------------------------------------------------------------------- - ! ... special adjustments - !------------------------------------------------------------------------------------- - if( mpan_ndx>0 ) then - dvelocity(:ncol,mpan_ndx) = dvelocity(:ncol,mpan_ndx)/3._r8 - endif - if( xmpan_ndx>0 ) then - dvelocity(:ncol,xmpan_ndx) = dvelocity(:ncol,xmpan_ndx)/3._r8 - endif - if( hcn_ndx>0 ) then - dvelocity(:ncol,hcn_ndx) = ocnice_dvel(:ncol,hcn_ndx) ! should be zero over land - endif - if( ch3cn_ndx>0 ) then - dvelocity(:ncol,ch3cn_ndx) = ocnice_dvel(:ncol,ch3cn_ndx) ! should be zero over land - endif - - ! HCOOH, use CH3COOH dep.vel - if( hcooh_ndx > 0 .and. ch3cooh_ndx > 0 ) then - if( has_dvel(hcooh_ndx) ) then - dvelocity(:ncol,hcooh_ndx) = dvelocity(:ncol,ch3cooh_ndx) - end if - end if - - !------------------------------------------------------------------------------------- - ! ... assign CO tags to CO - ! put this kludge in for now ... - ! -- should be able to set all these via the table mapping in seq_drydep_mod - !------------------------------------------------------------------------------------- - if( cohc_ndx>0 .and. co_ndx>0 ) then - dvelocity(:ncol,cohc_ndx) = dvelocity(:ncol,co_ndx) - dflx(:ncol,cohc_ndx) = dvelocity(:ncol,co_ndx) * term(:ncol) * State_Chm%Species(1,:ncol,plev,cohc_ndx) - endif - if( come_ndx>0 .and. co_ndx>0 ) then - dvelocity(:ncol,come_ndx) = dvelocity(:ncol,co_ndx) - dflx(:ncol,come_ndx) = dvelocity(:ncol,co_ndx) * term(:ncol) * State_Chm%Species(1,:ncol,plev,come_ndx) - endif - - if ( co_ndx>0 ) then - do i=1,tag_cnt - dvelocity(:ncol,cotag_ndx(i)) = dvelocity(:ncol,co_ndx) - dflx(:ncol,cotag_ndx(i)) = dvelocity(:ncol,co_ndx) * term(:ncol) * State_Chm%Species(1,:ncol,plev,cotag_ndx(i)) - enddo - endif - - do ispec = 1,nddvels - !------------------------------------------------------------------------------------- - ! ... compute the deposition flux - !------------------------------------------------------------------------------------- - if ( drySpc_ndx(ispec) > 0 ) then - dflx(:ncol,drySpc_ndx(ispec)) = dvelocity(:ncol,drySpc_ndx(ispec)) * term(:ncol) * State_Chm%Species(1,:ncol,plev,drySpc_ndx(ispec)) - endif - end do - - end subroutine drydep_fromlnd - - !--------------------------------------------------------------------------- - !--------------------------------------------------------------------------- - subroutine dvel_inti_table( depvel_file ) - !--------------------------------------------------------------------------- - ! ... Initialize module, depvel arrays, and a few other variables. - ! The depvel fields will be linearly interpolated to the correct time - !--------------------------------------------------------------------------- - - use mo_constants, only : d2r, r2d - use ioFileMod, only : getfil - use string_utils, only : to_lower, GLC - use mo_chem_utls, only : get_spc_ndx - use constituents, only : pcnst - use chem_mods, only : drySpc_ndx - use interpolate_data, only : lininterp_init, lininterp, lininterp_finish,interp_type - use mo_constants, only : pi - use phys_grid, only : get_ncols_p, get_rlat_all_p, get_rlon_all_p - - implicit none - - character(len=*), intent(in) :: depvel_file - - !--------------------------------------------------------------------------- - ! ... Local variables - !--------------------------------------------------------------------------- - integer :: nlat, nlon, nmonth, ndims - integer :: dimid_lat, dimid_lon, dimid_species, dimid_time - integer :: dimid(4), count(4), start(4) - integer :: m, ispecies, nchar, ierr - real(r8) :: scale_factor - - real(r8), allocatable :: dvel_lats(:), dvel_lons(:) - real(r8), allocatable :: dvel_in(:,:,:,:) ! input depvel array - character(len=50) :: units - character(len=20), allocatable :: species_names(:) ! names of depvel species - logical :: found - type(file_desc_t) :: piofile - type(var_desc_t) :: vid, vid_dvel - - character(len=shr_kind_cl) :: locfn - integer :: mm,n - - integer :: i, c, ncols - real(r8) :: to_lats(pcols), to_lons(pcols) - type(interp_type) :: lon_wgts, lat_wgts - real(r8), parameter :: zero=0._r8, twopi=2._r8*pi - - mm = 1 - do m = 1,pcnst - if ( len_trim(drydep_list(m))==0 ) exit - n = drySpc_ndx(m) - !n = get_spc_ndx(drydep_list(m)) - if ( n < 1 ) then - write(iulog,*) 'drydep_inti: '//drydep_list(m)//' is not included in species set' - call endrun('drydep_init: invalid dry deposition species') - endif - enddo - - if( masterproc ) then - write(iulog,*) 'drydep_inti: following species have dry deposition' - do i=1,nddvels - if( len_trim(drydep_list(i)) > 0 ) then - write(iulog,*) 'drydep_inti: '//trim(drydep_list(i))//' is requested to have dry dep' - endif - enddo - write(iulog,*) 'drydep_inti:' - endif - - if ( nddvels < 1 ) return - - !--------------------------------------------------------------------------- - ! ... Setup species maps - !--------------------------------------------------------------------------- - o3a_ndx = get_spc_ndx( 'O3A') - xpan_ndx = get_spc_ndx( 'XPAN') - xmpan_ndx = get_spc_ndx( 'XMPAN') - xno2_ndx = get_spc_ndx( 'XNO2') - xhno3_ndx = get_spc_ndx( 'XHNO3') - xonit_ndx = get_spc_ndx( 'XONIT') - xonitr_ndx = get_spc_ndx( 'XONITR') - xno_ndx = get_spc_ndx( 'XNO') - xho2no2_ndx = get_spc_ndx( 'XHO2NO2') - o3a_dd = has_drydep( 'O3A') - xpan_dd = has_drydep( 'XPAN') - xmpan_dd = has_drydep( 'XMPAN') - xno2_dd = has_drydep( 'XNO2') - xhno3_dd = has_drydep( 'XHNO3') - xonit_dd = has_drydep( 'XONIT') - xonitr_dd = has_drydep( 'XONITR') - xno_dd = has_drydep( 'XNO') - xho2no2_dd = has_drydep( 'XHO2NO2') - - pan_ndx = get_spc_ndx( 'PAN') - mpan_ndx = get_spc_ndx( 'MPAN') - no2_ndx = get_spc_ndx( 'NO2') - hno3_ndx = get_spc_ndx( 'HNO3') - co_ndx = get_spc_ndx( 'CO') - o3_ndx = get_spc_ndx( 'O3') - if( o3_ndx < 1 ) then - o3_ndx = get_spc_ndx( 'OX') - end if - h2o2_ndx = get_spc_ndx( 'H2O2') - onit_ndx = get_spc_ndx( 'ONIT') - onitr_ndx = get_spc_ndx( 'ONITR') - ch4_ndx = get_spc_ndx( 'CH4') - ch2o_ndx = get_spc_ndx( 'CH2O') - ch3ooh_ndx = get_spc_ndx( 'CH3OOH') - ch3cho_ndx = get_spc_ndx( 'CH3CHO') - ch3cocho_ndx = get_spc_ndx( 'CH3COCHO') - pooh_ndx = get_spc_ndx( 'POOH') - ch3coooh_ndx = get_spc_ndx( 'CH3COOOH') - c2h5ooh_ndx = get_spc_ndx( 'C2H5OOH') - eooh_ndx = get_spc_ndx( 'EOOH') - c3h7ooh_ndx = get_spc_ndx( 'C3H7OOH') - rooh_ndx = get_spc_ndx( 'ROOH') - ch3coch3_ndx = get_spc_ndx( 'CH3COCH3') - no_ndx = get_spc_ndx( 'NO') - ho2no2_ndx = get_spc_ndx( 'HO2NO2') - glyald_ndx = get_spc_ndx( 'GLYALD') - hyac_ndx = get_spc_ndx( 'HYAC') - ch3oh_ndx = get_spc_ndx( 'CH3OH') - c2h5oh_ndx = get_spc_ndx( 'C2H5OH') - macrooh_ndx = get_spc_ndx( 'MACROOH') - isopooh_ndx = get_spc_ndx( 'ISOPOOH') - xooh_ndx = get_spc_ndx( 'XOOH') - hydrald_ndx = get_spc_ndx( 'HYDRALD') - h2_ndx = get_spc_ndx( 'H2') - Pb_ndx = get_spc_ndx( 'Pb') - o3s_ndx = get_spc_ndx( 'O3S') - o3inert_ndx = get_spc_ndx( 'O3INERT') - alkooh_ndx = get_spc_ndx( 'ALKOOH') - mekooh_ndx = get_spc_ndx( 'MEKOOH') - tolooh_ndx = get_spc_ndx( 'TOLOOH') - terpooh_ndx = get_spc_ndx( 'TERPOOH') - ch3cooh_ndx = get_spc_ndx( 'CH3COOH') - soam_ndx = get_spc_ndx( 'SOAM' ) - soai_ndx = get_spc_ndx( 'SOAI' ) - soat_ndx = get_spc_ndx( 'SOAT' ) - soab_ndx = get_spc_ndx( 'SOAB' ) - soax_ndx = get_spc_ndx( 'SOAX' ) - sogm_ndx = get_spc_ndx( 'SOGM' ) - sogi_ndx = get_spc_ndx( 'SOGI' ) - sogt_ndx = get_spc_ndx( 'SOGT' ) - sogb_ndx = get_spc_ndx( 'SOGB' ) - sogx_ndx = get_spc_ndx( 'SOGX' ) - soa_ndx = get_spc_ndx( 'SOA' ) - so4_ndx = get_spc_ndx( 'SO4' ) - cb1_ndx = get_spc_ndx( 'CB1' ) - cb2_ndx = get_spc_ndx( 'CB2' ) - oc1_ndx = get_spc_ndx( 'OC1' ) - oc2_ndx = get_spc_ndx( 'OC2' ) - nh3_ndx = get_spc_ndx( 'NH3' ) - nh4no3_ndx = get_spc_ndx( 'NH4NO3' ) - xnh4no3_ndx = get_spc_ndx( 'XNH4NO3' ) - sa1_ndx = get_spc_ndx( 'SA1' ) - sa2_ndx = get_spc_ndx( 'SA2' ) - sa3_ndx = get_spc_ndx( 'SA3' ) - sa4_ndx = get_spc_ndx( 'SA4' ) - nh4_ndx = get_spc_ndx( 'NH4' ) - alkooh_dd = has_drydep( 'ALKOOH') - mekooh_dd = has_drydep( 'MEKOOH') - tolooh_dd = has_drydep( 'TOLOOH') - terpooh_dd = has_drydep( 'TERPOOH') - ch3cooh_dd = has_drydep( 'CH3COOH') - soam_dd = has_drydep( 'SOAM' ) - soai_dd = has_drydep( 'SOAI' ) - soat_dd = has_drydep( 'SOAT' ) - soab_dd = has_drydep( 'SOAB' ) - soax_dd = has_drydep( 'SOAX' ) - sogm_dd = has_drydep( 'SOGM' ) - sogi_dd = has_drydep( 'SOGI' ) - sogt_dd = has_drydep( 'SOGT' ) - sogb_dd = has_drydep( 'SOGB' ) - sogx_dd = has_drydep( 'SOGX' ) - soa_dd = has_drydep( 'SOA' ) - so4_dd = has_drydep( 'SO4' ) - cb1_dd = has_drydep( 'CB1' ) - cb2_dd = has_drydep( 'CB2' ) - oc1_dd = has_drydep( 'OC1' ) - oc2_dd = has_drydep( 'OC2' ) - nh3_dd = has_drydep( 'NH3' ) - nh4no3_dd = has_drydep( 'NH4NO3' ) - xnh4no3_dd = has_drydep( 'XNH4NO3' ) - sa1_dd = has_drydep( 'SA1' ) - sa2_dd = has_drydep( 'SA2' ) - sa3_dd = has_drydep( 'SA3' ) - sa4_dd = has_drydep( 'SA4' ) - nh4_dd = has_drydep( 'NH4' ) - pan_dd = has_drydep( 'PAN') - mpan_dd = has_drydep( 'MPAN') - no2_dd = has_drydep( 'NO2') - hno3_dd = has_drydep( 'HNO3') - co_dd = has_drydep( 'CO') - o3_dd = has_drydep( 'O3') - if( .not. o3_dd ) then - o3_dd = has_drydep( 'OX') - end if - h2o2_dd = has_drydep( 'H2O2') - onit_dd = has_drydep( 'ONIT') - onitr_dd = has_drydep( 'ONITR') - ch4_dd = has_drydep( 'CH4') - ch2o_dd = has_drydep( 'CH2O') - ch3ooh_dd = has_drydep( 'CH3OOH') - ch3cho_dd = has_drydep( 'CH3CHO') - c2h5oh_dd = has_drydep( 'C2H5OH') - eooh_dd = has_drydep( 'EOOH') - ch3cocho_dd = has_drydep( 'CH3COCHO') - pooh_dd = has_drydep( 'POOH') - ch3coooh_dd = has_drydep( 'CH3COOOH') - c2h5ooh_dd = has_drydep( 'C2H5OOH') - c3h7ooh_dd = has_drydep( 'C3H7OOH') - rooh_dd = has_drydep( 'ROOH') - ch3coch3_dd = has_drydep( 'CH3COCH3') - glyald_dd = has_drydep( 'GLYALD') - hyac_dd = has_drydep( 'HYAC') - ch3oh_dd = has_drydep( 'CH3OH') - macrooh_dd = has_drydep( 'MACROOH') - isopooh_dd = has_drydep( 'ISOPOOH') - xooh_dd = has_drydep( 'XOOH') - hydrald_dd = has_drydep( 'HYDRALD') - h2_dd = has_drydep( 'H2') - Pb_dd = has_drydep( 'Pb') - o3s_dd = has_drydep( 'O3S') - o3inert_dd = has_drydep( 'O3INERT') - ch3cn_dd = has_drydep( 'CH3CN') - hcn_dd = has_drydep( 'HCN') - hcooh_dd = has_drydep( 'HCOOH') - ch3cn_ndx = get_spc_ndx( 'CH3CN') - hcn_ndx = get_spc_ndx( 'HCN') - hcooh_ndx = get_spc_ndx( 'HCOOH' ) - - if( masterproc ) then - write(iulog,*) 'dvel_inti: diagnostics' - write(iulog,'(10i5)') pan_ndx, mpan_ndx, no2_ndx, hno3_ndx, o3_ndx, & - h2o2_ndx, onit_ndx, onitr_ndx, ch4_ndx, ch2o_ndx, & - ch3ooh_ndx, pooh_ndx, ch3coooh_ndx, c2h5ooh_ndx, eooh_ndx, & - c3h7ooh_ndx, rooh_ndx, ch3cocho_ndx, co_ndx, ch3coch3_ndx, & - no_ndx, ho2no2_ndx, glyald_ndx, hyac_ndx, ch3oh_ndx, c2h5oh_ndx, & - hydrald_ndx, h2_ndx, Pb_ndx, o3s_ndx, o3inert_ndx, macrooh_ndx, & - xooh_ndx, ch3cho_ndx, isopooh_ndx, noa_ndx, alknit_ndx, isopnita_ndx, & - honitr_ndx, isopnooh_ndx, nc4cho_ndx, nc4ch2oh_ndx, terpnit_ndx, nterpooh_ndx - write(iulog,*) pan_dd, mpan_dd, no2_dd, hno3_dd, o3_dd, isopooh_dd, ch4_dd,& - h2o2_dd, onit_dd, onitr_dd, ch2o_dd, macrooh_dd, xooh_dd, & - ch3ooh_dd, pooh_dd, ch3coooh_dd, c2h5ooh_dd, eooh_dd, ch3cho_dd, c2h5oh_dd, & - c3h7ooh_dd, rooh_dd, ch3cocho_dd, co_dd, ch3coch3_dd, & - glyald_dd, hyac_dd, ch3oh_dd, hydrald_dd, h2_dd, Pb_dd, o3s_dd, o3inert_dd, & - noa_dd, alknit_dd, isopnita_dd, & - honitr_dd, isopnooh_dd, nc4cho_dd, nc4ch2oh_dd, terpnit_dd, nterpooh_dd - endif - !--------------------------------------------------------------------------- - ! ... Open NetCDF file - !--------------------------------------------------------------------------- - call getfil (depvel_file, locfn, 0) - call cam_pio_openfile (piofile, trim(locfn), PIO_NOWRITE) - - !--------------------------------------------------------------------------- - ! ... Get variable ID for dep vel array - !--------------------------------------------------------------------------- - ierr = pio_inq_varid( piofile, 'dvel', vid_dvel ) - - !--------------------------------------------------------------------------- - ! ... Inquire about dimensions - !--------------------------------------------------------------------------- - ierr = pio_inq_dimid( piofile, 'lon', dimid_lon ) - ierr = pio_inq_dimlen( piofile, dimid_lon, nlon ) - ierr = pio_inq_dimid( piofile, 'lat', dimid_lat ) - ierr = pio_inq_dimlen( piofile, dimid_lat, nlat ) - ierr = pio_inq_dimid( piofile, 'species', dimid_species ) - ierr = pio_inq_dimlen( piofile, dimid_species, nspecies ) - ierr = pio_inq_dimid( piofile, 'time', dimid_time ) - ierr = pio_inq_dimlen( piofile, dimid_time, nmonth ) - if(masterproc) write(iulog,*) 'dvel_inti: dimensions (nlon,nlat,nspecies,nmonth) = ',nlon,nlat,nspecies,nmonth - - !--------------------------------------------------------------------------- - ! ... Check dimensions of dvel variable. Must be (lon, lat, species, month). - !--------------------------------------------------------------------------- - ierr = pio_inq_varndims( piofile, vid_dvel, ndims ) - - if( masterproc .and. ndims /= 4 ) then - write(iulog,*) 'dvel_inti: dvel has ',ndims,' dimensions. Expecting 4.' - call endrun - end if - ierr = pio_inq_vardimid( piofile, vid_dvel, dimid ) - - if( dimid(1) /= dimid_lon .or. dimid(2) /= dimid_lat .or. & - dimid(3) /= dimid_species .or. dimid(4) /= dimid_time ) then - write(iulog,*) 'dvel_inti: Dimensions in wrong order for dvel' - write(iulog,*) '... Expecting (lon, lat, species, month)' - call endrun - end if - - !--------------------------------------------------------------------------- - ! ... Allocate depvel lats, lons and read - !--------------------------------------------------------------------------- - allocate( dvel_lats(nlat), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'dvel_inti: Failed to allocate dvel_lats vector' - call endrun - end if - allocate( dvel_lons(nlon), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'dvel_inti: Failed to allocate dvel_lons vector' - call endrun - end if - - ierr = pio_inq_varid( piofile, 'lat', vid ) - ierr = pio_get_var( piofile, vid, dvel_lats ) - ierr = pio_inq_varid( piofile, 'lon', vid ) - ierr = pio_get_var( piofile, vid, dvel_lons ) - - !--------------------------------------------------------------------------- - ! ... Set the transform from inputs lats to simulation lats - !--------------------------------------------------------------------------- - dvel_lats(:nlat) = d2r * dvel_lats(:nlat) - dvel_lons(:nlon) = d2r * dvel_lons(:nlon) - - !--------------------------------------------------------------------------- - ! ... Allocate dvel and read data from file - !--------------------------------------------------------------------------- - allocate( dvel_in(nlon, nlat ,nspecies, nmonth), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'dvel_inti: Failed to allocate dvel_in' - call endrun - end if - start = (/ 1, 1, 1, 1 /) - count = (/ nlon, nlat, nspecies, nmonth /) - - ierr = pio_get_var( piofile, vid_dvel, start, count, dvel_in ) - - - !--------------------------------------------------------------------------- - ! ... Check units of deposition velocity. If necessary, convert to cm/s. - !--------------------------------------------------------------------------- - units(:) = ' ' - ierr = pio_get_att( piofile, vid_dvel, 'units', units ) - if( to_lower(trim(units(:GLC(units)))) == 'm/s' ) then -#ifdef DEBUG - if(masterproc) write(iulog,*) 'dvel_inti: depvel units = m/s. Converting to cm/s' -#endif - scale_factor = 100._r8 - elseif( to_lower(trim(units(:GLC(units)))) == 'cm/s' ) then -#ifdef DEBUG - if(masterproc) write(iulog,*) 'dvel_inti: depvel units = cm/s' -#endif - scale_factor = 1._r8 - else -#ifdef DEBUG - if(masterproc) then - write(iulog,*) 'dvel_inti: Warning! depvel units unknown = ', to_lower(trim(units)) - write(iulog,*) ' ... proceeding with scale_factor=1' - end if -#endif - scale_factor = 1._r8 - end if - - dvel_in(:,:,:,:) = scale_factor*dvel_in(:,:,:,:) - - !--------------------------------------------------------------------------- - ! ... Regrid deposition velocities - !--------------------------------------------------------------------------- - allocate( dvel(pcols,begchunk:endchunk,nspecies,nmonth),stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'dvel_inti: Failed to allocate dvel' - call endrun - end if - - do c=begchunk,endchunk - ncols = get_ncols_p(c) - call get_rlat_all_p(c, pcols, to_lats) - call get_rlon_all_p(c, pcols, to_lons) - call lininterp_init(dvel_lons, nlon, to_lons, ncols, 2, lon_wgts, zero, twopi) - call lininterp_init(dvel_lats, nlat, to_lats, ncols, 1, lat_wgts) - - do ispecies = 1,nspecies - do m = 1,12 - call lininterp( dvel_in( :,:,ispecies,m ), nlon, nlat, dvel(:,c,ispecies,m), ncols,lon_wgts,lat_wgts) - end do - end do - - call lininterp_finish(lat_wgts) - call lininterp_finish(lon_wgts) - end do - - deallocate( dvel_in ) - deallocate( dvel_lats, dvel_lons ) - - !--------------------------------------------------------------------------- - ! ... Read in species names and determine mapping to tracer numbers - !--------------------------------------------------------------------------- - allocate( species_names(nspecies), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'dvel_inti: species_names allocation error = ',ierr - call endrun - end if - ierr = pio_inq_varid( piofile, 'species_name', vid ) - ierr = pio_inq_varndims( piofile, vid, ndims ) - - ierr = pio_inq_vardimid( piofile, vid, dimid ) - - ierr = pio_inq_dimlen( piofile, dimid(1), nchar ) - map(:) = 0 - do ispecies = 1,nspecies - start(:2) = (/ 1, ispecies /) - count(:2) = (/ nchar, 1 /) - species_names(ispecies)(:) = ' ' - ierr = pio_get_var( piofile, vid, start(1:2), count(1:2), species_names(ispecies:ispecies) ) - if( species_names(ispecies) == 'O3' ) then - o3_in_tab = .true. - o3_tab_ndx = ispecies - else if( species_names(ispecies) == 'H2O2' ) then - h2o2_in_tab = .true. - h2o2_tab_ndx = ispecies - else if( species_names(ispecies) == 'CH3OOH' ) then - ch3ooh_in_tab = .true. - ch3ooh_tab_ndx = ispecies - else if( species_names(ispecies) == 'CO' ) then - co_in_tab = .true. - co_tab_ndx = ispecies - else if( species_names(ispecies) == 'CH3CHO' ) then - ch3cho_in_tab = .true. - ch3cho_tab_ndx = ispecies - end if - found = .false. - do m = 1, nTracers - if( species_names(ispecies) == tracerNames(m) .or. & - (species_names(ispecies) == 'O3' .and. tracerNames(m) == 'OX') .or. & - (species_names(ispecies) == 'HNO4' .and. tracerNames(m) == 'HO2NO2') ) then - if ( has_drydep( tracerNames(m) ) ) then - map(m) = ispecies - found = .true. -#ifdef DEBUG - if( masterproc ) then - write(iulog,*) 'dvel_inti: ispecies, m, tracnam = ',ispecies,m,trim(tracerNames(m)) - end if -#endif - exit - end if - end if - end do - if( .not. found ) then - write(iulog,*) 'dvel_inti: Warning! DVEL species ',trim(species_names(ispecies)),' not found' - endif - end do - deallocate( species_names ) - - call cam_pio_closefile( piofile ) - - !--------------------------------------------------------------------------- - ! ... Allocate dvel_interp array - !--------------------------------------------------------------------------- - allocate( dvel_interp(pcols,begchunk:endchunk,nspecies),stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'dvel_inti: Failed to allocate dvel_interp; error = ',ierr - call endrun - end if - - end subroutine dvel_inti_table - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - subroutine interpdvel( calday, ncol, lchnk ) - !--------------------------------------------------------------------------- - ! ... Interpolate the fields whose values are required at the - ! begining of a timestep. - !--------------------------------------------------------------------------- - - use time_manager, only : get_calday - - implicit none - - !--------------------------------------------------------------------------- - ! ... Dummy arguments - !--------------------------------------------------------------------------- - real(r8), intent(in) :: calday ! Interpolate the input data to calday - integer, intent(in) :: ncol, lchnk - - !--------------------------------------------------------------------------- - ! ... Local variables - !--------------------------------------------------------------------------- - integer :: m, last, next - integer :: dates(12) = (/ 116, 214, 316, 415, 516, 615, & - 716, 816, 915, 1016, 1115, 1216 /) - real(r8) :: calday_loc, last_days, next_days - real(r8), save :: dys(12) - logical, save :: entered = .false. - - if( .not. entered ) then - do m = 1,12 - dys(m) = get_calday( dates(m), 0 ) - end do - entered = .true. - end if - - if( calday < dys(1) ) then - next = 1 - last = 12 - else if( calday >= dys(12) ) then - next = 1 - last = 12 - else - do m = 11,1,-1 - if( calday >= dys(m) ) then - exit - end if - end do - last = m - next = m + 1 - end if - - last_days = dys( last ) - next_days = dys( next ) - calday_loc = calday - - if( next_days < last_days ) then - next_days = next_days + 365._r8 - end if - if( calday_loc < last_days ) then - calday_loc = calday_loc + 365._r8 - end if - - do m = 1,nspecies - call intp2d( last_days, next_days, calday_loc, ncol, lchnk, & - dvel(:,lchnk,m,last), & - dvel(:,lchnk,m,next), & - dvel_interp(:,lchnk,m) ) - end do - - end subroutine interpdvel - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - subroutine intp2d( t1, t2, tint, ncol, lchnk, f1, f2, fint ) - !----------------------------------------------------------------------- - ! ... Linearly interpolate between f1(t1) and f2(t2) to fint(tint). - !----------------------------------------------------------------------- - - implicit none - - !----------------------------------------------------------------------- - ! ... Dummy arguments - !----------------------------------------------------------------------- - real(r8), intent(in) :: & - t1, & ! time level of f1 - t2, & ! time level of f2 - tint ! interpolant time - real(r8), dimension(pcols), intent(in) :: & - f1, & ! field at time t1 - f2 ! field at time t2 - - integer, intent(in) :: ncol, lchnk - - real(r8), intent(out) :: & - fint(pcols) ! field at time tint - - - !----------------------------------------------------------------------- - ! ... Local variables - !----------------------------------------------------------------------- - real(r8) :: factor - - factor = (tint - t1)/(t2 - t1) - - fint(:ncol) = f1(:ncol) + (f2(:ncol) - f1(:ncol))*factor - - end subroutine intp2d - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - !subroutine drydep_table( calday, tsurf, zen_angle, & - ! depvel, dflx, q, p, & - ! tv, ncol, icefrac, ocnfrac, lchnk ) - ! !-------------------------------------------------------- - ! ! ... Form the deposition velocities for this - ! ! latitude slice - ! !-------------------------------------------------------- - - ! use physconst, only : rair,pi - ! use dycore, only : dycore_is - - ! implicit none - - ! !-------------------------------------------------------- - ! ! ... Dummy arguments - ! !-------------------------------------------------------- - ! integer, intent(in) :: ncol ! columns in chunk - ! real(r8), intent(in) :: q(pcols,plev,gas_pcnst) ! tracer mmr (kg/kg) - ! real(r8), intent(in) :: p(pcols) ! midpoint pressure in surface layer (Pa) - ! real(r8), intent(in) :: tv(pcols) ! virtual temperature in surface layer (K) - ! real(r8), intent(in) :: calday ! time of year in days - ! real(r8), intent(in) :: tsurf(pcols) ! surface temperature (K) - ! real(r8), intent(in) :: zen_angle(ncol) ! zenith angle (radians) - ! real(r8), intent(inout) :: dflx(pcols,gas_pcnst) ! flux due to dry deposition (kg/m^2/sec) - ! real(r8), intent(out) :: depvel(ncol,gas_pcnst) ! deposition vel (cm/s) - - ! real(r8), intent(in) :: icefrac(pcols) ! sea-ice areal fraction - ! real(r8), intent(in) :: ocnfrac(pcols) ! ocean areal fraction - ! - ! integer, intent(in) :: lchnk - ! !----------------------------------------------------------------------- - ! ! ... Local variables - ! !----------------------------------------------------------------------- - ! integer :: m, i - ! real(r8), dimension(ncol) :: vel, glace, temp_fac, wrk, tmp - ! real(r8), dimension(ncol) :: o3_tab_dvel - ! real(r8), dimension(ncol) :: ocean - - ! real(r8), parameter :: pid2 = .5_r8 * pi - - ! if(dycore_is('UNSTRUCTURED')) then - ! call endrun( 'Option not supported for unstructured atmosphere grids ') - ! end if - - ! !----------------------------------------------------------------------- - ! ! ... Note the factor 1.e-2 in the wrk array calculation is - ! ! to transform the incoming dep vel from cm/s to m/s - ! !----------------------------------------------------------------------- - ! wrk(:ncol) = 1.e-2_r8 * p(:ncol) / (rair * tv(:ncol)) - - ! !-------------------------------------------------------- - ! ! ... Initialize all deposition velocities to zero - ! !-------------------------------------------------------- - ! depvel(:,:) = 0._r8 - - ! !-------------------------------------------------------- - ! ! ... Time interpolate primary depvel array - ! ! (also seaice and npp) - ! !-------------------------------------------------------- - ! call interpdvel( calday, ncol, lchnk ) - - ! if( o3_in_tab ) then - ! do i=1,ncol - ! o3_tab_dvel(i) = dvel_interp(i,lchnk,o3_tab_ndx) - ! enddo - ! end if - - ! !-------------------------------------------------------- - ! ! ... Set deposition velocities - ! !-------------------------------------------------------- - ! do m = 1,gas_pcnst - ! if( map(m) /= 0 ) then - ! do i = 1,ncol - ! depvel(i,m) = dvel_interp(i,lchnk,map(m)) - ! dflx(i,m) = wrk(i) * depvel(i,m) * q(i,plev,m) - ! enddo - ! end if - ! end do - - ! !-------------------------------------------------------- - ! ! ... Set some variables needed for some dvel calculations - ! !-------------------------------------------------------- - ! temp_fac(:ncol) = min( 1._r8, max( 0._r8, (tsurf(:ncol) - 268._r8) / 5._r8 ) ) - ! ocean(:ncol) = icefrac(:ncol)+ocnfrac(:ncol) - ! glace(:ncol) = icefrac(:ncol) + (1._r8 - ocean(:ncol)) * (1._r8 - temp_fac(:ncol)) - ! glace(:ncol) = min( 1._r8,glace(:ncol) ) - - ! !-------------------------------------------------------- - ! ! ... Set pan & mpan - ! !-------------------------------------------------------- - ! if( o3_in_tab ) then - ! tmp(:ncol) = o3_tab_dvel(:ncol) / 3._r8 - ! else - ! tmp(:) = 0._r8 - ! end if - ! if( pan_dd ) then - ! if( map(pan_ndx) == 0 ) then - ! depvel(:ncol,pan_ndx) = tmp(:ncol) - ! dflx(:ncol,pan_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,pan_ndx) - ! end if - ! end if - ! if( mpan_dd ) then - ! if( map(mpan_ndx) == 0 ) then - ! depvel(:ncol,mpan_ndx) = tmp(:ncol) - ! dflx(:ncol,mpan_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,mpan_ndx) - ! end if - ! end if - - ! !-------------------------------------------------------- - ! ! ... Set no2 dvel - ! !-------------------------------------------------------- - ! if( no2_dd ) then - ! if( map(no2_ndx) == 0 .and. o3_in_tab ) then - ! depvel(:ncol,no2_ndx) = (.6_r8*o3_tab_dvel(:ncol) + .055_r8*ocean(:ncol)) * .9_r8 - ! dflx(:ncol,no2_ndx) = wrk(:) * depvel(:ncol,no2_ndx) * q(:ncol,plev,no2_ndx) - ! end if - ! end if - - ! !-------------------------------------------------------- - ! ! ... Set hno3 dvel - ! !-------------------------------------------------------- - ! tmp(:ncol) = (2._r8 - ocnfrac(:ncol)) * (1._r8 - glace(:ncol)) + .05_r8 * glace(:ncol) - ! if( hno3_dd ) then - ! if( map(hno3_ndx) == 0 ) then - ! depvel(:ncol,hno3_ndx) = tmp(:ncol) - ! dflx(:ncol,hno3_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,hno3_ndx) - ! else - ! tmp(:ncol) = depvel(:ncol,hno3_ndx) - ! end if - ! end if - ! if( onitr_dd ) then - ! if( map(onitr_ndx) == 0 ) then - ! depvel(:ncol,onitr_ndx) = tmp(:ncol) - ! dflx(:ncol,onitr_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,onitr_ndx) - ! end if - ! end if - ! if( isopooh_dd ) then - ! if( map(isopooh_ndx) == 0 ) then - ! depvel(:ncol,isopooh_ndx) = tmp(:ncol) - ! dflx(:ncol,isopooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,isopooh_ndx) - ! end if - ! end if - - ! !-------------------------------------------------------- - ! ! ... Set h2o2 dvel - ! !-------------------------------------------------------- - ! if( .not. h2o2_in_tab ) then - ! if( o3_in_tab ) then - ! tmp(:ncol) = .05_r8*glace(:ncol) + ocean(:ncol) - icefrac(:ncol) & - ! + (1._r8 - (glace(:) + ocean(:ncol)) + icefrac(:ncol)) & - ! *max( 1._r8,1._r8/(.5_r8 + 1._r8/(6._r8*o3_tab_dvel(:ncol))) ) - ! else - ! tmp(:ncol) = 0._r8 - ! end if - ! else - ! do i=1,ncol - ! tmp(i) = dvel_interp(i,lchnk,h2o2_tab_ndx) - ! enddo - ! end if - ! if( h2o2_dd ) then - ! if( map(h2o2_ndx) == 0 ) then - ! depvel(:ncol,h2o2_ndx) = tmp(:ncol) - ! dflx(:ncol,h2o2_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,h2o2_ndx) - ! end if - ! end if - ! !-------------------------------------------------------- - ! ! ... Set hcn dvel - ! !-------------------------------------------------------- - ! if( hcn_dd ) then - ! if( map(hcn_ndx) == 0 ) then - ! depvel(:ncol,hcn_ndx) = ocnfrac(:ncol)*0.2_r8 - ! endif - ! endif - ! !-------------------------------------------------------- - ! ! ... Set ch3cn dvel - ! !-------------------------------------------------------- - ! if( ch3cn_dd ) then - ! if( map(ch3cn_ndx) == 0 ) then - ! depvel(:,ch3cn_ndx) = ocnfrac(:ncol)*0.2_r8 - ! endif - ! endif - ! !-------------------------------------------------------- - ! ! ... Set onit - ! !-------------------------------------------------------- - ! if( onit_dd ) then - ! if( map(onit_ndx) == 0 ) then - ! depvel(:ncol,onit_ndx) = tmp(:ncol) - ! dflx(:ncol,onit_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,onit_ndx) - ! end if - ! end if - ! if( ch3cocho_dd ) then - ! if( map(ch3cocho_ndx) == 0 ) then - ! depvel(:ncol,ch3cocho_ndx) = tmp(:ncol) - ! dflx(:ncol,ch3cocho_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch3cocho_ndx) - ! end if - ! end if - ! if( ch3ooh_in_tab ) then - ! do i=1,ncol - ! tmp(i) = dvel_interp(i,lchnk,ch3ooh_tab_ndx) - ! enddo - ! else - ! tmp(:ncol) = .5_r8 * tmp(:ncol) - ! end if - ! if( ch3ooh_dd ) then - ! if( map(ch3ooh_ndx) == 0 ) then - ! depvel(:ncol,ch3ooh_ndx) = tmp(:ncol) - ! dflx(:ncol,ch3ooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch3ooh_ndx) - ! end if - ! end if - ! if( pooh_dd ) then - ! if( map(pooh_ndx) == 0 ) then - ! depvel(:ncol,pooh_ndx) = tmp(:ncol) - ! dflx(:ncol,pooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,pooh_ndx) - ! end if - ! end if - ! if( ch3coooh_dd ) then - ! if( map(ch3coooh_ndx) == 0 ) then - ! depvel(:ncol,ch3coooh_ndx) = tmp(:ncol) - ! dflx(:ncol,ch3coooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch3coooh_ndx) - ! end if - ! end if - ! if( c2h5ooh_dd ) then - ! if( map(c2h5ooh_ndx) == 0 ) then - ! depvel(:ncol,c2h5ooh_ndx) = tmp(:ncol) - ! dflx(:ncol,c2h5ooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,c2h5ooh_ndx) - ! end if - ! end if - ! if( c3h7ooh_dd ) then - ! if( map(c3h7ooh_ndx) == 0 ) then - ! depvel(:ncol,c3h7ooh_ndx) = tmp(:ncol) - ! dflx(:ncol,c3h7ooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,c3h7ooh_ndx) - ! end if - ! end if - ! if( rooh_dd ) then - ! if( map(rooh_ndx) == 0 ) then - ! depvel(:ncol,rooh_ndx) = tmp(:ncol) - ! dflx(:ncol,rooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,rooh_ndx) - ! end if - ! end if - ! if( macrooh_dd ) then - ! if( map(macrooh_ndx) == 0 ) then - ! depvel(:ncol,macrooh_ndx) = tmp(:ncol) - ! dflx(:ncol,macrooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,macrooh_ndx) - ! end if - ! end if - ! if( xooh_dd ) then - ! if( map(xooh_ndx) == 0 ) then - ! depvel(:ncol,xooh_ndx) = tmp(:ncol) - ! dflx(:ncol,xooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,xooh_ndx) - ! end if - ! end if - ! if( ch3oh_dd ) then - ! if( map(ch3oh_ndx) == 0 ) then - ! depvel(:ncol,ch3oh_ndx) = tmp(:ncol) - ! dflx(:ncol,ch3oh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch3oh_ndx) - ! end if - ! end if - ! if( c2h5oh_dd ) then - ! if( map(c2h5oh_ndx) == 0 ) then - ! depvel(:ncol,c2h5oh_ndx) = tmp(:ncol) - ! dflx(:ncol,c2h5oh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,c2h5oh_ndx) - ! end if - ! end if - ! if( alkooh_dd ) then - ! if( map(alkooh_ndx) == 0 ) then - ! depvel(:ncol,alkooh_ndx) = tmp(:ncol) - ! dflx(:ncol,alkooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,alkooh_ndx) - ! end if - ! end if - ! if( mekooh_dd ) then - ! if( map(mekooh_ndx) == 0 ) then - ! depvel(:ncol,mekooh_ndx) = tmp(:ncol) - ! dflx(:ncol,mekooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,mekooh_ndx) - ! end if - ! end if - ! if( tolooh_dd ) then - ! if( map(tolooh_ndx) == 0 ) then - ! depvel(:ncol,tolooh_ndx) = tmp(:ncol) - ! dflx(:ncol,tolooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,tolooh_ndx) - ! end if - ! end if - ! if( o3_in_tab ) then - ! tmp(:ncol) = o3_tab_dvel(:ncol) - ! else - ! tmp(:ncol) = 0._r8 - ! end if - ! if( ch2o_dd ) then - ! if( map(ch2o_ndx) == 0 ) then - ! depvel(:ncol,ch2o_ndx) = tmp(:ncol) - ! dflx(:ncol,ch2o_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch2o_ndx) - ! end if - ! end if - - ! if( hydrald_dd ) then - ! if( map(hydrald_ndx) == 0 ) then - ! depvel(:ncol,hydrald_ndx) = tmp(:ncol) - ! dflx(:ncol,hydrald_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,hydrald_ndx) - ! end if - ! end if - ! if( ch3cooh_dd ) then - ! if( map(ch3cooh_ndx) == 0 ) then - ! depvel(:ncol,ch3cooh_ndx) = depvel(:ncol,ch2o_ndx) - ! dflx(:ncol,ch3cooh_ndx) = wrk(:ncol) * depvel(:ncol,ch3cooh_ndx) * q(:ncol,plev,ch3cooh_ndx) - ! end if - ! end if - ! if( eooh_dd ) then - ! if( map(eooh_ndx) == 0 ) then - ! depvel(:ncol,eooh_ndx) = depvel(:ncol,ch2o_ndx) - ! dflx(:ncol,eooh_ndx) = wrk(:ncol) * depvel(:ncol,eooh_ndx) * q(:ncol,plev,eooh_ndx) - ! end if - ! end if - ! ! HCOOH - set to CH3COOH - ! if( hcooh_dd ) then - ! if( map(hcooh_ndx) == 0 ) then - ! depvel(:ncol,hcooh_ndx) = depvel(:ncol,ch2o_ndx) - ! dflx(:ncol,hcooh_ndx) = wrk(:ncol) * depvel(:ncol,hcooh_ndx) * q(:ncol,plev,hcooh_ndx) - ! end if - ! end if - - ! !-------------------------------------------------------- - ! ! ... Set co and related species dep vel - ! !-------------------------------------------------------- - ! if( co_in_tab ) then - ! do i=1,ncol - ! tmp(i) = dvel_interp(i,lchnk,co_tab_ndx) - ! enddo - ! else - ! tmp(:) = 0._r8 - ! end if - ! if( co_dd ) then - ! if( map(co_ndx) == 0 ) then - ! depvel(:ncol,co_ndx) = tmp(:ncol) - ! dflx(:ncol,co_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,co_ndx) - ! end if - ! end if - ! if( ch3coch3_dd ) then - ! if( map(ch3coch3_ndx) == 0 ) then - ! depvel(:ncol,ch3coch3_ndx) = tmp(:ncol) - ! dflx(:ncol,ch3coch3_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,ch3coch3_ndx) - ! end if - ! end if - ! if( hyac_dd ) then - ! if( map(hyac_ndx) == 0 ) then - ! depvel(:ncol,hyac_ndx) = tmp(:ncol) - ! dflx(:ncol,hyac_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,hyac_ndx) - ! end if - ! end if - ! if( h2_dd ) then - ! if( map(h2_ndx) == 0 ) then - ! depvel(:ncol,h2_ndx) = tmp(:ncol) * 1.5_r8 ! Hough(1991) - ! dflx(:ncol,h2_ndx) = wrk(:ncol) * depvel(:ncol,h2_ndx) * q(:ncol,plev,h2_ndx) - ! end if - ! end if - - ! !-------------------------------------------------------- - ! ! ... Set glyald - ! !-------------------------------------------------------- - ! if( glyald_dd ) then - ! if( map(glyald_ndx) == 0 ) then - ! if( ch3cho_dd ) then - ! depvel(:ncol,glyald_ndx) = depvel(:ncol,ch3cho_ndx) - ! else if( ch3cho_in_tab ) then - ! do i=1,ncol - ! depvel(i,glyald_ndx) = dvel_interp(i,lchnk,ch3cho_tab_ndx) - ! enddo - ! else - ! depvel(:ncol,glyald_ndx) = 0._r8 - ! end if - ! dflx(:ncol,glyald_ndx) = wrk(:ncol) * depvel(:ncol,glyald_ndx) * q(:ncol,plev,glyald_ndx) - ! end if - ! end if - - ! !-------------------------------------------------------- - ! ! ... Lead deposition - ! !-------------------------------------------------------- - ! if( Pb_dd ) then - ! if( map(Pb_ndx) == 0 ) then - ! depvel(:ncol,Pb_ndx) = ocean(:ncol) * .05_r8 + (1._r8 - ocean(:ncol)) * .2_r8 - ! dflx(:ncol,Pb_ndx) = wrk(:ncol) * depvel(:ncol,Pb_ndx) * q(:ncol,plev,Pb_ndx) - ! end if - ! end if - - ! !-------------------------------------------------------- - ! ! ... diurnal dependence for OX dvel - ! !-------------------------------------------------------- - ! if( o3_dd .or. o3s_dd .or. o3inert_dd ) then - ! if( o3_dd .or. o3_in_tab ) then - ! if( o3_dd ) then - ! tmp(:ncol) = max( 1._r8,sqrt( (depvel(:ncol,o3_ndx) - .2_r8)**3/.27_r8 + 4._r8*depvel(:ncol,o3_ndx) + .67_r8 ) ) - ! vel(:ncol) = depvel(:ncol,o3_ndx) - ! else if( o3_in_tab ) then - ! tmp(:ncol) = max( 1._r8,sqrt( (o3_tab_dvel(:ncol) - .2_r8)**3/.27_r8 + 4._r8*o3_tab_dvel(:ncol) + .67_r8 ) ) - ! vel(:ncol) = o3_tab_dvel(:ncol) - ! end if - ! where( abs( zen_angle(:) ) > pid2 ) - ! vel(:) = vel(:) / tmp(:) - ! elsewhere - ! vel(:) = vel(:) * tmp(:) - ! endwhere - - ! else - ! vel(:ncol) = 0._r8 - ! end if - ! if( o3_dd ) then - ! depvel(:ncol,o3_ndx) = vel(:ncol) - ! dflx(:ncol,o3_ndx) = wrk(:ncol) * vel(:ncol) * q(:ncol,plev,o3_ndx) - ! end if - ! !-------------------------------------------------------- - ! ! ... Set stratospheric O3 deposition - ! !-------------------------------------------------------- - ! if( o3s_dd ) then - ! depvel(:ncol,o3s_ndx) = vel(:ncol) - ! dflx(:ncol,o3s_ndx) = wrk(:ncol) * vel(:ncol) * q(:ncol,plev,o3s_ndx) - ! end if - ! if( o3inert_dd ) then - ! depvel(:ncol,o3inert_ndx) = vel(:ncol) - ! dflx(:ncol,o3inert_ndx) = wrk(:ncol) * vel(:ncol) * q(:ncol,plev,o3inert_ndx) - ! end if - ! end if - - ! if( xno2_dd ) then - ! if( map(xno2_ndx) == 0 ) then - ! depvel(:ncol,xno2_ndx) = depvel(:ncol,no2_ndx) - ! dflx(:ncol,xno2_ndx) = wrk(:ncol) * depvel(:ncol,xno2_ndx) * q(:ncol,plev,xno2_ndx) - ! end if - ! endif - ! if( o3a_dd ) then - ! if( map(o3a_ndx) == 0 ) then - ! depvel(:ncol,o3a_ndx) = depvel(:ncol,o3_ndx) - ! dflx(:ncol,o3a_ndx) = wrk(:ncol) * depvel(:ncol,o3a_ndx) * q(:ncol,plev,o3a_ndx) - ! end if - ! endif - ! if( xhno3_dd ) then - ! if( map(xhno3_ndx) == 0 ) then - ! depvel(:ncol,xhno3_ndx) = depvel(:ncol,hno3_ndx) - ! dflx(:ncol,xhno3_ndx) = wrk(:ncol) * depvel(:ncol,xhno3_ndx) * q(:ncol,plev,xhno3_ndx) - ! end if - ! endif - ! if( xnh4no3_dd ) then - ! if( map(xnh4no3_ndx) == 0 ) then - ! depvel(:ncol,xnh4no3_ndx) = depvel(:ncol,nh4no3_ndx) - ! dflx(:ncol,xnh4no3_ndx) = wrk(:ncol) * depvel(:ncol,xnh4no3_ndx) * q(:ncol,plev,xnh4no3_ndx) - ! end if - ! endif - ! if( xpan_dd ) then - ! if( map(xpan_ndx) == 0 ) then - ! depvel(:ncol,xpan_ndx) = depvel(:ncol,pan_ndx) - ! dflx(:ncol,xpan_ndx) = wrk(:ncol) * depvel(:ncol,xpan_ndx) * q(:ncol,plev,xpan_ndx) - ! end if - ! endif - ! if( xmpan_dd ) then - ! if( map(xmpan_ndx) == 0 ) then - ! depvel(:ncol,xmpan_ndx) = depvel(:ncol,mpan_ndx) - ! dflx(:ncol,xmpan_ndx) = wrk(:ncol) * depvel(:ncol,xmpan_ndx) * q(:ncol,plev,xmpan_ndx) - ! end if - ! endif - ! if( xonit_dd ) then - ! if( map(xonit_ndx) == 0 ) then - ! depvel(:ncol,xonit_ndx) = depvel(:ncol,onit_ndx) - ! dflx(:ncol,xonit_ndx) = wrk(:ncol) * depvel(:ncol,xonit_ndx) * q(:ncol,plev,xonit_ndx) - ! end if - ! endif - ! if( xonitr_dd ) then - ! if( map(xonitr_ndx) == 0 ) then - ! depvel(:ncol,xonitr_ndx) = depvel(:ncol,onitr_ndx) - ! dflx(:ncol,xonitr_ndx) = wrk(:ncol) * depvel(:ncol,xonitr_ndx) * q(:ncol,plev,xonitr_ndx) - ! end if - ! endif - ! if( xno_dd ) then - ! if( map(xno_ndx) == 0 ) then - ! depvel(:ncol,xno_ndx) = depvel(:ncol,no_ndx) - ! dflx(:ncol,xno_ndx) = wrk(:ncol) * depvel(:ncol,xno_ndx) * q(:ncol,plev,xno_ndx) - ! end if - ! endif - ! if( xho2no2_dd ) then - ! if( map(xho2no2_ndx) == 0 ) then - ! depvel(:ncol,xho2no2_ndx) = depvel(:ncol,ho2no2_ndx) - ! dflx(:ncol,xho2no2_ndx) = wrk(:ncol) * depvel(:ncol,xho2no2_ndx) * q(:ncol,plev,xho2no2_ndx) - ! end if - ! endif - ! !lke-TS1 - ! if( phenooh_dd ) then - ! if( map(phenooh_ndx) == 0 ) then - ! depvel(:ncol,phenooh_ndx) = depvel(:ncol,ch3ooh_ndx) - ! dflx(:ncol,phenooh_ndx) = wrk(:ncol) * depvel(:ncol,phenooh_ndx) * q(:ncol,plev,phenooh_ndx) - ! end if - ! endif - ! if( benzooh_dd ) then - ! if( map(benzooh_ndx) == 0 ) then - ! depvel(:ncol,benzooh_ndx) = depvel(:ncol,ch3ooh_ndx) - ! dflx(:ncol,benzooh_ndx) = wrk(:ncol) * depvel(:ncol,benzooh_ndx) * q(:ncol,plev,benzooh_ndx) - ! end if - ! endif - ! if( c6h5ooh_dd ) then - ! if( map(c6h5ooh_ndx) == 0 ) then - ! depvel(:ncol,c6h5ooh_ndx) = depvel(:ncol,ch3ooh_ndx) - ! dflx(:ncol,c6h5ooh_ndx) = wrk(:ncol) * depvel(:ncol,c6h5ooh_ndx) * q(:ncol,plev,c6h5ooh_ndx) - ! end if - ! endif - ! if( bzooh_dd ) then - ! if( map(bzooh_ndx) == 0 ) then - ! depvel(:ncol,bzooh_ndx) = depvel(:ncol,ch3ooh_ndx) - ! dflx(:ncol,bzooh_ndx) = wrk(:ncol) * depvel(:ncol,bzooh_ndx) * q(:ncol,plev,bzooh_ndx) - ! end if - ! endif - ! if( xylolooh_dd ) then - ! if( map(xylolooh_ndx) == 0 ) then - ! depvel(:ncol,xylolooh_ndx) = depvel(:ncol,ch3ooh_ndx) - ! dflx(:ncol,xylolooh_ndx) = wrk(:ncol) * depvel(:ncol,xylolooh_ndx) * q(:ncol,plev,xylolooh_ndx) - ! end if - ! endif - ! if( xylenooh_dd ) then - ! if( map(xylenooh_ndx) == 0 ) then - ! depvel(:ncol,xylenooh_ndx) = depvel(:ncol,ch3ooh_ndx) - ! dflx(:ncol,xylenooh_ndx) = wrk(:ncol) * depvel(:ncol,xylenooh_ndx) * q(:ncol,plev,xylenooh_ndx) - ! end if - ! endif - ! if( terpooh_dd ) then - ! if( map(terpooh_ndx) == 0 ) then - ! depvel(:ncol,terpooh_ndx) = depvel(:ncol,isopooh_ndx) - ! dflx(:ncol,terpooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,terpooh_ndx) - ! end if - ! end if - ! if( terp2ooh_dd ) then - ! if( map(terp2ooh_ndx) == 0 ) then - ! depvel(:ncol,terp2ooh_ndx) = depvel(:ncol,isopooh_ndx) - ! dflx(:ncol,terp2ooh_ndx) = wrk(:ncol) * tmp(:ncol) * q(:ncol,plev,terp2ooh_ndx) - ! end if - ! end if - ! if( terprod1_dd ) then - ! if( map(terprod1_ndx) == 0 ) then - ! depvel(:ncol,terprod1_ndx) = depvel(:ncol,hyac_ndx) - ! dflx(:ncol,terprod1_ndx) = wrk(:ncol) * depvel(:ncol,terprod1_ndx) * q(:ncol,plev,terprod1_ndx) - ! end if - ! endif - ! if( terprod2_dd ) then - ! if( map(terprod2_ndx) == 0 ) then - ! depvel(:ncol,terprod2_ndx) = depvel(:ncol,hyac_ndx) - ! dflx(:ncol,terprod2_ndx) = wrk(:ncol) * depvel(:ncol,terprod2_ndx) * q(:ncol,plev,terprod2_ndx) - ! end if - ! endif - ! if( hmprop_dd ) then - ! if( map(hmprop_ndx) == 0 ) then - ! depvel(:ncol,hmprop_ndx) = depvel(:ncol,glyald_ndx) - ! dflx(:ncol,hmprop_ndx) = wrk(:ncol) * depvel(:ncol,hmprop_ndx) * q(:ncol,plev,hmprop_ndx) - ! end if - ! endif - ! if( mboooh_dd ) then - ! if( map(mboooh_ndx) == 0 ) then - ! depvel(:ncol,mboooh_ndx) = depvel(:ncol,isopooh_ndx) - ! dflx(:ncol,mboooh_ndx) = wrk(:ncol) * depvel(:ncol,mboooh_ndx) * q(:ncol,plev,mboooh_ndx) - ! end if - ! endif - ! if( hpald_dd ) then - ! if( map(hpald_ndx) == 0 ) then - ! depvel(:ncol,hpald_ndx) = depvel(:ncol,ch3ooh_ndx) - ! dflx(:ncol,hpald_ndx) = wrk(:ncol) * depvel(:ncol,hpald_ndx) * q(:ncol,plev,hpald_ndx) - ! end if - ! endif - ! if( iepox_dd ) then - ! if( map(iepox_ndx) == 0 ) then - ! depvel(:ncol,iepox_ndx) = depvel(:ncol,hyac_ndx) - ! dflx(:ncol,iepox_ndx) = wrk(:ncol) * depvel(:ncol,iepox_ndx) * q(:ncol,plev,iepox_ndx) - ! end if - ! endif - ! if( noa_dd ) then - ! if( map(noa_ndx) == 0 ) then - ! depvel(:ncol,noa_ndx) = depvel(:ncol,h2o2_ndx) - ! dflx(:ncol,noa_ndx) = wrk(:ncol) * depvel(:ncol,noa_ndx) * q(:ncol,plev,noa_ndx) - ! end if - ! endif - ! if( alknit_dd ) then - ! if( map(alknit_ndx) == 0 ) then - ! depvel(:ncol,alknit_ndx) = depvel(:ncol,h2o2_ndx) - ! dflx(:ncol,alknit_ndx) = wrk(:ncol) * depvel(:ncol,alknit_ndx) * q(:ncol,plev,alknit_ndx) - ! end if - ! endif - ! if( isopnita_dd ) then - ! if( map(isopnita_ndx) == 0 ) then - ! depvel(:ncol,isopnita_ndx) = depvel(:ncol,h2o2_ndx) - ! dflx(:ncol,isopnita_ndx) = wrk(:ncol) * depvel(:ncol,isopnita_ndx) * q(:ncol,plev,isopnita_ndx) - ! end if - ! endif - ! if( isopnitb_dd ) then - ! if( map(isopnitb_ndx) == 0 ) then - ! depvel(:ncol,isopnitb_ndx) = depvel(:ncol,h2o2_ndx) - ! dflx(:ncol,isopnitb_ndx) = wrk(:ncol) * depvel(:ncol,isopnitb_ndx) * q(:ncol,plev,isopnitb_ndx) - ! end if - ! endif - ! if( honitr_dd ) then - ! if( map(honitr_ndx) == 0 ) then - ! depvel(:ncol,honitr_ndx) = depvel(:ncol,h2o2_ndx) - ! dflx(:ncol,honitr_ndx) = wrk(:ncol) * depvel(:ncol,honitr_ndx) * q(:ncol,plev,honitr_ndx) - ! end if - ! endif - ! if( isopnooh_dd ) then - ! if( map(isopnooh_ndx) == 0 ) then - ! depvel(:ncol,isopnooh_ndx) = depvel(:ncol,h2o2_ndx) - ! dflx(:ncol,isopnooh_ndx) = wrk(:ncol) * depvel(:ncol,isopnooh_ndx) * q(:ncol,plev,isopnooh_ndx) - ! end if - ! endif - ! if( nc4cho_dd ) then - ! if( map(nc4cho_ndx) == 0 ) then - ! depvel(:ncol,nc4cho_ndx) = depvel(:ncol,h2o2_ndx) - ! dflx(:ncol,nc4cho_ndx) = wrk(:ncol) * depvel(:ncol,nc4cho_ndx) * q(:ncol,plev,nc4cho_ndx) - ! end if - ! endif - ! if( nc4ch2oh_dd ) then - ! if( map(nc4ch2oh_ndx) == 0 ) then - ! depvel(:ncol,nc4ch2oh_ndx) = depvel(:ncol,h2o2_ndx) - ! dflx(:ncol,nc4ch2oh_ndx) = wrk(:ncol) * depvel(:ncol,nc4ch2oh_ndx) * q(:ncol,plev,nc4ch2oh_ndx) - ! end if - ! endif - ! if( terpnit_dd ) then - ! if( map(terpnit_ndx) == 0 ) then - ! depvel(:ncol,terpnit_ndx) = depvel(:ncol,h2o2_ndx) - ! dflx(:ncol,terpnit_ndx) = wrk(:ncol) * depvel(:ncol,terpnit_ndx) * q(:ncol,plev,terpnit_ndx) - ! end if - ! endif - ! if( nterpooh_dd ) then - ! if( map(nterpooh_ndx) == 0 ) then - ! depvel(:ncol,nterpooh_ndx) = depvel(:ncol,h2o2_ndx) - ! dflx(:ncol,nterpooh_ndx) = wrk(:ncol) * depvel(:ncol,nterpooh_ndx) * q(:ncol,plev,nterpooh_ndx) - ! end if - ! endif - - - !end subroutine drydep_table - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - subroutine dvel_inti_xactive( depvel_lnd_file, clim_soilw_file, season_wes_file ) - !------------------------------------------------------------------------------------- - ! ... intialize interactive drydep - !------------------------------------------------------------------------------------- - use dycore, only : dycore_is - use mo_constants, only : r2d - use chem_mods, only : adv_mass - use mo_chem_utls, only : get_spc_ndx ! Replaced, TMMF - use seq_drydep_mod,only : drydep_method, DD_XATM, DD_XLND - use phys_control, only : phys_getopts - - implicit none - - !------------------------------------------------------------------------------------- - ! ... dummy arguments - !------------------------------------------------------------------------------------- - character(len=*), intent(in) :: depvel_lnd_file, clim_soilw_file, season_wes_file - - !------------------------------------------------------------------------------------- - ! ... local variables - !------------------------------------------------------------------------------------- - integer :: i, j, ii, jj, jl, ju - integer :: nlon_veg, nlat_veg, npft_veg - integer :: nlat_lai, npft_lai, pos_min, imin - integer :: dimid - integer :: m, n, l, id - integer :: length1, astat - integer, allocatable :: wk_lai(:,:,:) - integer, allocatable :: index_season_lai_j(:,:) - integer :: k, num_max, k_max - integer :: num_seas(5) - integer :: plon, plat - integer :: ierr, ndx - - real(r8) :: spc_mass - real(r8) :: diff_min, target_lat - real(r8), allocatable :: vegetation_map(:,:,:) - real(r8), pointer :: soilw_map(:,:,:) - real(r8), allocatable :: work(:,:) - real(r8), allocatable :: landmask(:,:) - real(r8), allocatable :: urban(:,:) - real(r8), allocatable :: lake(:,:) - real(r8), allocatable :: wetland(:,:) - real(r8), allocatable :: lon_veg(:) - real(r8), allocatable :: lon_veg_edge(:) - real(r8), allocatable :: lat_veg(:) - real(r8), allocatable :: lat_veg_edge(:) - real(r8), allocatable :: lat_lai(:) - real(r8), allocatable :: clat(:) - character(len=32) :: test_name - character(len=4) :: tag_name - type(file_desc_t) :: piofile - type(var_desc_t) :: vid - logical :: do_soilw - - character(len=shr_kind_cl) :: locfn - logical :: prog_modal_aero - - ! determine if modal aerosols are active so that fraction_landuse array is initialized for modal aerosal dry dep - call phys_getopts(prog_modal_aero_out=prog_modal_aero) - - call dvel_inti_fromlnd() - - if( masterproc ) then - write(iulog,*) 'drydep_inti: following species have dry deposition' - do i=1,nddvels - if( len_trim(drydep_list(i)) > 0 ) then - write(iulog,*) 'drydep_inti: '//trim(drydep_list(i))//' is requested to have dry dep' - endif - enddo - write(iulog,*) 'drydep_inti:' - endif - - !------------------------------------------------------------------------------------- - ! ... get species indices - !------------------------------------------------------------------------------------- - xpan_ndx = get_spc_ndx( 'XPAN' ) - xmpan_ndx = get_spc_ndx( 'XMPAN' ) - o3a_ndx = get_spc_ndx( 'O3A' ) - - ch4_ndx = get_spc_ndx( 'CH4' ) - h2_ndx = get_spc_ndx( 'H2' ) - co_ndx = get_spc_ndx( 'CO' ) - Pb_ndx = get_spc_ndx( 'Pb' ) - pan_ndx = get_spc_ndx( 'PAN' ) - mpan_ndx = get_spc_ndx( 'MPAN' ) - o3_ndx = get_spc_ndx( 'OX' ) - if( o3_ndx < 0 ) then - o3_ndx = get_spc_ndx( 'O3' ) - end if - so2_ndx = get_spc_ndx( 'SO2' ) - alkooh_ndx = get_spc_ndx( 'ALKOOH') - mekooh_ndx = get_spc_ndx( 'MEKOOH') - tolooh_ndx = get_spc_ndx( 'TOLOOH') - terpooh_ndx = get_spc_ndx( 'TERPOOH') - ch3cooh_ndx = get_spc_ndx( 'CH3COOH') - soa_ndx = get_spc_ndx( 'SOA' ) - so4_ndx = get_spc_ndx( 'SO4' ) - cb1_ndx = get_spc_ndx( 'CB1' ) - cb2_ndx = get_spc_ndx( 'CB2' ) - oc1_ndx = get_spc_ndx( 'OC1' ) - oc2_ndx = get_spc_ndx( 'OC2' ) - nh3_ndx = get_spc_ndx( 'NH3' ) - nh4no3_ndx = get_spc_ndx( 'NH4NO3' ) - sa1_ndx = get_spc_ndx( 'SA1' ) - sa2_ndx = get_spc_ndx( 'SA2' ) - sa3_ndx = get_spc_ndx( 'SA3' ) - sa4_ndx = get_spc_ndx( 'SA4' ) - nh4_ndx = get_spc_ndx( 'NH4' ) - alkooh_dd = has_drydep( 'ALKOOH') - mekooh_dd = has_drydep( 'MEKOOH') - tolooh_dd = has_drydep( 'TOLOOH') - terpooh_dd = has_drydep( 'TERPOOH') - ch3cooh_dd = has_drydep( 'CH3COOH') - soa_dd = has_drydep( 'SOA' ) - so4_dd = has_drydep( 'SO4' ) - cb1_dd = has_drydep( 'CB1' ) - cb2_dd = has_drydep( 'CB2' ) - oc1_dd = has_drydep( 'OC1' ) - oc2_dd = has_drydep( 'OC2' ) - nh3_dd = has_drydep( 'NH3' ) - nh4no3_dd = has_drydep( 'NH4NO3' ) - sa1_dd = has_drydep( 'SA1' ) - sa2_dd = has_drydep( 'SA2' ) - sa3_dd = has_drydep( 'SA3' ) - sa4_dd = has_drydep( 'SA4' ) - nh4_dd = has_drydep( 'NH4' ) -! - soam_ndx = get_spc_ndx( 'SOAM' ) - soai_ndx = get_spc_ndx( 'SOAI' ) - soat_ndx = get_spc_ndx( 'SOAT' ) - soab_ndx = get_spc_ndx( 'SOAB' ) - soax_ndx = get_spc_ndx( 'SOAX' ) - sogm_ndx = get_spc_ndx( 'SOGM' ) - sogi_ndx = get_spc_ndx( 'SOGI' ) - sogt_ndx = get_spc_ndx( 'SOGT' ) - sogb_ndx = get_spc_ndx( 'SOGB' ) - sogx_ndx = get_spc_ndx( 'SOGX' ) - soam_dd = has_drydep ( 'SOAM' ) - soai_dd = has_drydep ( 'SOAI' ) - soat_dd = has_drydep ( 'SOAT' ) - soab_dd = has_drydep ( 'SOAB' ) - soax_dd = has_drydep ( 'SOAX' ) - sogm_dd = has_drydep ( 'SOGM' ) - sogi_dd = has_drydep ( 'SOGI' ) - sogt_dd = has_drydep ( 'SOGT' ) - sogb_dd = has_drydep ( 'SOGB' ) - sogx_dd = has_drydep ( 'SOGX' ) -! - hcn_ndx = get_spc_ndx( 'HCN') - ch3cn_ndx = get_spc_ndx( 'CH3CN') - -!lke-TS1 - phenooh_ndx = get_spc_ndx( 'PHENOOH') - benzooh_ndx = get_spc_ndx( 'BENZOOH') - c6h5ooh_ndx = get_spc_ndx( 'C6H5OOH') - bzooh_ndx = get_spc_ndx( 'BZOOH') - xylolooh_ndx = get_spc_ndx( 'XYLOLOOH') - xylenooh_ndx = get_spc_ndx( 'XYLENOOH') - terp2ooh_ndx = get_spc_ndx( 'TERP2OOH') - terprod1_ndx = get_spc_ndx( 'TERPROD1') - terprod2_ndx = get_spc_ndx( 'TERPROD2') - hmprop_ndx = get_spc_ndx( 'HMPROP') - mboooh_ndx = get_spc_ndx( 'MBOOOH') - hpald_ndx = get_spc_ndx( 'HPALD') - iepox_ndx = get_spc_ndx( 'IEPOX') - noa_ndx = get_spc_ndx( 'NOA') - alknit_ndx = get_spc_ndx( 'ALKNIT') - isopnita_ndx = get_spc_ndx( 'ISOPNITA') - isopnitb_ndx = get_spc_ndx( 'ISOPNITB') - honitr_ndx = get_spc_ndx( 'HONITR') - isopnooh_ndx = get_spc_ndx( 'ISOPNOOH') - nc4cho_ndx = get_spc_ndx( 'NC4CHO') - nc4ch2oh_ndx = get_spc_ndx( 'NC4CH2OH') - terpnit_ndx = get_spc_ndx( 'TERPNIT') - nterpooh_ndx = get_spc_ndx( 'NTERPOOH') - phenooh_dd = has_drydep( 'PHENOOH') - benzooh_dd = has_drydep( 'BENZOOH') - c6h5ooh_dd = has_drydep( 'C6H5OOH') - bzooh_dd = has_drydep( 'BZOOH') - xylolooh_dd = has_drydep( 'XYLOLOOH') - xylenooh_dd = has_drydep( 'XYLENOOH') - terp2ooh_dd = has_drydep( 'TERP2OOH') - terprod1_dd = has_drydep( 'TERPROD1') - terprod2_dd = has_drydep( 'TERPROD2') - hmprop_dd = has_drydep( 'HMPROP') - mboooh_dd = has_drydep( 'MBOOOH') - hpald_dd = has_drydep( 'HPALD') - iepox_dd = has_drydep( 'IEPOX') - noa_dd = has_drydep( 'NOA') - alknit_dd = has_drydep( 'ALKNIT') - isopnita_dd = has_drydep( 'ISOPNITA') - isopnitb_dd = has_drydep( 'ISOPNITB') - honitr_dd = has_drydep( 'HONITR') - isopnooh_dd = has_drydep( 'ISOPNOOH') - nc4cho_dd = has_drydep( 'NC4CHO') - nc4ch2oh_dd = has_drydep( 'NC4CH2OH') - terpnit_dd = has_drydep( 'TERPNIT') - nterpooh_dd = has_drydep( 'NTERPOOH') -! - cohc_ndx = get_spc_ndx( 'COhc' ) - come_ndx = get_spc_ndx( 'COme' ) - - tag_cnt=0 - cotag_ndx(:)=-1 - do i = 1,NTAGS - write(tag_name,'(a2,i2.2)') 'CO',i - ndx = get_spc_ndx(tag_name) - if (ndx>0) then - tag_cnt = tag_cnt+1 - cotag_ndx(tag_cnt) = ndx - endif - enddo - - o3s_ndx = get_spc_ndx( 'O3S' ) - - do i=1,nddvels - if ( ( mapping(i) > 0 ) .and. ( drySpc_ndx(i) > 0 ) ) then - m = drySpc_ndx(i) - has_dvel(m) = .true. - map_dvel(m) = i - endif - enddo - - if( all( .not. has_dvel(:) ) ) then - return - end if - - !--------------------------------------------------------------------------- - ! ... allocate module variables - !--------------------------------------------------------------------------- - allocate( dep_ra(pcols,n_land_type,begchunk:endchunk),stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate dep_ra; error = ',astat - call endrun - end if - allocate( dep_rb(pcols,n_land_type,begchunk:endchunk),stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate dep_rb; error = ',astat - call endrun - end if - - if (drydep_method == DD_XLND .and. (.not.prog_modal_aero)) then - return - endif - - do_soilw = .not. dyn_soilw .and. (has_drydep( 'H2' ) .or. has_drydep( 'CO' )) - allocate( fraction_landuse(pcols,n_land_type, begchunk:endchunk),stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate fraction_landuse; error = ',astat - call endrun - end if - if(do_soilw) then - allocate(soilw_3d(pcols,12,begchunk:endchunk),stat=astat) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate soilw_3d error = ',astat - call endrun - end if - end if - - plon = get_dyn_grid_parm('plon') - plat = get_dyn_grid_parm('plat') - allocate( index_season_lai_j(n_land_type,12),stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate index_season_lai_j; error = ',astat - call endrun - end if - if(dycore_is('UNSTRUCTURED') ) then - call get_landuse_and_soilw_from_file(do_soilw) - allocate( index_season_lai(plon,12),stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate index_season_lai; error = ',astat - call endrun - end if - else - allocate( index_season_lai(plat,12),stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate index_season_lai; error = ',astat - call endrun - end if - !--------------------------------------------------------------------------- - ! ... read landuse map - !--------------------------------------------------------------------------- - call getfil (depvel_lnd_file, locfn, 0) - call cam_pio_openfile (piofile, trim(locfn), PIO_NOWRITE) - !--------------------------------------------------------------------------- - ! ... get the dimensions - !--------------------------------------------------------------------------- - ierr = pio_inq_dimid( piofile, 'lon', dimid ) - ierr = pio_inq_dimlen( piofile, dimid, nlon_veg ) - ierr = pio_inq_dimid( piofile, 'lat', dimid ) - ierr = pio_inq_dimlen( piofile, dimid, nlat_veg ) - ierr = pio_inq_dimid( piofile, 'pft', dimid ) - ierr = pio_inq_dimlen( piofile, dimid, npft_veg ) - !--------------------------------------------------------------------------- - ! ... allocate arrays - !--------------------------------------------------------------------------- - allocate( vegetation_map(nlon_veg,nlat_veg,npft_veg), work(nlon_veg,nlat_veg), stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate vegation_map; error = ',astat - call endrun - end if - allocate( urban(nlon_veg,nlat_veg), lake(nlon_veg,nlat_veg), & - landmask(nlon_veg,nlat_veg), wetland(nlon_veg,nlat_veg), stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate vegation_map; error = ',astat - call endrun - end if - allocate( lon_veg(nlon_veg), lat_veg(nlat_veg), & - lon_veg_edge(nlon_veg+1), lat_veg_edge(nlat_veg+1), stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate vegation lon, lat arrays; error = ',astat - call endrun - end if - !--------------------------------------------------------------------------- - ! ... read the vegetation map and landmask - !--------------------------------------------------------------------------- - ierr = pio_inq_varid( piofile, 'PCT_PFT', vid ) - ierr = pio_get_var( piofile, vid, vegetation_map ) - - ierr = pio_inq_varid( piofile, 'LANDMASK', vid ) - ierr = pio_get_var( piofile, vid, landmask ) - - ierr = pio_inq_varid( piofile, 'PCT_URBAN', vid ) - ierr = pio_get_var( piofile, vid, urban ) - - ierr = pio_inq_varid( piofile, 'PCT_LAKE', vid ) - ierr = pio_get_var( piofile, vid, lake ) - - ierr = pio_inq_varid( piofile, 'PCT_WETLAND', vid ) - ierr = pio_get_var( piofile, vid, wetland ) - - call cam_pio_closefile( piofile ) - - !--------------------------------------------------------------------------- - ! scale vegetation, urban, lake, and wetland to fraction - !--------------------------------------------------------------------------- - vegetation_map(:,:,:) = .01_r8 * vegetation_map(:,:,:) - wetland(:,:) = .01_r8 * wetland(:,:) - lake(:,:) = .01_r8 * lake(:,:) - urban(:,:) = .01_r8 * urban(:,:) -#ifdef DEBUG - if(masterproc) then - write(iulog,*) 'minmax vegetation_map ',minval(vegetation_map),maxval(vegetation_map) - write(iulog,*) 'minmax wetland ',minval(wetland),maxval(wetland) - write(iulog,*) 'minmax landmask ',minval(landmask),maxval(landmask) - end if -#endif - !--------------------------------------------------------------------------- - ! ... define lat-lon of vegetation map (1x1) - !--------------------------------------------------------------------------- - lat_veg(:) = (/ (-89.5_r8 + (i-1),i=1,nlat_veg ) /) - lon_veg(:) = (/ ( 0.5_r8 + (i-1),i=1,nlon_veg ) /) - lat_veg_edge(:) = (/ (-90.0_r8 + (i-1),i=1,nlat_veg+1) /) - lon_veg_edge(:) = (/ ( 0.0_r8 + (i-1),i=1,nlon_veg+1) /) - !--------------------------------------------------------------------------- - ! ... read soilw table if necessary - !--------------------------------------------------------------------------- - - if( do_soilw ) then - call soilw_inti( clim_soilw_file, nlon_veg, nlat_veg, soilw_map ) - end if - - !--------------------------------------------------------------------------- - ! ... regrid to model grid - !--------------------------------------------------------------------------- - - call interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_veg_edge, & - lon_veg, lon_veg_edge, landmask, urban, lake, & - wetland, vegetation_map, soilw_map, do_soilw ) - - deallocate( vegetation_map, work, stat=astat ) - deallocate( lon_veg, lat_veg, lon_veg_edge, lat_veg_edge, stat=astat ) - deallocate( landmask, urban, lake, wetland, stat=astat ) - if( do_soilw ) then - deallocate( soilw_map, stat=astat ) - end if - endif ! Unstructured grid - - if (drydep_method == DD_XLND) then - return - endif - - !--------------------------------------------------------------------------- - ! ... read LAI based season indeces - !--------------------------------------------------------------------------- - call getfil (season_wes_file, locfn, 0) - call cam_pio_openfile (piofile, trim(locfn), PIO_NOWRITE) - !--------------------------------------------------------------------------- - ! ... get the dimensions - !--------------------------------------------------------------------------- - ierr = pio_inq_dimid( piofile, 'lat', dimid ) - ierr = pio_inq_dimlen( piofile, dimid, nlat_lai ) - ierr = pio_inq_dimid( piofile, 'pft', dimid ) - ierr = pio_inq_dimlen( piofile, dimid, npft_lai ) - !--------------------------------------------------------------------------- - ! ... allocate arrays - !--------------------------------------------------------------------------- - allocate( lat_lai(nlat_lai), wk_lai(nlat_lai,npft_lai,12), stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate vegation_map; error = ',astat - call endrun - end if - !--------------------------------------------------------------------------- - ! ... read the latitude and the season indicies - !--------------------------------------------------------------------------- - ierr = pio_inq_varid( piofile, 'lat', vid ) - ierr = pio_get_var( piofile, vid, lat_lai ) - - ierr = pio_inq_varid( piofile, 'season_wes', vid ) - ierr = pio_get_var( piofile, vid, wk_lai ) - - call cam_pio_closefile( piofile ) - - - if(dycore_is('UNSTRUCTURED') ) then - ! For unstructured grids plon is the 1d horizontal grid size and plat=1 - allocate(clat(plon)) - call get_horiz_grid_d(plon, clat_d_out=clat) - jl = 1 - ju = plon - else - allocate(clat(plat)) - call get_horiz_grid_d(plat, clat_d_out=clat) - jl = 1 - ju = plat - end if - imin = 1 - do j = 1,ju - diff_min = 10._r8 - pos_min = -99 - target_lat = clat(j)*r2d - do i = imin,nlat_lai - if( abs(lat_lai(i) - target_lat) < diff_min ) then - diff_min = abs(lat_lai(i) - target_lat) - pos_min = i - end if - end do - if( pos_min < 0 ) then - write(iulog,*) 'dvel_inti: cannot find ',target_lat,' at j,pos_min,diff_min = ',j,pos_min,diff_min - write(iulog,*) 'dvel_inti: imin,nlat_lai = ',imin,nlat_lai - write(iulog,*) 'dvel_inti: lat_lai' - write(iulog,'(1p,10g12.5)') lat_lai(:) - call endrun - end if - if(dycore_is('UNSTRUCTURED') ) then - imin=1 - else - imin = pos_min - end if - index_season_lai_j(:,:) = wk_lai(pos_min,:,:) - - !--------------------------------------------------------------------------- - ! specify the season as the most frequent in the 11 vegetation classes - ! this was done to remove a banding problem in dvel (JFL Oct 04) - !--------------------------------------------------------------------------- - do m = 1,12 - num_seas = 0 - do l = 1,11 - do k = 1,5 - if( index_season_lai_j(l,m) == k ) then - num_seas(k) = num_seas(k) + 1 - exit - end if - end do - end do - - num_max = -1 - do k = 1,5 - if( num_seas(k) > num_max ) then - num_max = num_seas(k) - k_max = k - endif - end do - - index_season_lai(j,m) = k_max - end do - end do - - deallocate( lat_lai, wk_lai, clat, index_season_lai_j) - - end subroutine dvel_inti_xactive - - subroutine dvel_inti_xactive_landuse( depvel_lnd_file, clim_soilw_file ) - !------------------------------------------------------------------------------------- - ! ... intialize interactive drydep - !------------------------------------------------------------------------------------- - use dycore, only : dycore_is - use mo_constants, only : r2d - use chem_mods, only : adv_mass - use mo_chem_utls, only : get_spc_ndx ! Replaced, TMMF - use seq_drydep_mod,only : drydep_method, DD_XATM, DD_XLND - use phys_control, only : phys_getopts - - implicit none - - !------------------------------------------------------------------------------------- - ! ... dummy arguments - !------------------------------------------------------------------------------------- - character(len=*), intent(in) :: depvel_lnd_file, clim_soilw_file - - !------------------------------------------------------------------------------------- - ! ... local variables - !------------------------------------------------------------------------------------- - integer :: i, j, ii, jj, jl, ju - integer :: nlon_veg, nlat_veg, npft_veg - integer :: nlat_lai, npft_lai, pos_min, imin - integer :: dimid - integer :: m, n, l, id - integer :: length1, astat - integer :: k, num_max, k_max - integer :: num_seas(5) - integer :: plon, plat - integer :: ierr, ndx - - real(r8) :: spc_mass - real(r8) :: diff_min, target_lat - real(r8), allocatable :: vegetation_map(:,:,:) - real(r8), pointer :: soilw_map(:,:,:) - real(r8), allocatable :: work(:,:) - real(r8), allocatable :: landmask(:,:) - real(r8), allocatable :: urban(:,:) - real(r8), allocatable :: lake(:,:) - real(r8), allocatable :: wetland(:,:) - real(r8), allocatable :: lon_veg(:) - real(r8), allocatable :: lon_veg_edge(:) - real(r8), allocatable :: lat_veg(:) - real(r8), allocatable :: lat_veg_edge(:) - character(len=32) :: test_name - character(len=4) :: tag_name - type(file_desc_t) :: piofile - type(var_desc_t) :: vid - logical :: do_soilw - - character(len=shr_kind_cl) :: locfn - logical :: prog_modal_aero - - ! determine if modal aerosols are active so that fraction_landuse array is initialized for modal aerosal dry dep - call phys_getopts(prog_modal_aero_out=prog_modal_aero) - - call dvel_inti_fromlnd() - - !--------------------------------------------------------------------------- - ! ... allocate module variables - !--------------------------------------------------------------------------- - if (drydep_method == DD_XLND .and. (.not.prog_modal_aero)) then - return - endif - - do_soilw = .not. dyn_soilw - allocate( fraction_landuse(pcols,n_land_type, begchunk:endchunk),stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate fraction_landuse; error = ',astat - call endrun - end if - if(do_soilw) then - allocate(soilw_3d(pcols,12,begchunk:endchunk),stat=astat) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate soilw_3d error = ',astat - call endrun - end if - end if - - plon = get_dyn_grid_parm('plon') - plat = get_dyn_grid_parm('plat') - if(dycore_is('UNSTRUCTURED') ) then - call get_landuse_and_soilw_from_file(do_soilw) - else - !--------------------------------------------------------------------------- - ! ... read landuse map - !--------------------------------------------------------------------------- - call getfil (depvel_lnd_file, locfn, 0) - call cam_pio_openfile (piofile, trim(locfn), PIO_NOWRITE) - !--------------------------------------------------------------------------- - ! ... get the dimensions - !--------------------------------------------------------------------------- - ierr = pio_inq_dimid( piofile, 'lon', dimid ) - ierr = pio_inq_dimlen( piofile, dimid, nlon_veg ) - ierr = pio_inq_dimid( piofile, 'lat', dimid ) - ierr = pio_inq_dimlen( piofile, dimid, nlat_veg ) - ierr = pio_inq_dimid( piofile, 'pft', dimid ) - ierr = pio_inq_dimlen( piofile, dimid, npft_veg ) - !--------------------------------------------------------------------------- - ! ... allocate arrays - !--------------------------------------------------------------------------- - allocate( vegetation_map(nlon_veg,nlat_veg,npft_veg), work(nlon_veg,nlat_veg), stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate vegation_map; error = ',astat - call endrun - end if - allocate( urban(nlon_veg,nlat_veg), lake(nlon_veg,nlat_veg), & - landmask(nlon_veg,nlat_veg), wetland(nlon_veg,nlat_veg), stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate vegation_map; error = ',astat - call endrun - end if - allocate( lon_veg(nlon_veg), lat_veg(nlat_veg), & - lon_veg_edge(nlon_veg+1), lat_veg_edge(nlat_veg+1), stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'dvel_inti: failed to allocate vegation lon, lat arrays; error = ',astat - call endrun - end if - !--------------------------------------------------------------------------- - ! ... read the vegetation map and landmask - !--------------------------------------------------------------------------- - ierr = pio_inq_varid( piofile, 'PCT_PFT', vid ) - ierr = pio_get_var( piofile, vid, vegetation_map ) - - ierr = pio_inq_varid( piofile, 'LANDMASK', vid ) - ierr = pio_get_var( piofile, vid, landmask ) - - ierr = pio_inq_varid( piofile, 'PCT_URBAN', vid ) - ierr = pio_get_var( piofile, vid, urban ) - - ierr = pio_inq_varid( piofile, 'PCT_LAKE', vid ) - ierr = pio_get_var( piofile, vid, lake ) - - ierr = pio_inq_varid( piofile, 'PCT_WETLAND', vid ) - ierr = pio_get_var( piofile, vid, wetland ) - - call cam_pio_closefile( piofile ) - - !--------------------------------------------------------------------------- - ! scale vegetation, urban, lake, and wetland to fraction - !--------------------------------------------------------------------------- - vegetation_map(:,:,:) = .01_r8 * vegetation_map(:,:,:) - wetland(:,:) = .01_r8 * wetland(:,:) - lake(:,:) = .01_r8 * lake(:,:) - urban(:,:) = .01_r8 * urban(:,:) -#ifdef DEBUG - if(masterproc) then - write(iulog,*) 'minmax vegetation_map ',minval(vegetation_map),maxval(vegetation_map) - write(iulog,*) 'minmax wetland ',minval(wetland),maxval(wetland) - write(iulog,*) 'minmax landmask ',minval(landmask),maxval(landmask) - end if -#endif - !--------------------------------------------------------------------------- - ! ... define lat-lon of vegetation map (1x1) - !--------------------------------------------------------------------------- - lat_veg(:) = (/ (-89.5_r8 + (i-1),i=1,nlat_veg ) /) - lon_veg(:) = (/ ( 0.5_r8 + (i-1),i=1,nlon_veg ) /) - lat_veg_edge(:) = (/ (-90.0_r8 + (i-1),i=1,nlat_veg+1) /) - lon_veg_edge(:) = (/ ( 0.0_r8 + (i-1),i=1,nlon_veg+1) /) - !--------------------------------------------------------------------------- - ! ... read soilw table if necessary - !--------------------------------------------------------------------------- - - if( do_soilw ) then - call soilw_inti( clim_soilw_file, nlon_veg, nlat_veg, soilw_map ) - end if - - !--------------------------------------------------------------------------- - ! ... regrid to model grid - !--------------------------------------------------------------------------- - - call interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_veg_edge, & - lon_veg, lon_veg_edge, landmask, urban, lake, & - wetland, vegetation_map, soilw_map, do_soilw ) - - deallocate( vegetation_map, work, stat=astat ) - deallocate( lon_veg, lat_veg, lon_veg_edge, lat_veg_edge, stat=astat ) - deallocate( landmask, urban, lake, wetland, stat=astat ) - if( do_soilw ) then - deallocate( soilw_map, stat=astat ) - end if - endif ! Unstructured grid - - end subroutine dvel_inti_xactive_landuse - - !------------------------------------------------------------------------------------- - subroutine get_landuse_and_soilw_from_file(do_soilw) - use ncdio_atm, only : infld - logical, intent(in) :: do_soilw - logical :: readvar - - type(file_desc_t) :: piofile - character(len=shr_kind_cl) :: locfn - logical :: lexist - - call getfil (drydep_srf_file, locfn, 1, lexist) - if(lexist) then - call cam_pio_openfile(piofile, locfn, PIO_NOWRITE) - - call infld('fraction_landuse', piofile, 'ncol','class',1,pcols,1,n_land_type, begchunk,endchunk, & - fraction_landuse, readvar, gridname='physgrid') - if (.not. readvar) then - write(iulog,*)'**************************************' - write(iulog,*)'get_landuse_and_soilw_from_file: INFO:' - write(iulog,*)' fraction_landuse not read from file: ' - write(iulog,*)' ', trim(locfn) - write(iulog,*)' setting all values to zero' - write(iulog,*)'**************************************' - fraction_landuse = 0._r8 - end if - - if(do_soilw) then - call infld('soilw', piofile, 'ncol','month',1,pcols,1,12, begchunk,endchunk, & - soilw_3d, readvar, gridname='physgrid') - end if - - call cam_pio_closefile(piofile) - else - call endrun('Unstructured grids require drydep_srf_file ') - end if - - - end subroutine get_landuse_and_soilw_from_file - - !------------------------------------------------------------------------------------- - subroutine interp_map( plon, plat, nlon_veg, nlat_veg, npft_veg, lat_veg, lat_veg_edge, & - lon_veg, lon_veg_edge, landmask, urban, lake, & - wetland, vegetation_map, soilw_map, do_soilw ) - - use mo_constants, only : r2d - use scamMod, only : latiop,loniop,scmlat,scmlon,scm_cambfb_mode - use shr_scam_mod , only: shr_scam_getCloseLatLon ! Standardized system subroutines - use cam_initfiles, only: initial_file_get_id - use dycore, only : dycore_is - use phys_grid, only : scatter_field_to_chunk - implicit none - - !------------------------------------------------------------------------------------- - ! ... dummy arguments - !------------------------------------------------------------------------------------- - integer, intent(in) :: plon, plat, nlon_veg, nlat_veg, npft_veg - real(r8), pointer :: soilw_map(:,:,:) - real(r8), intent(in) :: landmask(nlon_veg,nlat_veg) - real(r8), intent(in) :: urban(nlon_veg,nlat_veg) - real(r8), intent(in) :: lake(nlon_veg,nlat_veg) - real(r8), intent(in) :: wetland(nlon_veg,nlat_veg) - real(r8), intent(in) :: vegetation_map(nlon_veg,nlat_veg,npft_veg) - real(r8), intent(in) :: lon_veg(nlon_veg) - real(r8), intent(in) :: lon_veg_edge(nlon_veg+1) - real(r8), intent(in) :: lat_veg(nlat_veg) - real(r8), intent(in) :: lat_veg_edge(nlat_veg+1) - logical, intent(in) :: do_soilw - - !------------------------------------------------------------------------------------- - ! ... local variables - !------------------------------------------------------------------------------------- - real(r8) :: closelat,closelon - integer :: latidx,lonidx - - integer, parameter :: veg_ext = 20 - type(file_desc_t), pointer :: piofile - integer :: i, j, ii, jj, jl, ju, i_ndx, n - integer, dimension(plon+1) :: ind_lon - integer, dimension(plat+1) :: ind_lat - real(r8) :: total_land - real(r8), dimension(plon+1) :: lon_edge - real(r8), dimension(plat+1) :: lat_edge - real(r8) :: lat1, lat2, lon1, lon2 - real(r8) :: x1, x2, y1, y2, dx, dy - real(r8) :: area, total_area - real(r8), dimension(npft_veg+3) :: fraction - real(r8) :: total_soilw_area - real(r8) :: fraction_soilw - real(r8) :: total_soilw(12) - - real(r8), dimension(-veg_ext:nlon_veg+veg_ext) :: lon_veg_edge_ext - integer, dimension(-veg_ext:nlon_veg+veg_ext) :: mapping_ext - - real(r8), allocatable :: lam(:), phi(:), garea(:) - - logical, parameter :: has_npole = .true. - integer :: ploniop,platiop - real(r8) :: tmp_frac_lu(plon,n_land_type,plat), tmp_soilw_3d(plon,12,plat) - - if(dycore_is('UNSTRUCTURED') ) then - ! For unstructured grids plon is the 1d horizontal grid size and plat=1 - allocate(lam(plon), phi(plon)) - call get_horiz_grid_d(plon, clat_d_out=phi) - else - allocate(lam(plon), phi(plat)) - call get_horiz_grid_d(plat, clat_d_out=phi) - endif - call get_horiz_grid_d(plon, clon_d_out=lam) - - - jl = 1 - ju = plon - - if (single_column) then - if (scm_cambfb_mode) then - piofile => initial_file_get_id() - call shr_scam_getCloseLatLon(piofile%fh,scmlat,scmlon,closelat,closelon,latidx,lonidx) - ploniop=size(loniop) - platiop=size(latiop) - else - latidx=1 - lonidx=1 - ploniop=1 - platiop=1 - end if - - lon_edge(1) = loniop(lonidx) * r2d - .5_r8*(loniop(2) - loniop(1)) * r2d - - if (lonidx.lt.ploniop) then - lon_edge(2) = loniop(lonidx+1) * r2d - .5_r8*(loniop(2) - loniop(1)) * r2d - else - lon_edge(2) = lon_edge(1) + (loniop(2) - loniop(1)) * r2d - end if - - lat_edge(1) = latiop(latidx) * r2d - .5_r8*(latiop(2) - latiop(1)) * r2d - - if (latidx.lt.platiop) then - lat_edge(2) = latiop(latidx+1) * r2d - .5_r8*(latiop(2) - latiop(1)) * r2d - else - lat_edge(2) = lat_edge(1) + (latiop(2) - latiop(1)) * r2d - end if - else - do i = 1,plon - lon_edge(i) = lam(i) * r2d - .5_r8*(lam(2) - lam(1)) * r2d - end do - lon_edge(plon+1) = lon_edge(plon) + (lam(2) - lam(1)) * r2d - if( .not. has_npole ) then - do j = 1,plat+1 - lat_edge(j) = phi(j) * r2d - .5_r8*(phi(2) - phi(1)) * r2d - end do - else - do j = 1,plat - lat_edge(j) = phi(j) * r2d - .5_r8*(phi(2) - phi(1)) * r2d - end do - lat_edge(plat+1) = lat_edge(plat) + (phi(2) - phi(1)) * r2d - end if - end if - do j = 1,plat+1 - lat_edge(j) = min( lat_edge(j), 90._r8 ) - lat_edge(j) = max( lat_edge(j),-90._r8 ) - end do - - !------------------------------------------------------------------------------------- - ! wrap around the longitudes - !------------------------------------------------------------------------------------- - do i = -veg_ext,0 - lon_veg_edge_ext(i) = lon_veg_edge(nlon_veg+i) - 360._r8 - mapping_ext (i) = nlon_veg+i - end do - do i = 1,nlon_veg - lon_veg_edge_ext(i) = lon_veg_edge(i) - mapping_ext (i) = i - end do - do i = nlon_veg+1,nlon_veg+veg_ext - lon_veg_edge_ext(i) = lon_veg_edge(i-nlon_veg) + 360._r8 - mapping_ext (i) = i-nlon_veg - end do -#ifdef DEBUG - write(iulog,*) 'interp_map : lon_edge ',lon_edge - write(iulog,*) 'interp_map : lat_edge ',lat_edge - write(iulog,*) 'interp_map : mapping_ext ',mapping_ext -#endif - do j = 1,plon+1 - lon1 = lon_edge(j) - do i = -veg_ext,nlon_veg+veg_ext - dx = lon_veg_edge_ext(i ) - lon1 - dy = lon_veg_edge_ext(i+1) - lon1 - if( dx*dy <= 0._r8 ) then - ind_lon(j) = i - exit - end if - end do - end do - - do j = 1,plat+1 - lat1 = lat_edge(j) - do i = 1,nlat_veg - dx = lat_veg_edge(i ) - lat1 - dy = lat_veg_edge(i+1) - lat1 - if( dx*dy <= 0._r8 ) then - ind_lat(j) = i - exit - end if - end do - end do -#ifdef DEBUG - write(iulog,*) 'interp_map : ind_lon ',ind_lon - write(iulog,*) 'interp_map : ind_lat ',ind_lat -#endif - lat_loop : do j = 1,plat - lon_loop : do i = 1,plon - total_area = 0._r8 - fraction = 0._r8 - total_soilw(:) = 0._r8 - total_soilw_area = 0._r8 - do jj = ind_lat(j),ind_lat(j+1) - y1 = max( lat_edge(j),lat_veg_edge(jj) ) - y2 = min( lat_edge(j+1),lat_veg_edge(jj+1) ) - dy = (y2 - y1)/(lat_veg_edge(jj+1) - lat_veg_edge(jj)) - do ii =ind_lon(i),ind_lon(i+1) - i_ndx = mapping_ext(ii) - x1 = max( lon_edge(i),lon_veg_edge_ext(ii) ) - x2 = min( lon_edge(i+1),lon_veg_edge_ext(ii+1) ) - dx = (x2 - x1)/(lon_veg_edge_ext(ii+1) - lon_veg_edge_ext(ii)) - area = dx * dy - total_area = total_area + area - !----------------------------------------------------------------- - ! ... special case for ocean grid point - !----------------------------------------------------------------- - if( nint(landmask(i_ndx,jj)) == 0 ) then - fraction(npft_veg+1) = fraction(npft_veg+1) + area - else - do n = 1,npft_veg - fraction(n) = fraction(n) + vegetation_map(i_ndx,jj,n) * area - end do - fraction(npft_veg+1) = fraction(npft_veg+1) + area * lake (i_ndx,jj) - fraction(npft_veg+2) = fraction(npft_veg+2) + area * wetland(i_ndx,jj) - fraction(npft_veg+3) = fraction(npft_veg+3) + area * urban (i_ndx,jj) - !----------------------------------------------------------------- - ! ... check if land accounts for the whole area. - ! If not, the remaining area is in the ocean - !----------------------------------------------------------------- - total_land = sum(vegetation_map(i_ndx,jj,:)) & - + urban (i_ndx,jj) & - + lake (i_ndx,jj) & - + wetland(i_ndx,jj) - if( total_land < 1._r8 ) then - fraction(npft_veg+1) = fraction(npft_veg+1) + (1._r8 - total_land) * area - end if - !------------------------------------------------------------------------------------- - ! ... compute weighted average of soilw over grid (non-water only) - !------------------------------------------------------------------------------------- - if( do_soilw ) then - fraction_soilw = total_land - (lake(i_ndx,jj) + wetland(i_ndx,jj)) - total_soilw_area = total_soilw_area + fraction_soilw * area - total_soilw(:) = total_soilw(:) + fraction_soilw * area * soilw_map(i_ndx,jj,:) - end if - end if - end do - end do - !------------------------------------------------------------------------------------- - ! ... divide by total area of grid box - !------------------------------------------------------------------------------------- - fraction(:) = fraction(:)/total_area - !------------------------------------------------------------------------------------- - ! ... make sure we don't have too much or too little - !------------------------------------------------------------------------------------- - if( abs( sum(fraction) - 1._r8) > .001_r8 ) then - fraction(:) = fraction(:)/sum(fraction) - end if - !------------------------------------------------------------------------------------- - ! ... map to Wesely land classification - !------------------------------------------------------------------------------------- - - - - - tmp_frac_lu(i, 1, j) = fraction(20) ! Urban - tmp_frac_lu(i, 2, j) = sum(fraction(16:17)) ! - tmp_frac_lu(i, 3, j) = sum(fraction(13:15)) ! - tmp_frac_lu(i, 4, j) = sum(fraction( 5: 9)) ! - tmp_frac_lu(i, 5, j) = sum(fraction( 2: 4)) ! - tmp_frac_lu(i, 6, j) = fraction(19) ! Wetland - tmp_frac_lu(i, 7, j) = fraction(18) ! Lake - tmp_frac_lu(i, 8, j) = fraction( 1) ! - tmp_frac_lu(i, 9, j) = 0._r8 - tmp_frac_lu(i,10, j) = 0._r8 - tmp_frac_lu(i,11, j) = sum(fraction(10:12)) ! - if( do_soilw ) then - if( total_soilw_area > 0._r8 ) then - tmp_soilw_3d(i,:,j) = total_soilw(:)/total_soilw_area - else - tmp_soilw_3d(i,:,j) = -99._r8 - end if - end if - end do lon_loop - end do lat_loop - !------------------------------------------------------------------------------------- - ! ... reshape according to lat-lon blocks - !------------------------------------------------------------------------------------- - call scatter_field_to_chunk(1,n_land_type,1,plon,tmp_frac_lu,fraction_landuse) - if(do_soilw) call scatter_field_to_chunk(1,12,1,plon,tmp_soilw_3d,soilw_3d) - !------------------------------------------------------------------------------------- - ! ... make sure there are no out of range values - !------------------------------------------------------------------------------------- - where (fraction_landuse < 0._r8) fraction_landuse = 0._r8 - where (fraction_landuse > 1._r8) fraction_landuse = 1._r8 - - end subroutine interp_map - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - subroutine drydep_xactive( ncdate, sfc_temp, pressure_sfc, & - wind_speed, spec_hum, air_temp, pressure_10m, rain, & - snow, solar_flux, dvel, dflx, State_Chm, & - tv, soilw, rh, ncol, lonndx, latndx, lchnk, & - ocnfrc, icefrc, beglandtype, endlandtype ) - !------------------------------------------------------------------------------------- - ! code based on wesely (atmospheric environment, 1989, vol 23, p. 1293-1304) for - ! calculation of r_c, and on walcek et. al. (atmospheric enviroment, 1986, - ! vol. 20, p. 949-964) for calculation of r_a and r_b - ! - ! as suggested in walcek (u_i)(u*_i) = (u_a)(u*_a) - ! is kept constant where i represents a subgrid environment and a the - ! grid average environment. thus the calculation proceeds as follows: - ! va the grid averaged wind is calculated on dots - ! z0(i) the grid averaged roughness coefficient is calculated - ! ri(i) the grid averaged richardson number is calculated - ! --> the grid averaged (u_a)(u*_a) is calculated - ! --> subgrid scale u*_i is calculated assuming (u_i) given as above - ! --> final deposotion velocity is weighted average of subgrid scale velocities - ! - ! code written by P. Hess, rewritten in fortran 90 by JFL (August 2000) - ! modified by JFL to be used in MOZART-2 (October 2002) - !------------------------------------------------------------------------------------- - - use seq_drydep_mod, only: z0, rgso, rgss, h2_a, h2_b, h2_c, ri, rclo, rcls, rlu, rac - use seq_drydep_mod, only: seq_drydep_setHCoeff, foxd, drat - use physconst, only: tmelt - use seq_drydep_mod, only: drydep_method, DD_XLND - - implicit none - - !------------------------------------------------------------------------------------- - ! ... dummy arguments - !------------------------------------------------------------------------------------- - integer, intent(in) :: ncol - integer, intent(in) :: ncdate ! present date (yyyymmdd) - real(r8), intent(in) :: sfc_temp(pcols) ! surface temperature (K) - real(r8), intent(in) :: pressure_sfc(pcols) ! surface pressure (Pa) - real(r8), intent(in) :: wind_speed(pcols) ! 10 meter wind speed (m/s) - real(r8), intent(in) :: spec_hum(pcols) ! specific humidity (kg/kg) - real(r8), intent(in) :: rh(ncol,1) ! relative humidity - real(r8), intent(in) :: air_temp(pcols) ! surface air temperature (K) - real(r8), intent(in) :: pressure_10m(pcols) ! 10 meter pressure (Pa) - real(r8), intent(in) :: rain(pcols) - real(r8), intent(in) :: snow(pcols) ! snow height (m) - real(r8), intent(in) :: soilw(pcols) ! soil moisture fraction - real(r8), intent(in) :: solar_flux(pcols) ! direct shortwave radiation at surface (W/m^2) - real(r8), intent(in) :: tv(pcols) ! potential temperature - type(ChmState), intent(in):: State_Chm ! GEOS-Chem State Chem - real(r8), intent(out) :: dvel(ncol,nTracersMax) ! deposition velocity (cm/s) - real(r8), intent(inout) :: dflx(pcols,nTracersMax) ! deposition flux (/cm^2/s) - - integer, intent(in) :: latndx(pcols) ! chunk latitude indicies - integer, intent(in) :: lonndx(pcols) ! chunk longitude indicies - integer, intent(in) :: lchnk ! chunk number - - integer, intent(in), optional :: beglandtype - integer, intent(in), optional :: endlandtype - - real(r8), intent(in), optional :: ocnfrc(pcols) - real(r8), intent(in), optional :: icefrc(pcols) - - !------------------------------------------------------------------------------------- - ! ... local variables - !------------------------------------------------------------------------------------- - real(r8), parameter :: scaling_to_cm_per_s = 100._r8 - real(r8), parameter :: rain_threshold = 1.e-7_r8 ! of the order of 1cm/day expressed in m/s - - integer :: i, ispec, lt, m - integer :: sndx - integer :: month - - real(r8) :: slope = 0._r8 - real(r8) :: z0water ! revised z0 over water - real(r8) :: p ! pressure at midpoint first layer - real(r8) :: pg ! surface pressure - real(r8) :: es ! saturation vapor pressure - real(r8) :: ws ! saturation mixing ratio - real(r8) :: hvar ! constant to compute xmol - real(r8) :: h ! constant to compute xmol - real(r8) :: psih ! stability correction factor - real(r8) :: rs ! constant for calculating rsmx - real(r8) :: rmx ! resistance by vegetation - real(r8) :: zovl ! ratio of z to m-o length - real(r8) :: cvarb ! cvar averaged over landtypes - real(r8) :: bb ! b averaged over landtypes - real(r8) :: ustarb ! ustar averaged over landtypes - real(r8) :: tc(ncol) ! temperature in celsius - real(r8) :: cts(ncol) ! correction to rlu rcl and rgs for frost - - !------------------------------------------------------------------------------------- - ! local arrays: dependent on location and species - !------------------------------------------------------------------------------------- - real(r8), dimension(ncol,nddvels) :: heff - - !------------------------------------------------------------------------------------- - ! local arrays: dependent on location only - !------------------------------------------------------------------------------------- - integer :: index_season(ncol,n_land_type) - real(r8), dimension(ncol) :: tha ! atmospheric virtual potential temperature - real(r8), dimension(ncol) :: thg ! ground virtual potential temperature - real(r8), dimension(ncol) :: z ! height of lowest level - real(r8), dimension(ncol) :: va ! magnitude of v on cross points - real(r8), dimension(ncol) :: ribn ! richardson number - real(r8), dimension(ncol) :: qs ! saturation specific humidity - real(r8), dimension(ncol) :: crs ! multiplier to calculate crs - real(r8), dimension(ncol) :: rdc ! part of lower canopy resistance - real(r8), dimension(ncol) :: uustar ! u*ustar (assumed constant over grid) - real(r8), dimension(ncol) :: z0b ! average roughness length over grid - real(r8), dimension(ncol) :: wrk ! work array - real(r8), dimension(ncol) :: term ! work array - real(r8), dimension(ncol) :: resc ! work array - real(r8), dimension(ncol) :: lnd_frc ! work array - logical, dimension(ncol) :: unstable - logical, dimension(ncol) :: has_rain - logical, dimension(ncol) :: has_dew - - !------------------------------------------------------------------------------------- - ! local arrays: dependent on location and landtype - !------------------------------------------------------------------------------------- - real(r8), dimension(ncol,n_land_type) :: rds ! resistance for deposition of sulfate - real(r8), dimension(ncol,n_land_type) :: b ! buoyancy parameter for unstable conditions - real(r8), dimension(ncol,n_land_type) :: cvar ! height parameter - real(r8), dimension(ncol,n_land_type) :: ustar ! friction velocity - real(r8), dimension(ncol,n_land_type) :: xmol ! monin-obukhov length - - !------------------------------------------------------------------------------------- - ! local arrays: dependent on location, landtype and species - !------------------------------------------------------------------------------------- - real(r8), dimension(ncol,n_land_type,nTracersMax) :: rsmx ! vegetative resistance (plant mesophyll) - real(r8), dimension(ncol,n_land_type,nTracersMax) :: rclx ! lower canopy resistance - real(r8), dimension(ncol,n_land_type,nTracersMax) :: rlux ! vegetative resistance (upper canopy) - real(r8), dimension(ncol,n_land_type) :: rlux_o3 ! vegetative resistance (upper canopy) - real(r8), dimension(ncol,n_land_type,nTracersMax) :: rgsx ! ground resistance - real(r8) :: pmid(ncol,1) ! for seasalt aerosols - real(r8) :: tfld(ncol,1) ! for seasalt aerosols - real(r8) :: fact, vds - real(r8) :: rc ! combined surface resistance - real(r8) :: var_soilw, dv_soil_h2, fact_h2 ! h2 dvel wrking variables - logical :: fr_lnduse(ncol,n_land_type) ! wrking array - real(r8) :: dewm ! multiplier for rs when dew occurs - - real(r8) :: lcl_frc_landuse(ncol,n_land_type) - - integer :: beglt, endlt - - !------------------------------------------------------------------------------------- - ! jfl : mods for PAN - !------------------------------------------------------------------------------------- - real(r8) :: dv_pan - real(r8) :: c0_pan(11) = (/ 0.000_r8, 0.006_r8, 0.002_r8, 0.009_r8, 0.015_r8, & - 0.006_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.002_r8, 0.002_r8 /) - real(r8) :: k_pan (11) = (/ 0.000_r8, 0.010_r8, 0.005_r8, 0.004_r8, 0.003_r8, & - 0.005_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.075_r8, 0.002_r8 /) - - if (present( beglandtype)) then - beglt = beglandtype - else - beglt = 1 - endif - if (present( endlandtype)) then - endlt = endlandtype - else - endlt = n_land_type - endif - - !------------------------------------------------------------------------------------- - ! initialize - !------------------------------------------------------------------------------------- - do m = 1,nTracersMax - dvel(:,m) = 0._r8 - end do - - if( all( .not. has_dvel(:) ) ) then - return - end if - - !------------------------------------------------------------------------------------- - ! define species-dependent parameters (temperature dependent) - !------------------------------------------------------------------------------------- - call seq_drydep_setHCoeff( ncol, sfc_temp, heff ) - - do lt = 1,n_land_type - dep_ra (:,lt,lchnk) = 0._r8 - dep_rb (:,lt,lchnk) = 0._r8 - rds(:,lt) = 0._r8 - end do - - !------------------------------------------------------------------------------------- - ! ... set month - !------------------------------------------------------------------------------------- - month = mod( ncdate,10000 )/100 - - !------------------------------------------------------------------------------------- - ! define which season (relative to Northern hemisphere climate) - !------------------------------------------------------------------------------------- - - !------------------------------------------------------------------------------------- - ! define season index based on fixed LAI - !------------------------------------------------------------------------------------- - if ( drydep_method == DD_XLND ) then - index_season = 4 - else - do i = 1,ncol - index_season(i,:) = index_season_lai(latndx(i),month) - end do - endif - !------------------------------------------------------------------------------------- - ! special case for snow covered terrain - !------------------------------------------------------------------------------------- - do i = 1,ncol - if( snow(i) > .01_r8 ) then - index_season(i,:) = 4 - end if - end do - !------------------------------------------------------------------------------------- - ! scale rain and define logical arrays - !------------------------------------------------------------------------------------- - has_rain(:ncol) = rain(:ncol) > rain_threshold - - !------------------------------------------------------------------------------------- - ! loop over longitude points - !------------------------------------------------------------------------------------- - col_loop : do i = 1,ncol - p = pressure_10m(i) - pg = pressure_sfc(i) - !------------------------------------------------------------------------------------- - ! potential temperature - !------------------------------------------------------------------------------------- - tha(i) = air_temp(i) * (p00/p )**rovcp * (1._r8 + .61_r8*spec_hum(i)) - thg(i) = sfc_temp(i) * (p00/pg)**rovcp * (1._r8 + .61_r8*spec_hum(i)) - !------------------------------------------------------------------------------------- - ! height of 1st level - !------------------------------------------------------------------------------------- - z(i) = - r/grav * air_temp(i) * (1._r8 + .61_r8*spec_hum(i)) * log(p/pg) - !------------------------------------------------------------------------------------- - ! wind speed - !------------------------------------------------------------------------------------- - va(i) = max( .01_r8,wind_speed(i) ) - !------------------------------------------------------------------------------------- - ! Richardson number - !------------------------------------------------------------------------------------- - ribn(i) = z(i) * grav * (tha(i) - thg(i))/thg(i) / (va(i)*va(i)) - ribn(i) = min( ribn(i),ric ) - unstable(i) = ribn(i) < 0._r8 - !------------------------------------------------------------------------------------- - ! saturation vapor pressure (Pascals) - ! saturation mixing ratio - ! saturation specific humidity - !------------------------------------------------------------------------------------- - es = 611._r8*exp( 5414.77_r8*(sfc_temp(i) - tmelt)/(tmelt*sfc_temp(i)) ) - ws = .622_r8*es/(pg - es) - qs(i) = ws/(1._r8 + ws) - has_dew(i) = .false. - if( qs(i) <= spec_hum(i) ) then - has_dew(i) = .true. - end if - if( sfc_temp(i) < tmelt ) then - has_dew(i) = .false. - end if - !------------------------------------------------------------------------------------- - ! constant in determining rs - !------------------------------------------------------------------------------------- - tc(i) = sfc_temp(i) - tmelt - if( sfc_temp(i) > tmelt .and. sfc_temp(i) < 313.15_r8 ) then - crs(i) = (1._r8 + (200._r8/(solar_flux(i) + .1_r8))**2) * (400._r8/(tc(i)*(40._r8 - tc(i)))) - else - crs(i) = large_value - end if - !------------------------------------------------------------------------------------- - ! rdc (lower canopy res) - !------------------------------------------------------------------------------------- - rdc(i) = 100._r8*(1._r8 + 1000._r8/(solar_flux(i) + 10._r8))/(1._r8 + 1000._r8*slope) - end do col_loop - - !------------------------------------------------------------------------------------- - ! ... form working arrays - !------------------------------------------------------------------------------------- - do lt = 1,n_land_type - do i=1,ncol - if ( drydep_method == DD_XLND ) then - lcl_frc_landuse(i,lt) = 0._r8 - else - lcl_frc_landuse(i,lt) = fraction_landuse(i,lt,lchnk) - endif - enddo - end do - if ( present(ocnfrc) .and. present(icefrc) ) then - do i=1,ncol - ! land type 7 is used for ocean - ! land type 8 is used for sea ice - lcl_frc_landuse(i,7) = ocnfrc(i) - lcl_frc_landuse(i,8) = icefrc(i) - enddo - endif - do lt = 1,n_land_type - do i=1,ncol - fr_lnduse(i,lt) = lcl_frc_landuse(i,lt) > 0._r8 - enddo - end do - - !------------------------------------------------------------------------------------- - ! find grid averaged z0: z0bar (the roughness length) z_o=exp[S(f_i*ln(z_oi))] - ! this is calculated so as to find u_i, assuming u*u=u_i*u_i - !------------------------------------------------------------------------------------- - z0b(:) = 0._r8 - do lt = 1,n_land_type - do i = 1,ncol - if( fr_lnduse(i,lt) ) then - z0b(i) = z0b(i) + lcl_frc_landuse(i,lt) * log( z0(index_season(i,lt),lt) ) - end if - end do - end do - - !------------------------------------------------------------------------------------- - ! find the constant velocity uu*=(u_i)(u*_i) - !------------------------------------------------------------------------------------- - do i = 1,ncol - z0b(i) = exp( z0b(i) ) - cvarb = vonkar/log( z(i)/z0b(i) ) - !------------------------------------------------------------------------------------- - ! unstable and stable cases - !------------------------------------------------------------------------------------- - if( unstable(i) ) then - bb = 9.4_r8*(cvarb**2)*sqrt( abs(ribn(i))*z(i)/z0b(i) ) - ustarb = cvarb * va(i) * sqrt( 1._r8 - (9.4_r8*ribn(i)/(1._r8 + 7.4_r8*bb)) ) - else - ustarb = cvarb * va(i)/(1._r8 + 4.7_r8*ribn(i)) - end if - uustar(i) = va(i)*ustarb - end do - - !------------------------------------------------------------------------------------- - ! calculate the friction velocity for each land type u_i=uustar/u*_i - !------------------------------------------------------------------------------------- - do lt = beglt,endlt - do i = 1,ncol - if( fr_lnduse(i,lt) ) then - if( unstable(i) ) then - cvar(i,lt) = vonkar/log( z(i)/z0(index_season(i,lt),lt) ) - b(i,lt) = 9.4_r8*(cvar(i,lt)**2)* sqrt( abs(ribn(i))*z(i)/z0(index_season(i,lt),lt) ) - ustar(i,lt) = sqrt( cvar(i,lt)*uustar(i)*sqrt( 1._r8 - (9.4_r8*ribn(i)/(1._r8 + 7.4_r8*b(i,lt))) ) ) - else - cvar(i,lt) = vonkar/log( z(i)/z0(index_season(i,lt),lt) ) - ustar(i,lt) = sqrt( cvar(i,lt)*uustar(i)/(1._r8 + 4.7_r8*ribn(i)) ) - end if - end if - end do - end do - - !------------------------------------------------------------------------------------- - ! revise calculation of friction velocity and z0 over water - !------------------------------------------------------------------------------------- - lt = 7 - do i = 1,ncol - if( fr_lnduse(i,lt) ) then - if( unstable(i) ) then - z0water = (.016_r8*(ustar(i,lt)**2)/grav) + diffk/(9.1_r8*ustar(i,lt)) - cvar(i,lt) = vonkar/(log( z(i)/z0water )) - b(i,lt) = 9.4_r8*(cvar(i,lt)**2)*sqrt( abs(ribn(i))*z(i)/z0water ) - ustar(i,lt) = sqrt( cvar(i,lt)*uustar(i)* sqrt( 1._r8 - (9.4_r8*ribn(i)/(1._r8+ 7.4_r8*b(i,lt))) ) ) - else - z0water = (.016_r8*(ustar(i,lt)**2)/grav) + diffk/(9.1_r8*ustar(i,lt)) - cvar(i,lt) = vonkar/(log(z(i)/z0water)) - ustar(i,lt) = sqrt( cvar(i,lt)*uustar(i)/(1._r8 + 4.7_r8*ribn(i)) ) - end if - end if - end do - - !------------------------------------------------------------------------------------- - ! compute monin-obukhov length for unstable and stable conditions/ sublayer resistance - !------------------------------------------------------------------------------------- - do lt = beglt,endlt - do i = 1,ncol - if( fr_lnduse(i,lt) ) then - hvar = (va(i)/0.74_r8) * (tha(i) - thg(i)) * (cvar(i,lt)**2) - if( unstable(i) ) then ! unstable - h = hvar*(1._r8 - (9.4_r8*ribn(i)/(1._r8 + 5.3_r8*b(i,lt)))) - else - h = hvar/((1._r8+4.7_r8*ribn(i))**2) - end if - xmol(i,lt) = thg(i) * ustar(i,lt) * ustar(i,lt) / (vonkar * grav * h) - end if - end do - end do - - !------------------------------------------------------------------------------------- - ! psih - !------------------------------------------------------------------------------------- - do lt = beglt,endlt - do i = 1,ncol - if( fr_lnduse(i,lt) ) then - if( xmol(i,lt) < 0._r8 ) then - zovl = z(i)/xmol(i,lt) - zovl = max( -1._r8,zovl ) - psih = exp( .598_r8 + .39_r8*log( -zovl ) - .09_r8*(log( -zovl ))**2 ) - vds = 2.e-3_r8*ustar(i,lt) * (1._r8 + (300/(-xmol(i,lt)))**0.666_r8) - else - zovl = z(i)/xmol(i,lt) - zovl = min( 1._r8,zovl ) - psih = -5._r8 * zovl - vds = 2.e-3_r8*ustar(i,lt) - end if - dep_ra (i,lt,lchnk) = (vonkar - psih*cvar(i,lt))/(ustar(i,lt)*vonkar*cvar(i,lt)) - dep_rb (i,lt,lchnk) = (2._r8/(vonkar*ustar(i,lt))) * crb - rds(i,lt) = 1._r8/vds - end if - end do - end do - - !------------------------------------------------------------------------------------- - ! surface resistance : depends on both land type and species - ! land types are computed seperately, then resistance is computed as average of values - ! following wesely rc=(1/(rs+rm) + 1/rlu +1/(rdc+rcl) + 1/(rac+rgs))**-1 - ! - ! compute rsmx = 1/(rs+rm) : multiply by 3 if surface is wet - !------------------------------------------------------------------------------------- - species_loop1 : do ispec = 1,nTracersMax - if( has_dvel(ispec) ) then - m = map_dvel(ispec) - do lt = beglt,endlt - do i = 1,ncol - if( fr_lnduse(i,lt) ) then - sndx = index_season(i,lt) - if( ispec == o3_ndx .or. ispec == o3a_ndx .or. ispec == so2_ndx ) then - rmx = 0._r8 - else - rmx = 1._r8/(heff(i,m)/3000._r8 + 100._r8*foxd(m)) - end if - cts(i) = 1000._r8*exp( - tc(i) - 4._r8 ) ! correction for frost - rgsx(i,lt,ispec) = cts(i) + 1._r8/((heff(i,m)/(1.e5_r8*rgss(sndx,lt))) + (foxd(m)/rgso(sndx,lt))) - !------------------------------------------------------------------------------------- - ! special case for H2 and CO;; CH4 is set ot a fraction of dv(H2) - !------------------------------------------------------------------------------------- - if( ispec == h2_ndx .or. ispec == co_ndx .or. ispec == ch4_ndx ) then - if( ispec == co_ndx ) then - fact_h2 = 1.0_r8 - elseif ( ispec == h2_ndx ) then - fact_h2 = 0.5_r8 - elseif ( ispec == ch4_ndx ) then - fact_h2 = 50.0_r8 - end if - !------------------------------------------------------------------------------------- - ! no deposition on snow, ice, desert, and water - !------------------------------------------------------------------------------------- - if( lt == 1 .or. lt == 7 .or. lt == 8 .or. sndx == 4 ) then - rgsx(i,lt,ispec) = large_value - else - var_soilw = max( .1_r8,min( soilw(i),.3_r8 ) ) - if( lt == 3 ) then - var_soilw = log( var_soilw ) - end if - dv_soil_h2 = h2_c(lt) + var_soilw*(h2_b(lt) + var_soilw*h2_a(lt)) - if( dv_soil_h2 > 0._r8 ) then - rgsx(i,lt,ispec) = fact_h2/(dv_soil_h2*1.e-4_r8) - end if - end if - end if - if( lt == 7 ) then - rclx(i,lt,ispec) = large_value - rsmx(i,lt,ispec) = large_value - rlux(i,lt,ispec) = large_value - else - rs = ri(sndx,lt)*crs(i) - if ( has_dew(i) .or. has_rain(i) ) then - dewm = 3._r8 - else - dewm = 1._r8 - end if - rsmx(i,lt,ispec) = (dewm*rs*drat(m) + rmx) - !------------------------------------------------------------------------------------- - ! jfl : special case for PAN - !------------------------------------------------------------------------------------- - if( ispec == pan_ndx .or. ispec == xpan_ndx ) then - dv_pan = c0_pan(lt) * (1._r8 - exp( -k_pan(lt)*(dewm*rs*drat(m))*1.e-2_r8 )) - if( dv_pan > 0._r8 .and. sndx /= 4 ) then - rsmx(i,lt,ispec) = ( 1._r8/dv_pan ) - end if - end if - rclx(i,lt,ispec) = cts(i) + 1._r8/((heff(i,m)/(1.e5_r8*rcls(sndx,lt))) + (foxd(m)/rclo(sndx,lt))) - rlux(i,lt,ispec) = cts(i) + rlu(sndx,lt)/(1.e-5_r8*heff(i,m) + foxd(m)) - end if - end if - end do - end do - end if - end do species_loop1 - - do lt = beglt,endlt - if( lt /= 7 ) then - do i = 1,ncol - if( fr_lnduse(i,lt) ) then - sndx = index_season(i,lt) - !------------------------------------------------------------------------------------- - ! ... no effect if sfc_temp < O C - !------------------------------------------------------------------------------------- - if( sfc_temp(i) > tmelt ) then - if( has_dew(i) ) then - rlux_o3(i,lt) = 3000._r8*rlu(sndx,lt)/(1000._r8 + rlu(sndx,lt)) - if( o3_ndx > 0 ) then - rlux(i,lt,o3_ndx) = rlux_o3(i,lt) - endif - if( o3a_ndx > 0 ) then - rlux(i,lt,o3a_ndx) = rlux_o3(i,lt) - endif - end if - if( has_rain(i) ) then - ! rlux(i,lt,o3_ndx) = 1./(1.e-3 + (1./(3.*rlu(sndx,lt)))) - rlux_o3(i,lt) = 3000._r8*rlu(sndx,lt)/(1000._r8 + 3._r8*rlu(sndx,lt)) - if( o3_ndx > 0 ) then - rlux(i,lt,o3_ndx) = rlux_o3(i,lt) - endif - if( o3a_ndx > 0 ) then - rlux(i,lt,o3a_ndx) = rlux_o3(i,lt) - endif - end if - end if - - if ( o3_ndx > 0 ) then - rclx(i,lt,o3_ndx) = cts(i) + rclo(index_season(i,lt),lt) - rlux(i,lt,o3_ndx) = cts(i) + rlux(i,lt,o3_ndx) - end if - if ( o3a_ndx > 0 ) then - rclx(i,lt,o3a_ndx) = cts(i) + rclo(index_season(i,lt),lt) - rlux(i,lt,o3a_ndx) = cts(i) + rlux(i,lt,o3a_ndx) - end if - - end if - end do - end if - end do - - species_loop2 : do ispec = 1,nTracersMax - m = map_dvel(ispec) - if( has_dvel(ispec) ) then - if( ispec /= o3_ndx .and. ispec /= o3a_ndx .and. ispec /= so2_ndx ) then - do lt = beglt,endlt - if( lt /= 7 ) then - do i = 1,ncol - if( fr_lnduse(i,lt) ) then - !------------------------------------------------------------------------------------- - ! no effect if sfc_temp < O C - !------------------------------------------------------------------------------------- - if( sfc_temp(i) > tmelt ) then - if( has_dew(i) ) then - rlux(i,lt,ispec) = 1._r8/((1._r8/(3._r8*rlux(i,lt,ispec))) & - + 1.e-7_r8*heff(i,m) + foxd(m)/rlux_o3(i,lt)) - end if - end if - - end if - end do - end if - end do - else if( ispec == so2_ndx ) then - do lt = beglt,endlt - if( lt /= 7 ) then - do i = 1,ncol - if( fr_lnduse(i,lt) ) then - !------------------------------------------------------------------------------------- - ! no effect if sfc_temp < O C - !------------------------------------------------------------------------------------- - if( sfc_temp(i) > tmelt ) then - if( qs(i) <= spec_hum(i) ) then - rlux(i,lt,ispec) = 100._r8 - end if - if( has_rain(i) ) then - ! rlux(i,lt,ispec) = 1./(2.e-4 + (1./(3.*rlu(index_season(i,lt),lt)))) - rlux(i,lt,ispec) = 15._r8*rlu(index_season(i,lt),lt)/(5._r8 + 3.e-3_r8*rlu(index_season(i,lt),lt)) - end if - end if - rclx(i,lt,ispec) = cts(i) + rcls(index_season(i,lt),lt) - rlux(i,lt,ispec) = cts(i) + rlux(i,lt,ispec) - - end if - end do - end if - end do - do i = 1,ncol - if( fr_lnduse(i,1) .and. (has_dew(i) .or. has_rain(i)) ) then - rlux(i,1,ispec) = 50._r8 - end if - end do - end if - end if - end do species_loop2 - - !------------------------------------------------------------------------------------- - ! compute rc - !------------------------------------------------------------------------------------- - term(:ncol) = 1.e-2_r8 * pressure_10m(:ncol) / (r*tv(:ncol)) - species_loop3 : do ispec = 1,nTracersMax - if( has_dvel(ispec) ) then - wrk(:) = 0._r8 - lt_loop: do lt = beglt,endlt - do i = 1,ncol - if (fr_lnduse(i,lt)) then - resc(i) = 1._r8/( 1._r8/rsmx(i,lt,ispec) + 1._r8/rlux(i,lt,ispec) & - + 1._r8/(rdc(i) + rclx(i,lt,ispec)) & - + 1._r8/(rac(index_season(i,lt),lt) + rgsx(i,lt,ispec))) - - resc(i) = max( 10._r8,resc(i) ) - - lnd_frc(i) = lcl_frc_landuse(i,lt) - endif - enddo - !------------------------------------------------------------------------------------- - ! ... compute average deposition velocity - !------------------------------------------------------------------------------------- - select case( tracerNames(ispec) ) - case( 'SO2' ) - if( lt == 7 ) then - where( fr_lnduse(:ncol,lt) ) - ! assume no surface resistance for SO2 over water` - wrk(:) = wrk(:) + lnd_frc(:)/(dep_ra(:ncol,lt,lchnk) + dep_rb(:ncol,lt,lchnk)) - endwhere - else - where( fr_lnduse(:ncol,lt) ) - wrk(:) = wrk(:) + lnd_frc(:)/(dep_ra(:ncol,lt,lchnk) + dep_rb(:ncol,lt,lchnk) + resc(:)) - endwhere - end if - - ! JFL - increase in dry deposition of SO2 to improve bias over US/Europe - wrk(:) = wrk(:) * 2._r8 - - case( 'SO4' ) - where( fr_lnduse(:ncol,lt) ) - wrk(:) = wrk(:) + lnd_frc(:)/(dep_ra(:ncol,lt,lchnk) + rds(:,lt)) - endwhere - case( 'NH4', 'NH4NO3', 'XNH4NO3' ) - where( fr_lnduse(:ncol,lt) ) - wrk(:) = wrk(:) + lnd_frc(:)/(dep_ra(:ncol,lt,lchnk) + 0.5_r8*rds(:,lt)) - endwhere - - !------------------------------------------------------------------------------------- - ! ... special case for Pb (for consistency with offline code) - !------------------------------------------------------------------------------------- - case( 'Pb' ) - if( lt == 7 ) then - where( fr_lnduse(:ncol,lt) ) - wrk(:) = wrk(:) + lnd_frc(:) * 0.05e-2_r8 - endwhere - else - where( fr_lnduse(:ncol,lt) ) - wrk(:ncol) = wrk(:ncol) + lnd_frc(:ncol) * 0.2e-2_r8 - endwhere - end if - - !------------------------------------------------------------------------------------- - ! ... special case for carbon aerosols - !------------------------------------------------------------------------------------- - case( 'CB1', 'CB2', 'OC1', 'OC2', 'SOAM', 'SOAI', 'SOAT', 'SOAB','SOAX' ) - if ( drydep_method == DD_XLND ) then - where( fr_lnduse(:ncol,lt) ) - wrk(:ncol) = wrk(:ncol) + lnd_frc(:ncol) * 0.10e-2_r8 - endwhere - else - wrk(:ncol) = 0.10e-2_r8 - endif - - !------------------------------------------------------------------------------------- - ! deposition over ocean for HCN, CH3CN - ! velocity estimated from aircraft measurements (E.Apel, INTEX-B) - !------------------------------------------------------------------------------------- - case( 'HCN','CH3CN' ) - if( lt == 7 ) then ! over ocean only - where( fr_lnduse(:ncol,lt) .and. snow(:ncol) < 0.01_r8 ) - wrk(:ncol) = wrk(:ncol) + lnd_frc(:ncol) * 0.2e-2_r8 - endwhere - end if - case default - where( fr_lnduse(:ncol,lt) ) - wrk(:ncol) = wrk(:ncol) + lnd_frc(:ncol)/(dep_ra(:ncol,lt,lchnk) + dep_rb(:ncol,lt,lchnk) + resc(:ncol)) - endwhere - end select - end do lt_loop - dvel(:ncol,ispec) = wrk(:ncol) * scaling_to_cm_per_s - dflx(:ncol,ispec) = term(:ncol) * dvel(:ncol,ispec) * State_Chm%Species(1,:ncol,plev,ispec) - end if - - end do species_loop3 - - if ( beglt > 1 ) return - - !------------------------------------------------------------------------------------- - ! ... special adjustments - !------------------------------------------------------------------------------------- - if( mpan_ndx > 0 ) then - if( has_dvel(mpan_ndx) ) then - dvel(:ncol,mpan_ndx) = dvel(:ncol,mpan_ndx)/3._r8 - dflx(:ncol,mpan_ndx) = term(:ncol) * dvel(:ncol,mpan_ndx) * State_Chm%Species(1,:ncol,plev,mpan_ndx) - end if - end if - if( xmpan_ndx > 0 ) then - if( has_dvel(xmpan_ndx) ) then - dvel(:ncol,xmpan_ndx) = dvel(:ncol,xmpan_ndx)/3._r8 - dflx(:ncol,xmpan_ndx) = term(:ncol) * dvel(:ncol,xmpan_ndx) * State_Chm%Species(1,:ncol,plev,xmpan_ndx) - end if - end if - - ! HCOOH, use CH3COOH dep.vel - if( hcooh_ndx > 0) then - if( has_dvel(hcooh_ndx) ) then - dvel(:ncol,hcooh_ndx) = dvel(:ncol,ch3cooh_ndx) - dflx(:ncol,hcooh_ndx) = term(:ncol) * dvel(:ncol,hcooh_ndx) * State_Chm%Species(1,:ncol,plev,hcooh_ndx) - end if - end if -! -! SOG species -! - if( sogm_ndx > 0) then - if( has_dvel(sogm_ndx) ) then - dvel(:ncol,sogm_ndx) = dvel(:ncol,ch3cooh_ndx) - dflx(:ncol,sogm_ndx) = term(:ncol) * dvel(:ncol,sogm_ndx) * State_Chm%Species(1,:ncol,plev,sogm_ndx) - end if - end if - if( sogi_ndx > 0) then - if( has_dvel(sogi_ndx) ) then - dvel(:ncol,sogi_ndx) = dvel(:ncol,ch3cooh_ndx) - dflx(:ncol,sogi_ndx) = term(:ncol) * dvel(:ncol,sogi_ndx) * State_Chm%Species(1,:ncol,plev,sogi_ndx) - end if - end if - if( sogt_ndx > 0) then - if( has_dvel(sogt_ndx) ) then - dvel(:ncol,sogt_ndx) = dvel(:ncol,ch3cooh_ndx) - dflx(:ncol,sogt_ndx) = term(:ncol) * dvel(:ncol,sogt_ndx) * State_Chm%Species(1,:ncol,plev,sogt_ndx) - end if - end if - if( sogb_ndx > 0) then - if( has_dvel(sogb_ndx) ) then - dvel(:ncol,sogb_ndx) = dvel(:ncol,ch3cooh_ndx) - dflx(:ncol,sogb_ndx) = term(:ncol) * dvel(:ncol,sogb_ndx) * State_Chm%Species(1,:ncol,plev,sogb_ndx) - end if - end if - if( sogx_ndx > 0) then - if( has_dvel(sogx_ndx) ) then - dvel(:ncol,sogx_ndx) = dvel(:ncol,ch3cooh_ndx) - dflx(:ncol,sogx_ndx) = term(:ncol) * dvel(:ncol,sogx_ndx) * State_Chm%Species(1,:ncol,plev,sogx_ndx) - end if - end if -! - end subroutine drydep_xactive - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - subroutine soilw_inti( ncfile, nlon_veg, nlat_veg, soilw_map ) - !------------------------------------------------------------------ - ! ... read primary soil moisture table - !------------------------------------------------------------------ - - use time_manager, only : get_calday - - implicit none - - !------------------------------------------------------------------ - ! ... dummy args - !------------------------------------------------------------------ - integer, intent(in) :: & - nlon_veg, & - nlat_veg - real(r8), pointer :: soilw_map(:,:,:) - character(len=*), intent(in) :: ncfile ! file name of netcdf file containing data - - !------------------------------------------------------------------ - ! ... local variables - !------------------------------------------------------------------ - integer :: gndx = 0 - integer :: nlat, & ! # of lats in soilw file - nlon ! # of lons in soilw file - integer :: i, ip, k, m - integer :: j, jl, ju - integer :: lev, day, ierr - type(file_desc_t) :: piofile - type(var_desc_t) :: vid - - integer :: dimid_lat, dimid_lon, dimid_time - integer :: dates(12) = (/ 116, 214, 316, 415, 516, 615, & - 716, 816, 915, 1016, 1115, 1216 /) - - character(len=shr_kind_cl) :: locfn - - !----------------------------------------------------------------------- - ! ... open netcdf file - !----------------------------------------------------------------------- - call getfil (ncfile, locfn, 0) - call cam_pio_openfile (piofile, trim(locfn), PIO_NOWRITE) - - !----------------------------------------------------------------------- - ! ... get longitudes - !----------------------------------------------------------------------- - ierr = pio_inq_dimid( piofile, 'lon', dimid_lon ) - ierr = pio_inq_dimlen( piofile, dimid_lon, nlon ) - if( nlon /= nlon_veg ) then - write(iulog,*) 'soilw_inti: soil and vegetation lons differ; ',nlon, nlon_veg - call endrun - end if - !----------------------------------------------------------------------- - ! ... get latitudes - !----------------------------------------------------------------------- - ierr = pio_inq_dimid( piofile, 'lat', dimid_lat ) - ierr = pio_inq_dimlen( piofile, dimid_lat, nlat ) - if( nlat /= nlat_veg ) then - write(iulog,*) 'soilw_inti: soil and vegetation lats differ; ',nlat, nlat_veg - call endrun - end if - !----------------------------------------------------------------------- - ! ... set times (days of year) - !----------------------------------------------------------------------- - ierr = pio_inq_dimid( piofile, 'time', dimid_time ) - ierr = pio_inq_dimlen( piofile, dimid_time, ndays ) - if( ndays /= 12 ) then - write(iulog,*) 'soilw_inti: dataset not a cyclical year' - call endrun - end if - allocate( days(ndays),stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'soilw_inti: days allocation error = ',ierr - call endrun - end if - do m = 1,min(12,ndays) - days(m) = get_calday( dates(m), 0 ) - end do - - !------------------------------------------------------------------ - ! ... allocate arrays - !------------------------------------------------------------------ - allocate( soilw_map(nlon,nlat,ndays), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'soilw_inti: soilw_map allocation error = ',ierr - call endrun - end if - - !------------------------------------------------------------------ - ! ... read in the soil moisture - !------------------------------------------------------------------ - ierr = pio_inq_varid( piofile, 'SOILW', vid ) - ierr = pio_get_var( piofile, vid, soilw_map ) - !------------------------------------------------------------------ - ! ... close file - !------------------------------------------------------------------ - call cam_pio_closefile( piofile ) - - end subroutine soilw_inti - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - subroutine chk_soilw( calday ) - !-------------------------------------------------------------------- - ! ... check timing for ub values - !-------------------------------------------------------------------- - - use mo_constants, only : dayspy - - implicit none - - !-------------------------------------------------------------------- - ! ... dummy args - !-------------------------------------------------------------------- - real(r8), intent(in) :: calday - - !-------------------------------------------------------------------- - ! ... local variables - !-------------------------------------------------------------------- - integer :: m, upper - real(r8) :: numer, denom - - !-------------------------------------------------------- - ! ... setup the time interpolation - !-------------------------------------------------------- - if( calday < days(1) ) then - next = 1 - last = ndays - else - if( days(ndays) < dayspy ) then - upper = ndays - else - upper = ndays - 1 - end if - do m = upper,1,-1 - if( calday >= days(m) ) then - exit - end if - end do - last = m - next = mod( m,ndays ) + 1 - end if - numer = calday - days(last) - denom = days(next) - days(last) - if( numer < 0._r8 ) then - numer = dayspy + numer - end if - if( denom < 0._r8 ) then - denom = dayspy + denom - end if - dels = max( min( 1._r8,numer/denom ),0._r8 ) - - end subroutine chk_soilw - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - subroutine set_soilw( soilw, lchnk, calday ) - !-------------------------------------------------------------------- - ! ... set the soil moisture - !-------------------------------------------------------------------- - - implicit none - - !-------------------------------------------------------------------- - ! ... dummy args - !-------------------------------------------------------------------- - real(r8), intent(inout) :: soilw(pcols) - integer, intent(in) :: lchnk ! chunk indice - real(r8), intent(in) :: calday - - - integer :: i, ilon,ilat - - call chk_soilw( calday ) - - soilw(:) = soilw_3d(:,last,lchnk) + dels *( soilw_3d(:,next,lchnk) - soilw_3d(:,last,lchnk)) - - end subroutine set_soilw - - !------------------------------------------------------------------------------------- - !------------------------------------------------------------------------------------- - function has_drydep( name ) - - implicit none - - character(len=*), intent(in) :: name - - logical :: has_drydep - integer :: i - - has_drydep = .false. - - do i=1,nddvels - if ( trim(name) == trim(drydep_list(i)) ) then - has_drydep = .true. - exit - endif - enddo - - endfunction has_drydep - -end module mo_drydep diff --git a/src/chemistry/geoschem/mo_drydep.F90 b/src/chemistry/geoschem/mo_drydep.F90 new file mode 120000 index 0000000000..fcb098953c --- /dev/null +++ b/src/chemistry/geoschem/mo_drydep.F90 @@ -0,0 +1 @@ +../mozart/mo_drydep.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/mo_neu_wetdep.F90 b/src/chemistry/geoschem/mo_neu_wetdep.F90 index 49a9acb3a0..b70718015a 100644 --- a/src/chemistry/geoschem/mo_neu_wetdep.F90 +++ b/src/chemistry/geoschem/mo_neu_wetdep.F90 @@ -148,8 +148,14 @@ subroutine neu_wetdep_init 'IONITA', 'ISALA', 'ISALC', 'LVOCOA', 'MONITA', & 'MSA', 'NH4', 'NIT', 'NITS', 'PFE', & 'SALAAL', 'SALACL', 'SALCAL', 'SALCCL', 'SO4S', & - 'SOAGX', 'SOAIE' ) + 'SOAS', 'SOAGX', 'SOAIE', 'TSOA0', 'TSOA1', & + 'TSOA2', 'TSOA3', 'ASOAN', 'ASOA1', 'ASOA2', & + 'ASOA3' ) test_name = 'HNO3' + case( 'ASOG1', 'ASOG2', 'ASOG3' ) + test_name = 'ASOG' + case( 'TSOG0', 'TSOG1', 'TSOG2', 'TSOG3' ) + test_name = 'TSOG' end select ! do l = 1,n_species_table @@ -226,8 +232,8 @@ subroutine neu_wetdep_init call addfld ('DTWR_'//trim(gas_wetdep_list(m)),(/ 'lev' /), 'A','kg/kg/s','wet removal Neu scheme tendency') call addfld ('WD_'//trim(gas_wetdep_list(m)),horiz_only, 'A','kg/m2/s','vertical integrated wet deposition flux') call addfld ('HEFF_'//trim(gas_wetdep_list(m)),(/ 'lev' /), 'A','M/atm','Effective Henrys Law coeff.') - call add_default('DTWR_'//trim(gas_wetdep_list(m)), 2, ' ') - call add_default('WD_'//trim(gas_wetdep_list(m)), 2, ' ') + !call add_default('DTWR_'//trim(gas_wetdep_list(m)), 2, ' ') + !call add_default('WD_'//trim(gas_wetdep_list(m)), 2, ' ') !call add_default('HEFF_'//trim(gas_wetdep_list(m)), 2, ' ') if (history_chemistry) then call add_default('DTWR_'//trim(gas_wetdep_list(m)), 1, ' ') diff --git a/src/chemistry/geoschem/mo_sim_dat.F90 b/src/chemistry/geoschem/mo_sim_dat.F90 index 442e2fc4a0..46c344415b 100644 --- a/src/chemistry/geoschem/mo_sim_dat.F90 +++ b/src/chemistry/geoschem/mo_sim_dat.F90 @@ -40,22 +40,24 @@ subroutine set_sim_dat ! aerosols, as those will be constituents. MAM requires that there ! is a linear mapping between solsym and constituents - solsym(:318) = (/ 'ACET ','ACTA ','AERI ', & - 'ALD2 ','ALK4 ','ATOOH ', & - 'BCPI ','BCPO ','BENZ ', & - 'BR ','BR2 ','BRCL ', & - 'BRNO2 ','BRNO3 ','BRO ', & - 'BRSALA ','BRSALC ','C2H6 ', & - 'C3H8 ','CCL4 ','CFC11 ', & - 'CFC113 ','CFC114 ','CFC115 ', & - 'CFC12 ','CH2BR2 ','CH2CL2 ', & - 'CH2I2 ','CH2IBR ','CH2ICL ', & - 'CH2O ','CH3BR ','CH3CCL3 ', & - 'CH3CL ','CH3I ','CH4 ', & - 'CHBR3 ','CHCL3 ','CL ', & - 'CL2 ','CL2O2 ','CLNO2 ', & - 'CLNO3 ','CLO ','CLOO ', & - 'CLOCK ', & + solsym(:331) = (/ 'ACET ','ACTA ','AERI ', & + 'ALD2 ','ALK4 ','ASOA1 ', & + 'ASOA2 ','ASOA3 ','ASOAN ', & + 'ASOG1 ','ASOG2 ','ASOG3 ', & + 'ATOOH ','BCPI ','BCPO ', & + 'BENZ ','BR ','BR2 ', & + 'BRCL ','BRNO2 ','BRNO3 ', & + 'BRO ','BRSALA ','BRSALC ', & + 'C2H6 ','C3H8 ','CCL4 ', & + 'CFC11 ','CFC113 ','CFC114 ', & + 'CFC115 ','CFC12 ','CH2BR2 ', & + 'CH2CL2 ','CH2I2 ','CH2IBR ', & + 'CH2ICL ','CH2O ','CH3BR ', & + 'CH3CCL3 ','CH3CL ','CH3I ', & + 'CH4 ','CHBR3 ','CHCL3 ', & + 'CL ','CL2 ','CL2O2 ', & + 'CLNO2 ','CLNO3 ','CLO ', & + 'CLOO ','CLOCK ', & 'CO ','DMS ','DST1 ', & 'DST2 ','DST3 ','DST4 ', & 'EOH ','ETHLN ','ETNO3 ', & @@ -107,8 +109,10 @@ subroutine set_sim_dat 'SALAAL ','SALACL ','SALC ', & 'SALCAL ','SALCCL ','SO2 ', & 'SO4 ','SO4S ','SOAGX ', & - 'SOAIE ','SOAP ','SOAS ', & - 'TOLU ','XYLE ','bc_a1 ', & + 'SOAIE ','TOLU ','TSOA0 ', & + 'TSOA1 ','TSOA2 ','TSOA3 ', & + 'TSOG0 ','TSOG1 ','TSOG2 ', & + 'TSOG3 ','XYLE ','bc_a1 ', & 'bc_a4 ','dst_a1 ','dst_a2 ', & 'dst_a3 ','ncl_a1 ','ncl_a2 ', & 'ncl_a3 ','num_a1 ','num_a2 ', & @@ -154,81 +158,78 @@ subroutine set_sim_dat fix_mass(: 6) = (/ 0.00000000_r8, 28.0134800_r8, 31.9988000_r8, 2.020000_r8, 32.050000_r8, & 74.090000_r8 /) - adv_mass(:318) = (/ 58.090000_r8, 60.060000_r8, 126.900000_r8, 44.060000_r8, 58.120000_r8, & - 90.090000_r8, 12.010000_r8, 12.010000_r8, 78.120000_r8, 79.900000_r8, & - 159.800000_r8, 115.450000_r8, 125.910000_r8, 141.910000_r8, 95.900000_r8, & - 79.900000_r8, 79.900000_r8, 30.080000_r8, 44.110000_r8, 153.820000_r8, & - 137.370000_r8, 187.380000_r8, 170.920000_r8, 154.470000_r8, 120.910000_r8, & - 173.830000_r8, 84.930000_r8, 267.840000_r8, 220.840000_r8, 176.380000_r8, & - 30.030000_r8, 94.940000_r8, 133.350000_r8, 50.450000_r8, 141.940000_r8, & - 16.050000_r8, 252.730000_r8, 119.350000_r8, 35.450000_r8, 70.900000_r8, & - 102.910000_r8, 81.450000_r8, 97.450000_r8, 51.450000_r8, 67.450000_r8, & - 1.000000_r8, & - 28.010000_r8, 62.130000_r8, 29.000000_r8, 29.000000_r8, 29.000000_r8, & - 29.000000_r8, 46.080000_r8, 105.060000_r8, 91.080000_r8, 62.080000_r8, & - 60.060000_r8, 58.040000_r8, 165.360000_r8, 148.910000_r8, 259.820000_r8, & - 18.020000_r8, 34.020000_r8, 74.080000_r8, 80.910000_r8, 100.130000_r8, & - 152.930000_r8, 116.940000_r8, 100.500000_r8, 86.470000_r8, 36.450000_r8, & - 46.030000_r8, 127.910000_r8, 64.050000_r8, 102.100000_r8, 47.010000_r8, & - 63.010000_r8, 79.010000_r8, 96.910000_r8, 52.450000_r8, 143.890000_r8, & - 215.000000_r8, 116.130000_r8, 116.130000_r8, 116.130000_r8, 116.130000_r8, & - 76.060000_r8, 126.900000_r8, 253.800000_r8, 285.800000_r8, 301.800000_r8, & - 317.800000_r8, 206.900000_r8, 116.130000_r8, 162.450000_r8, 145.130000_r8, & - 150.150000_r8, 98.110000_r8, 148.130000_r8, 168.170000_r8, 150.150000_r8, & - 192.150000_r8, 106.140000_r8, 106.140000_r8, 106.140000_r8, 147.150000_r8, & - 147.150000_r8, 147.150000_r8, 147.150000_r8, 102.000000_r8, 156.910000_r8, & - 163.150000_r8, 163.150000_r8, 142.900000_r8, 14.010000_r8, 172.910000_r8, & - 188.910000_r8, 105.110000_r8, 126.900000_r8, 126.900000_r8, 68.130000_r8, & - 195.150000_r8, 197.170000_r8, 136.260000_r8, 154.190000_r8, 154.190000_r8, & - 70.100000_r8, 102.100000_r8, 76.060000_r8, 104.120000_r8, 86.100000_r8, & - 149.110000_r8, 149.110000_r8, 120.120000_r8, 72.110000_r8, 77.050000_r8, & - 72.070000_r8, 32.050000_r8, 14.010000_r8, 215.280000_r8, 215.280000_r8, & - 48.050000_r8, 147.100000_r8, 93.050000_r8, 96.100000_r8, 136.260000_r8, & - 136.260000_r8, 70.090000_r8, 105.130000_r8, 102.100000_r8, 102.100000_r8, & - 120.120000_r8, 149.120000_r8, 118.100000_r8, 44.020000_r8, 108.020000_r8, & - 17.040000_r8, 18.050000_r8, 62.010000_r8, 31.400000_r8, 30.010000_r8, & - 46.010000_r8, 62.010000_r8, 105.110000_r8, 48.000000_r8, 67.450000_r8, & - 12.010000_r8, 12.010000_r8, 60.070000_r8, 158.900000_r8, 121.060000_r8, & - 55.850000_r8, 186.280000_r8, 92.110000_r8, 135.080000_r8, 119.080000_r8, & - 42.090000_r8, 137.110000_r8, 88.070000_r8, 119.100000_r8, 90.140000_r8, & - 76.110000_r8, 76.110000_r8, 58.090000_r8, 118.150000_r8, 118.150000_r8, & - 118.150000_r8, 118.150000_r8, 90.090000_r8, 31.400000_r8, 31.400000_r8, & - 35.450000_r8, 31.400000_r8, 31.400000_r8, 35.450000_r8, 64.040000_r8, & - 96.060000_r8, 31.400000_r8, 58.040000_r8, 118.150000_r8, 150.000000_r8, & - 150.000000_r8, 92.150000_r8, 106.180000_r8, 12.011000_r8, 12.011000_r8, & - 135.064039_r8, 135.064039_r8, 135.064039_r8, 58.442468_r8, 58.442468_r8, & - 58.442468_r8, 1.007400_r8, 1.007400_r8, 1.007400_r8, 1.007400_r8, & - 12.011000_r8, 12.011000_r8, 115.107340_r8, 115.107340_r8, 115.107340_r8, & + adv_mass(:331) = (/ 58.090000_r8, 60.060000_r8, 126.900000_r8, 44.060000_r8, 58.120000_r8, & + 150.000000_r8, 150.000000_r8, 150.000000_r8, 150.000000_r8, 150.000000_r8, & + 150.00000_r8, 150.000000_r8, 90.0900000_r8, 12.010000_r8, 12.010000_r8, & + 78.120000_r8, 79.900000_r8, 159.800000_r8, 115.450000_r8, 125.910000_r8, & + 141.910000_r8, 95.900000_r8, 79.900000_r8, 79.900000_r8, 30.080000_r8, & + 44.110000_r8, 153.820000_r8, 137.370000_r8, 187.380000_r8, 170.920000_r8, & + 154.470000_r8, 120.910000_r8, 173.830000_r8, 84.930000_r8, 267.840000_r8, & + 220.840000_r8, 176.380000_r8, 30.030000_r8, 94.940000_r8, 133.350000_r8, & + 50.450000_r8, 141.940000_r8, 16.050000_r8, 252.730000_r8, 119.350000_r8, & + 35.450000_r8, 70.900000_r8, 102.910000_r8, 81.450000_r8, 97.450000_r8, & + 51.450000_r8, 67.450000_r8, 1.000000_r8, 28.010000_r8, 62.130000_r8, & + 29.000000_r8, 29.000000_r8, 29.000000_r8, 29.000000_r8, 46.080000_r8, & + 105.060000_r8, 91.080000_r8, 62.080000_r8, 60.060000_r8, 58.040000_r8, & + 165.360000_r8, 148.910000_r8, 259.820000_r8, 18.020000_r8, 34.020000_r8, & + 74.080000_r8, 80.910000_r8, 100.130000_r8, 152.930000_r8, 116.940000_r8, & + 100.500000_r8, 86.470000_r8, 36.450000_r8, 46.030000_r8, 127.910000_r8, & + 64.050000_r8, 102.100000_r8, 47.010000_r8, 63.010000_r8, 79.010000_r8, & + 96.910000_r8, 52.450000_r8, 143.890000_r8, 215.000000_r8, 116.130000_r8, & + 116.130000_r8, 116.130000_r8, 116.130000_r8, 76.060000_r8, 126.900000_r8, & + 253.800000_r8, 285.800000_r8, 301.800000_r8, 317.800000_r8, 206.900000_r8, & + 116.130000_r8, 162.450000_r8, 145.130000_r8, 150.150000_r8, 98.110000_r8, & + 148.130000_r8, 168.170000_r8, 150.150000_r8, 192.150000_r8, 106.140000_r8, & + 106.140000_r8, 106.140000_r8, 147.150000_r8, 147.150000_r8, 147.150000_r8, & + 147.150000_r8, 102.000000_r8, 156.910000_r8, 163.150000_r8, 163.150000_r8, & + 142.900000_r8, 14.010000_r8, 172.910000_r8, 188.910000_r8, 105.110000_r8, & + 126.900000_r8, 126.900000_r8, 68.130000_r8, 195.150000_r8, 197.170000_r8, & + 136.260000_r8, 154.190000_r8, 154.190000_r8, 70.100000_r8, 102.100000_r8, & + 76.060000_r8, 104.120000_r8, 86.100000_r8, 149.110000_r8, 149.110000_r8, & + 120.120000_r8, 72.110000_r8, 77.050000_r8, 72.070000_r8, 32.050000_r8, & + 14.010000_r8, 215.280000_r8, 215.280000_r8, 48.050000_r8, 147.100000_r8, & + 93.050000_r8, 96.100000_r8, 136.260000_r8, 136.260000_r8, 70.090000_r8, & + 105.130000_r8, 102.100000_r8, 102.100000_r8, 120.120000_r8, 149.120000_r8, & + 118.100000_r8, 44.020000_r8, 108.020000_r8, 17.040000_r8, 18.050000_r8, & + 62.010000_r8, 31.400000_r8, 30.010000_r8, 46.010000_r8, 62.010000_r8, & + 105.110000_r8, 48.000000_r8, 67.450000_r8, 12.010000_r8, 12.010000_r8, & + 60.070000_r8, 158.900000_r8, 121.060000_r8, 55.850000_r8, 186.280000_r8, & + 92.110000_r8, 135.080000_r8, 119.080000_r8, 42.090000_r8, 137.110000_r8, & + 88.070000_r8, 119.100000_r8, 90.140000_r8, 76.110000_r8, 76.110000_r8, & + 58.090000_r8, 118.150000_r8, 118.150000_r8, 118.150000_r8, 118.150000_r8, & + 90.090000_r8, 31.400000_r8, 31.400000_r8, 35.450000_r8, 31.400000_r8, & + 31.400000_r8, 35.450000_r8, 64.040000_r8, 96.060000_r8, 31.400000_r8, & + 58.040000_r8, 118.150000_r8, 92.150000_r8, 150.000000_r8, 150.000000_r8, & + 150.000000_r8, 150.000000_r8, 150.000000_r8, 150.000000_r8, 150.000000_r8, & + 150.000000_r8, 106.180000_r8, 12.011000_r8, 12.011000_r8, 135.064039_r8, & + 135.064039_r8, 135.064039_r8, 58.442468_r8, 58.442468_r8, 58.442468_r8, & + 1.007400_r8, 1.007400_r8, 1.007400_r8, 1.007400_r8, 12.011000_r8, & + 12.011000_r8, 115.107340_r8, 115.107340_r8, 115.107340_r8, 250.445000_r8, & 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & + 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 98.078400_r8, & 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & - 98.078400_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & - 250.445000_r8, 44.010000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, & + 44.010000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, & + -1.000000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, 96.060000_r8, & + 96.060000_r8, 96.060000_r8, 96.060000_r8, -1.000000_r8, -1.000000_r8, & -1.000000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, & - 96.060000_r8, 96.060000_r8, 96.060000_r8, 96.060000_r8, -1.000000_r8, & - -1.000000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, -1.000000_r8, & - -1.000000_r8, 159.130000_r8, 173.160000_r8, 14.010000_r8, 187.190000_r8, & - 147.120000_r8, 147.120000_r8, 146.140000_r8, 103.110000_r8, 103.110000_r8, & - 241.140000_r8, 194.140000_r8, 196.160000_r8, 60.110000_r8, 196.160000_r8, & - 196.160000_r8, 196.160000_r8, 1.010000_r8, 167.160000_r8, 167.160000_r8, & - 167.160000_r8, 212.160000_r8, 149.140000_r8, 150.130000_r8, 136.090000_r8, & - 119.110000_r8, 119.110000_r8, 101.090000_r8, 91.100000_r8, 230.270000_r8, & - 230.270000_r8, 61.070000_r8, 212.160000_r8, 89.080000_r8, 185.270000_r8, & - 101.090000_r8, 149.140000_r8, 149.140000_r8, 60.060000_r8, 185.270000_r8, & - 196.160000_r8, 75.100000_r8, 117.140000_r8, 117.140000_r8, 162.140000_r8, & - 162.140000_r8, 180.100000_r8, 89.080000_r8, 61.070000_r8, 89.130000_r8, & - 75.100000_r8, 46.030000_r8, 75.050000_r8, 47.040000_r8, 16.000000_r8, & - 17.010000_r8, 33.010000_r8, 16.000000_r8, 2.020000_r8, 28.020000_r8, & - 32.000000_r8, 74.090000_r8 /) + 159.130000_r8, 173.160000_r8, 14.010000_r8, 187.190000_r8, 147.120000_r8, & + 147.120000_r8, 146.140000_r8, 103.110000_r8, 103.110000_r8, 241.140000_r8, & + 194.140000_r8, 196.160000_r8, 60.110000_r8, 196.160000_r8, 196.160000_r8, & + 196.160000_r8, 1.010000_r8, 167.160000_r8, 167.160000_r8, 167.160000_r8, & + 212.160000_r8, 149.140000_r8, 150.130000_r8, 136.090000_r8, 119.110000_r8, & + 119.110000_r8, 101.090000_r8, 91.100000_r8, 230.270000_r8, 230.270000_r8, & + 61.070000_r8, 212.160000_r8, 89.080000_r8, 185.270000_r8, 101.090000_r8, & + 149.140000_r8, 149.140000_r8, 60.060000_r8, 185.270000_r8, 196.160000_r8, & + 75.100000_r8, 117.140000_r8, 117.140000_r8, 162.140000_r8, 162.140000_r8, & + 180.100000_r8, 89.080000_r8, 61.070000_r8, 89.130000_r8, 75.100000_r8, & + 46.030000_r8, 75.050000_r8, 47.040000_r8, 16.000000_r8, 17.010000_r8, & + 33.010000_r8, 16.000000_r8, 2.020000_r8, 28.020000_r8, 32.000000_r8, & + 74.090000_r8 /) extfrc_lst(: 1) = (/ ' ' /) frc_from_dataset(: 1) = (/ .false. /) - !extfrc_lst(: 17) = (/ 'so4_a2 ','NO ','NO2 ','SO2 ','SVOC ', & - ! 'pom_a1 ','pom_a4 ','so4_a1 ','CO ','bc_a1 ', & - ! 'bc_a4 ','num_a1 ','num_a2 ','num_a4 ','OH ', & - ! 'N ','AOA_NH ' /) - ! crb_mass(:221) = (/ 60.055000_r8, 60.055000_r8, 12.011000_r8, 12.011000_r8, 12.011000_r8, & ! 180.165000_r8, 72.066000_r8, 72.066000_r8, 72.066000_r8, 60.055000_r8, & ! 48.044000_r8, 60.055000_r8, 60.055000_r8, 72.066000_r8, 60.055000_r8, & @@ -351,532 +352,6 @@ subroutine set_sim_dat ! 'PHENO2 ', 'PO2 ', 'RO2 ', 'TERP2O2 ', 'TERPO2 ', & ! 'TOLO2 ', 'XO2 ', 'XYLENO2 ', 'XYLOLO2 ' /) - ! if( allocated( rxt_tag_lst ) ) then - ! deallocate( rxt_tag_lst ) - ! end if - ! allocate( rxt_tag_lst(rxt_tag_cnt),stat=ios ) - ! if( ios /= 0 ) then - ! write(iulog,*) 'set_sim_dat: failed to allocate rxt_tag_lst; error = ',ios - ! call endrun - ! end if - ! if( allocated( rxt_tag_map ) ) then - ! deallocate( rxt_tag_map ) - ! end if - ! allocate( rxt_tag_map(rxt_tag_cnt),stat=ios ) - ! if( ios /= 0 ) then - ! write(iulog,*) 'set_sim_dat: failed to allocate rxt_tag_map; error = ',ios - ! call endrun - ! end if - ! rxt_tag_lst( 1: 200) = (/ 'jh2o_b ', 'jh2o_a ', & - ! 'jh2o_c ', 'jh2o2 ', & - ! 'jo2_a ', 'jo2_b ', & - ! 'jo3_a ', 'jo3_b ', & - ! 'jhno3 ', 'jho2no2_a ', & - ! 'jho2no2_b ', 'jn2o ', & - ! 'jn2o5_a ', 'jn2o5_b ', & - ! 'jno ', 'jno2 ', & - ! 'jno3_b ', 'jno3_a ', & - ! 'jalknit ', 'jalkooh ', & - ! 'jbenzooh ', 'jbepomuc ', & - ! 'jbigald ', 'jbigald1 ', & - ! 'jbigald2 ', 'jbigald3 ', & - ! 'jbigald4 ', 'jbzooh ', & - ! 'jc2h5ooh ', 'jc3h7ooh ', & - ! 'jc6h5ooh ', 'jch2o_a ', & - ! 'jch2o_b ', 'jch3cho ', & - ! 'jacet ', 'jmgly ', & - ! 'jch3co3h ', 'jch3ooh ', & - ! 'jch4_a ', 'jch4_b ', & - ! 'jco2 ', 'jeooh ', & - ! 'jglyald ', 'jglyoxal ', & - ! 'jhonitr ', 'jhpald ', & - ! 'jhyac ', 'jisopnooh ', & - ! 'jisopooh ', 'jmacr_a ', & - ! 'jmacr_b ', 'jmek ', & - ! 'jmekooh ', 'jmpan ', & - ! 'jmvk ', 'jnc4cho ', & - ! 'jnoa ', 'jnterpooh ', & - ! 'jonitr ', 'jpan ', & - ! 'jphenooh ', 'jpooh ', & - ! 'jrooh ', 'jtepomuc ', & - ! 'jterp2ooh ', 'jterpnit ', & - ! 'jterpooh ', 'jterprd1 ', & - ! 'jterprd2 ', 'jtolooh ', & - ! 'jxooh ', 'jxylenooh ', & - ! 'jxylolooh ', 'jbrcl ', & - ! 'jbro ', 'jbrono2_b ', & - ! 'jbrono2_a ', 'jccl4 ', & - ! 'jcf2clbr ', 'jcf3br ', & - ! 'jcfcl3 ', 'jcfc113 ', & - ! 'jcfc114 ', 'jcfc115 ', & - ! 'jcf2cl2 ', 'jch2br2 ', & - ! 'jch3br ', 'jch3ccl3 ', & - ! 'jch3cl ', 'jchbr3 ', & - ! 'jcl2 ', 'jcl2o2 ', & - ! 'jclo ', 'jclono2_a ', & - ! 'jclono2_b ', 'jcof2 ', & - ! 'jcofcl ', 'jh2402 ', & - ! 'jhbr ', 'jhcfc141b ', & - ! 'jhcfc142b ', 'jhcfc22 ', & - ! 'jhcl ', 'jhf ', & - ! 'jhobr ', 'jhocl ', & - ! 'joclo ', 'jsf6 ', & - ! 'jh2so4 ', 'jocs ', & - ! 'jso ', 'jso2 ', & - ! 'jso3 ', 'jsoa1_a1 ', & - ! 'jsoa1_a2 ', 'jsoa2_a1 ', & - ! 'jsoa2_a2 ', 'jsoa3_a1 ', & - ! 'jsoa3_a2 ', 'jsoa4_a1 ', & - ! 'jsoa4_a2 ', 'jsoa5_a1 ', & - ! 'jsoa5_a2 ', 'O1D_H2 ', & - ! 'O1D_H2O ', 'O1D_N2 ', & - ! 'O1D_O2ab ', 'O1D_O3 ', & - ! 'O_O3 ', 'usr_O_O ', & - ! 'usr_O_O2 ', 'H2_O ', & - ! 'H2O2_O ', 'H_HO2 ', & - ! 'H_HO2a ', 'H_HO2b ', & - ! 'H_O2 ', 'HO2_O ', & - ! 'HO2_O3 ', 'H_O3 ', & - ! 'OH_H2 ', 'OH_H2O2 ', & - ! 'OH_HO2 ', 'OH_O ', & - ! 'OH_O3 ', 'OH_OH ', & - ! 'OH_OH_M ', 'usr_HO2_HO2 ', & - ! 'HO2NO2_OH ', 'N_NO ', & - ! 'N_NO2a ', 'N_NO2b ', & - ! 'N_NO2c ', 'N_O2 ', & - ! 'NO2_O ', 'NO2_O3 ', & - ! 'NO2_O_M ', 'NO3_HO2 ', & - ! 'NO3_NO ', 'NO3_O ', & - ! 'NO3_OH ', 'N_OH ', & - ! 'NO_HO2 ', 'NO_O3 ', & - ! 'NO_O_M ', 'O1D_N2Oa ', & - ! 'O1D_N2Ob ', 'tag_NO2_HO2 ', & - ! 'tag_NO2_NO3 ', 'tag_NO2_OH ', & - ! 'usr_HNO3_OH ', 'usr_HO2NO2_M ', & - ! 'usr_N2O5_M ', 'CL_CH2O ', & - ! 'CL_CH4 ', 'CL_H2 ', & - ! 'CL_H2O2 ', 'CL_HO2a ', & - ! 'CL_HO2b ', 'CL_O3 ', & - ! 'CLO_CH3O2 ', 'CLO_CLOa ', & - ! 'CLO_CLOb ', 'CLO_CLOc ', & - ! 'CLO_HO2 ', 'CLO_NO ', & - ! 'CLONO2_CL ', 'CLO_NO2_M ', & - ! 'CLONO2_O ', 'CLONO2_OH ', & - ! 'CLO_O ', 'CLO_OHa ', & - ! 'CLO_OHb ', 'HCL_O ', & - ! 'HCL_OH ', 'HOCL_CL ', & - ! 'HOCL_O ', 'HOCL_OH ', & - ! 'O1D_CCL4 ', 'O1D_CF2CLBR ' /) - ! rxt_tag_lst( 201: 400) = (/ 'O1D_CFC11 ', 'O1D_CFC113 ', & - ! 'O1D_CFC114 ', 'O1D_CFC115 ', & - ! 'O1D_CFC12 ', 'O1D_HCLa ', & - ! 'O1D_HCLb ', 'tag_CLO_CLO_M ', & - ! 'usr_CL2O2_M ', 'BR_CH2O ', & - ! 'BR_HO2 ', 'BR_O3 ', & - ! 'BRO_BRO ', 'BRO_CLOa ', & - ! 'BRO_CLOb ', 'BRO_CLOc ', & - ! 'BRO_HO2 ', 'BRO_NO ', & - ! 'BRO_NO2_M ', 'BRONO2_O ', & - ! 'BRO_O ', 'BRO_OH ', & - ! 'HBR_O ', 'HBR_OH ', & - ! 'HOBR_O ', 'O1D_CF3BR ', & - ! 'O1D_CHBR3 ', 'O1D_H2402 ', & - ! 'O1D_HBRa ', 'O1D_HBRb ', & - ! 'F_CH4 ', 'F_H2 ', & - ! 'F_H2O ', 'F_HNO3 ', & - ! 'O1D_COF2 ', 'O1D_COFCL ', & - ! 'CH2BR2_CL ', 'CH2BR2_OH ', & - ! 'CH3BR_CL ', 'CH3BR_OH ', & - ! 'CH3CCL3_OH ', 'CH3CL_CL ', & - ! 'CH3CL_OH ', 'CHBR3_CL ', & - ! 'CHBR3_OH ', 'HCFC141B_OH ', & - ! 'HCFC142B_OH ', 'HCFC22_OH ', & - ! 'O1D_CH2BR2 ', 'O1D_CH3BR ', & - ! 'O1D_HCFC141B ', 'O1D_HCFC142B ', & - ! 'O1D_HCFC22 ', 'CH2O_HO2 ', & - ! 'CH2O_NO3 ', 'CH2O_O ', & - ! 'CH2O_OH ', 'CH3O2_CH3O2a ', & - ! 'CH3O2_CH3O2b ', 'CH3O2_HO2 ', & - ! 'CH3O2_NO ', 'CH3OH_OH ', & - ! 'CH3OOH_OH ', 'CH4_OH ', & - ! 'CO_OH_M ', 'HCN_OH ', & - ! 'HCOOH_OH ', 'HOCH2OO_HO2 ', & - ! 'HOCH2OO_M ', 'HOCH2OO_NO ', & - ! 'O1D_CH4a ', 'O1D_CH4b ', & - ! 'O1D_CH4c ', 'O1D_HCN ', & - ! 'usr_CO_OH_b ', 'C2H2_CL_M ', & - ! 'C2H2_OH_M ', 'C2H4_CL_M ', & - ! 'C2H4_O3 ', 'C2H5O2_C2H5O2 ', & - ! 'C2H5O2_CH3O2 ', 'C2H5O2_HO2 ', & - ! 'C2H5O2_NO ', 'C2H5OH_OH ', & - ! 'C2H5OOH_OH ', 'C2H6_CL ', & - ! 'C2H6_OH ', 'CH3CHO_NO3 ', & - ! 'CH3CHO_OH ', 'CH3CN_OH ', & - ! 'CH3CO3_CH3CO3 ', 'CH3CO3_CH3O2 ', & - ! 'CH3CO3_HO2 ', 'CH3CO3_NO ', & - ! 'CH3COOH_OH ', 'CH3COOOH_OH ', & - ! 'EO2_HO2 ', 'EO2_NO ', & - ! 'EO_M ', 'EO_O2 ', & - ! 'GLYALD_OH ', 'GLYOXAL_OH ', & - ! 'PAN_OH ', 'tag_C2H4_OH ', & - ! 'tag_CH3CO3_NO2 ', 'usr_PAN_M ', & - ! 'C3H6_NO3 ', 'C3H6_O3 ', & - ! 'C3H7O2_CH3O2 ', 'C3H7O2_HO2 ', & - ! 'C3H7O2_NO ', 'C3H7OOH_OH ', & - ! 'C3H8_OH ', 'CH3COCHO_NO3 ', & - ! 'CH3COCHO_OH ', 'HYAC_OH ', & - ! 'NOA_OH ', 'PO2_HO2 ', & - ! 'PO2_NO ', 'POOH_OH ', & - ! 'RO2_CH3O2 ', 'RO2_HO2 ', & - ! 'RO2_NO ', 'ROOH_OH ', & - ! 'tag_C3H6_OH ', 'usr_CH3COCH3_OH ', & - ! 'BIGENE_NO3 ', 'BIGENE_OH ', & - ! 'ENEO2_NO ', 'ENEO2_NOb ', & - ! 'HONITR_OH ', 'MACRO2_CH3CO3 ', & - ! 'MACRO2_CH3O2 ', 'MACRO2_HO2 ', & - ! 'MACRO2_NO3 ', 'MACRO2_NOa ', & - ! 'MACRO2_NOb ', 'MACR_O3 ', & - ! 'MACR_OH ', 'MACROOH_OH ', & - ! 'MCO3_CH3CO3 ', 'MCO3_CH3O2 ', & - ! 'MCO3_HO2 ', 'MCO3_MCO3 ', & - ! 'MCO3_NO ', 'MCO3_NO3 ', & - ! 'MEKO2_HO2 ', 'MEKO2_NO ', & - ! 'MEK_OH ', 'MEKOOH_OH ', & - ! 'MPAN_OH_M ', 'MVK_O3 ', & - ! 'MVK_OH ', 'usr_MCO3_NO2 ', & - ! 'usr_MPAN_M ', 'ALKNIT_OH ', & - ! 'ALKO2_HO2 ', 'ALKO2_NO ', & - ! 'ALKO2_NOb ', 'ALKOOH_OH ', & - ! 'BIGALK_OH ', 'HPALD_OH ', & - ! 'HYDRALD_OH ', 'IEPOX_OH ', & - ! 'ISOPAO2_CH3CO3 ', 'ISOPAO2_CH3O2 ', & - ! 'ISOPAO2_HO2 ', 'ISOPAO2_NO ', & - ! 'ISOPAO2_NO3 ', 'ISOPBO2_CH3CO3 ', & - ! 'ISOPBO2_CH3O2 ', 'ISOPBO2_HO2 ', & - ! 'ISOPBO2_M ', 'ISOPBO2_NO ', & - ! 'ISOPBO2_NO3 ', 'ISOPNITA_OH ', & - ! 'ISOPNITB_OH ', 'ISOP_NO3 ', & - ! 'ISOPNO3_CH3CO3 ', 'ISOPNO3_CH3O2 ', & - ! 'ISOPNO3_HO2 ', 'ISOPNO3_NO ', & - ! 'ISOPNO3_NO3 ', 'ISOPNOOH_OH ', & - ! 'ISOP_O3 ', 'ISOP_OH ', & - ! 'ISOPOOH_OH ', 'NC4CH2OH_OH ', & - ! 'NC4CHO_OH ', 'XO2_CH3CO3 ', & - ! 'XO2_CH3O2 ', 'XO2_HO2 ', & - ! 'XO2_NO ', 'XO2_NO3 ', & - ! 'XOOH_OH ', 'ACBZO2_HO2 ', & - ! 'ACBZO2_NO ', 'BENZENE_OH ', & - ! 'BENZO2_HO2 ', 'BENZO2_NO ' /) - ! rxt_tag_lst( 401: 528) = (/ 'BENZOOH_OH ', 'BZALD_OH ', & - ! 'BZOO_HO2 ', 'BZOOH_OH ', & - ! 'BZOO_NO ', 'C6H5O2_HO2 ', & - ! 'C6H5O2_NO ', 'C6H5OOH_OH ', & - ! 'CRESOL_OH ', 'DICARBO2_HO2 ', & - ! 'DICARBO2_NO ', 'DICARBO2_NO2 ', & - ! 'MALO2_HO2 ', 'MALO2_NO ', & - ! 'MALO2_NO2 ', 'MDIALO2_HO2 ', & - ! 'MDIALO2_NO ', 'MDIALO2_NO2 ', & - ! 'PHENO2_HO2 ', 'PHENO2_NO ', & - ! 'PHENOL_OH ', 'PHENO_NO2 ', & - ! 'PHENO_O3 ', 'PHENOOH_OH ', & - ! 'tag_ACBZO2_NO2 ', 'TOLO2_HO2 ', & - ! 'TOLO2_NO ', 'TOLOOH_OH ', & - ! 'TOLUENE_OH ', 'usr_PBZNIT_M ', & - ! 'XYLENES_OH ', 'XYLENO2_HO2 ', & - ! 'XYLENO2_NO ', 'XYLENOOH_OH ', & - ! 'XYLOLO2_HO2 ', 'XYLOLO2_NO ', & - ! 'XYLOL_OH ', 'XYLOLOOH_OH ', & - ! 'BCARY_NO3 ', 'BCARY_O3 ', & - ! 'BCARY_OH ', 'MTERP_NO3 ', & - ! 'MTERP_O3 ', 'MTERP_OH ', & - ! 'NTERPO2_CH3O2 ', 'NTERPO2_HO2 ', & - ! 'NTERPO2_NO ', 'NTERPO2_NO3 ', & - ! 'NTERPOOH_OH ', 'TERP2O2_CH3O2 ', & - ! 'TERP2O2_HO2 ', 'TERP2O2_NO ', & - ! 'TERP2OOH_OH ', 'TERPNIT_OH ', & - ! 'TERPO2_CH3O2 ', 'TERPO2_HO2 ', & - ! 'TERPO2_NO ', 'TERPOOH_OH ', & - ! 'TERPROD1_NO3 ', 'TERPROD1_OH ', & - ! 'TERPROD2_OH ', 'OCS_O ', & - ! 'OCS_OH ', 'S_O2 ', & - ! 'S_O3 ', 'SO_BRO ', & - ! 'SO_CLO ', 'S_OH ', & - ! 'SO_NO2 ', 'SO_O2 ', & - ! 'SO_O3 ', 'SO_OCLO ', & - ! 'SO_OH ', 'usr_SO2_OH ', & - ! 'usr_SO3_H2O ', 'DMS_NO3 ', & - ! 'DMS_OHa ', 'NH3_OH ', & - ! 'usr_DMS_OH ', 'usr_GLYOXAL_aer ', & - ! 'usr_HO2_aer ', 'usr_HONITR_aer ', & - ! 'usr_ISOPNITA_aer ', 'usr_ISOPNITB_aer ', & - ! 'usr_N2O5_aer ', 'usr_NC4CH2OH_aer ', & - ! 'usr_NC4CHO_aer ', 'usr_NH4_strat_tau ', & - ! 'usr_NO2_aer ', 'usr_NO3_aer ', & - ! 'usr_NTERPOOH_aer ', 'usr_ONITR_aer ', & - ! 'usr_TERPNIT_aer ', 'BCARY_NO3_vbs ', & - ! 'BCARY_O3_vbs ', 'BCARY_OH_vbs ', & - ! 'BENZENE_OH_vbs ', 'ISOP_NO3_vbs ', & - ! 'ISOP_O3_vbs ', 'ISOP_OH_vbs ', & - ! 'IVOC_OH ', 'MTERP_NO3_vbs ', & - ! 'MTERP_O3_vbs ', 'MTERP_OH_vbs ', & - ! 'SVOC_OH ', 'TOLUENE_OH_vbs ', & - ! 'XYLENES_OH_vbs ', 'het1 ', & - ! 'het10 ', 'het11 ', & - ! 'het12 ', 'het13 ', & - ! 'het14 ', 'het15 ', & - ! 'het16 ', 'het17 ', & - ! 'het2 ', 'het3 ', & - ! 'het4 ', 'het5 ', & - ! 'het6 ', 'het7 ', & - ! 'het8 ', 'het9 ', & - ! 'E90_tau ', 'NH_50_tau ', & - ! 'NH_5_tau ', 'ST80_25_tau ' /) - ! rxt_tag_map(:rxt_tag_cnt) = (/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, & - ! 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, & - ! 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, & - ! 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, & - ! 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, & - ! 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, & - ! 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, & - ! 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, & - ! 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, & - ! 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, & - ! 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, & - ! 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, & - ! 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, & - ! 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, & - ! 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, & - ! 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, & - ! 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, & - ! 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, & - ! 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, & - ! 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, & - ! 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, & - ! 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, & - ! 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, & - ! 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, & - ! 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, & - ! 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, & - ! 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, & - ! 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, & - ! 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, & - ! 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, & - ! 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, & - ! 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, & - ! 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, & - ! 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, & - ! 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, & - ! 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, & - ! 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, & - ! 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, & - ! 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, & - ! 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, & - ! 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, & - ! 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, & - ! 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, & - ! 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, & - ! 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, & - ! 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, & - ! 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, & - ! 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, & - ! 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, & - ! 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, & - ! 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, & - ! 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, & - ! 521, 522, 523, 524, 525, 526, 527, 528 /) - ! if( allocated( pht_alias_lst ) ) then - ! deallocate( pht_alias_lst ) - ! end if - ! allocate( pht_alias_lst(phtcnt,2),stat=ios ) - ! if( ios /= 0 ) then - ! write(iulog,*) 'set_sim_dat: failed to allocate pht_alias_lst; error = ',ios - ! call endrun - ! end if - ! if( allocated( pht_alias_mult ) ) then - ! deallocate( pht_alias_mult ) - ! end if - ! allocate( pht_alias_mult(phtcnt,2),stat=ios ) - ! if( ios /= 0 ) then - ! write(iulog,*) 'set_sim_dat: failed to allocate pht_alias_mult; error = ',ios - ! call endrun - ! end if - ! pht_alias_lst(:,1) = (/ ' ', ' ', ' ', ' ', & - ! 'userdefined ', 'userdefined ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', 'userdefined ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ' /) - ! pht_alias_lst(:,2) = (/ ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', 'jch3ooh ', 'jch3ooh ', & - ! 'jch3ooh ', 'jno2 ', 'jno2 ', 'jno2 ', & - ! 'jno2 ', 'jno2 ', 'jno2 ', 'jch3ooh ', & - ! 'jch3ooh ', 'jch3ooh ', 'jch3ooh ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! 'jh2o2 ', ' ', ' ', ' ', & - ! ' ', 'jch3ooh ', ' ', 'jmgly ', & - ! 'jch2o_a ', 'jno2 ', ' ', 'jch3ooh ', & - ! 'jch3ooh ', ' ', ' ', 'jacet ', & - ! 'jch3ooh ', 'jpan ', ' ', 'jch2o_a ', & - ! 'jch2o_a ', 'jch3ooh ', 'jch3cho ', ' ', & - ! 'jch3ooh ', 'jch3ooh ', 'jch3ooh ', 'jno2 ', & - ! 'jch3ooh ', 'jch3ooh ', 'jch3ooh ', 'jch3cho ', & - ! 'jch3cho ', 'jch3ooh ', 'jch3ooh ', 'jch3ooh ', & - ! 'jch3ooh ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', ' ', ' ', ' ', & - ! ' ', 'jno2 ', 'jno2 ', 'jno2 ', & - ! 'jno2 ', 'jno2 ', 'jno2 ', 'jno2 ', & - ! 'jno2 ', 'jno2 ', 'jno2 ' /) - ! pht_alias_mult(:,1) = (/ 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8 /) - ! pht_alias_mult(:,2) = (/ 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, .10_r8, 0.2_r8, .14_r8, .20_r8, & - ! .20_r8, .006_r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 0.28_r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! .006_r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, .10_r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, 1._r8, 1._r8, & - ! 1._r8, 1._r8, 1._r8, .0004_r8, .0004_r8, & - ! .0004_r8, .0004_r8, .0004_r8, .0004_r8, .0004_r8, & - ! .0004_r8, .0004_r8, .0004_r8 /) - ! allocate( cph_enthalpy(enthalpy_cnt),stat=ios ) - ! if( ios /= 0 ) then - ! write(iulog,*) 'set_sim_dat: failed to allocate cph_enthalpy; error = ',ios - ! call endrun - ! end if - ! allocate( cph_rid(enthalpy_cnt),stat=ios ) - ! if( ios /= 0 ) then - ! write(iulog,*) 'set_sim_dat: failed to allocate cph_rid; error = ',ios - ! call endrun - ! end if - ! cph_rid(:) = (/ 126, 129, 130, 131, 134, & - ! 137, 138, 139, 140, 143, & - ! 144, 145, 148, 150, 154, & - ! 155, 163, 164 /) - ! cph_enthalpy(:) = (/ 189.810000_r8, 392.190000_r8, 493.580000_r8, 101.390000_r8, 232.590000_r8, & - ! 203.400000_r8, 226.580000_r8, 120.100000_r8, 194.710000_r8, 293.620000_r8, & - ! 67.670000_r8, 165.300000_r8, 165.510000_r8, 313.750000_r8, 133.750000_r8, & - ! 193.020000_r8, 34.470000_r8, 199.170000_r8 /) - ! allocate( num_rnts(rxntot-phtcnt),stat=ios ) - ! if( ios /= 0 ) then - ! write(iulog,*) 'set_sim_dat: failed to allocate num_rnts; error = ',ios - ! call endrun - ! end if - ! num_rnts(:) = (/ 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, & - ! 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, & - ! 2, 3, 2, 2, 3, 3, 3, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 3, 3, 2, 2, 1, 2, 2, 2, 2, & - ! 2, 2, 3, 3, 3, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, & - ! 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, & - ! 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, & - ! 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, & - ! 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, & - ! 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, & - ! 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, & - ! 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, & - ! 2, 2, 2, 1, 1, 2, 2, 2, 1, 1, & - ! 2, 1, 1, 1, 1 /) - end subroutine set_sim_dat end module mo_sim_dat diff --git a/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 b/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 index 8050030043..b6cbc77dcc 100644 --- a/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 +++ b/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 @@ -14,7 +14,7 @@ module chem_mods relcnt = 0, & ! number of relationship species grpcnt = 0, & ! number of group members nzcnt = 2022, & ! number of non-zero matrix entries - extcnt = 17, & ! number of species with external forcing + extcnt = 25, & ! number of species with external forcing clscnt1 = 30, & ! number of species in explicit class clscnt2 = 0, & ! number of species in hov class clscnt3 = 0, & ! number of species in ebi class diff --git a/src/chemistry/pp_trop_strat_mam4_vbs/mo_sim_dat.F90 b/src/chemistry/pp_trop_strat_mam4_vbs/mo_sim_dat.F90 index b4acb1295a..5eec3adef2 100644 --- a/src/chemistry/pp_trop_strat_mam4_vbs/mo_sim_dat.F90 +++ b/src/chemistry/pp_trop_strat_mam4_vbs/mo_sim_dat.F90 @@ -242,15 +242,17 @@ subroutine set_sim_dat 1621,1672,1699,1734,1776,1837,1862,1893,1917,1996, & 2022 /) - extfrc_lst(: 17) = (/ 'so4_a2 ','NO ','NO2 ','SO2 ','SVOC ', & + extfrc_lst(: 25) = (/ 'so4_a2 ','NO ','NO2 ','SO2 ','SVOC ', & 'pom_a1 ','pom_a4 ','so4_a1 ','CO ','bc_a1 ', & - 'bc_a4 ','num_a1 ','num_a2 ','num_a4 ','OH ', & - 'N ','AOA_NH ' /) + 'bc_a4 ','num_a1 ','num_a2 ','num_a4 ','CH3COCH3 ', & + 'CH3CHO ','BIGALK ','C2H6 ','C3H8 ','CH2O ', & + 'C3H6 ','MACR ','OH ','N ','AOA_NH ' /) - frc_from_dataset(: 17) = (/ .true., .true., .true., .true., .true., & + frc_from_dataset(: 25) = (/ .true., .true., .true., .true., .true., & .true., .true., .true., .true., .true., & - .true., .true., .true., .true., .false., & - .false., .false. /) + .true., .true., .true., .true., .true., & + .true., .true., .true., .true., .true., & + .true., .true., .false., .false., .false. /) inv_lst(: 3) = (/ 'M ', 'N2 ', 'O2 ' /) diff --git a/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 b/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 index 9665256a26..02c648cbcb 100644 --- a/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 +++ b/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 @@ -14,7 +14,7 @@ module chem_mods relcnt = 0, & ! number of relationship species grpcnt = 0, & ! number of group members nzcnt = 2078, & ! number of non-zero matrix entries - extcnt = 17, & ! number of species with external forcing + extcnt = 25, & ! number of species with external forcing clscnt1 = 26, & ! number of species in explicit class clscnt2 = 0, & ! number of species in hov class clscnt3 = 0, & ! number of species in ebi class diff --git a/src/chemistry/pp_trop_strat_mam4_vbsext/mo_sim_dat.F90 b/src/chemistry/pp_trop_strat_mam4_vbsext/mo_sim_dat.F90 index ec5d8e28ed..6559e5596d 100644 --- a/src/chemistry/pp_trop_strat_mam4_vbsext/mo_sim_dat.F90 +++ b/src/chemistry/pp_trop_strat_mam4_vbsext/mo_sim_dat.F90 @@ -269,15 +269,17 @@ subroutine set_sim_dat 1395,1418,1513,1538,1698,1722,1764,1822,1873,1934, & 1959,1986,2017,2052,2078 /) - extfrc_lst(: 17) = (/ 'pombb1_a4 ','bc_a4 ','CO ','NO ','NO2 ', & + extfrc_lst(: 25) = (/ 'pombb1_a4 ','bc_a4 ','CO ','NO ','NO2 ', & 'num_a1 ','num_a2 ','num_a4 ','SO2 ','so4_a1 ', & 'so4_a2 ','SVOCbb ','SVOCff ','pomff1_a4 ','bc_a1 ', & - 'N ','OH ' /) + 'CH3COCH3 ','CH3CHO ','BIGALK ','C2H6 ','C3H8 ', & + 'CH2O ','C3H6 ','MACR ','N ','OH ' /) - frc_from_dataset(: 17) = (/ .true., .true., .true., .true., .true., & + frc_from_dataset(: 25) = (/ .true., .true., .true., .true., .true., & .true., .true., .true., .true., .true., & .true., .true., .true., .true., .true., & - .false., .false. /) + .true., .true., .true., .true., .true., & + .true., .true., .true., .false., .false. /) inv_lst(: 3) = (/ 'M ', 'O2 ', 'N2 ' /) From d8f37097fc799efe201d488dff14d0143601850d Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 7 Dec 2021 12:40:05 -0700 Subject: [PATCH 013/160] Fix: correct improper merge conflict handling introduced during rebase Signed-off-by: Lizzie Lundgren --- .../use_cases/2000_geoschem.xml | 8 +- src/chemistry/geoschem/chemistry.F90 | 434 +++++------------- 2 files changed, 118 insertions(+), 324 deletions(-) diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index 7b4aa03782..2b7264fc61 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -50,13 +50,13 @@ 2000 atm/waccm/lb/LBC_2000climo_CMIP6_0p5degLat_c180227.nc ->&gt; emissions timing &lt;/!</! + ->&gt; &amp;lt;ext_frc_type&amp;gt;'SERIAL'&amp;lt;/ext_frc_type&amp;gt; &lt;/!</! + 'CYCLICAL' 2000 ->&gt; History Files &lt;/!</! + 1,30,365,240,240,480,365,73,30 0,-24,-24,-3,-1,1,-24,-120,-240 @@ -93,7 +93,7 @@ - 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index f1bff359d2..eda8b869a0 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -193,10 +193,9 @@ logical function chem_is (name) use mo_chem_utls, only : utls_chem_is - chem_is = .false. - IF ( to_upper(name) == 'GEOSCHEM' ) THEN - chem_is = .true. - ENDIF + character(len=*), intent(in) :: name + + chem_is = utls_chem_is(name) end function chem_is @@ -275,7 +274,6 @@ subroutine chem_register ! hplin 2020-05-16: Call set_sim_dat to populate chemistry constituent information ! from mo_sim_dat.F90 in other places. This is needed for HEMCO_CESM. CALL Set_sim_dat() - IF ( MasterProc ) Write(iulog,*) 'GCCALL after set_sim_dat' ! Prevent Reporting IO%amIRoot = .False. @@ -714,7 +712,9 @@ subroutine chem_readnl(nlfile) srf_emis_fixed_tod, & srf_emis_type - nIgnored = 0 + ! ghg chem + + namelist /chem_inparm/ bndtvg, h2orates, ghg_chem ALLOCATE(drySpc_ndx(nddvels), STAT=IERR) IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate drySpc_ndx') @@ -915,6 +915,7 @@ function chem_is_active() !----------------------------------------------------------------------- logical :: chem_is_active !----------------------------------------------------------------------- + chem_is_active = .true. end function chem_is_active @@ -1214,14 +1215,14 @@ subroutine chem_init(phys_state, pbuf2d) DO I = BEGCHUNK, ENDCHUNK - ! Initialize fields of the Grid State object - CALL Init_State_Grid( Input_Opt = Input_Opt, & - State_Grid = State_Grid(I), & - RC = RC ) + ! Initialize fields of the Grid State object + CALL Init_State_Grid( Input_Opt = Input_Opt, & + State_Grid = State_Grid(I), & + RC = RC ) IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered within call to "Init_State_Grid"!' - CALL Error_Stop( ErrMsg, ThisLoc ) + ErrMsg = 'Error encountered within call to "Init_State_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF State_Grid(I)%NX = nX @@ -1229,14 +1230,13 @@ subroutine chem_init(phys_state, pbuf2d) State_Grid(I)%NZ = nZ ! Initialize GEOS-Chem horizontal grid structure - CALL GC_Init_Grid( am_I_Root = am_I_Root, & - Input_Opt = Input_Opt, & + CALL GC_Init_Grid( Input_Opt = Input_Opt, & State_Grid = State_Grid(I), & RC = RC ) IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered within call to "GC_Init_Grid"!' - CALL Error_Stop( ErrMsg, ThisLoc ) + ErrMsg = 'Error encountered within call to "GC_Init_Grid"!' + CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF ! Define more variables for State_Grid @@ -1245,9 +1245,9 @@ subroutine chem_init(phys_state, pbuf2d) ! Set maximum number of levels in the chemistry grid IF ( Input_Opt%LUCX ) THEN - State_Grid(I)%MaxChemLev = State_Grid(I)%MaxStratLev + State_Grid(I)%MaxChemLev = State_Grid(I)%MaxStratLev ELSE - State_Grid(I)%MaxChemLev = State_Grid(I)%MaxTropLev + State_Grid(I)%MaxChemLev = State_Grid(I)%MaxTropLev ENDIF ENDDO @@ -1288,7 +1288,7 @@ subroutine chem_init(phys_state, pbuf2d) IF ( MasterProc ) THEN ! Read data in to Input_Opt%Linoz_TParm - CALL Linoz_Read( MasterProc, Input_Opt, RC ) + CALL Linoz_Read( Input_Opt, RC ) IF ( RC /= GC_SUCCESS ) THEN ErrMsg = 'Error encountered in "Linoz_Read"!' CALL Error_Stop( ErrMsg, ThisLoc ) @@ -1305,7 +1305,6 @@ subroutine chem_init(phys_state, pbuf2d) IF ( ALLOCATED( linozData ) ) DEALLOCATE(linozData) ENDIF - ! Note: The following calculations do not setup the gridcell areas. ! In any case, we will need to be constantly updating this grid ! to compensate for the "multiple chunks per processor" element @@ -1352,13 +1351,13 @@ subroutine chem_init(phys_state, pbuf2d) latEdgeArr(nX+1,J) = REAL((latVal) * PI_180, f4) ENDDO - CALL SetGridFromCtrEdges( am_I_Root = MasterProc, & + CALL SetGridFromCtrEdges( Input_Opt = Input_Opt, & State_Grid = State_Grid(L), & lonCtr = lonMidArr, & latCtr = latMidArr, & lonEdge = lonEdgeArr, & latEdge = latEdgeArr, & - RC = RC ) + RC = RC ) IF ( RC /= GC_SUCCESS ) THEN ErrMsg = 'Error encountered in "SetGridFromCtrEdges"!' @@ -1371,7 +1370,6 @@ subroutine chem_init(phys_state, pbuf2d) IF ( ALLOCATED( lonEdgeArr ) ) DEALLOCATE( lonEdgeArr ) IF ( ALLOCATED( latEdgeArr ) ) DEALLOCATE( latEdgeArr ) - ! Set the times held by "time_mod" CALL Accept_External_Date_Time( value_NYMDb = Input_Opt%NYMDb, & value_NHMSb = Input_Opt%NHMSb, & @@ -1380,6 +1378,7 @@ subroutine chem_init(phys_state, pbuf2d) value_NYMD = Input_Opt%NYMDb, & value_NHMS = Input_Opt%NHMSb, & RC = RC ) + IF ( RC /= GC_SUCCESS ) THEN ErrMsg = 'Error encountered in "Accept_External_Date_Time"!' CALL Error_Stop( ErrMsg, ThisLoc ) @@ -1423,7 +1422,7 @@ subroutine chem_init(phys_state, pbuf2d) ENDIF DO I = BEGCHUNK, ENDCHUNK - am_I_Root = (MasterProc .AND. (I == BEGCHUNK)) + Input_Opt%amIRoot = (MasterProc .AND. (I == BEGCHUNK)) CALL GC_Init_StateObj( Diag_List = Diag_List, & ! Diagnostic list obj TaggedDiag_List = TaggedDiag_List, & ! TaggedDiag list obj @@ -1560,8 +1559,8 @@ subroutine chem_init(phys_state, pbuf2d) Ap_CAM_Flip = 0.0e+0_fp Bp_CAM_Flip = 0.0e+0_fp DO I = 1, nZ+1 - Ap_CAM_Flip(I) = hyai(nZ+2-I) * ps0 * 0.01e+0_r8 - Bp_CAM_Flip(I) = hybi(nZ+2-I) + Ap_CAM_Flip(I) = hyai(nZ+2-I) * ps0 * 0.01e+0_r8 + Bp_CAM_Flip(I) = hybi(nZ+2-I) ENDDO !----------------------------------------------------------------- @@ -1591,56 +1590,26 @@ subroutine chem_init(phys_state, pbuf2d) IF ( ALLOCATED( Ap_CAM_Flip ) ) DEALLOCATE( Ap_CAM_Flip ) IF ( ALLOCATED( Bp_CAM_Flip ) ) DEALLOCATE( Bp_CAM_Flip ) - !! Initialize HEMCO? - !CALL Emissions_Init ( am_I_Root = MasterProc, & - ! Input_Opt = Input_Opt, & - ! State_Met = State_Met, & - ! State_Chm = State_Chm, & - ! State_Grid = State_Grid, & - ! State_Met = State_Met, & - ! RC = RC, & - ! HcoConfig = HcoConfig ) - ! - !IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Error encountered in "Emissions_Init"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - !ENDIF - ! + ! Once the initial met fields have been read in, we need to find + ! the maximum PBL level for the non-local mixing algorithm. + CALL Max_PblHt_For_Vdiff( Input_Opt = Input_Opt, & + State_Grid = State_Grid(BEGCHUNK), & + State_Met = State_Met(BEGCHUNK), & + RC = RC ) -!#if ( ALLDDVEL_GEOSCHEM && LANDTYPE_HEMCO ) -! ! Populate the State_Met%LandTypeFrac field with data from HEMCO -! CALL Init_LandTypeFrac( am_I_Root = MasterProc, & -! Input_Opt = Input_Opt, & -! State_Met = State_Met(BEGCHUNK), & -! RC = RC ) -! -! IF ( RC /= GC_SUCCESS ) THEN -! ErrMsg = 'Error encountered in "Init_LandTypeFrac"!' -! CALL Error_Stop( ErrMsg, ThisLoc ) -! ENDIF -! -! ! Compute the Olson landmap fields of State_Met -! ! (e.g. State_Met%IREG, State_Met%ILAND, etc.) -! CALL Compute_Olson_Landmap( am_I_Root = MasterProc, & -! Input_Opt = Input_Opt, & -! State_Grid = State_Grid(BEGCHUNK), & -! State_Met = State_Met(BEGCHUNK), & -! RC = RC ) -! -! IF ( RC /= GC_SUCCESS ) THEN -! ErrMsg = 'Error encountered in "Compute_Olson_Landmap"!' -! CALL Error_Stop( ErrMsg, ThisLoc ) -! ENDIF -!#endif + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Max_PblHt_for_Vdiff"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF IF ( Input_Opt%Its_A_FullChem_Sim .OR. & Input_Opt%Its_An_Aerosol_Sim ) THEN - ! This also initializes Fast-JX - CALL Init_Chemistry( Input_Opt = Input_Opt, & - & State_Chm = State_Chm(BEGCHUNK), & - & State_Diag = State_Diag(BEGCHUNK), & - & State_Grid = State_Grid(BEGCHUNK), & - & RC = RC ) + ! This also initializes Fast-JX + CALL Init_Chemistry( Input_Opt = Input_Opt, & + State_Chm = State_Chm(BEGCHUNK), & + State_Diag = State_Diag(BEGCHUNK), & + State_Grid = State_Grid(BEGCHUNK), & + RC = RC ) IF ( RC /= GC_SUCCESS ) THEN ErrMsg = 'Error encountered in "Init_Chemistry"!' @@ -3101,47 +3070,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Dimensions : nX, nY, nZ State_Met(LCHNK)%OPTD = State_Met(LCHNK)%TAUCLI + State_Met(LCHNK)%TAUCLW - ! Determine current date and time - CALL Get_Curr_Date( yr = currYr, & - mon = currMo, & - day = currDy, & - tod = currTOD ) - - ! For now, force year to be 2000 - currYr = 2000 - currYMD = (currYr*1000) + (currMo*100) + (currDy) - ! Deal with subdaily - currUTC = REAL(currTOD,f4)/3600.0e+0_f4 - currSc = 0 - currMn = 0 - currHr = 0 - DO WHILE (currTOD > 3600) - currTOD = currTOD - 3600 - currHr = currHr + 1 - ENDDO - DO WHILE (currTOD > 60) - currTOD = currTOD - 60 - currMn = currMn + 1 - ENDDO - currSc = currTOD - currHMS = (currHr*1000) + (currMn*100) + (currSc) - - IF ( firstDay ) THEN - newDay = .True. - newMonth = .True. - firstDay = .False. - ELSE IF ( currHMS < dT ) THEN - newDay = .True. - IF ( currDy == 1 ) THEN - newMonth = .True. - ELSE - newMonth = .False. - ENDIF - ELSE - newDay = .False. - newMonth = .False. - ENDIF - ! Pass time values obtained from the ESMF environment to GEOS-Chem CALL Accept_External_Date_Time( value_NYMD = currYMD, & value_NHMS = currHMS, & @@ -3635,130 +3563,53 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF -#if ( OCNDDVEL_GEOSCHEM ) - - DO N = 1, nddvels - - !! Print debug - !IF ( rootChunk ) THEN - ! IF ( N == 1 ) THEN - ! Write(iulog,*) "Number of GC dry deposition species = ", & - ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) - ! Write(iulog,*) "Number of CESM dry deposition species = ", & - ! nddvels - ! ENDIF - ! Write(iulog,*) "N = ", N - ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) - ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) - ! IF ( map2GC_dryDep(N) > 0 ) THEN - ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) - ! ENDIF - ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) - ! IF ( drySpc_ndx(N) > 0 ) THEN - ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) - ! ENDIF - ! Write(iulog,*) "CLM-depVel = ", & - ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]" - ! IF ( map2GC_dryDep(N) > 0 ) THEN - ! Write(iulog,*) "GC-depVel = ", & - ! MAXVAL(State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N))), " [m/s]" - ! ENDIF - !ENDIF - - IF ( map2GC_dryDep(N) > 0 ) THEN - ! State_Chm%DryDepVel is in m/s - State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & - ! This first bit corresponds to the dry deposition - ! velocities over land as computed from CLM and - ! converted to m/s. This is scaled by the fraction - ! of land. - cam_in%depVel(:nY,N) * 1.0e-02_fp & - * MAX(0._fp, 1.0_fp - State_Met(LCHNK)%FROCEAN(1,:nY)) & - ! This second bit corresponds to the dry deposition - ! velocities over ocean and sea ice as computed from - ! GEOS-Chem. This is scaled by the fraction of ocean - ! and sea ice. - + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) & - * State_Met(LCHNK)%FROCEAN(1,:nY) - ENDIF - ENDDO - -#endif - -#elif ( OCNDDVEL_MOZART ) - ! This routine updates the deposition velocities from CLM in the - ! pointer lnd(LCHNK)%dvel as long as drydep_method == DD_XLND is - ! True. - CALL drydep_update( State, cam_in ) - - windSpeed(:nY) = SQRT( state%U(:nY,nZ)*state%U(:nY,nZ) + & - state%V(:nY,nZ)*state%V(:nY,nZ) ) - potT(:nY) = state%t(:nY,nZ) * (1._fp + qH2O(:nY,nZ)) - - CALL get_lat_all_p( LCHNK, nY, latndx ) - CALL get_lon_all_p( LCHNK, nY, lonndx ) - - CALL drydep_fromlnd( ocnfrac = cam_in%ocnfrac(:), & - icefrac = cam_in%icefrac(:), & - ncdate = currYMD, & - sfc_temp = cam_in%TS(:), & - pressure_sfc = state%PS(:), & - wind_speed = windSpeed(:), & - spec_hum = qH2O(:,nZ), & - air_temp = state%t(:,nZ), & - pressure_10m = state%pmid(:,nZ), & - rain = State_Met(LCHNK)%PRECTOT(1,:), & - snow = cam_in%Snowhland(:), & - solar_flux = State_Met(LCHNK)%SWGDN(1,:), & - dvelocity = MOZART_depVel(:,:), & - dflx = MOZART_depFlx(:,:), & - State_Chm = State_Chm(LCHNK), & - tv = potT(:), & - soilw = -99._fp, & - rh = relHum(:,nZ), & - ncol = nY, & - lonndx = lonndx(:), & - latndx = latndx(:), & - lchnk = LCHNK ) - - DO N = 1, nddvels - - !! Print debug - !IF ( rootChunk ) THEN - ! IF ( N == 1 ) THEN - ! Write(iulog,*) "Number of GC dry deposition species = ", & - ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) - ! Write(iulog,*) "Number of CESM dry deposition species = ", & - ! nddvels - ! ENDIF - ! Write(iulog,*) "N = ", N - ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) - ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) - ! IF ( map2GC_dryDep(N) > 0 ) THEN - ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) - ! ENDIF - ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) - ! IF ( drySpc_ndx(N) > 0 ) THEN - ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) - ! ENDIF - ! Write(iulog,*) "CLM-depVel = ", & - ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]", LCHNK - ! IF ( drySpc_ndx(N) > 0 ) THEN - ! Write(iulog,*) "Merged depVel = ", & - ! MAXVAL(MOZART_depVel(:nY,drySpc_ndx(N))) * 1.0e-02_fp, " [m/s]", LCHNK - ! ENDIF - !ENDIF - - IF ( ( map2GC_dryDep(N) > 0 ) .AND. ( drySpc_ndx(N) > 0 ) ) THEN - ! State_Chm%DryDepVel is in m/s - State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & - MOZART_depVel(:nY,drySpc_ndx(N)) * 1.0e-02_fp - ENDIF - - ENDDO - - !TMMF, Here set dry deposition velocities to zero if MAM performs its - !own deposition... + IF ( Input_Opt%ddVel_CLM ) THEN + DO N = 1, nddvels + + !! Print debug + !IF ( rootChunk ) THEN + ! IF ( N == 1 ) THEN + ! Write(iulog,*) "Number of GC dry deposition species = ", & + ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) + ! Write(iulog,*) "Number of CESM dry deposition species = ", & + ! nddvels + ! ENDIF + ! Write(iulog,*) "N = ", N + ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) + ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) + ! IF ( map2GC_dryDep(N) > 0 ) THEN + ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) + ! ENDIF + ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) + ! IF ( drySpc_ndx(N) > 0 ) THEN + ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) + ! ENDIF + ! Write(iulog,*) "CLM-depVel = ", & + ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]" + ! IF ( map2GC_dryDep(N) > 0 ) THEN + ! Write(iulog,*) "GC-depVel = ", & + ! MAXVAL(State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N))), " [m/s]" + ! ENDIF + !ENDIF + + IF ( map2GC_dryDep(N) > 0 ) THEN + ! State_Chm%DryDepVel is in m/s + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & + ! This first bit corresponds to the dry deposition + ! velocities over land as computed from CLM and + ! converted to m/s. This is scaled by the fraction + ! of land. + cam_in%depVel(:nY,N) * 1.0e-02_fp & + * MAX(0._fp, 1.0_fp - State_Met(LCHNK)%FROCEAN(1,:nY)) & + ! This second bit corresponds to the dry deposition + ! velocities over ocean and sea ice as computed from + ! GEOS-Chem. This is scaled by the fraction of ocean + ! and sea ice. + + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) & + * State_Met(LCHNK)%FROCEAN(1,:nY) + ENDIF + ENDDO + ENDIF CALL Update_DryDepFreq( Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & @@ -3769,36 +3620,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF - !!=========================================================== - !! ***** E M I S S I O N S ***** - !! - !! NOTE: For a complete description of how emissions from - !! HEMCO are added into GEOS-Chem (and how they are mixed - !! into the boundary layer), please see the wiki page: - !! - !! http://wiki-geos-chem.org/Distributing_emissions_in_the_PBL - !!=========================================================== - ! - !! EMISSIONS_RUN will call HEMCO run phase 2. HEMCO run phase - !! only calculates emissions. All data has been read to disk - !! in phase 1 at the beginning of the time step. - !! (ckeller, 4/1/15) - !CALL Emissions_Run( Input_Opt = Input_Opt, & - ! State_Chm = State_Chmk(LCHNK), & - ! State_Diag = State_Diag(LCHNK), & - ! State_Grid = State_Grid(LCHNK), & - ! State_Met = State_Met(LCHNK), & - ! TimeForEmis = TimeForEmis, & - ! Phase = 2, & - ! RC = RC ) - ! - !! Trap potential errors - !IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = - ! 'Error encountered in "Emissions_Run"! after drydep!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - !ENDIF - !=========================================================== ! ***** M I X E D L A Y E R M I X I N G ***** !=========================================================== @@ -3911,20 +3732,20 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF ( Input_Opt%Its_A_FullChem_Sim .OR. & Input_Opt%Its_An_Aerosol_Sim ) THEN - IF ( Input_Opt%LChem ) THEN - CALL Compute_Overhead_O3( Input_Opt = Input_Opt, & - State_Grid = State_Grid(LCHNK), & - State_Chm = State_Chm(LCHNK), & - DAY = currDy, & - USE_O3_FROM_MET = Input_Opt%Use_O3_From_Met, & - TO3 = State_Met(LCHNK)%TO3, & - RC = RC ) - - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Compute_Overhead_O3"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - ENDIF + IF ( Input_Opt%LChem ) THEN + CALL Compute_Overhead_O3( Input_Opt = Input_Opt, & + State_Grid = State_Grid(LCHNK), & + State_Chm = State_Chm(LCHNK), & + DAY = currDy, & + USE_O3_FROM_MET = Input_Opt%Use_O3_From_Met, & + TO3 = State_Met(LCHNK)%TO3, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "Compute_Overhead_O3"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + ENDIF ENDIF IF ( Input_Opt%Its_A_Fullchem_Sim .and. iH2O > 0 ) THEN @@ -4415,7 +4236,7 @@ subroutine chem_init_cnst(name, latvals, lonvals, mask, q) ! Will need a simple mapping structure as well as the CAM tracer registration ! routines. - INTEGER :: ILEV, NLEV, I + INTEGER :: ilev, nlev, M REAL(r8) :: QTemp, Min_MMR nlev = SIZE(q, 2) @@ -4518,10 +4339,10 @@ subroutine chem_final ! Loop over each chunk and cleanup the variables DO I = BEGCHUNK, ENDCHUNK - CALL Cleanup_State_Chm ( State_Chm(I), RC ) - CALL Cleanup_State_Diag( State_Diag(I), RC ) - CALL Cleanup_State_Grid( State_Grid(I), RC ) - CALL Cleanup_State_Met ( State_Met(I), RC ) + CALL Cleanup_State_Chm ( State_Chm(I), RC ) + CALL Cleanup_State_Diag( State_Diag(I), RC ) + CALL Cleanup_State_Grid( State_Grid(I), RC ) + CALL Cleanup_State_Met ( State_Met(I), RC ) ENDDO CALL Cleanup_Error @@ -4534,7 +4355,6 @@ subroutine chem_final IF ( ALLOCATED( slvd_Lst ) ) DEALLOCATE( slvd_Lst ) IF ( ALLOCATED( slvd_ref_MMR ) ) DEALLOCATE( slvd_ref_MMR ) - RETURN end subroutine chem_final @@ -4625,40 +4445,14 @@ subroutine chem_emissions( state, cam_in ) nY = state%NCOL rootChunk = ( MasterProc.and.(LCHNK.EQ.BEGCHUNK) ) - sflx(:,:) = 0.0e+0_r8 - - DO N = 1, nTracers - - fldname_ns = 'HCO_' // TRIM(tracerNames(N)) - tmpIdx = pbuf_get_index(fldname_ns, RC) - IF ( tmpIdx < 0 ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_emissions hemco: Field not found ", TRIM(fldname_ns) - ELSE - ! This is already in chunk, retrieve it - pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) - CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) - - IF ( .NOT. ASSOCIATED(pbuf_ik) ) THEN ! Sanity check - CALL ENDRUN("chem_emissions: FATAL - tmpIdx > 0 but pbuf_ik not associated") - ENDIF - - ! For each column retrieve data from pbuf_ik(I,K) - sflx(1:ncol,N) = pbuf_ik(1:ncol,pver) ! Only surface emissions for now, - - ! Reset pointers - pbuf_ik => NULL() - pbuf_chnk => NULL() - - M = map2GCinv(N) - - IF ( M <= 0 ) CYCLE + !----------------------------------------------------------------------- + ! Reset surface fluxes + !----------------------------------------------------------------------- - cam_in%cflx(1:ncol,M) = sflx(1:ncol,N) - If ( MAXVAL(sflx(1:ncol,N)) > 0.0e+0_fp ) & - Write(iulog,*) "chem_emissions: debug added emiss for ", & - TRIM(cnst_name(M)), MAXVAL(sflx(1:ncol,N)), " from ", TRIM(fldname_ns), & - ". Total emission flux is: ", MAXVAL(cam_in%cflx(1:ncol,M)) - ENDIF + DO M = iFirstCnst, pcnst + !N = map2chm(M) + !IF ( N > 0 ) cam_in%cflx(1:nY,N) = 0.0e+0_r8 + cam_in%cflx(1:nY,M) = 0.0e+0_r8 ENDDO end subroutine chem_emissions From 62bb87d1c804ccf7bbca9cdd1104d679e48e0602 Mon Sep 17 00:00:00 2001 From: Thibaud Fritz Date: Thu, 9 Dec 2021 09:50:55 +0100 Subject: [PATCH 014/160] Feat: Return in sox_cldaero_mod if running with GEOS-Chem This prevents the code from double counting in-cloud sulfur oxidation Signed-off-by: Thibaud Fritz --- src/chemistry/modal_aero/sox_cldaero_mod.F90 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/chemistry/modal_aero/sox_cldaero_mod.F90 b/src/chemistry/modal_aero/sox_cldaero_mod.F90 index bacf94246c..589c881279 100644 --- a/src/chemistry/modal_aero/sox_cldaero_mod.F90 +++ b/src/chemistry/modal_aero/sox_cldaero_mod.F90 @@ -7,6 +7,7 @@ module sox_cldaero_mod use cam_abortutils, only : endrun use ppgrid, only : pcols, pver use mo_chem_utls, only : get_spc_ndx + use mo_chem_utls, only: utls_chem_is use cldaero_mod, only : cldaero_conc_t, cldaero_allocate, cldaero_deallocate use modal_aero_data, only : ntot_amode, modeptr_accum, lptr_so4_cw_amode, lptr_msa_cw_amode use modal_aero_data, only : numptrcw_amode, lptr_nh4_cw_amode @@ -229,6 +230,12 @@ subroutine sox_cldaero_update( & dqdt_aqhprxn(:,:) = 0.0_r8 dqdt_aqo3rxn(:,:) = 0.0_r8 + ! Avoid double counting in-cloud sulfur oxidation when running with + ! GEOS-Chem (CESM2-GC). If running with CESM2-GC, sulfur oxidation + ! is performed internally to GEOS-Chem. Here, we just return to the + ! parent routine and thus we do not apply tendencies calculated by MAM. + if ( utls_chem_is('GEOS-Chem') ) return + lev_loop: do k = 1,pver col_loop: do i = 1,ncol cloud: if (cldfrc(i,k) >= 1.0e-5_r8) then From 515ad9a80c75c863643ad0ca211ae287287f3ebb Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 13 Dec 2021 07:22:01 -0700 Subject: [PATCH 015/160] Fix: correct wrong indexes introduced by manual revert; rm GC wetscav Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/gas_wetdep_opts.F90 | 3 +-- src/chemistry/pp_trop_strat_mam4_vbs/mo_sim_dat.F90 | 4 ++-- src/chemistry/pp_trop_strat_mam4_vbsext/mo_sim_dat.F90 | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/chemistry/geoschem/gas_wetdep_opts.F90 b/src/chemistry/geoschem/gas_wetdep_opts.F90 index 908e352239..614eb50727 100644 --- a/src/chemistry/geoschem/gas_wetdep_opts.F90 +++ b/src/chemistry/geoschem/gas_wetdep_opts.F90 @@ -69,9 +69,8 @@ subroutine gas_wetdep_readnl(nlfile) if (( gas_wetdep_cnt>0 ).and. & ( .not.(gas_wetdep_method=='MOZ' .or. & gas_wetdep_method=='NEU' .or. & - gas_wetdep_method=='GEOS-CHEM' .or. & gas_wetdep_method=='OFF') )) then - call endrun('gas_wetdep_readnl; gas_wetdep_method must be set to either MOZ, NEU or GEOS-CHEM') + call endrun('gas_wetdep_readnl; gas_wetdep_method must be set to either MOZ or NEU') endif end subroutine gas_wetdep_readnl diff --git a/src/chemistry/pp_trop_strat_mam4_vbs/mo_sim_dat.F90 b/src/chemistry/pp_trop_strat_mam4_vbs/mo_sim_dat.F90 index 8ed889ffe6..68d5d53160 100644 --- a/src/chemistry/pp_trop_strat_mam4_vbs/mo_sim_dat.F90 +++ b/src/chemistry/pp_trop_strat_mam4_vbs/mo_sim_dat.F90 @@ -246,12 +246,12 @@ subroutine set_sim_dat 1278,1291,1304,1327,1352,1507,1549,1640,1691,1716, & 1739,1845,1876,1900,1935,1993,2054,2080 /) - extfrc_lst(: 24) = (/ 'so4_a1 ','bc_a4 ','SVOC ','bc_a1 ','CO ', & + extfrc_lst(: 16) = (/ 'so4_a1 ','bc_a4 ','SVOC ','bc_a1 ','CO ', & 'NO ','NO2 ','num_a1 ','num_a2 ','num_a4 ', & 'pom_a1 ','pom_a4 ','so4_a2 ','SO2 ','AOA_NH ',& 'N ' /) - frc_from_dataset(: 24) = (/ .true., .true., .true., .true., .true., & + frc_from_dataset(: 16) = (/ .true., .true., .true., .true., .true., & .true., .true., .true., .true., .true., & .true., .true., .true., .true., .false., & .false. /) diff --git a/src/chemistry/pp_trop_strat_mam4_vbsext/mo_sim_dat.F90 b/src/chemistry/pp_trop_strat_mam4_vbsext/mo_sim_dat.F90 index b58866a13a..4afb77bfb4 100644 --- a/src/chemistry/pp_trop_strat_mam4_vbsext/mo_sim_dat.F90 +++ b/src/chemistry/pp_trop_strat_mam4_vbsext/mo_sim_dat.F90 @@ -269,12 +269,12 @@ subroutine set_sim_dat 1395,1418,1513,1538,1698,1722,1764,1822,1873,1934, & 1959,1986,2017,2052,2078 /) - extfrc_lst(: 26) = (/ 'bc_a1 ','bc_a4 ','CO ','NO ','NO2 ', & + extfrc_lst(: 18) = (/ 'bc_a1 ','bc_a4 ','CO ','NO ','NO2 ', & 'num_a1 ','num_a2 ','num_a4 ','SO2 ','so4_a1 ', & 'so4_a2 ','SVOCbb ','SVOCff ','pomff1_a4 ','pombb1_a4 ', & 'AOA_NH ','N ','OH ' /) - frc_from_dataset(: 26) = (/ .true., .true., .true., .true., .true., & + frc_from_dataset(: 18) = (/ .true., .true., .true., .true., .true., & .true., .true., .true., .true., .true., & .true., .true., .true., .true., .true., & .false., .false., .false. /) From 71fb83adfdb9be465f84a3b9661281a2f2e015c7 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 7 Feb 2022 08:58:18 -0700 Subject: [PATCH 016/160] Enable compilation in CESM 2.3 for non-GEOS-Chem case This commit includes: 1. Syntax bug fixes in perl file ChemNamelist.pm 2. Setting perl smartmatch to experimental in ChemNamelist.pm to avoid perl version dependent build error for use of '~~' (checks if item is in array) 3. Remove CAM imports lwtgcell, pwtgcell, and lai that are used for GEOS-Chem dry deposition velocity calculation. In a future update GEOS-Chem will no longer calculate dry deposition velocity when run in CESM so these imports are not needed. Signed-off-by: Lizzie Lundgren --- bld/perl5lib/Build/ChemNamelist.pm | 4 +++- src/control/camsrfexch.F90 | 31 +----------------------------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/bld/perl5lib/Build/ChemNamelist.pm b/bld/perl5lib/Build/ChemNamelist.pm index 5a9891faad..88d573afe1 100644 --- a/bld/perl5lib/Build/ChemNamelist.pm +++ b/bld/perl5lib/Build/ChemNamelist.pm @@ -1,5 +1,7 @@ package Build::ChemNamelist; +no if $] >= 5.017011, warnings => 'experimental::smartmatch'; + #------------------------------------------------------------------------------------- # generates species lists for chemistry namelist settings #------------------------------------------------------------------------------------- @@ -313,7 +315,7 @@ sub get_dep_list #------------------------------------------------------------------------------- sub filter_dep_list { - my ( $input_list, $print_lvl, @species_list_ref, $nottransported_list_ref ) = @_; + my ( $input_list, $print_lvl, $species_list_ref, $nottransported_list_ref ) = @_; if ($print_lvl>=2){ print "Filtering deposition species list \n"; } diff --git a/src/control/camsrfexch.F90 b/src/control/camsrfexch.F90 index c4fa59d797..f6dc1239fc 100644 --- a/src/control/camsrfexch.F90 +++ b/src/control/camsrfexch.F90 @@ -117,9 +117,6 @@ module camsrfexch real(r8), pointer, dimension(:) :: fv !friction velocity (m/s) (pcols) real(r8), pointer, dimension(:) :: soilw !volumetric soil water (m3/m3) real(r8), pointer, dimension(:,:) :: depvel ! deposition velocities - real(r8), pointer, dimension(:,:) :: lwtgcell ! landunit areas - real(r8), pointer, dimension(:,:) :: pwtgcell ! patch areas - real(r8), pointer, dimension(:,:) :: lai ! leaf area indices real(r8), pointer, dimension(:,:) :: dstflx ! dust fluxes real(r8), pointer, dimension(:,:) :: meganflx ! MEGAN fluxes real(r8), pointer, dimension(:,:) :: fireflx ! wild fire emissions @@ -135,7 +132,7 @@ subroutine hub2atm_alloc( cam_in ) ! Allocate space for the surface to atmosphere data type. And initialize ! the values. - use seq_drydep_mod, only: lnd_drydep, n_drydep, NLUse, NPatch + use seq_drydep_mod, only: lnd_drydep, n_drydep use shr_megan_mod, only: shr_megan_mechcomps_n use shr_fire_emis_mod,only: shr_fire_emis_mechcomps_n @@ -160,9 +157,6 @@ subroutine hub2atm_alloc( cam_in ) nullify(cam_in(c)%fv) nullify(cam_in(c)%soilw) nullify(cam_in(c)%depvel) - nullify(cam_in(c)%lwtgcell) - nullify(cam_in(c)%pwtgcell) - nullify(cam_in(c)%lai) nullify(cam_in(c)%dstflx) nullify(cam_in(c)%meganflx) nullify(cam_in(c)%fireflx) @@ -196,12 +190,6 @@ subroutine hub2atm_alloc( cam_in ) do c = begchunk,endchunk allocate (cam_in(c)%depvel(pcols,n_drydep), stat=ierror) if ( ierror /= 0 ) call endrun(sub//': allocation error depvel') - allocate (cam_in(c)%lwtgcell(pcols,NLUse), stat=ierror) - if ( ierror /= 0 ) call endrun(sub//': allocation error lwtgcell') - allocate (cam_in(c)%pwtgcell(pcols,NPatch), stat=ierror) - if ( ierror /= 0 ) call endrun(sub//': allocation error pwtgcell') - allocate (cam_in(c)%lai(pcols,NPatch), stat=ierror) - if ( ierror /= 0 ) call endrun(sub//': allocation error lai') end do endif @@ -258,11 +246,6 @@ subroutine hub2atm_alloc( cam_in ) if (lnd_drydep .and. n_drydep>0) then cam_in(c)%depvel (:,:) = 0._r8 endif - if (lnd_drydep) then - cam_in(c)%lwtgcell (:,:) = 0._r8 - cam_in(c)%pwtgcell (:,:) = 0._r8 - cam_in(c)%lai (:,:) = 0._r8 - endif if (active_Fall_flxfire .and. shr_fire_emis_mechcomps_n>0) then cam_in(c)%fireflx(:,:) = 0._r8 cam_in(c)%fireztop(:) = 0._r8 @@ -401,18 +384,6 @@ subroutine hub2atm_deallocate(cam_in) deallocate(cam_in(c)%depvel) nullify(cam_in(c)%depvel) end if - if(associated(cam_in(c)%lwtgcell)) then - deallocate(cam_in(c)%lwtgcell) - nullify(cam_in(c)%lwtgcell) - end if - if(associated(cam_in(c)%pwtgcell)) then - deallocate(cam_in(c)%pwtgcell) - nullify(cam_in(c)%pwtgcell) - end if - if(associated(cam_in(c)%lai)) then - deallocate(cam_in(c)%lai) - nullify(cam_in(c)%lai) - end if enddo From 9f80b02058fb11a4ddbd5379dc66a39909a51278 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 10 Feb 2022 12:50:27 -0700 Subject: [PATCH 017/160] Build fixes for CESM-GC within CESM: non-GEOS-Chem cases Signed-off-by: Lizzie Lundgren --- bld/config_files/definition.xml | 2 +- cime_config/buildcpp | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/bld/config_files/definition.xml b/bld/config_files/definition.xml index 08603ff741..a95c9d755e 100644 --- a/bld/config_files/definition.xml +++ b/bld/config_files/definition.xml @@ -98,7 +98,7 @@ meteor_smoke (Meteor Smoke), mixed_sulfate (Meteor Smoke and Sulfate), pmc (Pola sulfate (Sulfate Aerosols), tholin (early earth haze), test_detrain (Detrainment), test_growth (Particle Growth), test_passive (Passive Dust), test_radiative (Radiatively Active Dust), test_swelling (Sea Salt), test_tracers (Asian Monsoon), test_tracers2 (Guam). - + Chemistry package: trop_mam3 trop_mam4 trop_mam5 trop_mam7 trop_mozart trop_strat_mam4_ts2 trop_strat_mam4_vbs trop_strat_mam4_vbsext waccm_ma waccm_mad waccm_mad_mam4 waccm_ma_mam4 waccm_ma_sulfur waccm_sc waccm_sc_mam4 waccm_tsmlt_mam4 waccm_tsmlt_mam5 terminator GEOS-Chem none diff --git a/cime_config/buildcpp b/cime_config/buildcpp index d42f2ca70f..83b0548703 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -41,7 +41,6 @@ def buildcpp(case): nthrds_atm = case.get_value("NTHRDS_ATM") cam_config_opts = case.get_value("CAM_CONFIG_OPTS") comp_interface=case.get_value("COMP_INTERFACE") - clm_config_opts = case.get_value("CLM_CONFIG_OPTS") # added for CESM-GC # level information for CAM is part of the atm grid name - and must be stripped out nlev = '' @@ -118,15 +117,6 @@ def buildcpp(case): else: config_opts += ["-ocn", comp_ocn] - # Added for CESM-GC - if '-chem geoschem' in cam_config_opts: - if 'clm4_0' in clm_config_opts: - config_opts += ["-clm_vers", "CLM4.0"] - elif 'clm4_5' in clm_config_opts: - config_opts += ["-clm_vers", "CLM4.5"] - elif 'clm5_0' in clm_config_opts: - config_opts += ["-clm_vers", "CLM5.0"] - # Add user options. config_opts += cam_config_opts.split(" ") From 60e537a2ba8e358f7c4c7c78f73a2132528439de Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 16 Feb 2022 09:59:47 -0700 Subject: [PATCH 018/160] Update GEOS-Chem interface code for compatibility with CESM 2.3 Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/cesmgc_emissions_mod.F90 | 8 ++++---- src/chemistry/geoschem/chemistry.F90 | 2 +- src/chemistry/geoschem/getLandTypes.F90 | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 index 5489b0f043..f231d8dd8c 100644 --- a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 @@ -273,12 +273,12 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS USE STRING_UTILS, ONLY : to_upper USE PHYSCONSTANTS, ONLY : PI - ! Data from CLM - USE CAM_CPL_INDICES, ONLY : index_x2a_Fall_flxvoc - ! Lightning emissions USE MO_LIGHTNING, ONLY : prod_NO + ! MEGAN emissions + USE SRF_FIELD_CHECK, ONLY : active_Fall_flxvoc + ! Fire emissions USE FIRE_EMISSIONS, ONLY : fire_emissions_srf USE FIRE_EMISSIONS, ONLY : fire_emissions_vrt @@ -531,7 +531,7 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS ! MEGAN emissions ... !----------------------------------------------------------------------- - IF ( index_x2a_Fall_flxvoc > 0 .AND. shr_megan_mechcomps_n > 0 ) THEN + IF ( active_Fall_flxvoc > 0 .AND. shr_megan_mechcomps_n > 0 ) THEN ! set MEGAN fluxes DO N = 1, shr_megan_mechcomps_n DO J = 1, nY diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index eda8b869a0..f5ba122309 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -2528,7 +2528,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Calculate RH (range 0-1, note still level 1 = TOA) relHum(:,:) = 0.0e+0_r8 - CALL QSat(state%t(:nY,:), state%pmid(:nY,:), satV, satQ) + CALL QSat(state%t(:nY,:), state%pmid(:nY,:), satV, satQ, state%NCOL,PVER) DO J = 1, nY DO L = 1, nZ relHum(J,L) = 0.622e+0_r8 * h2ovmr(J,L) / satQ(J,L) diff --git a/src/chemistry/geoschem/getLandTypes.F90 b/src/chemistry/geoschem/getLandTypes.F90 index 2a7ef31932..93e1030340 100644 --- a/src/chemistry/geoschem/getLandTypes.F90 +++ b/src/chemistry/geoschem/getLandTypes.F90 @@ -15,7 +15,6 @@ SUBROUTINE getLandTypes( cam_in, nY, State_Met ) ! USE camsrfexch, ONLY : cam_in_t USE State_Met_Mod, ONLY : MetState - USE seq_drydep_mod, ONLY : NPatch USE shr_kind_mod, ONLY : r8 => shr_kind_r8 USE PRECISION_MOD, ONLY : fp, f4 ! Flexible precision USE CMN_SIZE_Mod, ONLY : NSURFTYPE From a6c7cc649535968fbeee573d23e055c25d0918d2 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 4 Mar 2022 08:13:36 -0700 Subject: [PATCH 019/160] Fix bug in J-value diagnostic names for O3O1D Signed-off-by: Lizzie Lundgren --- bld/namelist_files/use_cases/hist_geoschem.xml | 2 +- bld/namelist_files/use_cases/sd_geoschem.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 9eac1a5be6..6c20797422 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -129,7 +129,7 @@ 'MEG_MTPO', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', 'DHNO3CHM', 'DH2O2CHM', 'DO3CHM', 'DCOCHM', 'AQ_SO2', 'GS_SO2', 'SO2_CLXF', 'MASS', 'ABSORB', - 'Jval_O3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', + 'JvalO3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a1', 'ncl_a2', 'ncl_a3', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa1_a1', 'soa2_a1', 'soa3_a1', 'soa4_a1', 'soa5_a1', 'soa1_a2', 'soa2_a2', 'soa3_a2', diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index e420cc20bb..ea50638364 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -154,7 +154,7 @@ 'MEG_MTPO', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', 'DHNO3CHM', 'DH2O2CHM', 'DO3CHM', 'DCOCHM', 'AQ_SO2', 'GS_SO2', 'SO2_CLXF', 'MASS', 'ABSORB', - 'Jval_O3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', + 'JvalO3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a1', 'ncl_a2', 'ncl_a3', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa1_a1', 'soa2_a1', 'soa3_a1', 'soa4_a1', 'soa5_a1', 'soa1_a2', 'soa2_a2', 'soa3_a2', From 035f27cecca38c1e46487f2821b6dae55dd4b6cc Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 7 Mar 2022 09:38:02 -0700 Subject: [PATCH 020/160] Remove remaining references to compset FSPCAMM_GC Signed-off-by: Lizzie Lundgren --- cime_config/config_compsets.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index e05944f99a..c9a9511796 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -513,14 +513,8 @@ - - - FSPCAMM_GC - 2000_CAM%SPCAMMGC_CLM50%SP_CICE%PRES_DOCN%DOM_RTM_SGLC_SWAV - - FC2000climo_GC 2000_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV From a002aff2955bfd55f7bad9e5dcd2ddcbc87b0f3d Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 11 Mar 2022 08:35:53 -0700 Subject: [PATCH 021/160] GEOS-Chem driver routine updates for compatibility with GEOS-Chem 13.3.4 --- src/chemistry/geoschem/chemistry.F90 | 138 ++++++++++----------------- 1 file changed, 51 insertions(+), 87 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index f5ba122309..20c2bb2abf 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -212,7 +212,6 @@ subroutine chem_register use State_Chm_Mod, only : Init_State_Chm, Cleanup_State_Chm use State_Chm_Mod, only : Ind_ use Input_Opt_Mod, only : Set_Input_Opt, Cleanup_Input_Opt - use CMN_SIZE_Mod, only : Init_CMN_SIZE use mo_sim_dat, only : set_sim_dat use mo_chem_utls, only : get_spc_ndx @@ -291,7 +290,6 @@ subroutine chem_register ! Options needed by Init_State_Chm IO%ITS_A_FULLCHEM_SIM = .True. IO%LLinoz = .True. - IO%LUCX = .True. IO%LPRT = .False. IO%N_Advect = nTracers DO I = 1, nTracers @@ -326,9 +324,6 @@ subroutine chem_register CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF - CALL Init_CMN_SIZE( Input_Opt = IO, & - RC = RC ) - IF ( RC /= GC_SUCCESS ) THEN ErrMsg = 'Error encountered within call to "Init_CMN_SIZE"!' CALL Error_Stop( ErrMsg, ThisLoc ) @@ -1002,7 +997,7 @@ subroutine chem_init(phys_state, pbuf2d) use Pressure_Mod, only : Accept_External_ApBp use Chemistry_Mod, only : Init_Chemistry use Ucx_Mod, only : Init_Ucx - use Strat_chem_Mod, only : Init_Strat_Chem + use Linear_Chem_Mod, only : Init_Linear_Chem use isorropiaII_Mod, only : Init_IsorropiaII use Input_Mod, only : Read_Input_File use Input_Mod, only : Validate_Directories @@ -1207,11 +1202,7 @@ subroutine chem_init(phys_state, pbuf2d) ! Define more variables for maxGrid maxGrid%MaxTropLev = nTrop maxGrid%MaxStratLev = nStrat - IF ( Input_Opt%LUCX ) THEN - maxGrid%MaxChemLev = maxGrid%MaxStratLev - ELSE - maxGrid%MaxChemLev = maxGrid%MaxTropLev - ENDIF + maxGrid%MaxChemLev = maxGrid%MaxStratLev DO I = BEGCHUNK, ENDCHUNK @@ -1244,11 +1235,7 @@ subroutine chem_init(phys_state, pbuf2d) State_Grid(I)%MaxStratLev = nStrat ! Set maximum number of levels in the chemistry grid - IF ( Input_Opt%LUCX ) THEN - State_Grid(I)%MaxChemLev = State_Grid(I)%MaxStratLev - ELSE - State_Grid(I)%MaxChemLev = State_Grid(I)%MaxTropLev - ENDIF + State_Grid(I)%MaxChemLev = State_Grid(I)%MaxStratLev ENDDO @@ -1617,23 +1604,22 @@ subroutine chem_init(phys_state, pbuf2d) ENDIF ENDIF - IF ( Input_Opt%LChem .AND. & - Input_Opt%LUCX ) THEN + IF ( Input_Opt%LChem ) THEN CALL Init_UCX( Input_Opt = Input_Opt, & State_Chm = State_Chm(BEGCHUNK), & State_Diag = State_Diag(BEGCHUNK), & State_Grid = maxGrid ) ENDIF - IF ( Input_Opt%LSCHEM ) THEN - CALL Init_Strat_Chem( Input_Opt = Input_Opt, & - State_Chm = State_Chm(BEGCHUNK), & - State_Met = State_Met(BEGCHUNK), & - State_Grid = maxGrid, & - RC = RC ) + IF ( Input_Opt%Linear_Chem ) THEN + CALL Init_Linear_Chem( Input_Opt = Input_Opt, & + State_Chm = State_Chm(BEGCHUNK), & + State_Met = State_Met(BEGCHUNK), & + State_Grid = maxGrid, & + RC = RC ) IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Init_Strat_Chem"!' + ErrMsg = 'Error encountered in "Init_Linear_Chem"!' CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF ENDIF @@ -1877,13 +1863,13 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use PBL_Mix_Mod, only : Compute_PBL_Height use UCX_Mod, only : Set_H2O_Trac use CMN_FJX_MOD, only : ZPJ - use FAST_JX_MOD, only : RXN_NO2, RXN_O3_1, RXN_O3_2a + use FAST_JX_MOD, only : RXN_NO2, RXN_O3_1 use State_Diag_Mod, only : get_TagInfo use Unitconv_Mod, only : Convert_Spc_Units use State_Chm_Mod, only : Ind_ - use Strat_Chem_Mod, only : Strat_TrID_GC, GC_Bry_TrID, NSCHEM - use Strat_Chem_Mod, only : BrPtrDay, BrPtrNight, PLVEC, STRAT_OH + use Linear_Chem_Mod, only : TrID_GC, GC_Bry_TrID, NSCHEM + use Linear_Chem_Mod, only : BrPtrDay, BrPtrNight, PLVEC, GMI_OH use CESMGC_Emissions_Mod,only : CESMGC_Emissions_Calc use CESMGC_Diag_Mod, only : CESMGC_Diag_Calc @@ -3178,15 +3164,14 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF ! SDE 05/28/13: Set H2O to State_Chm tracer if relevant and, - ! if LUCX=T and LSETH2O=F and LACTIVEH2O=T, update specific humidity + ! if LSETH2O=F and LACTIVEH2O=T, update specific humidity ! in the stratosphere ! ! NOTE: Specific humidity may change in SET_H2O_TRAC and ! therefore this routine may call AIRQNT again to update ! air quantities and tracer concentrations (ewl, 10/28/15) IF ( Input_Opt%Its_A_Fullchem_Sim .and. iH2O > 0 ) THEN - CALL Set_H2O_Trac( SETSTRAT = ( ( .not. Input_Opt%LUCX ) & - .or. Input_Opt%LSETH2O ), & + CALL Set_H2O_Trac( SETSTRAT = Input_Opt%LSETH2O, & Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & State_Grid = State_Grid(LCHNK), & @@ -3263,7 +3248,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Dimensions : nX, nY State_Met(LCHNK)%TO3 (1,:nY) = O3col(:nY) - IF ( Input_Opt%LSCHEM .AND. & + IF ( Input_Opt%Linear_Chem .AND. & State_Grid(LCHNK)%MaxChemLev /= State_Grid(LCHNK)%nZ ) THEN IF ( iStep == 1 ) THEN ALLOCATE( BrPtrDay ( 6 ), STAT=IERR ) @@ -3320,7 +3305,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) DO N = 1,NSCHEM ! Get GEOS-Chem species index - M = Strat_TrID_GC(N) + M = TrID_GC(N) ! Skip if species is not defined IF ( M <= 0 ) CYCLE @@ -3333,11 +3318,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! --------------------------------------------------------------- ! Production rates [v/v/s] - IF ( Input_Opt%LUCX ) THEN - FieldName = 'GMI_PROD_'//TRIM(SpcName) - ELSE - FieldName = 'UCX_PROD_'//TRIM(SpcName) - ENDIF + FieldName = 'GMI_PROD_'//TRIM(SpcName) ALLOCATE( PLVEC(N)%PROD(1,PCOLS,nZ), STAT=IERR ) IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating PLVEC%PROD') @@ -3369,11 +3350,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF ! Loss frequency [s-1] - IF ( Input_Opt%LUCX ) THEN - FieldName = 'GMI_LOSS_'//TRIM(SpcName) - ELSE - FieldName = 'UCX_LOSS_'//TRIM(SpcName) - ENDIF + FieldName = 'GMI_LOSS_'//TRIM(SpcName) ! Get pointer from HEMCO tmpIdx = pbuf_get_index(FieldName, RC) @@ -3401,19 +3378,19 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDDO !N - ! Get pointer to STRAT_OH + ! Get pointer to GMI_OH - ALLOCATE( STRAT_OH(1,PCOLS,nZ), STAT=IERR ) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating STRAT_OH') + ALLOCATE( GMI_OH(1,PCOLS,nZ), STAT=IERR ) + IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating GMI_OH') tmpIdx = pbuf_get_index(FieldName, RC) IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) - STRAT_OH(1,:nY,nZ:1:-1) = 0.0e+0_f4 + GMI_OH(1,:nY,nZ:1:-1) = 0.0e+0_f4 ELSE pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) - STRAT_OH(1,:nY,nZ:1:-1) = REAL(pbuf_ik(:nY,:nZ), f4) + GMI_OH(1,:nY,nZ:1:-1) = REAL(pbuf_ik(:nY,:nZ), f4) pbuf_chnk => NULL() pbuf_ik => NULL() ENDIF @@ -3749,7 +3726,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF IF ( Input_Opt%Its_A_Fullchem_Sim .and. iH2O > 0 ) THEN - CALL Set_H2O_Trac( SETSTRAT = (.not. Input_Opt%LUCX), & + CALL Set_H2O_Trac( SETSTRAT = .False. , & Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & State_Grid = State_Grid(LCHNK), & @@ -3853,13 +3830,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) - IF ( Input_Opt%LUCX ) THEN - ! RXN_O3_1: O3 + hv --> O2 + O - pbuf_i(:nY) = ZPJ(1,RXN_O3_1,1,:nY) - ELSE - ! RXN_O3_2a: O3 + hv --> 2OH - pbuf_i(:nY) = ZPJ(1,RXN_O3_2a,1,:nY) - ENDIF + ! RXN_O3_1: O3 + hv --> O2 + O + pbuf_i(:nY) = ZPJ(1,RXN_O3_1,1,:nY) pbuf_chnk => NULL() pbuf_i => NULL() ENDIF @@ -4259,31 +4231,29 @@ end subroutine chem_init_cnst subroutine chem_final - use Input_Opt_Mod, only : Cleanup_Input_Opt - use State_Chm_Mod, only : Cleanup_State_Chm - use State_Diag_Mod, only : Cleanup_State_Diag - use State_Grid_Mod, only : Cleanup_State_Grid - use State_Met_Mod, only : Cleanup_State_Met - use Error_Mod, only : Cleanup_Error - - use FlexChem_Mod, only : Cleanup_FlexChem - use UCX_Mod, only : Cleanup_UCX - use Drydep_Mod, only : Cleanup_Drydep - use Carbon_Mod, only : Cleanup_Carbon - use Dust_Mod, only : Cleanup_Dust - use Seasalt_Mod, only : Cleanup_Seasalt - use Aerosol_Mod, only : Cleanup_Aerosol - use Sulfate_Mod, only : Cleanup_Sulfate - use Pressure_Mod, only : Cleanup_Pressure - use Strat_Chem_Mod, only : Cleanup_Strat_Chem - - use CMN_Size_Mod, only : Cleanup_CMN_Size - use CMN_FJX_Mod, only : Cleanup_CMN_FJX + use Input_Opt_Mod, only : Cleanup_Input_Opt + use State_Chm_Mod, only : Cleanup_State_Chm + use State_Diag_Mod, only : Cleanup_State_Diag + use State_Grid_Mod, only : Cleanup_State_Grid + use State_Met_Mod, only : Cleanup_State_Met + use Error_Mod, only : Cleanup_Error + use Fullchem_Mod, only : Cleanup_FullChem + use UCX_Mod, only : Cleanup_UCX + use Drydep_Mod, only : Cleanup_Drydep + use Carbon_Mod, only : Cleanup_Carbon + use Dust_Mod, only : Cleanup_Dust + use Seasalt_Mod, only : Cleanup_Seasalt + use Aerosol_Mod, only : Cleanup_Aerosol + use Sulfate_Mod, only : Cleanup_Sulfate + use Pressure_Mod, only : Cleanup_Pressure + use Linear_Chem_Mod, only : Cleanup_Linear_Chem + + use CMN_FJX_Mod, only : Cleanup_CMN_FJX #ifdef BPCH_DIAG - use CMN_O3_Mod, only : Cleanup_CMN_O3 + use CMN_O3_Mod, only : Cleanup_CMN_O3 ! Special: cleans up after NDXX_Setup - use Diag_Mod, only : Cleanup_Diag + use Diag_Mod, only : Cleanup_Diag #endif use CESMGC_Emissions_Mod, only: CESMGC_Emissions_Final @@ -4298,25 +4268,19 @@ subroutine chem_final CALL Cleanup_Carbon CALL Cleanup_Drydep CALL Cleanup_Dust - CALL Cleanup_FlexChem( RC ) + CALL Cleanup_FullChem( RC ) IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Cleanup_FlexChem"!' + ErrMsg = 'Error encountered in "Cleanup_FullChem"!' CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF CALL Cleanup_Pressure CALL Cleanup_Seasalt CALL Cleanup_Sulfate - CALL Cleanup_Strat_Chem + CALL Cleanup_Linear_Chem CALL CESMGC_Emissions_Final - CALL Cleanup_CMN_SIZE( RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Cleanup_CMN_SIZE"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - CALL Cleanup_CMN_FJX( RC ) IF ( RC /= GC_SUCCESS ) THEN ErrMsg = 'Error encountered in "Cleanup_CMN_FJX"!' From 6fd974497839ffee00064929dbbc0f06f6e2727d Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 31 Mar 2022 11:35:49 -0600 Subject: [PATCH 022/160] Modifications for new GEOS-Chem species (HMS) in version 13.3 - Added HMS to solsym array and increased length by 1 - Add HMS molecular wt to adv_mass array and increased length by 1 - Increased parameter nTracersMax by 1 - Increased bld/configure variables chem_nadv by 1 Signed-off-by: Lizzie Lundgren --- bld/configure | 2 +- src/chemistry/geoschem/chem_mods.F90 | 2 +- src/chemistry/geoschem/mo_sim_dat.F90 | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bld/configure b/bld/configure index ea0e9abd62..7191dbe272 100755 --- a/bld/configure +++ b/bld/configure @@ -1404,7 +1404,7 @@ if ($chem_pkg =~ '_mam3') { # TMMF - wedge in GEOS-Chem CPP definitions here if ($chem_pkg =~ 'geoschem') { $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING -DLINUX_IFORT -DUSE_REAL8 -DMODEL_ -DMODEL_CESM'; - $chem_nadv = 251; + $chem_nadv = 252; if (defined $opts{'clm_vers'}) { if ($opts{'clm_vers'} =~ 'CLM4.0') { $chem_cppdefs .= ' -DCLM40' diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index 08733b6d85..b2f25b4e4d 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -7,7 +7,7 @@ module chem_mods implicit none save - INTEGER, PARAMETER :: nTracersMax = 251 ! Must be equal to chem_nadv + INTEGER, PARAMETER :: nTracersMax = 252 ! Must be equal to chem_nadv INTEGER :: nTracers CHARACTER(LEN=255) :: tracerNames(nTracersMax) CHARACTER(LEN=255) :: tracerLongNames(nTracersMax) diff --git a/src/chemistry/geoschem/mo_sim_dat.F90 b/src/chemistry/geoschem/mo_sim_dat.F90 index 46c344415b..82fedbda54 100644 --- a/src/chemistry/geoschem/mo_sim_dat.F90 +++ b/src/chemistry/geoschem/mo_sim_dat.F90 @@ -40,7 +40,8 @@ subroutine set_sim_dat ! aerosols, as those will be constituents. MAM requires that there ! is a linear mapping between solsym and constituents - solsym(:331) = (/ 'ACET ','ACTA ','AERI ', & + ! ewl notes: added HMS (for GEOS-Chem 13.3) + solsym(:332) = (/ 'ACET ','ACTA ','AERI ', & 'ALD2 ','ALK4 ','ASOA1 ', & 'ASOA2 ','ASOA3 ','ASOAN ', & 'ASOG1 ','ASOG2 ','ASOG3 ', & @@ -67,7 +68,7 @@ subroutine set_sim_dat 'HBR ','HC5A ','HCFC123 ', & 'HCFC141B ','HCFC142B ','HCFC22 ', & 'HCL ','HCOOH ','HI ', & - 'HMHP ','HMML ','HNO2 ', & + 'HMHP ','HMML ','HMS ', 'HNO2 ', & 'HNO3 ','HNO4 ','HOBR ', & 'HOCL ','HOI ','HONIT ', & 'HPALD1 ','HPALD2 ','HPALD3 ', & @@ -158,7 +159,7 @@ subroutine set_sim_dat fix_mass(: 6) = (/ 0.00000000_r8, 28.0134800_r8, 31.9988000_r8, 2.020000_r8, 32.050000_r8, & 74.090000_r8 /) - adv_mass(:331) = (/ 58.090000_r8, 60.060000_r8, 126.900000_r8, 44.060000_r8, 58.120000_r8, & + adv_mass(:332) = (/ 58.090000_r8, 60.060000_r8, 126.900000_r8, 44.060000_r8, 58.120000_r8, & 150.000000_r8, 150.000000_r8, 150.000000_r8, 150.000000_r8, 150.000000_r8, & 150.00000_r8, 150.000000_r8, 90.0900000_r8, 12.010000_r8, 12.010000_r8, & 78.120000_r8, 79.900000_r8, 159.800000_r8, 115.450000_r8, 125.910000_r8, & @@ -174,7 +175,7 @@ subroutine set_sim_dat 165.360000_r8, 148.910000_r8, 259.820000_r8, 18.020000_r8, 34.020000_r8, & 74.080000_r8, 80.910000_r8, 100.130000_r8, 152.930000_r8, 116.940000_r8, & 100.500000_r8, 86.470000_r8, 36.450000_r8, 46.030000_r8, 127.910000_r8, & - 64.050000_r8, 102.100000_r8, 47.010000_r8, 63.010000_r8, 79.010000_r8, & + 64.050000_r8, 102.100000_r8, 110.000000_r8, 47.010000_r8, 63.010000_r8, 79.010000_r8, & 96.910000_r8, 52.450000_r8, 143.890000_r8, 215.000000_r8, 116.130000_r8, & 116.130000_r8, 116.130000_r8, 116.130000_r8, 76.060000_r8, 126.900000_r8, & 253.800000_r8, 285.800000_r8, 301.800000_r8, 317.800000_r8, 206.900000_r8, & From 596c261d3375aa6d939475787462cff9bbc2c390 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 31 Mar 2022 11:36:28 -0600 Subject: [PATCH 023/160] Use ESCOMP/HEMCO_CESM rather than H. Lin's fork Signed-off-by: Lizzie Lundgren --- Externals_CAM.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 5091e191c0..228425040b 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -72,8 +72,8 @@ required = True [hemco] local_path = src/hemco protocol = git -branch = development -repo_url = https://github.com/jimmielin/HEMCO_CESM.git +branch = master +repo_url = https://github.com/ESCOMP/HEMCO_CESM.git required = True externals = Externals_HCO.cfg From 425bb4996dd430f45343ced4222220509ac96f74 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 31 Mar 2022 11:40:53 -0600 Subject: [PATCH 024/160] Change GEOS-Chem branch name to diverge from version used in CESM-GC 2.1 CESM-GC using CESM 2.1 used GEOS-Chem 13.1. The GEOS-Chem version used in development for CESM 2.3 is 13.3. Signed-off-by: Lizzie Lundgren --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 228425040b..dbab4284ca 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -65,7 +65,7 @@ required = True [geoschem] local_path = src/chemistry/geoschem/geoschem_src protocol = git -branch = CESM +branch = feature/cesm_2.3 repo_url = https://github.com/CESM-GC/geos-chem required = True From eb70ed3a4e2e9b4deab0f4bbfc5beb33487269a2 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 31 Mar 2022 11:54:41 -0600 Subject: [PATCH 025/160] Set default namelist values for cam_physics_mesh in geos-chem use cases Signed-off-by: Lizzie Lundgren --- bld/namelist_files/use_cases/2000_geoschem.xml | 5 +++++ bld/namelist_files/use_cases/2010_geoschem.xml | 5 +++++ bld/namelist_files/use_cases/geoschem_baro_moist.xml | 5 +++++ bld/namelist_files/use_cases/hist_geoschem.xml | 5 +++++ bld/namelist_files/use_cases/sd_geoschem.xml | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index 2b7264fc61..5c8cb2a45e 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -9,6 +9,11 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + +/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' + +/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' + 'ISOP = isoprene', diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index 6d10dd02df..8d37e9c9b9 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -10,6 +10,11 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + +/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' + +/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' + 'ISOP = isoprene', diff --git a/bld/namelist_files/use_cases/geoschem_baro_moist.xml b/bld/namelist_files/use_cases/geoschem_baro_moist.xml index da938fe300..51c3427f82 100644 --- a/bld/namelist_files/use_cases/geoschem_baro_moist.xml +++ b/bld/namelist_files/use_cases/geoschem_baro_moist.xml @@ -7,6 +7,11 @@ .false. + +/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' + +/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' + 0,-6 diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 6c20797422..5d446229f6 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -10,6 +10,11 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + +/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' + +/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' + 'ISOP = isoprene', diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index ea50638364..dd613f7619 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -14,6 +14,11 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f19_f19_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc atm/cam/met/MERRA2/1.9x2.5/fv_1.9x2.5_nc3000_Nsw084_Nrs016_Co120_Fi001_ZR_GRNL_MERRA2_c190617.nc + +/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' + +/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' + 'ISOP = isoprene', From 1778e5d0cb4b7f9b1d317f4396be6db1daae9dec Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 27 Apr 2022 14:30:18 -0600 Subject: [PATCH 026/160] Bug fix: increase module parameter gas_pcnst by 1 to include HMS This is necessary after upgrading the GEOS-Chem version since HMS is a newly added advected gas species. Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chem_mods.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index b2f25b4e4d..1c3ad941e3 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -61,7 +61,7 @@ module chem_mods rxntot = 212, & ! number of total reactions gascnt = 172, & ! number of gas phase reactions nabscol = 2, & ! number of absorbing column densities - gas_pcnst = 331, & ! number of "gas phase" species + gas_pcnst = 332, & ! number of "gas phase" species nfs = 6, & ! number of "fixed" species relcnt = 0, & ! number of relationship species grpcnt = 0, & ! number of group members From 0a782b962321c737660d07dec430207ff297fc41 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 24 Jun 2022 12:02:21 -0600 Subject: [PATCH 027/160] Modifications to turn off dry deposition and dependencies on CLM for land --- .../use_cases/hist_geoschem.xml | 7 + src/chemistry/geoschem/chemistry.F90 | 291 +++++++++--------- src/physics/cam/physpkg.F90 | 33 +- 3 files changed, 176 insertions(+), 155 deletions(-) diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 5d446229f6..2c6e7842bb 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -79,6 +79,8 @@ 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', + + + + 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 20c2bb2abf..292724dc51 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -165,11 +165,12 @@ module chemistry CHARACTER(LEN=255) :: ThisLoc CHARACTER(LEN=255) :: ErrMsg - ! Filenames to compute dry deposition velocities similarly to MOZART - character(len=shr_kind_cl) :: clim_soilw_file = 'clim_soilw_file' - character(len=shr_kind_cl) :: depvel_file = '' - character(len=shr_kind_cl) :: depvel_lnd_file = 'depvel_lnd_file' - character(len=shr_kind_cl) :: season_wes_file = 'season_wes_file' +! ewl: comment out defining files used only for dry deposition +! ! Filenames to compute dry deposition velocities similarly to MOZART +! character(len=shr_kind_cl) :: clim_soilw_file = 'clim_soilw_file' +! character(len=shr_kind_cl) :: depvel_file = '' +! character(len=shr_kind_cl) :: depvel_lnd_file = 'depvel_lnd_file' +! character(len=shr_kind_cl) :: season_wes_file = 'season_wes_file' character(len=shr_kind_cl) :: srf_emis_specifier(pcnst) = '' character(len=shr_kind_cl) :: ext_frc_specifier(pcnst) = '' @@ -689,18 +690,16 @@ subroutine chem_readnl(nlfile) LOGICAL :: menuFound LOGICAL :: validSLS +! ewl: remove 4 entries from chem_inparm used for dry deposition: +! clim_soilw_file, depvel_file, depvel_lnd_file, season_wes_file ! The following files are required to compute land maps, required to perform ! aerosol dry deposition - namelist /chem_inparm/ clim_soilw_file, & - depvel_file, & - lght_no_prd_factor, & - depvel_lnd_file, & + namelist /chem_inparm/ lght_no_prd_factor, & ext_frc_specifier, & ext_frc_type, & ext_frc_cycle_yr, & ext_frc_fixed_ymd, & ext_frc_fixed_tod, & - season_wes_file, & srf_emis_specifier, & srf_emis_cycle_yr, & srf_emis_fixed_ymd, & @@ -868,14 +867,15 @@ subroutine chem_readnl(nlfile) ! Broadcast namelist variables +! ewl: remove broadcast of 4 files used for dry deposition only ! The following files are required to compute land maps, required to perform ! aerosol dry deposition - CALL MPIBCAST (depvel_lnd_file, LEN(depvel_lnd_file), MPICHAR, 0, MPICOM) - CALL MPIBCAST (clim_soilw_file, LEN(clim_soilw_file), MPICHAR, 0, MPICOM) - CALL MPIBCAST (season_wes_file, LEN(season_wes_file), MPICHAR, 0, MPICOM) +! CALL MPIBCAST (depvel_lnd_file, LEN(depvel_lnd_file), MPICHAR, 0, MPICOM) +! CALL MPIBCAST (clim_soilw_file, LEN(clim_soilw_file), MPICHAR, 0, MPICOM) +! CALL MPIBCAST (season_wes_file, LEN(season_wes_file), MPICHAR, 0, MPICOM) CALL MPIBCAST (lght_no_prd_factor, 1, MPIR8, 0, MPICOM) - CALL MPIBCAST (depvel_file, LEN(depvel_file), MPICHAR, 0, MPICOM) +! CALL MPIBCAST (depvel_file, LEN(depvel_file), MPICHAR, 0, MPICOM) CALL MPIBCAST (srf_emis_specifier, LEN(srf_emis_specifier(1))*pcnst, MPICHAR, 0, MPICOM) CALL MPIBCAST (srf_emis_type, LEN(srf_emis_type), MPICHAR, 0, MPICOM) CALL MPIBCAST (srf_emis_cycle_yr, 1, MPIINT, 0, MPICOM) @@ -1165,13 +1165,15 @@ subroutine chem_init(phys_state, pbuf2d) ! -> False (read monthly-mean albedo from HEMCO) Input_Opt%onlineAlbedo = .False. +! ewl: Change using online land types from true to false ! onlineLandTypes -> True (use CLM landtypes) ! -> False (read landtypes from HEMCO) - Input_Opt%onlineLandTypes = .True. + Input_Opt%onlineLandTypes = .False. +! ewl: Change using CLM dry dep velocities from false to true ! ddVel_CLM -> True (use CLM dry deposition velocities) ! -> False (let GEOS-Chem compute dry deposition velocities) - Input_Opt%ddVel_CLM = .False. + Input_Opt%ddVel_CLM = .True. ! applyQtend: apply tendencies of water vapor to specific humidity Input_Opt%applyQtend = .False. @@ -1495,16 +1497,17 @@ subroutine chem_init(phys_state, pbuf2d) ! Initialize aerosols CALL aero_model_init( pbuf2d ) - ! Initialize land maps for aerosol dry deposition - IF ( drydep_method == DD_XATM .OR. drydep_method == DD_XLND ) THEN - CALL drydep_inti( depvel_lnd_file, & - clim_soilw_file, & - season_wes_file ) - ELSE - IF ( masterProc ) Write(iulog,'(a,a)') ' drydep_method is set to: ', TRIM(drydep_method) - CALL ENDRUN('drydep_method must be DD_XLND or DD_XATM to compute land '// & - 'maps for aerosol dry deposition!') - ENDIF +! ewl: Comment out initializing land maps for aerosol dry deposition. +! ! Initialize land maps for aerosol dry deposition +! IF ( drydep_method == DD_XATM .OR. drydep_method == DD_XLND ) THEN +! CALL drydep_inti( depvel_lnd_file, & +! clim_soilw_file, & +! season_wes_file ) +! ELSE +! IF ( masterProc ) Write(iulog,'(a,a)') ' drydep_method is set to: ', TRIM(drydep_method) +! CALL ENDRUN('drydep_method must be DD_XLND or DD_XATM to compute land '// & +! 'maps for aerosol dry deposition!') +! ENDIF #endif IF ( gas_wetdep_method == 'NEU' ) THEN @@ -2625,73 +2628,78 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) State_Met(LCHNK)%EFLUX (1,:nY) = cam_in%Lhf(:nY) State_Met(LCHNK)%HFLUX (1,:nY) = cam_in%Shf(:nY) - ! Field : LandTypeFrac - ! Description: Olson fraction per type - ! Unit : - (between 0 and 1) - ! Dimensions : nX, nY, NSURFTYPE - ! Note : Index 1 is water - IF ( Input_Opt%onlineLandTypes ) THEN - ! Fill in water - State_Met(LCHNK)%LandTypeFrac(1,:nY,1) = cam_in%ocnFrac(:nY) & - + cam_in%iceFrac(:nY) - IF ( .NOT. Input_Opt%ddVel_CLM ) THEN - CALL getLandTypes( cam_in, & - nY, & - State_Met(LCHNK) ) - ENDIF - ELSE - DO N = 1, NSURFTYPE - Write(FieldName, '(a,i2.2)') 'HCO_LANDTYPE', N-1 - tmpIdx = pbuf_get_index(FieldName, rc) - IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) - ELSE - CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) - DO J = 1, nY - State_Met(LCHNK)%LandTypeFrac(1,J,N) = pbuf_i(J) - ENDDO - pbuf_i => NULL() - ENDIF - - Write(FieldName, '(a,i2.2)') 'HCO_XLAI', N-1 - tmpIdx = pbuf_get_index(FieldName, rc) - IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) - ELSE - CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) - DO J = 1, nY - State_Met(LCHNK)%XLAI_NATIVE(1,J,N) = pbuf_i(J) - ENDDO - pbuf_i => NULL() - ENDIF - ENDDO - ENDIF - - ! Field : FRCLND, FRLAND, FROCEAN, FRSEAICE, FRLAKE, FRLANDIC - ! Description: Olson land fraction - ! Fraction of land - ! Fraction of ocean - ! Fraction of sea ice - ! Fraction of lake - ! Fraction of land ice - ! Fraction of snow - ! Unit : - - ! Dimensions : nX, nY - State_Met(LCHNK)%FRCLND (1,:ny) = 1.e+0_fp - & - State_Met(LCHNK)%LandTypeFrac(1,:nY,1) ! Olson Land Fraction - State_Met(LCHNK)%FRLAND (1,:nY) = cam_in%landFrac(:nY) - State_Met(LCHNK)%FROCEAN (1,:nY) = cam_in%ocnFrac(:nY) + cam_in%iceFrac(:nY) - State_Met(LCHNK)%FRSEAICE (1,:nY) = cam_in%iceFrac(:nY) - IF ( Input_Opt%onlineLandTypes ) THEN - State_Met(LCHNK)%FRLAKE (1,:nY) = cam_in%lwtgcell(:,3) + & - cam_in%lwtgcell(:,4) - State_Met(LCHNK)%FRLANDIC (1,:nY) = cam_in%lwtgcell(:,2) - State_Met(LCHNK)%FRSNO (1,:nY) = 0.0e+0_fp - ELSE - State_Met(LCHNK)%FRLAKE (1,:nY) = 0.0e+0_fp - State_Met(LCHNK)%FRLANDIC (1,:nY) = 0.0e+0_fp - State_Met(LCHNK)%FRSNO (1,:nY) = 0.0e+0_fp - ENDIF +! ewl: Comment out setting State_Met fields LandTypeFrac and XLAI_NATIVE. Note +! that onlineLandTypes is now false. +! ! Field : LandTypeFrac +! ! Description: Olson fraction per type +! ! Unit : - (between 0 and 1) +! ! Dimensions : nX, nY, NSURFTYPE +! ! Note : Index 1 is water +! IF ( Input_Opt%onlineLandTypes ) THEN +! ! Fill in water +! State_Met(LCHNK)%LandTypeFrac(1,:nY,1) = cam_in%ocnFrac(:nY) & +! + cam_in%iceFrac(:nY) +! IF ( .NOT. Input_Opt%ddVel_CLM ) THEN +! CALL getLandTypes( cam_in, & +! nY, & +! State_Met(LCHNK) ) +! ENDIF +! ELSE +! DO N = 1, NSURFTYPE +! Write(FieldName, '(a,i2.2)') 'HCO_LANDTYPE', N-1 +! tmpIdx = pbuf_get_index(FieldName, rc) +! IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN +! IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) +! ELSE +! CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) +! DO J = 1, nY +! State_Met(LCHNK)%LandTypeFrac(1,J,N) = pbuf_i(J) +! ENDDO +! pbuf_i => NULL() +! ENDIF +! +! Write(FieldName, '(a,i2.2)') 'HCO_XLAI', N-1 +! tmpIdx = pbuf_get_index(FieldName, rc) +! IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN +! IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) +! ELSE +! CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) +! DO J = 1, nY +! State_Met(LCHNK)%XLAI_NATIVE(1,J,N) = pbuf_i(J) +! ENDDO +! pbuf_i => NULL() +! ENDIF +! ENDDO +! ENDIF + +! ewl: Comment out setting State_Met fields FR* for CLND, LAND, OCEAN, +! SEAICE, LAKE, and LANDIC. If not getting land type from CLM need to +! figure out how to set these. +! ! Field : FRCLND, FRLAND, FROCEAN, FRSEAICE, FRLAKE, FRLANDIC +! ! Description: Olson land fraction +! ! Fraction of land +! ! Fraction of ocean +! ! Fraction of sea ice +! ! Fraction of lake +! ! Fraction of land ice +! ! Fraction of snow +! ! Unit : - +! ! Dimensions : nX, nY +! State_Met(LCHNK)%FRCLND (1,:ny) = 1.e+0_fp - & +! State_Met(LCHNK)%LandTypeFrac(1,:nY,1) ! Olson Land Fraction +! State_Met(LCHNK)%FRLAND (1,:nY) = cam_in%landFrac(:nY) +! State_Met(LCHNK)%FROCEAN (1,:nY) = cam_in%ocnFrac(:nY) + cam_in%iceFrac(:nY) +! State_Met(LCHNK)%FRSEAICE (1,:nY) = cam_in%iceFrac(:nY) +! IF ( Input_Opt%onlineLandTypes ) THEN +! State_Met(LCHNK)%FRLAKE (1,:nY) = cam_in%lwtgcell(:,3) + & +! cam_in%lwtgcell(:,4) +! State_Met(LCHNK)%FRLANDIC (1,:nY) = cam_in%lwtgcell(:,2) +! State_Met(LCHNK)%FRSNO (1,:nY) = 0.0e+0_fp +! ELSE +! State_Met(LCHNK)%FRLAKE (1,:nY) = 0.0e+0_fp +! State_Met(LCHNK)%FRLANDIC (1,:nY) = 0.0e+0_fp +! State_Met(LCHNK)%FRSNO (1,:nY) = 0.0e+0_fp +! ENDIF ! Field : GWETROOT, GWETTOP ! Description: Root and top soil moisture @@ -3188,45 +3196,48 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF (Input_Opt%LSETH2O) Input_Opt%LSETH2O = .FALSE. ENDIF +! ewl: Turn off over-writing isLand, isWater, and isIce with CLM land imports, +! and set isSnow to if SNODP > 0.01 (removes dependency on CLM land) ! Do this after AirQnt, such that we overwrite GEOS-Chem isLand, isWater and ! isIce, which are based on albedo. Rather, we use CLM landFranc, ocnFrac ! and iceFrac. We also compute isSnow DO J = 1, nY - iMaxLoc = MAXLOC( (/ State_Met(LCHNK)%FRLAND(1,J) + & - State_Met(LCHNK)%FRLANDIC(1,J) + & - State_Met(LCHNK)%FRLAKE(1,J), & - State_Met(LCHNK)%FRSEAICE(1,J), & - State_Met(LCHNK)%FROCEAN(1,J) - & - State_Met(LCHNK)%FRSEAICE(1,J) /) ) - IF ( iMaxLoc(1) == 3 ) iMaxLoc(1) = 0 - ! reset ocean to 0 - - ! Field : LWI - ! Description: Land/water indices - ! Unit : - - ! Dimensions : nX, nY - State_Met(LCHNK)%LWI(1,J) = FLOAT( iMaxLoc(1) ) - - IF ( iMaxLoc(1) == 0 ) THEN - State_Met(LCHNK)%isLand(1,J) = .False. - State_Met(LCHNK)%isWater(1,J) = .True. - State_Met(LCHNK)%isIce(1,J) = .False. - ELSEIF ( iMaxLoc(1) == 1 ) THEN - State_Met(LCHNK)%isLand(1,J) = .True. - State_Met(LCHNK)%isWater(1,J) = .False. - State_Met(LCHNK)%isIce(1,J) = .False. - ELSEIF ( iMaxLoc(1) == 2 ) THEN - State_Met(LCHNK)%isLand(1,J) = .False. - State_Met(LCHNK)%isWater(1,J) = .False. - State_Met(LCHNK)%isIce(1,J) = .True. - ELSE - Write(iulog,*) " iMaxLoc gets value: ", iMaxLoc - ErrMsg = 'Failed to figure out land/water' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - State_Met(LCHNK)%isSnow(1,J) = ( State_Met(LCHNK)%FRSEAICE(1,J) > 0.0e+0_fp & - .or. State_Met(LCHNK)%SNODP(1,J) > 0.01 ) +! iMaxLoc = MAXLOC( (/ State_Met(LCHNK)%FRLAND(1,J) + & +! State_Met(LCHNK)%FRLANDIC(1,J) + & +! State_Met(LCHNK)%FRLAKE(1,J), & +! State_Met(LCHNK)%FRSEAICE(1,J), & +! State_Met(LCHNK)%FROCEAN(1,J) - & +! State_Met(LCHNK)%FRSEAICE(1,J) /) ) +! IF ( iMaxLoc(1) == 3 ) iMaxLoc(1) = 0 +! ! reset ocean to 0 +! +! ! Field : LWI +! ! Description: Land/water indices +! ! Unit : - +! ! Dimensions : nX, nY +! State_Met(LCHNK)%LWI(1,J) = FLOAT( iMaxLoc(1) ) +! +! IF ( iMaxLoc(1) == 0 ) THEN +! State_Met(LCHNK)%isLand(1,J) = .False. +! State_Met(LCHNK)%isWater(1,J) = .True. +! State_Met(LCHNK)%isIce(1,J) = .False. +! ELSEIF ( iMaxLoc(1) == 1 ) THEN +! State_Met(LCHNK)%isLand(1,J) = .True. +! State_Met(LCHNK)%isWater(1,J) = .False. +! State_Met(LCHNK)%isIce(1,J) = .False. +! ELSEIF ( iMaxLoc(1) == 2 ) THEN +! State_Met(LCHNK)%isLand(1,J) = .False. +! State_Met(LCHNK)%isWater(1,J) = .False. +! State_Met(LCHNK)%isIce(1,J) = .True. +! ELSE +! Write(iulog,*) " iMaxLoc gets value: ", iMaxLoc +! ErrMsg = 'Failed to figure out land/water' +! CALL Error_Stop( ErrMsg, ThisLoc ) +! ENDIF +! +! State_Met(LCHNK)%isSnow(1,J) = ( State_Met(LCHNK)%FRSEAICE(1,J) > 0.0e+0_fp & +! .or. State_Met(LCHNK)%SNODP(1,J) > 0.01 ) + State_Met(LCHNK)%isSnow(1,J) = ( State_Met(LCHNK)%SNODP(1,J) > 0.01 ) ENDDO @@ -3640,17 +3651,19 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! (stored as SurfaceFlux = -dflx) !----------------------------------------------------------------------- - DO ND = 1, State_Chm(BEGCHUNK)%nDryDep - ! Get the species ID from the drydep ID - N = State_Chm(BEGCHUNK)%Map_DryDep(ND) - IF ( N <= 0 ) CYCLE - - M = map2GCinv(N) - IF ( M <= 0 ) CYCLE - - cam_in%cflx(1:nY,M) = cam_in%cflx(1:nY,M) & - + State_Chm(LCHNK)%SurfaceFlux(1,1:nY,N) - ENDDO + IF ( Input_Opt%LDryD ) THEN + DO ND = 1, State_Chm(BEGCHUNK)%nDryDep + ! Get the species ID from the drydep ID + N = State_Chm(BEGCHUNK)%Map_DryDep(ND) + IF ( N <= 0 ) CYCLE + + M = map2GCinv(N) + IF ( M <= 0 ) CYCLE + + cam_in%cflx(1:nY,M) = cam_in%cflx(1:nY,M) & + + State_Chm(LCHNK)%SurfaceFlux(1,1:nY,N) + ENDDO + ENDIF !----------------------------------------------------------------------- ! Add non-surface emissions diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index 0db55d6e64..6c3fa00523 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -1649,22 +1649,23 @@ subroutine tphysac (ztodt, cam_in, & ! aerosol dry deposition processes call t_startf('aero_drydep') - if (trim(cam_take_snapshot_before) == "aero_model_drydep") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call aero_model_drydep( state, pbuf, obklen, surfric, cam_in, ztodt, cam_out, ptend ) - if ( (trim(cam_take_snapshot_after) == "aero_model_drydep") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "aero_model_drydep") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if +! ewl: turn off aerosol dry deposition +! if (trim(cam_take_snapshot_before) == "aero_model_drydep") then +! call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& +! fh2o, surfric, obklen, flx_heat) +! end if +! +! call aero_model_drydep( state, pbuf, obklen, surfric, cam_in, ztodt, cam_out, ptend ) +! if ( (trim(cam_take_snapshot_after) == "aero_model_drydep") .and. & +! (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then +! call cam_snapshot_ptend_outfld(ptend, lchnk) +! end if +! call physics_update(state, ptend, ztodt, tend) +! +! if (trim(cam_take_snapshot_after) == "aero_model_drydep") then +! call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& +! fh2o, surfric, obklen, flx_heat) +! end if call t_stopf('aero_drydep') From 97f4a30fac1cb4933c40016d5d81ae0e18b70bb3 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 24 Jun 2022 12:02:51 -0600 Subject: [PATCH 028/160] Kludge to get by missing Henry's Law coeffs for certain species --- src/chemistry/geoschem/mo_neu_wetdep.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/chemistry/geoschem/mo_neu_wetdep.F90 b/src/chemistry/geoschem/mo_neu_wetdep.F90 index b70718015a..809df9ad86 100644 --- a/src/chemistry/geoschem/mo_neu_wetdep.F90 +++ b/src/chemistry/geoschem/mo_neu_wetdep.F90 @@ -169,8 +169,10 @@ subroutine neu_wetdep_init end if end do if ( mapping_to_heff(m) == -99 ) then - if (masterproc) print *,'problem with mapping_to_heff of ',trim(test_name) -! call endrun() +! ewl: kludge until I add new species to species table in seq_drydep_mod.F90 +! if (masterproc) print *,'problem with mapping_to_heff of ',trim(test_name) +!! call endrun() + mapping_to_heff(m) = 1 end if ! ! special cases for NH3 and CO2 From e9b8b27b8d7eec853f9aae530415636ff53e3c80 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 24 Jun 2022 12:16:36 -0600 Subject: [PATCH 029/160] Configure compsets that use GEOS-Chem to also use HEMCO --- bld/namelist_files/use_cases/hist_geoschem.xml | 8 +++++--- cime_config/config_component.xml | 9 ++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 2c6e7842bb..7ef75a9eff 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -79,7 +79,7 @@ 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', - + +'' + +'' + 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 9a3ec114a0..6d95460f67 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -129,17 +129,18 @@ -phys cam_dev -chem trop_strat_mam4_vbs - -chem geoschem_mam4 + -chem geoschem_mam4 -hemco -chem trop_mam7 -chem trop_strat_mam4_vbsext -chem trop_strat_mam4_ts2 + -chem geoschem -hemco -clubb_sgs -dyn eul -scam -rad camrt -chem none -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_sam1mom -rad camrt -chem none -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_sam1mom -spcam_clubb_sgs -rad rrtmg -chem trop_mam3 -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_m2005 - -rad rrtmg -chem geoschem_mam3 -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_m2005 + -rad rrtmg -chem geoschem_mam3 -hemco -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_m2005 -rad rrtmg -chem trop_mam3 -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_m2005 -spcam_clubb_sgs -chem trop_mozart @@ -175,9 +176,7 @@ -phys adiabatic -phys tj2016 -analytic_ic -phys held_suarez -analytic_ic - -chem geoschem - -chem geoschem_mam4 - -phys held_suarez -chem geoschem -analytic_ic + -phys held_suarez -chem geoschem -hemco -analytic_ic -phys kessler -chem terminator -analytic_ic -nadv_tt=6 From ae59e64449a8797cf65a77f2b29908e7034055ed Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 29 Jun 2022 13:06:45 -0600 Subject: [PATCH 030/160] Added high-level log prints Signed-off-by: Lizzie Lundgren --- src/cpl/nuopc/atm_comp_nuopc.F90 | 18 ++++++++++++++++++ src/physics/cam/physpkg.F90 | 25 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/cpl/nuopc/atm_comp_nuopc.F90 b/src/cpl/nuopc/atm_comp_nuopc.F90 index 0a69dffe5d..9e62c6c77a 100644 --- a/src/cpl/nuopc/atm_comp_nuopc.F90 +++ b/src/cpl/nuopc/atm_comp_nuopc.F90 @@ -614,6 +614,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) stop_ymd=stop_ymd, stop_tod=stop_tod, curr_ymd=curr_ymd, curr_tod=curr_tod, & cam_out=cam_out, cam_in=cam_in) + if ( masterproc) print *, "ewl: in atm_comp_nuopc.F90: after cam_init" + if (mediator_present) then if (single_column) then @@ -735,6 +737,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) end if ! end of mediator_present if-block + if ( masterproc) print *, "ewl: in atm_comp_nuopc.F90: after mediator_present block" + call shr_file_setLogUnit (shrlogunit) #if (defined _MEMTRACE) @@ -750,6 +754,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) end if + if ( masterproc) print *, "ewl: in atm_comp_nuopc.F90: end of InitializeRealize" + end subroutine InitializeRealize !=============================================================================== @@ -997,6 +1003,8 @@ subroutine ModelAdvance(gcomp, rc) rc = ESMF_SUCCESS + if ( masterproc) print *, "ewl: At start of ModelAdvance" + !$ call omp_set_num_threads(nthrds) call shr_file_getLogUnit (shrlogunit) @@ -1096,14 +1104,20 @@ subroutine ModelAdvance(gcomp, rc) ! Run CAM (run2, run3, run4) + if ( masterproc) print *, "ewl: In ModelAdvance: before cam_run2" + call t_startf ('CAM_run2') call cam_run2( cam_out, cam_in ) call t_stopf ('CAM_run2') + if ( masterproc) print *, "ewl: In ModelAdvance: before cam_run3" + call t_startf ('CAM_run3') call cam_run3( cam_out ) call t_stopf ('CAM_run3') + if ( masterproc) print *, "ewl: In ModelAdvance: before cam_run4" + call t_startf ('CAM_run4') call cam_run4( cam_out, cam_in, rstwr, nlend, & yr_spec=yr_sync, mon_spec=mon_sync, day_spec=day_sync, sec_spec=tod_sync) @@ -1111,12 +1125,16 @@ subroutine ModelAdvance(gcomp, rc) ! Advance cam time step + if ( masterproc) print *, "ewl: In ModelAdvance: advancing timestep" + call t_startf ('CAM_adv_timestep') call advance_timestep() call t_stopf ('CAM_adv_timestep') ! Run cam radiation/clouds (run1) + if ( masterproc) print *, "ewl: In ModelAdvance: before cam_run1" + call t_startf ('CAM_run1') call cam_run1 ( cam_in, cam_out ) call t_stopf ('CAM_run1') diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index 6c3fa00523..e5116ff470 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -1557,14 +1557,19 @@ subroutine tphysac (ztodt, cam_in, & !=================================================== if (chem_is_active()) then + if (masterproc) print *, "ewl: cam/physpkg.F90: before chemistry" + if (trim(cam_take_snapshot_before) == "chem_timestep_tend") then call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& fh2o, surfric, obklen, flx_heat) end if + if (masterproc) print *, "ewl: cam/physpkg.F90: before chem_timestep_tend" + call chem_timestep_tend(state, ptend, cam_in, cam_out, ztodt, & pbuf, fh2o=fh2o) + if (masterproc) print *, "ewl: cam/physpkg.F90: chem_timestep_tend complete" if ( (trim(cam_take_snapshot_after) == "chem_timestep_tend") .and. & (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then @@ -1587,6 +1592,8 @@ subroutine tphysac (ztodt, cam_in, & ! Call vertical diffusion code (pbl, free atmosphere and molecular) !=================================================== + if (masterproc) print *, "ewl: cam/physpkg.F90: before vertical diffusion" + call t_startf('vertical_diffusion_tend') if (trim(cam_take_snapshot_before) == "vertical_diffusion_section") then @@ -1600,6 +1607,9 @@ subroutine tphysac (ztodt, cam_in, & !------------------------------------------ ! Call major diffusion for extended model !------------------------------------------ + + if (masterproc) print *, "ewl: cam/physpkg.F90: before major diffusion" + if ( waccmx_is('ionosphere') .or. waccmx_is('neutral') ) then call waccmx_phys_mspd_tend (ztodt ,state ,ptend) endif @@ -1626,6 +1636,9 @@ subroutine tphysac (ztodt, cam_in, & !=================================================== ! Rayleigh friction calculation !=================================================== + + if (masterproc) print *, "ewl: cam/physpkg.F90: before rayleigh friction calculation" + call t_startf('rayleigh_friction') call rayleigh_friction_tend( ztodt, state, ptend) if ( ptend%lu ) then @@ -1649,6 +1662,8 @@ subroutine tphysac (ztodt, cam_in, & ! aerosol dry deposition processes call t_startf('aero_drydep') + if (masterproc) print *, "ewl: cam/physpkg.F90: before aerosol dry deposition processes...skipping!" + ! ewl: turn off aerosol dry deposition ! if (trim(cam_take_snapshot_before) == "aero_model_drydep") then ! call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& @@ -1677,6 +1692,9 @@ subroutine tphysac (ztodt, cam_in, & ! that cam_out%xxxdryxxx fields have already been set for CAM aerosols and cam_out ! can be added to for CARMA aerosols. if (carma_do_aerosol) then + + if (masterproc) print *, "ewl: cam/physpkg.F90: before carma microphysics" + call t_startf('carma_timestep_tend') call carma_timestep_tend(state, cam_in, cam_out, ptend, ztodt, pbuf, obklen=obklen, ustar=surfric) call physics_update(state, ptend, ztodt, tend) @@ -1689,6 +1707,8 @@ subroutine tphysac (ztodt, cam_in, & !--------------------------------------------------------------------------------- ! ... enforce charge neutrality !--------------------------------------------------------------------------------- + if (masterproc) print *, "ewl: cam/physpkg.F90: before enforcing charge neutrality" + call charge_balance(state, pbuf) !=================================================== @@ -1696,6 +1716,8 @@ subroutine tphysac (ztodt, cam_in, & !=================================================== call t_startf('gw_tend') + if (masterproc) print *, "ewl: cam/physpkg.F90: before gravity wave drag" + if (trim(cam_take_snapshot_before) == "gw_tend") then call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& fh2o, surfric, obklen, flx_heat) @@ -1781,6 +1803,9 @@ subroutine tphysac (ztodt, cam_in, & !---------------------------------------------------------------------------- ! Call ionosphere routines for extended model if mode is set to ionosphere !---------------------------------------------------------------------------- + + if (masterproc) print *, "ewl: cam/physpkg.F90: before ionosphere routines" + if( waccmx_is('ionosphere') ) then call waccmx_phys_ion_elec_temp_tend(state, ptend, pbuf, ztodt) endif From aae00e757b2a3bc00323d6e5b76b970735714b3d Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 30 Jun 2022 14:11:05 -0600 Subject: [PATCH 031/160] Use same RUN_STARTDATE for compset FCHIST_GC as used in FCHIST Signed-off-by: Lizzie Lundgren --- cime_config/config_compsets.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index c9a9511796..90f1596edd 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -548,6 +548,7 @@ 1980-01-01 1850-01-01 2010-01-01 + 2010-01-01 2013-01-01 1995-01-01 1995-01-01 From e27c049c54db0d6833b5035eaa3b87d00e2e77e3 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 30 Jun 2022 14:50:46 -0600 Subject: [PATCH 032/160] Revert hist_geoschem.xml to original; will adjust in user_nl_cam --- bld/namelist_files/use_cases/hist_geoschem.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 7ef75a9eff..5d446229f6 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -79,8 +79,6 @@ 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', - - -'' - -'' - From 87e351129955e146c631f3579ab045f5de94cf05 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 30 Jun 2022 14:50:58 -0600 Subject: [PATCH 033/160] Remove compset that uses geoschem_mam3 Signed-off-by: Lizzie Lundgren --- cime_config/config_component.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 6d95460f67..6be27aa18b 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -140,7 +140,6 @@ -rad camrt -chem none -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_sam1mom -rad camrt -chem none -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_sam1mom -spcam_clubb_sgs -rad rrtmg -chem trop_mam3 -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_m2005 - -rad rrtmg -chem geoschem_mam3 -hemco -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_m2005 -rad rrtmg -chem trop_mam3 -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_m2005 -spcam_clubb_sgs -chem trop_mozart From 19832a954840caaf924015c5b620faaad06555be Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 14 Jul 2022 09:13:26 -0600 Subject: [PATCH 034/160] No diff updates to GEOS-Chem use cases to document diffs with non-GC Also deleted unused use case defined in geoschem_baro_moist.xml Signed-off-by: Lizzie Lundgren --- .../use_cases/2000_geoschem.xml | 42 +++++++++++++++---- .../use_cases/2010_geoschem.xml | 28 +++++++++++-- .../use_cases/hist_geoschem.xml | 15 ++++++- bld/namelist_files/use_cases/sd_geoschem.xml | 37 +++++++++------- 4 files changed, 92 insertions(+), 30 deletions(-) diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index 5c8cb2a45e..ab14bbedf2 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -1,7 +1,10 @@ - + + -00010101 + + + /glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ @@ -37,13 +40,17 @@ 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' - +'xactive_lnd' + + + +00010101 + + atm/cam/solar/SolarForcing1995-2005avg_c160929.nc 20000101 FIXED -'xactive_lnd' - .true. .true. @@ -55,12 +62,27 @@ 2000 atm/waccm/lb/LBC_2000climo_CMIP6_0p5degLat_c180227.nc - + + - -'CYCLICAL' + + + + + + + + +'CYCLICAL' 2000 + + + + + + + 1,30,365,240,240,480,365,73,30 @@ -77,14 +99,18 @@ .false. .false. + 'Q', 'U', 'V', 'OMEGA', 'T', 'PS', + 'O3', 'NO', 'NO2', 'CO', 'HNO3', 'CH4', 'NIT', 'NH4', 'NH3', 'SO4', 'SO2', 'OH', + + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index 8d37e9c9b9..c9d50d8389 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -1,8 +1,8 @@ - + -00010101 + /glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ @@ -38,13 +38,17 @@ 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' +'xactive_lnd' + + + +00010101 + atm/cam/solar/SolarForcing2006-2014avg_c180917.nc 20100101 FIXED -'xactive_lnd' - .true. .true. @@ -56,6 +60,19 @@ 2010 atm/waccm/lb/LBC_2010climo_CMIP6_0p5degLat_c180227.nc + + + + + + + + + + + + + @@ -73,10 +90,13 @@ .false. .false. + 'Q', 'U', 'V', 'OMEGA', 'T', 'PS', + + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 5d446229f6..8737da0b6a 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -2,7 +2,9 @@ -00010101 + + + /glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ @@ -12,7 +14,6 @@ /glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' - /glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' @@ -38,6 +39,10 @@ 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' + + +00010101 + atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc @@ -55,7 +60,10 @@ INTERP_MISSING_MONTHS + + + INTERP_MISSING_MONTHS 'noy', 'nhx' @@ -77,6 +85,7 @@ .false. + 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', 'LNO_COL_PROD', 'NO2_CLXF', 'SFNO', 'SFNH3', 'BRO', @@ -183,6 +192,8 @@ 'soa2_a2_CHML', 'soa3_a2_CHML', 'soa4_a2_CHML', 'soa5_a2_CHML', 'so4_a1_CHMP', 'so4_a2_CHMP', 'so4_a3_CHMP', 'H2SO4_sfnnuc1', 'num_a2_sfnnuc1', --> + + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index dd613f7619..49dbbf3f3b 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -2,21 +2,20 @@ -20050101 + + + /glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ -atm/cam/met/MERRA2/0.5x0.63/fv_0.47x0.63_nc3000_Co030_Fi001_PF_nullRR_Nsw021_MERRA2_c180612.nc +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f19_f19_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc +atm/cam/met/MERRA2/1.9x2.5/fv_1.9x2.5_nc3000_Nsw084_Nrs016_Co120_Fi001_ZR_GRNL_MERRA2_c190617.nc /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f09_f09_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc atm/cam/met/MERRA2/0.9x1.25/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_MERRA2_c171218.nc -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f19_f19_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc -atm/cam/met/MERRA2/1.9x2.5/fv_1.9x2.5_nc3000_Nsw084_Nrs016_Co120_Fi001_ZR_GRNL_MERRA2_c190617.nc - - + /glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' - /glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' @@ -42,9 +41,14 @@ 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' + + +20050101 + 50. .true. + 2005/MERRA2_1.9x2.5_20050101.nc atm/cam/met/MERRA2/1.9x2.5 atm/cam/met/MERRA2/1.9x2.5/filenames_list_c20210302 @@ -57,14 +61,6 @@ atm/cam/met/MERRA2/0.5x0.63 atm/cam/met/MERRA2/0.5x0.63/filenames_list_c180612 -2005/MERRA2_0.9x1.25_20050101.nc -atm/cam/met/MERRA2/0.9x1.25 -atm/cam/met/MERRA2/0.9x1.25/filenames_1975-2017_c190125.txt - -2010/MERRA2_0.5x0.63_20100101.nc -atm/cam/met/MERRA2/0.5x0.63 -atm/cam/met/MERRA2/0.5x0.63/filenames_list_c180612 - atm/cam/solar/SolarForcingNRLSSI2_daily_s18820101_e20171231_c191122.nc SERIAL @@ -80,11 +76,16 @@ atm/waccm/lb/LBC_1750-2014_CMIP6_0p5degLat_c170126.nc - INTERP_MISSING_MONTHS + + + INTERP_MISSING_MONTHS + + + 1,30,365,240,240,480,365,73,30 @@ -102,6 +103,7 @@ .false. + 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', 'LNO_COL_PROD', 'NO2_CLXF', 'SFNO', 'SFNH3', 'BRO', @@ -203,6 +205,9 @@ 'BURDENSEASALTdn','BURDENBCdn', 'PM25' + + + 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', From e6dd893c9d28618cf8a208c24f65605b42d0fe9e Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 19 Jul 2022 10:42:57 -0600 Subject: [PATCH 035/160] Clean up GEOS-Chem compset namelists -Move megan_specifier definition for GEOS-Chem in use_cases files to bld/build-namelist given chem=geoschem -Move cam_physics_mesh definitions used by HEMCO from use_cases files to namelist_defaults_cam.xml -Remove drydep_method, ext_frc_*, and srf_emis_* parameters from GEOS-Chem use case files -Delete namelist file (geoschem_baro_moist.xml) for unused GEOS-Chem compset -Set default RUN_STARTDATE for the GEOS-Chem climo compsets in config_compsets.xml -Remove ext_frc_* and srf_emis_* variables from geoschem/chemistry.F90 since not used -Fix incorrect comment in mo_chem_utls.F90 Signed-off-by: Lizzie Lundgren --- bld/build-namelist | 50 ++++++++++--- bld/namelist_files/namelist_defaults_cam.xml | 4 + .../use_cases/2000_geoschem.xml | 45 ------------ .../use_cases/2010_geoschem.xml | 40 ---------- .../use_cases/geoschem_baro_moist.xml | 27 ------- .../use_cases/hist_geoschem.xml | 38 +--------- bld/namelist_files/use_cases/sd_geoschem.xml | 35 --------- cime_config/config_compsets.xml | 2 + src/chemistry/geoschem/chemistry.F90 | 73 ++++++++++--------- src/chemistry/geoschem/mo_chem_utls.F90 | 2 +- 10 files changed, 86 insertions(+), 230 deletions(-) delete mode 100644 bld/namelist_files/use_cases/geoschem_baro_moist.xml diff --git a/bld/build-namelist b/bld/build-namelist index 2b647218fc..b993ae2bd9 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -2326,10 +2326,12 @@ if (($chem =~ /_mam4/ or $chem =~ /_mam5/) and ($phys =~ /cam6/ or $phys =~ /cam $first = 0; } } - add_default($nl, 'srf_emis_specifier', 'val'=>$val); - unless (defined $nl->get_value('srf_emis_type')) { - add_default($nl, 'srf_emis_type', 'val'=>'CYCLICAL'); - add_default($nl, 'srf_emis_cycle_yr', 'val'=>2000); + if ($chem !~ /geoschem/) { + add_default($nl, 'srf_emis_specifier', 'val'=>$val); + unless (defined $nl->get_value('srf_emis_type')) { + add_default($nl, 'srf_emis_type', 'val'=>'CYCLICAL'); + add_default($nl, 'srf_emis_cycle_yr', 'val'=>2000); + } } # Vertical emission datasets: @@ -2390,14 +2392,16 @@ if (($chem =~ /_mam4/ or $chem =~ /_mam5/) and ($phys =~ /cam6/ or $phys =~ /cam $first = 0; } } - add_default($nl, 'ext_frc_specifier', 'val'=>$val); - unless (defined $nl->get_value('ext_frc_type')) { - add_default($nl, 'ext_frc_type', 'val'=>"'CYCLICAL'"); - add_default($nl, 'ext_frc_cycle_yr', 'val'=>2000); + if ($chem !~ /geoschem/) { + add_default($nl, 'ext_frc_specifier', 'val'=>$val); + unless (defined $nl->get_value('ext_frc_type')) { + add_default($nl, 'ext_frc_type', 'val'=>"'CYCLICAL'"); + add_default($nl, 'ext_frc_cycle_yr', 'val'=>2000); + } } # MEGAN emissions - if ($chem =~ /trop_strat_mam4_vbsext/ or $chem =~ /waccm_tsmlt/ or $chem =~ /geoschem/) { + if ($chem =~ /trop_strat_mam4_vbsext/ or $chem =~ /waccm_tsmlt/) { my $val = "'ISOP = isoprene'," . "'MTERP = pinene_a + carene_3 + thujene_a + 2met_styrene + cymene_p + cymene_o + terpinolene + bornene " . "+ fenchene_a + ocimene_al + pinene_b + sabinene + camphene + limonene + phellandrene_a + terpinene_g " @@ -2423,6 +2427,30 @@ if (($chem =~ /_mam4/ or $chem =~ /_mam5/) and ($phys =~ /cam6/ or $phys =~ /cam add_default($nl, 'megan_factors_file'); add_default($nl, 'megan_mapped_emisfctrs', 'val'=>'.false.'); } + if ($chem =~ /geoschem/) { + my $val = "'ISOP = isoprene'," + . "'MOH = methanol'," + . "'EOH = ethanol'," + . "'CH2O = formaldehyde'," + . "'ALD2 = acetaldehyde'," + . "'ACTA = acetic_acid'," + . "'ACET = acetone'," + . "'HCOOH = formic_acid'," + . "'HCN = hydrogen_cyanide'," + . "'CO = carbon_monoxide'," + . "'C2H6 = ethane'," + . "'C2H4 = ethene'," + . "'C3H8 = propane'," + . "'ALK4 = pentane + hexane + heptane + tricyclene'," + . "'PRPE = propene + butene'," + . "'TOLU = toluene'," + . "'LIMO = limonene'," + . "'MTPA = pinene_a + pinene_b + sabinene + carene_3'," + . "'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b'"; + add_default($nl, 'megan_specifier', 'val'=>$val); + add_default($nl, 'megan_factors_file'); + add_default($nl, 'megan_mapped_emisfctrs', 'val'=>'.false.'); + } if ($chem =~ /trop_strat_mam4_vbs/ ) { my $val = "'ISOP = isoprene'," . "'MTERP = carene_3 + pinene_a + thujene_a + bornene + terpineol_4 + terpineol_a + terpinyl_ACT_a " @@ -2818,6 +2846,10 @@ else { # HEMCO $nl->set_variable_value('hemco_nl', 'hemco_config_File', "'HEMCO_Config.rc'"); +my $hco = $cfg->get('hemco'); +if ( $hco eq '1' ) { + add_default($nl, 'cam_physics_mesh'); +} # Physics options diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index cb49caf9c4..ebee401afb 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -767,6 +767,8 @@ atm/cam/coords/ne16np4_esmf_c210305.nc atm/cam/coords/ne30np4_esmf_c210305.nc atm/cam/coords/ne30pg3_esmf_20200428.nc +atm/cam/coords/fv0.9x1.25_esmf_141008.nc' +atm/cam/coords/fv1.9x2.5_esmf_141008.nc' 1.00D0 @@ -3183,4 +3185,6 @@ atm/cam/ocnfrac/domain.aqua.fv1.9x2.5.nc + + diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index ab14bbedf2..c20a3c66fc 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -12,36 +12,6 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc - -/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' - -/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' - - - - 'ISOP = isoprene', - 'MOH = methanol', - 'EOH = ethanol', - 'CH2O = formaldehyde', - 'ALD2 = acetaldehyde', - 'ACTA = acetic_acid', - 'ACET = acetone', - 'HCOOH = formic_acid', - 'HCN = hydrogen_cyanide', - 'CO = carbon_monoxide', - 'C2H6 = ethane', - 'C2H4 = ethene', - 'C3H8 = propane', - 'ALK4 = pentane + hexane + heptane + tricyclene', - 'PRPE = propene + butene', - 'TOLU = toluene', - 'LIMO = limonene', - 'MTPA = pinene_a + pinene_b + sabinene + carene_3', - 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' - - -'xactive_lnd' - 00010101 @@ -65,21 +35,6 @@ - - - - - - - - - -'CYCLICAL' -2000 - - - - diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index c9d50d8389..ece3001986 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -10,36 +10,6 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc - -/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' - -/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' - - - - 'ISOP = isoprene', - 'MOH = methanol', - 'EOH = ethanol', - 'CH2O = formaldehyde', - 'ALD2 = acetaldehyde', - 'ACTA = acetic_acid', - 'ACET = acetone', - 'HCOOH = formic_acid', - 'HCN = hydrogen_cyanide', - 'CO = carbon_monoxide', - 'C2H6 = ethane', - 'C2H4 = ethene', - 'C3H8 = propane', - 'ALK4 = pentane + hexane + heptane + tricyclene', - 'PRPE = propene + butene', - 'TOLU = toluene', - 'LIMO = limonene', - 'MTPA = pinene_a + pinene_b + sabinene + carene_3', - 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' - - -'xactive_lnd' - 00010101 @@ -62,16 +32,6 @@ - - - - - - - - - - diff --git a/bld/namelist_files/use_cases/geoschem_baro_moist.xml b/bld/namelist_files/use_cases/geoschem_baro_moist.xml deleted file mode 100644 index 51c3427f82..0000000000 --- a/bld/namelist_files/use_cases/geoschem_baro_moist.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - 10101 - - -.false. - - -/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' - -/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' - - -0,-6 - - 'U:I','V:I','T:I' - -'baroclinic_wave' - - diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 8737da0b6a..35f09e0474 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -12,33 +12,6 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc - -/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' -/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' - - - - 'ISOP = isoprene', - 'MOH = methanol', - 'EOH = ethanol', - 'CH2O = formaldehyde', - 'ALD2 = acetaldehyde', - 'ACTA = acetic_acid', - 'ACET = acetone', - 'HCOOH = formic_acid', - 'HCN = hydrogen_cyanide', - 'CO = carbon_monoxide', - 'C2H6 = ethane', - 'C2H4 = ethene', - 'C3H8 = propane', - 'ALK4 = pentane + hexane + heptane + tricyclene', - 'PRPE = propene + butene', - 'TOLU = toluene', - 'LIMO = limonene', - 'MTPA = pinene_a + pinene_b + sabinene + carene_3', - 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' - - 00010101 @@ -55,16 +28,7 @@ SERIAL atm/waccm/lb/LBC_1750-2014_CMIP6_0p5degLat_c170126.nc - SERIAL - - - -INTERP_MISSING_MONTHS - - - - -INTERP_MISSING_MONTHS +SERIAL 'noy', 'nhx' diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index 49dbbf3f3b..01e51032e4 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -14,33 +14,6 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f09_f09_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc atm/cam/met/MERRA2/0.9x1.25/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_MERRA2_c171218.nc - -/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv0.9x1.25_esmf_141008.nc' -/glade/p/cesmdata/cseg/inputdata/atm/cam/coords/fv1.9x2.5_esmf_141008.nc' - - - - 'ISOP = isoprene', - 'MOH = methanol', - 'EOH = ethanol', - 'CH2O = formaldehyde', - 'ALD2 = acetaldehyde', - 'ACTA = acetic_acid', - 'ACET = acetone', - 'HCOOH = formic_acid', - 'HCN = hydrogen_cyanide', - 'CO = carbon_monoxide', - 'C2H6 = ethane', - 'C2H4 = ethene', - 'C3H8 = propane', - 'ALK4 = pentane + hexane + heptane + tricyclene', - 'PRPE = propene + butene', - 'TOLU = toluene', - 'LIMO = limonene', - 'MTPA = pinene_a + pinene_b + sabinene + carene_3', - 'MTPO = terpinene_g + terpinene_a + terpinolene + myrcene + ocimene_al + ocimene_t_b + ocimene_c_b + thujene_a + 2met_styrene + cymene_p + cymene_o + bornene + fenchene_a + camphene + phellandrene_a + phellandrene_b' - - 20050101 @@ -75,14 +48,6 @@ SERIAL atm/waccm/lb/LBC_1750-2014_CMIP6_0p5degLat_c170126.nc - -INTERP_MISSING_MONTHS - - - - -INTERP_MISSING_MONTHS - diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 90f1596edd..0670ca8725 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -557,6 +557,8 @@ 2010-01-01 1980-01-01 2000-01-01 + 2000-01-01 + 2010-01-01 2004-01-01 1950-01-01 diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 292724dc51..9dec917b96 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -171,19 +171,19 @@ module chemistry ! character(len=shr_kind_cl) :: depvel_file = '' ! character(len=shr_kind_cl) :: depvel_lnd_file = 'depvel_lnd_file' ! character(len=shr_kind_cl) :: season_wes_file = 'season_wes_file' - - character(len=shr_kind_cl) :: srf_emis_specifier(pcnst) = '' - character(len=shr_kind_cl) :: ext_frc_specifier(pcnst) = '' - - character(len=24) :: srf_emis_type = 'CYCLICAL' ! 'CYCLICAL' | 'SERIAL' | 'INTERP_MISSING_MONTHS' - integer :: srf_emis_cycle_yr = 0 - integer :: srf_emis_fixed_ymd = 0 - integer :: srf_emis_fixed_tod = 0 - - character(len=24) :: ext_frc_type = 'CYCLICAL' ! 'CYCLICAL' | 'SERIAL' | 'INTERP_MISSING_MONTHS' - integer :: ext_frc_cycle_yr = 0 - integer :: ext_frc_fixed_ymd = 0 - integer :: ext_frc_fixed_tod = 0 +! +! character(len=shr_kind_cl) :: srf_emis_specifier(pcnst) = '' +! character(len=shr_kind_cl) :: ext_frc_specifier(pcnst) = '' +! +! character(len=24) :: srf_emis_type = 'CYCLICAL' ! 'CYCLICAL' | 'SERIAL' | 'INTERP_MISSING_MONTHS' +! integer :: srf_emis_cycle_yr = 0 +! integer :: srf_emis_fixed_ymd = 0 +! integer :: srf_emis_fixed_tod = 0 +! +! character(len=24) :: ext_frc_type = 'CYCLICAL' ! 'CYCLICAL' | 'SERIAL' | 'INTERP_MISSING_MONTHS' +! integer :: ext_frc_cycle_yr = 0 +! integer :: ext_frc_fixed_ymd = 0 +! integer :: ext_frc_fixed_tod = 0 !================================================================================================ @@ -691,20 +691,21 @@ subroutine chem_readnl(nlfile) LOGICAL :: validSLS ! ewl: remove 4 entries from chem_inparm used for dry deposition: -! clim_soilw_file, depvel_file, depvel_lnd_file, season_wes_file +! clim_soilw_file, depvel_file, depvel_lnd_file, season_wes_file; +! remove ext_frc_ and srf_emis_ ones too. ! The following files are required to compute land maps, required to perform ! aerosol dry deposition - namelist /chem_inparm/ lght_no_prd_factor, & - ext_frc_specifier, & - ext_frc_type, & - ext_frc_cycle_yr, & - ext_frc_fixed_ymd, & - ext_frc_fixed_tod, & - srf_emis_specifier, & - srf_emis_cycle_yr, & - srf_emis_fixed_ymd, & - srf_emis_fixed_tod, & - srf_emis_type + namelist /chem_inparm/ lght_no_prd_factor +! ext_frc_specifier, & +! ext_frc_type, & +! ext_frc_cycle_yr, & +! ext_frc_fixed_ymd, & +! ext_frc_fixed_tod, & +! srf_emis_specifier, & +! srf_emis_cycle_yr, & +! srf_emis_fixed_ymd, & +! srf_emis_fixed_tod, & +! srf_emis_type ! ghg chem @@ -867,7 +868,7 @@ subroutine chem_readnl(nlfile) ! Broadcast namelist variables -! ewl: remove broadcast of 4 files used for dry deposition only +! ewl: remove broadcast of 4 files used for dry deposition only; srf_emis and ext_frc too. ! The following files are required to compute land maps, required to perform ! aerosol dry deposition ! CALL MPIBCAST (depvel_lnd_file, LEN(depvel_lnd_file), MPICHAR, 0, MPICOM) @@ -876,16 +877,16 @@ subroutine chem_readnl(nlfile) CALL MPIBCAST (lght_no_prd_factor, 1, MPIR8, 0, MPICOM) ! CALL MPIBCAST (depvel_file, LEN(depvel_file), MPICHAR, 0, MPICOM) - CALL MPIBCAST (srf_emis_specifier, LEN(srf_emis_specifier(1))*pcnst, MPICHAR, 0, MPICOM) - CALL MPIBCAST (srf_emis_type, LEN(srf_emis_type), MPICHAR, 0, MPICOM) - CALL MPIBCAST (srf_emis_cycle_yr, 1, MPIINT, 0, MPICOM) - CALL MPIBCAST (srf_emis_fixed_ymd, 1, MPIINT, 0, MPICOM) - CALL MPIBCAST (srf_emis_fixed_tod, 1, MPIINT, 0, MPICOM) - CALL MPIBCAST (ext_frc_specifier, LEN(ext_frc_specifier(1))*pcnst, MPICHAR, 0, MPICOM) - CALL MPIBCAST (ext_frc_type, LEN(ext_frc_type), MPICHAR, 0, MPICOM) - CALL MPIBCAST (ext_frc_cycle_yr, 1, MPIINT, 0, MPICOM) - CALL MPIBCAST (ext_frc_fixed_ymd, 1, MPIINT, 0, MPICOM) - CALL MPIBCAST (ext_frc_fixed_tod, 1, MPIINT, 0, MPICOM) +! CALL MPIBCAST (srf_emis_specifier, LEN(srf_emis_specifier(1))*pcnst, MPICHAR, 0, MPICOM) +! CALL MPIBCAST (srf_emis_type, LEN(srf_emis_type), MPICHAR, 0, MPICOM) +! CALL MPIBCAST (srf_emis_cycle_yr, 1, MPIINT, 0, MPICOM) +! CALL MPIBCAST (srf_emis_fixed_ymd, 1, MPIINT, 0, MPICOM) +! CALL MPIBCAST (srf_emis_fixed_tod, 1, MPIINT, 0, MPICOM) +! CALL MPIBCAST (ext_frc_specifier, LEN(ext_frc_specifier(1))*pcnst, MPICHAR, 0, MPICOM) +! CALL MPIBCAST (ext_frc_type, LEN(ext_frc_type), MPICHAR, 0, MPICOM) +! CALL MPIBCAST (ext_frc_cycle_yr, 1, MPIINT, 0, MPICOM) +! CALL MPIBCAST (ext_frc_fixed_ymd, 1, MPIINT, 0, MPICOM) +! CALL MPIBCAST (ext_frc_fixed_tod, 1, MPIINT, 0, MPICOM) CALL MPIBCAST (ghg_chem, 1, MPILOG, 0, MPICOM) CALL MPIBCAST (bndtvg, LEN(bndtvg), MPICHAR, 0, MPICOM) diff --git a/src/chemistry/geoschem/mo_chem_utls.F90 b/src/chemistry/geoschem/mo_chem_utls.F90 index 43e2d7317e..aba6436b56 100644 --- a/src/chemistry/geoschem/mo_chem_utls.F90 +++ b/src/chemistry/geoschem/mo_chem_utls.F90 @@ -46,7 +46,7 @@ end function get_spc_ndx integer function get_inv_ndx( invariant ) !----------------------------------------------------------------------- - ! ... return overall external frcing index associated with spc_name + ! ... return overall invariant index associated with spc_name !----------------------------------------------------------------------- use chem_mods, only : nfs, inv_lst From 849edd7eecfcdb8e31ef66c563b1f40e05eb4f64 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 21 Jul 2022 10:51:45 -0600 Subject: [PATCH 036/160] Move GEOS-Chem deposition lists to common file with namelist defaults This update also slims down the dry deposition lists to not include aerosols or unused species (new lists submitted by Haipeng Lin). Signed-off-by: Lizzie Lundgren --- bld/namelist_files/namelist_defaults_cam.xml | 23 +++++++++++++++++++ .../use_cases/2000_geoschem.xml | 18 --------------- .../use_cases/2010_geoschem.xml | 18 --------------- .../use_cases/hist_geoschem.xml | 18 --------------- bld/namelist_files/use_cases/sd_geoschem.xml | 19 --------------- 5 files changed, 23 insertions(+), 73 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index ebee401afb..fb80654cb9 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -3186,5 +3186,28 @@ atm/cam/ocnfrac/domain.aqua.fv1.9x2.5.nc + + + + + + +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HMS','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + + +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HMS','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index c20a3c66fc..b2c980ddd3 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -64,22 +64,4 @@ 'O3', 'NO', 'NO2', 'CO', 'HNO3', 'CH4', 'NIT', 'NH4', 'NH3', 'SO4', 'SO2', 'OH', - - - - 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', - - - - 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - - 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', - - - - 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index ece3001986..4ac969a9aa 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -55,22 +55,4 @@ 'Q', 'U', 'V', 'OMEGA', 'T', 'PS', - - - - 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', - - - - 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - - 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', - - - - 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 35f09e0474..60068f00d4 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -156,22 +156,4 @@ 'soa2_a2_CHML', 'soa3_a2_CHML', 'soa4_a2_CHML', 'soa5_a2_CHML', 'so4_a1_CHMP', 'so4_a2_CHMP', 'so4_a3_CHMP', 'H2SO4_sfnnuc1', 'num_a2_sfnnuc1', --> - - - - 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', - - - - 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - - 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', - - - - 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index 01e51032e4..fbeaa8cc0b 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -170,23 +170,4 @@ 'BURDENSEASALTdn','BURDENBCdn', 'PM25' - - - - - 'ACET','ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','BRNO3','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','EOH','ETHLN','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG0','HG0_ANT','HG0_ARC','HG0_ATL','HG0_BB','HG0_CAM','HG0_CAN','HG0_EAF','HG0_EAS','HG0_EEU','HG0_EUR','HG0_GEO','HG0_JPN','HG0_MDE','HG0_NAF','HG0_NAT','HG0_NPA','HG0_OCE','HG0_OCN','HG0_SAF','HG0_SAM','HG0_SAS','HG0_SAT','HG0_SEA','HG0_SO','HG0_SOV','HG0_STR','HG0_USA','HG0_WAF','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPRNO3','O3','O3AFBL','O3ASBL','O3ATBL','O3EUBL','O3INIT','O3MT','O3NABL','O3PCBL','O3ROW','O3STRAT','O3USA','O3UT','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', - - - - 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - - 'ACTA','ALD2','ASOG1','ASOG2','ASOG3','ATOOH','BR2','BRCL','CH2O','EOH','ETHLN','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HG2','HG2_ANT','HG2_ARC','HG2_ATL','HG2_BB','HG2_CAM','HG2_CAN','HG2_EAF','HG2_EAS','HG2_EEU','HG2_EUR','HG2_GEO','HG2_JPN','HG2_MDE','HG2_NAF','HG2_NAT','HG2_NPA','HG2_OCE','HG2_OCN','HG2_SAF','HG2_SAM','HG2_SAS','HG2_SAT','HG2_SEA','HG2_SO','HG2_SOV','HG2_STR','HG2_USA','HG2_WAF','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','OPOG1','OPOG2','PAN','POG1','POG2','POPG_BAP','POPG_PHE','POPG_PYR','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','TSOG0','TSOG1','TSOG2','TSOG3','AERI','ASOA1','ASOA2','ASOA3','ASOAN','BCPI','BCPO','BE10','BE10STRAT','BE7','BE7STRAT','BRSALA','BRSALC','DST1','DST2','DST3','DST4','DSTAL1','DSTAL2','DSTAL3','DSTAL4','HGP','HGP_ANT','HGP_ARC','HGP_ATL','HGP_BB','HGP_CAM','HGP_CAN','HGP_EAF','HGP_EAS','HGP_EEU','HGP_EUR','HGP_GEO','HGP_JPN','HGP_MDE','HGP_NAF','HGP_NAT','HGP_NPA','HGP_OCE','HGP_OCN','HGP_SAF','HGP_SAM','HGP_SAS','HGP_SAT','HGP_SEA','HGP_SO','HGP_SOV','HGP_STR','HGP_USA','HGP_WAF','INDIOL','IONITA','ISALA','ISALC','LVOCOA','MONITA','MOPI','MOPO','MSA','NH4','NIT','NITD1','NITD2','NITD3','NITD4','NITS','OCPI','OCPO','OPOA1','OPOA2','PB210','PB210STRAT','PFE','POA1','POA2','POPPBCPI_BAP','POPPBCPI_PHE','POPPBCPI_PYR','POPPBCPO_BAP','POPPBCPO_PHE','POPPBCPO_PYR','POPPOCPI_BAP','POPPOCPI_PHE','POPPOCPI_PYR','POPPOCPO_BAP','POPPOCPO_PHE','POPPOCPO_PYR','SALA','SALAAL','SALACL','SALC','SALCAL','SALCCL','SO4','SO4D1','SO4D2','SO4D3','SO4D4','SO4S','SOAGX','SOAIE','SOAS','TSOA0','TSOA1','TSOA2','TSOA3', - - - - 'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - From 9ab1b89fa008c2954d30792ace3b95c9106bfb73 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 4 Aug 2022 09:14:30 -0600 Subject: [PATCH 037/160] Updates to Neu wet dep in GEOS-Chem for Henry's Law coeffs from netcdf Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/mo_neu_wetdep.F90 | 203 +++++++++++------------ 1 file changed, 101 insertions(+), 102 deletions(-) diff --git a/src/chemistry/geoschem/mo_neu_wetdep.F90 b/src/chemistry/geoschem/mo_neu_wetdep.F90 index 809df9ad86..4f3f2fc040 100644 --- a/src/chemistry/geoschem/mo_neu_wetdep.F90 +++ b/src/chemistry/geoschem/mo_neu_wetdep.F90 @@ -12,7 +12,7 @@ module mo_neu_wetdep use constituents, only : pcnst use spmd_utils, only : masterproc use cam_abortutils, only : endrun - use seq_drydep_mod, only : n_species_table, species_name_table, dheff + use shr_drydep_mod, only : n_species_table, species_name_table, dheff use gas_wetdep_opts, only : gas_wetdep_method, gas_wetdep_list, gas_wetdep_cnt ! implicit none @@ -83,80 +83,84 @@ subroutine neu_wetdep_init test_name = gas_wetdep_list(m) if ( debug ) print '(i4,a)',m,trim(test_name) ! -! mapping based on the MOZART4 wet removal subroutine; -! this might need to be redone (JFL: Sep 2010) -! - select case( trim(test_name) ) -! -! CCMI: added SO2t and NH_50W -! - case( 'HYAC', 'CH3COOH' , 'HCOOH', 'EOOH', 'IEPOX' ) - test_name = 'CH2O' - case ( 'SOGB','SOGI','SOGM','SOGT','SOGX' ) - test_name = 'H2O2' - case ( 'SO2t' ) - test_name = 'SO2' - case ( 'CLONO2','BRONO2','HCL','HOCL','HOBR','HBR', 'Pb', 'MACROOH', 'ISOPOOH', 'XOOH', 'H2SO4', 'HF', 'COF2', 'COFCL') - test_name = 'HNO3' - case ( 'NH_50W', 'NDEP', 'NHDEP', 'NH4NO3' ) - test_name = 'HNO3' - case ( 'ALKOOH', 'MEKOOH', 'TOLOOH' ) - test_name = 'CH3OOH' - case( 'PHENOOH', 'BENZOOH', 'C6H5OOH', 'BZOOH', 'XYLOLOOH', 'XYLENOOH', 'HPALD' ) - test_name = 'CH3OOH' - case( 'TERPOOH', 'TERP2OOH', 'MBOOOH' ) - test_name = 'HNO3' - case( 'TERPROD1', 'TERPROD2' ) - test_name = 'CH2O' - case( 'HMPROP' ) - test_name = 'GLYALD' - case( 'NOA', 'ALKNIT', 'ISOPNITA', 'ISOPNITB', 'HONITR', 'ISOPNOOH' ) - test_name = 'H2O2' - case( 'NC4CHO', 'NC4CH2OH', 'TERPNIT', 'NTERPOOH' ) - test_name = 'H2O2' - case( 'SOAGbb0' ) ! Henry's Law coeff. added for VBS SOA's, biomass burning is the same as fossil fuels - test_name = 'SOAGff0' - case( 'SOAGbb1' ) - test_name = 'SOAGff1' - case( 'SOAGbb2' ) - test_name = 'SOAGff2' - case( 'SOAGbb3' ) - test_name = 'SOAGff3' - case( 'SOAGbb4' ) - test_name = 'SOAGff4' - case( 'H2O2' ) - test_name = 'GC_H2O2' - case( 'HCHO' ) - test_name = 'GC_CH2O' - case( 'CH2O' ) - test_name = 'GC_CH2O' - case( 'NO2' ) - test_name = 'GC_NO2' - !case( 'HNO3' ) - ! test_name = 'GC_HNO3' - case( 'NH3' ) - test_name = 'GC_NH3' - case( 'N2O5' ) - test_name = 'GC_N2O5' - case( 'PAN' ) - test_name = 'GC_PAN' - !case( 'SO2' ) - ! test_name = 'GC_SO2' - ! Now list all non-MAM GEOS-Chem aerosols. These will be scavenged similarly - ! to HNO3 - case( 'AERI', 'BRSALA', 'BRSALC', 'INDIOL', & - 'IONITA', 'ISALA', 'ISALC', 'LVOCOA', 'MONITA', & - 'MSA', 'NH4', 'NIT', 'NITS', 'PFE', & - 'SALAAL', 'SALACL', 'SALCAL', 'SALCCL', 'SO4S', & - 'SOAS', 'SOAGX', 'SOAIE', 'TSOA0', 'TSOA1', & - 'TSOA2', 'TSOA3', 'ASOAN', 'ASOA1', 'ASOA2', & - 'ASOA3' ) - test_name = 'HNO3' - case( 'ASOG1', 'ASOG2', 'ASOG3' ) - test_name = 'ASOG' - case( 'TSOG0', 'TSOG1', 'TSOG2', 'TSOG3' ) - test_name = 'TSOG' - end select +! ewl: this mapping can be replaced by including Henry's Law etc for all species, which makes usage of +! the parameters more transparent. I will comment out.... +!!!! +!!!! mapping based on the MOZART4 wet removal subroutine; +!!!! this might need to be redone (JFL: Sep 2010) +!!!! +!!! select case( trim(test_name) ) +!!!! +!!!! CCMI: added SO2t and NH_50W +!!!! +!!! case( 'HYAC', 'CH3COOH' , 'HCOOH', 'EOOH', 'IEPOX' ) +!!! test_name = 'CH2O' +!!! case ( 'SOGB','SOGI','SOGM','SOGT','SOGX' ) +!!! test_name = 'H2O2' +!!! case ( 'SO2t' ) +!!! test_name = 'SO2' +!!! case ( 'CLONO2','BRONO2','HCL','HOCL','HOBR','HBR', 'Pb', 'MACROOH', 'ISOPOOH', 'XOOH', 'H2SO4', 'HF', 'COF2', 'COFCL') +!!! test_name = 'HNO3' +!!! case ( 'NH_50W', 'NDEP', 'NHDEP', 'NH4NO3' ) +!!! test_name = 'HNO3' +!!! case ( 'ALKOOH', 'MEKOOH', 'TOLOOH' ) +!!! test_name = 'CH3OOH' +!!! case( 'PHENOOH', 'BENZOOH', 'C6H5OOH', 'BZOOH', 'XYLOLOOH', 'XYLENOOH', 'HPALD' ) +!!! test_name = 'CH3OOH' +!!! case( 'TERPOOH', 'TERP2OOH', 'MBOOOH' ) +!!! test_name = 'HNO3' +!!! case( 'TERPROD1', 'TERPROD2' ) +!!! test_name = 'CH2O' +!!! case( 'HMPROP' ) +!!! test_name = 'GLYALD' +!!! case( 'NOA', 'ALKNIT', 'ISOPNITA', 'ISOPNITB', 'HONITR', 'ISOPNOOH' ) +!!! test_name = 'H2O2' +!!! case( 'NC4CHO', 'NC4CH2OH', 'TERPNIT', 'NTERPOOH' ) +!!! test_name = 'H2O2' +!!! case( 'SOAGbb0' ) ! Henry's Law coeff. added for VBS SOA's, biomass burning is the same as fossil fuels +!!! test_name = 'SOAGff0' +!!! case( 'SOAGbb1' ) +!!! test_name = 'SOAGff1' +!!! case( 'SOAGbb2' ) +!!! test_name = 'SOAGff2' +!!! case( 'SOAGbb3' ) +!!! test_name = 'SOAGff3' +!!! case( 'SOAGbb4' ) +!!! test_name = 'SOAGff4' +!!! case( 'H2O2' ) +!!! test_name = 'GC_H2O2' +!!! case( 'HCHO' ) +!!! test_name = 'GC_CH2O' +!!! case( 'CH2O' ) +!!! test_name = 'GC_CH2O' +!!! case( 'NO2' ) +!!! test_name = 'GC_NO2' +!!! !case( 'HNO3' ) +!!! ! test_name = 'GC_HNO3' +!!! case( 'NH3' ) +!!! test_name = 'GC_NH3' +!!! case( 'N2O5' ) +!!! test_name = 'GC_N2O5' +!!! case( 'PAN' ) +!!! test_name = 'GC_PAN' +!!! !case( 'SO2' ) +!!! ! test_name = 'GC_SO2' +!!! ! Now list all non-MAM GEOS-Chem aerosols. These will be scavenged similarly +!!! ! to HNO3 +!!! case( 'AERI', 'BRSALA', 'BRSALC', 'INDIOL', & +!!! 'IONITA', 'ISALA', 'ISALC', 'LVOCOA', 'MONITA', & +!!! 'MSA', 'NH4', 'NIT', 'NITS', 'PFE', & +!!! 'SALAAL', 'SALACL', 'SALCAL', 'SALCCL', 'SO4S', & +!!! 'SOAS', 'SOAGX', 'SOAIE', 'TSOA0', 'TSOA1', & +!!! 'TSOA2', 'TSOA3', 'ASOAN', 'ASOA1', 'ASOA2', & +!!! 'ASOA3' ) +!!! test_name = 'HNO3' +!!! case( 'ASOG1', 'ASOG2', 'ASOG3' ) +!!! test_name = 'ASOG' +!!! case( 'TSOG0', 'TSOG1', 'TSOG2', 'TSOG3' ) +!!! test_name = 'TSOG' +!!! end select +! ! do l = 1,n_species_table ! @@ -169,10 +173,8 @@ subroutine neu_wetdep_init end if end do if ( mapping_to_heff(m) == -99 ) then -! ewl: kludge until I add new species to species table in seq_drydep_mod.F90 -! if (masterproc) print *,'problem with mapping_to_heff of ',trim(test_name) -!! call endrun() - mapping_to_heff(m) = 1 + print '(a,a)','neu_wetdep_init: ERROR: Ending run because mapping to species heff not found for ',trim(test_name) + call endrun() end if ! ! special cases for NH3 and CO2 @@ -204,7 +206,7 @@ subroutine neu_wetdep_init call cnst_get_ind(gas_wetdep_list(m), mapping_to_mmr(m), abort=.false. ) if ( debug ) print '(a,i4)','mapping_to_mmr ',mapping_to_mmr(m) if ( mapping_to_mmr(m) <= 0 ) then - print *,'problem with mapping_to_mmr of ',gas_wetdep_list(m) + print *,'neu_wetdep_init: problem with mapping_to_mmr of ',gas_wetdep_list(m) call endrun('problem with mapping_to_mmr of '//trim(gas_wetdep_list(m))) end if end do @@ -263,10 +265,10 @@ end subroutine neu_wetdep_init subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & prain, nevapr, cld, cmfdqr, wd_tend, wd_tend_int) ! - use ppgrid, only : pcols, pver -!!DEK + use ppgrid, only : pcols, pver use phys_grid, only : get_area_all_p, get_rlat_all_p use shr_const_mod, only : SHR_CONST_REARTH,SHR_CONST_G + use shr_const_mod, only : pi => shr_const_pi use cam_history, only : outfld ! implicit none @@ -288,7 +290,7 @@ subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & ! ! local arrays and variables ! - integer :: i,k,l,kk,m,id + integer :: i,k,l,kk,m real(r8), parameter :: rearth = SHR_CONST_REARTH ! radius earth (m) real(r8), parameter :: gravit = SHR_CONST_G ! m/s^2 real(r8), dimension(ncol) :: area, wk_out @@ -310,14 +312,13 @@ subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & real(r8), parameter :: ph_inv = 1._r8/ph real(r8) :: e298, dhr real(r8), dimension(ncol) :: dk1s,dk2s,wrk -!!DEK - real(r8) :: pi real(r8) :: lats(pcols) + + real(r8), parameter :: rad2deg = 180._r8/pi + ! ! from cam/src/physics/cam/stratiform.F90 ! -!!DEK - pi = 4._r8*atan(1.0_r8) if (.not.do_neu_wetdep) return ! @@ -381,7 +382,6 @@ subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & end do ! ! compute effective Henry's law coefficients -! code taken from models/drv/shr/seq_drydep_mod.F90 ! heff = 0._r8 do k=1,pver @@ -393,14 +393,13 @@ subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & do m=1,gas_wetdep_cnt ! l = mapping_to_heff(m) - id = 6*(l - 1) - e298 = dheff(id+1) - dhr = dheff(id+2) + e298 = dheff(1,l) + dhr = dheff(2,l) heff(:,k,m) = e298*exp( dhr*wrk(:) ) test_flag = -99 - if( dheff(id+3) /= 0._r8 .and. dheff(id+5) == 0._r8 ) then - e298 = dheff(id+3) - dhr = dheff(id+4) + if( dheff(3,l) /= 0._r8 .and. dheff(5,l) == 0._r8 ) then + e298 = dheff(3,l) + dhr = dheff(4,l) dk1s(:) = e298*exp( dhr*wrk(:) ) where( heff(:,k,m) /= 0._r8 ) heff(:,k,m) = heff(:,k,m)*(1._r8 + dk1s(:)*ph_inv) @@ -410,15 +409,15 @@ subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & endwhere end if ! - if (k.eq.1 .and. maxval(test_flag) > 0 .and. debug ) print '(a,i4)','heff for m=',m + if (k.eq.1 .and. maxval(test_flag) > 0 .and. debug .and. masterproc) print '(a,i4)','neu_wetdep_tend: heff for m=',m ! - if( dheff(id+5) /= 0._r8 ) then + if( dheff(5,l) /= 0._r8 ) then if( nh3_ndx > 0 .or. co2_ndx > 0 ) then - e298 = dheff(id+3) - dhr = dheff(id+4) + e298 = dheff(3,l) + dhr = dheff(4,l) dk1s(:) = e298*exp( dhr*wrk(:) ) - e298 = dheff(id+5) - dhr = dheff(id+6) + e298 = dheff(5,l) + dhr = dheff(6,l) dk2s(:) = e298*exp( dhr*wrk(:) ) if( m == co2_ndx ) then heff(:,k,m) = heff(:,k,m)*(1._r8 + dk1s(:)*ph_inv)*(1._r8 + dk2s(:)*ph_inv) @@ -473,11 +472,11 @@ subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & dtwr(1:ncol,:,:) = wd_mmr(1:ncol,:,:) - dtwr(1:ncol,:,:) dtwr(1:ncol,:,:) = dtwr(1:ncol,:,:) / delt -!!DEK polarward of 60S, 60N and <200hPa set to zero! +! polarward of 60S, 60N and <200hPa set to zero! call get_rlat_all_p(lchnk, pcols, lats ) do k = 1, pver do i= 1, ncol - if ( abs( lats(i)*180._r8/pi ) > 60._r8 ) then + if ( abs( lats(i)*rad2deg ) > 60._r8 ) then if ( pmid(i,k) < 20000._r8) then dtwr(i,k,:) = 0._r8 endif From 4fa1cf41517aad55d0e5438a7a051294ea08e6be Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 4 Aug 2022 09:15:53 -0600 Subject: [PATCH 038/160] Update Neu wet dep debug prints in GEOS-Chem Debug prints are now only done by the master processor. The debug logical is still manually set in mo_neu_wetdep.F90. It is false by default. Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/mo_neu_wetdep.F90 | 81 +++++++++++++----------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/src/chemistry/geoschem/mo_neu_wetdep.F90 b/src/chemistry/geoschem/mo_neu_wetdep.F90 index 4f3f2fc040..b7eab09b23 100644 --- a/src/chemistry/geoschem/mo_neu_wetdep.F90 +++ b/src/chemistry/geoschem/mo_neu_wetdep.F90 @@ -73,15 +73,15 @@ subroutine neu_wetdep_init ! ! find mapping to heff table ! - if ( debug ) then - print '(a,i4)','gas_wetdep_cnt=',gas_wetdep_cnt - print '(a,i4)','n_species_table=',n_species_table + if ( debug .and. masterproc ) then + print '(a,i4)','neu_wetdep_init: gas_wetdep_cnt=',gas_wetdep_cnt + print '(a,i4)','neu_wetdep_init: n_species_table=',n_species_table end if mapping_to_heff = -99 do m=1,gas_wetdep_cnt ! test_name = gas_wetdep_list(m) - if ( debug ) print '(i4,a)',m,trim(test_name) + if ( debug .and. masterproc ) print '(a,i4,a)','neu_wetdep_init: gas_wetdep_list species ',m,trim(test_name) ! ! ewl: this mapping can be replaced by including Henry's Law etc for all species, which makes usage of ! the parameters more transparent. I will comment out.... @@ -161,14 +161,12 @@ subroutine neu_wetdep_init !!! test_name = 'TSOG' !!! end select ! + if ( debug .and. masterproc ) print '(a,i4,a)','neu_wetdep_init: using name for mapping: ',m,trim(test_name) ! do l = 1,n_species_table -! -! if ( debug ) print '(i4,a)',l,trim(species_name_table(l)) -! if( trim(test_name) == trim( species_name_table(l) ) ) then mapping_to_heff(m) = l - if ( debug ) print '(a,a,i4)','mapping to heff of ',trim(species_name_table(l)),l + if ( debug .and. masterproc ) print '(a,a,i4)','neu_wetdep_init: found mapping to heff of ',trim(species_name_table(l)),l exit end if end do @@ -193,18 +191,18 @@ subroutine neu_wetdep_init if (any ( mapping_to_heff(:) == -99 )) call endrun('mo_neu_wet->depwetdep_init: unmapped species error' ) ! - if ( debug ) then - print '(a,i4)','co2_ndx',co2_ndx - print '(a,i4)','nh3_ndx',nh3_ndx + if ( debug .and. masterproc ) then + print '(a,i4)','neu_wetdep_init: co2_ndx',co2_ndx + print '(a,i4)','neu_wetdep_init: nh3_ndx',nh3_ndx end if ! ! find mapping to species ! mapping_to_mmr = -99 do m=1,gas_wetdep_cnt - if ( debug ) print '(i4,a)',m,trim(gas_wetdep_list(m)) + if ( debug .and. masterproc ) print '(a,i4,a)','neu_wetdep_init: ',m,trim(gas_wetdep_list(m)) call cnst_get_ind(gas_wetdep_list(m), mapping_to_mmr(m), abort=.false. ) - if ( debug ) print '(a,i4)','mapping_to_mmr ',mapping_to_mmr(m) + if ( debug .and. masterproc) print '(a,i4)','neu_wetdep_init: mapping_to_mmr ',mapping_to_mmr(m) if ( mapping_to_mmr(m) <= 0 ) then print *,'neu_wetdep_init: problem with mapping_to_mmr of ',gas_wetdep_list(m) call endrun('problem with mapping_to_mmr of '//trim(gas_wetdep_list(m))) @@ -216,7 +214,7 @@ subroutine neu_wetdep_init do m=1,gas_wetdep_cnt ! mol_weight(m) = cnst_mw(mapping_to_mmr(m)) - if ( debug ) print '(i4,a,f8.4)',m,' mol_weight ',mol_weight(m) + if ( debug .and. masterproc ) print '(a,i4,a,f8.4)','neu_wetdep_init: ',m,' mol_weight ',mol_weight(m) ice_uptake(m) = .false. if ( trim(gas_wetdep_list(m)) == 'HNO3' ) then ice_uptake(m) = .true. @@ -433,13 +431,24 @@ subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & end do end do ! - if ( debug ) then - print '(a,50f8.2)','tckaqb ',tckaqb - print '(a,50e12.4)','heff ',heff(1,1,:) - print '(a,50i4)' ,'ice_uptake ',ice_uptake - print '(a,50f8.2)','mol_weight ',mol_weight(:) - print '(a,50f8.2)','temp ',temp(1,:) - print '(a,50f8.2)','p ',p (1,:) + if ( debug .and. masterproc ) then + print '(a)','neu_wetdep_tend: ' + do m=1,gas_wetdep_cnt + print '(a,a)','wetdep species name: ',trim(gas_wetdep_list(m)) + l = mapping_to_heff(m) + print '(a,50e12.4)','dheff(1,l): ', dheff(1,l) + print '(a,50e12.4)','dheff(1,l): ', dheff(2,l) + print '(a,50e12.4)','dheff(1,l): ', dheff(3,l) + print '(a,50e12.4)','dheff(1,l): ', dheff(4,l) + print '(a,50e12.4)','dheff(1,l): ', dheff(5,l) + print '(a,50e12.4)','dheff(1,l): ', dheff(6,l) + print '(a,50f8.2)','tckaqb ',tckaqb(m) + print '(a,50e12.4)','heff ',heff(1,1,m) + print '(a,50i4)' ,'ice_uptake ',ice_uptake(m) + print '(a,50f8.2)','mol_weight ',mol_weight(m) + print '(a,50f8.2)','temp ',temp(1,m) + print '(a,50f8.2)','p ',p (1,m) + enddo end if ! ! call J. Neu's subroutine @@ -503,7 +512,7 @@ subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & ! ! to be used in mo_chm_diags to compute wet_deposition_NOy_as_N and wet_deposition_NHx_as_N (units: kg/m2/s) ! - if ( debug) print *,'mo_neu ',mapping_to_mmr(m),(wk_out(1:ncol)) + if ( debug .and. masterproc ) print *,'neu_wetdep_tend: ',mapping_to_mmr(m),(wk_out(1:ncol)) wd_tend_int(1:ncol,mapping_to_mmr(m)) = wk_out(1:ncol) ! end do @@ -625,7 +634,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & ! integer :: LWASHTYP,LICETYP ! - if ( debug ) then + if ( debug .and. masterproc ) then print '(a,50f8.2)','tckaqb ',tckaqb print '(a,50e12.4)','hstar ',hstar(1,:) print '(a,50i4)' ,'ice_uptake ',TCNION @@ -767,7 +776,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & !----------------------------------------------------------------------- FAX = max( zero,FAMA*(one - evaprate(l)) ) RAX = RAMA !kg/m2/s - if ( debug ) then + if ( debug .and. masterproc ) then if( (l == 3 .or. l == 2) ) then write(*,*) 'washout: l,rls,fax = ',l,rls(l),fax endif @@ -804,7 +813,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & endif RNEW = RLSOG(L) - (RAX*FAX + RCA*FCA) !GBA*CF rnew_wrk(l) = rnew_tst - if ( debug ) then + if ( debug .and. masterproc ) then if( is_hno3 .and. l == kdiag-1 ) then write(*,*) ' ' write(*,*) 'washout: rls,rax,fax,rca,fca' @@ -928,7 +937,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & WEMP = (CLWX*QM(L))/(GAREA*CFXX(L)*DELZ(L)) !kg/m3 REMP = RPRECIP/((RHORAIN/1.e3_r8)) !mm/s local DNEW = DEMPIRICAL( WEMP, REMP ) - if ( debug ) then + if ( debug .and. masterproc ) then if( is_hno3 .and. l >= 15 ) then write(*,*) ' ' write(*,*) 'washout: wemp,remp.dnew @ l = ',l @@ -959,7 +968,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & DEMP = zero DCXA = zero endif - if ( debug ) then + if ( debug .and. masterproc ) then if( is_hno3 .and. l >= 15 ) then write(*,*) ' ' write(*,*) 'washout: rca,rcxa,deltarime,dor,rprecip,dnew @ l = ',l @@ -994,7 +1003,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & QTRAINCXA = zero QTRAINCXB = zero endif - if( debug .and. is_hno3 .and. l == kdiag ) then + if( debug .and. masterproc .and. is_hno3 .and. l == kdiag ) then write(*,*) ' ' write(*,*) 'washout: Ice Scavenging' write(*,*) 'washout: qtraincxa, qtraincxb, fcxa, fcxb, qt_rain, cfxx(l), wrk @ level = ',l @@ -1021,7 +1030,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & HSTAR(L,N), TEM(L), POFL(L), & QM(L), QTCXA, QTDISRIME ) QTDISSTAR = (QTDISRIME*QTCXA)/(QTDISRIME + QTCXA) - if ( debug ) then + if ( debug .and. masterproc ) then if( is_hno3 .and. l >= 15 ) then write(*,*) ' ' write(*,*) 'washout: fcxa,dca,rca,qtdisstar @ l = ',l @@ -1099,7 +1108,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & WRK = QTRAIN/CFXX(L) QTRAINCXA = FCXA*WRK QTRAINCXB = FCXB*WRK - if( debug .and. is_hno3 .and. l == kdiag ) then + if( debug .and. masterproc .and. is_hno3 .and. l == kdiag ) then write(*,*) ' ' write(*,*) 'washout: Rain Scavenging' write(*,*) 'washout: qtraincxa, qtraincxb, fcxa, fcxb, qt_rain, cfxx(l), wrk @ level = ',l @@ -1221,7 +1230,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & QTEVAPAXP = min( QTTOPAA,QTTOPAA - (RAMPCT*(QTTOPAA-QTEVAPAXP)) ) FAX = FAXADJ RAX = RAXADJ - if ( debug ) then + if ( debug .and. masterproc ) then if( (l == 3 .or. l == 2) ) then write(*,*) 'washout: l,fcxa,fax = ',l,fcxa,fax endif @@ -1375,7 +1384,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & else CFXX(LM1) = CFR(LM1) endif - if( is_hno3 .and. lm1 == kdiag .and. debug ) then + if( is_hno3 .and. lm1 == kdiag .and. debug .and. masterproc ) then write(*,*) ' ' write(*,*) 'washout: rls,garea,rcxa,fcxa,rcxb,fcxb,rax,fax' write(*,'(1p,8g15.7)') rls(lm1),garea,rcxa,fcxa,rcxb,fcxb,rax,fax @@ -1422,7 +1431,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & ! Maintain cloud core by reducing NC and AM area going into cloud below !----------------------------------------------------------------------- RCA = (RCXA*FCXA*CLOLDPCT + RCXB*FCXB*CLNEWPCT + RAX*FAX*AMCLPCT)/FCA - if ( debug ) then + if ( debug .and. masterproc ) then if( is_hno3 ) then write(*,*) ' ' write(*,*) 'washout: rcxa,fcxa,cloldpctrca,rca,fca,dcxa @ l = ',l @@ -1531,13 +1540,13 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & frc(l,2) = qtnetlcxb frc(l,3) = qtnetlax endif - if( debug .and. is_hno3 .and. l == kdiag ) then + if( debug .and. masterproc .and. is_hno3 .and. l == kdiag ) then write(*,*) ' ' write(*,*) 'washout: qtraincxa, qtraincxb, qtrimecxa @ level = ',l write(*,'(1p,3g15.7)') qtraincxa, qtraincxb, qtrimecxa write(*,*) ' ' endif - if ( debug ) then + if ( debug .and. masterproc ) then if( (l == 3 .or. l == 2) ) then write(*,*) 'washout: hno3, hno3, qtnetlca,b, qtnetlax @ level = ',l write(*,'(1p,5g15.7)') qttnew(l), qtt(l), qtnetlcxa, qtnetlcxb, qtnetlax @@ -1552,7 +1561,7 @@ subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & QTTOPAA = QTTOPAAX end do level_loop - if ( debug ) then + if ( debug .and. masterproc) then if( is_hno3 ) then write(*,*) ' ' write(*,*) 'washout: clwx_wrk' From 9fed226d09da69abec0d9183554a07d5738b0567 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 4 Aug 2022 09:21:39 -0600 Subject: [PATCH 039/160] Preliminary updates for GEOS-Chem 14.0 Signed-off-by: Lizzie Lundgren --- bld/configure | 2 +- bld/namelist_files/namelist_defaults_cam.xml | 1 + cime_config/buildnml | 14 +- src/chemistry/geoschem/cesmgc_diag_mod.F90 | 46 +++--- src/chemistry/geoschem/chem_mods.F90 | 2 +- src/chemistry/geoschem/chemistry.F90 | 149 ++++++++++--------- src/chemistry/geoschem/mo_sim_dat.F90 | 53 ++++--- 7 files changed, 141 insertions(+), 126 deletions(-) diff --git a/bld/configure b/bld/configure index 5324dbd63a..b5604f3860 100755 --- a/bld/configure +++ b/bld/configure @@ -1404,7 +1404,7 @@ if ($chem_pkg =~ '_mam3') { # TMMF - wedge in GEOS-Chem CPP definitions here if ($chem_pkg =~ 'geoschem') { $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING -DLINUX_IFORT -DUSE_REAL8 -DMODEL_ -DMODEL_CESM'; - $chem_nadv = 252; + $chem_nadv = 266; if (defined $opts{'clm_vers'}) { if ($opts{'clm_vers'} =~ 'CLM4.0') { $chem_cppdefs .= ' -DCLM40' diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 19a8a6f13d..dc8b169857 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -3237,6 +3237,7 @@ + atm/cam/chem/trop_mozart/dvel/dep_data_c201019.nc +/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc atm/waccm/phot/effxstex.txt @@ -3233,13 +3234,13 @@ -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HMS','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index e00c569961..7ced1d5107 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -11,7 +11,7 @@ module chemistry use constituents, only : pcnst, cnst_add, cnst_get_ind use constituents, only : cnst_name use shr_const_mod, only : molw_dryair=>SHR_CONST_MWDAIR - use seq_drydep_mod, only : nddvels => n_drydep, drydep_list + use shr_drydep_mod, only : nddvels => n_drydep, drydep_list use spmd_utils, only : MasterProc, myCPU=>Iam, nCPUs=>npes use cam_logfile, only : iulog use string_utils, only : to_upper @@ -164,11 +164,11 @@ module chemistry CHARACTER(LEN=255) :: ThisLoc CHARACTER(LEN=255) :: ErrMsg -! ewl: comment out defining files used only for dry deposition +! ewl: comment out certain files used only for dry deposition ! ! Filenames to compute dry deposition velocities similarly to MOZART ! character(len=shr_kind_cl) :: clim_soilw_file = 'clim_soilw_file' ! character(len=shr_kind_cl) :: depvel_file = '' -! character(len=shr_kind_cl) :: depvel_lnd_file = 'depvel_lnd_file' + character(len=shr_kind_cl) :: depvel_lnd_file = 'depvel_lnd_file' ! character(len=shr_kind_cl) :: season_wes_file = 'season_wes_file' ! ! character(len=shr_kind_cl) :: srf_emis_specifier(pcnst) = '' @@ -696,12 +696,14 @@ subroutine chem_readnl(nlfile) ! Assume a successful return until otherwise RC = GC_SUCCESS -! ewl: remove 4 entries from chem_inparm used for dry deposition: -! clim_soilw_file, depvel_file, depvel_lnd_file, season_wes_file; -! remove ext_frc_ and srf_emis_ ones too. +! ewl: remove several entries from chem_inparm used for dry deposition: +! clim_soilw_file, depvel_file, season_wes_file; ! The following files are required to compute land maps, required to perform ! aerosol dry deposition - namelist /chem_inparm/ lght_no_prd_factor +!ewl: need to play around with need to include these (ext_* and srf_*) for drydep + namelist /chem_inparm/ lght_no_prd_factor, & + depvel_lnd_file +!, & ! ext_frc_specifier, & ! ext_frc_type, & ! ext_frc_cycle_yr, & @@ -885,7 +887,7 @@ subroutine chem_readnl(nlfile) ! ewl: remove broadcast of 4 files used for dry deposition only; srf_emis and ext_frc too. ! The following files are required to compute land maps, required to perform ! aerosol dry deposition -! CALL MPIBCAST (depvel_lnd_file, LEN(depvel_lnd_file), MPICHAR, 0, MPICOM) + CALL MPIBCAST (depvel_lnd_file, LEN(depvel_lnd_file), MPICHAR, 0, MPICOM) ! CALL MPIBCAST (clim_soilw_file, LEN(clim_soilw_file), MPICHAR, 0, MPICOM) ! CALL MPIBCAST (season_wes_file, LEN(season_wes_file), MPICHAR, 0, MPICOM) @@ -980,8 +982,6 @@ subroutine chem_init(phys_state, pbuf2d) use Phys_Grid, only : get_Area_All_p use hycoef, only : ps0, hyai, hybi, hyam -!ewl: comment out below following fvitt updates -! use seq_drydep_mod, only : drydep_method, DD_XLND, DD_XATM use gas_wetdep_opts, only : gas_wetdep_method use mo_neu_wetdep, only : neu_wetdep_init @@ -1513,17 +1513,8 @@ subroutine chem_init(phys_state, pbuf2d) ! Initialize aerosols CALL aero_model_init( pbuf2d ) -! ewl: Comment out initializing land maps for aerosol dry deposition. -! ! Initialize land maps for aerosol dry deposition -! IF ( drydep_method == DD_XATM .OR. drydep_method == DD_XLND ) THEN -! CALL drydep_inti( depvel_lnd_file, & -! clim_soilw_file, & -! season_wes_file ) -! ELSE -! IF ( masterProc ) Write(iulog,'(a,a)') ' drydep_method is set to: ', TRIM(drydep_method) -! CALL ENDRUN('drydep_method must be DD_XLND or DD_XATM to compute land '// & -! 'maps for aerosol dry deposition!') -! ENDIF + ! Initialize drydep + CALL drydep_inti( depvel_lnd_file) #endif IF ( gas_wetdep_method == 'NEU' ) THEN From e565c302bcb875b737d41ea33084f28755797b83 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 13 Sep 2022 14:13:42 -0600 Subject: [PATCH 043/160] Change geoschem .exclude file to use relative paths to files Previously file only contained filenames. This update should be used with CIME updates submitted in: ESMCI/cime#4180 ESMCI/cime#4302 Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/.exclude | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/chemistry/geoschem/.exclude b/src/chemistry/geoschem/.exclude index b8418763c5..3629106b6e 100644 --- a/src/chemistry/geoschem/.exclude +++ b/src/chemistry/geoschem/.exclude @@ -1,20 +1,20 @@ -regrid_a2a_mod.F90 -transport_mod.F90 -tpcore_window_mod.F90 -tpcore_fvdas_mod.F90 -flexgrid_read_mod.F90 -get_met_mod.F90 -planeflight_mod.F90 -diag1.F90 -diag03_mod.F90 -diag3.F90 -diag51_mod.F90 -diag51b_mod.F90 -diag53_mod.F90 -emissions_mod.F90 -gamap_mod.F90 -gosat_ch4_mod.F90 -tccon_ch4_mod.F90 -initialize.F90 -cleanup.F90 -main.F90 +geoschem_src/GeosCore/regrid_a2a_mod.F90 +geoschem_src/GeosCore/transport_mod.F90 +geoschem_src/GeosCore/tpcore_window_mod.F90 +geoschem_src/GeosCore/tpcore_fvdas_mod.F90 +geoschem_src/GeosCore/flexgrid_read_mod.F90 +geoschem_src/GeosCore/get_met_mod.F90 +geoschem_src/GeosCore/planeflight_mod.F90 +geoschem_src/GeosCore/diag1.F90 +geoschem_src/GeosCore/diag03_mod.F90 +geoschem_src/GeosCore/diag3.F90 +geoschem_src/GeosCore/diag51_mod.F90 +geoschem_src/GeosCore/diag51b_mod.F90 +geoschem_src/GeosCore/diag53_mod.F90 +geoschem_src/GeosCore/emissions_mod.F90 +geoschem_src/GeosCore/gamap_mod.F90 +geoschem_src/GeosCore/gosat_ch4_mod.F90 +geoschem_src/GeosCore/tccon_ch4_mod.F90 +geoschem_src/GeosCore/initialize.F90 +geoschem_src/GeosCore/cleanup.F90 +geoschem_src/Interfaces/GC-Classic/main.F90 From 03f75fdc3aeecaf12342e27972750c5c0003c0d4 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 13 Sep 2022 14:15:09 -0600 Subject: [PATCH 044/160] Clean up new debug print code in physpkg.F90 Local debug option can be enabled in the source code to print messages before and after chem_timestep_tend and aero_model_drydep are called. Prints are off by default. Signed-off-by: Lizzie Lundgren --- src/physics/cam/physpkg.F90 | 61 +++++++++++++++---------------------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index 21a3fa6b94..0434870e8f 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -1410,6 +1410,7 @@ subroutine tphysac (ztodt, cam_in, & integer :: ixq logical :: labort ! abort flag + logical :: debug ! enable status prints real(r8) tvm(pcols,pver) ! virtual temperature real(r8) prect(pcols) ! total precipitation @@ -1445,6 +1446,8 @@ subroutine tphysac (ztodt, cam_in, & nstep = get_nstep() call cnst_get_ind('Q', ixq) + debug = .false. + ! Adjust the surface fluxes to reduce instabilities in near sfc layer if (phys_do_flux_avg()) then call flux_avg_run(state, cam_in, pbuf, nstep, ztodt) @@ -1563,19 +1566,15 @@ subroutine tphysac (ztodt, cam_in, & !=================================================== if (chem_is_active()) then - if (masterproc) print *, "ewl: cam/physpkg.F90: before chemistry" - if (trim(cam_take_snapshot_before) == "chem_timestep_tend") then call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& fh2o, surfric, obklen, flx_heat) end if - if (masterproc) print *, "ewl: cam/physpkg.F90: before chem_timestep_tend" - + if (debug .and. masterproc) print *, "cam/physpkg.F90: calling chem_timestep_tend" call chem_timestep_tend(state, ptend, cam_in, cam_out, ztodt, & pbuf, fh2o=fh2o) - - if (masterproc) print *, "ewl: cam/physpkg.F90: chem_timestep_tend complete" + if (debug .and. masterproc) print *, "cam/physpkg.F90: chem_timestep_tend complete" if ( (trim(cam_take_snapshot_after) == "chem_timestep_tend") .and. & (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then @@ -1598,8 +1597,6 @@ subroutine tphysac (ztodt, cam_in, & ! Call vertical diffusion code (pbl, free atmosphere and molecular) !=================================================== - if (masterproc) print *, "ewl: cam/physpkg.F90: before vertical diffusion" - call t_startf('vertical_diffusion_tend') if (trim(cam_take_snapshot_before) == "vertical_diffusion_section") then @@ -1614,8 +1611,6 @@ subroutine tphysac (ztodt, cam_in, & ! Call major diffusion for extended model !------------------------------------------ - if (masterproc) print *, "ewl: cam/physpkg.F90: before major diffusion" - if ( waccmx_is('ionosphere') .or. waccmx_is('neutral') ) then call waccmx_phys_mspd_tend (ztodt ,state ,ptend) endif @@ -1643,8 +1638,6 @@ subroutine tphysac (ztodt, cam_in, & ! Rayleigh friction calculation !=================================================== - if (masterproc) print *, "ewl: cam/physpkg.F90: before rayleigh friction calculation" - call t_startf('rayleigh_friction') call rayleigh_friction_tend( ztodt, state, ptend) if ( ptend%lu ) then @@ -1668,25 +1661,26 @@ subroutine tphysac (ztodt, cam_in, & ! aerosol dry deposition processes call t_startf('aero_drydep') - if (masterproc) print *, "ewl: cam/physpkg.F90: before aerosol dry deposition processes...skipping!" + if (trim(cam_take_snapshot_before) == "aero_model_drydep") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if -! ewl: turn off aerosol dry deposition -! if (trim(cam_take_snapshot_before) == "aero_model_drydep") then -! call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& -! fh2o, surfric, obklen, flx_heat) -! end if -! -! call aero_model_drydep( state, pbuf, obklen, surfric, cam_in, ztodt, cam_out, ptend ) -! if ( (trim(cam_take_snapshot_after) == "aero_model_drydep") .and. & -! (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then -! call cam_snapshot_ptend_outfld(ptend, lchnk) -! end if -! call physics_update(state, ptend, ztodt, tend) -! -! if (trim(cam_take_snapshot_after) == "aero_model_drydep") then -! call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& -! fh2o, surfric, obklen, flx_heat) -! end if + if (debug .and. masterproc) print *, "cam/physpkg.F90: calling aero_model_drydep" + + call aero_model_drydep( state, pbuf, obklen, surfric, cam_in, ztodt, cam_out, ptend ) + if ( (trim(cam_take_snapshot_after) == "aero_model_drydep") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (debug .and. masterproc) print *, "cam/physpkg.F90: aero_model_drydep complete" + + if (trim(cam_take_snapshot_after) == "aero_model_drydep") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if call t_stopf('aero_drydep') @@ -1699,8 +1693,6 @@ subroutine tphysac (ztodt, cam_in, & ! can be added to for CARMA aerosols. if (carma_do_aerosol) then - if (masterproc) print *, "ewl: cam/physpkg.F90: before carma microphysics" - call t_startf('carma_timestep_tend') call carma_timestep_tend(state, cam_in, cam_out, ptend, ztodt, pbuf, obklen=obklen, ustar=surfric) call physics_update(state, ptend, ztodt, tend) @@ -1713,7 +1705,6 @@ subroutine tphysac (ztodt, cam_in, & !--------------------------------------------------------------------------------- ! ... enforce charge neutrality !--------------------------------------------------------------------------------- - if (masterproc) print *, "ewl: cam/physpkg.F90: before enforcing charge neutrality" call charge_balance(state, pbuf) @@ -1722,8 +1713,6 @@ subroutine tphysac (ztodt, cam_in, & !=================================================== call t_startf('gw_tend') - if (masterproc) print *, "ewl: cam/physpkg.F90: before gravity wave drag" - if (trim(cam_take_snapshot_before) == "gw_tend") then call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& fh2o, surfric, obklen, flx_heat) @@ -1810,8 +1799,6 @@ subroutine tphysac (ztodt, cam_in, & ! Call ionosphere routines for extended model if mode is set to ionosphere !---------------------------------------------------------------------------- - if (masterproc) print *, "ewl: cam/physpkg.F90: before ionosphere routines" - if( waccmx_is('ionosphere') ) then call waccmx_phys_ion_elec_temp_tend(state, ptend, pbuf, ztodt) endif From e8b0747d5027b3549be5bcd2a5e59dfd8427dea5 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 13 Sep 2022 14:16:27 -0600 Subject: [PATCH 045/160] Expand error prints in constituents module for clarify Signed-off-by: Lizzie Lundgren --- src/physics/cam/constituents.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/constituents.F90 b/src/physics/cam/constituents.F90 index 528f254497..a9eb721dc1 100644 --- a/src/physics/cam/constituents.F90 +++ b/src/physics/cam/constituents.F90 @@ -174,7 +174,7 @@ subroutine cnst_add (name, mwc, cpc, qminc, & padv = padv+1 ind = padv if (padv > pcnst) then - write(errmsg, *) sub//': FATAL: advected tracer index greater than pcnst=', pcnst + write(errmsg, *) sub//': FATAL: advected tracer (', trim(name), ') index for greater than pcnst=', pcnst call endrun(errmsg) end if @@ -380,7 +380,7 @@ subroutine cnst_get_ind (name, ind, abort) if (present(abort)) abort_on_error = abort if (abort_on_error) then - write(iulog, *) sub//': FATAL: name:', name, ' not found in list:', cnst_name(:) + write(iulog, *) sub//': FATAL: name:', name, ' not found in constituent list: ', cnst_name(:) call endrun(sub//': FATAL: name not found') end if From a11b7e867fb9d208b1f2061a55a7444faab7b150 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 13 Sep 2022 14:24:36 -0600 Subject: [PATCH 046/160] Remove online land type option when using GEOS-Chem and use Olson/XLAI Dry deposition in GEOS-Chem now uses a combination of CLM dry deposition velocities and GEOS-Chem computed velocities which is determined by presence of ocean (100% CLM velocities if no ocean, 100% GEOS-Chem velocities if all ocean, and a scaled value of the two if in between). This update also uncomments several code that set State_Met fields, and the logicals for CLM drydep vel and online land type is removed (the former is effectively now always true and the latter is always false). Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chemistry.F90 | 318 ++++++++++++--------------- 1 file changed, 137 insertions(+), 181 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 7ced1d5107..a464440428 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -1181,16 +1181,6 @@ subroutine chem_init(phys_state, pbuf2d) ! -> False (read monthly-mean albedo from HEMCO) Input_Opt%onlineAlbedo = .False. -! ewl: Change using online land types from true to false - ! onlineLandTypes -> True (use CLM landtypes) - ! -> False (read landtypes from HEMCO) - Input_Opt%onlineLandTypes = .False. - -! ewl: Change using CLM dry dep velocities from false to true - ! ddVel_CLM -> True (use CLM dry deposition velocities) - ! -> False (let GEOS-Chem compute dry deposition velocities) - Input_Opt%ddVel_CLM = .True. - ! applyQtend: apply tendencies of water vapor to specific humidity Input_Opt%applyQtend = .False. @@ -2638,78 +2628,55 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) State_Met(LCHNK)%EFLUX (1,:nY) = cam_in%Lhf(:nY) State_Met(LCHNK)%HFLUX (1,:nY) = cam_in%Shf(:nY) -! ewl: Comment out setting State_Met fields LandTypeFrac and XLAI_NATIVE. Note -! that onlineLandTypes is now false. -! ! Field : LandTypeFrac -! ! Description: Olson fraction per type -! ! Unit : - (between 0 and 1) -! ! Dimensions : nX, nY, NSURFTYPE -! ! Note : Index 1 is water -! IF ( Input_Opt%onlineLandTypes ) THEN -! ! Fill in water -! State_Met(LCHNK)%LandTypeFrac(1,:nY,1) = cam_in%ocnFrac(:nY) & -! + cam_in%iceFrac(:nY) -! IF ( .NOT. Input_Opt%ddVel_CLM ) THEN -! CALL getLandTypes( cam_in, & -! nY, & -! State_Met(LCHNK) ) -! ENDIF -! ELSE -! DO N = 1, NSURFTYPE -! Write(FieldName, '(a,i2.2)') 'HCO_LANDTYPE', N-1 -! tmpIdx = pbuf_get_index(FieldName, rc) -! IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN -! IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) -! ELSE -! CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) -! DO J = 1, nY -! State_Met(LCHNK)%LandTypeFrac(1,J,N) = pbuf_i(J) -! ENDDO -! pbuf_i => NULL() -! ENDIF -! -! Write(FieldName, '(a,i2.2)') 'HCO_XLAI', N-1 -! tmpIdx = pbuf_get_index(FieldName, rc) -! IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN -! IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) -! ELSE -! CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) -! DO J = 1, nY -! State_Met(LCHNK)%XLAI_NATIVE(1,J,N) = pbuf_i(J) -! ENDDO -! pbuf_i => NULL() -! ENDIF -! ENDDO -! ENDIF - -! ewl: Comment out setting State_Met fields FR* for CLND, LAND, OCEAN, -! SEAICE, LAKE, and LANDIC. If not getting land type from CLM need to -! figure out how to set these. -! ! Field : FRCLND, FRLAND, FROCEAN, FRSEAICE, FRLAKE, FRLANDIC -! ! Description: Olson land fraction -! ! Fraction of land -! ! Fraction of ocean -! ! Fraction of sea ice -! ! Fraction of lake -! ! Fraction of land ice -! ! Fraction of snow -! ! Unit : - -! ! Dimensions : nX, nY -! State_Met(LCHNK)%FRCLND (1,:ny) = 1.e+0_fp - & -! State_Met(LCHNK)%LandTypeFrac(1,:nY,1) ! Olson Land Fraction -! State_Met(LCHNK)%FRLAND (1,:nY) = cam_in%landFrac(:nY) -! State_Met(LCHNK)%FROCEAN (1,:nY) = cam_in%ocnFrac(:nY) + cam_in%iceFrac(:nY) -! State_Met(LCHNK)%FRSEAICE (1,:nY) = cam_in%iceFrac(:nY) -! IF ( Input_Opt%onlineLandTypes ) THEN -! State_Met(LCHNK)%FRLAKE (1,:nY) = cam_in%lwtgcell(:,3) + & -! cam_in%lwtgcell(:,4) -! State_Met(LCHNK)%FRLANDIC (1,:nY) = cam_in%lwtgcell(:,2) -! State_Met(LCHNK)%FRSNO (1,:nY) = 0.0e+0_fp -! ELSE -! State_Met(LCHNK)%FRLAKE (1,:nY) = 0.0e+0_fp -! State_Met(LCHNK)%FRLANDIC (1,:nY) = 0.0e+0_fp -! State_Met(LCHNK)%FRSNO (1,:nY) = 0.0e+0_fp -! ENDIF + ! Field : LandTypeFrac + ! Description: Olson fraction per type + ! Unit : - (between 0 and 1) + ! Dimensions : nX, nY, NSURFTYPE + ! Note : Index 1 is water + DO N = 1, NSURFTYPE + Write(FieldName, '(a,i2.2)') 'HCO_LANDTYPE', N-1 + tmpIdx = pbuf_get_index(FieldName, rc) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) + ELSE + CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) + DO J = 1, nY + State_Met(LCHNK)%LandTypeFrac(1,J,N) = pbuf_i(J) + ENDDO + pbuf_i => NULL() + ENDIF + + Write(FieldName, '(a,i2.2)') 'HCO_XLAI', N-1 + tmpIdx = pbuf_get_index(FieldName, rc) + IF ( tmpIdx < 0 .or. ( iStep == 1 ) ) THEN + IF ( rootChunk ) Write(iulog,*) "chem_timestep_tend: Field not found ", TRIM(FieldName) + ELSE + CALL pbuf_get_field(pbuf, tmpIdx, pbuf_i) + DO J = 1, nY + State_Met(LCHNK)%XLAI_NATIVE(1,J,N) = pbuf_i(J) + ENDDO + pbuf_i => NULL() + ENDIF + ENDDO + + ! Field : FRCLND, FRLAND, FROCEAN, FRSEAICE, FRLAKE, FRLANDIC + ! Description: Olson land fraction + ! Fraction of land + ! Fraction of ocean + ! Fraction of sea ice + ! Fraction of lake + ! Fraction of land ice + ! Fraction of snow + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%FRCLND (1,:ny) = 1.e+0_fp - & + State_Met(LCHNK)%LandTypeFrac(1,:nY,1) ! Olson Land Fraction + State_Met(LCHNK)%FRLAND (1,:nY) = cam_in%landFrac(:nY) + State_Met(LCHNK)%FROCEAN (1,:nY) = cam_in%ocnFrac(:nY) + cam_in%iceFrac(:nY) + State_Met(LCHNK)%FRSEAICE (1,:nY) = cam_in%iceFrac(:nY) + State_Met(LCHNK)%FRLAKE (1,:nY) = 0.0e+0_fp + State_Met(LCHNK)%FRLANDIC (1,:nY) = 0.0e+0_fp + State_Met(LCHNK)%FRSNO (1,:nY) = 0.0e+0_fp ! Field : GWETROOT, GWETTOP ! Description: Root and top soil moisture @@ -3206,48 +3173,46 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF (Input_Opt%LSETH2O) Input_Opt%LSETH2O = .FALSE. ENDIF -! ewl: Turn off over-writing isLand, isWater, and isIce with CLM land imports, -! and set isSnow to if SNODP > 0.01 (removes dependency on CLM land) ! Do this after AirQnt, such that we overwrite GEOS-Chem isLand, isWater and ! isIce, which are based on albedo. Rather, we use CLM landFranc, ocnFrac ! and iceFrac. We also compute isSnow DO J = 1, nY -! iMaxLoc = MAXLOC( (/ State_Met(LCHNK)%FRLAND(1,J) + & -! State_Met(LCHNK)%FRLANDIC(1,J) + & -! State_Met(LCHNK)%FRLAKE(1,J), & -! State_Met(LCHNK)%FRSEAICE(1,J), & -! State_Met(LCHNK)%FROCEAN(1,J) - & -! State_Met(LCHNK)%FRSEAICE(1,J) /) ) -! IF ( iMaxLoc(1) == 3 ) iMaxLoc(1) = 0 -! ! reset ocean to 0 -! -! ! Field : LWI -! ! Description: Land/water indices -! ! Unit : - -! ! Dimensions : nX, nY -! State_Met(LCHNK)%LWI(1,J) = FLOAT( iMaxLoc(1) ) -! -! IF ( iMaxLoc(1) == 0 ) THEN -! State_Met(LCHNK)%isLand(1,J) = .False. -! State_Met(LCHNK)%isWater(1,J) = .True. -! State_Met(LCHNK)%isIce(1,J) = .False. -! ELSEIF ( iMaxLoc(1) == 1 ) THEN -! State_Met(LCHNK)%isLand(1,J) = .True. -! State_Met(LCHNK)%isWater(1,J) = .False. -! State_Met(LCHNK)%isIce(1,J) = .False. -! ELSEIF ( iMaxLoc(1) == 2 ) THEN -! State_Met(LCHNK)%isLand(1,J) = .False. -! State_Met(LCHNK)%isWater(1,J) = .False. -! State_Met(LCHNK)%isIce(1,J) = .True. -! ELSE -! Write(iulog,*) " iMaxLoc gets value: ", iMaxLoc -! ErrMsg = 'Failed to figure out land/water' -! CALL Error_Stop( ErrMsg, ThisLoc ) -! ENDIF -! -! State_Met(LCHNK)%isSnow(1,J) = ( State_Met(LCHNK)%FRSEAICE(1,J) > 0.0e+0_fp & -! .or. State_Met(LCHNK)%SNODP(1,J) > 0.01 ) - State_Met(LCHNK)%isSnow(1,J) = ( State_Met(LCHNK)%SNODP(1,J) > 0.01 ) + iMaxLoc = MAXLOC( (/ State_Met(LCHNK)%FRLAND(1,J) + & + State_Met(LCHNK)%FRLANDIC(1,J) + & + State_Met(LCHNK)%FRLAKE(1,J), & + State_Met(LCHNK)%FRSEAICE(1,J), & + State_Met(LCHNK)%FROCEAN(1,J) - & + State_Met(LCHNK)%FRSEAICE(1,J) /) ) + IF ( iMaxLoc(1) == 3 ) iMaxLoc(1) = 0 + ! reset ocean to 0 + + ! Field : LWI + ! Description: Land/water indices + ! Unit : - + ! Dimensions : nX, nY + State_Met(LCHNK)%LWI(1,J) = FLOAT( iMaxLoc(1) ) + + IF ( iMaxLoc(1) == 0 ) THEN + State_Met(LCHNK)%isLand(1,J) = .False. + State_Met(LCHNK)%isWater(1,J) = .True. + State_Met(LCHNK)%isIce(1,J) = .False. + ELSEIF ( iMaxLoc(1) == 1 ) THEN + State_Met(LCHNK)%isLand(1,J) = .True. + State_Met(LCHNK)%isWater(1,J) = .False. + State_Met(LCHNK)%isIce(1,J) = .False. + ELSEIF ( iMaxLoc(1) == 2 ) THEN + State_Met(LCHNK)%isLand(1,J) = .False. + State_Met(LCHNK)%isWater(1,J) = .False. + State_Met(LCHNK)%isIce(1,J) = .True. + ELSE + Write(iulog,*) " iMaxLoc gets value: ", iMaxLoc + ErrMsg = 'Failed to figure out land/water' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + + State_Met(LCHNK)%isSnow(1,J) = & + ( State_Met(LCHNK)%FRSEAICE(1,J) > 0.0e+0_fp & + .or. State_Met(LCHNK)%SNODP(1,J) > 0.01 ) ENDDO @@ -3492,22 +3457,15 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) !================================================================== ! Compute dry deposition velocities ! - ! CLM computes dry deposition velocities over land. - ! We need to merge the land component passed through cam_in and - ! the ocn/ice dry deposition velocities. - ! - ! If using the CLM velocities, then use GEOS-Chem's dry deposition - ! module to compute velocities and then scale them with the ocean - ! fraction (Input_Opt%ddVel_CLM) - ! - ! A second option would be to let GEOS-Chem compute dry deposition - ! velocity, thus overwriting the input from CLM + ! CLM computes dry deposition velocities but only for gas-phase + ! species and only over land. We therefore need to both pass the + ! the CLM dry deposition velocities as well as compute them using + ! the GEOS-Chem dry deposition module. If using the CLM velocities, + ! then scale them with the ocean fraction; otherwise use GEOS-Chem + ! computed velocities. ! ! drydep_method must be set to DD_XLND. ! - ! The GEOS-Chem option (.not. Input_Opt%ddVel_CLM) option coupled - ! with Input_Opt%onlineLandTypes requires that CLM passes land - ! type information (land type and leaf area index). !================================================================== ! ! State_Chm expects dry deposition velocities in m/s, whereas @@ -3515,7 +3473,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! ! For now, dry deposition velocities are only computed for gases ! (which is what CLM deals with). Dry deposition for aerosols is - ! work in progress. + ! work in progress. <-- ewl...is this still true??? ! ! Thibaud M. Fritz - 27 Feb 2020 !================================================================== @@ -3561,53 +3519,51 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF - IF ( Input_Opt%ddVel_CLM ) THEN - DO N = 1, nddvels - - !! Print debug - !IF ( rootChunk ) THEN - ! IF ( N == 1 ) THEN - ! Write(iulog,*) "Number of GC dry deposition species = ", & - ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) - ! Write(iulog,*) "Number of CESM dry deposition species = ", & - ! nddvels - ! ENDIF - ! Write(iulog,*) "N = ", N - ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) - ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) - ! IF ( map2GC_dryDep(N) > 0 ) THEN - ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) - ! ENDIF - ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) - ! IF ( drySpc_ndx(N) > 0 ) THEN - ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) - ! ENDIF - ! Write(iulog,*) "CLM-depVel = ", & - ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]" - ! IF ( map2GC_dryDep(N) > 0 ) THEN - ! Write(iulog,*) "GC-depVel = ", & - ! MAXVAL(State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N))), " [m/s]" - ! ENDIF - !ENDIF - - IF ( map2GC_dryDep(N) > 0 ) THEN - ! State_Chm%DryDepVel is in m/s - State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & - ! This first bit corresponds to the dry deposition - ! velocities over land as computed from CLM and - ! converted to m/s. This is scaled by the fraction - ! of land. - cam_in%depVel(:nY,N) * 1.0e-02_fp & - * MAX(0._fp, 1.0_fp - State_Met(LCHNK)%FROCEAN(1,:nY)) & - ! This second bit corresponds to the dry deposition - ! velocities over ocean and sea ice as computed from - ! GEOS-Chem. This is scaled by the fraction of ocean - ! and sea ice. - + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) & - * State_Met(LCHNK)%FROCEAN(1,:nY) - ENDIF - ENDDO - ENDIF + DO N = 1, nddvels + + !! Print debug + !IF ( rootChunk ) THEN + ! IF ( N == 1 ) THEN + ! Write(iulog,*) "Number of GC dry deposition species = ", & + ! SIZE(State_Chm(LCHNK)%DryDepVel(:,:,:),3) + ! Write(iulog,*) "Number of CESM dry deposition species = ", & + ! nddvels + ! ENDIF + ! Write(iulog,*) "N = ", N + ! Write(iulog,*) "drySpc_ndx = ", drySpc_ndx(N) + ! Write(iulog,*) "GC index = ", map2GC_dryDep(N) + ! IF ( map2GC_dryDep(N) > 0 ) THEN + ! Write(iulog,*) "GC name = ", TRIM(DEPNAME(map2GC_dryDep(N))) + ! ENDIF + ! Write(iulog,*) "dry Species= ", TRIM(drydep_list(N)) + ! IF ( drySpc_ndx(N) > 0 ) THEN + ! Write(iulog,*) "tracerName = ", TRIM(tracerNames(drySpc_ndx(N))) + ! ENDIF + ! Write(iulog,*) "CLM-depVel = ", & + ! MAXVAL(cam_in%depvel(:nY,N)) * 1.0e-02_fp, " [m/s]" + ! IF ( map2GC_dryDep(N) > 0 ) THEN + ! Write(iulog,*) "GC-depVel = ", & + ! MAXVAL(State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N))), " [m/s]" + ! ENDIF + !ENDIF + + IF ( map2GC_dryDep(N) > 0 ) THEN + ! State_Chm%DryDepVel is in m/s + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) = & + ! This first bit corresponds to the dry deposition + ! velocities over land as computed from CLM and + ! converted to m/s. This is scaled by the fraction + ! of land. + cam_in%depVel(:nY,N) * 1.0e-02_fp & + * MAX(0._fp, 1.0_fp - State_Met(LCHNK)%FROCEAN(1,:nY)) & + ! This second bit corresponds to the dry deposition + ! velocities over ocean and sea ice as computed from + ! GEOS-Chem. This is scaled by the fraction of ocean + ! and sea ice. + + State_Chm(LCHNK)%DryDepVel(1,:nY,map2GC_dryDep(N)) & + * State_Met(LCHNK)%FROCEAN(1,:nY) + ENDIF + ENDDO CALL Update_DryDepFreq( Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & From 3a27896fcc5da4ce0e9d361d98ce20ecc637a95c Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 16 Sep 2022 13:40:42 -0600 Subject: [PATCH 047/160] Update GEOS-Chem chemistry log messages for clarity Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chemistry.F90 | 42 ++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index a464440428..efc8bd6c20 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -34,6 +34,9 @@ module chemistry use chem_mods, only : nSlvd, slvd_Lst, slvd_ref_MMR + !-------------------------------------------------------------------- + ! CAM modules + !-------------------------------------------------------------------- ! Exit routine in CAM use cam_abortutils, only : endrun @@ -263,6 +266,8 @@ subroutine chem_register ! Initialize pointer ThisSpc => NULL() + if (debug .and. masterproc) write(iulog,'(a)') 'chem_register: registering advected constituents for GEOS-Chem chemistry' + ! SDE 2018-05-02: This seems to get called before anything else ! that includes CHEM_INIT ! At this point, mozart calls SET_SIM_DAT, which is specified by each @@ -501,16 +506,21 @@ subroutine chem_register ! More information: ! http://www.cesm.ucar.edu/models/atm-cam/docs/phys-interface/node5.html + if (debug .and. masterproc) write(iulog,'(a,i4,a)') 'chem_register: looping over gas_pcnst (length', gas_pcnst, ') to map solsym onto GEOS-Chem species' + DO N = 1, gas_pcnst ! Map solsym onto GEOS-Chem species map2chm(N) = Ind_(TRIM(solsym(N))) IF ( map2chm(N) < 0 ) THEN - ! This is not a GEOS-Chem species and we thus map on constituents + ! This is not a GEOS-Chem species and we thus map to constituents list. ! Most likely, these will be MAM aerosols ! We store the index as the opposite to not confuse with GEOS-Chem ! indices. CALL cnst_get_ind(TRIM(solsym(N)), I, abort=.True.) map2chm(N) = -I + if (debug .and. masterproc) write(iulog,'(a,a,a,I4,a,I4)') ' -> solsym species ', trim(solsym(N)), ' (index ', N, ') is not a GEOS-Chem species. Mapping to negative constituent index: ', map2chm(N) + ELSE + if (debug .and. masterproc) write(iulog,'(a,a,a,I4,a,I4)') ' -> solsym species ', trim(solsym(N)), ' (index ', N, ') mapped to GEOS-Chem species ', map2chm(N) ENDIF ENDDO ! Get constituent index of specific humidity @@ -524,13 +534,17 @@ subroutine chem_register nIgnored = 0 + if (debug .and. masterproc) write(iulog,'(a,i4,a)') 'chem_register: looping over gas dry deposition list with ', nddvels, ' species' + DO N = 1, nddvels ! The species names need to be convert to upper case as, ! for instance, BR2 != Br2 drySpc_ndx(N) = get_spc_ndx( to_upper(drydep_list(N)) ) - IF ( MasterProc .AND. ( drySpc_ndx(N) < 0 ) ) THEN + if (debug .and. masterproc) write(iulog,'(a,a,a,i4,a,i4)') ' -> species ', trim(drydep_list(N)), ' in dry deposition list at index ', N, ' maps to species in solsym at index ', drySpc_ndx(N) + + IF ( MasterProc .and. ( drySpc_ndx(N) < 0 ) ) THEN Write(iulog,'(a,a)') ' ## Ignoring dry deposition of ', & TRIM(drydep_list(N)) nIgnored = nIgnored + 1 @@ -626,7 +640,7 @@ subroutine chem_register !============================================================== IF ( MasterProc ) THEN - Write(iulog,'(/, a)') '### Summary of GEOS-Chem species: ' + Write(iulog,'(/, a)') '### Summary of GEOS-Chem species (end of chem_register): ' Write(iulog,'( a)') REPEAT( '-', 50 ) Write(iulog,'( a)') '+ List of advected species: ' Write(iulog,100) 'ID', 'Tracer', ''!'Dry deposition (T/F)' @@ -661,6 +675,7 @@ subroutine chem_register call pbuf_add_field('HCO_IN_JNO2', 'global', dtype_r8, (/pcols/), tmpIdx) call pbuf_add_field('HCO_IN_JOH', 'global', dtype_r8, (/pcols/), tmpIdx) + if (debug .and. masterproc) write(iulog,'(a)') 'chem_register: advected constituent registration for GEOS-Chem chemistry complete ' end subroutine chem_register @@ -719,6 +734,8 @@ subroutine chem_readnl(nlfile) namelist /chem_inparm/ bndtvg, h2orates, ghg_chem + if (debug .and. masterproc) write(iulog,'(a)') 'chem_readnl: reading namelists for GEOS-Chem chemistry' + ALLOCATE(drySpc_ndx(nddvels), STAT=IERR) IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate drySpc_ndx') @@ -800,6 +817,8 @@ subroutine chem_readnl(nlfile) IF ( INDEX( LINE, 'transported_species' ) > 0 ) EXIT ENDDO + if (debug .and. masterproc) write(iulog,'(a)') 'chem_readnl: reading advected species list from geoschem_config.yml' + ! Read in all advected species names and add them to tracer names list nTracers = 0 DO WHILE ( LEN_TRIM( line ) > 0 ) @@ -823,6 +842,7 @@ subroutine chem_readnl(nlfile) nTracers = nTracers + 1 tracerNames(nTracers) = TRIM(substrs(1)) + write(iulog,'(a,i4,a,a)') ' ', nTracers, ' ', TRIM(substrs(1)) ENDIF ENDDO CLOSE(unitn) @@ -842,6 +862,9 @@ subroutine chem_readnl(nlfile) CALL ENDRUN('chem_readnl: too many species - increase nSlsmax') ENDIF + if (debug .and. masterproc) write(iulog,'(a)') 'chem_readnl: getting non-advected (short-lived) species list from KPP' + if (debug .and. masterproc) write(iulog,'(a)') 'NOTE: does not include CO2 even if CO2 is not advected' + nSls = 0 DO I = 1, nSpec ! Get the name of the species from KPP @@ -853,6 +876,7 @@ subroutine chem_readnl(nlfile) ! Genuine new short-lived species nSls = nSls + 1 slsNames(nSls) = TRIM(line) + write(iulog,'(a,i4,a,a)') ' ', nSls, ' ', TRIM(slsNames(nSls)) ENDIF ENDDO @@ -919,6 +943,8 @@ subroutine chem_readnl(nlfile) slvd_Lst(I) = TRIM(slsNames(I)) ENDDO + if (debug .and. masterproc) write(iulog,'(a)') 'chem_readnl: reading GEOS-Chem chemistry namelists complete' + end subroutine chem_readnl !================================================================================================ @@ -1083,6 +1109,8 @@ subroutine chem_init(phys_state, pbuf2d) ! Initialize pointers SpcInfo => NULL() + if (debug .and. masterproc) write(iulog,'(a)') 'chem_init: initializing GEOS-Chem chemistry' + ! LCHNK: which chunks we have on this process LCHNK = phys_state%LCHNK ! NCOL: number of atmospheric columns for each chunk @@ -1689,6 +1717,8 @@ subroutine chem_init(phys_state, pbuf2d) ! Cleanup Call Cleanup_State_Grid( maxGrid, RC ) + if (debug .and. masterproc) write(iulog,'(a)') 'chem_init: GEOS-Chem chemistry initialization complete' + end subroutine chem_init !=============================================================================== @@ -4313,7 +4343,7 @@ subroutine chem_init_restart(File) TYPE(file_desc_t) :: File - IF (MasterProc) WRITE(iulog,'(a)') 'GCCALL CHEM_INIT_RESTART' + WRITE(iulog,'(a)') 'chem_init_restart: init restarts for tracer sources and offline fields' ! ! data for offline tracers @@ -4336,7 +4366,7 @@ subroutine chem_write_restart( File ) TYPE(file_desc_t) :: File - IF ( MasterProc ) WRITE(iulog,'(a)') 'GCCALL CHEM_WRITE_RESTART' + WRITE(iulog,'(a)') 'chem_write_restart: writing restarts for tracer sources and offline fields' ! ! data for offline tracers ! @@ -4357,7 +4387,7 @@ subroutine chem_read_restart( File ) TYPE(file_desc_t) :: File - IF ( MasterProc ) WRITE(iulog,'(a)') 'GCCALL CHEM_READ_RESTART' + WRITE(iulog,'(a)') 'GCCALL CHEM_READ_RESTART' ! ! data for offline tracers ! From d9d9f67b5b1ba49404bfeb73926dbb32e4503a9b Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 16 Sep 2022 13:50:26 -0600 Subject: [PATCH 048/160] Remove unused code from GEOS-Chem chemistry.F90 file Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chemistry.F90 | 57 +--------------------------- 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index efc8bd6c20..9a552861ee 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -167,26 +167,8 @@ module chemistry CHARACTER(LEN=255) :: ThisLoc CHARACTER(LEN=255) :: ErrMsg -! ewl: comment out certain files used only for dry deposition -! ! Filenames to compute dry deposition velocities similarly to MOZART -! character(len=shr_kind_cl) :: clim_soilw_file = 'clim_soilw_file' -! character(len=shr_kind_cl) :: depvel_file = '' + ! For dry deposition character(len=shr_kind_cl) :: depvel_lnd_file = 'depvel_lnd_file' -! character(len=shr_kind_cl) :: season_wes_file = 'season_wes_file' -! -! character(len=shr_kind_cl) :: srf_emis_specifier(pcnst) = '' -! character(len=shr_kind_cl) :: ext_frc_specifier(pcnst) = '' -! -! character(len=24) :: srf_emis_type = 'CYCLICAL' ! 'CYCLICAL' | 'SERIAL' | 'INTERP_MISSING_MONTHS' -! integer :: srf_emis_cycle_yr = 0 -! integer :: srf_emis_fixed_ymd = 0 -! integer :: srf_emis_fixed_tod = 0 -! -! character(len=24) :: ext_frc_type = 'CYCLICAL' ! 'CYCLICAL' | 'SERIAL' | 'INTERP_MISSING_MONTHS' -! integer :: ext_frc_cycle_yr = 0 -! integer :: ext_frc_fixed_ymd = 0 -! integer :: ext_frc_fixed_tod = 0 - !================================================================================================ contains @@ -711,24 +693,8 @@ subroutine chem_readnl(nlfile) ! Assume a successful return until otherwise RC = GC_SUCCESS -! ewl: remove several entries from chem_inparm used for dry deposition: -! clim_soilw_file, depvel_file, season_wes_file; - ! The following files are required to compute land maps, required to perform - ! aerosol dry deposition -!ewl: need to play around with need to include these (ext_* and srf_*) for drydep namelist /chem_inparm/ lght_no_prd_factor, & depvel_lnd_file -!, & -! ext_frc_specifier, & -! ext_frc_type, & -! ext_frc_cycle_yr, & -! ext_frc_fixed_ymd, & -! ext_frc_fixed_tod, & -! srf_emis_specifier, & -! srf_emis_cycle_yr, & -! srf_emis_fixed_ymd, & -! srf_emis_fixed_tod, & -! srf_emis_type ! ghg chem @@ -907,27 +873,8 @@ subroutine chem_readnl(nlfile) CALL MPIBCAST ( slsNames, LEN(slsNames(1))*nSlsMax, MPICHAR, 0, MPICOM ) ! Broadcast namelist variables - -! ewl: remove broadcast of 4 files used for dry deposition only; srf_emis and ext_frc too. - ! The following files are required to compute land maps, required to perform - ! aerosol dry deposition CALL MPIBCAST (depvel_lnd_file, LEN(depvel_lnd_file), MPICHAR, 0, MPICOM) -! CALL MPIBCAST (clim_soilw_file, LEN(clim_soilw_file), MPICHAR, 0, MPICOM) -! CALL MPIBCAST (season_wes_file, LEN(season_wes_file), MPICHAR, 0, MPICOM) - CALL MPIBCAST (lght_no_prd_factor, 1, MPIR8, 0, MPICOM) -! CALL MPIBCAST (depvel_file, LEN(depvel_file), MPICHAR, 0, MPICOM) -! CALL MPIBCAST (srf_emis_specifier, LEN(srf_emis_specifier(1))*pcnst, MPICHAR, 0, MPICOM) -! CALL MPIBCAST (srf_emis_type, LEN(srf_emis_type), MPICHAR, 0, MPICOM) -! CALL MPIBCAST (srf_emis_cycle_yr, 1, MPIINT, 0, MPICOM) -! CALL MPIBCAST (srf_emis_fixed_ymd, 1, MPIINT, 0, MPICOM) -! CALL MPIBCAST (srf_emis_fixed_tod, 1, MPIINT, 0, MPICOM) -! CALL MPIBCAST (ext_frc_specifier, LEN(ext_frc_specifier(1))*pcnst, MPICHAR, 0, MPICOM) -! CALL MPIBCAST (ext_frc_type, LEN(ext_frc_type), MPICHAR, 0, MPICOM) -! CALL MPIBCAST (ext_frc_cycle_yr, 1, MPIINT, 0, MPICOM) -! CALL MPIBCAST (ext_frc_fixed_ymd, 1, MPIINT, 0, MPICOM) -! CALL MPIBCAST (ext_frc_fixed_tod, 1, MPIINT, 0, MPICOM) - CALL MPIBCAST (ghg_chem, 1, MPILOG, 0, MPICOM) CALL MPIBCAST (bndtvg, LEN(bndtvg), MPICHAR, 0, MPICOM) CALL MPIBCAST (h2orates, LEN(h2orates), MPICHAR, 0, MPICOM) @@ -3503,7 +3450,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! ! For now, dry deposition velocities are only computed for gases ! (which is what CLM deals with). Dry deposition for aerosols is - ! work in progress. <-- ewl...is this still true??? + ! work in progress. ! ! Thibaud M. Fritz - 27 Feb 2020 !================================================================== From 5ddd22e02bade976bf5ba61332a48765a4561f5f Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 21 Sep 2022 11:31:59 -0600 Subject: [PATCH 049/160] Externals update to use latest GEOS-Chem, HEMCO_CESM, and HEMCO These will need to change again before merge because GEOS-Chem 14.0.0 and HEMCO 3.5.0 are not yet released, and I am now using my fork of HEMCO_CESM with modifications needed to link to and build latest HEMCO as is. Signed-off-by: Lizzie Lundgren --- Externals_CAM.cfg | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 03a22f2349..29f5521914 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -70,17 +70,17 @@ hash = ff76a231 required = True [geoschem] -local_path = src/chemistry/geoschem/geoschem_src +tag = 14.0.0-alpha.9 protocol = git -branch = feature/cesm_2.3 -repo_url = https://github.com/CESM-GC/geos-chem +repo_url = https://github.com/geoschem/geos-chem.git +local_path = src/chemistry/geoschem/geoschem_src required = True [hemco] -local_path = src/hemco +branch = feature/hemco_3.5.0 protocol = git -branch = master -repo_url = https://github.com/ESCOMP/HEMCO_CESM.git +repo_url = https://github.com/lizziel/HEMCO_CESM.git +local_path = src/hemco required = True externals = Externals_HCO.cfg From fd67bd8ed57b679873d58574586375afd1f373f2 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 21 Sep 2022 12:35:34 -0600 Subject: [PATCH 050/160] Temporarily put wetdep and drydep lists in namelist file per GEOS-Chem case This is until there is a better way to handle the wetdep and drydep lists for GEOS-Chem cases Signed-off-by: Lizzie Lundgren --- bld/namelist_files/namelist_defaults_cam.xml | 26 ------------------- .../use_cases/2000_geoschem.xml | 20 ++++++++++++++ .../use_cases/2010_geoschem.xml | 20 ++++++++++++++ .../use_cases/hist_geoschem.xml | 20 ++++++++++++++ bld/namelist_files/use_cases/sd_geoschem.xml | 19 ++++++++++++++ 5 files changed, 79 insertions(+), 26 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 98fbcb1153..c2d4ec6345 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -3227,30 +3227,4 @@ atm/cam/ocnfrac/domain.aqua.fv1.9x2.5.nc - - - - - - - -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' - - - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index b2c980ddd3..cd26058362 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -38,6 +38,26 @@ + + + +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + + +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + 1,30,365,240,240,480,365,73,30 diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index 4ac969a9aa..9af5dad132 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -34,6 +34,26 @@ + + + +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + + +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + 1,30,365,240,240,480,365,73,30 diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 60068f00d4..2214ef4e15 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -32,6 +32,26 @@ 'noy', 'nhx' + + + +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + + +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + 1,30,365,240,240,480,365,73,30 diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index fbeaa8cc0b..6852f2a1a0 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -51,6 +51,25 @@ + + + +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + + +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + 1,30,365,240,240,480,365,73,30 From bfd2a090261eadb3cfc71a36d233a3108e228361 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 21 Sep 2022 14:05:28 -0600 Subject: [PATCH 051/160] Add deposition coefficient data file to GEOS-Chem use case files Eventually this will go higher up in the cam bld directory since the same file is used for all GEOS-Chem cases. Signed-off-by: Lizzie Lundgren --- bld/namelist_files/use_cases/2000_geoschem.xml | 2 ++ bld/namelist_files/use_cases/2010_geoschem.xml | 2 ++ bld/namelist_files/use_cases/hist_geoschem.xml | 2 ++ bld/namelist_files/use_cases/sd_geoschem.xml | 2 ++ 4 files changed, 8 insertions(+) diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index cd26058362..670cff6809 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -12,6 +12,8 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc + 00010101 diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index 9af5dad132..847a245a70 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -10,6 +10,8 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc + 00010101 diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 2214ef4e15..6e0c1cee83 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -12,6 +12,8 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc + 00010101 diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index 6852f2a1a0..3f86e29f1b 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -14,6 +14,8 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f09_f09_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc atm/cam/met/MERRA2/0.9x1.25/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_MERRA2_c171218.nc +/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc + 20050101 From 5da5680d321a0692f11928e50d658f177d2bd745 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 21 Sep 2022 14:06:01 -0600 Subject: [PATCH 052/160] Minor edit to Neu wet deposition debug code when using GEOS-Chem Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/mo_neu_wetdep.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chemistry/geoschem/mo_neu_wetdep.F90 b/src/chemistry/geoschem/mo_neu_wetdep.F90 index b7eab09b23..a168010729 100644 --- a/src/chemistry/geoschem/mo_neu_wetdep.F90 +++ b/src/chemistry/geoschem/mo_neu_wetdep.F90 @@ -81,7 +81,7 @@ subroutine neu_wetdep_init do m=1,gas_wetdep_cnt ! test_name = gas_wetdep_list(m) - if ( debug .and. masterproc ) print '(a,i4,a)','neu_wetdep_init: gas_wetdep_list species ',m,trim(test_name) + if ( debug .and. masterproc ) print '(a,i4,a,a)','neu_wetdep_init: gas_wetdep_list species ',m,' ',trim(test_name) ! ! ewl: this mapping can be replaced by including Henry's Law etc for all species, which makes usage of ! the parameters more transparent. I will comment out.... From 33de60e26fb35f932a783746d54695c1328bd453 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 23 Sep 2022 10:27:42 -0600 Subject: [PATCH 053/160] Add non-advected GEOS-Chem species OH and HO2 to solsym for diagnostics Signed-off-by: Lizzie Lundgren --- bld/configure | 2 +- src/chemistry/geoschem/chem_mods.F90 | 4 ++-- src/chemistry/geoschem/mo_sim_dat.F90 | 22 +++++++++++++--------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bld/configure b/bld/configure index 69aeb1edbe..0bbcc8ff50 100755 --- a/bld/configure +++ b/bld/configure @@ -1404,7 +1404,7 @@ if ($chem_pkg =~ '_mam3') { # TMMF - wedge in GEOS-Chem CPP definitions here if ($chem_pkg =~ 'geoschem') { $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING -DLINUX_IFORT -DUSE_REAL8 -DMODEL_ -DMODEL_CESM'; - $chem_nadv = 267; # includes GC advected species (233), CO2 (1), and MAM aerosols (33) + $chem_nadv = 269; # includes GC advected species (233), CO2 (1), and MAM aerosols (33) if (defined $opts{'clm_vers'}) { if ($opts{'clm_vers'} =~ 'CLM4.0') { $chem_cppdefs .= ' -DCLM40' diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index d44f3da459..4c336a5b29 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -7,7 +7,7 @@ module chem_mods implicit none save - INTEGER, PARAMETER :: nTracersMax = 267 ! Must be equal to chem_nadv + INTEGER, PARAMETER :: nTracersMax = 269 ! Must be equal to chem_nadv INTEGER :: nTracers CHARACTER(LEN=255) :: tracerNames(nTracersMax) CHARACTER(LEN=255) :: tracerLongNames(nTracersMax) @@ -61,7 +61,7 @@ module chem_mods rxntot = 212, & ! number of total reactions gascnt = 172, & ! number of gas phase reactions nabscol = 2, & ! number of absorbing column densities - gas_pcnst = 267, & ! number of "gas phase" species (same as solsym length) + gas_pcnst = 269, & ! number of "gas phase" species (same as solsym length) ! Includes GC advected species (233), MAM aerosols (33), ! and CO2 (1) nfs = 6, & ! number of "fixed" species diff --git a/src/chemistry/geoschem/mo_sim_dat.F90 b/src/chemistry/geoschem/mo_sim_dat.F90 index 25fc5207aa..5bd6d5a199 100644 --- a/src/chemistry/geoschem/mo_sim_dat.F90 +++ b/src/chemistry/geoschem/mo_sim_dat.F90 @@ -43,14 +43,17 @@ subroutine set_sim_dat ! ewl notes: added HMS (for GEOS-Chem 13.3) ! added AONITA, AROMP4, AROMP5, BALD, BENZP, BZCO3H, ! BZPAN, C2H2, C2H4, CSL, ETHN, ETHP, MCT, NPHEN, PHEN for 14.0 - ! Removed non-advected GEOS-Chem species (except CO2) for 14.0 + ! Removed non-advected GEOS-Chem species for 14.0, except CO2 + ! which is a constituent, as well as OH and HO2 for diagnostic + ! output. ! - ! Currently include GC advected species (233), MAM aerosols (33), and CO2 (1) + ! Currently include GC advected species (233), MAM aerosols (33), CO2 (1), + ! and OH and HO2 (2). ! If changed, update to match solsym length: - ! 1. cam/bld/configure variable $chem_adv + ! 1. cam/bld/configure variable $chem_nadv ! 2. cam/src/chemistry/geoschem/chem_mods.F90 vars gas_pcnst and nTracersMax - ! Alse update adv_mass to store MWs for species in solsym (ewl, 8/8/22) - solsym(:267) = (/ 'ACET ', & + ! Also update adv_mass to store MWs for species in solsym (ewl, 8/8/22) + solsym(:269) = (/ 'ACET ', & 'ACTA ','AERI ', & 'ALD2 ','ALK4 ','ASOA1 ', & 'ASOA2 ','ASOA3 ','ASOAN ', & @@ -143,8 +146,9 @@ subroutine set_sim_dat 'soa3_a2 ','soa4_a1 ','soa4_a2 ', & 'soa5_a1 ','soa5_a2 ','H2SO4 ', & 'SOAG0 ','SOAG1 ','SOAG2 ', & - 'SOAG3 ','SOAG4 ','CO2 ' /) -!non-advected GEOS-Chem species in 14.0: + 'SOAG3 ','SOAG4 ','CO2 ', & + 'HO2 ','OH ' /) +!non-advected GEOS-Chem species in 14.0 (beware this includes OH and HO2 already listed above) ! 'LBRO2H ','LBRO2N ','LISOPOH ', & ! 'LISOPNO3 ','LTRO2H ','LTRO2N ', & ! 'LXRO2H ','LXRO2N ','SO4H1 ', & @@ -179,7 +183,7 @@ subroutine set_sim_dat fix_mass(: 6) = (/ 0.00000000_r8, 28.0134800_r8, 31.9988000_r8, 2.020000_r8, 32.050000_r8, & 74.090000_r8 /) - adv_mass(:267) = (/ 58.090000_r8, 60.060000_r8, 126.900000_r8, 44.060000_r8, 58.120000_r8, & + adv_mass(:269) = (/ 58.090000_r8, 60.060000_r8, 126.900000_r8, 44.060000_r8, 58.120000_r8, & 150.000000_r8, 150.000000_r8, 150.000000_r8, 150.000000_r8, 150.000000_r8, & 150.00000_r8, 150.000000_r8, 189.12_r8, 68.08_r8, 98.10_r8, & 90.0900000_r8, 106.12_r8, 12.010000_r8, 12.010000_r8, & @@ -231,7 +235,7 @@ subroutine set_sim_dat 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 98.078400_r8, & 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & - 44.010000_r8 /) + 44.010000_r8, 33.0100000_r8, 17.0100000_r8 /) extfrc_lst(: 1) = (/ ' ' /) From 06985e5ee4397e921fcad583046c07e81f319ade Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 23 Sep 2022 11:56:39 -0600 Subject: [PATCH 054/160] Change default FCSD_GC year from 2005 to 2015 Signed-off-by: Lizzie Lundgren --- bld/namelist_files/use_cases/sd_geoschem.xml | 7 ++++--- cime_config/config_compsets.xml | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index 3f86e29f1b..a398cc0a5e 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -17,18 +17,19 @@ /glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc + -20050101 +20150101 50. .true. -2005/MERRA2_1.9x2.5_20050101.nc +2015/MERRA2_1.9x2.5_20150101.nc atm/cam/met/MERRA2/1.9x2.5 atm/cam/met/MERRA2/1.9x2.5/filenames_list_c20210302 -2005/MERRA2_0.9x1.25_20050101.nc +2015/MERRA2_0.9x1.25_20150101.nc atm/cam/met/MERRA2/0.9x1.25 atm/cam/met/MERRA2/0.9x1.25/filenames_1975-2017_c190125.txt diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 8fa40e5f9d..c6c943604a 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -558,6 +558,7 @@ 1995-01-01 2005-01-01 2005-01-01 + 2015-01-01 2010-01-01 1980-01-01 2000-01-01 From 822cd06727acfcfc8e79b1e2528aa554cbee1974 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 27 Sep 2022 13:40:08 -0600 Subject: [PATCH 055/160] Fix parameters incremented for non-advected species added to solysm Only gas_pcnst should be incremented when adding non-advected species to solsym. Signed-off-by: Lizzie Lundgren --- bld/configure | 2 +- src/chemistry/geoschem/chem_mods.F90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/configure b/bld/configure index 0bbcc8ff50..69aeb1edbe 100755 --- a/bld/configure +++ b/bld/configure @@ -1404,7 +1404,7 @@ if ($chem_pkg =~ '_mam3') { # TMMF - wedge in GEOS-Chem CPP definitions here if ($chem_pkg =~ 'geoschem') { $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING -DLINUX_IFORT -DUSE_REAL8 -DMODEL_ -DMODEL_CESM'; - $chem_nadv = 269; # includes GC advected species (233), CO2 (1), and MAM aerosols (33) + $chem_nadv = 267; # includes GC advected species (233), CO2 (1), and MAM aerosols (33) if (defined $opts{'clm_vers'}) { if ($opts{'clm_vers'} =~ 'CLM4.0') { $chem_cppdefs .= ' -DCLM40' diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index 4c336a5b29..fd7249ddd2 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -7,7 +7,7 @@ module chem_mods implicit none save - INTEGER, PARAMETER :: nTracersMax = 269 ! Must be equal to chem_nadv + INTEGER, PARAMETER :: nTracersMax = 267 ! Must be equal to chem_nadv INTEGER :: nTracers CHARACTER(LEN=255) :: tracerNames(nTracersMax) CHARACTER(LEN=255) :: tracerLongNames(nTracersMax) From 805659715e1d158374aa9ebd65fdc675529cdc7d Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 27 Sep 2022 13:53:23 -0600 Subject: [PATCH 056/160] Change Default FCHIST_GC run startdate year from 2010 t0 2015 This avoids an error retrieving CEDS emissions for which 2010 is not available. This update also include a minor comment change in chem_mods. Signed-off-by: Lizzie Lundgren --- cime_config/config_compsets.xml | 2 +- src/chemistry/geoschem/chem_mods.F90 | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index c6c943604a..93bb88ec3b 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -552,7 +552,7 @@ 1980-01-01 1850-01-01 2010-01-01 - 2010-01-01 + 2015-01-01 2013-01-01 1995-01-01 1995-01-01 diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index fd7249ddd2..03c0805ffc 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -63,7 +63,8 @@ module chem_mods nabscol = 2, & ! number of absorbing column densities gas_pcnst = 269, & ! number of "gas phase" species (same as solsym length) ! Includes GC advected species (233), MAM aerosols (33), - ! and CO2 (1) + ! and CO2 (1), as well as any non-advected species added + ! to solsym and mo_sim_dat.F90. nfs = 6, & ! number of "fixed" species relcnt = 0, & ! number of relationship species grpcnt = 0, & ! number of group members From a89b9cb3a13597bb66dad50bbd08d4f3d2870bb2 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 29 Sep 2022 14:30:46 -0600 Subject: [PATCH 057/160] Add friction velocity as a nuopc import in CAM Ustar is used in GEOS-Chem dry deposition over ocean Signed-off-by: Lizzie Lundgren --- src/cpl/nuopc/atm_import_export.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpl/nuopc/atm_import_export.F90 b/src/cpl/nuopc/atm_import_export.F90 index 11e4eb6772..bdce379f69 100644 --- a/src/cpl/nuopc/atm_import_export.F90 +++ b/src/cpl/nuopc/atm_import_export.F90 @@ -225,6 +225,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, rc) call fldlist_add(fldsToAtm_num, fldsToAtm, 'Si_snowh' ) call fldlist_add(fldsToAtm_num, fldsToAtm, 'So_ssq' ) call fldlist_add(fldsToAtm_num, fldsToAtm, 'So_re' ) + call fldlist_add(fldsToAtm_num, fldsToAtm, 'So_ustar' ) call fldlist_add(fldsToAtm_num, fldsToAtm, 'Sx_u10' ) call fldlist_add(fldsToAtm_num, fldsToAtm, 'Faxx_taux' ) call fldlist_add(fldsToAtm_num, fldsToAtm, 'Faxx_tauy' ) From c8dd834f68542d46cf64c8fb3dba9920f30c57b9 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 31 Oct 2022 13:41:09 -0600 Subject: [PATCH 058/160] Add hemco_grid_xdim, hemco_grid_ydim namelist variables to configure HEMCO grid. --- bld/namelist_files/namelist_defaults_cam.xml | 12 ++++++++++++ bld/namelist_files/namelist_definition.xml | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index c2d4ec6345..6be1e5df3d 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -3227,4 +3227,16 @@ atm/cam/ocnfrac/domain.aqua.fv1.9x2.5.nc + +HEMCO_Config.rc + +288 +201 + +288 +201 + +144 +91 + diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index fa38d85c54..8c08feee05 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4887,6 +4887,18 @@ Full pathname to HEMCO_Config.rc, which prescribes emission inventories Default: set by build-namelist. + +Number of x-dimensions in HEMCO internal grid. +Default: set by build-namelist. + + + +Number of y-dimensions in HEMCO internal grid. +Default: set by build-namelist. + + Date: Mon, 31 Oct 2022 13:50:27 -0600 Subject: [PATCH 059/160] Update HEMCO tag to hemco-cesm1_0_hemco3_5_0 --- Externals_CAM.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 29f5521914..43066f7169 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -77,9 +77,9 @@ local_path = src/chemistry/geoschem/geoschem_src required = True [hemco] -branch = feature/hemco_3.5.0 +tag = hemco-cesm1_0_hemco_3_5_0 protocol = git -repo_url = https://github.com/lizziel/HEMCO_CESM.git +repo_url = https://github.com/ESCOMP/HEMCO_CESM.git local_path = src/hemco required = True externals = Externals_HCO.cfg From aefa2ef854d657f77a3585e4ce2ffc12525663fe Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 31 Oct 2022 15:06:08 -0600 Subject: [PATCH 060/160] Experimental first version of New History Diagnostics --- cime_config/config_compsets.xml | 5 + src/chemistry/geoschem/cesmgc_history_mod.F90 | 1212 +++++++++++++++++ src/chemistry/geoschem/chemistry.F90 | 43 + 3 files changed, 1260 insertions(+) create mode 100644 src/chemistry/geoschem/cesmgc_history_mod.F90 diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 93bb88ec3b..6206142da2 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -539,6 +539,11 @@ HIST_CAM60%GC%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + + FCnudged_GC + HIST_CAM60%GC%NUDG_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + + diff --git a/src/chemistry/geoschem/cesmgc_history_mod.F90 b/src/chemistry/geoschem/cesmgc_history_mod.F90 new file mode 100644 index 0000000000..88f8d2d25b --- /dev/null +++ b/src/chemistry/geoschem/cesmgc_history_mod.F90 @@ -0,0 +1,1212 @@ +#define ASSERT_(cond,msg) if(.not.cond) then; print *, "assertion error: ", Iam, __LINE__; call endrun("assertion error - look above - in cesmgc_history_mod.F90"); endif +#define _Iam_(name) character(len=255) :: Iam=name +#define __Iam__(name) integer :: STATUS; _Iam_(name) +! Above are compatibility shorthands to avoid excessive divergence from +! MAPL-based code. (hplin, 10/19/22) +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !MODULE: cesmgc_history_mod.F90 +! +! !DESCRIPTION: Module CESMGC\_History\_Mod interfaces between the CAM history +! component, the HISTORY.rc configuration file, and the GEOS-Chem State registry. +! This module is based off GCHP\_HistoryExports\_Mod originally developed by +! Lizzie Lundgren for GCHP. +!\\ +!\\ +! !INTERFACE: +! +MODULE CESMGC_History_Mod +! +! !USES: +! + USE DiagList_Mod + USE TaggedDiagList_Mod + USE ErrCode_Mod + USE Precision_Mod + + USE cam_abortutils, only : endrun + + IMPLICIT NONE + PRIVATE +! +! !PUBLIC MEMBER FUNCTIONS: +! + PUBLIC :: HistoryExports_SetServices + PUBLIC :: HistoryExports_SetDataPointers + PUBLIC :: CopyGCStates2Exports + PUBLIC :: Destroy_HistoryConfig +! +! !PRIVATE: +! + PRIVATE :: Init_HistoryConfig + PRIVATE :: Init_HistoryExport + PRIVATE :: Init_HistoryExportsList + PRIVATE :: Append_HistoryExportsList + PRIVATE :: Check_HistoryExportsList + PRIVATE :: Print_HistoryExportsList + ! +! !PUBLIC TYPES +! + ! History Configuration Object + TYPE, PUBLIC :: HistoryConfigObj + + CHARACTER(LEN=255) :: ROOT ! TODO: needed? + CHARACTER(LEN=255) :: ConfigFileName + LOGICAL :: ConfigFileRead + TYPE(HistoryExportsListObj), POINTER :: HistoryExportsList + TYPE(DgnList) :: DiagList + TYPE(TaggedDgnList) :: TaggedDiagList + + END TYPE HistoryConfigObj +! +! !PRIVATE TYPES +! + ! History Exports Linked List + TYPE :: HistoryExportsListObj + + TYPE(HistoryExportObj), POINTER :: head + INTEGER :: numExports + + END TYPE HistoryExportsListObj + + ! History Export Object + TYPE :: HistoryExportObj + + CHARACTER(LEN=255) :: name + CHARACTER(LEN=255) :: metadataID + CHARACTER(LEN=255) :: registryID + CHARACTER(LEN=255) :: long_name + CHARACTER(LEN=255) :: units + INTEGER :: vloc + INTEGER :: rank + INTEGER :: type + LOGICAL :: isMet + LOGICAL :: isChem + LOGICAL :: isDiag + TYPE(HistoryExportObj), POINTER :: next + + ! Pointers to ESMF Export and GEOS-Chem State + ! TODO: for now, include all possible data types in the registry. + REAL, POINTER :: ExportData2d(:,:) + REAL, POINTER :: ExportData3d(:,:,:) + REAL(fp), POINTER :: GCStateData0d + REAL(fp), POINTER :: GCStateData1d(:) + REAL(fp), POINTER :: GCStateData2d(:,:) + REAL(fp), POINTER :: GCStateData3d(:,:,:) + REAL(f4), POINTER :: GCStateData0d_4 + REAL(f4), POINTER :: GCStateData1d_4(:) + REAL(f4), POINTER :: GCStateData2d_4(:,:) + REAL(f4), POINTER :: GCStateData3d_4(:,:,:) + REAL(f8), POINTER :: GCStateData0d_8 + REAL(f8), POINTER :: GCStateData1d_8(:) + REAL(f8), POINTER :: GCStateData2d_8(:,:) + REAL(f8), POINTER :: GCStateData3d_8(:,:,:) + INTEGER, POINTER :: GCStateData0d_I + INTEGER, POINTER :: GCStateData1d_I(:) + INTEGER, POINTER :: GCStateData2d_I(:,:) + INTEGER, POINTER :: GCStateData3d_I(:,:,:) + + END TYPE HistoryExportObj +! +! !REVISION HISTORY: +! 01 Sep 2017 - E. Lundgren - Initial version +! 19 Oct 2022 - H.P. Lin - Adapted for CESM +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC + +CONTAINS +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: Init_HistoryConfig +! +! !DESCRIPTION: +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE Init_HistoryConfig ( am_I_Root, HistoryConfig, configFile, RC ) +! +! !USES: +! +! +! !INPUT PARAMETERS: +! + LOGICAL, INTENT(IN) :: am_I_Root + CHARACTER(LEN=*), INTENT(IN) :: configFile +! +! !OUTPUT PARAMETERS: +! + TYPE(HistoryConfigObj), POINTER :: HistoryConfig + INTEGER, INTENT(OUT) :: RC +! +! !REVISION HISTORY: +! 01 Sep 2017 - E. Lundgren - Initial version +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC + __Iam__('Init_HistoryConfig (cesmgc_history_mod.F90)') + RC = GC_SUCCESS + ALLOCATE(HistoryConfig) + HistoryConfig%ROOT = '' + HistoryConfig%ConfigFileName = TRIM(configFile) + HistoryConfig%ConfigFileRead = .FALSE. + + CALL Init_DiagList( am_I_Root, configFile, HistoryConfig%DiagList, RC ) + IF ( RC == GC_FAILURE ) THEN + _ASSERT(.FALSE., 'informative message here') + RETURN + ENDIF + ! Optional debugging + CALL Print_DiagList( am_I_Root, HistoryConfig%DiagList, RC ) + + CALL Init_TaggedDiagList( am_I_Root, HistoryConfig%DiagList, & + HistoryConfig%TaggedDiagList, RC ) + IF ( RC == GC_FAILURE ) THEN + _ASSERT(.FALSE., 'informative message here') + RETURN + ENDIF + ! Optional debugging + CALL Print_TaggedDiagList( am_I_Root, HistoryConfig%TaggedDiagList, RC ) + + + CALL Init_HistoryExportsList( am_I_Root, HistoryConfig, RC ) + IF ( RC == GC_FAILURE ) THEN + _ASSERT(.FALSE., 'informative message here') + RETURN + ENDIF + + ! Optional debugging + CALL Print_HistoryExportsList( am_I_Root, HistoryConfig, RC ) + + END SUBROUTINE Init_HistoryConfig +!EOC +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: Init_HistoryExportsList +! +! !DESCRIPTION: +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE Init_HistoryExportsList ( am_I_Root, HistoryConfig, RC ) +! +! !USES: +! + USE State_Chm_Mod, ONLY: Get_Metadata_State_Chm + USE State_Diag_Mod, ONLY: Get_Metadata_State_Diag + USE State_Met_Mod, ONLY: Get_Metadata_State_Met +! +! !INPUT PARAMETERS: +! + LOGICAL, INTENT(IN) :: am_I_Root +! +! !INPUT/OUTPUT PARAMETERS: +! + TYPE(HistoryConfigObj), POINTER :: HistoryConfig +! +! !OUTPUT PARAMETERS: +! + INTEGER, INTENT(OUT) :: RC +! +! !REVISION HISTORY: +! 01 Sep 2017 - E. Lundgren - initial version +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + INTEGER :: N, rank, vloc, type + CHARACTER(LEN=255) :: ErrMsg, desc, units, tag + LOGICAL :: isMet, isChem, isDiag, found + TYPE(HistoryExportObj), POINTER :: NewHistExp + TYPE(DgnItem), POINTER :: current + + ! ================================================================ + ! Init_HistoryExportsList begins here + ! ================================================================ + __Iam__('Init_HistoryExportsList (cesmgc_history_mod.F90)') + RC = GC_SUCCESS + + ! Init + NewHistExp => NULL() + + ! Create HistoryExportsList object + ALLOCATE(HistoryConfig%HistoryExportsList) + HistoryConfig%HistoryExportsList%numExports = 0 + HistoryConfig%HistoryExportsList%head => NULL() + + ! Loop over entries in DiagList + current => HistoryConfig%DiagList%head + DO WHILE ( ASSOCIATED( current ) ) + + ! Skip diagnostics handled by HEMCO, non-standard for GEOS, + ! or species in the GCHP/GEOS internal state. + ! See diaglist_mod.F90 for criteria for assigning diagnostic state. + IF ( INDEX( current%state, 'HEMCO' ) == 1 .OR. & + INDEX( current%state, 'GEOS' ) == 1 .OR. & + INDEX( current%state, 'INTERNAL' ) == 1 ) THEN + current => current%next + CYCLE + ENDIF + + ! Check history exports list to see if already added (unless wildcard) + IF ( .NOT. current%isWildcard ) THEN + CALL Check_HistoryExportsList( am_I_Root, current%name, & + HistoryConfig%HistoryExportsList, & + found, RC ) + IF ( found ) THEN + current => current%next + CYCLE + ENDIF + ENDIF + + ! Get metadata using metadataID and state + ! If isTagged, then append to description + ! If isWildcard, shouldn't get here + ! The name of the export is simply name + Found = .TRUE. + isMet = .FALSE. + isChem = .FALSE. + isDiag = .FALSE. + IF ( TRIM(current%state) == 'MET' ) THEN + isMet = .TRUE. + CALL Get_Metadata_State_Met( am_I_Root, current%metadataID, & + Found, RC, desc=desc, units=units, & + rank=rank, type=type, vloc=vloc ) + ! TODO: need to add found to outputs of get_metadata_state_met + ELSEIF ( TRIM(current%state) == 'CHEM' ) THEN + isCHEM = .TRUE. + CALL Get_Metadata_State_Chm( am_I_Root, current%metadataID, & + Found, RC, desc=desc, units=units, & + rank=rank, type=type, vloc=vloc ) + ELSEIF ( TRIM(current%state) == 'DIAG' ) THEN + isDIAG = .TRUE. + CALL Get_Metadata_State_Diag( am_I_Root, current%metadataID, & + Found, RC, desc=desc, units=units, & + rank=rank, srcType=type, vloc=vloc ) + ELSE + RC = GC_FAILURE + ErrMsg = "Unknown state of item " // TRIM(current%name) // & + " in DiagList: " // TRIM(current%state) + EXIT + ENDIF + + IF ( .NOT. Found ) THEN + RC = GC_FAILURE + ErrMsg = "Metadata not found for " // TRIM(current%name) // & + " in state " // TRIM(current%state) + EXIT + ENDIF + + ! If wildcard is present + IF ( current%isWildcard ) THEN + ! Do nothing. This should never happen at this point since + ! Init_DiagList will exit with an error if wildcard is + ! encountered in HISTORY.rc while compiling with ESMF_. + + ! When it comes time to implement, create exports in a loop, + ! either for all species or for advected species only. Include + ! a check that the export was not already created. Loop over + ! AdvNames if wildcard is ADV. Loop over SpecNames for all other + ! cases, passing not found = OK so that not all are necessarily + ! output. Later on, after species database is initialized, exports + ! for only species in the specific wildcard will be associated + ! with data and thus included in the output file. + + ! If the meantime, skip wildcards if it gets here. + current => current%next + CYCLE + ENDIF + + ! If this item is for a specific tag, append description. + ! This will need revisiting since there may be tag-dependent + ! strings to append to long names + IF ( current%isTagged ) THEN + desc = TRIM(desc) // " for " // TRIM(current%tag) + ENDIF + + ! Create a new HistoryExportObj object + CALL Init_HistoryExport( am_I_Root, NewHistExp, & + name=current%name, & + metadataID=current%metadataID, & + registryID=current%registryID, & + long_name=desc, & + units=units, & + vloc=vloc, & + rank=rank, & + type=type, & + isMet=isMet, & + isChem=isChem, & + isDiag=isDiag, & + RC=RC ) + IF ( RC == GC_FAILURE ) THEN + RC = GC_FAILURE + ErrMsg = "History export init fail for " // TRIM(current%name) + EXIT + ENDIF + + ! Add new HistoryExportObj to linked list + CALL Append_HistoryExportsList( am_I_Root, NewHistExp, & + HistoryConfig, RC ) + IF ( RC == GC_FAILURE ) THEN + RC = GC_FAILURE + ErrMsg = "History export append fail for " // TRIM(current%name) + EXIT + ENDIF + + ! Set up for next item in DiagList + current => current%next + + ENDDO + current => NULL() + + IF ( RC == GC_SUCCESS ) THEN + HistoryConfig%ConfigFileRead = .TRUE. + ELSE + CALL GC_ERROR( ErrMsg, RC, Iam ) + _ASSERT(.FALSE., 'informative message here') + RETURN + ENDIF + + END SUBROUTINE Init_HistoryExportsList +!EOC +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: Init_HistoryExport +! +! !DESCRIPTION: +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE Init_HistoryExport ( am_I_Root, NewHistExp, name, & + metadataID, registryID, long_name, & + units, vloc, rank, & + type, isMet, isChem, & + isDiag, RC ) +! +! !INPUT PARAMETERS: +! + LOGICAL, INTENT(IN) :: am_I_Root +! +! !OUTPUT PARAMETERS: +! + TYPE(HistoryExportObj), POINTER :: NewHistExp + CHARACTER(LEN=*), OPTIONAL :: name + CHARACTER(LEN=*), OPTIONAL :: metadataID + CHARACTER(LEN=*), OPTIONAL :: registryID + CHARACTER(LEN=*), OPTIONAL :: long_name + CHARACTER(LEN=*), OPTIONAL :: units + INTEGER, OPTIONAL :: vloc + INTEGER, OPTIONAL :: rank + INTEGER, OPTIONAL :: type + LOGICAL, OPTIONAL :: isMet + LOGICAL, OPTIONAL :: isChem + LOGICAL, OPTIONAL :: isDiag + INTEGER, OPTIONAL :: RC +! +! !REVISION HISTORY: +! 01 Sep 2017 - E. Lundgren - Initial version +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC + __Iam__('Init_HistoryExport (cesmgc_history_mod.F90)') + RC = GC_SUCCESS + ALLOCATE(NewHistExp) + + IF ( PRESENT( name ) ) THEN + NewHistExp%name = TRIM(name) + ELSE + NewHistExp%name = '' + ENDIF + + IF ( PRESENT( metaDataId ) ) THEN + NewHistExp%metadataID = TRIM(metadataID) + ELSE + NewHistExp%metadataID = '' + ENDIF + + IF ( PRESENT( registryId ) ) THEN + NewHistExp%registryID = TRIM(registryID) + ELSE + NewHistExp%registryId = '' + ENDIF + + IF ( PRESENT( long_name ) ) THEN + NewHistExp%long_name = TRIM(long_name) + ELSE + NewHistExp%long_name = '' + ENDIF + + IF ( PRESENT( units ) ) THEN + NewHistExp%units = TRIM(units) + ELSE + NewHistExp%units = '' + ENDIF + + IF ( PRESENT( vloc ) ) THEN + NewHistExp%vloc = vloc + ELSE + NewHistExp%vloc = -1 + ENDIF + + IF ( PRESENT( rank ) ) THEN + NewHistExp%rank = rank + ELSE + NewHistExp%rank = -1 + ENDIF + + IF ( PRESENT( type ) ) THEN + NewHistExp%type = type + ELSE + NewHistExp%type = -1 + ENDIF + + IF ( PRESENT( isMet ) ) THEN + NewHistExp%isMet = isMet + ELSE + NewHistExp%isMet = .FALSE. + ENDIF + + IF ( PRESENT( isChem ) ) THEN + NewHistExp%isChem = isChem + ELSE + NewHistExp%isChem = .FALSE. + ENDIF + + IF ( PRESENT( isDiag ) ) THEN + NewHistExp%isDiag = isDiag + ELSE + NewHistExp%isDiag = .FALSE. + ENDIF + + NewHistExp%next => NULL() + NewHistExp%ExportData2d => NULL() + NewHistExp%ExportData3d => NULL() + NewHistExp%GCStateData0d => NULL() + NewHistExp%GCStateData1d => NULL() + NewHistExp%GCStateData2d => NULL() + NewHistExp%GCStateData3d => NULL() + NewHistExp%GCStateData0d_4 => NULL() + NewHistExp%GCStateData1d_4 => NULL() + NewHistExp%GCStateData2d_4 => NULL() + NewHistExp%GCStateData3d_4 => NULL() + NewHistExp%GCStateData0d_8 => NULL() + NewHistExp%GCStateData1d_8 => NULL() + NewHistExp%GCStateData2d_8 => NULL() + NewHistExp%GCStateData3d_8 => NULL() + NewHistExp%GCStateData0d_I => NULL() + NewHistExp%GCStateData1d_I => NULL() + NewHistExp%GCStateData2d_I => NULL() + NewHistExp%GCStateData3d_I => NULL() + + END SUBROUTINE Init_HistoryExport +!EOC +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: Append_HistoryExportsList +! +! !DESCRIPTION: +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE Append_HistoryExportsList ( am_I_Root, HistoryExport, & + HistoryConfig, RC ) +! +! !USES: +! +! +! !INPUT PARAMETERS: +! + LOGICAL, INTENT(IN) :: am_I_Root + TYPE(HistoryExportObj), POINTER :: HistoryExport +! +! !INPUT/OUTPUT PARAMETERS: +! + TYPE(HistoryConfigObj), POINTER :: HistoryConfig +! +! !OUTPUT PARAMETERS: +! + INTEGER, INTENT(OUT) :: RC +! +! !REVISION HISTORY: +! 01 Sep 2017 - E. Lundgren - initial version +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + TYPE(HistoryExportObj), POINTER :: NewHistExp + + ! ================================================================ + ! Append_HistoryExportsList begins here + ! ================================================================ + __Iam__('Append_HistoryExportsList (cesmgc_history_mod.F90)') + RC = GC_SUCCESS + + ! Add new object to the beginning of the linked list + HistoryExport%next => HistoryConfig%HistoryExportsList%head + HistoryConfig%HistoryExportsList%head => HistoryExport + + ! Update # of list items + HistoryConfig%HistoryExportsList%numExports = & + HistoryConfig%HistoryExportsList%numExports + 1 + + END SUBROUTINE Append_HistoryExportsList +!EOC +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: Check_HistoryExportsList +! +! !DESCRIPTION: +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE Check_HistoryExportsList ( am_I_Root, name, & + ExportsList, found, RC ) +! +! !INPUT PARAMETERS: +! + LOGICAL, INTENT(IN) :: am_I_Root + CHARACTER(LEN=*), INTENT(IN) :: name + TYPE(HistoryExportsListObj), POINTER :: ExportsList +! +! !OUTPUT PARAMETERS: +! + LOGICAL, INTENT(OUT) :: found + INTEGER, INTENT(OUT) :: RC +! +! !REVISION HISTORY: +! 12 Sep 2017 - E. Lundgren - Initial version +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + TYPE(HistoryExportObj), POINTER :: current + + __Iam__('Check_HistoryExportsList (cesmgc_history_mod.F90)') + RC = GC_SUCCESS + + ! Assume not found + found = .False. + + current => ExportsList%head + DO WHILE ( ASSOCIATED( current ) ) + IF ( current%name == name ) THEN + found = .TRUE. + RETURN + ENDIF + current => current%next + ENDDO + current => NULL() + + END SUBROUTINE Check_HistoryExportsList +!EOC +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: HistoryExports_SetServices +! +! !DESCRIPTION: +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE HistoryExports_SetServices( am_I_Root, config_file, & + HistoryConfig, RC ) +! +! !USES: +! + USE cam_history, only: addfld, add_default, horiz_only + USE Registry_Params_Mod +! +! !INPUT PARAMETERS: +! + LOGICAL, INTENT(IN) :: am_I_Root + CHARACTER(LEN=*), INTENT(IN) :: config_file +! +! !INPUT AND OUTPUT PARAMETERS: +! + +! +! !OUTPUT PARAMETERS: +! + TYPE(HistoryConfigObj), POINTER :: HistoryConfig ! History config object + INTEGER, INTENT(OUT) :: RC +! +! !REMARKS: +! ! +! !REVISION HISTORY: +! 01 Sep 2017 - E. Lundgren - Initial version +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + CHARACTER(LEN=255) :: ErrMsg + TYPE(HistoryExportObj), POINTER :: current + + ! ================================================================ + ! HistoryExports_SetServices begins here + ! ================================================================ + + ! For MAPL/ESMF error handling (defines Iam and STATUS) + __Iam__('HistoryExports_SetServices (cesmgc_history_mod.F90)') + RC = GC_SUCCESS + + ! Create a config object if it does not already exist + IF ( .NOT. ASSOCIATED(HistoryConfig) ) THEN + CALL Init_HistoryConfig( am_I_Root, HistoryConfig, config_file, RC ) + IF ( RC == GC_FAILURE ) THEN + _ASSERT(.FALSE., 'informative message here') + RETURN + ENDIF + ENDIF + + ! Loop over the History Exports list to add one export per item + IF ( am_I_Root ) THEN + WRITE(6,*) " " + WRITE(6,*) "Adding history variables to CAM History State:" + ENDIF + current => HistoryConfig%HistoryExportsList%head + DO WHILE ( ASSOCIATED( current ) ) + IF ( am_I_Root ) PRINT *, "adding export: ", TRIM(current%name) + ! Create an export for this item + IF ( current%rank == 3 ) THEN + IF ( current%vloc == VLocationCenter ) THEN + CALL addfld(trim(current%name), & + (/'lev'/), & + 'I', & + trim(current%units), & + trim(current%long_name) ) + IF ( RC == GC_FAILURE ) THEN + ErrMsg = "Problem adding 3D export for " // TRIM(current%name) + EXIT + ENDIF + ELSEIF ( current%vloc == VLocationEdge ) THEN + CALL addfld(trim(current%name), & + (/'ilev'/), & + 'I', & + trim(current%units), & + trim(current%long_name) ) + ELSE + IF ( am_I_Root ) THEN + PRINT *, "Unknown vertical location for ", & + TRIM(current%name) + ENDIF + ENDIF + ELSEIF ( current%rank == 2 ) THEN + CALL addfld(trim(current%name), & + horiz_only, & + 'I', & + trim(current%units), & + trim(current%long_name) ) + IF ( RC == GC_FAILURE ) THEN + ErrMsg = "Problem adding 2D export for " // TRIM(current%name) + EXIT + ENDIF + ELSE + RC = GC_FAILURE + ErrMsg = "Problem adding export for " // TRIM(current%name) // & + ". Rank is only implemented for 2 or 3!" + EXIT + ENDIF + + current => current%next + ENDDO + current => NULL() + + IF ( RC == GC_FAILURE ) THEN + CALL GC_ERROR( ErrMsg, RC, Iam ) + _ASSERT(.FALSE., 'informative message here') + RETURN + ENDIF + + END SUBROUTINE HistoryExports_SetServices +!EOC +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: CopyGCStates2Exports +! +! !DESCRIPTION: +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig, LCHNK, RC ) +! +! !USES: +! + USE HCO_Interface_GC_Mod, ONLY : HCOI_GC_WriteDiagn + USE Input_Opt_Mod, ONLY : OptInput + USE State_Grid_Mod, ONLY : GrdState +! +! !INPUT PARAMETERS: +! + LOGICAL, INTENT(IN) :: am_I_Root + TYPE(OptInput), INTENT(IN) :: Input_Opt + TYPE(GrdState), INTENT(IN) :: State_Grid + INTEGER, INTENT(IN) :: LCHNK ! Chunk number for CESM +! +! !INPUT AND OUTPUT PARAMETERS: +! + TYPE(HistoryConfigObj), POINTER :: HistoryConfig ! History config object +! +! !OUTPUT PARAMETERS: +! + INTEGER, INTENT(OUT) :: RC +! +! !REMARKS: +! ! +! !REVISION HISTORY: +! 01 Sep 2017 - E. Lundgren - Initial version +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + INTEGER :: LMAX + CHARACTER(LEN=255) :: ErrMsg + TYPE(HistoryExportObj), POINTER :: current + + ! ================================================================ + ! CopyGCStates2Exports begins here + ! ================================================================ + __Iam__('CopyGCStates2Exports (cesmgc_history_mod.F90)') + RC = GC_SUCCESS + + ! Loop over the History Exports list + current => HistoryConfig%HistoryExportsList%head + DO WHILE ( ASSOCIATED( current ) ) + + ! if (MAPL_Am_I_Root()) THEN + ! print *, ' Copying ' // TRIM(current%name) + ! endif + IF ( current%rank == 2 ) THEN + IF ( ASSOCIATED( current%GCStateData2d ) ) THEN + current%ExportData2d(:,1:State_Grid%NY) = current%GCStateData2d(:,1:State_Grid%NY) + ELSE IF ( ASSOCIATED( current%GCStateData2d_4 ) ) THEN + current%ExportData2d(:,1:State_Grid%NY) = current%GCStateData2d_4(:,1:State_Grid%NY) + ELSE IF ( ASSOCIATED( current%GCStateData2d_8 ) ) THEN + current%ExportData2d(:,1:State_Grid%NY) = current%GCStateData2d_8(:,1:State_Grid%NY) + ELSE IF ( ASSOCIATED( current%GCStateData2d_I ) ) THEN + ! Convert integer to float (integers not allowed in MAPL exports) + current%ExportData2d(:,1:State_Grid%NY) = FLOAT(current%GCStateData2d_I(:,1:State_Grid%NY)) + ELSE + RC = GC_FAILURE + ErrMsg = "No GC 2D pointer found for " // TRIM(current%name) + EXIT + ENDIF + + ! Now call outfld to output for this chunk + call outfld(trim(current%name), & + current%ExportData2d(1, 1:State_Grid%NY), & ! Chunk width always 1 + State_Grid%NY, & + LCHNK ) + ELSEIF ( current%rank == 3 ) THEN + IF ( ASSOCIATED( current%GCStateData3d ) ) THEN + current%ExportData3d(:,1:State_Grid%NY,:) = current%GCStateData3d(:,1:State_Grid%NY,:) + ELSE IF ( ASSOCIATED( current%GCStateData3d_4 ) ) THEN + current%ExportData3d(:,1:State_Grid%NY,:) = current%GCStateData3d_4(:,1:State_Grid%NY,:) + ELSE IF ( ASSOCIATED( current%GCStateData3d_8 ) ) THEN + current%ExportData3d(:,1:State_Grid%NY,:) = current%GCStateData3d_8(:,1:State_Grid%NY,:) + ELSE IF ( ASSOCIATED( current%GCStateData3d_I ) ) THEN + current%ExportData3d(:,1:State_Grid%NY,:) = FLOAT(current%GCStateData3d_I(:,1:State_Grid%NY,:)) + ELSE + RC = GC_FAILURE + ErrMsg = "No GC 3D pointer found for " // TRIM(current%name) + EXIT + ENDIF +#if defined( MODEL_GEOS ) || defined( MODEL_CESM ) + ! If using GEOS-5, flip the data vertically to match model + ! convention + ! Also do this in CESM. (hplin, 10/31/22) + LMAX = SIZE(current%ExportData3d, 3) + current%ExportData3d(:,:,1:LMAX) = & + current%ExportData3d(:,:,LMAX:1:-1) +#endif + + ! Now call outfld to output for this chunk + call outfld(trim(current%name), & + current%ExportData3d(1, 1:State_Grid%NY, :), & ! Chunk width always 1. TOA is 1 + State_Grid%NY, & + LCHNK ) + ENDIF + + current => current%next + ENDDO + current => NULL() + + ! Error handling + IF ( RC == GC_FAILURE ) THEN + CALL GC_ERROR( ErrMsg, RC, Iam ) + _ASSERT(.FALSE., 'informative message here') + RETURN + ENDIF + END SUBROUTINE CopyGCStates2Exports +!EOC +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: Print_HistoryExportsList +! +! !DESCRIPTION: +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE Print_HistoryExportsList( am_I_Root, HistoryConfig, RC ) +! +! !USES: +! +! +! !INPUT PARAMETERS: +! + LOGICAL, INTENT(IN) :: am_I_Root +! +! !INPUT AND OUTPUT PARAMETERS: +! + TYPE(HistoryConfigObj), POINTER :: HistoryConfig ! History config object +! +! !OUTPUT PARAMETERS: +! + INTEGER, INTENT(OUT) :: RC +! +! !REMARKS: +! ! +! !REVISION HISTORY: +! 01 Sep 2017 - E. Lundgren - Initial version +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + TYPE(HistoryExportObj), POINTER :: current + + ! ================================================================ + ! Print_HistoryExportsList begins here + ! ================================================================ + __Iam__('Print_HistoryExportsList (cesmgc_history_mod.F90)') + RC = GC_SUCCESS + + ! Loop over the History Exports list + current => HistoryConfig%HistoryExportsList%head + IF ( am_I_Root ) PRINT *, '===========================' + IF ( am_I_Root ) PRINT *, 'History Exports List:' + IF ( am_I_Root ) PRINT *, ' ' + DO WHILE ( ASSOCIATED( current ) ) + IF ( am_I_Root ) THEN + PRINT *, "Name: ", TRIM(current%name) + PRINT *, " MetadataID: ", TRIM(current%metadataID) + PRINT *, " RegistryID: ", TRIM(current%registryID) + PRINT *, " Long name: ", TRIM(current%long_name) + PRINT *, " Units: ", TRIM(current%units) + PRINT *, " Vert loc: ", current%vloc + PRINT *, " Rank: ", current%rank + PRINT *, " Type: ", current%type + PRINT *, " isMet: ", current%isMet + PRINT *, " isChem: ", current%isChem + PRINT *, " isDiag: ", current%isDiag + IF ( ASSOCIATED( current%ExportData2d )) + PRINT *, " E2D dim'l: ", size(current%ExportData2d) + ENDIF + IF ( ASSOCIATED( current%ExportData3d )) + PRINT *, " E3D dim'l: ", size(current%ExportData3d) + ENDIF + PRINT *, " " + ENDIF + current => current%next + ENDDO + IF ( am_I_Root ) PRINT *, '===========================' + current => NULL() + + END SUBROUTINE Print_HistoryExportsList +!EOC +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: HistoryExports_SetDataPointers +! +! !DESCRIPTION: +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE HistoryExports_SetDataPointers( am_I_Root, & + HistoryConfig, State_Chm, & + State_Grid, & + State_Diag, State_Met, & + RC ) +! +! !USES: +! + USE Registry_Mod, ONLY : Registry_Lookup + USE State_Grid_Mod, ONLY : GrdState + USE State_Chm_Mod, ONLY : ChmState + USE State_Diag_Mod, ONLY : DgnState + USE State_Met_Mod, ONLY : MetState +! +! !INPUT PARAMETERS: +! + LOGICAL, INTENT(IN) :: am_I_Root +! +! !INPUT AND OUTPUT PARAMETERS: +! + TYPE(HistoryConfigObj), POINTER :: HistoryConfig ! History config obj + TYPE(GrdState), INTENT(INOUT) :: State_Grid ! Grid State obj + TYPE(ChmState), INTENT(INOUT) :: State_Chm ! Chemistry State obj + TYPE(MetState), INTENT(INOUT) :: State_Met ! Meteorology State obj + TYPE(DgnState), INTENT(INOUT) :: State_Diag ! Diagnostics State obj +! +! !OUTPUT PARAMETERS: +! + INTEGER, INTENT(OUT) :: RC +! +! !REMARKS: +! ! +! !REVISION HISTORY: +! 01 Sep 2017 - E. Lundgren - Initial version +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + CHARACTER(LEN=255) :: ErrMsg + TYPE(HistoryExportObj), POINTER :: current + + ! ================================================================ + ! HistoryExports_SetDataPointers begins here + ! ================================================================ + __Iam__('HistoryExports_SetDataPointers') + RC = GC_SUCCESS + + IF ( am_I_Root ) THEN + WRITE(6,*) " " + WRITE(6,*) "Setting history variable pointers to GC and Export States" + ENDIF + + ! Loop over the History Exports list + current => HistoryConfig%HistoryExportsList%head + DO WHILE ( ASSOCIATED( current ) ) + + ! Get pointer to GC state data + !IF ( am_I_Root ) WRITE(6,*) current%name + IF ( current%isMET ) THEN + CALL Registry_Lookup( am_I_Root = am_I_Root, & + Registry = State_Met%Registry, & + RegDict = State_Met%RegDict, & + State = State_Met%State, & + Variable = current%registryID, & + Ptr2d_4 = current%GCStateData2d_4, & + Ptr2d_8 = current%GCStateData2d_8, & + Ptr2d_I = current%GCStateData2d_I, & + Ptr3d_4 = current%GCStateData3d_4, & + Ptr3d_8 = current%GCStateData3d_8, & + Ptr3d_I = current%GCStateData3d_I, & + RC = RC ) + ELSEIF ( current%isChem ) THEN + CALL Registry_Lookup( am_I_Root = am_I_Root, & + Registry = State_Chm%Registry, & + RegDict = State_Chm%RegDict, & + State = State_Chm%State, & + Variable = current%registryID, & + Ptr2d_4 = current%GCStateData2d_4, & + Ptr2d_8 = current%GCStateData2d_8, & + Ptr2d_I = current%GCStateData2d_I, & + Ptr3d_4 = current%GCStateData3d_4, & + Ptr3d_8 = current%GCStateData3d_8, & + Ptr3d_I = current%GCStateData3d_I, & + RC = RC ) + ELSEIF ( current%isDiag ) THEN + CALL Registry_Lookup( am_I_Root = am_I_Root, & + Registry = State_Diag%Registry, & + RegDict = State_Diag%RegDict, & + State = State_Diag%State, & + Variable = current%registryID, & + Ptr2d_4 = current%GCStateData2d_4, & + Ptr2d_8 = current%GCStateData2d_8, & + Ptr2d_I = current%GCStateData2d_I, & + Ptr3d_4 = current%GCStateData3d_4, & + Ptr3d_8 = current%GCStateData3d_8, & + Ptr3d_I = current%GCStateData3d_I, & + RC = RC ) + ENDIF + IF ( RC == GC_FAILURE ) THEN + ErrMsg = "Registry pointer not found for " // TRIM(current%name) // & + ". Check that the tag (e.g. species) is valid " // & + "for this diagnostic." + EXIT + ENDIF + + ! For CESM export, outfld accepts the data pointer directly but it + ! has to be in r8. Thus, allocate a r8 data type in exportData2d or + ! ExportData3d so that the rest of the code can be reused, then + ! update pointer data can just call outfld additionally. There is, + ! however, a memory hit from this. Revisit later. (hplin, 10/31/22) + ! + ! As a side note, in CESM-GC, State_Grid%NX is always 1 since the data + ! is chunkized. Only the State_Grid%NY matters here. + ! + ! Because NY could vary across chunk sizes, allocate one extra column + ! but only read up to the actual :State_Grid%NY. This allows for different + ! instances of GEOS-Chem to share the same ExportData allocation in separate + ! calls to the pointer update subroutine. + IF ( current%rank == 2 ) THEN + IF ( .not. ASSOCIATED(current%ExportData2d) ) THEN + ALLOCATE(current%ExportData2d(State_Grid%NX, State_Grid%NY+1), stat=RC) + ENDIF + ELSEIF ( current%rank == 3 ) THEN + IF ( .not. ASSOCIATED(current%ExportData3d) ) THEN + IF ( current%vloc == VLocationCenter ) THEN + ALLOCATE(current%ExportData2d(State_Grid%NX, State_Grid%NY+1, State_Grid%NZ ), stat=RC) + ELSEIF ( current%vloc == VLocationEdge ) THEN + ALLOCATE(current%ExportData2d(State_Grid%NX, State_Grid%NY+1, State_Grid%NZ+1), stat=RC) + ENDIF + ENDIF + + !! debugging + !IF ( Am_I_Root) THEN + ! WRITE(6,*) TRIM(current%name) + !ENDIF + + current => current%next + ENDDO + current => NULL() + + IF ( RC == GC_FAILURE ) THEN + CALL GC_ERROR( ErrMsg, RC, Iam ) + _ASSERT(.FALSE., 'informative message here') + RETURN + ENDIF + + END SUBROUTINE HistoryExports_SetDataPointers +!EOC +!------------------------------------------------------------------------------ +! GEOS-Chem Global Chemical Transport Model ! +!------------------------------------------------------------------------------ +!BOP +! +! !IROUTINE: Destroy_HistoryConfig +! +! !DESCRIPTION: Subroutine Destroy_HistoryConfig deallocates a HistoryConfig +! object and all of its member objects including the linked list of +! HistoryExport objects. +!\\ +!\\ +! !INTERFACE: +! + SUBROUTINE Destroy_HistoryConfig ( am_I_Root, HistoryConfig, RC ) +! +! !INPUT PARAMETERS: +! + LOGICAL, INTENT(IN) :: am_I_Root ! root CPU? + TYPE(HistoryConfigObj), POINTER :: HistoryConfig +! +! !INPUT/OUTPUT PARAMETERS: +! + INTEGER, INTENT(INOUT) :: RC ! Success? +! +! !REVISION HISTORY: +! 01 Sep 2017 - E. Lundgren - Initial version +! See https://github.com/geoschem/geos-chem for history +!EOP +!------------------------------------------------------------------------------ +!BOC +! +! !LOCAL VARIABLES: +! + TYPE(HistoryExportObj), POINTER :: current + TYPE(HistoryExportObj), POINTER :: next + + ! ================================================================ + ! Destroy_HistoryConfig begins here + ! ================================================================ + __Iam__('Destroy_HistoryConfig (cesmgc_history_mod.F90)') + + current => NULL() + next => NULL() + + ! Destroy each item in the linked list of HistoryExport objects + current => HistoryConfig%HistoryExportsList%head + IF ( ASSOCIATED( current ) ) next => current%next + DO WHILE ( ASSOCIATED( current ) ) + ! Clean up the temporary array used for exports as well + IF ( ASSOCIATED( current%ExportData2d ) ) THEN + DEALLOCATE ( current%ExportData2d, stat=RC ) + ENDIF + + IF ( ASSOCIATED( current%ExportData3d ) ) THEN + DEALLOCATE ( current%ExportData3d, stat=RC ) + ENDIF + + DEALLOCATE( current, STAT=RC ) + _ASSERT( RC == GC_SUCCESS, 'informative message here' ) + IF ( .NOT. ASSOCIATED ( next ) ) EXIT + current => next + next => current%next + ENDDO + + ! Deallocate the HistoryExportsList object + DEALLOCATE( HistoryConfig%HistoryExportsList, STAT=RC ) + _ASSERT( RC == GC_SUCCESS, 'informative message here' ) + + ! Deallocate the HistoryConfig object + DEALLOCATE( HistoryConfig, STAT=RC ) + _ASSERT( RC == GC_SUCCESS, 'informative message here' ) + + ! Final cleanup + current => NULL() + next => NULL() + + END SUBROUTINE Destroy_HistoryConfig +!EOC +END MODULE CESMGC_History_Mod \ No newline at end of file diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 9a552861ee..08ddc61030 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -34,6 +34,11 @@ module chemistry use chem_mods, only : nSlvd, slvd_Lst, slvd_ref_MMR + !-------------------------------------------------------------------- + ! GEOS-Chem History exports module + !-------------------------------------------------------------------- + use CESMGC_History_Mod + !-------------------------------------------------------------------- ! CAM modules !-------------------------------------------------------------------- @@ -110,6 +115,8 @@ module chemistry TYPE(DgnList ) :: Diag_List ! Diagnostics list object TYPE(TaggedDgnList ) :: TaggedDiag_List ! Tagged diagnostics list object + TYPE(HistoryConfigObj), POINTER :: HistoryConfig ! HistoryConfig object for History diagn. + type(physics_buffer_desc), pointer :: hco_pbuf2d(:,:) ! Pointer to 2D pbuf ! Mimic code in sfcvmr_mod.F90 @@ -1391,6 +1398,21 @@ subroutine chem_init(phys_state, pbuf2d) CALL Print_TaggedDiagList( Input_Opt%amIRoot, TaggedDiag_List, RC ) ENDIF + ! There are actually two copies of the history configuration, one is contained + ! within HistoryConfig to mimic the properties of GCHP. + ! + ! The above original implementation is similar to GC-Classic and WRF-GC + ! (hplin, 10/31/22) + CALL HistoryExports_SetServices(am_I_Root = masterproc, & + config_file = historyConfigFile, & + HistoryConfig = HistoryConfig, & + RC = RC ) + + IF ( RC /= GC_SUCCESS ) THEN + ErrMsg = 'Error encountered in "HistoryExports_SetServices"!' + CALL Error_Stop( ErrMsg, ThisLoc ) + ENDIF + DO I = BEGCHUNK, ENDCHUNK Input_Opt%amIRoot = (MasterProc .AND. (I == BEGCHUNK)) @@ -2020,6 +2042,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) INTEGER :: IERR INTEGER, SAVE :: iStep = 0 + LOGICAL, SAVE :: FIRST = .TRUE. LOGICAL :: rootChunk LOGICAL :: lastChunk INTEGER :: RC @@ -4116,6 +4139,23 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) mmr_tend = mmr_tend, & LCHNK = LCHNK ) + ! Compute new GEOS-Chem diagnostics into CESM History (hplin, 10/31/22) + IF ( FIRST ) THEN + CALL HistoryExports_SetDataPointers(rootChunk, & + HistoryConfig, State_Chm(LCHNK), & + State_Grid(LCHNK), & + State_Diag(LCHNK), State_Met(LCHNK), & + RC) + FIRST = .false. + ENDIF + + CALL CopyGCStates2Exports( am_I_Root = rootChunk, & + Input_Opt = Input_Opt, & + State_Grid = State_Grid(LCHNK), & + HistoryConfig = HistoryConfig, & + LCHNK = LCHNK, & + RC = RC ) + IF ( ghg_chem ) THEN ptend%lq(1) = .True. CALL outfld( 'CT_H2O_GHG', ptend%q(:,:,1), PCOLS, LCHNK ) @@ -4217,6 +4257,9 @@ subroutine chem_final ! Local variables INTEGER :: I, RC + ! Destroy the history interface between GC States and CAM exports + CALL Destroy_HistoryConfig(masterproc, HistoryConfig, RC) + ! Finalize GEOS-Chem CALL Cleanup_UCX From 5cac78c863c812a393b15749ea8e4eff66b42698 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 1 Nov 2022 10:58:59 -0600 Subject: [PATCH 061/160] Disable legacy Jval_ approach; new history diags with debug (wip) --- src/chemistry/geoschem/cesmgc_diag_mod.F90 | 129 +++++++++--------- src/chemistry/geoschem/cesmgc_history_mod.F90 | 26 ++-- 2 files changed, 84 insertions(+), 71 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_diag_mod.F90 b/src/chemistry/geoschem/cesmgc_diag_mod.F90 index 0a9201cb83..1bcd7f6d04 100644 --- a/src/chemistry/geoschem/cesmgc_diag_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_diag_mod.F90 @@ -452,33 +452,34 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF - DO M = 1, nPhotol - CALL get_TagInfo( Input_Opt = Input_Opt, & - tagID = 'PHO', & - State_Chm = State_Chm, & - Found = Found, & - RC = RC, & - N = M, & - tagName = tagName ) - - ! Trap potential errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Abnormal exit from routine "Get_TagInfo"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - SpcName = 'Jval_' // TRIM( tagName ) - CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & - TRIM(tagName) // ' photolysis rate' ) - ENDDO - ! Add JvalO3O1D and JvalO3O3P - SpcName = 'JvalO3O1D' - CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & - 'O3 -> O1D photolysis rate' ) - - SpcName = 'JvalO3O3P' - CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & - 'O3 -> O3P photolysis rate' ) + ! Remove as superceded + ! DO M = 1, nPhotol + ! CALL get_TagInfo( Input_Opt = Input_Opt, & + ! tagID = 'PHO', & + ! State_Chm = State_Chm, & + ! Found = Found, & + ! RC = RC, & + ! N = M, & + ! tagName = tagName ) + + ! ! Trap potential errors + ! IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Abnormal exit from routine "Get_TagInfo"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + ! ENDIF + + ! SpcName = 'Jval_' // TRIM( tagName ) + ! CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & + ! TRIM(tagName) // ' photolysis rate' ) + ! ENDDO + ! ! Add JvalO3O1D and JvalO3O3P + ! SpcName = 'JvalO3O1D' + ! CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & + ! 'O3 -> O1D photolysis rate' ) + + ! SpcName = 'JvalO3O3P' + ! CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & + ! 'O3 -> O3P photolysis rate' ) ! ========================================== ! Now add fields corresponding to State_Met @@ -1482,42 +1483,44 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & ! Diagnose photolysis rates ! =============================================== - IF ( ASSOCIATED(State_Diag%Jval) ) THEN - DO M = 1, nPhotol - CALL get_TagInfo( Input_Opt = Input_Opt, & - tagID = 'PHO', & - State_Chm = State_Chm, & - Found = Found, & - RC = RC, & - N = M, & - tagName = tagName ) - - ! Trap potential errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Abnormal exit from routine "Get_TagInfo"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - SpcName = 'Jval_' // TRIM( tagName ) - IF ( .NOT. hist_fld_active(TRIM(SpcName)) ) CYCLE - outTmp(:nY,:nZ) = REAL(State_Diag%Jval(1,:nY,nZ:1:-1,M),r8) - CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) - ENDDO - ENDIF - IF ( ASSOCIATED(State_Diag%JvalO3O1D) ) THEN - SpcName = 'JvalO3O1D' - IF ( hist_fld_active(TRIM(SpcName)) ) THEN - outTmp(:nY,:nZ) = REAL(State_Diag%JvalO3O1D(1,:nY,nZ:1:-1),r8) - CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) - ENDIF - ENDIF - IF ( ASSOCIATED(State_Diag%JvalO3O3P) ) THEN - SpcName = 'JvalO3O3P' - IF ( hist_fld_active(TRIM(SpcName)) ) THEN - outTmp(:nY,:nZ) = REAL(State_Diag%JvalO3O3P(1,:nY,nZ:1:-1),r8) - CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) - ENDIF - ENDIF + ! Disable as superceded by cesmgc_history_mod.F90 (hplin, 10/31/22) + + ! IF ( ASSOCIATED(State_Diag%Jval) ) THEN + ! DO M = 1, nPhotol + ! CALL get_TagInfo( Input_Opt = Input_Opt, & + ! tagID = 'PHO', & + ! State_Chm = State_Chm, & + ! Found = Found, & + ! RC = RC, & + ! N = M, & + ! tagName = tagName ) + + ! ! Trap potential errors + ! IF ( RC /= GC_SUCCESS ) THEN + ! ErrMsg = 'Abnormal exit from routine "Get_TagInfo"!' + ! CALL Error_Stop( ErrMsg, ThisLoc ) + ! ENDIF + + ! SpcName = 'Jval_' // TRIM( tagName ) + ! IF ( .NOT. hist_fld_active(TRIM(SpcName)) ) CYCLE + ! outTmp(:nY,:nZ) = REAL(State_Diag%Jval(1,:nY,nZ:1:-1,M),r8) + ! CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ! ENDDO + ! ENDIF + ! IF ( ASSOCIATED(State_Diag%JvalO3O1D) ) THEN + ! SpcName = 'JvalO3O1D' + ! IF ( hist_fld_active(TRIM(SpcName)) ) THEN + ! outTmp(:nY,:nZ) = REAL(State_Diag%JvalO3O1D(1,:nY,nZ:1:-1),r8) + ! CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ! ENDIF + ! ENDIF + ! IF ( ASSOCIATED(State_Diag%JvalO3O3P) ) THEN + ! SpcName = 'JvalO3O3P' + ! IF ( hist_fld_active(TRIM(SpcName)) ) THEN + ! outTmp(:nY,:nZ) = REAL(State_Diag%JvalO3O3P(1,:nY,nZ:1:-1),r8) + ! CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) + ! ENDIF + ! ENDIF ! =============================================== ! Diagnose fields corresponding to State_Met diff --git a/src/chemistry/geoschem/cesmgc_history_mod.F90 b/src/chemistry/geoschem/cesmgc_history_mod.F90 index 88f8d2d25b..0af0d1b830 100644 --- a/src/chemistry/geoschem/cesmgc_history_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_history_mod.F90 @@ -1,4 +1,4 @@ -#define ASSERT_(cond,msg) if(.not.cond) then; print *, "assertion error: ", Iam, __LINE__; call endrun("assertion error - look above - in cesmgc_history_mod.F90"); endif +#define _ASSERT(cond,msg) if(.not.cond) then; print *, "assertion error: ", Iam, __LINE__; call endrun("assertion error - look above - in cesmgc_history_mod.F90"); endif #define _Iam_(name) character(len=255) :: Iam=name #define __Iam__(name) integer :: STATUS; _Iam_(name) ! Above are compatibility shorthands to avoid excessive divergence from @@ -90,8 +90,8 @@ MODULE CESMGC_History_Mod ! Pointers to ESMF Export and GEOS-Chem State ! TODO: for now, include all possible data types in the registry. - REAL, POINTER :: ExportData2d(:,:) - REAL, POINTER :: ExportData3d(:,:,:) + REAL(f8), POINTER :: ExportData2d(:,:) + REAL(f8), POINTER :: ExportData3d(:,:,:) REAL(fp), POINTER :: GCStateData0d REAL(fp), POINTER :: GCStateData1d(:) REAL(fp), POINTER :: GCStateData2d(:,:) @@ -185,7 +185,7 @@ SUBROUTINE Init_HistoryConfig ( am_I_Root, HistoryConfig, configFile, RC ) ENDIF ! Optional debugging - CALL Print_HistoryExportsList( am_I_Root, HistoryConfig, RC ) + ! CALL Print_HistoryExportsList( am_I_Root, HistoryConfig, RC ) END SUBROUTINE Init_HistoryConfig !EOC @@ -779,6 +779,8 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig USE HCO_Interface_GC_Mod, ONLY : HCOI_GC_WriteDiagn USE Input_Opt_Mod, ONLY : OptInput USE State_Grid_Mod, ONLY : GrdState + + USE cam_history, ONLY : outfld ! ! !INPUT PARAMETERS: ! @@ -820,6 +822,8 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig current => HistoryConfig%HistoryExportsList%head DO WHILE ( ASSOCIATED( current ) ) + write(6,*) "copying", current%name, current%rank + ! if (MAPL_Am_I_Root()) THEN ! print *, ' Copying ' // TRIM(current%name) ! endif @@ -952,10 +956,10 @@ SUBROUTINE Print_HistoryExportsList( am_I_Root, HistoryConfig, RC ) PRINT *, " isMet: ", current%isMet PRINT *, " isChem: ", current%isChem PRINT *, " isDiag: ", current%isDiag - IF ( ASSOCIATED( current%ExportData2d )) + IF ( ASSOCIATED( current%ExportData2d )) THEN PRINT *, " E2D dim'l: ", size(current%ExportData2d) ENDIF - IF ( ASSOCIATED( current%ExportData3d )) + IF ( ASSOCIATED( current%ExportData3d )) THEN PRINT *, " E3D dim'l: ", size(current%ExportData3d) ENDIF PRINT *, " " @@ -992,6 +996,7 @@ SUBROUTINE HistoryExports_SetDataPointers( am_I_Root, & USE State_Chm_Mod, ONLY : ChmState USE State_Diag_Mod, ONLY : DgnState USE State_Met_Mod, ONLY : MetState + USE Registry_Params_Mod ! ! !INPUT PARAMETERS: ! @@ -1107,10 +1112,11 @@ SUBROUTINE HistoryExports_SetDataPointers( am_I_Root, & ELSEIF ( current%rank == 3 ) THEN IF ( .not. ASSOCIATED(current%ExportData3d) ) THEN IF ( current%vloc == VLocationCenter ) THEN - ALLOCATE(current%ExportData2d(State_Grid%NX, State_Grid%NY+1, State_Grid%NZ ), stat=RC) + ALLOCATE(current%ExportData3d(State_Grid%NX, State_Grid%NY+1, State_Grid%NZ ), stat=RC) ELSEIF ( current%vloc == VLocationEdge ) THEN - ALLOCATE(current%ExportData2d(State_Grid%NX, State_Grid%NY+1, State_Grid%NZ+1), stat=RC) + ALLOCATE(current%ExportData3d(State_Grid%NX, State_Grid%NY+1, State_Grid%NZ+1), stat=RC) ENDIF + ENDIF ENDIF !! debugging @@ -1122,6 +1128,10 @@ SUBROUTINE HistoryExports_SetDataPointers( am_I_Root, & ENDDO current => NULL() + ! Optional debugging + WRITE(6,*) "hplin debug: after HistoryExports_SetDataPointers" + CALL Print_HistoryExportsList( am_I_Root, HistoryConfig, RC ) + IF ( RC == GC_FAILURE ) THEN CALL GC_ERROR( ErrMsg, RC, Iam ) _ASSERT(.FALSE., 'informative message here') From 3f0e7253f7110fdf5f574f77912966a72826386d Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 1 Nov 2022 13:03:42 -0600 Subject: [PATCH 062/160] Fix diagnostic chunk bug; now functional --- src/chemistry/geoschem/cesmgc_history_mod.F90 | 18 ++++++++++++---- src/chemistry/geoschem/chemistry.F90 | 21 ++++++++++++------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_history_mod.F90 b/src/chemistry/geoschem/cesmgc_history_mod.F90 index 0af0d1b830..bd147c82a6 100644 --- a/src/chemistry/geoschem/cesmgc_history_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_history_mod.F90 @@ -780,7 +780,7 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig USE Input_Opt_Mod, ONLY : OptInput USE State_Grid_Mod, ONLY : GrdState - USE cam_history, ONLY : outfld + USE cam_history, ONLY : hist_fld_active, outfld ! ! !INPUT PARAMETERS: ! @@ -821,10 +821,13 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig ! Loop over the History Exports list current => HistoryConfig%HistoryExportsList%head DO WHILE ( ASSOCIATED( current ) ) + ! Skip if not active + if(.not. hist_fld_active(trim(current%name))) then + current => current%next + cycle + endif - write(6,*) "copying", current%name, current%rank - - ! if (MAPL_Am_I_Root()) THEN + ! if (am_I_Root) THEN ! print *, ' Copying ' // TRIM(current%name) ! endif IF ( current%rank == 2 ) THEN @@ -997,6 +1000,8 @@ SUBROUTINE HistoryExports_SetDataPointers( am_I_Root, & USE State_Diag_Mod, ONLY : DgnState USE State_Met_Mod, ONLY : MetState USE Registry_Params_Mod + + use cam_history, only: hist_fld_active ! ! !INPUT PARAMETERS: ! @@ -1042,6 +1047,11 @@ SUBROUTINE HistoryExports_SetDataPointers( am_I_Root, & ! Loop over the History Exports list current => HistoryConfig%HistoryExportsList%head DO WHILE ( ASSOCIATED( current ) ) + ! Skip if not active + if(.not. hist_fld_active(trim(current%name))) then + current => current%next + cycle + endif ! Get pointer to GC state data !IF ( am_I_Root ) WRITE(6,*) current%name diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 08ddc61030..384ba73d0e 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -4140,14 +4140,16 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) LCHNK = LCHNK ) ! Compute new GEOS-Chem diagnostics into CESM History (hplin, 10/31/22) - IF ( FIRST ) THEN - CALL HistoryExports_SetDataPointers(rootChunk, & - HistoryConfig, State_Chm(LCHNK), & - State_Grid(LCHNK), & - State_Diag(LCHNK), State_Met(LCHNK), & - RC) - FIRST = .false. - ENDIF + ! Note that the containers (data pointers) actually need to be updated every time step, + ! because the State_Chm(LCHNK) target changes. There is some registry lookup overhead + ! but mitigated by a check to the history field activeness. (hplin, 11/1/22) + ! + ! An alternative is to have multiple HistoryConfig... will make alternative implementation + CALL HistoryExports_SetDataPointers(rootChunk, & + HistoryConfig, State_Chm(LCHNK), & + State_Grid(LCHNK), & + State_Diag(LCHNK), State_Met(LCHNK), & + RC) CALL CopyGCStates2Exports( am_I_Root = rootChunk, & Input_Opt = Input_Opt, & @@ -4188,6 +4190,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF ( rootChunk ) WRITE(iulog,*) ' GEOS-Chem Chemistry step ', iStep, ' completed' IF ( lastChunk ) WRITE(iulog,*) ' Chemistry completed on all chunks completed of MasterProc' + IF ( FIRST ) THEN + FIRST = .false. + ENDIF end subroutine chem_timestep_tend From 23a2ca72261c9ff60c347464bfb896ceea59f8f2 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 3 Nov 2022 11:44:15 -0600 Subject: [PATCH 063/160] Update HEMCO external to 3.5.1 --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 43066f7169..0ef34d69c8 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -77,7 +77,7 @@ local_path = src/chemistry/geoschem/geoschem_src required = True [hemco] -tag = hemco-cesm1_0_hemco_3_5_0 +tag = hemco-cesm1_0_hemco_3_5_1 protocol = git repo_url = https://github.com/ESCOMP/HEMCO_CESM.git local_path = src/hemco From 73b1cc2638559fb019c5a5e8d54ef507b2d61453 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 3 Nov 2022 11:49:15 -0600 Subject: [PATCH 064/160] Add FCnudged_GC component set based on FCnudged. --- cime_config/config_compsets.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 93bb88ec3b..6206142da2 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -539,6 +539,11 @@ HIST_CAM60%GC%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + + FCnudged_GC + HIST_CAM60%GC%NUDG_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + + From babae9fd0e7c28f763afd9a006fecb705193a452 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 3 Nov 2022 13:03:39 -0600 Subject: [PATCH 065/160] Add hist_geoschem_nudged.xml configuration for FCnudged_GC --- .../use_cases/hist_geoschem_nudged.xml | 236 ++++++++++++++++++ cime_config/config_component.xml | 1 + 2 files changed, 237 insertions(+) create mode 100644 bld/namelist_files/use_cases/hist_geoschem_nudged.xml diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml new file mode 100644 index 0000000000..1bf8d90874 --- /dev/null +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -0,0 +1,236 @@ + + + + + + + + +/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ + +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + +/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc + +/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc + + + +00010101 + + +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc + + +.true. +.true. +.false. +0.25D0 + +SERIAL +atm/waccm/lb/LBC_1750-2014_CMIP6_0p5degLat_c170126.nc + +SERIAL + +'noy', 'nhx' + + + +.true. +'atm/cam/met/nudging/MERRA2_fv09_32L/' +'atm/cam/met/nudging/MERRA2_ne30_32L/' +'atm/cam/met/nudging/MERRA2_ne30pg3_32L/' +'atm/cam/met/nudging/MERRA2_ne0CONUS30x8_L32/' +'%y/MERRA2_fv09.cam2.i.%y-%m-%d-%s.nc' +'%y/MERRA2_ne30np4_L32.cam2.i.%y-%m-%d-%s.nc' +'%y/MERRA2_ne30pg3_L32.cam2.i.%y-%m-%d-%s.nc' +'%y/MERRA2_ne0CONUS30x8_L32.cam2.i.%y-%m-%d-%s.nc' +0 +0 +4 +8 + +48 +384 +1 +0.06 +1 +0.06 +1 +0.06 +0 +0.00 +0 +0.00 +2010 +2013 +1 +1 +2020 +12 +31 +0.0 +37. +9999. +56. +1. +5. +180. +264. +9999. +94. +1. +5. +.false. +.true. +33. +0.001 +0. +0.1 +.false. + + + + +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + + +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + +'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' + + + + + + 1,30,365,240,240,480,365,73,30 + 0,-24,-24,-3,-1,1,-24,-120,-240 +'A','A','A','A','A','A','A','A','I' + +.true. +.false. +.false. +.false. +.false. +.false. +.false. +.false. +.false. + + + + + 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', + 'LNO_COL_PROD', 'NO2_CLXF', 'SFNO', 'SFNH3', 'BRO', + 'CH3CL', 'CLO', 'CO2', 'HCL', 'HO2', 'HOCL', 'PHIS', 'Z3', + 'BENZ', 'C2H6', 'C3H8', 'CCL4', 'CFC11', 'CFC113', 'CFC12', + 'CH2O', 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'ACET', 'MOH', 'CH4', + 'CO', 'H2O2', 'HCFC22', 'HNO3', 'ISOP', 'MTPA', 'N2O', 'O3', + 'PAN', 'SO2', 'OH', 'ALK4', 'PRPE', 'BR', 'BRCL', 'BRO', 'BRNO3', + 'EOH', 'ETP', 'PRPE', 'RA3P', 'CCL4', 'H1211', 'H1301', + 'CFC11', 'CFC113', 'CFC114', 'CFC115', 'CFC12', 'CH2BR2', 'CH2O', + 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'MGLY', 'ACTA', 'MAP', 'MP', + 'CH4', 'CHBR3', 'CL', 'CL2', 'CL2O2', 'CLO', 'CLNO3', 'CO', + 'CO2', 'DMS', 'GLYC', 'GLYX', + 'H', 'H2', 'H2402', 'H2O2', 'HBR', 'HCFC141B', 'HCFC142B', 'HCFC22', + 'HCL', 'HNO3', 'HNO4', 'HOBR', 'HOCL', 'HONIT', 'HPALD1', 'HPALD2', 'HPALD3', + 'HPALD4', 'HAC', 'HC5A', 'IEPOXA', 'IEPOXB', 'IEPOXD', 'ISOP', 'IHN1', 'IHN2', 'IHN3', + 'IHN4', 'INO2B', 'INO2D', 'INPB', 'INPD', 'RIPA', 'RIPB', 'RIPC', 'RIPD', + 'MACR', 'MVKHP', 'MEK', 'MCRDH', 'MPAN', 'MVK', 'N', 'N2O', 'N2O5', 'ICN', + 'NH3', 'NH4', 'NO', 'NO2', 'NO3', 'PROPNN', 'OLND', 'OLNN', 'O', 'OCLO', + 'OCS', 'PAN', 'SO2', 'SO4', 'TOLU', 'XYLE', + 'R4O2', 'BRO2', 'ETO2', 'A3O2', 'MCO3', 'MO2', 'HO2', 'O1D', 'OH', + 'TSOA0', 'TSOA1', 'TSOA2', 'TSOA3', 'ASOAN', 'ASOA1', 'ASOA2', 'ASOA3', + 'SOAIE', 'SOAGX', + 'H2O', 'SAD_PSC', 'SAD_SULFC', 'SAD_TROP', 'SAD_AERO', 'REFF_AERO', + 'PDELDRY', 'RAD_PSC', 'RAD_SULFC', + 'HNO3_GAS', 'HNO3_STS', 'HNO3_NAT', 'NOX', 'NOY', 'CLOX', 'CLOY', + 'BROX', 'BROY', 'TCLY', 'TOTH', 'MASS', 'TBRY', 'HCL_GAS', + 'HCL_GAS', 'dgnumwet1', 'dgnumwet2', 'dgnumwet3', 'ABSORB', + 'AODVISdn', 'AODdnMODE1', 'AODVISstdn', 'AODNIRstdn', + 'AODUVstdn', 'AODdnMODE2', 'AODdnMODE3', 'AODdnDUST1', 'AODdnDUST2', + 'AODdnDUST3', 'AODVISstdn', 'AODUVstdn', 'AODNIRstdn', + 'AODNIRstdn', 'AODVISdn', 'AODUVdn', 'EXTINCTdn', 'EXTxASYMdn', + 'EXTINCTNIRdn', 'EXTINCTUVdn', + 'WD_EOH', 'WD_ETP', 'WD_RA3P', 'WD_CH2O', 'WD_ALD2', + 'WD_MGLY', 'WD_ACTA', 'WD_MAP', 'WD_MOH', 'WD_MP', + 'WD_GLYC', 'WD_H2O2', 'WD_SO4', 'WD_HBR', 'WD_HCL', + 'WD_HNO3', 'WD_HOBR', 'WD_HOCL', 'WD_HONIT', 'WD_HAC', 'WD_IEPOXA', + 'WD_IEPOXB', 'WD_IEPOXD', 'WD_MVK', 'WD_NH3', 'WD_NH4', 'WD_SO2', + 'DF_EOH', 'DF_ETP', 'DF_RA3P', 'DF_CH2O', 'DF_ALD2', 'DF_ACET', + 'DF_MGLY', 'DF_ACTA', 'DF_MAP', 'DF_MOH', 'DF_MP', 'DF_CO', + 'DF_GLYC', 'DF_H2O2', 'DF_SO4', 'DF_HNO3', 'DF_HNO4', + 'DF_HONIT', 'DF_HPALD1', 'DF_HPALD2', 'DF_HPALD3', 'DF_HPALD4', + 'DF_HAC', 'DF_IEPOXA', 'DF_IEPOXB', 'DF_IEPOXD', + 'DF_MPAN', 'DF_NH3', 'DF_NH4', 'DF_NO', + 'DF_NO2', 'DF_O3', 'DF_PAN', 'DF_SO2', + 'SO2_CLXF', 'SO2_XFRC', + 'CO_CLXF', 'NO2_CLXF', 'LNO_PROD', 'LNO_COL_PROD', + 'SFEOH', 'SFALD2', 'SFMEK', 'SFCH2O', 'SFC2H6', 'SFC3H8', + 'SFALK4', 'SFPRPE', 'SFBENZ', 'SFTOLU', 'SFXYLE', + 'SFNO', 'SFACTA', 'SFDMS', 'SFMEK', 'SFSO2', 'SFNH3', + 'SFISOP', 'SFMTPA', 'SFMOH', 'SFACET', 'SFCO', + 'MEG_ISOP', 'MEG_MOH', 'MEG_EOH', 'MEG_CH2O', 'MEG_ALD2', 'MEG_ACTA', + 'MEG_ACET', 'MEG_HCOOH', 'MEG_HCN', 'MEG_CO', 'MEG_C2H6', 'MEG_C2H4', + 'MEG_C3H8', 'MEG_ALK4', 'MEG_PRPE', 'MEG_TOLU', 'MEG_LIMO', 'MEG_MTPA', + 'MEG_MTPO', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', + 'DHNO3CHM', 'DH2O2CHM', 'DO3CHM', 'DCOCHM', 'AQ_SO2', 'GS_SO2', 'SO2_CLXF', + 'MASS', 'ABSORB', + 'JvalO3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', + 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a1', + 'ncl_a2', 'ncl_a3', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', + 'soa1_a1', 'soa2_a1', 'soa3_a1', 'soa4_a1', 'soa5_a1', 'soa1_a2', 'soa2_a2', 'soa3_a2', + 'soa4_a2', 'soa5_a2', 'bc_c1', 'bc_c4', 'dst_c1', 'dst_c2', 'dst_c3', 'ncl_c1', 'ncl_c1', + 'ncl_c2', 'ncl_c3', 'pom_c1', 'pom_c4', 'so4_c1', 'so4_c2', 'so4_c3', 'soa1_c1', 'soa2_c1', + 'soa3_c1', 'soa4_c1', 'soa5_c1', 'soa1_c2', 'soa2_c2', 'soa3_c2', 'soa4_c2', 'soa5_c2', + 'bc_a1SFWET', 'num_a1','num_a2','num_a3','num_a4','num_c1','num_c2','num_c3','num_c4', + 'bc_a1SFWET', 'bc_a4SFWET', 'dst_a1SFWET', 'dst_a2SFWET', 'dst_a3SFWET', 'ncl_a1SFWET', + 'ncl_a2SFWET', 'ncl_a3SFWET', 'pom_a1SFWET', 'pom_a4SFWET', + 'so4_a1SFWET', 'so4_a2SFWET', 'so4_a3SFWET', 'soa1_a1SFWET', 'soa1_a2SFWET', + 'soa2_a1SFWET', 'soa2_a2SFWET', 'soa3_a1SFWET', 'soa3_a2SFWET', + 'soa4_a1SFWET', 'soa4_a2SFWET', 'soa5_a1SFWET', 'soa5_a2SFWET', 'bc_c1SFWET', + 'bc_c4SFWET', 'dst_c1SFWET', 'dst_c2SFWET', 'dst_c3SFWET', + 'ncl_c1SFWET', 'ncl_c2SFWET', 'ncl_c3SFWET', 'pom_c1SFWET', 'pom_c4SFWET', + 'so4_c1SFWET', 'so4_c2SFWET', 'so4_c3SFWET', 'soa1_c1SFWET', + 'soa1_c2SFWET', 'soa2_c1SFWET', 'soa2_c2SFWET', 'soa3_c1SFWET', 'soa3_c2SFWET', + 'soa4_c1SFWET', 'soa4_c2SFWET', 'soa5_c1SFWET', 'soa5_c2SFWET', + 'bc_a1DDF', 'bc_a4DDF', 'dst_a1DDF', 'dst_a2DDF', 'dst_a3DDF', 'ncl_a1DDF', + 'ncl_a2DDF', 'ncl_a3DDF', 'pom_a1DDF', + 'pom_a4DDF', 'so4_a1DDF', 'so4_a2DDF', 'so4_a3DDF', 'soa1_a1DDF', + 'soa1_a2DDF', 'soa2_a1DDF', 'soa2_a2DDF', 'soa3_a1DDF', + 'soa3_a2DDF', 'soa4_a1DDF', 'soa4_a2DDF', 'soa5_a1DDF', 'soa5_a2DDF', + 'bc_c1DDF', 'bc_c4DDF', 'dst_c1DDF', 'dst_c2DDF', + 'dst_c3DDF', 'ncl_c1DDF', 'ncl_c2DDF', 'ncl_c3DDF', 'pom_c1DDF', + 'pom_c4DDF', 'so4_c1DDF', 'so4_c2DDF', 'so4_c3DDF', + 'soa1_c1DDF', 'soa1_c2DDF', 'soa2_c1DDF', 'soa2_c2DDF', 'soa3_c1DDF', + 'soa3_c2DDF', 'soa4_c1DDF', 'soa4_c2DDF', 'soa5_c1DDF', + 'soa5_c2DDF', 'num_a1DDF', 'num_a2DDF', 'num_a3DDF', 'num_a4DDF', + 'num_c1DDF', 'num_c2DDF', 'num_c3DDF', 'num_c4DDF', + 'bc_a4_CLXF', 'pom_a4_CLXF', 'so4_a1_CLXF', 'so4_a2_CLXF', + 'num_a1_CLXF', 'num_a2_CLXF', 'SFbc_a4', 'SFpom_a4', 'SFso4_a1', + 'SFso4_a2', 'SFnum_a1', 'SFnum_a2', 'SFnum_a3', 'so4_a1_sfgaex1', + 'so4_a2_sfgaex1', 'so4_a3_sfgaex1', 'soa1_a1_sfgaex1', 'soa1_a2_sfgaex1', + 'soa2_a1_sfgaex1', 'soa2_a2_sfgaex1', 'soa3_a1_sfgaex1', 'soa3_a2_sfgaex1', + 'soa4_a1_sfgaex1', 'soa4_a2_sfgaex1', 'soa5_a1_sfgaex1', 'soa5_a2_sfgaex1', + 'so4_a2_sfnnuc1', 'so4_c1AQH2SO4', 'so4_c2AQH2SO4', 'so4_c3AQH2SO4', + 'so4_c1AQSO4', 'so4_c2AQSO4', 'so4_c3AQSO4', 'SFdst_a1', 'SFdst_a2', 'SFdst_a3', + 'SFncl_a1', 'SFncl_a2', 'SFncl_a3', + 'TMOCS', 'TMSO2', 'TMso4_a1', 'TMso4_a2', 'TMso4_a3', + 'BURDENDUSTdn', 'BURDENPOMdn', 'BURDENSO4dn', 'BURDENSOAdn', + 'BURDENSEASALTdn','BURDENBCdn', 'PM25' + + + + + diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 6be27aa18b..bb78e132ee 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -262,6 +262,7 @@ hist_trop_strat_vbsext_cam6 hist_trop_strat_vbsfire_cam6 hist_geoschem + hist_geoschem_nudged waccmx_ma_hist_cam6 1850-PD_cam5 From f19429eac49a3c7810725b15e9bc1f7137f20fab Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 3 Nov 2022 13:06:50 -0600 Subject: [PATCH 066/160] Remove config_compsets.xml change that does not belong to this branch and was added in error --- cime_config/config_compsets.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 6206142da2..93bb88ec3b 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -539,11 +539,6 @@ HIST_CAM60%GC%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV - - FCnudged_GC - HIST_CAM60%GC%NUDG_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV - - From dca0f5ea099e8ad36758bdeafe72fc66e0c40f43 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 3 Nov 2022 13:07:38 -0600 Subject: [PATCH 067/160] Expand CAM history field name maximum to 32 chars --- src/control/cam_history_support.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/cam_history_support.F90 b/src/control/cam_history_support.F90 index 1ec5cc2e1c..6df7d906b2 100644 --- a/src/control/cam_history_support.F90 +++ b/src/control/cam_history_support.F90 @@ -25,7 +25,7 @@ module cam_history_support integer, parameter, public :: max_string_len = shr_kind_cxx integer, parameter, public :: max_chars = shr_kind_cl ! max chars for char variables - integer, parameter, public :: fieldname_len = 24 ! max chars for field name + integer, parameter, public :: fieldname_len = 32 ! max chars for field name integer, parameter, public :: fieldname_suffix_len = 3 ! length of field name suffix ("&IC") integer, parameter, public :: fieldname_lenp2 = fieldname_len + 2 ! allow for extra characters ! max_fieldname_len = max chars for field name (including suffix) From c74560a8d8003fd4d95ba06546ac20ab2287b6e9 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 3 Nov 2022 15:04:35 -0600 Subject: [PATCH 068/160] Fix bug that was forcing HEMCO_Config.rc as hemco_config_file --- bld/build-namelist | 1 - 1 file changed, 1 deletion(-) diff --git a/bld/build-namelist b/bld/build-namelist index 472514e9ea..c93581b002 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -2841,7 +2841,6 @@ else { } # HEMCO -$nl->set_variable_value('hemco_nl', 'hemco_config_File', "'HEMCO_Config.rc'"); my $hco = $cfg->get('hemco'); if ( $hco eq '1' ) { add_default($nl, 'cam_physics_mesh'); From ea168b0858509fd41f70c9417ba3168156304732 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 3 Nov 2022 17:34:48 -0400 Subject: [PATCH 069/160] Fix typo in HEMCO-CESM tag Signed-off-by: Lizzie Lundgren --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 0ef34d69c8..bb476b1c7d 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -77,7 +77,7 @@ local_path = src/chemistry/geoschem/geoschem_src required = True [hemco] -tag = hemco-cesm1_0_hemco_3_5_1 +tag = hemco-cesm1_0_hemco3_5_1 protocol = git repo_url = https://github.com/ESCOMP/HEMCO_CESM.git local_path = src/hemco From 0af7d6649f0efb177c79719dd58ee6fadeb00ead Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 4 Nov 2022 15:44:27 -0600 Subject: [PATCH 070/160] Remove debugging routines --- src/chemistry/geoschem/cesmgc_history_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_history_mod.F90 b/src/chemistry/geoschem/cesmgc_history_mod.F90 index bd147c82a6..dcc89b128e 100644 --- a/src/chemistry/geoschem/cesmgc_history_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_history_mod.F90 @@ -1139,8 +1139,8 @@ SUBROUTINE HistoryExports_SetDataPointers( am_I_Root, & current => NULL() ! Optional debugging - WRITE(6,*) "hplin debug: after HistoryExports_SetDataPointers" - CALL Print_HistoryExportsList( am_I_Root, HistoryConfig, RC ) + !WRITE(6,*) "hplin debug: after HistoryExports_SetDataPointers" + !CALL Print_HistoryExportsList( am_I_Root, HistoryConfig, RC ) IF ( RC == GC_FAILURE ) THEN CALL GC_ERROR( ErrMsg, RC, Iam ) From 17b61802c74dc492378b377a7e1a0a97f862cd8a Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 9 Nov 2022 12:57:07 -0700 Subject: [PATCH 071/160] Fix HEMCO namelist bugs Signed-off-by: Lizzie Lundgren --- bld/build-namelist | 3 +++ bld/namelist_files/namelist_definition.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bld/build-namelist b/bld/build-namelist index c93581b002..98957459bd 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -2844,6 +2844,9 @@ else { my $hco = $cfg->get('hemco'); if ( $hco eq '1' ) { add_default($nl, 'cam_physics_mesh'); + add_default($nl, 'hemco_config_file'); + add_default($nl, 'hemco_grid_xdim'); + add_default($nl, 'hemco_grid_ydim'); } # Physics options diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 8c08feee05..96d81e703f 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4881,7 +4881,7 @@ Default: set by build-namelist. - Full pathname to HEMCO_Config.rc, which prescribes emission inventories Default: set by build-namelist. From 13607ad53295974392e98ed9d3e6422489a02819 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 9 Nov 2022 13:35:42 -0700 Subject: [PATCH 072/160] Upgrade GEOS-Chem to version 14.0.1 Signed-off-by: Lizzie Lundgren hemco --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index bb476b1c7d..f02dc79ee4 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -70,7 +70,7 @@ hash = ff76a231 required = True [geoschem] -tag = 14.0.0-alpha.9 +tag = 14.0.1 protocol = git repo_url = https://github.com/geoschem/geos-chem.git local_path = src/chemistry/geoschem/geoschem_src From dc68379b20ee8749127cd1545d5f04f2c68114d5 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 14 Nov 2022 12:59:58 -0700 Subject: [PATCH 073/160] Fix MEGAN emissions in CESM-GC - active_fall_flxvoc is a logical and not integer --- src/chemistry/geoschem/cesmgc_emissions_mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 index f231d8dd8c..3b4eaf35ad 100644 --- a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 @@ -531,7 +531,7 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS ! MEGAN emissions ... !----------------------------------------------------------------------- - IF ( active_Fall_flxvoc > 0 .AND. shr_megan_mechcomps_n > 0 ) THEN + IF ( active_Fall_flxvoc .AND. shr_megan_mechcomps_n > 0 ) THEN ! set MEGAN fluxes DO N = 1, shr_megan_mechcomps_n DO J = 1, nY From 224faaff2e434cba8c4d85dc4f0f84df1122f26b Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 14 Nov 2022 16:20:38 -0700 Subject: [PATCH 074/160] Add comments on xml source --- bld/namelist_files/use_cases/hist_geoschem_nudged.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml index 1bf8d90874..d5ab458374 100644 --- a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -2,7 +2,7 @@ - + @@ -14,7 +14,7 @@ /glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc - + 00010101 From 07d197ce55dc1f8a974486e2db4dc391fced1de4 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 16 Nov 2022 13:48:34 -0700 Subject: [PATCH 075/160] Update comments; remove more debug routines --- src/chemistry/geoschem/cesmgc_history_mod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_history_mod.F90 b/src/chemistry/geoschem/cesmgc_history_mod.F90 index dcc89b128e..866003b976 100644 --- a/src/chemistry/geoschem/cesmgc_history_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_history_mod.F90 @@ -88,7 +88,7 @@ MODULE CESMGC_History_Mod LOGICAL :: isDiag TYPE(HistoryExportObj), POINTER :: next - ! Pointers to ESMF Export and GEOS-Chem State + ! Pointers to temporaries for CAM Export and GEOS-Chem State ! TODO: for now, include all possible data types in the registry. REAL(f8), POINTER :: ExportData2d(:,:) REAL(f8), POINTER :: ExportData3d(:,:,:) @@ -166,7 +166,7 @@ SUBROUTINE Init_HistoryConfig ( am_I_Root, HistoryConfig, configFile, RC ) RETURN ENDIF ! Optional debugging - CALL Print_DiagList( am_I_Root, HistoryConfig%DiagList, RC ) + ! CALL Print_DiagList( am_I_Root, HistoryConfig%DiagList, RC ) CALL Init_TaggedDiagList( am_I_Root, HistoryConfig%DiagList, & HistoryConfig%TaggedDiagList, RC ) @@ -175,7 +175,7 @@ SUBROUTINE Init_HistoryConfig ( am_I_Root, HistoryConfig, configFile, RC ) RETURN ENDIF ! Optional debugging - CALL Print_TaggedDiagList( am_I_Root, HistoryConfig%TaggedDiagList, RC ) + ! CALL Print_TaggedDiagList( am_I_Root, HistoryConfig%TaggedDiagList, RC ) CALL Init_HistoryExportsList( am_I_Root, HistoryConfig, RC ) From a0742f43bc9db3de5bee67ae5fa7c078a78bd6fc Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 16 Nov 2022 18:41:36 -0700 Subject: [PATCH 076/160] Remove array temporary allocations; now use one outTmp_3D and outTmp_2D for 3D and 2D data. --- src/chemistry/geoschem/cesmgc_history_mod.F90 | 77 +++++-------------- 1 file changed, 18 insertions(+), 59 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_history_mod.F90 b/src/chemistry/geoschem/cesmgc_history_mod.F90 index 866003b976..e71cd4f893 100644 --- a/src/chemistry/geoschem/cesmgc_history_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_history_mod.F90 @@ -90,8 +90,6 @@ MODULE CESMGC_History_Mod ! Pointers to temporaries for CAM Export and GEOS-Chem State ! TODO: for now, include all possible data types in the registry. - REAL(f8), POINTER :: ExportData2d(:,:) - REAL(f8), POINTER :: ExportData3d(:,:,:) REAL(fp), POINTER :: GCStateData0d REAL(fp), POINTER :: GCStateData1d(:) REAL(fp), POINTER :: GCStateData2d(:,:) @@ -500,8 +498,6 @@ SUBROUTINE Init_HistoryExport ( am_I_Root, NewHistExp, name, & ENDIF NewHistExp%next => NULL() - NewHistExp%ExportData2d => NULL() - NewHistExp%ExportData3d => NULL() NewHistExp%GCStateData0d => NULL() NewHistExp%GCStateData1d => NULL() NewHistExp%GCStateData2d => NULL() @@ -781,6 +777,7 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig USE State_Grid_Mod, ONLY : GrdState USE cam_history, ONLY : hist_fld_active, outfld + USE SHR_KIND_MOD, ONLY : shr_kind_r8 ! ! !INPUT PARAMETERS: ! @@ -812,6 +809,11 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig CHARACTER(LEN=255) :: ErrMsg TYPE(HistoryExportObj), POINTER :: current + ! Temporaries for CAM exports. + ! Note that in CESM, State_Grid%NX is always length 1. (hplin, 11/16/22) + REAL(shr_kind_r8) :: outTmp_3D(State_Grid%NY, State_Grid%NZ) + REAL(shr_kind_r8) :: outTmp_2D(State_Grid%NY) + ! ================================================================ ! CopyGCStates2Exports begins here ! ================================================================ @@ -832,14 +834,14 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig ! endif IF ( current%rank == 2 ) THEN IF ( ASSOCIATED( current%GCStateData2d ) ) THEN - current%ExportData2d(:,1:State_Grid%NY) = current%GCStateData2d(:,1:State_Grid%NY) + outTmp_2D(1:State_Grid%NY) = current%GCStateData2d(1,1:State_Grid%NY) ELSE IF ( ASSOCIATED( current%GCStateData2d_4 ) ) THEN - current%ExportData2d(:,1:State_Grid%NY) = current%GCStateData2d_4(:,1:State_Grid%NY) + outTmp_2D(1:State_Grid%NY) = current%GCStateData2d_4(1,1:State_Grid%NY) ELSE IF ( ASSOCIATED( current%GCStateData2d_8 ) ) THEN - current%ExportData2d(:,1:State_Grid%NY) = current%GCStateData2d_8(:,1:State_Grid%NY) + outTmp_2D(1:State_Grid%NY) = current%GCStateData2d_8(1,1:State_Grid%NY) ELSE IF ( ASSOCIATED( current%GCStateData2d_I ) ) THEN ! Convert integer to float (integers not allowed in MAPL exports) - current%ExportData2d(:,1:State_Grid%NY) = FLOAT(current%GCStateData2d_I(:,1:State_Grid%NY)) + outTmp_2D(1:State_Grid%NY) = FLOAT(current%GCStateData2d_I(1,1:State_Grid%NY)) ELSE RC = GC_FAILURE ErrMsg = "No GC 2D pointer found for " // TRIM(current%name) @@ -848,18 +850,18 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig ! Now call outfld to output for this chunk call outfld(trim(current%name), & - current%ExportData2d(1, 1:State_Grid%NY), & ! Chunk width always 1 + outTmp_2D, & ! Chunk width always 1 State_Grid%NY, & LCHNK ) ELSEIF ( current%rank == 3 ) THEN IF ( ASSOCIATED( current%GCStateData3d ) ) THEN - current%ExportData3d(:,1:State_Grid%NY,:) = current%GCStateData3d(:,1:State_Grid%NY,:) + outTmp_3D(1:State_Grid%NY, :) = current%GCStateData3d(1,1:State_Grid%NY,:) ELSE IF ( ASSOCIATED( current%GCStateData3d_4 ) ) THEN - current%ExportData3d(:,1:State_Grid%NY,:) = current%GCStateData3d_4(:,1:State_Grid%NY,:) + outTmp_3D(1:State_Grid%NY, :) = current%GCStateData3d_4(1,1:State_Grid%NY,:) ELSE IF ( ASSOCIATED( current%GCStateData3d_8 ) ) THEN - current%ExportData3d(:,1:State_Grid%NY,:) = current%GCStateData3d_8(:,1:State_Grid%NY,:) + outTmp_3D(1:State_Grid%NY, :) = current%GCStateData3d_8(1,1:State_Grid%NY,:) ELSE IF ( ASSOCIATED( current%GCStateData3d_I ) ) THEN - current%ExportData3d(:,1:State_Grid%NY,:) = FLOAT(current%GCStateData3d_I(:,1:State_Grid%NY,:)) + outTmp_3D(1:State_Grid%NY, :) = FLOAT(current%GCStateData3d_I(1,1:State_Grid%NY,:)) ELSE RC = GC_FAILURE ErrMsg = "No GC 3D pointer found for " // TRIM(current%name) @@ -869,14 +871,13 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig ! If using GEOS-5, flip the data vertically to match model ! convention ! Also do this in CESM. (hplin, 10/31/22) - LMAX = SIZE(current%ExportData3d, 3) - current%ExportData3d(:,:,1:LMAX) = & - current%ExportData3d(:,:,LMAX:1:-1) + LMAX = SIZE(outTmp_3D, 2) + outTmp_3D(:,1:LMAX) = outTmp_3D(:,LMAX:1:-1) #endif ! Now call outfld to output for this chunk call outfld(trim(current%name), & - current%ExportData3d(1, 1:State_Grid%NY, :), & ! Chunk width always 1. TOA is 1 + outTmp_3D, & ! Chunk width always 1. TOA is 1 State_Grid%NY, & LCHNK ) ENDIF @@ -959,12 +960,6 @@ SUBROUTINE Print_HistoryExportsList( am_I_Root, HistoryConfig, RC ) PRINT *, " isMet: ", current%isMet PRINT *, " isChem: ", current%isChem PRINT *, " isDiag: ", current%isDiag - IF ( ASSOCIATED( current%ExportData2d )) THEN - PRINT *, " E2D dim'l: ", size(current%ExportData2d) - ENDIF - IF ( ASSOCIATED( current%ExportData3d )) THEN - PRINT *, " E3D dim'l: ", size(current%ExportData3d) - ENDIF PRINT *, " " ENDIF current => current%next @@ -1102,33 +1097,6 @@ SUBROUTINE HistoryExports_SetDataPointers( am_I_Root, & EXIT ENDIF - ! For CESM export, outfld accepts the data pointer directly but it - ! has to be in r8. Thus, allocate a r8 data type in exportData2d or - ! ExportData3d so that the rest of the code can be reused, then - ! update pointer data can just call outfld additionally. There is, - ! however, a memory hit from this. Revisit later. (hplin, 10/31/22) - ! - ! As a side note, in CESM-GC, State_Grid%NX is always 1 since the data - ! is chunkized. Only the State_Grid%NY matters here. - ! - ! Because NY could vary across chunk sizes, allocate one extra column - ! but only read up to the actual :State_Grid%NY. This allows for different - ! instances of GEOS-Chem to share the same ExportData allocation in separate - ! calls to the pointer update subroutine. - IF ( current%rank == 2 ) THEN - IF ( .not. ASSOCIATED(current%ExportData2d) ) THEN - ALLOCATE(current%ExportData2d(State_Grid%NX, State_Grid%NY+1), stat=RC) - ENDIF - ELSEIF ( current%rank == 3 ) THEN - IF ( .not. ASSOCIATED(current%ExportData3d) ) THEN - IF ( current%vloc == VLocationCenter ) THEN - ALLOCATE(current%ExportData3d(State_Grid%NX, State_Grid%NY+1, State_Grid%NZ ), stat=RC) - ELSEIF ( current%vloc == VLocationEdge ) THEN - ALLOCATE(current%ExportData3d(State_Grid%NX, State_Grid%NY+1, State_Grid%NZ+1), stat=RC) - ENDIF - ENDIF - ENDIF - !! debugging !IF ( Am_I_Root) THEN ! WRITE(6,*) TRIM(current%name) @@ -1199,15 +1167,6 @@ SUBROUTINE Destroy_HistoryConfig ( am_I_Root, HistoryConfig, RC ) current => HistoryConfig%HistoryExportsList%head IF ( ASSOCIATED( current ) ) next => current%next DO WHILE ( ASSOCIATED( current ) ) - ! Clean up the temporary array used for exports as well - IF ( ASSOCIATED( current%ExportData2d ) ) THEN - DEALLOCATE ( current%ExportData2d, stat=RC ) - ENDIF - - IF ( ASSOCIATED( current%ExportData3d ) ) THEN - DEALLOCATE ( current%ExportData3d, stat=RC ) - ENDIF - DEALLOCATE( current, STAT=RC ) _ASSERT( RC == GC_SUCCESS, 'informative message here' ) IF ( .NOT. ASSOCIATED ( next ) ) EXIT From cbe679e2de8a2a0c7195f50b9f0560210bd68395 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 17 Nov 2022 10:16:47 -0700 Subject: [PATCH 077/160] Remove unnecessary legacy code in cesmgc_diag_mod.F90 --- src/chemistry/geoschem/cesmgc_diag_mod.F90 | 185 --------------------- 1 file changed, 185 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_diag_mod.F90 b/src/chemistry/geoschem/cesmgc_diag_mod.F90 index 1bcd7f6d04..300402f518 100644 --- a/src/chemistry/geoschem/cesmgc_diag_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_diag_mod.F90 @@ -40,7 +40,6 @@ MODULE CESMGC_Diag_Mod PUBLIC :: CESMGC_Diag_Calc PUBLIC :: wetdep_name, wtrate_name - INTEGER :: nPhotol ! Number of diagnosed photolytic reactions CHARACTER(LEN=fieldname_len) :: srcnam(gas_pcnst) ! Names of source/sink tendencies CHARACTER(LEN=fieldname_len) :: wetdep_name(gas_pcnst) ! Wet deposition tendencies CHARACTER(LEN=fieldname_len) :: wtrate_name(gas_pcnst) ! Column tendencies for wet dep @@ -438,85 +437,6 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) CALL Add_Default ('CT_H2O' , history_budget_histfile_num, ' ') ENDIF - CALL get_TagInfo( Input_Opt = Input_Opt, & - tagID = 'PHO', & - State_Chm = State_Chm, & - Found = Found, & - RC = RC, & - nTags = nPhotol ) - - ! Trap potential errors - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Abnormal exit from routine "Get_TagInfo", could not ' // & - ' get nTags!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF - - ! Remove as superceded - ! DO M = 1, nPhotol - ! CALL get_TagInfo( Input_Opt = Input_Opt, & - ! tagID = 'PHO', & - ! State_Chm = State_Chm, & - ! Found = Found, & - ! RC = RC, & - ! N = M, & - ! tagName = tagName ) - - ! ! Trap potential errors - ! IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Abnormal exit from routine "Get_TagInfo"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - ! ENDIF - - ! SpcName = 'Jval_' // TRIM( tagName ) - ! CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & - ! TRIM(tagName) // ' photolysis rate' ) - ! ENDDO - ! ! Add JvalO3O1D and JvalO3O3P - ! SpcName = 'JvalO3O1D' - ! CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & - ! 'O3 -> O1D photolysis rate' ) - - ! SpcName = 'JvalO3O3P' - ! CALL Addfld( TRIM(SpcName), (/ 'lev' /), 'A', '1/s', & - ! 'O3 -> O3P photolysis rate' ) - - ! ========================================== - ! Now add fields corresponding to State_Met - ! ========================================== - - ! Copied from Headers/registry_mod.F90 - ! Point to the head node of the Registry - Current => State_Met%Registry - - ! As long as the current node isn't NULL - DO WHILE( ASSOCIATED( Current ) ) - - ! Get the REGISTRY ITEM belonging to this node of the Registry - Item => Current%Item - - ! Only print on the root CPU - IF ( ASSOCIATED( Item ) ) THEN - - !IF (( TRIM(Item%FullName(1:8)) /= 'MET_XLAI' ) .AND. & - ! ( TRIM(Item%FullName(1:8)) /= 'MET_IUSE' ) .AND. & - ! ( TRIM(Item%FullName(1:9)) /= 'MET_ILAND' )) THEN - ! IF ( TRIM(Item%DimNames) == 'xy' ) THEN - ! CALL Addfld( TRIM( Item%FullName ), horiz_only, 'A', & - ! TRIM( Item%Units ), TRIM( Item%Description ) ) - ! ELSE - ! CALL Addfld( TRIM( Item%FullName ), (/ 'lev' /), 'A', & - ! TRIM( Item%Units ), TRIM( Item%Description ) ) - ! ENDIF - !ENDIF - - ENDIF - - ! Point to next node of the Registry - Current => Current%Next - - ENDDO - ! Chemical tendencies DO N = 1, gas_pcnst M = map2chm(N) @@ -987,8 +907,6 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & INTEGER :: I, J, L, M, N, ND, SM INTEGER :: idx INTEGER :: RC - INTEGER :: Source_KindVal ! KIND value of data - INTEGER :: Output_KindVal ! KIND value for output INTEGER :: Rank ! Size of data INTEGER :: nY, nZ @@ -1479,113 +1397,10 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) ENDDO - ! =============================================== - ! Diagnose photolysis rates - ! =============================================== - - ! Disable as superceded by cesmgc_history_mod.F90 (hplin, 10/31/22) - - ! IF ( ASSOCIATED(State_Diag%Jval) ) THEN - ! DO M = 1, nPhotol - ! CALL get_TagInfo( Input_Opt = Input_Opt, & - ! tagID = 'PHO', & - ! State_Chm = State_Chm, & - ! Found = Found, & - ! RC = RC, & - ! N = M, & - ! tagName = tagName ) - - ! ! Trap potential errors - ! IF ( RC /= GC_SUCCESS ) THEN - ! ErrMsg = 'Abnormal exit from routine "Get_TagInfo"!' - ! CALL Error_Stop( ErrMsg, ThisLoc ) - ! ENDIF - - ! SpcName = 'Jval_' // TRIM( tagName ) - ! IF ( .NOT. hist_fld_active(TRIM(SpcName)) ) CYCLE - ! outTmp(:nY,:nZ) = REAL(State_Diag%Jval(1,:nY,nZ:1:-1,M),r8) - ! CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) - ! ENDDO - ! ENDIF - ! IF ( ASSOCIATED(State_Diag%JvalO3O1D) ) THEN - ! SpcName = 'JvalO3O1D' - ! IF ( hist_fld_active(TRIM(SpcName)) ) THEN - ! outTmp(:nY,:nZ) = REAL(State_Diag%JvalO3O1D(1,:nY,nZ:1:-1),r8) - ! CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) - ! ENDIF - ! ENDIF - ! IF ( ASSOCIATED(State_Diag%JvalO3O3P) ) THEN - ! SpcName = 'JvalO3O3P' - ! IF ( hist_fld_active(TRIM(SpcName)) ) THEN - ! outTmp(:nY,:nZ) = REAL(State_Diag%JvalO3O3P(1,:nY,nZ:1:-1),r8) - ! CALL OutFld( TRIM(SpcName), outTmp(:nY,:), nY, LCHNK ) - ! ENDIF - ! ENDIF - ! =============================================== ! Diagnose fields corresponding to State_Met ! =============================================== - ! Copied from Headers/registry_mod.F90 - ! Point to the head node of the Registry - Current => State_Met%Registry - - Source_KindVal = KINDVAL_F8 - Output_KindVal = KINDVAL_F8 - - ! As long as the current node isn't NULL - DO WHILE( ASSOCIATED( Current ) ) - - ! Get the REGISTRY ITEM belonging to this node of the Registry - Item => Current%Item - - ! Only print on the root CPU - IF ( ASSOCIATED( Item ) ) THEN - - SpcName = TRIM(Item%FullName) - IF (( TRIM(Item%FullName(1:8)) /= 'MET_XLAI' ) .AND. & - ( TRIM(Item%FullName(1:8)) /= 'MET_IUSE' ) .AND. & - ( TRIM(Item%FullName(1:9)) /= 'MET_ILAND' )) THEN - CALL Registry_Lookup( am_I_Root = Input_Opt%amIRoot, & - Registry = State_Met%Registry, & - RegDict = State_Met%RegDict, & - State = State_Met%State, & - Variable = Item%FullName, & - Source_KindVal = Source_KindVal, & - Output_KindVal = Output_KindVal, & - Rank = Rank, & - OnLevelEdges = OnLevelEdges, & - Ptr0d_8 = Ptr0d_8, & - Ptr1d_8 = Ptr1d_8, & - Ptr2d_8 = Ptr2d_8, & - Ptr3d_8 = Ptr3d_8, & - RC = RC ) - - !IF ( hist_fld_active(TRIM(SpcName)) ) THEN - ! IF ( Source_KindVal /= KINDVAL_I4 ) THEN - ! IF ( Rank == 2 ) THEN - ! outTmp(:nY,nZ) = REAL(Ptr2d_8(1,:nY),r8) - ! CALL Outfld( TRIM( Item%FullName ), outTmp(:nY,nZ), nY, LCHNK ) - ! ELSEIF ( Rank == 3 ) THEN - ! ! For now, treat variables defined on level edges by ignoring top - ! ! most layer - ! outTmp(:nY,:nZ) = REAL(Ptr3d_8(1,:nY,nZ:1:-1),r8) - ! CALL Outfld( TRIM( Item%FullName ), outTmp(:nY,:), nY, LCHNK ) - ! ELSE - ! IF ( rootChunk ) Write(iulog,*) " Item ", TRIM(Item%FullName), & - ! " is of rank ", Rank, " and will not be diagnosed!" - ! ENDIF - ! ENDIF - !ENDIF - ENDIF - - ENDIF - - ! Point to next node of the Registry - Current => Current%Next - - ENDDO - SpcName = 'SZA' IF ( hist_fld_active(TRIM(SpcName)) ) THEN outTmp(:nY,1) = ACOS(MIN(MAX(State_Met%SUNCOS(1,:nY),-1._r8),1._r8))/pi*180.e+0_r8 From 0c6204e1fe72a6df112b86a31be365d7e9524d22 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 17 Nov 2022 10:17:49 -0700 Subject: [PATCH 078/160] Update comments; remove extraneous GC_FAILURE call to address review comments --- src/chemistry/geoschem/cesmgc_history_mod.F90 | 14 +++++++------- src/chemistry/geoschem/chemistry.F90 | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_history_mod.F90 b/src/chemistry/geoschem/cesmgc_history_mod.F90 index e71cd4f893..5e221cdafb 100644 --- a/src/chemistry/geoschem/cesmgc_history_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_history_mod.F90 @@ -110,7 +110,7 @@ MODULE CESMGC_History_Mod END TYPE HistoryExportObj ! ! !REVISION HISTORY: -! 01 Sep 2017 - E. Lundgren - Initial version +! 01 Sep 2017 - E. Lundgren - Initial version for GCHP/GEOS ! 19 Oct 2022 - H.P. Lin - Adapted for CESM ! See https://github.com/geoschem/geos-chem for history !EOP @@ -353,7 +353,6 @@ SUBROUTINE Init_HistoryExportsList ( am_I_Root, HistoryConfig, RC ) isDiag=isDiag, & RC=RC ) IF ( RC == GC_FAILURE ) THEN - RC = GC_FAILURE ErrMsg = "History export init fail for " // TRIM(current%name) EXIT ENDIF @@ -362,7 +361,6 @@ SUBROUTINE Init_HistoryExportsList ( am_I_Root, HistoryConfig, RC ) CALL Append_HistoryExportsList( am_I_Root, NewHistExp, & HistoryConfig, RC ) IF ( RC == GC_FAILURE ) THEN - RC = GC_FAILURE ErrMsg = "History export append fail for " // TRIM(current%name) EXIT ENDIF @@ -667,7 +665,8 @@ SUBROUTINE HistoryExports_SetServices( am_I_Root, config_file, & ! !REMARKS: ! ! ! !REVISION HISTORY: -! 01 Sep 2017 - E. Lundgren - Initial version +! 01 Sep 2017 - E. Lundgren - Initial version for GCHP/GEOS +! 19 Oct 2022 - H.P. Lin - Adapted for CESM ! See https://github.com/geoschem/geos-chem for history !EOP !------------------------------------------------------------------------------ @@ -682,7 +681,7 @@ SUBROUTINE HistoryExports_SetServices( am_I_Root, config_file, & ! HistoryExports_SetServices begins here ! ================================================================ - ! For MAPL/ESMF error handling (defines Iam and STATUS) + ! For error handling (defines Iam and STATUS) __Iam__('HistoryExports_SetServices (cesmgc_history_mod.F90)') RC = GC_SUCCESS @@ -797,7 +796,8 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig ! !REMARKS: ! ! ! !REVISION HISTORY: -! 01 Sep 2017 - E. Lundgren - Initial version +! 01 Sep 2017 - E. Lundgren - Initial version for GCHP/GEOS +! 19 Oct 2022 - H.P. Lin - Adapted for CESM ! See https://github.com/geoschem/geos-chem for history !EOP !------------------------------------------------------------------------------ @@ -867,7 +867,7 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig ErrMsg = "No GC 3D pointer found for " // TRIM(current%name) EXIT ENDIF -#if defined( MODEL_GEOS ) || defined( MODEL_CESM ) +#if defined( MODEL_CESM ) ! If using GEOS-5, flip the data vertically to match model ! convention ! Also do this in CESM. (hplin, 10/31/22) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 384ba73d0e..48699a0590 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -1401,7 +1401,9 @@ subroutine chem_init(phys_state, pbuf2d) ! There are actually two copies of the history configuration, one is contained ! within HistoryConfig to mimic the properties of GCHP. ! - ! The above original implementation is similar to GC-Classic and WRF-GC + ! The above original implementation is similar to GC-Classic and WRF-GC, + ! and is used by cesmgc_diag_mod for lookups for certain diagnostic + ! fields for compatibility with CAM-chem outputs. ! (hplin, 10/31/22) CALL HistoryExports_SetServices(am_I_Root = masterproc, & config_file = historyConfigFile, & @@ -4143,8 +4145,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Note that the containers (data pointers) actually need to be updated every time step, ! because the State_Chm(LCHNK) target changes. There is some registry lookup overhead ! but mitigated by a check to the history field activeness. (hplin, 11/1/22) - ! - ! An alternative is to have multiple HistoryConfig... will make alternative implementation CALL HistoryExports_SetDataPointers(rootChunk, & HistoryConfig, State_Chm(LCHNK), & State_Grid(LCHNK), & From 76bd32aa35dc0ead94b841cc3bf985b5bd206486 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 15 Dec 2022 10:14:08 -0700 Subject: [PATCH 079/160] Change CMEPS and coupler remotes from fvitt to ESCOMP github Francis Vitt's updates required for GEOS-Chem are now merged into the main development branches and therefore his GitHub branches do not need to be used. Signed-off-by: Lizzie Lundgren --- Externals.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index eed5b04ee6..d807ba80e7 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -21,9 +21,9 @@ externals = Externals.cfg required = True [cmeps] -tag = cmeps0.13.70 +tag = cmeps0.13.71 protocol = git -repo_url = https://github.com/fvitt/CMEPS.git +repo_url = https://github.com/ESCOMP/CMEPS.git local_path = components/cmeps required = True @@ -38,7 +38,7 @@ required = True [cpl7] tag = cpl7.0.14 protocol = git -repo_url = https://github.com/fvitt/CESM_CPL7andDataComps +repo_url = https://github.com/ESCOMP/CESM_CPL7andDataComps local_path = components/cpl7 required = True From a20ed2df3ac978f6891ea744299262fc9b06c92f Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 21 Dec 2022 13:47:37 -0700 Subject: [PATCH 080/160] Reduce GEOS-Chem dir mozart files; build mozart and pp_none if geos-chem This update required modifications to mozart/mo_chem_utls.F90 to allow optional argument for comparing upper-case letters in function get_spc_ndx. Signed-off-by: Lizzie Lundgren --- bld/configure | 4 + src/chemistry/geoschem/cesmgc_diag_mod.F90 | 93 +- src/chemistry/geoschem/charge_neutrality.F90 | 176 --- src/chemistry/geoschem/chemistry.F90 | 35 +- src/chemistry/geoschem/clybry_fam.F90 | 180 --- src/chemistry/geoschem/epp_ionization.F90 | 508 ------- src/chemistry/geoschem/fire_emissions.F90 | 1 - src/chemistry/geoschem/gas_wetdep_opts.F90 | 78 -- src/chemistry/geoschem/mo_apex.F90 | 314 ----- src/chemistry/geoschem/mo_chem_utls.F90 | 180 --- src/chemistry/geoschem/mo_drydep.F90 | 1 - .../geoschem/mo_gas_phase_chemdr.F90 | 1180 ----------------- src/chemistry/geoschem/mo_ghg_chem.F90 | 1 - src/chemistry/geoschem/mo_lightning.F90 | 1 - src/chemistry/geoschem/mo_mean_mass.F90 | 1 - src/chemistry/geoschem/mo_setinv.F90 | 1 - src/chemistry/geoschem/mo_tracname.F90 | 14 - src/chemistry/geoschem/rate_diags.F90 | 177 --- src/chemistry/geoschem/tracer_cnst.F90 | 1 - src/chemistry/geoschem/tracer_srcs.F90 | 1 - src/chemistry/geoschem/upper_bc.F90 | 243 ---- .../modal_aero/modal_aero_gasaerexch.F90 | 5 +- src/chemistry/modal_aero/sox_cldaero_mod.F90 | 7 +- src/chemistry/mozart/mo_chem_utls.F90 | 20 +- 24 files changed, 93 insertions(+), 3129 deletions(-) delete mode 100644 src/chemistry/geoschem/charge_neutrality.F90 delete mode 100644 src/chemistry/geoschem/clybry_fam.F90 delete mode 100644 src/chemistry/geoschem/epp_ionization.F90 delete mode 120000 src/chemistry/geoschem/fire_emissions.F90 delete mode 100644 src/chemistry/geoschem/gas_wetdep_opts.F90 delete mode 100644 src/chemistry/geoschem/mo_apex.F90 delete mode 100644 src/chemistry/geoschem/mo_chem_utls.F90 delete mode 120000 src/chemistry/geoschem/mo_drydep.F90 delete mode 100644 src/chemistry/geoschem/mo_gas_phase_chemdr.F90 delete mode 120000 src/chemistry/geoschem/mo_ghg_chem.F90 delete mode 120000 src/chemistry/geoschem/mo_lightning.F90 delete mode 120000 src/chemistry/geoschem/mo_mean_mass.F90 delete mode 120000 src/chemistry/geoschem/mo_setinv.F90 delete mode 100644 src/chemistry/geoschem/mo_tracname.F90 delete mode 100644 src/chemistry/geoschem/rate_diags.F90 delete mode 120000 src/chemistry/geoschem/tracer_cnst.F90 delete mode 120000 src/chemistry/geoschem/tracer_srcs.F90 delete mode 100644 src/chemistry/geoschem/upper_bc.F90 diff --git a/bld/configure b/bld/configure index fe4c2dfb20..70ffe02a83 100755 --- a/bld/configure +++ b/bld/configure @@ -2187,6 +2187,10 @@ sub write_filepath print $fh "$camsrcdir/src/chemistry/modal_aero\n"; print $fh "$camsrcdir/src/chemistry/aerosol\n"; } + # Also build Mozart for dependencies elsewhere in CESM + # Some modules ignored since also in GEOS-Chem + print $fh "$camsrcdir/src/chemistry/pp_none\n"; + print $fh "$camsrcdir/src/chemistry/mozart\n"; } } diff --git a/src/chemistry/geoschem/cesmgc_diag_mod.F90 b/src/chemistry/geoschem/cesmgc_diag_mod.F90 index 300402f518..b689ef3bb5 100644 --- a/src/chemistry/geoschem/cesmgc_diag_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_diag_mod.F90 @@ -191,6 +191,7 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) ! Logical LOGICAL :: Found + LOGICAL :: compare_uppercase ! Compare upper-case names LOGICAL :: history_aerosol ! Output the MAM aerosol ! tendencies LOGICAL :: history_chemistry @@ -239,51 +240,53 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) history_scwaccm_forcing_out = history_scwaccm_forcing, & history_dust_out = history_dust ) - id_no3 = get_spc_ndx( 'NO3' ) - id_o3 = get_spc_ndx( 'O3' ) - id_oh = get_spc_ndx( 'OH' ) - id_ho2 = get_spc_ndx( 'HO2' ) - id_so4_a1 = get_spc_ndx( 'so4_a1' ) - id_so4_a2 = get_spc_ndx( 'so4_a2' ) - id_so4_a3 = get_spc_ndx( 'so4_a3' ) - id_num_a2 = get_spc_ndx( 'num_a2' ) - id_num_a3 = get_spc_ndx( 'num_a3' ) - id_dst_a3 = get_spc_ndx( 'dst_a3' ) - id_ncl_a3 = get_spc_ndx( 'ncl_a3' ) - id_co2 = get_spc_ndx( 'CO2' ) - id_no = get_spc_ndx( 'NO' ) - id_h = get_spc_ndx( 'H' ) - id_o = get_spc_ndx( 'O' ) - id_o2 = get_spc_ndx( 'O2' ) - id_ch4 = get_spc_ndx( 'CH4' ) - id_h2o = get_spc_ndx( 'H2O' ) - id_n2o = get_spc_ndx( 'N2O' ) - id_cfc11 = get_spc_ndx( 'CFC11' ) - id_cfc12 = get_spc_ndx( 'CFC12' ) - - id_bry = get_spc_ndx( 'BRY' ) - id_cly = get_spc_ndx( 'CLY' ) - - id_dst01 = get_spc_ndx( 'DST01' ) - id_dst02 = get_spc_ndx( 'DST02' ) - id_dst03 = get_spc_ndx( 'DST03' ) - id_dst04 = get_spc_ndx( 'DST04' ) - id_sslt01 = get_spc_ndx( 'SSLT01' ) - id_sslt02 = get_spc_ndx( 'SSLT02' ) - id_sslt03 = get_spc_ndx( 'SSLT03' ) - id_sslt04 = get_spc_ndx( 'SSLT04' ) - id_soa = get_spc_ndx( 'SOA' ) - id_so4 = get_spc_ndx( 'SO4' ); id_so4 = -1 ! Don't pick up GEOS-Chem's SO4! - id_oc1 = get_spc_ndx( 'OC1' ) - id_oc2 = get_spc_ndx( 'OC2' ) - id_cb1 = get_spc_ndx( 'CB1' ) - id_cb2 = get_spc_ndx( 'CB2' ) - id_nh4no3 = get_spc_ndx( 'NH4NO3' ) - id_soam = get_spc_ndx( 'SOAM' ) - id_soai = get_spc_ndx( 'SOAI' ) - id_soat = get_spc_ndx( 'SOAT' ) - id_soab = get_spc_ndx( 'SOAB' ) - id_soax = get_spc_ndx( 'SOAX' ) + compare_uppercase = .true. + + id_no3 = get_spc_ndx( 'NO3', compare_uppercase ) + id_o3 = get_spc_ndx( 'O3', compare_uppercase ) + id_oh = get_spc_ndx( 'OH', compare_uppercase ) + id_ho2 = get_spc_ndx( 'HO2', compare_uppercase ) + id_so4_a1 = get_spc_ndx( 'so4_a1', compare_uppercase ) + id_so4_a2 = get_spc_ndx( 'so4_a2', compare_uppercase ) + id_so4_a3 = get_spc_ndx( 'so4_a3', compare_uppercase ) + id_num_a2 = get_spc_ndx( 'num_a2', compare_uppercase ) + id_num_a3 = get_spc_ndx( 'num_a3', compare_uppercase ) + id_dst_a3 = get_spc_ndx( 'dst_a3', compare_uppercase ) + id_ncl_a3 = get_spc_ndx( 'ncl_a3', compare_uppercase ) + id_co2 = get_spc_ndx( 'CO2', compare_uppercase ) + id_no = get_spc_ndx( 'NO', compare_uppercase ) + id_h = get_spc_ndx( 'H', compare_uppercase ) + id_o = get_spc_ndx( 'O', compare_uppercase ) + id_o2 = get_spc_ndx( 'O2', compare_uppercase ) + id_ch4 = get_spc_ndx( 'CH4', compare_uppercase ) + id_h2o = get_spc_ndx( 'H2O', compare_uppercase ) + id_n2o = get_spc_ndx( 'N2O', compare_uppercase ) + id_cfc11 = get_spc_ndx( 'CFC11', compare_uppercase ) + id_cfc12 = get_spc_ndx( 'CFC12', compare_uppercase ) + + id_bry = get_spc_ndx( 'BRY', compare_uppercase ) + id_cly = get_spc_ndx( 'CLY', compare_uppercase ) + + id_dst01 = get_spc_ndx( 'DST01', compare_uppercase ) + id_dst02 = get_spc_ndx( 'DST02', compare_uppercase ) + id_dst03 = get_spc_ndx( 'DST03', compare_uppercase ) + id_dst04 = get_spc_ndx( 'DST04', compare_uppercase ) + id_sslt01 = get_spc_ndx( 'SSLT01', compare_uppercase ) + id_sslt02 = get_spc_ndx( 'SSLT02', compare_uppercase ) + id_sslt03 = get_spc_ndx( 'SSLT03', compare_uppercase ) + id_sslt04 = get_spc_ndx( 'SSLT04', compare_uppercase ) + id_soa = get_spc_ndx( 'SOA', compare_uppercase ) + id_so4 = get_spc_ndx( 'SO4', compare_uppercase ); id_so4 = -1 ! Don't pick up GEOS-Chem's SO4! + id_oc1 = get_spc_ndx( 'OC1', compare_uppercase ) + id_oc2 = get_spc_ndx( 'OC2', compare_uppercase ) + id_cb1 = get_spc_ndx( 'CB1', compare_uppercase ) + id_cb2 = get_spc_ndx( 'CB2', compare_uppercase ) + id_nh4no3 = get_spc_ndx( 'NH4NO3', compare_uppercase ) + id_soam = get_spc_ndx( 'SOAM', compare_uppercase ) + id_soai = get_spc_ndx( 'SOAI', compare_uppercase ) + id_soat = get_spc_ndx( 'SOAT', compare_uppercase ) + id_soab = get_spc_ndx( 'SOAB', compare_uppercase ) + id_soax = get_spc_ndx( 'SOAX', compare_uppercase ) bulkaero_species(:) = -1 bulkaero_species(1:20) = (/ id_dst01, id_dst02, id_dst03, id_dst04, & diff --git a/src/chemistry/geoschem/charge_neutrality.F90 b/src/chemistry/geoschem/charge_neutrality.F90 deleted file mode 100644 index 92ec519000..0000000000 --- a/src/chemistry/geoschem/charge_neutrality.F90 +++ /dev/null @@ -1,176 +0,0 @@ -module charge_neutrality - - use shr_kind_mod, only : r8 => shr_kind_r8 - use ppgrid, only : pcols, pver - !use mo_chem_utls, only : get_spc_ndx - - implicit none - - private - public :: charge_balance - - interface charge_balance - module procedure charge_fix_vmr - module procedure charge_fix_mmr ! for fixing charge balance after vertical diffusion - end interface - - !integer, parameter :: pos_ion_n = 22 - !character(len=16), parameter :: pos_ion_names(pos_ion_n) = (/ & - ! 'Np ','N2p ','Op ','O2p ','NOp ', & - ! 'O4p ','O2p_H2O ','Hp_H2O ','Hp_2H2O ','Hp_3H2O ', & - ! 'Hp_4H2O ','Hp_5H2O ','H3Op_OH ','Hp_3N1 ','Hp_4N1 ', & - ! 'NOp_H2O ','NOp_2H2O ','NOp_3H2O ','NOp_CO2 ','NOp_N2 ', & - ! 'Op2P ','Op2D ' /) - - !integer, parameter :: neg_ion_n = 21 - !character(len=16), parameter :: neg_ion_names(neg_ion_n) = (/ & - ! 'Om ','O2m ','O3m ','O4m ','OHm ', & - ! 'CO3m ','CO4m ','NO2m ','NO3m ','HCO3m ', & - ! 'CLm ','CLOm ','CLm_H2O ','CLm_HCL ','CO3m_H2O ', & - ! 'NO3m_H2O ','CO3m2H2O ','NO2m_H2O ','NO3m2H2O ','NO3mHNO3 ', & - ! 'NO3m_HCL ' /) - -contains - - !----------------------------------------------------------------------- - ! ... force ion/electron balance - !----------------------------------------------------------------------- - subroutine charge_fix_vmr( ncol, vmr ) - - !----------------------------------------------------------------------- - ! ... dummy arguments - !----------------------------------------------------------------------- - integer, intent(in) :: ncol - real(r8), intent(inout) :: vmr(:,:,:) ! concentration - - !----------------------------------------------------------------------- - ! ... local variables - !----------------------------------------------------------------------- - integer :: i, n - integer :: elec_ndx - real(r8) :: wrk(ncol,pver) - - !elec_ndx = get_spc_ndx('e') - - !!-------------------------------------------------------------------- - !! If electrons are in the chemistry add up charges to get electrons - !!-------------------------------------------------------------------- - !if( elec_ndx > 0 ) then - ! wrk(:,:) = 0._r8 - - ! do i = 1,pos_ion_n - ! n = get_spc_ndx(pos_ion_names(i)) - ! if (n>0) then - ! wrk(:ncol,:) = wrk(:ncol,:) + vmr(:ncol,:,n) - ! endif - ! enddo - ! do i = 1,neg_ion_n - ! n = get_spc_ndx(neg_ion_names(i)) - ! if (n>0) then - ! wrk(:ncol,:) = wrk(:ncol,:) - vmr(:ncol,:,n) - ! endif - ! enddo - - ! where ( wrk(:,:)<0._r8 ) - ! wrk(:,:)=0._r8 - ! end where - - ! vmr(:ncol,:,elec_ndx) = wrk(:ncol,:) - - !end if - - end subroutine charge_fix_vmr - - !----------------------------------------------------------------------- - ! ... force ion/electron balance - !----------------------------------------------------------------------- - subroutine charge_fix_mmr(state, pbuf) - - use constituents, only : cnst_get_ind - use physconst, only : mbarv ! Constituent dependent mbar - use short_lived_species, only : slvd_index,slvd_pbf_ndx => pbf_idx ! Routines to access short lived species in pbuf - use chem_mods, only : adv_mass - use physics_buffer, only : pbuf_get_field,physics_buffer_desc ! Needed to get variables from physics buffer - use physics_types, only : physics_state - - !----------------------------------------------------------------------- - ! ... dummy arguments - !----------------------------------------------------------------------- - type(physics_state), intent(inout), target :: state - type(physics_buffer_desc), pointer :: pbuf(:) ! physics buffer - - !----------------------------------------------------------------------- - ! ... local variables - !----------------------------------------------------------------------- - !integer :: i, n, ns, nc - !integer :: elec_ndx - !integer :: lchnk !Chunk number from state structure - !integer :: ncol !Number of columns in this chunk from state structure - - !real(r8), dimension(:,:,:), pointer :: q ! model mass mixing ratios - !real(r8), dimension(:,:), pointer :: qs ! Pointer to access fields in pbuf - - !character(len=16) :: name - !real(r8) :: vmr(state%ncol,pver) - !real(r8) :: wrk(state%ncol,pver) - - !!----------------------------------------------------------------------- - !elec_ndx = get_spc_ndx('e') - - !!-------------------------------------------------------------------- - !! If electrons are simulated enforce charge neutrality ... - !!-------------------------------------------------------------------- - !if( elec_ndx > 0 ) then - ! lchnk = state%lchnk - ! ncol = state%ncol - ! q => state%q - ! wrk(:,:) = 0._r8 - - ! do i = 1,pos_ion_n+neg_ion_n - ! if (i .le. pos_ion_n) then - ! name = pos_ion_names(i) - ! else - ! name = neg_ion_names(i-pos_ion_n) - ! endif - ! n = get_spc_ndx(name) - - ! if (n>0) then - ! call cnst_get_ind( name, nc, abort=.false. ) - ! if (nc>0) then - ! vmr(:ncol,:) = mbarv(:ncol,:,lchnk) * q(:ncol,:,nc) / adv_mass(n) - ! else - ! ! not transported - ! ns = slvd_index( name ) - ! if (ns>0) then - ! call pbuf_get_field(pbuf, slvd_pbf_ndx, qs, start=(/1,1,ns/), kount=(/pcols,pver,1/) ) - ! vmr(:ncol,:) = mbarv(:ncol,:,lchnk) * qs(:ncol,:) / adv_mass(n) - ! endif - ! endif - ! if (i .le. pos_ion_n) then - ! wrk(:ncol,:) = wrk(:ncol,:) + vmr(:ncol,:) - ! else - ! wrk(:ncol,:) = wrk(:ncol,:) - vmr(:ncol,:) - ! endif - ! end if - ! end do - - ! where ( wrk(:,:)<0._r8 ) - ! wrk(:,:)=0._r8 - ! end where - - ! call cnst_get_ind( 'e', nc, abort=.false. ) - - ! if (nc>0) then - ! q(:ncol,:,nc) = adv_mass(elec_ndx) * wrk(:ncol,:) / mbarv(:ncol,:,lchnk) - ! else - ! ! not transported - ! ns = slvd_index( 'e' ) - ! call pbuf_get_field(pbuf, slvd_pbf_ndx, qs, start=(/1,1,ns/), kount=(/pcols,pver,1/) ) - ! qs(:ncol,:) = adv_mass(elec_ndx) * wrk(:ncol,:) / mbarv(:ncol,:,lchnk) - ! endif - - !endif - - end subroutine charge_fix_mmr - -end module charge_neutrality diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 48699a0590..46dcf32309 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -181,13 +181,16 @@ module chemistry contains !================================================================================================ - logical function chem_is (name) + function chem_is (name) result (chem_name_is) - use mo_chem_utls, only : utls_chem_is + use string_utils, only : to_lower character(len=*), intent(in) :: name - chem_is = utls_chem_is(name) + logical :: chem_name_is + + chem_name_is = (( to_lower(name) == 'geoschem' ) .or. & + ( to_lower(name) == 'geos-chem' )) end function chem_is @@ -467,7 +470,7 @@ subroutine chem_register map2GCinv(M) = N ENDIF ! Map constituent onto chemically-active species (aka as indexed in solsym) - M = get_spc_ndx(TRIM(trueName)) + M = get_spc_ndx(TRIM(trueName), compare_uppercase=.true.) IF ( M > 0 ) THEN mapCnst(N) = M ENDIF @@ -529,7 +532,7 @@ subroutine chem_register ! The species names need to be convert to upper case as, ! for instance, BR2 != Br2 - drySpc_ndx(N) = get_spc_ndx( to_upper(drydep_list(N)) ) + drySpc_ndx(N) = get_spc_ndx( to_upper(drydep_list(N)), compare_uppercase=.true. ) if (debug .and. masterproc) write(iulog,'(a,a,a,i4,a,i4)') ' -> species ', trim(drydep_list(N)), ' in dry deposition list at index ', N, ' maps to species in solsym at index ', drySpc_ndx(N) @@ -1643,8 +1646,8 @@ subroutine chem_init(phys_state, pbuf2d) ! Free pointer SpcInfo => NULL() - l_H2SO4 = get_spc_ndx('H2SO4') - l_SO4 = get_spc_ndx('SO4') + l_H2SO4 = get_spc_ndx('H2SO4', compare_uppercase=.true.) + l_SO4 = get_spc_ndx('SO4', compare_uppercase=.true.) ! Get indices for physical fields in physics buffer NDX_PBLH = pbuf_get_index('pblh' ) @@ -3893,10 +3896,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) speciesName_2 = 'ASOAN' speciesName_2 = 'SOAIE' speciesName_2 = 'SOAGX' - K1 = get_spc_ndx(TRIM(speciesName_1)) - K2 = get_spc_ndx(TRIM(speciesName_2)) - K3 = get_spc_ndx(TRIM(speciesName_3)) - K4 = get_spc_ndx(TRIM(speciesName_4)) + K1 = get_spc_ndx(TRIM(speciesName_1), compare_uppercase=.true.) + K2 = get_spc_ndx(TRIM(speciesName_2), compare_uppercase=.true.) + K3 = get_spc_ndx(TRIM(speciesName_3), compare_uppercase=.true.) + K4 = get_spc_ndx(TRIM(speciesName_4), compare_uppercase=.true.) bulkMass(:nY,:nZ) = 0.0e+00_r8 DO iBin = 1, 2 DO M = 1, ntot_amode @@ -3930,8 +3933,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) speciesName_1 = 'TSOA3' speciesName_2 = 'ASOA3' ENDIF - K1 = get_spc_ndx(TRIM(speciesName_1)) - K2 = get_spc_ndx(TRIM(speciesName_2)) + K1 = get_spc_ndx(TRIM(speciesName_1), compare_uppercase=.true. ) + K2 = get_spc_ndx(TRIM(speciesName_2), compare_uppercase=.true. ) bulkMass(:nY,:nZ) = 0.0e+00_r8 DO M = 1, ntot_amode N = lptr2_soa_a_amode(M,iBin) @@ -3952,7 +3955,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Now deal with gaseous SOA species ! Deal with lowest two volatility bins speciesName_1 = 'TSOG0' - K1 = get_spc_ndx(TRIM(speciesName_1)) + K1 = get_spc_ndx(TRIM(speciesName_1), compare_uppercase=.true.) N = lptr2_soa_g_amode(1) P = mapCnst(N) vmr1(:nY,:nZ,P) = vmr0(:nY,:nZ,P) / (vmr0(:nY,:nZ,P) + vmr0(:nY,:nZ,mapCnst(lptr2_soa_g_amode(2)))) & @@ -3976,8 +3979,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) speciesName_1 = 'TSOG3' speciesName_2 = 'ASOG3' ENDIF - K1 = get_spc_ndx(TRIM(speciesName_1)) - K2 = get_spc_ndx(TRIM(speciesName_2)) + K1 = get_spc_ndx(TRIM(speciesName_1), compare_uppercase=.true.) + K2 = get_spc_ndx(TRIM(speciesName_2), compare_uppercase=.true.) IF ( P > 0 .AND. K1 > 0 .AND. K2 > 0 ) vmr1(:nY,:nZ,P) = vmr1(:nY,:nZ,K1) + vmr1(:nY,:nZ,K2) ENDDO diff --git a/src/chemistry/geoschem/clybry_fam.F90 b/src/chemistry/geoschem/clybry_fam.F90 deleted file mode 100644 index d53a32fdf0..0000000000 --- a/src/chemistry/geoschem/clybry_fam.F90 +++ /dev/null @@ -1,180 +0,0 @@ -!----------------------------------------------------------------------- -! -! Manages the adjustment of ClOy and BrOy family components in response -! to conservation issues resulting from advection. -! -! Created by: Francis Vitt -! Date: 21 May 2008 -! Modified by Stacy Walters -! Date: 13 August 2008 -!----------------------------------------------------------------------- - -module clybry_fam - - use shr_kind_mod, only : r8 => shr_kind_r8 - use ppgrid, only : pcols, pver - use chem_mods, only : gas_pcnst, adv_mass - use constituents, only : pcnst - use short_lived_species,only: set_short_lived_species,get_short_lived_species - - implicit none - - save - - private - public :: clybry_fam_set - public :: clybry_fam_adj - public :: clybry_fam_init - - integer :: id_cly,id_bry - - integer :: id_cl,id_clo,id_hocl,id_cl2,id_cl2o2,id_oclo,id_hcl,id_clono2 - integer :: id_br,id_bro,id_hbr,id_brono2,id_brcl,id_hobr - - logical :: has_clybry - -contains - - !------------------------------------------ - !------------------------------------------ - subroutine clybry_fam_init - - !use mo_chem_utls, only : get_spc_ndx - implicit none - - integer :: ids(16) - - !id_cly = get_spc_ndx('CLY') - !id_bry = get_spc_ndx('BRY') - - !id_cl = get_spc_ndx('CL') - !id_clo = get_spc_ndx('CLO') - !id_hocl = get_spc_ndx('HOCL') - !id_cl2 = get_spc_ndx('CL2') - !id_cl2o2 = get_spc_ndx('CL2O2') - !id_oclo = get_spc_ndx('OCLO') - !id_hcl = get_spc_ndx('HCL') - !id_clono2 = get_spc_ndx('CLONO2') - - !id_br = get_spc_ndx('BR') - !id_bro = get_spc_ndx('BRO') - !id_hbr = get_spc_ndx('HBR') - !id_brono2 = get_spc_ndx('BRONO2') - !id_brcl = get_spc_ndx('BRCL') - !id_hobr = get_spc_ndx('HOBR') - - !ids = (/ id_cly,id_bry, & - ! id_cl,id_clo,id_hocl,id_cl2,id_cl2o2,id_oclo,id_hcl,id_clono2, & - ! id_br,id_bro,id_hbr,id_brono2,id_brcl,id_hobr /) - - !has_clybry = all( ids(:) > 0 ) - - endsubroutine clybry_fam_init - -!-------------------------------------------------------------- -! set the ClOy and BrOy mass mixing ratios -! - this is call before advection -!-------------------------------------------------------------- - subroutine clybry_fam_set( ncol, lchnk, map2chm, q, pbuf ) - - use time_manager, only : get_nstep - use physics_buffer, only : physics_buffer_desc - - implicit none - -!-------------------------------------------------------------- -! ... dummy arguments -!-------------------------------------------------------------- - integer, intent(in) :: ncol, lchnk - integer, intent(in) :: map2chm(pcnst) - real(r8), intent(inout) :: q(pcols,pver,pcnst) - type(physics_buffer_desc), pointer :: pbuf(:) - - !real(r8) :: wrk(ncol,pver,2) - !real(r8) :: mmr(pcols,pver,gas_pcnst) - !integer :: n, m - - if (.not. has_clybry) return - - end subroutine clybry_fam_set - -!-------------------------------------------------------------- -! adjust the ClOy and BrOy individual family members -! - this is call after advection -!-------------------------------------------------------------- - subroutine clybry_fam_adj( ncol, lchnk, map2chm, q, pbuf ) - - use time_manager, only : is_first_step - use physics_buffer, only : physics_buffer_desc - - implicit none - -!-------------------------------------------------------------- -! ... dummy arguments -!-------------------------------------------------------------- - integer, intent(in) :: ncol, lchnk - integer, intent(in) :: map2chm(pcnst) - real(r8), intent(inout) :: q(pcols,pver,pcnst) - type(physics_buffer_desc), pointer :: pbuf(:) - - end subroutine clybry_fam_adj - -!-------------------------------------------------------------- -! private methods -!-------------------------------------------------------------- - -!-------------------------------------------------------------- -! compute the mass mixing retio of ClOy -!-------------------------------------------------------------- - function cloy( q, pcols, ncol ) - -!-------------------------------------------------------------- -! ... dummy arguments -!-------------------------------------------------------------- - integer, intent(in) :: pcols - integer, intent(in) :: ncol - real(r8), intent(in) :: q(pcols,pver,gas_pcnst) - -!-------------------------------------------------------------- -! ... function declaration -!-------------------------------------------------------------- - real(r8) :: cloy(ncol,pver) - -!-------------------------------------------------------------- -! ... local variables -!-------------------------------------------------------------- - real(r8) :: wrk(ncol) - integer :: k - - cloy = 0._r8 - - end function cloy - -!-------------------------------------------------------------- -! compute the mass mixing retio of BrOy -!-------------------------------------------------------------- - function broy( q, pcols, ncol ) - -!-------------------------------------------------------------- -! ... dummy arguments -!-------------------------------------------------------------- - integer, intent(in) :: pcols - integer, intent(in) :: ncol - real(r8), intent(in) :: q(pcols,pver,gas_pcnst) - -!-------------------------------------------------------------- -! ... function declaration -!-------------------------------------------------------------- - real(r8) :: broy(ncol,pver) - -!-------------------------------------------------------------- -! ... local variables -!-------------------------------------------------------------- - real(r8) :: wrk(ncol) - integer :: k - - broy = 0._r8 - - end function broy - -end module clybry_fam diff --git a/src/chemistry/geoschem/epp_ionization.F90 b/src/chemistry/geoschem/epp_ionization.F90 deleted file mode 100644 index 98276cd5f3..0000000000 --- a/src/chemistry/geoschem/epp_ionization.F90 +++ /dev/null @@ -1,508 +0,0 @@ -!------------------------------------------------------------------------------- -! Energetic Particle Precipitation (EPP) forcings module -! Manages ionization of the atmosphere due to energetic particles, which consists of -! solar protons events (SPE), galactic cosmic rays(GCR), medium energy electrons (MEE) -!------------------------------------------------------------------------------- -module epp_ionization - use shr_kind_mod, only : r8 => shr_kind_r8, cs => shr_kind_cs, cl=> shr_kind_cl - use spmd_utils, only : masterproc - use cam_abortutils, only : endrun - use cam_logfile, only : iulog - use phys_grid, only : pcols, pver, begchunk, endchunk, get_ncols_p - use pio, only : var_desc_t, file_desc_t - use pio, only : pio_get_var, pio_inq_varid, pio_get_att - use pio, only : pio_inq_varndims, pio_inq_vardimid, pio_inq_dimname, pio_inq_dimlen - use pio, only : PIO_NOWRITE - use cam_pio_utils, only : cam_pio_openfile - use ioFileMod, only : getfil - use input_data_utils, only : time_coordinate - - implicit none - private - - public :: epp_ionization_readnl ! read namelist variables - public :: epp_ionization_init ! initialization - public :: epp_ionization_adv ! read and time/space interpolate the data - public :: epp_ionization_ionpairs! ion pairs production rates - public :: epp_ionization_setmag ! update geomagnetic coordinates mapping - public :: epp_ionization_active - - character(len=cl) :: epp_all_filepath = 'NONE' - character(len=cs) :: epp_all_varname = 'epp_ion_rates' - character(len=cl) :: epp_mee_filepath = 'NONE' - character(len=cs) :: epp_mee_varname = 'iprm' - character(len=cl) :: epp_spe_filepath = 'NONE' - character(len=cs) :: epp_spe_varname = 'iprp' - character(len=cl) :: epp_gcr_filepath = 'NONE' - character(len=cs) :: epp_gcr_varname = 'iprg' - - logical, protected :: epp_ionization_active = .false. - - type input_obj_t - type(file_desc_t) :: fid - type(var_desc_t) :: vid - character(len=32) :: units - integer :: nlevs = 0 - integer :: nglats = 0 - real(r8), allocatable :: press(:) - real(r8), allocatable :: glats(:) - real(r8), allocatable :: gwght(:,:) ! (pcol, begchunk:endchunk) - integer, allocatable :: glatn(:,:) ! (pcol, begchunk:endchunk) - real(r8), allocatable :: indata(:,:,:,:) ! (pcol,nlevs,begchunk:endchunk,2) inputs at indexm and indexp - type(time_coordinate) :: time_coord - endtype input_obj_t - - type(input_obj_t), pointer :: epp_in => null() - type(input_obj_t), pointer :: spe_in => null() - type(input_obj_t), pointer :: mee_in => null() - type(input_obj_t), pointer :: gcr_in => null() - -contains - - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - subroutine epp_ionization_readnl(nlfile) - - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use spmd_utils, only: mpicom, mpi_character, masterprocid - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - - !! Local variables - !integer :: unitn, ierr - !character(len=*), parameter :: subname = 'epp_ionization_readnl' - - !namelist /epp_ionization_nl/ epp_all_filepath, epp_all_varname, & - ! epp_mee_filepath, epp_mee_varname, epp_spe_filepath, epp_spe_varname, epp_gcr_filepath, epp_gcr_varname - - !! Read namelist - !if (masterproc) then - ! unitn = getunit() - ! open( unitn, file=trim(nlfile), status='old' ) - ! call find_group_name(unitn, 'epp_ionization_nl', status=ierr) - ! if (ierr == 0) then - ! read(unitn, epp_ionization_nl, iostat=ierr) - ! if (ierr /= 0) then - ! call endrun(subname // ':: ERROR reading namelist') - ! end if - ! end if - ! close(unitn) - ! call freeunit(unitn) - !end if - - !! Broadcast namelist variables - !call mpi_bcast(epp_all_filepath, len(epp_all_filepath), mpi_character, masterprocid, mpicom, ierr) - !call mpi_bcast(epp_mee_filepath, len(epp_mee_filepath), mpi_character, masterprocid, mpicom, ierr) - !call mpi_bcast(epp_spe_filepath, len(epp_spe_filepath), mpi_character, masterprocid, mpicom, ierr) - !call mpi_bcast(epp_gcr_filepath, len(epp_gcr_filepath), mpi_character, masterprocid, mpicom, ierr) - - !call mpi_bcast(epp_all_varname, len(epp_all_varname), mpi_character, masterprocid, mpicom, ierr) - !call mpi_bcast(epp_mee_varname, len(epp_mee_varname), mpi_character, masterprocid, mpicom, ierr) - !call mpi_bcast(epp_spe_varname, len(epp_spe_varname), mpi_character, masterprocid, mpicom, ierr) - !call mpi_bcast(epp_gcr_varname, len(epp_gcr_varname), mpi_character, masterprocid, mpicom, ierr) - - !epp_ionization_active = epp_all_filepath /= 'NONE' - !epp_ionization_active = epp_mee_filepath /= 'NONE' .or. epp_ionization_active - !epp_ionization_active = epp_spe_filepath /= 'NONE' .or. epp_ionization_active - !epp_ionization_active = epp_gcr_filepath /= 'NONE' .or. epp_ionization_active - - !if ( epp_ionization_active .and. masterproc ) then - ! write(iulog,*) subname//':: epp_all_filepath = '//trim(epp_all_filepath) - ! write(iulog,*) subname//':: epp_mee_filepath = '//trim(epp_mee_filepath) - ! write(iulog,*) subname//':: epp_spe_filepath = '//trim(epp_spe_filepath) - ! write(iulog,*) subname//':: epp_gcr_filepath = '//trim(epp_gcr_filepath) - !endif - - end subroutine epp_ionization_readnl - - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - subroutine epp_ionization_init() - !use cam_history, only : addfld - - !character(len=32) :: fldunits - !fldunits = '' - ! - !if (epp_all_filepath /= 'NONE') then - ! epp_in => create_input_obj(epp_all_filepath,epp_all_varname) - ! fldunits = trim(epp_in%units) - !else - ! if (epp_mee_filepath /= 'NONE') then - ! mee_in => create_input_obj(epp_mee_filepath,epp_mee_varname) - ! fldunits = trim(mee_in%units) - ! endif - ! if (epp_spe_filepath /= 'NONE') then - ! spe_in => create_input_obj(epp_spe_filepath,epp_spe_varname) - ! fldunits = trim(spe_in%units) - ! endif - ! if (epp_gcr_filepath /= 'NONE') then - ! gcr_in => create_input_obj(epp_gcr_filepath,epp_gcr_varname) - ! fldunits = trim(gcr_in%units) - ! endif - !endif - !call addfld( 'EPPions', (/ 'lev' /), 'A', fldunits, 'EPP ionization data' ) - - end subroutine epp_ionization_init - - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - subroutine epp_ionization_setmag( maglat ) - real(r8), intent(in) :: maglat(pcols,begchunk:endchunk) - - if (.not.epp_ionization_active) return - - !if ( associated(epp_in) ) then - ! call set_wghts(maglat,epp_in) - !else - ! if ( associated(mee_in) ) then - ! call set_wghts(maglat,mee_in) - ! endif - ! if ( associated(spe_in) ) then - ! call set_wghts(maglat,spe_in) - ! endif - ! if ( associated(gcr_in) ) then - ! call set_wghts(maglat,gcr_in) - ! endif - !endif - - end subroutine epp_ionization_setmag - - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - subroutine epp_ionization_adv - - if (.not.epp_ionization_active) return - - !if ( associated(epp_in) ) then - ! call update_input(epp_in) - !else - ! if ( associated(spe_in) ) then - ! call update_input(spe_in) - ! endif - ! if ( associated(gcr_in) ) then - ! call update_input(gcr_in) - ! endif - ! if ( associated(mee_in) ) then - ! call update_input(mee_in) - ! endif - !endif - - end subroutine epp_ionization_adv - - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - subroutine epp_ionization_ionpairs( ncol, lchnk, pmid, temp, ionpairs ) - - integer, intent(in) :: ncol, lchnk - real(r8), intent(in) :: pmid(:,:), temp(:,:) - real(r8), intent(out) :: ionpairs(:,:) ! ion pair production rate - - ionpairs = 0._r8 - if (.not.epp_ionization_active) return - - !if ( associated(epp_in) ) then - ! ionpairs(:ncol,:) = ionpairs(:ncol,:) + interp_ionpairs( ncol, lchnk, pmid, temp, epp_in ) - !else - ! if ( associated(spe_in) ) then - ! ionpairs(:ncol,:) = ionpairs(:ncol,:) + interp_ionpairs( ncol, lchnk, pmid, temp, spe_in ) - ! endif - ! if ( associated(gcr_in) ) then - ! ionpairs(:ncol,:) = ionpairs(:ncol,:) + interp_ionpairs( ncol, lchnk, pmid, temp, gcr_in ) - ! endif - ! if ( associated(mee_in) ) then - ! ionpairs(:ncol,:) = ionpairs(:ncol,:) + interp_ionpairs( ncol, lchnk, pmid, temp, mee_in ) - ! endif - !endif - - end subroutine epp_ionization_ionpairs - - ! private methods - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - subroutine update_input( input ) - type(input_obj_t), pointer :: input - - if ( input%time_coord%read_more() ) then - call input%time_coord%advance() - call read_next_data( input ) - else - call input%time_coord%advance() - endif - - end subroutine update_input - - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - subroutine read_next_data( input ) - type(input_obj_t), pointer :: input - - !! read data corresponding surrounding time indices - !if ( input%nglats > 0 ) then - ! call read_2d_profile( input ) - !else - ! call read_1d_profile( input ) - !endif - - end subroutine read_next_data - - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - function interp_ionpairs( ncol, lchnk, pmid, temp, input ) result( ionpairs ) - use interpolate_data, only : lininterp - use physconst, only : rairv - use cam_history, only : outfld - - integer, intent(in) :: ncol, lchnk - real(r8), intent(in) :: pmid(:,:) ! Pa - real(r8), intent(in) :: temp(:,:) ! K - type(input_obj_t), pointer :: input - real(r8) :: ionpairs(ncol,pver) - - real(r8) :: fctr1, fctr2 - real(r8) :: wrk(ncol,input%nlevs) - real(r8) :: ions_diags(ncol,pver) ! for diagnostics - integer :: i - - !if (input%time_coord%time_interp) then - ! ! time interpolate - ! fctr1 = input%time_coord%wghts(1) - ! fctr2 = input%time_coord%wghts(2) - ! wrk(:ncol,:) = fctr1*input%indata(:ncol,:,lchnk,1) + fctr2*input%indata(:ncol,:,lchnk,2) - !else - ! wrk(:ncol,:) = input%indata(:ncol,:,lchnk,1) - !endif - - !! vertical interpolate ... - !! interpolate to model levels - !do i = 1,ncol - - ! ! interpolate over log pressure - ! call lininterp( wrk(i,:input%nlevs), log(input%press(:input%nlevs)*1.e2_r8), input%nlevs, & - ! ionpairs(i,:pver), log(pmid(i,:pver)), pver ) - ! ions_diags(i,:pver) = ionpairs(i,:pver) - ! - ! if ( index(trim(input%units), 'g^-1') > 0 ) then - ! ! convert to ionpairs/cm3/sec - ! ionpairs(i,:pver) = ionpairs(i,:pver) *(1.e-3_r8*pmid(i,:pver)/(rairv(i,:pver,lchnk)*temp(i,:pver))) - ! endif - !enddo - - !call outfld( 'EPPions', ions_diags(:ncol,:), ncol, lchnk ) - - end function interp_ionpairs - - !----------------------------------------------------------------------------- - ! read 2D profile (geomag-lat vs press) and transfer to geographic grid - !----------------------------------------------------------------------------- - subroutine read_2d_profile( input ) - - type(input_obj_t), pointer :: input - - ! local vars - real(r8) :: wrk2d( input%nglats, input%nlevs, 2 ) - integer :: t, c, i, ntimes, ncols, ierr - real(r8) :: wght1, wght2 - integer :: gndx1, gndx2 - integer :: cnt(3), strt(3) - - !if (input%time_coord%time_interp) then - ! ntimes = 2 - !else - ! ntimes = 1 - !endif - - !cnt(1) = input%nglats - !cnt(2) = input%nlevs - !cnt(3) = ntimes - - !strt(:) = 1 - !strt(3) = input%time_coord%indxs(1) - - !ierr = pio_get_var( input%fid, input%vid, strt, cnt, wrk2d ) - - !do t = 1,ntimes - ! do c=begchunk,endchunk - ! ncols = get_ncols_p(c) - ! do i = 1,ncols - ! gndx1 = input%glatn(i,c) - ! if (gndx1>0) then - ! wght1 = input%gwght(i,c) - ! gndx2 = gndx1+1 - ! if (gndx2.le.input%nglats) then - ! wght2 = 1._r8-wght1 - ! input%indata(i,:,c,t) = wght1*wrk2d(gndx1,:,t) & - ! + wght2*wrk2d(gndx2,:,t) - ! else - ! input%indata(i,:,c,t) = wght1*wrk2d(gndx1,:,t) - ! endif - ! else - ! input%indata(i,:,c,t) = 0._r8 - ! endif - ! end do - ! end do - !end do - - end subroutine read_2d_profile - - !----------------------------------------------------------------------------- - ! read 1D vertical profile and transfer to geographic grid poleward of 60 degrees geomag-lat - !----------------------------------------------------------------------------- - subroutine read_1d_profile( input ) - - type(input_obj_t), pointer :: input - - ! local vars - real(r8) :: wrk( input%nlevs, 2 ) - integer :: t, c, i, ntimes, ncols, ierr - integer :: cnt(2), strt(2) - - !if (input%time_coord%time_interp) then - ! ntimes = 2 - !else - ! ntimes = 1 - !endif - - !cnt(1) = input%nlevs - !cnt(2) = ntimes - - !strt(:) = 1 - !strt(2) = input%time_coord%indxs(1) - - !ierr = pio_get_var( input%fid, input%vid, strt, cnt, wrk ) - - !do t = 1,ntimes - ! do c=begchunk,endchunk - ! ncols = get_ncols_p(c) - ! do i = 1,ncols - ! input%indata(i,:,c,t) = input%gwght(i,c)*wrk(:,t) - ! end do - ! end do - !end do - - end subroutine read_1d_profile - - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - function create_input_obj( path, varname ) result(in_obj) - use infnan, only : nan, assignment(=) - - character(*), intent(in) :: path - character(*), intent(in) :: varname - type(input_obj_t), pointer :: in_obj - - character(len=cl) :: filen - character(len=cl) :: data_units - character(len=cs) :: dimname - integer :: i, ierr - integer, allocatable :: dimids(:) - integer :: pres_did, pres_vid, glat_did, glat_vid, ndims - - if (path .eq. 'NONE') return - - !allocate(in_obj) - - !call in_obj%time_coord%initialize( path ) - - !call getfil( path, filen, 0 ) - !call cam_pio_openfile( in_obj%fid, filen, PIO_NOWRITE ) - - !ierr = pio_inq_varid( in_obj%fid, varname, in_obj%vid ) - - !ierr = pio_get_att( in_obj%fid, in_obj%vid, 'units', data_units) - !in_obj%units = trim(data_units(1:32)) - - !ierr = pio_inq_varndims( in_obj%fid, in_obj%vid, ndims ) - !allocate( dimids(ndims) ) - - !ierr = pio_inq_vardimid( in_obj%fid, in_obj%vid, dimids) - !pres_did = -1 - !glat_did = -1 - !do i = 1,ndims - ! ierr = pio_inq_dimname( in_obj%fid, dimids(i), dimname ) - ! select case( trim(dimname(1:4)) ) - ! case ( 'pres', 'lev', 'plev' ) - ! pres_did = dimids(i) - ! ierr = pio_inq_varid( in_obj%fid, dimname, pres_vid) - ! case ( 'glat' ) - ! glat_did = dimids(i) - ! ierr = pio_inq_varid( in_obj%fid, dimname, glat_vid) - ! case default - ! end select - !end do - - !deallocate( dimids ) - - !if (pres_did>0) then - ! ierr = pio_inq_dimlen( in_obj%fid, pres_did, in_obj%nlevs ) - ! allocate( in_obj%press(in_obj%nlevs) ) - ! ierr = pio_get_var( in_obj%fid, pres_vid, in_obj%press ) - !endif - !if (glat_did>0) then - ! ierr = pio_inq_dimlen( in_obj%fid, glat_did, in_obj%nglats ) - ! allocate( in_obj%glats(in_obj%nglats) ) - ! ierr = pio_get_var( in_obj%fid, glat_vid, in_obj%glats ) - ! allocate( in_obj%glatn(pcols,begchunk:endchunk) ) - !endif - ! - !allocate( in_obj%gwght(pcols,begchunk:endchunk) ) - - !if (in_obj%time_coord%time_interp) then - ! allocate( in_obj%indata(pcols,in_obj%nlevs,begchunk:endchunk,2) ) - !else - ! allocate( in_obj%indata(pcols,in_obj%nlevs,begchunk:endchunk,1) ) - !endif - !in_obj%indata = nan - - end function create_input_obj - - !----------------------------------------------------------------------- - !----------------------------------------------------------------------- - subroutine set_wghts( maglat, input ) - - real(r8), intent(in) :: maglat(pcols,begchunk:endchunk) - type(input_obj_t), pointer :: input - - integer :: i, c, ncols, imag - - !if (input%nglats>1) then ! read in general EPP 2D ionpairs production rates - ! do c = begchunk,endchunk - ! ncols = get_ncols_p(c) - ! col_loop: do i = 1,ncols - ! if ( maglat(i,c) .lt. input%glats(1) ) then - ! input%glatn(i,c) = 1 - ! input%gwght(i,c) = 1._r8 - ! elseif ( maglat(i,c) .gt. input%glats(input%nglats) ) then - ! input%glatn(i,c) = input%nglats - ! input%gwght(i,c) = 1._r8 - ! else - ! mag_loop: do imag = 1,input%nglats-1 - ! if ( maglat(i,c) .ge. input%glats(imag) .and. & - ! maglat(i,c) .lt. input%glats(imag+1) ) then - ! input%gwght(i,c) = (input%glats(imag+1)-maglat(i,c) ) & - ! / (input%glats(imag+1)-input%glats(imag)) - ! input%glatn(i,c) = imag - ! exit mag_loop - ! endif - ! enddo mag_loop - ! endif - ! enddo col_loop - ! enddo - !else ! read in 1D SPE ionpairs profile ... - ! do c = begchunk,endchunk - ! ncols = get_ncols_p(c) - ! do i = 1,ncols - ! if ( abs(maglat(i,c)) .ge. 60._r8 ) then ! poleward of 60 degrees - ! input%gwght(i,c) = 1._r8 - ! else - ! input%gwght(i,c) = 0._r8 - ! endif - ! enddo - ! enddo - !endif - - !call read_next_data( input ) ! update the inputs when wghts are updated - - end subroutine set_wghts - -end module epp_ionization diff --git a/src/chemistry/geoschem/fire_emissions.F90 b/src/chemistry/geoschem/fire_emissions.F90 deleted file mode 120000 index 7b9f50ff22..0000000000 --- a/src/chemistry/geoschem/fire_emissions.F90 +++ /dev/null @@ -1 +0,0 @@ -../mozart/fire_emissions.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/gas_wetdep_opts.F90 b/src/chemistry/geoschem/gas_wetdep_opts.F90 deleted file mode 100644 index 614eb50727..0000000000 --- a/src/chemistry/geoschem/gas_wetdep_opts.F90 +++ /dev/null @@ -1,78 +0,0 @@ -!----------------------------------------------------------------------- -! Reads namelist options for gas-phase wet deposition -! -! Created by Francis Vitt -- 22 Apr 2011 -!----------------------------------------------------------------------- -module gas_wetdep_opts - - use constituents, only : pcnst - use cam_logfile, only : iulog - use constituents, only : pcnst - use spmd_utils, only : masterproc - use cam_abortutils, only : endrun - - implicit none - - character(len=16), protected :: gas_wetdep_list(pcnst) = ' ' - character(len=9), protected :: gas_wetdep_method = 'MOZ' - integer, protected :: gas_wetdep_cnt = 0 - -contains - - !----------------------------------------------------------------------- - !----------------------------------------------------------------------- - - subroutine gas_wetdep_readnl(nlfile) - - use cam_abortutils, only: endrun - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit -#ifdef SPMD - use mpishorthand, only: mpichar, mpicom -#endif - - implicit none - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - - integer :: unitn, i, ierr - - namelist /wetdep_inparm/ gas_wetdep_list - namelist /wetdep_inparm/ gas_wetdep_method - - if (masterproc) then - unitn = getunit() - open( unitn, file=trim(nlfile), status='old' ) - call find_group_name(unitn, 'wetdep_inparm', status=ierr) - if (ierr == 0) then - read(unitn, wetdep_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun('mo_neu_wetdep->wetdep_readnl: ERROR reading wetdep_inparm namelist') - end if - end if - close(unitn) - call freeunit(unitn) - end if - -#ifdef SPMD - call mpibcast (gas_wetdep_list, len(gas_wetdep_list(1))*pcnst, mpichar, 0, mpicom) - call mpibcast (gas_wetdep_method, len(gas_wetdep_method), mpichar, 0, mpicom) -#endif - - gas_wetdep_cnt = 0 - do i = 1,pcnst - if ( len_trim(gas_wetdep_list(i)) > 0 ) then - gas_wetdep_cnt = gas_wetdep_cnt + 1 - endif - enddo - - if (( gas_wetdep_cnt>0 ).and. & - ( .not.(gas_wetdep_method=='MOZ' .or. & - gas_wetdep_method=='NEU' .or. & - gas_wetdep_method=='OFF') )) then - call endrun('gas_wetdep_readnl; gas_wetdep_method must be set to either MOZ or NEU') - endif - - end subroutine gas_wetdep_readnl - -end module gas_wetdep_opts diff --git a/src/chemistry/geoschem/mo_apex.F90 b/src/chemistry/geoschem/mo_apex.F90 deleted file mode 100644 index 0737f7e278..0000000000 --- a/src/chemistry/geoschem/mo_apex.F90 +++ /dev/null @@ -1,314 +0,0 @@ -module mo_apex - -!------------------------------------------------------------------------------- -! Purpose: -! -! Calculate apex coordinates and magnetic field magnitudes -! at global geographic grid for year of current model run. -! -! Method: -! -! The magnetic field parameters output by this module are time and height -! independent. They are chunked for waccm physics, i.e., allocated as -! (pcols,begchunk:endchunk) -! Interface sub apexmag is called once per run from sub inti. -! Sub apexmag may be called for years 1900 through 2005. -! This module is dependent on routines in apex_subs.F (modified IGRF model). -! Apex_subs has several authors, but has been modified and maintained -! in recent years by Roy Barnes (bozo@ucar.edu). -! Subs apxmka and apxmall are called with the current lat x lon grid -! resolution. -! -! Author: Ben Foster, foster@ucar.edu (Nov, 2003) -!------------------------------------------------------------------------------- - - use shr_kind_mod, only: r8 => shr_kind_r8 - use ppgrid, only: pcols, begchunk, endchunk ! physics grid - use cam_abortutils, only: endrun - use cam_logfile, only: iulog - use spmd_utils, only: masterproc - !use apex, only: apex_mka, apex_mall, apex_dypol, apex_set_igrf - !use apex, only: apex_beg_yr, apex_end_yr - implicit none - - private - public :: mo_apex_readnl - public :: mo_apex_init - public :: mo_apex_init1 - public :: alatm, alonm, bnorth, beast, bdown, bmag - public :: d1vec, d2vec, colatp, elonp - public :: maglon0 ! geographic longitude at the equator where geomagnetic longitude is zero (radians) - - ! year to initialize apex - real(r8), public, protected :: geomag_year = -1._r8 - logical, public, protected :: geomag_year_updated = .true. - - integer :: fixed_geomag_year = -1 - -!------------------------------------------------------------------------------- -! Magnetic field output arrays, chunked for physics: -! (these are allocated (pcols,begchunk:endchunk) by sub allocate_arrays) -!------------------------------------------------------------------------------- - real(r8), protected, allocatable, dimension(:,:) :: & ! (pcols,begchunk:endchunk) - alatm, & ! apex mag latitude at each geographic grid point (radians) - alonm, & ! apex mag longitude at each geographic grid point (radians) - bnorth, & ! northward component of magnetic field - beast, & ! eastward component of magnetic field - bdown, & ! downward component of magnetic field - bmag ! magnitude of magnetic field - real(r8), protected, allocatable, dimension(:,:,:) :: & ! (3,pcols,begchunk:endchunk) - d1vec, & ! base vectors more-or-less magnetic eastward direction - d2vec ! base vectors more-or-less magnetic downward/equatorward direction - real(r8), protected :: & - colatp, & ! geocentric colatitude of geomagnetic dipole north pole (deg) - elonp ! East longitude of geomagnetic dipole north pole (deg) - - real(r8), protected :: maglon0 - - character(len=256) :: igrf_geomag_coefs_file = 'igrf_geomag_coefs_file' - -contains - -!====================================================================== -!====================================================================== -subroutine mo_apex_readnl(nlfile) - - use namelist_utils, only : find_group_name - use units, only : getunit, freeunit - use spmd_utils, only : mpicom, masterprocid, mpi_integer, mpi_character - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - - !! Local variables - !integer :: unitn, ierr - !character(len=*), parameter :: subname = 'mo_apex_readnl' - - !namelist /geomag_nl/ fixed_geomag_year, igrf_geomag_coefs_file - - !! Read namelist - !if (masterproc) then - ! unitn = getunit() - ! open( unitn, file=trim(nlfile), status='old' ) - ! call find_group_name(unitn, 'geomag_nl', status=ierr) - ! if (ierr == 0) then - ! read(unitn, geomag_nl, iostat=ierr) - ! if (ierr /= 0) then - ! call endrun(subname // ':: ERROR reading namelist') - ! end if - ! end if - ! close(unitn) - ! call freeunit(unitn) - !end if - - !! Broadcast namelist variables - !call mpi_bcast(fixed_geomag_year, 1, mpi_integer, masterprocid, mpicom, ierr) - !call mpi_bcast(igrf_geomag_coefs_file, len(igrf_geomag_coefs_file), mpi_character, masterprocid, mpicom, ierr) - -end subroutine mo_apex_readnl - -!====================================================================== -!====================================================================== -subroutine mo_apex_init1() - use time_manager, only: get_curr_date - use dyn_grid, only: get_horiz_grid_dim_d - - -end subroutine mo_apex_init1 - -!====================================================================== -!====================================================================== -subroutine mo_apex_init(phys_state) -!------------------------------------------------------------------------------- -! Driver for apex code to calculate apex magnetic coordinates at -! current geographic spatial resolution for given year. This calls -! routines in apex_subs.F. -! -! This is called once per run from sub inti. -!------------------------------------------------------------------------------- - - use physconst,only : pi - use physics_types, only: physics_state - !use epp_ionization,only: epp_ionization_setmag - - ! Input/output arguments - type(physics_state), intent(in), dimension(begchunk:endchunk) :: phys_state - -!!------------------------------------------------------------------------------- -!! Local variables -!!------------------------------------------------------------------------------- -! real(r8), parameter :: re = 6.378165e8_r8 ! earth radius (cm) -! real(r8), parameter :: h0 = 9.0e6_r8 ! base height (90 km) -! real(r8), parameter :: hs = 1.3e7_r8 -! real(r8), parameter :: eps = 1.e-6_r8 ! epsilon -! real(r8), parameter :: cm2km = 1.e-5_r8 -! -! integer :: c, i, ist ! indices -! integer :: ncol -! -! real(r8) :: alt, hr, alon, alat, & ! apxmall args -! vmp, w, d, be3, sim, xlatqd, f, si, collat, collon -! -!!------------------------------------------------------------------------------- -!! Non-scalar arguments returned by APXMALL: -!!------------------------------------------------------------------------------- -! real(r8) :: bhat(3) -! real(r8) :: d3(3) -! real(r8) :: e1(3), e2(3), e3(3) -! real(r8) :: f1(2), f2(2) -! -! real(r8) :: bg(3), d1g(3), d2g(3), bmg -! -! real(r8) :: rdum -! -! real(r8) :: maglat(pcols,begchunk:endchunk) -! -! real(r8), parameter :: rtd = 180._r8/pi ! radians to degrees -! real(r8), parameter :: dtr = pi/180._r8 ! degrees to radians -! -! call mo_apex_init1() -! if ((.not.geomag_year_updated) .and. (allocated(alatm))) return -! -!!------------------------------------------------------------------------------- -!! Allocate output arrays -!!------------------------------------------------------------------------------- -! call allocate_arrays() -! -! alt = hs*cm2km ! altitude for apxmall (km) -! hr = alt ! reference altitude (km) -! -!!------------------------------------------------------------------------------ -!! Apex coords alon, alat are returned for each geographic grid point: -!! first form global arrays -!!------------------------------------------------------------------------------ -! do c = begchunk, endchunk -! ncol = phys_state(c)%ncol -! do i = 1,ncol -! collat = phys_state(c)%lat(i)*rtd ! latitude of current column (deg) -! collon = phys_state(c)%lon(i)*rtd ! latitude of current column (deg) -! if ( collon < -180._r8 ) collon = collon+360._r8 -! if ( collon > 180._r8 ) collon = collon-360._r8 -! call apex_mall( & -! collat, collon, alt, hr, & ! Inputs -! bg, bhat, bmag(i,c), si, & ! Mag Fld -! alon, alat, & ! Apex lon,lat output -! vmp, w, d, be3, sim, d1vec(:,i,c), d2vec(:,i,c), d3, e1, e2, e3, & ! Mod Apex -! xlatqd, f, f1, f2, ist ) ! Qsi-Dpl -! if( ist /= 0 ) then -! write(iulog,"(/,'>>> mo_apex_init: Error from apxmall: ist=',i4)") ist -! call endrun('mo_apex_init: Error from apxmall') -! end if -! beast (i,c) = bg(1) -! bnorth(i,c) = bg(2) -! bdown (i,c) = -bg(3) -! alonm (i,c) = alon*dtr ! mag lons (radians) -! alatm (i,c) = alat*dtr ! mag lats (radians) -! maglat(i,c) = alat ! mag lats (degrees) -! enddo -! enddo -! -! ! find geograghic latitude ( maglon0 ) where the geomagnetic latitude is zero at the equator -! ! by first extracting the geographic coordinates at zero degrees longitude ... -! collat = 0._r8 -! collon = 0._r8 -! call apex_mall( & -! collat, collon, alt, hr, & ! Inputs -! bg, bhat, bmg, si, & ! Mag Fld -! alon, alat, & ! Apex lon,lat output -! vmp, w, d, be3, sim, d1g, d2g, d3, e1, e2, e3, & ! Mod Apex -! xlatqd, f, f1, f2, ist ) ! Qsi-Dpl -! -! if( ist /= 0 ) then -! write(iulog,"(/,'>>> mo_apex_init: Error from apxmall: ist=',i4)") ist -! call endrun('mo_apex_init: Error from apxmall') -! end if -! -! maglon0 = -alon*dtr ! (radians) geograghic latitude where the geomagnetic latitude is zero -! ! where longitude ranges from -180E to 180E -! -! call apex_dypol( colatp, elonp, rdum ) ! get geomagnetic dipole north pole -! -! if (masterproc) then -! write(iulog, "('mo_apex_init: colatp,elonp ', 2f12.6)") colatp, elonp -! write(iulog, "('mo_apex_init: Calculated apex magnetic coordinates for year AD ',f8.2)") geomag_year -! endif -! -! call epp_ionization_setmag(maglat) - -end subroutine mo_apex_init - -subroutine allocate_arrays -!!------------------------------------------------------------------------------ -!! Allocate module output arrays for chunked physics grid. -!!------------------------------------------------------------------------------ -! -!!------------------------------------------------------------------------------ -!! local variables -!!------------------------------------------------------------------------------ -! integer :: istat ! status of allocate statements -! -! if (.not.allocated(alatm)) then -! allocate(alatm(pcols,begchunk:endchunk),stat=istat) -! if (istat /= 0) then -! write(iulog,"('>>> allocate_arrays: allocate of alatm failed: istat=',i5)") istat -! call endrun -! end if -! end if -! -! if (.not.allocated(alonm)) then -! allocate(alonm(pcols,begchunk:endchunk),stat=istat) -! if (istat /= 0) then -! write(iulog,"('>>> allocate_arrays: allocate of alonm failed: istat=',i5)") istat -! call endrun -! end if -! end if -! -! if (.not.allocated(bnorth)) then -! allocate(bnorth(pcols,begchunk:endchunk),stat=istat) -! if (istat /= 0) then -! write(iulog,"('>>> allocate_arrays: allocate of bnorth failed: istat=',i5)") istat -! call endrun -! end if -! end if -! -! if (.not.allocated(beast)) then -! allocate(beast(pcols,begchunk:endchunk),stat=istat) -! if (istat /= 0) then -! write(iulog,"('>>> allocate_arrays: allocate of beast failed: istat=',i5)") istat -! call endrun -! end if -! end if -! -! if (.not.allocated(bdown)) then -! allocate(bdown(pcols,begchunk:endchunk),stat=istat) -! if (istat /= 0) then -! write(iulog,"('>>> allocate_arrays: allocate of bdown failed: istat=',i5)") istat -! call endrun -! end if -! end if -! -! if (.not.allocated(bmag)) then -! allocate(bmag(pcols,begchunk:endchunk),stat=istat) -! if (istat /= 0) then -! write(iulog,"('>>> allocate_arrays: allocate of bmag failed: istat=',i5)") istat -! call endrun -! end if -! end if -! if (.not.allocated(d1vec)) then -! allocate(d1vec(3,pcols,begchunk:endchunk),stat=istat) -! if (istat /= 0) then -! write(iulog,"('>>> allocate_arrays: allocate of d1vec failed: istat=',i5)") istat -! call endrun -! endif -! endif -! -! if (.not.allocated(d2vec)) then -! allocate(d2vec(3,pcols,begchunk:endchunk),stat=istat) -! if (istat /= 0) then -! write(iulog,"('>>> allocate_arrays: allocate of d2vec failed: istat=',i5)") istat -! call endrun -! endif -! endif -! -end subroutine allocate_arrays - -end module mo_apex diff --git a/src/chemistry/geoschem/mo_chem_utls.F90 b/src/chemistry/geoschem/mo_chem_utls.F90 deleted file mode 100644 index aba6436b56..0000000000 --- a/src/chemistry/geoschem/mo_chem_utls.F90 +++ /dev/null @@ -1,180 +0,0 @@ - -module mo_chem_utls - - private - public :: get_spc_ndx - public :: get_inv_ndx - public :: get_extfrc_ndx - public :: get_rxt_ndx - public :: utls_chem_is - !, get_het_ndx - - save - -contains - - integer function get_spc_ndx( spc_name ) - !----------------------------------------------------------------------- - ! ... return overall species index associated with spc_name - !----------------------------------------------------------------------- - - use chem_mods, only : gas_pcnst - use mo_tracname, only : tracnam => solsym - use string_utils, only : to_upper - - implicit none - - !----------------------------------------------------------------------- - ! ... dummy arguments - !----------------------------------------------------------------------- - character(len=*), intent(in) :: spc_name - - !----------------------------------------------------------------------- - ! ... local variables - !----------------------------------------------------------------------- - integer :: m - - get_spc_ndx = -1 - do m = 1, gas_pcnst - if( trim( to_upper( spc_name ) ) == trim( to_upper( tracnam(m) ) ) ) then - get_spc_ndx = m - exit - end if - end do - - end function get_spc_ndx - - integer function get_inv_ndx( invariant ) - !----------------------------------------------------------------------- - ! ... return overall invariant index associated with spc_name - !----------------------------------------------------------------------- - - use chem_mods, only : nfs, inv_lst - - implicit none - - !----------------------------------------------------------------------- - ! ... dummy arguments - !----------------------------------------------------------------------- - character(len=*), intent(in) :: invariant - - !----------------------------------------------------------------------- - ! ... local variables - !----------------------------------------------------------------------- - integer :: m - - get_inv_ndx = -1 - do m = 1,nfs - if( trim( invariant ) == trim( inv_lst(m) ) ) then - get_inv_ndx = m - exit - end if - end do - - end function get_inv_ndx - - logical function utls_chem_is (name) result(chem_is) - use string_utils, only : to_lower - - character(len=*), intent(in) :: name - chem_is = .false. - if (( to_lower(name) == 'geoschem' ) .or. & - ( to_lower(name) == 'geos-chem' )) then - chem_is = .true. - endif - - end function utls_chem_is -! -! integer function get_het_ndx( het_name ) -! !----------------------------------------------------------------------- -! ! ... return overall het process index associated with spc_name -! !----------------------------------------------------------------------- -! -! use gas_wetdep_opts,only : gas_wetdep_method, gas_wetdep_list, gas_wetdep_cnt -! -! implicit none -! -! !----------------------------------------------------------------------- -! ! ... dummy arguments -! !----------------------------------------------------------------------- -! character(len=*), intent(in) :: het_name -! -! !----------------------------------------------------------------------- -! ! ... local variables -! !----------------------------------------------------------------------- -! integer :: m -! -! get_het_ndx=-1 -! -! do m=1,gas_wetdep_cnt -! -! if( trim( het_name ) == trim( gas_wetdep_list(m) ) ) then -! get_het_ndx = get_spc_ndx( gas_wetdep_list(m) ) -! return -! endif -! -! enddo -! -! end function get_het_ndx -! - integer function get_extfrc_ndx( frc_name ) - !----------------------------------------------------------------------- - ! ... return overall external frcing index associated with spc_name - !----------------------------------------------------------------------- - - use chem_mods, only : extcnt, extfrc_lst - - implicit none - - !----------------------------------------------------------------------- - ! ... dummy arguments - !----------------------------------------------------------------------- - character(len=*), intent(in) :: frc_name - - !----------------------------------------------------------------------- - ! ... local variables - !----------------------------------------------------------------------- - integer :: m - - get_extfrc_ndx = -1 - if( extcnt > 0 ) then - do m = 1,max(1,extcnt) - if( trim( frc_name ) == trim( extfrc_lst(m) ) ) then - get_extfrc_ndx = m - exit - end if - end do - end if - - end function get_extfrc_ndx - - integer function get_rxt_ndx( rxt_tag ) - !----------------------------------------------------------------------- - ! ... return overall external frcing index associated with spc_name - !----------------------------------------------------------------------- - - use chem_mods, only : rxt_tag_cnt, rxt_tag_lst, rxt_tag_map - - implicit none - - !----------------------------------------------------------------------- - ! ... dummy arguments - !----------------------------------------------------------------------- - character(len=*), intent(in) :: rxt_tag - - !----------------------------------------------------------------------- - ! ... local variables - !----------------------------------------------------------------------- - integer :: m - - get_rxt_ndx = -1 - do m = 1,rxt_tag_cnt - if( trim( rxt_tag ) == trim( rxt_tag_lst(m) ) ) then - get_rxt_ndx = rxt_tag_map(m) - exit - end if - end do - - end function get_rxt_ndx - -end module mo_chem_utls diff --git a/src/chemistry/geoschem/mo_drydep.F90 b/src/chemistry/geoschem/mo_drydep.F90 deleted file mode 120000 index fcb098953c..0000000000 --- a/src/chemistry/geoschem/mo_drydep.F90 +++ /dev/null @@ -1 +0,0 @@ -../mozart/mo_drydep.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/mo_gas_phase_chemdr.F90 b/src/chemistry/geoschem/mo_gas_phase_chemdr.F90 deleted file mode 100644 index a881683024..0000000000 --- a/src/chemistry/geoschem/mo_gas_phase_chemdr.F90 +++ /dev/null @@ -1,1180 +0,0 @@ -module mo_gas_phase_chemdr - - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_const_mod, only : pi => shr_const_pi - use constituents, only : pcnst - use cam_history, only : fieldname_len - use chem_mods, only : phtcnt, rxntot, gas_pcnst - use chem_mods, only : rxt_tag_cnt, rxt_tag_lst, rxt_tag_map, extcnt, num_rnts - !use dust_model, only : dust_names, ndust => dust_nbin - use ppgrid, only : pcols, pver - use phys_control, only : phys_getopts - use carma_flags_mod, only : carma_hetchem_feedback - use chem_prod_loss_diags, only: chem_prod_loss_diags_init, chem_prod_loss_diags_out - - implicit none - save - - private - public :: gas_phase_chemdr, gas_phase_chemdr_inti - public :: map2chm - - integer :: map2chm(pcnst) = 0 ! index map to/from chemistry/constituents list - - integer :: synoz_ndx, so4_ndx, h2o_ndx, o2_ndx, o_ndx, hno3_ndx, hcl_ndx, dst_ndx, cldice_ndx, snow_ndx - integer :: o3_ndx, o3s_ndx - integer :: het1_ndx - integer :: ndx_cldfr, ndx_cmfdqr, ndx_nevapr, ndx_cldtop, ndx_prain - integer :: ndx_h2so4 -! -! CCMI -! - integer :: st80_25_ndx - integer :: st80_25_tau_ndx - integer :: aoa_nh_ndx - integer :: aoa_nh_ext_ndx - integer :: nh_5_ndx - integer :: nh_50_ndx - integer :: nh_50w_ndx - integer :: sad_pbf_ndx - integer :: cb1_ndx,cb2_ndx,oc1_ndx,oc2_ndx,dst1_ndx,dst2_ndx,sslt1_ndx,sslt2_ndx - integer :: soa_ndx,soai_ndx,soam_ndx,soat_ndx,soab_ndx,soax_ndx - - character(len=fieldname_len),dimension(rxt_tag_cnt) :: tag_names - character(len=fieldname_len),dimension(extcnt) :: extfrc_name - - logical :: pm25_srf_diag - logical :: pm25_srf_diag_soa - - logical :: convproc_do_aer - integer :: ele_temp_ndx, ion_temp_ndx - -contains - - subroutine gas_phase_chemdr_inti() - - !use mo_chem_utls, only : get_spc_ndx, get_extfrc_ndx, get_rxt_ndx - use cam_history, only : addfld,add_default,horiz_only - !use mo_chm_diags, only : chm_diags_inti - use constituents, only : cnst_get_ind - use physics_buffer, only : pbuf_get_index - use rate_diags, only : rate_diags_init - use cam_abortutils, only : endrun - - implicit none - - character(len=3) :: string - integer :: n, m, err, ii - logical :: history_cesm_forcing - character(len=16) :: unitstr - !----------------------------------------------------------------------- - logical :: history_scwaccm_forcing - - call phys_getopts( history_scwaccm_forcing_out = history_scwaccm_forcing ) - - call phys_getopts( convproc_do_aer_out = convproc_do_aer, history_cesm_forcing_out=history_cesm_forcing ) - - !ndx_h2so4 = get_spc_ndx('H2SO4') -! -! CCMI -! - !st80_25_ndx = get_spc_ndx ('ST80_25') - !st80_25_tau_ndx = get_rxt_ndx ('ST80_25_tau') - !aoa_nh_ndx = get_spc_ndx ('AOA_NH') - !aoa_nh_ext_ndx = get_extfrc_ndx('AOA_NH') - !nh_5_ndx = get_spc_ndx('NH_5') - !nh_50_ndx = get_spc_ndx('NH_50') - !nh_50w_ndx = get_spc_ndx('NH_50W') -! - !cb1_ndx = get_spc_ndx('CB1') - !cb2_ndx = get_spc_ndx('CB2') - !oc1_ndx = get_spc_ndx('OC1') - !oc2_ndx = get_spc_ndx('OC2') - !dst1_ndx = get_spc_ndx('DST01') - !dst2_ndx = get_spc_ndx('DST02') - !sslt1_ndx = get_spc_ndx('SSLT01') - !sslt2_ndx = get_spc_ndx('SSLT02') - !soa_ndx = get_spc_ndx('SOA') - !soam_ndx = get_spc_ndx('SOAM') - !soai_ndx = get_spc_ndx('SOAI') - !soat_ndx = get_spc_ndx('SOAT') - !soab_ndx = get_spc_ndx('SOAB') - !soax_ndx = get_spc_ndx('SOAX') - - !pm25_srf_diag = cb1_ndx>0 .and. cb2_ndx>0 .and. oc1_ndx>0 .and. oc2_ndx>0 & - ! .and. dst1_ndx>0 .and. dst2_ndx>0 .and. sslt1_ndx>0 .and. sslt2_ndx>0 & - ! .and. soa_ndx>0 - - !pm25_srf_diag_soa = cb1_ndx>0 .and. cb2_ndx>0 .and. oc1_ndx>0 .and. oc2_ndx>0 & - ! .and. dst1_ndx>0 .and. dst2_ndx>0 .and. sslt1_ndx>0 .and. sslt2_ndx>0 & - ! .and. soam_ndx>0 .and. soai_ndx>0 .and. soat_ndx>0 .and. soab_ndx>0 .and. soax_ndx>0 - ! - !if ( pm25_srf_diag .or. pm25_srf_diag_soa) then - ! call addfld('PM25_SRF',horiz_only,'I','kg/kg','bottom layer PM2.5 mixing ratio' ) - !endif - !call addfld('U_SRF',horiz_only,'I','m/s','bottom layer wind velocity' ) - !call addfld('V_SRF',horiz_only,'I','m/s','bottom layer wind velocity' ) - !call addfld('Q_SRF',horiz_only,'I','kg/kg','bottom layer specific humidity' ) -! - !het1_ndx= get_rxt_ndx('het1') - !o3_ndx = get_spc_ndx('O3') - !o3s_ndx = get_spc_ndx('O3S') - !o_ndx = get_spc_ndx('O') - !o2_ndx = get_spc_ndx('O2') - !so4_ndx = get_spc_ndx('SO4') - !h2o_ndx = get_spc_ndx('H2O') - !hno3_ndx = get_spc_ndx('HNO3') - !hcl_ndx = get_spc_ndx('HCL') - !dst_ndx = get_spc_ndx( dust_names(1) ) - !synoz_ndx = get_extfrc_ndx( 'SYNOZ' ) - !call cnst_get_ind( 'CLDICE', cldice_ndx ) - !call cnst_get_ind( 'SNOWQM', snow_ndx, abort=.false. ) - - - !do m = 1,extcnt - ! WRITE(UNIT=string, FMT='(I2.2)') m - ! extfrc_name(m) = 'extfrc_'// trim(string) - ! call addfld( extfrc_name(m), (/ 'lev' /), 'I', ' ', 'ext frcing' ) - !end do - - !do n = 1,rxt_tag_cnt - ! tag_names(n) = trim(rxt_tag_lst(n)) - ! if (n<=phtcnt) then - ! call addfld( tag_names(n), (/ 'lev' /), 'I', '/s', 'photolysis rate constant' ) - ! else - ! ii = n-phtcnt - ! select case(num_rnts(ii)) - ! case(1) - ! unitstr='/s' - ! case(2) - ! unitstr='cm3/molecules/s' - ! case(3) - ! unitstr='cm6/molecules2/s' - ! case default - ! call endrun('gas_phase_chemdr_inti: invalid value in num_rnts used to set units in reaction rate constant') - ! end select - ! call addfld( tag_names(n), (/ 'lev' /), 'I', unitstr, 'reaction rate constant' ) - ! endif - ! if (history_scwaccm_forcing) then - ! select case (trim(tag_names(n))) - ! case ('jh2o_a', 'jh2o_b', 'jh2o_c' ) - ! call add_default( tag_names(n), 1, ' ') - ! end select - ! endif - !enddo - - !call addfld( 'DTCBS', horiz_only, 'I', ' ','photolysis diagnostic black carbon OD' ) - !call addfld( 'DTOCS', horiz_only, 'I', ' ','photolysis diagnostic organic carbon OD' ) - !call addfld( 'DTSO4', horiz_only, 'I', ' ','photolysis diagnostic SO4 OD' ) - !call addfld( 'DTSOA', horiz_only, 'I', ' ','photolysis diagnostic SOA OD' ) - !call addfld( 'DTANT', horiz_only, 'I', ' ','photolysis diagnostic NH4SO4 OD' ) - !call addfld( 'DTSAL', horiz_only, 'I', ' ','photolysis diagnostic salt OD' ) - !call addfld( 'DTDUST', horiz_only, 'I', ' ','photolysis diagnostic dust OD' ) - !call addfld( 'DTTOTAL', horiz_only, 'I', ' ','photolysis diagnostic total aerosol OD' ) - !call addfld( 'FRACDAY', horiz_only, 'I', ' ','photolysis diagnostic fraction of day' ) - - !call addfld( 'QDSAD', (/ 'lev' /), 'I', '/s', 'water vapor sad delta' ) - !call addfld( 'SAD_STRAT', (/ 'lev' /), 'I', 'cm2/cm3', 'stratospheric aerosol SAD' ) - !call addfld( 'SAD_SULFC', (/ 'lev' /), 'I', 'cm2/cm3', 'chemical sulfate aerosol SAD' ) - !call addfld( 'SAD_SAGE', (/ 'lev' /), 'I', 'cm2/cm3', 'SAGE sulfate aerosol SAD' ) - !call addfld( 'SAD_LNAT', (/ 'lev' /), 'I', 'cm2/cm3', 'large-mode NAT aerosol SAD' ) - !call addfld( 'SAD_ICE', (/ 'lev' /), 'I', 'cm2/cm3', 'water-ice aerosol SAD' ) - !call addfld( 'RAD_SULFC', (/ 'lev' /), 'I', 'cm', 'chemical sad sulfate' ) - !call addfld( 'RAD_LNAT', (/ 'lev' /), 'I', 'cm', 'large nat radius' ) - !call addfld( 'RAD_ICE', (/ 'lev' /), 'I', 'cm', 'sad ice' ) - !call addfld( 'SAD_TROP', (/ 'lev' /), 'I', 'cm2/cm3', 'tropospheric aerosol SAD' ) - !call addfld( 'SAD_AERO', (/ 'lev' /), 'I', 'cm2/cm3', 'aerosol surface area density' ) - !if (history_cesm_forcing) then - ! call add_default ('SAD_AERO',8,' ') - !endif - !call addfld( 'REFF_AERO', (/ 'lev' /), 'I', 'cm', 'aerosol effective radius' ) - !call addfld( 'SULF_TROP', (/ 'lev' /), 'I', 'mol/mol', 'tropospheric aerosol SAD' ) - !call addfld( 'QDSETT', (/ 'lev' /), 'I', '/s', 'water vapor settling delta' ) - !call addfld( 'QDCHEM', (/ 'lev' /), 'I', '/s', 'water vapor chemistry delta') - !call addfld( 'HNO3_TOTAL', (/ 'lev' /), 'I', 'mol/mol', 'total HNO3' ) - !call addfld( 'HNO3_STS', (/ 'lev' /), 'I', 'mol/mol', 'STS condensed HNO3' ) - !call addfld( 'HNO3_NAT', (/ 'lev' /), 'I', 'mol/mol', 'NAT condensed HNO3' ) - !call addfld( 'HNO3_GAS', (/ 'lev' /), 'I', 'mol/mol', 'gas-phase hno3' ) - !call addfld( 'H2O_GAS', (/ 'lev' /), 'I', 'mol/mol', 'gas-phase h2o' ) - !call addfld( 'HCL_TOTAL', (/ 'lev' /), 'I', 'mol/mol', 'total hcl' ) - !call addfld( 'HCL_GAS', (/ 'lev' /), 'I', 'mol/mol', 'gas-phase hcl' ) - !call addfld( 'HCL_STS', (/ 'lev' /), 'I', 'mol/mol', 'STS condensed HCL' ) - - !if (het1_ndx>0) then - ! call addfld( 'het1_total', (/ 'lev' /), 'I', '/s', 'total N2O5 + H2O het rate constant' ) - !endif - !call addfld( 'SZA', horiz_only, 'I', 'degrees', 'solar zenith angle' ) - - !call chm_diags_inti() - !call rate_diags_init() - -!----------------------------------------------------------------------- -! get pbuf indicies -!----------------------------------------------------------------------- - !ndx_cldfr = pbuf_get_index('CLD') - !ndx_cmfdqr = pbuf_get_index('RPRDTOT') - !ndx_nevapr = pbuf_get_index('NEVAPR') - !ndx_prain = pbuf_get_index('PRAIN') - !ndx_cldtop = pbuf_get_index('CLDTOP') - - !sad_pbf_ndx= pbuf_get_index('VOLC_SAD',errcode=err) ! prescribed strat aerosols (volcanic) - !if (.not.sad_pbf_ndx>0) sad_pbf_ndx = pbuf_get_index('SADSULF',errcode=err) ! CARMA's version of strat aerosols - - !ele_temp_ndx = pbuf_get_index('TElec',errcode=err)! electron temperature index - !ion_temp_ndx = pbuf_get_index('TIon',errcode=err) ! ion temperature index - - !! diagnostics for stratospheric heterogeneous reactions - !call addfld( 'GAMMA_HET1', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) - !call addfld( 'GAMMA_HET2', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) - !call addfld( 'GAMMA_HET3', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) - !call addfld( 'GAMMA_HET4', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) - !call addfld( 'GAMMA_HET5', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) - !call addfld( 'GAMMA_HET6', (/ 'lev' /), 'I', '1', 'Reaction Probability' ) - !call addfld( 'WTPER', (/ 'lev' /), 'I', '%', 'H2SO4 Weight Percent' ) - - !call chem_prod_loss_diags_init - - end subroutine gas_phase_chemdr_inti - - -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- - subroutine gas_phase_chemdr(lchnk, ncol, imozart, q, & - phis, zm, zi, calday, & - tfld, pmid, pdel, pint, & - cldw, troplev, troplevchem, & - ncldwtr, ufld, vfld, & - delt, ps, xactive_prates, & - fsds, ts, asdir, ocnfrac, icefrac, & - precc, precl, snowhland, ghg_chem, latmapback, & - drydepflx, wetdepflx, cflx, fire_sflx, fire_ztop, nhx_nitrogen_flx, noy_nitrogen_flx, qtend, pbuf) - - !----------------------------------------------------------------------- - ! ... Chem_solver advances the volumetric mixing ratio - ! forward one time step via a combination of explicit, - ! ebi, hov, fully implicit, and/or rodas algorithms. - !----------------------------------------------------------------------- - - use chem_mods, only : nabscol, nfs, indexm, clscnt4 - use physconst, only : rga - !use mo_photo, only : set_ub_col, setcol, table_photo, xactive_photo - !use mo_exp_sol, only : exp_sol - !use mo_imp_sol, only : imp_sol - !use mo_setrxt, only : setrxt - !use mo_adjrxt, only : adjrxt - !use mo_phtadj, only : phtadj - !use llnl_O1D_to_2OH_adj,only : O1D_to_2OH_adj - !use mo_usrrxt, only : usrrxt - !use mo_setinv, only : setinv - !use mo_negtrc, only : negtrc - !use mo_sulf, only : sulf_interp - !use mo_setext, only : setext - !use fire_emissions, only : fire_emissions_vrt - !use mo_sethet, only : sethet - !use mo_drydep, only : drydep, set_soilw - !use seq_drydep_mod, only : DD_XLND, DD_XATM, DD_TABL, drydep_method - !use mo_fstrat, only : set_fstrat_vals, set_fstrat_h2o - !use noy_ubc, only : noy_ubc_set - !use mo_flbc, only : flbc_set - !use phys_grid, only : get_rlat_all_p, get_rlon_all_p, get_lat_all_p, get_lon_all_p - !use mo_mean_mass, only : set_mean_mass - !use cam_history, only : outfld - !use wv_saturation, only : qsat - !use constituents, only : cnst_mw - !use mo_drydep, only : has_drydep - !use time_manager, only : get_ref_date - !use mo_ghg_chem, only : ghg_chem_set_rates, ghg_chem_set_flbc - !use mo_sad, only : sad_strat_calc - !use charge_neutrality, only : charge_balance - !use mo_strato_rates, only : ratecon_sfstrat - !use mo_aero_settling, only : strat_aer_settling - !use shr_orb_mod, only : shr_orb_decl - !use cam_control_mod, only : lambm0, eccen, mvelpp, obliqr - !use mo_strato_rates, only : has_strato_chem - !use short_lived_species,only: set_short_lived_species,get_short_lived_species - !use mo_chm_diags, only : chm_diags, het_diags - !use perf_mod, only : t_startf, t_stopf - !use gas_wetdep_opts, only : gas_wetdep_method - use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx - !use infnan, only : nan, assignment(=) - !use rate_diags, only : rate_diags_calc - !use mo_mass_xforms, only : mmr2vmr, vmr2mmr, h2o_to_vmr, mmr2vmri - !use orbit, only : zenith -! -! LINOZ -! - !use lin_strat_chem, only : do_lin_strat_chem, lin_strat_chem_solve - !use linoz_data, only : has_linoz_data -! -! for aqueous chemistry and aerosol growth -! - !use aero_model, only : aero_model_gasaerexch - - !use aero_model, only : aero_model_strat_surfarea - - implicit none - - !----------------------------------------------------------------------- - ! ... Dummy arguments - !----------------------------------------------------------------------- - integer, intent(in) :: lchnk ! chunk index - integer, intent(in) :: ncol ! number columns in chunk - integer, intent(in) :: imozart ! gas phase start index in q - real(r8), intent(in) :: delt ! timestep (s) - real(r8), intent(in) :: calday ! day of year - real(r8), intent(in) :: ps(pcols) ! surface pressure - real(r8), intent(in) :: phis(pcols) ! surface geopotential - real(r8),target,intent(in) :: tfld(pcols,pver) ! midpoint temperature (K) - real(r8), intent(in) :: pmid(pcols,pver) ! midpoint pressures (Pa) - real(r8), intent(in) :: pdel(pcols,pver) ! pressure delta about midpoints (Pa) - real(r8), intent(in) :: ufld(pcols,pver) ! zonal velocity (m/s) - real(r8), intent(in) :: vfld(pcols,pver) ! meridional velocity (m/s) - real(r8), intent(in) :: cldw(pcols,pver) ! cloud water (kg/kg) - real(r8), intent(in) :: ncldwtr(pcols,pver) ! droplet number concentration (#/kg) - real(r8), intent(in) :: zm(pcols,pver) ! midpoint geopotential height above the surface (m) - real(r8), intent(in) :: zi(pcols,pver+1) ! interface geopotential height above the surface (m) - real(r8), intent(in) :: pint(pcols,pver+1) ! interface pressures (Pa) - real(r8), intent(in) :: q(pcols,pver,pcnst) ! species concentrations (kg/kg) - real(r8),pointer, intent(in) :: fire_sflx(:,:) ! fire emssions surface flux (kg/m^2/s) - real(r8),pointer, intent(in) :: fire_ztop(:) ! top of vertical distribution of fire emssions (m) - logical, intent(in) :: xactive_prates - real(r8), intent(in) :: fsds(pcols) ! longwave down at sfc - real(r8), intent(in) :: icefrac(pcols) ! sea-ice areal fraction - real(r8), intent(in) :: ocnfrac(pcols) ! ocean areal fraction - real(r8), intent(in) :: asdir(pcols) ! albedo: shortwave, direct - real(r8), intent(in) :: ts(pcols) ! sfc temp (merged w/ocean if coupled) - real(r8), intent(in) :: precc(pcols) ! - real(r8), intent(in) :: precl(pcols) ! - real(r8), intent(in) :: snowhland(pcols) ! - logical, intent(in) :: ghg_chem - integer, intent(in) :: latmapback(pcols) - integer, intent(in) :: troplev(pcols) ! trop/strat separation vertical index - integer, intent(in) :: troplevchem(pcols) ! trop/strat chemistry separation vertical index - real(r8), intent(inout) :: qtend(pcols,pver,pcnst) ! species tendencies (kg/kg/s) - real(r8), intent(inout) :: cflx(pcols,pcnst) ! constituent surface flux (kg/m^2/s) - real(r8), intent(out) :: drydepflx(pcols,pcnst) ! dry deposition flux (kg/m^2/s) - real(r8), intent(in) :: wetdepflx(pcols,pcnst) ! wet deposition flux (kg/m^2/s) - real(r8), intent(out) :: nhx_nitrogen_flx(pcols) - real(r8), intent(out) :: noy_nitrogen_flx(pcols) - - type(physics_buffer_desc), pointer :: pbuf(:) - - !!----------------------------------------------------------------------- - !! ... Local variables - !!----------------------------------------------------------------------- - !real(r8), parameter :: m2km = 1.e-3_r8 - !real(r8), parameter :: Pa2mb = 1.e-2_r8 - - !real(r8), pointer :: prain(:,:) - !real(r8), pointer :: nevapr(:,:) - !real(r8), pointer :: cmfdqr(:,:) - !real(r8), pointer :: cldfr(:,:) - !real(r8), pointer :: cldtop(:) - - !integer :: i, k, m, n - !integer :: tim_ndx - !real(r8) :: delt_inverse - !real(r8) :: esfact - !integer :: latndx(pcols) ! chunk lat indicies - !integer :: lonndx(pcols) ! chunk lon indicies - !real(r8) :: invariants(ncol,pver,nfs) - !real(r8) :: col_dens(ncol,pver,max(1,nabscol)) ! column densities (molecules/cm^2) - !real(r8) :: col_delta(ncol,0:pver,max(1,nabscol)) ! layer column densities (molecules/cm^2) - !real(r8) :: extfrc(ncol,pver,max(1,extcnt)) - !real(r8) :: vmr(ncol,pver,gas_pcnst) ! xported species (vmr) - !real(r8) :: reaction_rates(ncol,pver,max(1,rxntot)) ! reaction rates - !real(r8) :: depvel(ncol,gas_pcnst) ! dry deposition velocity (cm/s) - !real(r8) :: het_rates(ncol,pver,max(1,gas_pcnst)) ! washout rate (1/s) - !real(r8), dimension(ncol,pver) :: & - ! h2ovmr, & ! water vapor volume mixing ratio - ! mbar, & ! mean wet atmospheric mass ( amu ) - ! zmid, & ! midpoint geopotential in km - ! zmidr, & ! midpoint geopotential in km realitive to surf - ! sulfate, & ! trop sulfate aerosols - ! pmb ! pressure at midpoints ( hPa ) - !real(r8), dimension(ncol,pver) :: & - ! cwat, & ! cloud water mass mixing ratio (kg/kg) - ! wrk - !real(r8), dimension(ncol,pver+1) :: & - ! zintr ! interface geopotential in km realitive to surf - !real(r8), dimension(ncol,pver+1) :: & - ! zint ! interface geopotential in km - !real(r8), dimension(ncol) :: & - ! zen_angle, & ! solar zenith angles - ! zsurf, & ! surface height (m) - ! rlats, rlons ! chunk latitudes and longitudes (radians) - !real(r8) :: sza(ncol) ! solar zenith angles (degrees) - !real(r8), parameter :: rad2deg = 180._r8/pi ! radians to degrees conversion factor - !real(r8) :: relhum(ncol,pver) ! relative humidity - !real(r8) :: satv(ncol,pver) ! wrk array for relative humidity - !real(r8) :: satq(ncol,pver) ! wrk array for relative humidity - - !integer :: j - !integer :: ltrop_sol(pcols) ! tropopause vertical index used in chem solvers - !real(r8), pointer :: strato_sad(:,:) ! stratospheric sad (1/cm) - - !real(r8) :: sad_trop(pcols,pver) ! total tropospheric sad (cm^2/cm^3) - !real(r8) :: reff(pcols,pver) ! aerosol effective radius (cm) - !real(r8) :: reff_strat(pcols,pver) ! stratospheric aerosol effective radius (cm) - - !real(r8) :: tvs(pcols) - !integer :: ncdate,yr,mon,day,sec - !real(r8) :: wind_speed(pcols) ! surface wind speed (m/s) - !logical, parameter :: dyn_soilw = .false. - !logical :: table_soilw - !real(r8) :: soilw(pcols) - !real(r8) :: prect(pcols) - !real(r8) :: sflx(pcols,gas_pcnst) - !real(r8) :: wetdepflx_diag(pcols,gas_pcnst) - !real(r8) :: dust_vmr(ncol,pver,ndust) - !real(r8) :: dt_diag(pcols,8) ! od diagnostics - !real(r8) :: fracday(pcols) ! fraction of day - !real(r8) :: o2mmr(ncol,pver) ! o2 concentration (kg/kg) - !real(r8) :: ommr(ncol,pver) ! o concentration (kg/kg) - !real(r8) :: mmr(pcols,pver,gas_pcnst) ! chem working concentrations (kg/kg) - !real(r8) :: mmr_new(pcols,pver,gas_pcnst) ! chem working concentrations (kg/kg) - !real(r8) :: hno3_gas(ncol,pver) ! hno3 gas phase concentration (mol/mol) - !real(r8) :: hno3_cond(ncol,pver,2) ! hno3 condensed phase concentration (mol/mol) - !real(r8) :: hcl_gas(ncol,pver) ! hcl gas phase concentration (mol/mol) - !real(r8) :: hcl_cond(ncol,pver) ! hcl condensed phase concentration (mol/mol) - !real(r8) :: h2o_gas(ncol,pver) ! h2o gas phase concentration (mol/mol) - !real(r8) :: h2o_cond(ncol,pver) ! h2o condensed phase concentration (mol/mol) - !real(r8) :: cldice(pcols,pver) ! cloud water "ice" (kg/kg) - !real(r8) :: radius_strat(ncol,pver,3) ! radius of sulfate, nat, & ice ( cm ) - !real(r8) :: sad_strat(ncol,pver,3) ! surf area density of sulfate, nat, & ice ( cm^2/cm^3 ) - !real(r8) :: mmr_tend(pcols,pver,gas_pcnst) ! chemistry species tendencies (kg/kg/s) - !real(r8) :: qh2o(pcols,pver) ! specific humidity (kg/kg) - !real(r8) :: delta - - ! !for aerosol formation.... - !real(r8) :: del_h2so4_gasprod(ncol,pver) - !real(r8) :: vmr0(ncol,pver,gas_pcnst) - -! -! CCMI -! - !real(r8) :: xlat - !real(r8) :: pm25(ncol) - - !real(r8) :: dlats(ncol) - - !real(r8), dimension(ncol,pver) :: & ! aerosol reaction diagnostics - ! gprob_n2o5, & - ! gprob_cnt_hcl, & - ! gprob_cnt_h2o, & - ! gprob_bnt_h2o, & - ! gprob_hocl_hcl, & - ! gprob_hobr_hcl, & - ! wtper - - !real(r8), pointer :: ele_temp_fld(:,:) ! electron temperature pointer - !real(r8), pointer :: ion_temp_fld(:,:) ! ion temperature pointer - !real(r8) :: prod_out(ncol,pver,max(1,clscnt4)) - !real(r8) :: loss_out(ncol,pver,max(1,clscnt4)) - - !if ( ele_temp_ndx>0 .and. ion_temp_ndx>0 ) then - ! call pbuf_get_field(pbuf, ele_temp_ndx, ele_temp_fld) - ! call pbuf_get_field(pbuf, ion_temp_ndx, ion_temp_fld) - !else - ! ele_temp_fld => tfld - ! ion_temp_fld => tfld - !endif - - !! initialize to NaN to hopefully catch user defined rxts that go unset - !reaction_rates(:,:,:) = nan - - !Dummy output - qtend = 0.0e+0_r8 - cflx = 0.0e+0_r8 - drydepflx = 0.0e+0_r8 - - !delt_inverse = 1._r8 / delt - !!----------------------------------------------------------------------- - !! ... Get chunck latitudes and longitudes - !!----------------------------------------------------------------------- - !call get_lat_all_p( lchnk, ncol, latndx ) - !call get_lon_all_p( lchnk, ncol, lonndx ) - !call get_rlat_all_p( lchnk, ncol, rlats ) - !call get_rlon_all_p( lchnk, ncol, rlons ) - !tim_ndx = pbuf_old_tim_idx() - !call pbuf_get_field(pbuf, ndx_prain, prain, start=(/1,1/), kount=(/ncol,pver/)) - !call pbuf_get_field(pbuf, ndx_cldfr, cldfr, start=(/1,1,tim_ndx/), kount=(/ncol,pver,1/) ) - !call pbuf_get_field(pbuf, ndx_cmfdqr, cmfdqr, start=(/1,1/), kount=(/ncol,pver/)) - !call pbuf_get_field(pbuf, ndx_nevapr, nevapr, start=(/1,1/), kount=(/ncol,pver/)) - !call pbuf_get_field(pbuf, ndx_cldtop, cldtop ) - - !reff_strat(:,:) = 0._r8 - - !dlats(:) = rlats(:)*rad2deg ! convert to degrees - - !!----------------------------------------------------------------------- - !! ... Calculate cosine of zenith angle - !! then cast back to angle (radians) - !!----------------------------------------------------------------------- - !call zenith( calday, rlats, rlons, zen_angle, ncol ) - !zen_angle(:) = acos( zen_angle(:) ) - - !sza(:) = zen_angle(:) * rad2deg - !call outfld( 'SZA', sza, ncol, lchnk ) - - !!----------------------------------------------------------------------- - !! ... Xform geopotential height from m to km - !! and pressure from Pa to mb - !!----------------------------------------------------------------------- - !zsurf(:ncol) = rga * phis(:ncol) - !do k = 1,pver - ! zintr(:ncol,k) = m2km * zi(:ncol,k) - ! zmidr(:ncol,k) = m2km * zm(:ncol,k) - ! zmid(:ncol,k) = m2km * (zm(:ncol,k) + zsurf(:ncol)) - ! zint(:ncol,k) = m2km * (zi(:ncol,k) + zsurf(:ncol)) - ! pmb(:ncol,k) = Pa2mb * pmid(:ncol,k) - !end do - !zint(:ncol,pver+1) = m2km * (zi(:ncol,pver+1) + zsurf(:ncol)) - !zintr(:ncol,pver+1)= m2km * zi(:ncol,pver+1) - - !!----------------------------------------------------------------------- - !! ... map incoming concentrations to working array - !!----------------------------------------------------------------------- - !do m = 1,pcnst - ! n = map2chm(m) - ! if( n > 0 ) then - ! mmr(:ncol,:,n) = q(:ncol,:,m) - ! end if - !end do - - !call get_short_lived_species( mmr, lchnk, ncol, pbuf ) - - !!----------------------------------------------------------------------- - !! ... Set atmosphere mean mass - !!----------------------------------------------------------------------- - !call set_mean_mass( ncol, mmr, mbar ) - - !!----------------------------------------------------------------------- - !! ... Xform from mmr to vmr - !!----------------------------------------------------------------------- - !call mmr2vmr( mmr(:ncol,:,:), vmr(:ncol,:,:), mbar(:ncol,:), ncol ) - -! -! CCMI -! -! reset STE tracer to specific vmr of 200 ppbv -! - !if ( st80_25_ndx > 0 ) then - ! where ( pmid(:ncol,:) < 80.e+2_r8 ) - ! vmr(:ncol,:,st80_25_ndx) = 200.e-9_r8 - ! end where - !end if -! -! reset AOA_NH, NH_5, NH_50, NH_50W surface mixing ratios between 30N and 50N -! - !if ( aoa_nh_ndx>0 ) then - ! do j=1,ncol - ! xlat = dlats(j) - ! if ( xlat >= 30._r8 .and. xlat <= 50._r8 ) then - ! vmr(j,pver,aoa_nh_ndx) = 0._r8 - ! end if - ! end do - !end if - !if ( nh_5_ndx>0 ) then - ! do j=1,ncol - ! xlat = dlats(j) - ! if ( xlat >= 30._r8 .and. xlat <= 50._r8 ) then - ! vmr(j,pver,nh_5_ndx) = 100.e-9_r8 - ! end if - ! end do - !end if - !if ( nh_50_ndx>0 ) then - ! do j=1,ncol - ! xlat = dlats(j) - ! if ( xlat >= 30._r8 .and. xlat <= 50._r8 ) then - ! vmr(j,pver,nh_50_ndx) = 100.e-9_r8 - ! end if - ! end do - !end if - !if ( nh_50w_ndx>0 ) then - ! do j=1,ncol - ! xlat = dlats(j) - ! if ( xlat >= 30._r8 .and. xlat <= 50._r8 ) then - ! vmr(j,pver,nh_50w_ndx) = 100.e-9_r8 - ! end if - ! end do - !end if - - !if (h2o_ndx>0) then - ! !----------------------------------------------------------------------- - ! ! ... store water vapor in wrk variable - ! !----------------------------------------------------------------------- - ! qh2o(:ncol,:) = mmr(:ncol,:,h2o_ndx) - ! h2ovmr(:ncol,:) = vmr(:ncol,:,h2o_ndx) - !else - ! qh2o(:ncol,:) = q(:ncol,:,1) - ! !----------------------------------------------------------------------- - ! ! ... Xform water vapor from mmr to vmr and set upper bndy values - ! !----------------------------------------------------------------------- - ! call h2o_to_vmr( q(:ncol,:,1), h2ovmr(:ncol,:), mbar(:ncol,:), ncol ) - - ! call set_fstrat_h2o( h2ovmr, pmid, troplev, calday, ncol, lchnk ) - - !endif - - !!----------------------------------------------------------------------- - !! ... force ion/electron balance - !!----------------------------------------------------------------------- - !call charge_balance( ncol, vmr ) - - !!----------------------------------------------------------------------- - !! ... Set the "invariants" - !!----------------------------------------------------------------------- - !call setinv( invariants, tfld, h2ovmr, vmr, pmid, ncol, lchnk, pbuf ) - - !!----------------------------------------------------------------------- - !! ... stratosphere aerosol surface area - !!----------------------------------------------------------------------- - !if (sad_pbf_ndx>0) then - ! call pbuf_get_field(pbuf, sad_pbf_ndx, strato_sad) - !else - ! allocate(strato_sad(pcols,pver)) - ! strato_sad(:,:) = 0._r8 - - ! ! Prognostic modal stratospheric sulfate: compute dry strato_sad - ! call aero_model_strat_surfarea( ncol, mmr, pmid, tfld, troplevchem, pbuf, strato_sad, reff_strat ) - - !endif - - !stratochem: if ( has_strato_chem ) then - ! !----------------------------------------------------------------------- - ! ! ... initialize condensed and gas phases; all hno3 to gas - ! !----------------------------------------------------------------------- - ! hcl_cond(:,:) = 0.0_r8 - ! hcl_gas (:,:) = 0.0_r8 - ! do k = 1,pver - ! hno3_gas(:,k) = vmr(:,k,hno3_ndx) - ! h2o_gas(:,k) = h2ovmr(:,k) - ! hcl_gas(:,k) = vmr(:,k,hcl_ndx) - ! wrk(:,k) = h2ovmr(:,k) - ! if (snow_ndx>0) then - ! cldice(:ncol,k) = q(:ncol,k,cldice_ndx) + q(:ncol,k,snow_ndx) - ! else - ! cldice(:ncol,k) = q(:ncol,k,cldice_ndx) - ! endif - ! end do - ! do m = 1,2 - ! do k = 1,pver - ! hno3_cond(:,k,m) = 0._r8 - ! end do - ! end do - - ! call mmr2vmri( cldice(:ncol,:), h2o_cond(:ncol,:), mbar(:ncol,:), cnst_mw(cldice_ndx), ncol ) - - ! !----------------------------------------------------------------------- - ! ! ... call SAD routine - ! !----------------------------------------------------------------------- - ! call sad_strat_calc( lchnk, invariants(:ncol,:,indexm), pmb, tfld, hno3_gas, & - ! hno3_cond, h2o_gas, h2o_cond, hcl_gas, hcl_cond, strato_sad(:ncol,:), radius_strat, & - ! sad_strat, ncol, pbuf ) - -! ! NOTE: output of total HNO3 is before vmr is set to gas-phase. - ! call outfld( 'HNO3_TOTAL', vmr(:ncol,:,hno3_ndx), ncol ,lchnk ) - - - ! do k = 1,pver - ! vmr(:,k,hno3_ndx) = hno3_gas(:,k) - ! h2ovmr(:,k) = h2o_gas(:,k) - ! vmr(:,k,h2o_ndx) = h2o_gas(:,k) - ! wrk(:,k) = (h2ovmr(:,k) - wrk(:,k))*delt_inverse - ! end do - - ! call outfld( 'QDSAD', wrk(:,:), ncol, lchnk ) -! - ! call outfld( 'SAD_STRAT', strato_sad(:ncol,:), ncol, lchnk ) - ! call outfld( 'SAD_SULFC', sad_strat(:,:,1), ncol, lchnk ) - ! call outfld( 'SAD_LNAT', sad_strat(:,:,2), ncol, lchnk ) - ! call outfld( 'SAD_ICE', sad_strat(:,:,3), ncol, lchnk ) -! - ! call outfld( 'RAD_SULFC', radius_strat(:,:,1), ncol, lchnk ) - ! call outfld( 'RAD_LNAT', radius_strat(:,:,2), ncol, lchnk ) - ! call outfld( 'RAD_ICE', radius_strat(:,:,3), ncol, lchnk ) -! - ! call outfld( 'HNO3_GAS', vmr(:ncol,:,hno3_ndx), ncol, lchnk ) - ! call outfld( 'HNO3_STS', hno3_cond(:,:,1), ncol, lchnk ) - ! call outfld( 'HNO3_NAT', hno3_cond(:,:,2), ncol, lchnk ) -! - ! call outfld( 'HCL_TOTAL', vmr(:ncol,:,hcl_ndx), ncol, lchnk ) - ! call outfld( 'HCL_GAS', hcl_gas (:,:), ncol ,lchnk ) - ! call outfld( 'HCL_STS', hcl_cond(:,:), ncol ,lchnk ) - - ! !----------------------------------------------------------------------- - ! ! ... call aerosol reaction rates - ! !----------------------------------------------------------------------- - ! call ratecon_sfstrat( ncol, invariants(:,:,indexm), pmid, tfld, & - ! radius_strat(:,:,1), sad_strat(:,:,1), sad_strat(:,:,2), & - ! sad_strat(:,:,3), h2ovmr, vmr, reaction_rates, & - ! gprob_n2o5, gprob_cnt_hcl, gprob_cnt_h2o, gprob_bnt_h2o, & - ! gprob_hocl_hcl, gprob_hobr_hcl, wtper ) - - ! call outfld( 'GAMMA_HET1', gprob_n2o5 (:ncol,:), ncol, lchnk ) - ! call outfld( 'GAMMA_HET2', gprob_cnt_h2o (:ncol,:), ncol, lchnk ) - ! call outfld( 'GAMMA_HET3', gprob_bnt_h2o (:ncol,:), ncol, lchnk ) - ! call outfld( 'GAMMA_HET4', gprob_cnt_hcl (:ncol,:), ncol, lchnk ) - ! call outfld( 'GAMMA_HET5', gprob_hocl_hcl(:ncol,:), ncol, lchnk ) - ! call outfld( 'GAMMA_HET6', gprob_hobr_hcl(:ncol,:), ncol, lchnk ) - ! call outfld( 'WTPER', wtper (:ncol,:), ncol, lchnk ) - - !endif stratochem - -! ! NOTE: For gas-phase solver only. -! ! ratecon_sfstrat needs total hcl. - !if (hcl_ndx>0) then - ! vmr(:,:,hcl_ndx) = hcl_gas(:,:) - !endif - - !!----------------------------------------------------------------------- - !! ... Set the column densities at the upper boundary - !!----------------------------------------------------------------------- - !call set_ub_col( col_delta, vmr, invariants, pint(:,1), pdel, ncol, lchnk) - - !!----------------------------------------------------------------------- - !! ... Set rates for "tabular" and user specified reactions - !!----------------------------------------------------------------------- - !call setrxt( reaction_rates, tfld, invariants(1,1,indexm), ncol ) - ! - !sulfate(:,:) = 0._r8 - !if ( .not. carma_hetchem_feedback ) then - ! if( so4_ndx < 1 ) then ! get offline so4 field if not prognostic - ! call sulf_interp( ncol, lchnk, sulfate ) - ! else - ! sulfate(:,:) = vmr(:,:,so4_ndx) - ! endif - !endif - ! - !!----------------------------------------------------------------- - !! ... zero out sulfate above tropopause - !!----------------------------------------------------------------- - !do k = 1, pver - ! do i = 1, ncol - ! if (k < troplevchem(i)) then - ! sulfate(i,k) = 0.0_r8 - ! end if - ! end do - !end do - - !call outfld( 'SULF_TROP', sulfate(:ncol,:), ncol, lchnk ) - - !!----------------------------------------------------------------- - !! ... compute the relative humidity - !!----------------------------------------------------------------- - !call qsat(tfld(:ncol,:), pmid(:ncol,:), satv, satq) - - !do k = 1,pver - ! relhum(:,k) = .622_r8 * h2ovmr(:,k) / satq(:,k) - ! relhum(:,k) = max( 0._r8,min( 1._r8,relhum(:,k) ) ) - !end do - ! - !cwat(:ncol,:pver) = cldw(:ncol,:pver) - - !call usrrxt( reaction_rates, tfld, ion_temp_fld, ele_temp_fld, invariants, h2ovmr, & - ! pmid, invariants(:,:,indexm), sulfate, mmr, relhum, strato_sad, & - ! troplevchem, dlats, ncol, sad_trop, reff, cwat, mbar, pbuf ) - - !call outfld( 'SAD_TROP', sad_trop(:ncol,:), ncol, lchnk ) - - !! Add trop/strat components of SAD for output - !sad_trop(:ncol,:)=sad_trop(:ncol,:)+strato_sad(:ncol,:) - !call outfld( 'SAD_AERO', sad_trop(:ncol,:), ncol, lchnk ) - - !! Add trop/strat components of effective radius for output - !reff(:ncol,:)=reff(:ncol,:)+reff_strat(:ncol,:) - !call outfld( 'REFF_AERO', reff(:ncol,:), ncol, lchnk ) - - !if (het1_ndx>0) then - ! call outfld( 'het1_total', reaction_rates(:,:,het1_ndx), ncol, lchnk ) - !endif - - !if (ghg_chem) then - ! call ghg_chem_set_rates( reaction_rates, latmapback, zen_angle, ncol, lchnk ) - !endif - - !do i = phtcnt+1,rxt_tag_cnt - ! call outfld( tag_names(i), reaction_rates(:ncol,:,rxt_tag_map(i)), ncol, lchnk ) - !enddo - - !call adjrxt( reaction_rates, invariants, invariants(1,1,indexm), ncol,pver ) - - !!----------------------------------------------------------------------- - !! ... Compute the photolysis rates at time = t(n+1) - !!----------------------------------------------------------------------- - !!----------------------------------------------------------------------- - !! ... Set the column densities - !!----------------------------------------------------------------------- - !call setcol( col_delta, col_dens, vmr, pdel, ncol ) - - !!----------------------------------------------------------------------- - !! ... Calculate the photodissociation rates - !!----------------------------------------------------------------------- - - !esfact = 1._r8 - !call shr_orb_decl( calday, eccen, mvelpp, lambm0, obliqr , & - ! delta, esfact ) - - - !if ( xactive_prates ) then - ! if ( dst_ndx > 0 ) then - ! dust_vmr(:ncol,:,1:ndust) = vmr(:ncol,:,dst_ndx:dst_ndx+ndust-1) - ! else - ! dust_vmr(:ncol,:,:) = 0._r8 - ! endif - - ! !----------------------------------------------------------------- - ! ! ... compute the photolysis rates - ! !----------------------------------------------------------------- - ! call xactive_photo( reaction_rates, vmr, tfld, cwat, cldfr, & - ! pmid, zmidr, col_dens, zen_angle, asdir, & - ! invariants(1,1,indexm), ps, ts, & - ! esfact, relhum, dust_vmr, dt_diag, fracday, ncol, lchnk ) - - ! call outfld('DTCBS', dt_diag(:ncol,1), ncol, lchnk ) - ! call outfld('DTOCS', dt_diag(:ncol,2), ncol, lchnk ) - ! call outfld('DTSO4', dt_diag(:ncol,3), ncol, lchnk ) - ! call outfld('DTANT', dt_diag(:ncol,4), ncol, lchnk ) - ! call outfld('DTSAL', dt_diag(:ncol,5), ncol, lchnk ) - ! call outfld('DTDUST', dt_diag(:ncol,6), ncol, lchnk ) - ! call outfld('DTSOA', dt_diag(:ncol,7), ncol, lchnk ) - ! call outfld('DTTOTAL', dt_diag(:ncol,8), ncol, lchnk ) - ! call outfld('FRACDAY', fracday(:ncol), ncol, lchnk ) - - !else - ! !----------------------------------------------------------------- - ! ! ... lookup the photolysis rates from table - ! !----------------------------------------------------------------- - ! call table_photo( reaction_rates, pmid, pdel, tfld, zmid, zint, & - ! col_dens, zen_angle, asdir, cwat, cldfr, & - ! esfact, vmr, invariants, ncol, lchnk, pbuf ) - !endif - - !do i = 1,phtcnt - ! call outfld( tag_names(i), reaction_rates(:ncol,:,rxt_tag_map(i)), ncol, lchnk ) - !enddo - - !!----------------------------------------------------------------------- - !! ... Adjust the photodissociation rates - !!----------------------------------------------------------------------- - !call O1D_to_2OH_adj( reaction_rates, invariants, invariants(:,:,indexm), ncol, tfld ) - !call phtadj( reaction_rates, invariants, invariants(:,:,indexm), ncol,pver ) - - !!----------------------------------------------------------------------- - !! ... Compute the extraneous frcing at time = t(n+1) - !!----------------------------------------------------------------------- - !if ( o2_ndx > 0 .and. o_ndx > 0 ) then - ! do k = 1,pver - ! o2mmr(:ncol,k) = mmr(:ncol,k,o2_ndx) - ! ommr(:ncol,k) = mmr(:ncol,k,o_ndx) - ! end do - !endif - !call setext( extfrc, zint, zintr, cldtop, & - ! zmid, lchnk, tfld, o2mmr, ommr, & - ! pmid, mbar, rlats, calday, ncol, rlons, pbuf ) - !! include forcings from fire emissions ... - !call fire_emissions_vrt( ncol, lchnk, zint, fire_sflx, fire_ztop, extfrc ) - - !do m = 1,extcnt - ! if( m /= synoz_ndx .and. m /= aoa_nh_ext_ndx ) then - ! do k = 1,pver - ! extfrc(:ncol,k,m) = extfrc(:ncol,k,m) / invariants(:ncol,k,indexm) - ! end do - ! endif - ! call outfld( extfrc_name(m), extfrc(:ncol,:,m), ncol, lchnk ) - !end do - - !!----------------------------------------------------------------------- - !! ... Form the washout rates - !!----------------------------------------------------------------------- - !if ( gas_wetdep_method=='MOZ' ) then - ! call sethet( het_rates, pmid, zmid, phis, tfld, & - ! cmfdqr, prain, nevapr, delt, invariants(:,:,indexm), & - ! vmr, ncol, lchnk ) - ! if (.not. convproc_do_aer) then - ! call het_diags( het_rates(:ncol,:,:), mmr(:ncol,:,:), pdel(:ncol,:), lchnk, ncol ) - ! endif - !else - ! het_rates = 0._r8 - !end if -! -! CCMI -! -! set loss to below the tropopause only -! - !if ( st80_25_tau_ndx > 0 ) then - ! do i = 1,ncol - ! reaction_rates(i,1:troplev(i),st80_25_tau_ndx) = 0._r8 - ! enddo - !end if - - !if ( has_linoz_data ) then - ! ltrop_sol(:ncol) = troplev(:ncol) - !else - ! ltrop_sol(:ncol) = 0 ! apply solver to all levels - !endif - - !! save h2so4 before gas phase chem (for later new particle nucleation) - !if (ndx_h2so4 > 0) then - ! del_h2so4_gasprod(1:ncol,:) = vmr(1:ncol,:,ndx_h2so4) - !else - ! del_h2so4_gasprod(:,:) = 0.0_r8 - !endif - - !vmr0(:ncol,:,:) = vmr(:ncol,:,:) ! mixing ratios before chemistry changes - - !!======================================================================= - !! ... Call the class solution algorithms - !!======================================================================= - !!----------------------------------------------------------------------- - !! ... Solve for "Explicit" species - !!----------------------------------------------------------------------- - !call exp_sol( vmr, reaction_rates, het_rates, extfrc, delt, invariants(1,1,indexm), ncol, lchnk, ltrop_sol ) - - !!----------------------------------------------------------------------- - !! ... Solve for "Implicit" species - !!----------------------------------------------------------------------- - !if ( has_strato_chem ) wrk(:,:) = vmr(:,:,h2o_ndx) - !call t_startf('imp_sol') - !! - !call imp_sol( vmr, reaction_rates, het_rates, extfrc, delt, & - ! ncol,pver, lchnk, prod_out, loss_out ) - - !call t_stopf('imp_sol') - - !call chem_prod_loss_diags_out( ncol, lchnk, vmr, reaction_rates, prod_out, loss_out, invariants(:ncol,:,indexm) ) - !if( h2o_ndx>0) call outfld( 'H2O_GAS', vmr(1,1,h2o_ndx), ncol ,lchnk ) - - !! reset O3S to O3 in the stratosphere ... - !if ( o3_ndx > 0 .and. o3s_ndx > 0 ) then - ! do i = 1,ncol - ! vmr(i,1:troplev(i),o3s_ndx) = vmr(i,1:troplev(i),o3_ndx) - ! end do - !end if - - !if (convproc_do_aer) then - ! call vmr2mmr( vmr(:ncol,:,:), mmr_new(:ncol,:,:), mbar(:ncol,:), ncol ) - ! ! mmr_new = average of mmr values before and after imp_sol - ! mmr_new(:ncol,:,:) = 0.5_r8*( mmr(:ncol,:,:) + mmr_new(:ncol,:,:) ) - ! call het_diags( het_rates(:ncol,:,:), mmr_new(:ncol,:,:), pdel(:ncol,:), lchnk, ncol ) - !endif - - !! save h2so4 change by gas phase chem (for later new particle nucleation) - !if (ndx_h2so4 > 0) then - ! del_h2so4_gasprod(1:ncol,:) = vmr(1:ncol,:,ndx_h2so4) - del_h2so4_gasprod(1:ncol,:) - !endif - -! -! Aerosol processes ... -! - - !call aero_model_gasaerexch( imozart-1, ncol, lchnk, troplevchem, delt, reaction_rates, & - ! tfld, pmid, pdel, mbar, relhum, & - ! zm, qh2o, cwat, cldfr, ncldwtr, & - ! invariants(:,:,indexm), invariants, del_h2so4_gasprod, & - ! vmr0, vmr, pbuf ) - - !if ( has_strato_chem ) then - - ! wrk(:ncol,:) = (vmr(:ncol,:,h2o_ndx) - wrk(:ncol,:))*delt_inverse - ! call outfld( 'QDCHEM', wrk(:ncol,:), ncol, lchnk ) - ! call outfld( 'HNO3_GAS', vmr(:ncol,:,hno3_ndx), ncol ,lchnk ) - - ! !----------------------------------------------------------------------- - ! ! ... aerosol settling - ! ! first settle hno3(2) using radius ice - ! ! secnd settle hno3(3) using radius large nat - ! !----------------------------------------------------------------------- - ! wrk(:,:) = vmr(:,:,h2o_ndx) -#ifdef ALT_SETTL - ! where( h2o_cond(:,:) > 0._r8 ) - ! settl_rad(:,:) = radius_strat(:,:,3) - ! elsewhere - ! settl_rad(:,:) = 0._r8 - ! endwhere - ! call strat_aer_settling( invariants(1,1,indexm), pmid, delt, zmid, tfld, & - ! hno3_cond(1,1,2), settl_rad, ncol, lchnk, 1 ) - - ! where( h2o_cond(:,:) == 0._r8 ) - ! settl_rad(:,:) = radius_strat(:,:,2) - ! elsewhere - ! settl_rad(:,:) = 0._r8 - ! endwhere - ! call strat_aer_settling( invariants(1,1,indexm), pmid, delt, zmid, tfld, & - ! hno3_cond(1,1,2), settl_rad, ncol, lchnk, 2 ) -#else - ! call strat_aer_settling( invariants(1,1,indexm), pmid, delt, zmid, tfld, & - ! hno3_cond(1,1,2), radius_strat(1,1,2), ncol, lchnk, 2 ) -#endif - - !----------------------------------------------------------------------- - ! ... reform total hno3 and hcl = gas + all condensed - !----------------------------------------------------------------------- -! NOTE: vmr for hcl and hno3 is gas-phase at this point. -! hno3_cond(:,k,1) = STS; hno3_cond(:,k,2) = NAT - - ! do k = 1,pver - ! vmr(:,k,hno3_ndx) = vmr(:,k,hno3_ndx) + hno3_cond(:,k,1) & - ! + hno3_cond(:,k,2) - ! vmr(:,k,hcl_ndx) = vmr(:,k,hcl_ndx) + hcl_cond(:,k) - ! - ! end do - - ! wrk(:,:) = (vmr(:,:,h2o_ndx) - wrk(:,:))*delt_inverse - ! call outfld( 'QDSETT', wrk(:,:), ncol, lchnk ) - - !endif - -! -! LINOZ -! - !if ( do_lin_strat_chem ) then - ! call lin_strat_chem_solve( ncol, lchnk, vmr(:,:,o3_ndx), col_dens(:,:,1), tfld, zen_angle, pmid, delt, rlats, troplev ) - !end if - - !!----------------------------------------------------------------------- - !! ... Check for negative values and reset to zero - !!----------------------------------------------------------------------- - !call negtrc( 'After chemistry ', vmr, ncol ) - - !!----------------------------------------------------------------------- - !! ... Set upper boundary mmr values - !!----------------------------------------------------------------------- - !call set_fstrat_vals( vmr, pmid, pint, troplev, calday, ncol,lchnk ) - - !!----------------------------------------------------------------------- - !! ... Set fixed lower boundary mmr values - !!----------------------------------------------------------------------- - !call flbc_set( vmr, ncol, lchnk, map2chm ) - - !!----------------------------------------------------------------------- - !! set NOy UBC - !!----------------------------------------------------------------------- - !call noy_ubc_set( lchnk, ncol, vmr ) - - !if ( ghg_chem ) then - ! call ghg_chem_set_flbc( vmr, ncol ) - !endif - - !!----------------------------------------------------------------------- - !! force ion/electron balance -- ext forcings likely do not conserve charge - !!----------------------------------------------------------------------- - !call charge_balance( ncol, vmr ) - - !!----------------------------------------------------------------------- - !! ... Xform from vmr to mmr - !!----------------------------------------------------------------------- - !call vmr2mmr( vmr(:ncol,:,:), mmr_tend(:ncol,:,:), mbar(:ncol,:), ncol ) - - !call set_short_lived_species( mmr_tend, lchnk, ncol, pbuf ) - - !!----------------------------------------------------------------------- - !! ... Form the tendencies - !!----------------------------------------------------------------------- - !do m = 1,gas_pcnst - ! mmr_new(:ncol,:,m) = mmr_tend(:ncol,:,m) - ! mmr_tend(:ncol,:,m) = (mmr_tend(:ncol,:,m) - mmr(:ncol,:,m))*delt_inverse - !enddo - - !do m = 1,pcnst - ! n = map2chm(m) - ! if( n > 0 ) then - ! qtend(:ncol,:,m) = qtend(:ncol,:,m) + mmr_tend(:ncol,:,n) - ! end if - !end do - - !tvs(:ncol) = tfld(:ncol,pver) * (1._r8 + qh2o(:ncol,pver)) - - !sflx(:,:) = 0._r8 - !call get_ref_date(yr, mon, day, sec) - !ncdate = yr*10000 + mon*100 + day - !wind_speed(:ncol) = sqrt( ufld(:ncol,pver)*ufld(:ncol,pver) + vfld(:ncol,pver)*vfld(:ncol,pver) ) - !prect(:ncol) = precc(:ncol) + precl(:ncol) - - !if ( drydep_method == DD_XLND ) then - ! soilw = -99 - ! call drydep( ocnfrac, icefrac, ncdate, ts, ps, & - ! wind_speed, qh2o(:,pver), tfld(:,pver), pmid(:,pver), prect, & - ! snowhland, fsds, depvel, sflx, mmr, & - ! tvs, soilw, relhum(:,pver:pver), ncol, lonndx, latndx, lchnk ) - !else if ( drydep_method == DD_XATM ) then - ! table_soilw = has_drydep( 'H2' ) .or. has_drydep( 'CO' ) - ! if( .not. dyn_soilw .and. table_soilw ) then - ! call set_soilw( soilw, lchnk, calday ) - ! end if - ! call drydep( ncdate, ts, ps, & - ! wind_speed, qh2o(:,pver), tfld(:,pver), pmid(:,pver), prect, & - ! snowhland, fsds, depvel, sflx, mmr, & - ! tvs, soilw, relhum(:,pver:pver), ncol, lonndx, latndx, lchnk ) - !else if ( drydep_method == DD_TABL ) then - ! call drydep( calday, ts, zen_angle, & - ! depvel, sflx, mmr, pmid(:,pver), & - ! tvs, ncol, icefrac, ocnfrac, lchnk ) - !endif - - !drydepflx(:,:) = 0._r8 - !do m = 1,pcnst - ! n = map2chm( m ) - ! if ( n > 0 ) then - ! cflx(:ncol,m) = cflx(:ncol,m) - sflx(:ncol,n) - ! drydepflx(:ncol,m) = sflx(:ncol,n) - ! wetdepflx_diag(:ncol,n) = wetdepflx(:ncol,m) - ! endif - !end do - - !call chm_diags( lchnk, ncol, vmr(:ncol,:,:), mmr_new(:ncol,:,:), & - ! reaction_rates(:ncol,:,:), invariants(:ncol,:,:), depvel(:ncol,:), sflx(:ncol,:), & - ! mmr_tend(:ncol,:,:), pdel(:ncol,:), pmid(:ncol,:), troplev(:ncol), wetdepflx_diag(:ncol,:), & - ! nhx_nitrogen_flx(:ncol), noy_nitrogen_flx(:ncol) ) - - !call rate_diags_calc( reaction_rates(:,:,:), vmr(:,:,:), invariants(:,:,indexm), ncol, lchnk ) -! -! jfl -! -! surface vmr -! - !if ( pm25_srf_diag ) then - ! pm25(:ncol) = mmr_new(:ncol,pver,cb1_ndx) & - ! + mmr_new(:ncol,pver,cb2_ndx) & - ! + mmr_new(:ncol,pver,oc1_ndx) & - ! + mmr_new(:ncol,pver,oc2_ndx) & - ! + mmr_new(:ncol,pver,dst1_ndx) & - ! + mmr_new(:ncol,pver,dst2_ndx) & - ! + mmr_new(:ncol,pver,sslt1_ndx) & - ! + mmr_new(:ncol,pver,sslt2_ndx) & - ! + mmr_new(:ncol,pver,soa_ndx) & - ! + mmr_new(:ncol,pver,so4_ndx) - ! call outfld('PM25_SRF',pm25(:ncol) , ncol, lchnk ) - !endif - !if ( pm25_srf_diag_soa ) then - ! pm25(:ncol) = mmr_new(:ncol,pver,cb1_ndx) & - ! + mmr_new(:ncol,pver,cb2_ndx) & - ! + mmr_new(:ncol,pver,oc1_ndx) & - ! + mmr_new(:ncol,pver,oc2_ndx) & - ! + mmr_new(:ncol,pver,dst1_ndx) & - ! + mmr_new(:ncol,pver,dst2_ndx) & - ! + mmr_new(:ncol,pver,sslt1_ndx) & - ! + mmr_new(:ncol,pver,sslt2_ndx) & - ! + mmr_new(:ncol,pver,soam_ndx) & - ! + mmr_new(:ncol,pver,soai_ndx) & - ! + mmr_new(:ncol,pver,soat_ndx) & - ! + mmr_new(:ncol,pver,soab_ndx) & - ! + mmr_new(:ncol,pver,soax_ndx) & - ! + mmr_new(:ncol,pver,so4_ndx) - ! call outfld('PM25_SRF',pm25(:ncol) , ncol, lchnk ) - !endif -! -! - !call outfld('Q_SRF',qh2o(:ncol,pver) , ncol, lchnk ) - !call outfld('U_SRF',ufld(:ncol,pver) , ncol, lchnk ) - !call outfld('V_SRF',vfld(:ncol,pver) , ncol, lchnk ) - -! - !if (.not.sad_pbf_ndx>0) then - ! deallocate(strato_sad) - !endif - - end subroutine gas_phase_chemdr - -end module mo_gas_phase_chemdr diff --git a/src/chemistry/geoschem/mo_ghg_chem.F90 b/src/chemistry/geoschem/mo_ghg_chem.F90 deleted file mode 120000 index f8a8b4ba4c..0000000000 --- a/src/chemistry/geoschem/mo_ghg_chem.F90 +++ /dev/null @@ -1 +0,0 @@ -../mozart/mo_ghg_chem.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/mo_lightning.F90 b/src/chemistry/geoschem/mo_lightning.F90 deleted file mode 120000 index 8b731ae98f..0000000000 --- a/src/chemistry/geoschem/mo_lightning.F90 +++ /dev/null @@ -1 +0,0 @@ -../mozart/mo_lightning.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/mo_mean_mass.F90 b/src/chemistry/geoschem/mo_mean_mass.F90 deleted file mode 120000 index e4231e65f7..0000000000 --- a/src/chemistry/geoschem/mo_mean_mass.F90 +++ /dev/null @@ -1 +0,0 @@ -../mozart/mo_mean_mass.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/mo_setinv.F90 b/src/chemistry/geoschem/mo_setinv.F90 deleted file mode 120000 index eeca85151d..0000000000 --- a/src/chemistry/geoschem/mo_setinv.F90 +++ /dev/null @@ -1 +0,0 @@ -../mozart/mo_setinv.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/mo_tracname.F90 b/src/chemistry/geoschem/mo_tracname.F90 deleted file mode 100644 index 8e8a80b9a3..0000000000 --- a/src/chemistry/geoschem/mo_tracname.F90 +++ /dev/null @@ -1,14 +0,0 @@ - - module mo_tracname -!----------------------------------------------------------- -! ... List of advected and non-advected trace species, and -! surface fluxes for the advected species. -!----------------------------------------------------------- - - use chem_mods, only : gas_pcnst - - implicit none - - character(len=16) :: solsym(gas_pcnst) ! species names - - end module mo_tracname diff --git a/src/chemistry/geoschem/rate_diags.F90 b/src/chemistry/geoschem/rate_diags.F90 deleted file mode 100644 index 40b5fa6dde..0000000000 --- a/src/chemistry/geoschem/rate_diags.F90 +++ /dev/null @@ -1,177 +0,0 @@ -!-------------------------------------------------------------------------------- -! Manages writing reaction rates to history -!-------------------------------------------------------------------------------- -module rate_diags - - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_kind_mod, only : CL => SHR_KIND_CL - use cam_history, only : fieldname_len - use cam_history, only : addfld, add_default - use cam_history, only : outfld - use chem_mods, only : rxt_tag_cnt, rxt_tag_lst, rxt_tag_map - use ppgrid, only : pver - use spmd_utils, only : masterproc - use cam_abortutils, only : endrun -! use sums_utils, only : sums_grp_t, parse_sums - - implicit none - private - public :: rate_diags_init - public :: rate_diags_calc - public :: rate_diags_readnl - - character(len=fieldname_len) :: rate_names(rxt_tag_cnt) - -! integer :: ngrps = 0 -! type(sums_grp_t), allocatable :: grps(:) - - integer, parameter :: maxlines = 200 - character(len=CL), allocatable :: rxn_rate_sums(:) - -contains - -!------------------------------------------------------------------- -!------------------------------------------------------------------- - subroutine rate_diags_readnl(nlfile) - - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use spmd_utils, only: mpicom, mpi_character, masterprocid - - ! args - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - - ! Local variables - integer :: unitn, ierr - - namelist /rxn_rate_diags_nl/ rxn_rate_sums - - allocate( rxn_rate_sums( maxlines ) ) - rxn_rate_sums(:) = ' ' - - !! Read namelist - !if (masterproc) then - ! unitn = getunit() - ! open( unitn, file=trim(nlfile), status='old' ) - ! call find_group_name(unitn, 'rxn_rate_diags_nl', status=ierr) - ! if (ierr == 0) then - ! read(unitn, rxn_rate_diags_nl, iostat=ierr) - ! if (ierr /= 0) then - ! call endrun('rate_diags_readnl:: ERROR reading namelist') - ! end if - ! end if - ! close(unitn) - ! call freeunit(unitn) - !end if - - ! Broadcast namelist variables - call mpi_bcast(rxn_rate_sums,len(rxn_rate_sums(1))*maxlines, mpi_character, masterprocid, mpicom, ierr) - - end subroutine rate_diags_readnl -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- - subroutine rate_diags_init - use phys_control, only : phys_getopts - - integer :: i, len, pos - character(len=64) :: name - logical :: history_scwaccm_forcing - - call phys_getopts( history_scwaccm_forcing_out = history_scwaccm_forcing ) - - !do i = 1,rxt_tag_cnt - ! pos = 0 - ! pos = index(rxt_tag_lst(i),'tag_') - ! if (pos <= 0) pos = index(rxt_tag_lst(i),'usr_') - ! if (pos <= 0) pos = index(rxt_tag_lst(i),'cph_') - ! if (pos <= 0) pos = index(rxt_tag_lst(i),'ion_') - ! if (pos>0) then - ! name = 'r_'//trim(rxt_tag_lst(i)(5:)) - ! else - ! name = 'r_'//trim(rxt_tag_lst(i)(1:)) - ! endif - ! len = min(fieldname_len,len_trim(name)) - ! rate_names(i) = trim(name(1:len)) - ! call addfld(rate_names(i), (/ 'lev' /),'A', 'molecules/cm3/sec','reaction rate') - ! if (history_scwaccm_forcing .and. rate_names(i) == 'r_O1D_H2O') then - ! call add_default( rate_names(i), 1, ' ') - ! endif - !enddo - - !! parse the terms of the summations - !call parse_sums(rxn_rate_sums, ngrps, grps) - !deallocate( rxn_rate_sums ) - - !do i = 1, ngrps - ! call addfld( grps(i)%name, (/ 'lev' /),'A', 'molecules/cm3/sec','reaction rate group') - !enddo - - end subroutine rate_diags_init - -!-------------------------------------------------------------------------------- -!-------------------------------------------------------------------------------- - subroutine rate_diags_calc( rxt_rates, vmr, m, ncol, lchnk ) - - !use mo_rxt_rates_conv, only: set_rates - - real(r8), intent(inout) :: rxt_rates(:,:,:) ! 'molec/cm3/sec' - real(r8), intent(in) :: vmr(:,:,:) - real(r8), intent(in) :: m(:,:) ! air density (molecules/cm3) - integer, intent(in) :: ncol, lchnk - - !integer :: i, j, ndx - !real(r8) :: group_rate(ncol,pver) - - rxt_rates(:,:,:) = 0.0e+0_r8 - - !call set_rates( rxt_rates, vmr, ncol ) - - !! output individual tagged rates - !do i = 1, rxt_tag_cnt - ! ! convert from vmr/sec to molecules/cm3/sec - ! rxt_rates(:ncol,:,rxt_tag_map(i)) = rxt_rates(:ncol,:,rxt_tag_map(i)) * m(:ncol,:) - ! call outfld( rate_names(i), rxt_rates(:ncol,:,rxt_tag_map(i)), ncol, lchnk ) - !enddo - - !! output rate groups ( or families ) - !do i = 1, ngrps - ! group_rate(:,:) = 0._r8 - ! do j = 1, grps(i)%nmembers - ! ndx = lookup_tag_ndx(grps(i)%term(j)) - ! group_rate(:ncol,:) = group_rate(:ncol,:) + grps(i)%multipler(j)*rxt_rates(:ncol,:,ndx) - ! enddo - ! call outfld( grps(i)%name, group_rate(:ncol,:), ncol, lchnk ) - !end do - - end subroutine rate_diags_calc - -!------------------------------------------------------------------- -! Private routines : -!------------------------------------------------------------------- -!------------------------------------------------------------------- - -!------------------------------------------------------------------- -! finds the index corresponging to a given reacton name -!------------------------------------------------------------------- - function lookup_tag_ndx( name ) result( ndx ) - character(len=*) :: name - integer :: ndx - - integer :: i - - ndx = -1 - - !findloop: do i = 1,rxt_tag_cnt - ! if (trim(name) .eq. trim(rate_names(i)(3:))) then - ! ndx = i - ! return - ! endif - !end do findloop - - !if (ndx<0) then - ! call endrun('rate_diags: not able to find rxn tag name: '//trim(name)) - !endif - - end function lookup_tag_ndx - -end module rate_diags diff --git a/src/chemistry/geoschem/tracer_cnst.F90 b/src/chemistry/geoschem/tracer_cnst.F90 deleted file mode 120000 index be79edec09..0000000000 --- a/src/chemistry/geoschem/tracer_cnst.F90 +++ /dev/null @@ -1 +0,0 @@ -../mozart/tracer_cnst.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/tracer_srcs.F90 b/src/chemistry/geoschem/tracer_srcs.F90 deleted file mode 120000 index 136404bf05..0000000000 --- a/src/chemistry/geoschem/tracer_srcs.F90 +++ /dev/null @@ -1 +0,0 @@ -../mozart/tracer_srcs.F90 \ No newline at end of file diff --git a/src/chemistry/geoschem/upper_bc.F90 b/src/chemistry/geoschem/upper_bc.F90 deleted file mode 100644 index 61f4dab886..0000000000 --- a/src/chemistry/geoschem/upper_bc.F90 +++ /dev/null @@ -1,243 +0,0 @@ - -module upper_bc - -!--------------------------------------------------------------------------------- -! Module to compute the upper boundary condition for temperature (dry static energy) -! and trace gases. Uses the MSIS model, and SNOE and TIME GCM data. -! -! original code by Stacy Walters -! adapted by B. A. Boville -!--------------------------------------------------------------------------------- - - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_const_mod,only: grav => shr_const_g, & ! gravitational constant (m/s^2) - kboltz => shr_const_boltz, & ! Boltzmann constant - pi => shr_const_pi, & ! pi - rEarth => shr_const_rearth ! Earth radius - use ppgrid, only: pcols, pver, pverp - use constituents, only: pcnst - use cam_logfile, only: iulog - use spmd_utils, only: masterproc - use ref_pres, only: ptop_ref - - implicit none - private - save -! -! Public interfaces -! - public :: ubc_defaultopts ! set default values of namelist variables - public :: ubc_setopts ! get namelist input - public :: ubc_init ! global initialization - public :: ubc_timestep_init ! time step initialization - public :: ubc_get_vals ! get ubc values for this step - -! Namelist variables - character(len=256) :: snoe_ubc_file = ' ' - real(r8) :: t_pert_ubc = 0._r8 - real(r8) :: no_xfac_ubc = 1._r8 - - character(len=256) :: tgcm_ubc_file = ' ' - integer :: tgcm_ubc_cycle_yr = 0 - integer :: tgcm_ubc_fixed_ymd = 0 - integer :: tgcm_ubc_fixed_tod = 0 - integer :: f_ndx, hf_ndx - character(len=32) :: tgcm_ubc_data_type = 'CYCLICAL' - - logical :: apply_upper_bc = .true. - -!================================================================================================ -contains -!================================================================================================ - -subroutine ubc_defaultopts(tgcm_ubc_file_out, tgcm_ubc_data_type_out, tgcm_ubc_cycle_yr_out, tgcm_ubc_fixed_ymd_out, & - tgcm_ubc_fixed_tod_out, snoe_ubc_file_out, t_pert_ubc_out, no_xfac_ubc_out) -!----------------------------------------------------------------------- -! Purpose: Return default runtime options -!----------------------------------------------------------------------- - - real(r8), intent(out), optional :: t_pert_ubc_out - real(r8), intent(out), optional :: no_xfac_ubc_out - character(len=*), intent(out), optional :: tgcm_ubc_file_out - character(len=*), intent(out), optional :: snoe_ubc_file_out - integer , intent(out), optional :: tgcm_ubc_cycle_yr_out - integer , intent(out), optional :: tgcm_ubc_fixed_ymd_out - integer , intent(out), optional :: tgcm_ubc_fixed_tod_out - character(len=*), intent(out), optional :: tgcm_ubc_data_type_out - -!----------------------------------------------------------------------- - - if ( present(tgcm_ubc_file_out) ) then - tgcm_ubc_file_out = tgcm_ubc_file - endif - if ( present(tgcm_ubc_data_type_out) ) then - tgcm_ubc_data_type_out = tgcm_ubc_data_type - endif - if ( present(tgcm_ubc_cycle_yr_out) ) then - tgcm_ubc_cycle_yr_out = tgcm_ubc_cycle_yr - endif - if ( present(tgcm_ubc_fixed_ymd_out) ) then - tgcm_ubc_fixed_ymd_out = tgcm_ubc_fixed_ymd - endif - if ( present(tgcm_ubc_fixed_tod_out) ) then - tgcm_ubc_fixed_tod_out = tgcm_ubc_fixed_tod - endif - if ( present(snoe_ubc_file_out) ) then - snoe_ubc_file_out = snoe_ubc_file - endif - if ( present(t_pert_ubc_out) ) then - t_pert_ubc_out = t_pert_ubc - endif - if ( present(no_xfac_ubc_out) ) then - no_xfac_ubc_out = no_xfac_ubc - endif - -end subroutine ubc_defaultopts - -!================================================================================================ - -subroutine ubc_setopts(tgcm_ubc_file_in, tgcm_ubc_data_type_in, tgcm_ubc_cycle_yr_in, tgcm_ubc_fixed_ymd_in, & - tgcm_ubc_fixed_tod_in, snoe_ubc_file_in, t_pert_ubc_in, no_xfac_ubc_in) -!----------------------------------------------------------------------- -! Purpose: Set runtime options -!----------------------------------------------------------------------- - - use cam_abortutils, only : endrun - - real(r8), intent(in), optional :: t_pert_ubc_in - real(r8), intent(in), optional :: no_xfac_ubc_in - character(len=*), intent(in), optional :: tgcm_ubc_file_in - character(len=*), intent(in), optional :: snoe_ubc_file_in - integer , intent(in), optional :: tgcm_ubc_cycle_yr_in - integer , intent(in), optional :: tgcm_ubc_fixed_ymd_in - integer , intent(in), optional :: tgcm_ubc_fixed_tod_in - character(len=*), intent(in), optional :: tgcm_ubc_data_type_in - -!----------------------------------------------------------------------- - - if ( present(tgcm_ubc_file_in) ) then - tgcm_ubc_file = tgcm_ubc_file_in - endif - if ( present(tgcm_ubc_data_type_in) ) then - tgcm_ubc_data_type = tgcm_ubc_data_type_in - endif - if ( present(tgcm_ubc_cycle_yr_in) ) then - tgcm_ubc_cycle_yr = tgcm_ubc_cycle_yr_in - endif - if ( present(tgcm_ubc_fixed_ymd_in) ) then - tgcm_ubc_fixed_ymd = tgcm_ubc_fixed_ymd_in - endif - if ( present(tgcm_ubc_fixed_tod_in) ) then - tgcm_ubc_fixed_tod = tgcm_ubc_fixed_tod_in - endif - if ( present(snoe_ubc_file_in) ) then - snoe_ubc_file = snoe_ubc_file_in - endif - if ( present(t_pert_ubc_in) ) then - t_pert_ubc = t_pert_ubc_in - endif - if ( present(no_xfac_ubc_in) ) then - no_xfac_ubc = no_xfac_ubc_in - if( no_xfac_ubc < 0._r8 ) then - write(iulog,*) 'ubc_setopts: no_xfac_ubc = ',no_xfac_ubc,' must be >= 0' - call endrun - end if - endif - -end subroutine ubc_setopts - -!=============================================================================== - - subroutine ubc_init() -!----------------------------------------------------------------------- -! Initialization of time independent fields for the upper boundary condition -! Calls initialization routine for MSIS, TGCM and SNOE -!----------------------------------------------------------------------- - - ! Assume we are running in a simulation with ptop >= 1 Pa - apply_upper_bc = .false. - - if (.not.apply_upper_bc) return - - end subroutine ubc_init - -!=============================================================================== - - subroutine ubc_timestep_init(pbuf2d, state) -!----------------------------------------------------------------------- -! timestep dependent setting -!----------------------------------------------------------------------- - - use solar_parms_data, only: kp=>solar_parms_kp, ap=>solar_parms_ap, f107=>solar_parms_f107 - use solar_parms_data, only: f107a=>solar_parms_f107a, f107p=>solar_parms_f107p - use physics_types, only: physics_state - use ppgrid, only: begchunk, endchunk - use physics_buffer, only: physics_buffer_desc - - type(physics_state), intent(in) :: state(begchunk:endchunk) - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - - if (.not.apply_upper_bc) return - - end subroutine ubc_timestep_init - -!=============================================================================== - - subroutine ubc_get_vals (lchnk, ncol, pint, zi, t, q, omega, phis, & - msis_temp, ubc_mmr, ubc_flux) - -!----------------------------------------------------------------------- -! interface routine for vertical diffusion and pbl scheme -!----------------------------------------------------------------------- - use cam_abortutils, only: endrun - use physconst, only: avogad, rairv, mbarv, rga ! Avogadro, gas constant, mean mass, universal gas constant - use phys_control, only: waccmx_is - use constituents, only: cnst_get_ind, cnst_mw, cnst_fixed_ubc ! Needed for ubc_flux - -!------------------------------Arguments-------------------------------- - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncol ! number of atmospheric columns - real(r8), intent(in) :: pint(pcols,pverp) ! interface pressures - real(r8), intent(in) :: zi(pcols,pverp) ! interface geoptl height above sfc - real(r8), intent(in) :: t(pcols,pver) ! midpoint temperature - real(r8), intent(in),target :: q(pcols,pver,pcnst) ! contituent mixing ratios (kg/kg) - real(r8), intent(in) :: omega(pcols,pver) ! Vertical pressure velocity (Pa/s) - real(r8), intent(in) :: phis(pcols) ! Surface geopotential (m2/s2) - - real(r8), intent(out) :: msis_temp(pcols) ! upper bndy temperature (K) - real(r8), intent(out) :: ubc_mmr(pcols,pcnst) ! upper bndy mixing ratios (kg/kg) - real(r8), intent(out) :: ubc_flux(pcols,pcnst) ! upper bndy flux (kg/s/m^2) - -!---------------------------Local storage------------------------------- - integer :: m ! constituent index - integer :: ierr ! error flag for allocates - integer :: indx_H ! cnst index for H - integer :: indx_HE ! cnst index for He - integer :: iCol ! column loop counter - - real(r8), parameter :: m2km = 1.e-3_r8 ! meter to km - real(r8) :: rho_top(pcols) ! density at top interface - real(r8) :: z_top(pcols) ! height of top interface (km) - - real(r8), parameter :: hfluxlimitfac = 0.72_r8 ! Hydrogen upper boundary flux limiting factor - - real(r8) :: nmbartop ! Top level density (rho) - real(r8) :: zkt ! Factor for H Jean's escape flux calculation - real(r8) :: nDensHETop ! Helium number density (kg/m3) - real(r8) :: pScaleHeight ! Scale height (m) - real(r8) :: wN2 ! Neutral vertical velocity second level (m/s) - real(r8) :: wN3 ! Neutral vertical velocity at third level (m/s) - real(r8) :: wNTop ! Neutral vertical velocity at top level (m/s) - - real(r8), pointer :: qh_top(:) ! Top level hydrogen mixing ratio (kg/kg) -!----------------------------------------------------------------------- - - ubc_mmr(:,:) = 0._r8 - ubc_flux(:,:) = 0._r8 - msis_temp(:) = 0._r8 - - if (.not. apply_upper_bc) return - - end subroutine ubc_get_vals - -end module upper_bc diff --git a/src/chemistry/modal_aero/modal_aero_gasaerexch.F90 b/src/chemistry/modal_aero/modal_aero_gasaerexch.F90 index 503853defd..31e6170a2d 100644 --- a/src/chemistry/modal_aero/modal_aero_gasaerexch.F90 +++ b/src/chemistry/modal_aero/modal_aero_gasaerexch.F90 @@ -108,8 +108,7 @@ subroutine modal_aero_gasaerexch_sub( & use physconst, only: gravit, mwdry, rair use cam_abortutils, only: endrun use spmd_utils, only: iam, masterproc -use mo_chem_utls, only: utls_chem_is - +use phys_control, only: cam_chempkg_is implicit none @@ -264,7 +263,7 @@ subroutine modal_aero_gasaerexch_sub( & ! set gas species indices call cnst_get_ind( 'H2SO4', l_so4g, .false. ) call cnst_get_ind( 'NH3', l_nh4g, .false. ) - if ( .not. utls_chem_is('GEOS-Chem') ) then + if ( .not. cam_chempkg_is('geoschem_mam4') ) then call cnst_get_ind( 'MSA', l_msag, .false. ) else l_msag = 0 diff --git a/src/chemistry/modal_aero/sox_cldaero_mod.F90 b/src/chemistry/modal_aero/sox_cldaero_mod.F90 index 589c881279..2500aa37e5 100644 --- a/src/chemistry/modal_aero/sox_cldaero_mod.F90 +++ b/src/chemistry/modal_aero/sox_cldaero_mod.F90 @@ -7,14 +7,13 @@ module sox_cldaero_mod use cam_abortutils, only : endrun use ppgrid, only : pcols, pver use mo_chem_utls, only : get_spc_ndx - use mo_chem_utls, only: utls_chem_is use cldaero_mod, only : cldaero_conc_t, cldaero_allocate, cldaero_deallocate use modal_aero_data, only : ntot_amode, modeptr_accum, lptr_so4_cw_amode, lptr_msa_cw_amode use modal_aero_data, only : numptrcw_amode, lptr_nh4_cw_amode use modal_aero_data, only : cnst_name_cw, specmw_so4_amode use chem_mods, only : adv_mass use physconst, only : gravit - use phys_control, only : phys_getopts + use phys_control, only : phys_getopts, cam_chempkg_is use cldaero_mod, only : cldaero_uptakerate use chem_mods, only : gas_pcnst @@ -231,10 +230,10 @@ subroutine sox_cldaero_update( & dqdt_aqo3rxn(:,:) = 0.0_r8 ! Avoid double counting in-cloud sulfur oxidation when running with - ! GEOS-Chem (CESM2-GC). If running with CESM2-GC, sulfur oxidation + ! GEOS-Chem. If running with GEOS-Chem then sulfur oxidation ! is performed internally to GEOS-Chem. Here, we just return to the ! parent routine and thus we do not apply tendencies calculated by MAM. - if ( utls_chem_is('GEOS-Chem') ) return + if ( cam_chempkg_is('geoschem_mam4') ) return lev_loop: do k = 1,pver col_loop: do i = 1,ncol diff --git a/src/chemistry/mozart/mo_chem_utls.F90 b/src/chemistry/mozart/mo_chem_utls.F90 index 6d47ed3a0a..992e0789e7 100644 --- a/src/chemistry/mozart/mo_chem_utls.F90 +++ b/src/chemistry/mozart/mo_chem_utls.F90 @@ -9,29 +9,43 @@ module mo_chem_utls contains - integer function get_spc_ndx( spc_name ) + integer function get_spc_ndx( spc_name, compare_uppercase ) !----------------------------------------------------------------------- ! ... return overall species index associated with spc_name !----------------------------------------------------------------------- use chem_mods, only : gas_pcnst use mo_tracname, only : tracnam => solsym + use string_utils, only : to_upper implicit none !----------------------------------------------------------------------- ! ... dummy arguments !----------------------------------------------------------------------- - character(len=*), intent(in) :: spc_name + character(len=*), intent(in) :: spc_name + logical, intent(in), optional :: compare_uppercase !----------------------------------------------------------------------- ! ... local variables !----------------------------------------------------------------------- integer :: m + logical :: convert_to_upper + logical :: match + + convert_to_upper = .false. + if ( present( compare_uppercase ) ) then + convert_to_upper = compare_uppercase + endif get_spc_ndx = -1 do m = 1,gas_pcnst - if( trim( spc_name ) == trim( tracnam(m) ) ) then + if ( .not. convert_to_upper ) then + match = trim( spc_name ) == trim( tracnam(m) ) + else + match = trim( to_upper( spc_name ) ) == trim( to_upper( tracnam(m) ) ) + endif + if( match ) then get_spc_ndx = m exit end if From 9c5f0b4c8261eada8270a1af9e193609d42cf605 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 4 Jan 2023 12:40:05 -0700 Subject: [PATCH 081/160] Removed unused file geoschem/getLandTypes.F90 Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/getLandTypes.F90 | 549 ------------------------ 1 file changed, 549 deletions(-) delete mode 100644 src/chemistry/geoschem/getLandTypes.F90 diff --git a/src/chemistry/geoschem/getLandTypes.F90 b/src/chemistry/geoschem/getLandTypes.F90 deleted file mode 100644 index 93e1030340..0000000000 --- a/src/chemistry/geoschem/getLandTypes.F90 +++ /dev/null @@ -1,549 +0,0 @@ -!------------------------------------------------------------------------------ -!BOP -! -! !ROUTINE: getLandTypes.F90 -! -! !DESCRIPTION: Subroutine getLandTypes converts the land types and leaf -! area indices from the land model to the LandTypeFrac and XLAI_NATIVE -! arrays in GEOS-Chem. -! -! !INTERFACE: -! - SUBROUTINE getLandTypes( cam_in, nY, State_Met ) -! -! !USES: -! - USE camsrfexch, ONLY : cam_in_t - USE State_Met_Mod, ONLY : MetState - USE shr_kind_mod, ONLY : r8 => shr_kind_r8 - USE PRECISION_MOD, ONLY : fp, f4 ! Flexible precision - USE CMN_SIZE_Mod, ONLY : NSURFTYPE - USE cam_abortutils, ONLY : endrun - - IMPLICIT NONE -! -! !INPUT PARAMETERS: -! - TYPE(cam_in_t), INTENT(IN ) :: cam_in ! CAM - INTEGER, INTENT(IN ) :: nY ! Number of grid cells on chunk -! -! !INPUT/OUTPUT PARAMETERS: -! - TYPE(MetState), INTENT(INOUT) :: State_Met -! -! !REVISION HISTORY: -! 8 May 2020 - Thibaud M. Fritz - Initial version -!EOP -!------------------------------------------------------------------------------ -!BOC -! -! !LOCAL VARIABLES: -! - INTEGER :: J, T - REAL(r8) :: waterFrac, landFrac - -#if defined( CLM40 ) - - ! Mapping for CLM4.0 - ! -----------------------------------|-------------------------------------- - ! Olson land type | CLM land type - ! -----------------------------------|-------------------------------------- - ! Inland/sea water (ID = 1) | Ocean fraction - ! | Deeplake & Shallowlake (LUID =3/4) - ! Urban (ID = 2) | Urban - Not Applied (LUID = 6) - ! Low Sparse Grassland (ID = 3) | - ! Coniferous Forest (ID = 4) | - ! Deciduous Conifer Forest (ID = 5) | Needleleaf Deciduous Bor. (PAID = 3) - ! Deciduous Broadleaf For. (ID = 6) | - ! Evergreen Broadleaf For. (ID = 7) | Broadleaf Evergreen Temp. (PAID = 5) - ! Tall Grasses and Shrubs (ID = 8) | - ! Bare Desert (ID = 9) | Not veg. \ Ice (PAID = 0\LUID = 2) - ! Upland Tundra (ID = 10) | Broadleaf Deciduous Bore. (PAID = 11) - ! Irrigated Grassland (ID = 11) | - ! Semi Desert (ID = 12) | - ! Glacier ice (ID = 13) | Land ice (LUID = 2) - ! Wooded Wet Swamp (ID = 14) | - ! - (ID = 15) | - ! - (ID = 16) | - ! Shrub Evergreen (ID = 17) | Broadleaf Evergreen Shru. (PAID = 9) - ! - (ID = 18) | - ! Shrub Deciduous (ID = 19) | - ! Evergreen Forest and Fi. (ID = 20) | - ! Cool Rain Forest (ID = 21) | - ! Conifer Boreal Forest (ID = 22) | Needleleaf Evergreen Bor. (PAID = 2) - ! Cool Conifer Forest (ID = 23) | - ! Cool Mixed Forest (ID = 24) | Broadleaf Deciduous Bore. (PAID = 8) - ! Mixed Forest (ID = 25) | - ! Cool Broadleaf Forest (ID = 26) | Broadleaf Deciduous Temp. (PAID = 7) - ! Deciduous Broadleaf For. (ID = 27) | - ! Conifer Forest (ID = 28) | Needleleaf Evergreen Tem. (PAID = 1) - ! Montane Tropical Forests (ID = 29) | - ! Seasonal Tropical Fores. (ID = 30) | - ! Cool Crops and Towns (ID = 31) | Winter Temp. Cereal (PAID = 19) - ! Crops and Town (ID = 32) | C3 Crop (PAID = 15) - ! | C3 Irrigated (PAID = 16) - ! | Spring Temp. Cereal (PAID = 18) - ! Dry Tropical Woods (ID = 33) | - ! Tropical Rainforest (ID = 34) | Broadleaf Evergreen Trop. (PAID = 4) - ! Tropical Degraded Forest (ID = 35) | - ! Corn and Beans Cropland (ID = 36) | Corn (PAID = 17) - ! | Soybean (PAID = 20) - ! Rice Paddy and Field (ID = 37) | - ! Hot Irrigated Cropland (ID = 38) | - ! Cool Irrigated Cropland (ID = 39) | - ! - (ID = 40) | - ! Cool Grasses and Shrubs (ID = 41) | - ! Hot and Mild Grasses and (ID = 42) | C3 Non-Arctic Grass (PAID = 13) - ! Cold Grassland (ID = 43) | C3 Arctic Grass (PAID = 12) - ! Savanna (Woods) (ID = 44) | Broadleaf Deciduous Trop. (PAID = 6) - ! | C4 Grass (PAID = 14) - ! Mire, Bog, Fen (ID = 45) | Wetland - Not Applied (LUID = 5) - ! Marsh Wetland (ID = 46) | - ! Mediterranean Scrub (ID = 47) | - ! Dry Woody Scrub (ID = 48) | Broadleaf Deciduous Temp. (PAID = 10) - ! - (ID = 49) | - ! - (ID = 50) | - ! - (ID = 51) | - ! Semi Desert Shrubs (ID = 52) | - ! Semi Desert Sage (ID = 53) | - ! Barren Tundra (ID = 54) | - ! Cool Southern Hemisphere (ID = 55) | - ! Cool Fields and Woods (ID = 56) | - ! Forest and Field (ID = 57) | - ! Cool Forest and Field (ID = 58) | - ! Fields and Woody Savanna (ID = 59) | - ! Succulent and Thorn Scr. (ID = 60) | - ! Small Leaf Mixed Woods (ID = 61) | - ! Deciduous and Mixed Bor. (ID = 62) | - ! Narrow Conifers (ID = 63) | - ! Wooded Tundra (ID = 64) | - ! Heath Scrub (ID = 65) | - ! - (ID = 66) | - ! - (ID = 67) | - ! - (ID = 68) | - ! - (ID = 69) | - ! Polar and Alpine Desert (ID = 70) | - ! - (ID = 71) | - ! - (ID = 72) | - ! Mangrove (ID = 73) | - - !================================================================== - ! The urban and wetland land unit types seem to be already - ! accounted for in patches, as it introduces total land fractions - ! (summed over all types) greater than 100%. - ! Thibaud M. Fritz - 06 May 2020 - !================================================================== - - DO J = 1, nY - waterFrac = cam_in%ocnFrac(J) + cam_in%iceFrac(J) & - + cam_in%lwtgcell(J,3) + cam_in%lwtgcell(J,4) - landFrac = 1.0e+0_fp - waterFrac - - ! Initialize fraction land for this grid cell - State_Met%LandTypeFrac(1,J, 1) = waterFrac - !State_Met%LandTypeFrac(1,J, 2) = cam_in%lwtgcell(J, 6) - State_Met%LandTypeFrac(1,J, 5) = cam_in%pwtgcell(J, 4) - State_Met%LandTypeFrac(1,J, 7) = cam_in%pwtgcell(J, 6) - State_Met%LandTypeFrac(1,J, 9) = cam_in%pwtgcell(J, 1) & - - cam_in%lwtgcell(J, 2) - State_Met%LandTypeFrac(1,J,10) = cam_in%pwtgcell(J,12) - State_Met%LandTypeFrac(1,J,13) = cam_in%lwtgcell(J, 2) - State_Met%LandTypeFrac(1,J,17) = cam_in%pwtgcell(J,10) - State_Met%LandTypeFrac(1,J,22) = cam_in%pwtgcell(J, 3) - State_Met%LandTypeFrac(1,J,24) = cam_in%pwtgcell(J, 9) - State_Met%LandTypeFrac(1,J,26) = cam_in%pwtgcell(J, 8) - State_Met%LandTypeFrac(1,J,28) = cam_in%pwtgcell(J, 2) - State_Met%LandTypeFrac(1,J,31) = cam_in%pwtgcell(J,20) - State_Met%LandTypeFrac(1,J,32) = cam_in%pwtgcell(J,16) & - + cam_in%pwtgcell(J,17) & - + cam_in%pwtgcell(J,19) - State_Met%LandTypeFrac(1,J,34) = cam_in%pwtgcell(J, 5) - State_Met%LandTypeFrac(1,J,36) = cam_in%pwtgcell(J,18) & - + cam_in%pwtgcell(J,21) - State_Met%LandTypeFrac(1,J,42) = cam_in%pwtgcell(J,14) - State_Met%LandTypeFrac(1,J,43) = cam_in%pwtgcell(J,13) - State_Met%LandTypeFrac(1,J,44) = cam_in%pwtgcell(J, 7) & - + cam_in%pwtgcell(J,15) - !State_Met%LandTypeFrac(1,J,45) = cam_in%lwtgcell(J, 5) - State_Met%LandTypeFrac(1,J,48) = cam_in%pwtgcell(J,11) - - State_Met%XLAI_NATIVE(1,J, 5) = cam_in%lai(J, 4) - State_Met%XLAI_NATIVE(1,J, 7) = cam_in%lai(J, 6) - State_Met%XLAI_NATIVE(1,J,10) = cam_in%lai(J,12) - State_Met%XLAI_NATIVE(1,J,17) = cam_in%lai(J,10) - State_Met%XLAI_NATIVE(1,J,22) = cam_in%lai(J, 3) - State_Met%XLAI_NATIVE(1,J,24) = cam_in%lai(J, 9) - State_Met%XLAI_NATIVE(1,J,26) = cam_in%lai(J, 8) - State_Met%XLAI_NATIVE(1,J,28) = cam_in%lai(J, 2) - State_Met%XLAI_NATIVE(1,J,31) = cam_in%lai(J,20) - State_Met%XLAI_NATIVE(1,J,32) = cam_in%lai(J,16) & - + cam_in%lai(J,17) & - + cam_in%lai(J,19) - State_Met%XLAI_NATIVE(1,J,34) = cam_in%lai(J, 5) - State_Met%XLAI_NATIVE(1,J,36) = cam_in%lai(J,18) & - + cam_in%lai(J,21) - State_Met%XLAI_NATIVE(1,J,42) = cam_in%lai(J,14) - State_Met%XLAI_NATIVE(1,J,43) = cam_in%lai(J,13) - State_Met%XLAI_NATIVE(1,J,44) = cam_in%lai(J, 7) & - + cam_in%lai(J,15) - State_Met%XLAI_NATIVE(1,J,48) = cam_in%lai(J,11) - - DO T = 2, NSURFTYPE - State_Met%LandTypeFrac(1,J,T) = & - State_Met%LandTypeFrac(1,J,T) * landFrac - - State_Met%XLAI_NATIVE(1,J,T) = & - State_Met%XLAI_NATIVE(1,J,T) * landFrac - - ! Make sure that the land type fractions do not exceed 1 - IF ( State_Met%LandTypeFrac(1,J,T) > 1.0e+0_fp ) THEN - State_Met%LandTypeFrac(1,J,T) = 1.0e+0_fp - ELSEIF ( State_Met%LandTypeFrac(1,J,T) < 0.0e+0_fp ) THEN - State_Met%LandTypeFrac(1,J,T) = 0.0e+0_fp - ENDIF - ENDDO - - ENDDO - -#elif defined( CLM45 ) || defined( CLM50 ) - - ! Mapping for CLM4.5/CLM5.0 - ! -----------------------------------|-------------------------------------- - ! Olson land type | CLM land type - ! -----------------------------------|-------------------------------------- - ! Inland/sea water (ID = 1) | Ocean fraction - ! | Deeplake (LUID = 5) - ! Urban (ID = 2) | Urban - Not Applied (LUID =7-9) - ! Low Sparse Grassland (ID = 3) | - ! Coniferous Forest (ID = 4) | - ! Deciduous Conifer Forest (ID = 5) | Needleleaf Deciduous Bor. (PAID = 3) - ! Deciduous Broadleaf For. (ID = 6) | - ! Evergreen Broadleaf For. (ID = 7) | Broadleaf Evergreen Temp. (PAID = 5) - ! Tall Grasses and Shrubs (ID = 8) | - ! Bare Desert (ID = 9) | Not veg. \ Ice (PAID = 0\LUID = 4) - ! Upland Tundra (ID = 10) | Broadleaf Deciduous Bore. (PAID = 11) - ! Irrigated Grassland (ID = 11) | - ! Semi Desert (ID = 12) | - ! Glacier ice (ID = 13) | Land ice (LUID = 4) - ! Wooded Wet Swamp (ID = 14) | - ! - (ID = 15) | - ! - (ID = 16) | - ! Shrub Evergreen (ID = 17) | Broadleaf Evergreen Shru. (PAID = 9) - ! - (ID = 18) | - ! Shrub Deciduous (ID = 19) | - ! Evergreen Forest and Fi. (ID = 20) | - ! Cool Rain Forest (ID = 21) | - ! Conifer Boreal Forest (ID = 22) | Needleleaf Evergreen Bor. (PAID = 2) - ! Cool Conifer Forest (ID = 23) | - ! Cool Mixed Forest (ID = 24) | Broadleaf Deciduous Bore. (PAID = 8) - ! Mixed Forest (ID = 25) | - ! Cool Broadleaf Forest (ID = 26) | Broadleaf Deciduous Temp. (PAID = 7) - ! Deciduous Broadleaf For. (ID = 27) | - ! Conifer Forest (ID = 28) | Needleleaf Evergreen Tem. (PAID = 1) - ! Montane Tropical Forests (ID = 29) | - ! Seasonal Tropical Fores. (ID = 30) | - ! Cool Crops and Towns (ID = 31) | - ! Crops and Town (ID = 32) | C3 Crop (PAID = 15) - ! | C3 Irrigated (PAID = 16) - ! Dry Tropical Woods (ID = 33) | - ! Tropical Rainforest (ID = 34) | Broadleaf Evergreen Trop. (PAID = 4) - ! Tropical Degraded Forest (ID = 35) | - ! Corn and Beans Cropland (ID = 36) | Corn (PAID = 17) - ! | Irrigated Temperate Corn (PAID = 18) - ! | Spring Wheat (PAID = 19) - ! | Irrigated Spring Wheat (PAID = 20) - ! | Winter Wheat (PAID = 21) - ! | Irrigated Winter Wheat (PAID = 22) - ! | Temperated Soybean (PAID = 23) - ! | Irrigated Temperate Soyb. (PAID = 24) - ! | Barley (PAID = 25) - ! | Irrigated Barley (PAID = 26) - ! | Winter Barley (PAID = 27) - ! | Irrigated Winter Barley (PAID = 28) - ! | Rye (PAID = 29) - ! | Irrigated Rye (PAID = 30) - ! | Winter Rye (PAID = 31) - ! | Irrigated Winter Rye (PAID = 32) - ! | Cassava (PAID = 33) - ! | Irrigated Cassava (PAID = 34) - ! | Citrus (PAID = 35) - ! | Irrigated Citrus (PAID = 36) - ! | Cocoa (PAID = 37) - ! | Irrigated Cocoa (PAID = 38) - ! | Coffee (PAID = 39) - ! | Irrigated Coffee (PAID = 40) - ! | Cotton (PAID = 41) - ! | Irrigated Cotton (PAID = 42) - ! | Datepalm (PAID = 43) - ! | Irrigated Datepalm (PAID = 44) - ! | Foddergrass (PAID = 45) - ! | Irrigated Foddergrass (PAID = 46) - ! | Grapes (PAID = 47) - ! | Irrigated Grapes (PAID = 48) - ! | Groundnuts (PAID = 49) - ! | Irrigated Groundnuts (PAID = 50) - ! | Millet (PAID = 51) - ! | Irrigated Millet (PAID = 52) - ! | Oilpalm (PAID = 53) - ! | Irrigated Oilpalm (PAID = 54) - ! | Potatoes (PAID = 55) - ! | Irrigated Potatoes (PAID = 56) - ! | Pulses (PAID = 57) - ! | Irrigated Pulses (PAID = 58) - ! | Rapeseed (PAID = 59) - ! | Irrigated Rapeseed (PAID = 60) - ! | Rice (PAID = 61) - ! | Irrigated Rice (PAID = 62) - ! | Sorghum (PAID = 63) - ! | Irrigated Sorghum (PAID = 64) - ! | Sugarbeet (PAID = 65) - ! | Irrigated Sugarbeet (PAID = 66) - ! | Sugarcane (PAID = 67) - ! | Irrigated Sugarcane (PAID = 68) - ! | Sunflower (PAID = 69) - ! | Irrigated Sunflower (PAID = 70) - ! | Miscanthus (PAID = 71) - ! | Irrigated Miscanthus (PAID = 72) - ! | Switchgrass (PAID = 73) - ! | Irrigated Switchgrass (PAID = 74) - ! | Tropical Corn (PAID = 75) - ! | Irrigated Tropical Corn (PAID = 76) - ! | Tropical Soybean (PAID = 77) - ! | Irrigated Tropical Soybe. (PAID = 78) - ! Rice Paddy and Field (ID = 37) | - ! Hot Irrigated Cropland (ID = 38) | - ! Cool Irrigated Cropland (ID = 39) | - ! - (ID = 40) | - ! Cool Grasses and Shrubs (ID = 41) | - ! Hot and Mild Grasses and (ID = 42) | C3 Non-Arctic Grass (PAID = 13) - ! Cold Grassland (ID = 43) | C3 Arctic Grass (PAID = 12) - ! Savanna (Woods) (ID = 44) | Broadleaf Deciduous Trop. (PAID = 6) - ! | C4 Grass (PAID = 14) - ! Mire, Bog, Fen (ID = 45) | Wetland - Not Applied (LUID = 6) - ! Marsh Wetland (ID = 46) | - ! Mediterranean Scrub (ID = 47) | - ! Dry Woody Scrub (ID = 48) | Broadleaf Deciduous Temp. (PAID = 10) - ! - (ID = 49) | - ! - (ID = 50) | - ! - (ID = 51) | - ! Semi Desert Shrubs (ID = 52) | - ! Semi Desert Sage (ID = 53) | - ! Barren Tundra (ID = 54) | - ! Cool Southern Hemisphere (ID = 55) | - ! Cool Fields and Woods (ID = 56) | - ! Forest and Field (ID = 57) | - ! Cool Forest and Field (ID = 58) | - ! Fields and Woody Savanna (ID = 59) | - ! Succulent and Thorn Scr. (ID = 60) | - ! Small Leaf Mixed Woods (ID = 61) | - ! Deciduous and Mixed Bor. (ID = 62) | - ! Narrow Conifers (ID = 63) | - ! Wooded Tundra (ID = 64) | - ! Heath Scrub (ID = 65) | - ! - (ID = 66) | - ! - (ID = 67) | - ! - (ID = 68) | - ! - (ID = 69) | - ! Polar and Alpine Desert (ID = 70) | - ! - (ID = 71) | - ! - (ID = 72) | - ! Mangrove (ID = 73) | - - State_Met%LandTypeFrac(:,:,:) = 0.0e+0_fp - State_Met%XLAI_NATIVE(:,:,:) = 0.0e+0_fp - - DO J = 1, nY - waterFrac = cam_in%ocnFrac(J) + cam_in%iceFrac(J) & - + cam_in%lwtgcell(J,5) - landFrac = 1.0e+0_fp - waterFrac - - ! Initialize fraction land for this grid cell - State_Met%LandTypeFrac(1,J, 1) = waterFrac - !State_Met%LandTypeFrac(1,J, 2) = cam_in%lwtgcell(J, 7) & - ! + cam_in%lwtgcell(J, 8) & - ! + cam_in%lwtgcell(J, 9) - State_Met%LandTypeFrac(1,J, 5) = cam_in%pwtgcell(J, 4) - State_Met%LandTypeFrac(1,J, 7) = cam_in%pwtgcell(J, 6) - State_Met%LandTypeFrac(1,J, 9) = cam_in%pwtgcell(J, 1) & - * ( 1.0e+0_fp - cam_in%lwtgcell(J, 4) ) - State_Met%LandTypeFrac(1,J,10) = cam_in%pwtgcell(J,12) - State_Met%LandTypeFrac(1,J,13) = cam_in%lwtgcell(J, 4) - State_Met%LandTypeFrac(1,J,17) = cam_in%pwtgcell(J,10) - State_Met%LandTypeFrac(1,J,22) = cam_in%pwtgcell(J, 3) - State_Met%LandTypeFrac(1,J,24) = cam_in%pwtgcell(J, 9) - State_Met%LandTypeFrac(1,J,26) = cam_in%pwtgcell(J, 8) - State_Met%LandTypeFrac(1,J,28) = cam_in%pwtgcell(J, 2) - State_Met%LandTypeFrac(1,J,32) = cam_in%pwtgcell(J,16) & - + cam_in%pwtgcell(J,17) - State_Met%LandTypeFrac(1,J,34) = cam_in%pwtgcell(J, 5) - State_Met%LandTypeFrac(1,J,36) = cam_in%pwtgcell(J,18) & - + cam_in%pwtgcell(J,19) & - + cam_in%pwtgcell(J,20) & - + cam_in%pwtgcell(J,21) & - + cam_in%pwtgcell(J,22) & - + cam_in%pwtgcell(J,23) & - + cam_in%pwtgcell(J,24) & - + cam_in%pwtgcell(J,25) & - + cam_in%pwtgcell(J,26) & - + cam_in%pwtgcell(J,27) & - + cam_in%pwtgcell(J,28) & - + cam_in%pwtgcell(J,29) & - + cam_in%pwtgcell(J,30) & - + cam_in%pwtgcell(J,31) & - + cam_in%pwtgcell(J,32) & - + cam_in%pwtgcell(J,33) & - + cam_in%pwtgcell(J,34) & - + cam_in%pwtgcell(J,35) & - + cam_in%pwtgcell(J,36) & - + cam_in%pwtgcell(J,37) & - + cam_in%pwtgcell(J,38) & - + cam_in%pwtgcell(J,39) & - + cam_in%pwtgcell(J,40) & - + cam_in%pwtgcell(J,41) & - + cam_in%pwtgcell(J,42) & - + cam_in%pwtgcell(J,43) & - + cam_in%pwtgcell(J,44) & - + cam_in%pwtgcell(J,45) & - + cam_in%pwtgcell(J,46) & - + cam_in%pwtgcell(J,47) & - + cam_in%pwtgcell(J,48) & - + cam_in%pwtgcell(J,49) & - + cam_in%pwtgcell(J,50) & - + cam_in%pwtgcell(J,51) & - + cam_in%pwtgcell(J,52) & - + cam_in%pwtgcell(J,53) & - + cam_in%pwtgcell(J,54) & - + cam_in%pwtgcell(J,55) & - + cam_in%pwtgcell(J,56) & - + cam_in%pwtgcell(J,57) & - + cam_in%pwtgcell(J,58) & - + cam_in%pwtgcell(J,59) & - + cam_in%pwtgcell(J,60) & - + cam_in%pwtgcell(J,61) & - + cam_in%pwtgcell(J,62) & - + cam_in%pwtgcell(J,63) & - + cam_in%pwtgcell(J,64) & - + cam_in%pwtgcell(J,65) & - + cam_in%pwtgcell(J,66) & - + cam_in%pwtgcell(J,67) & - + cam_in%pwtgcell(J,68) & - + cam_in%pwtgcell(J,69) & - + cam_in%pwtgcell(J,70) & - + cam_in%pwtgcell(J,71) & - + cam_in%pwtgcell(J,72) & - + cam_in%pwtgcell(J,73) & - + cam_in%pwtgcell(J,74) & - + cam_in%pwtgcell(J,75) & - + cam_in%pwtgcell(J,76) & - + cam_in%pwtgcell(J,77) & - + cam_in%pwtgcell(J,78) & - + cam_in%pwtgcell(J,79) - State_Met%LandTypeFrac(1,J,42) = cam_in%pwtgcell(J,14) - State_Met%LandTypeFrac(1,J,43) = cam_in%pwtgcell(J,13) - State_Met%LandTypeFrac(1,J,44) = cam_in%pwtgcell(J, 7) & - + cam_in%pwtgcell(J,15) - !State_Met%LandTypeFrac(1,J,45) = cam_in%lwtgcell(J, 6) - State_Met%LandTypeFrac(1,J,48) = cam_in%pwtgcell(J,11) - - State_Met%XLAI_NATIVE(1,J, 5) = cam_in%lai(J, 4) - State_Met%XLAI_NATIVE(1,J, 7) = cam_in%lai(J, 6) - State_Met%XLAI_NATIVE(1,J,10) = cam_in%lai(J,12) - State_Met%XLAI_NATIVE(1,J,17) = cam_in%lai(J,10) - State_Met%XLAI_NATIVE(1,J,22) = cam_in%lai(J, 3) - State_Met%XLAI_NATIVE(1,J,24) = cam_in%lai(J, 9) - State_Met%XLAI_NATIVE(1,J,26) = cam_in%lai(J, 8) - State_Met%XLAI_NATIVE(1,J,28) = cam_in%lai(J, 2) - State_Met%XLAI_NATIVE(1,J,32) = cam_in%lai(J,16) & - + cam_in%lai(J,17) - State_Met%XLAI_NATIVE(1,J,34) = cam_in%lai(J, 5) - State_Met%XLAI_NATIVE(1,J,36) = cam_in%lai(J,18) & - + cam_in%lai(J,19) & - + cam_in%lai(J,20) & - + cam_in%lai(J,21) & - + cam_in%lai(J,22) & - + cam_in%lai(J,23) & - + cam_in%lai(J,24) & - + cam_in%lai(J,25) & - + cam_in%lai(J,26) & - + cam_in%lai(J,27) & - + cam_in%lai(J,28) & - + cam_in%lai(J,29) & - + cam_in%lai(J,30) & - + cam_in%lai(J,31) & - + cam_in%lai(J,32) & - + cam_in%lai(J,33) & - + cam_in%lai(J,34) & - + cam_in%lai(J,35) & - + cam_in%lai(J,36) & - + cam_in%lai(J,37) & - + cam_in%lai(J,38) & - + cam_in%lai(J,39) & - + cam_in%lai(J,40) & - + cam_in%lai(J,41) & - + cam_in%lai(J,42) & - + cam_in%lai(J,43) & - + cam_in%lai(J,44) & - + cam_in%lai(J,45) & - + cam_in%lai(J,46) & - + cam_in%lai(J,47) & - + cam_in%lai(J,48) & - + cam_in%lai(J,49) & - + cam_in%lai(J,50) & - + cam_in%lai(J,51) & - + cam_in%lai(J,52) & - + cam_in%lai(J,53) & - + cam_in%lai(J,54) & - + cam_in%lai(J,55) & - + cam_in%lai(J,56) & - + cam_in%lai(J,57) & - + cam_in%lai(J,58) & - + cam_in%lai(J,59) & - + cam_in%lai(J,60) & - + cam_in%lai(J,61) & - + cam_in%lai(J,62) & - + cam_in%lai(J,63) & - + cam_in%lai(J,64) & - + cam_in%lai(J,65) & - + cam_in%lai(J,66) & - + cam_in%lai(J,67) & - + cam_in%lai(J,68) & - + cam_in%lai(J,69) & - + cam_in%lai(J,70) & - + cam_in%lai(J,71) & - + cam_in%lai(J,72) & - + cam_in%lai(J,73) & - + cam_in%lai(J,74) & - + cam_in%lai(J,75) & - + cam_in%lai(J,76) & - + cam_in%lai(J,77) & - + cam_in%lai(J,78) & - + cam_in%lai(J,79) - State_Met%XLAI_NATIVE(1,J,42) = cam_in%lai(J,14) - State_Met%XLAI_NATIVE(1,J,43) = cam_in%lai(J,13) - State_Met%XLAI_NATIVE(1,J,44) = cam_in%lai(J, 7) & - + cam_in%lai(J,15) - State_Met%XLAI_NATIVE(1,J,48) = cam_in%lai(J,11) - - DO T = 2, NSURFTYPE - State_Met%LandTypeFrac(1,J,T) = & - State_Met%LandTypeFrac(1,J,T) * landFrac - - State_Met%XLAI_NATIVE(1,J,T) = & - State_Met%XLAI_NATIVE(1,J,T) * landFrac - - ! Make sure that the land type fractions do not exceed 1 - IF ( State_Met%LandTypeFrac(1,J,T) > 1.0e+0_fp ) THEN - State_Met%LandTypeFrac(1,J,T) = 1.0e+0_fp - ELSEIF ( State_Met%LandTypeFrac(1,J,T) < 0.0e+0_fp ) THEN - State_Met%LandTypeFrac(1,J,T) = 0.0e+0_fp - ENDIF - ENDDO - - ENDDO - -#else - CALL endrun('Cannot figure out which version of CLM') -#endif - - END SUBROUTINE getLandTypes -!EOC From 0458ae6f8a45caad2edef034a742ef90893b0fae Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 4 Jan 2023 12:41:26 -0700 Subject: [PATCH 082/160] Modify mozart module mo_neu_wetdep for use when GEOS-Chem chemistry enabled Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/mo_neu_wetdep.F90 | 1815 ---------------------- src/chemistry/mozart/mo_neu_wetdep.F90 | 6 +- 2 files changed, 5 insertions(+), 1816 deletions(-) delete mode 100644 src/chemistry/geoschem/mo_neu_wetdep.F90 diff --git a/src/chemistry/geoschem/mo_neu_wetdep.F90 b/src/chemistry/geoschem/mo_neu_wetdep.F90 deleted file mode 100644 index a168010729..0000000000 --- a/src/chemistry/geoschem/mo_neu_wetdep.F90 +++ /dev/null @@ -1,1815 +0,0 @@ -! -! code written by J.-F. Lamarque, S. Walters and F. Vitt -! based on the original code from J. Neu developed for UC Irvine -! model -! -! LKE 2/23/2018 - correct setting flag for mass-limited (HNO3,etc.) vs Henry's Law washout -! -module mo_neu_wetdep -! - use shr_kind_mod, only : r8 => shr_kind_r8 - use cam_logfile, only : iulog - use constituents, only : pcnst - use spmd_utils, only : masterproc - use cam_abortutils, only : endrun - use shr_drydep_mod, only : n_species_table, species_name_table, dheff - use gas_wetdep_opts, only : gas_wetdep_method, gas_wetdep_list, gas_wetdep_cnt -! - implicit none -! - private - public :: neu_wetdep_init - public :: neu_wetdep_tend -! - save -! - integer, allocatable, dimension(:) :: mapping_to_heff,mapping_to_mmr - real(r8),allocatable, dimension(:) :: mol_weight - logical ,allocatable, dimension(:) :: ice_uptake - integer :: index_cldice,index_cldliq,nh3_ndx,co2_ndx - logical :: debug = .false. - integer :: hno3_ndx = 0 - integer :: h2o2_ndx = 0 -! -! diagnostics -! - logical :: do_diag = .false. - integer, parameter :: kdiag = 18 -! - real(r8), parameter :: zero = 0._r8 - real(r8), parameter :: one = 1._r8 -! - logical :: do_neu_wetdep -! - real(r8), parameter :: TICE=263._r8 - -contains - -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -! -subroutine neu_wetdep_init -! - use constituents, only : cnst_get_ind,cnst_mw - use cam_history, only : addfld, add_default, horiz_only - use phys_control, only : phys_getopts -! - integer :: m,l - character*20 :: test_name - - logical :: history_chemistry - - call phys_getopts(history_chemistry_out=history_chemistry) - - do_neu_wetdep = gas_wetdep_method == 'NEU' .and. gas_wetdep_cnt>0 - - if (.not.do_neu_wetdep) return - - allocate( mapping_to_heff(gas_wetdep_cnt) ) - allocate( mapping_to_mmr(gas_wetdep_cnt) ) - allocate( ice_uptake(gas_wetdep_cnt) ) - allocate( mol_weight(gas_wetdep_cnt) ) - -! -! find mapping to heff table -! - if ( debug .and. masterproc ) then - print '(a,i4)','neu_wetdep_init: gas_wetdep_cnt=',gas_wetdep_cnt - print '(a,i4)','neu_wetdep_init: n_species_table=',n_species_table - end if - mapping_to_heff = -99 - do m=1,gas_wetdep_cnt -! - test_name = gas_wetdep_list(m) - if ( debug .and. masterproc ) print '(a,i4,a,a)','neu_wetdep_init: gas_wetdep_list species ',m,' ',trim(test_name) -! -! ewl: this mapping can be replaced by including Henry's Law etc for all species, which makes usage of -! the parameters more transparent. I will comment out.... -!!!! -!!!! mapping based on the MOZART4 wet removal subroutine; -!!!! this might need to be redone (JFL: Sep 2010) -!!!! -!!! select case( trim(test_name) ) -!!!! -!!!! CCMI: added SO2t and NH_50W -!!!! -!!! case( 'HYAC', 'CH3COOH' , 'HCOOH', 'EOOH', 'IEPOX' ) -!!! test_name = 'CH2O' -!!! case ( 'SOGB','SOGI','SOGM','SOGT','SOGX' ) -!!! test_name = 'H2O2' -!!! case ( 'SO2t' ) -!!! test_name = 'SO2' -!!! case ( 'CLONO2','BRONO2','HCL','HOCL','HOBR','HBR', 'Pb', 'MACROOH', 'ISOPOOH', 'XOOH', 'H2SO4', 'HF', 'COF2', 'COFCL') -!!! test_name = 'HNO3' -!!! case ( 'NH_50W', 'NDEP', 'NHDEP', 'NH4NO3' ) -!!! test_name = 'HNO3' -!!! case ( 'ALKOOH', 'MEKOOH', 'TOLOOH' ) -!!! test_name = 'CH3OOH' -!!! case( 'PHENOOH', 'BENZOOH', 'C6H5OOH', 'BZOOH', 'XYLOLOOH', 'XYLENOOH', 'HPALD' ) -!!! test_name = 'CH3OOH' -!!! case( 'TERPOOH', 'TERP2OOH', 'MBOOOH' ) -!!! test_name = 'HNO3' -!!! case( 'TERPROD1', 'TERPROD2' ) -!!! test_name = 'CH2O' -!!! case( 'HMPROP' ) -!!! test_name = 'GLYALD' -!!! case( 'NOA', 'ALKNIT', 'ISOPNITA', 'ISOPNITB', 'HONITR', 'ISOPNOOH' ) -!!! test_name = 'H2O2' -!!! case( 'NC4CHO', 'NC4CH2OH', 'TERPNIT', 'NTERPOOH' ) -!!! test_name = 'H2O2' -!!! case( 'SOAGbb0' ) ! Henry's Law coeff. added for VBS SOA's, biomass burning is the same as fossil fuels -!!! test_name = 'SOAGff0' -!!! case( 'SOAGbb1' ) -!!! test_name = 'SOAGff1' -!!! case( 'SOAGbb2' ) -!!! test_name = 'SOAGff2' -!!! case( 'SOAGbb3' ) -!!! test_name = 'SOAGff3' -!!! case( 'SOAGbb4' ) -!!! test_name = 'SOAGff4' -!!! case( 'H2O2' ) -!!! test_name = 'GC_H2O2' -!!! case( 'HCHO' ) -!!! test_name = 'GC_CH2O' -!!! case( 'CH2O' ) -!!! test_name = 'GC_CH2O' -!!! case( 'NO2' ) -!!! test_name = 'GC_NO2' -!!! !case( 'HNO3' ) -!!! ! test_name = 'GC_HNO3' -!!! case( 'NH3' ) -!!! test_name = 'GC_NH3' -!!! case( 'N2O5' ) -!!! test_name = 'GC_N2O5' -!!! case( 'PAN' ) -!!! test_name = 'GC_PAN' -!!! !case( 'SO2' ) -!!! ! test_name = 'GC_SO2' -!!! ! Now list all non-MAM GEOS-Chem aerosols. These will be scavenged similarly -!!! ! to HNO3 -!!! case( 'AERI', 'BRSALA', 'BRSALC', 'INDIOL', & -!!! 'IONITA', 'ISALA', 'ISALC', 'LVOCOA', 'MONITA', & -!!! 'MSA', 'NH4', 'NIT', 'NITS', 'PFE', & -!!! 'SALAAL', 'SALACL', 'SALCAL', 'SALCCL', 'SO4S', & -!!! 'SOAS', 'SOAGX', 'SOAIE', 'TSOA0', 'TSOA1', & -!!! 'TSOA2', 'TSOA3', 'ASOAN', 'ASOA1', 'ASOA2', & -!!! 'ASOA3' ) -!!! test_name = 'HNO3' -!!! case( 'ASOG1', 'ASOG2', 'ASOG3' ) -!!! test_name = 'ASOG' -!!! case( 'TSOG0', 'TSOG1', 'TSOG2', 'TSOG3' ) -!!! test_name = 'TSOG' -!!! end select -! - if ( debug .and. masterproc ) print '(a,i4,a)','neu_wetdep_init: using name for mapping: ',m,trim(test_name) -! - do l = 1,n_species_table - if( trim(test_name) == trim( species_name_table(l) ) ) then - mapping_to_heff(m) = l - if ( debug .and. masterproc ) print '(a,a,i4)','neu_wetdep_init: found mapping to heff of ',trim(species_name_table(l)),l - exit - end if - end do - if ( mapping_to_heff(m) == -99 ) then - print '(a,a)','neu_wetdep_init: ERROR: Ending run because mapping to species heff not found for ',trim(test_name) - call endrun() - end if -! -! special cases for NH3 and CO2 -! - if ( trim(test_name) == 'NH3' ) then - nh3_ndx = m - end if - if ( trim(test_name) == 'CO2' ) then - co2_ndx = m - end if - if ( trim(gas_wetdep_list(m)) == 'HNO3' ) then - hno3_ndx = m - end if -! - end do - - if (any ( mapping_to_heff(:) == -99 )) call endrun('mo_neu_wet->depwetdep_init: unmapped species error' ) -! - if ( debug .and. masterproc ) then - print '(a,i4)','neu_wetdep_init: co2_ndx',co2_ndx - print '(a,i4)','neu_wetdep_init: nh3_ndx',nh3_ndx - end if -! -! find mapping to species -! - mapping_to_mmr = -99 - do m=1,gas_wetdep_cnt - if ( debug .and. masterproc ) print '(a,i4,a)','neu_wetdep_init: ',m,trim(gas_wetdep_list(m)) - call cnst_get_ind(gas_wetdep_list(m), mapping_to_mmr(m), abort=.false. ) - if ( debug .and. masterproc) print '(a,i4)','neu_wetdep_init: mapping_to_mmr ',mapping_to_mmr(m) - if ( mapping_to_mmr(m) <= 0 ) then - print *,'neu_wetdep_init: problem with mapping_to_mmr of ',gas_wetdep_list(m) - call endrun('problem with mapping_to_mmr of '//trim(gas_wetdep_list(m))) - end if - end do -! -! define species-dependent arrays -! - do m=1,gas_wetdep_cnt -! - mol_weight(m) = cnst_mw(mapping_to_mmr(m)) - if ( debug .and. masterproc ) print '(a,i4,a,f8.4)','neu_wetdep_init: ',m,' mol_weight ',mol_weight(m) - ice_uptake(m) = .false. - if ( trim(gas_wetdep_list(m)) == 'HNO3' ) then - ice_uptake(m) = .true. - end if -! -! - end do -! -! indices for cloud quantities -! - call cnst_get_ind( 'CLDICE', index_cldice ) - call cnst_get_ind( 'CLDLIQ', index_cldliq ) -! -! define output -! - do m=1,gas_wetdep_cnt - call addfld ('DTWR_'//trim(gas_wetdep_list(m)),(/ 'lev' /), 'A','kg/kg/s','wet removal Neu scheme tendency') - call addfld ('WD_'//trim(gas_wetdep_list(m)),horiz_only, 'A','kg/m2/s','vertical integrated wet deposition flux') - call addfld ('HEFF_'//trim(gas_wetdep_list(m)),(/ 'lev' /), 'A','M/atm','Effective Henrys Law coeff.') - !call add_default('DTWR_'//trim(gas_wetdep_list(m)), 2, ' ') - !call add_default('WD_'//trim(gas_wetdep_list(m)), 2, ' ') - !call add_default('HEFF_'//trim(gas_wetdep_list(m)), 2, ' ') - if (history_chemistry) then - call add_default('DTWR_'//trim(gas_wetdep_list(m)), 1, ' ') - call add_default('WD_'//trim(gas_wetdep_list(m)), 1, ' ') - end if - end do -! - if ( do_diag ) then - call addfld ('QT_RAIN_HNO3',(/ 'lev' /), 'A','mol/mol/s','wet removal Neu scheme rain tendency') - call addfld ('QT_RIME_HNO3',(/ 'lev' /), 'A','mol/mol/s','wet removal Neu scheme rain tendency') - call addfld ('QT_WASH_HNO3',(/ 'lev' /), 'A','mol/mol/s','wet removal Neu scheme rain tendency') - call addfld ('QT_EVAP_HNO3',(/ 'lev' /), 'A','mol/mol/s','wet removal Neu scheme rain tendency') - if (history_chemistry) then - call add_default('QT_RAIN_HNO3',1,' ') - call add_default('QT_RIME_HNO3',1,' ') - call add_default('QT_WASH_HNO3',1,' ') - call add_default('QT_EVAP_HNO3',1,' ') - end if - end if -! - return -! -end subroutine neu_wetdep_init -! -subroutine neu_wetdep_tend(lchnk,ncol,mmr,pmid,pdel,zint,tfld,delt, & - prain, nevapr, cld, cmfdqr, wd_tend, wd_tend_int) -! - use ppgrid, only : pcols, pver - use phys_grid, only : get_area_all_p, get_rlat_all_p - use shr_const_mod, only : SHR_CONST_REARTH,SHR_CONST_G - use shr_const_mod, only : pi => shr_const_pi - use cam_history, only : outfld -! - implicit none -! - integer, intent(in) :: lchnk,ncol - real(r8), intent(in) :: mmr(pcols,pver,pcnst) ! mass mixing ratio (kg/kg) - real(r8), intent(in) :: pmid(pcols,pver) ! midpoint pressures (Pa) - real(r8), intent(in) :: pdel(pcols,pver) ! pressure delta about midpoints (Pa) - real(r8), intent(in) :: zint(pcols,pver+1) ! interface geopotential height above the surface (m) - real(r8), intent(in) :: tfld(pcols,pver) ! midpoint temperature (K) - real(r8), intent(in) :: delt ! timestep (s) -! - real(r8), intent(in) :: prain(ncol, pver) - real(r8), intent(in) :: nevapr(ncol, pver) - real(r8), intent(in) :: cld(ncol, pver) - real(r8), intent(in) :: cmfdqr(ncol, pver) - real(r8), intent(inout) :: wd_tend(pcols,pver,pcnst) - real(r8), intent(inout) :: wd_tend_int(pcols,pcnst) -! -! local arrays and variables -! - integer :: i,k,l,kk,m - real(r8), parameter :: rearth = SHR_CONST_REARTH ! radius earth (m) - real(r8), parameter :: gravit = SHR_CONST_G ! m/s^2 - real(r8), dimension(ncol) :: area, wk_out - real(r8), dimension(ncol,pver) :: cldice,cldliq,cldfrc,totprec,totevap,delz,delp,p - real(r8), dimension(ncol,pver) :: rls,evaprate,mass_in_layer,temp - real(r8), dimension(ncol,pver,gas_wetdep_cnt) :: trc_mass,heff,dtwr - real(r8), dimension(ncol,pver,gas_wetdep_cnt) :: wd_mmr - logical , dimension(gas_wetdep_cnt) :: tckaqb - integer , dimension(ncol) :: test_flag -! -! arrays for HNO3 diagnostics -! - real(r8), dimension(ncol,pver) :: qt_rain,qt_rime,qt_wash,qt_evap -! -! for Henry's law calculations -! - real(r8), parameter :: t0 = 298._r8 - real(r8), parameter :: ph = 1.e-5_r8 - real(r8), parameter :: ph_inv = 1._r8/ph - real(r8) :: e298, dhr - real(r8), dimension(ncol) :: dk1s,dk2s,wrk - real(r8) :: lats(pcols) - - real(r8), parameter :: rad2deg = 180._r8/pi - -! -! from cam/src/physics/cam/stratiform.F90 -! - - if (.not.do_neu_wetdep) return -! -! don't do anything if there are no species to be removed -! - if ( gas_wetdep_cnt == 0 ) return -! -! reset output variables -! - wd_tend_int = 0._r8 -! -! get area (in radians square) -! - call get_area_all_p(lchnk, ncol, area) - area = area * rearth**2 ! in m^2 -! -! reverse order along the vertical before calling -! J. Neu's wet removal subroutine -! - do k=1,pver - kk = pver - k + 1 - do i=1,ncol -! - mass_in_layer(i,k) = area(i) * pdel(i,kk)/gravit ! kg -! - cldice (i,k) = mmr(i,kk,index_cldice) ! kg/kg - cldliq (i,k) = mmr(i,kk,index_cldliq) ! kg/kg - cldfrc (i,k) = cld(i,kk) ! unitless -! - totprec(i,k) = (prain(i,kk)+cmfdqr(i,kk)) & - * mass_in_layer(i,k) ! kg/s - totevap(i,k) = nevapr(i,kk) * mass_in_layer(i,k) ! kg/s -! - delz(i,k) = zint(i,kk) - zint(i,kk+1) ! in m -! - temp(i,k) = tfld(i,kk) -! -! convert tracer mass to kg to kg/kg -! - trc_mass(i,k,:) = mmr(i,kk,mapping_to_mmr(:)) * mass_in_layer(i,k) -! - delp(i,k) = pdel(i,kk) * 0.01_r8 ! in hPa - p (i,k) = pmid(i,kk) * 0.01_r8 ! in hPa -! - end do - end do -! -! define array for tendency calculation (on model grid) -! - dtwr(1:ncol,:,:) = mmr(1:ncol,:,mapping_to_mmr(:)) -! -! compute 1) integrated precipitation flux across the interfaces (rls) -! 2) evaporation rate -! - rls (:,pver) = 0._r8 - evaprate (:,pver) = 0._r8 - do k=pver-1,1,-1 - rls (:,k) = max(0._r8,totprec(:,k)-totevap(:,k)+rls(:,k+1)) - !evaprate(:,k) = min(1._r8,totevap(:,k)/(rls(:,k+1)+totprec(:,k)+1.e-36_r8)) - evaprate(:,k) = min(1._r8,totevap(:,k)/(rls(:,k+1)+1.e-36_r8)) - end do -! -! compute effective Henry's law coefficients -! - heff = 0._r8 - do k=1,pver -! - kk = pver - k + 1 -! - wrk(:) = (t0-tfld(1:ncol,kk))/(t0*tfld(1:ncol,kk)) -! - do m=1,gas_wetdep_cnt -! - l = mapping_to_heff(m) - e298 = dheff(1,l) - dhr = dheff(2,l) - heff(:,k,m) = e298*exp( dhr*wrk(:) ) - test_flag = -99 - if( dheff(3,l) /= 0._r8 .and. dheff(5,l) == 0._r8 ) then - e298 = dheff(3,l) - dhr = dheff(4,l) - dk1s(:) = e298*exp( dhr*wrk(:) ) - where( heff(:,k,m) /= 0._r8 ) - heff(:,k,m) = heff(:,k,m)*(1._r8 + dk1s(:)*ph_inv) - elsewhere - test_flag = 1 - heff(:,k,m) = dk1s(:)*ph_inv - endwhere - end if -! - if (k.eq.1 .and. maxval(test_flag) > 0 .and. debug .and. masterproc) print '(a,i4)','neu_wetdep_tend: heff for m=',m -! - if( dheff(5,l) /= 0._r8 ) then - if( nh3_ndx > 0 .or. co2_ndx > 0 ) then - e298 = dheff(3,l) - dhr = dheff(4,l) - dk1s(:) = e298*exp( dhr*wrk(:) ) - e298 = dheff(5,l) - dhr = dheff(6,l) - dk2s(:) = e298*exp( dhr*wrk(:) ) - if( m == co2_ndx ) then - heff(:,k,m) = heff(:,k,m)*(1._r8 + dk1s(:)*ph_inv)*(1._r8 + dk2s(:)*ph_inv) - else if( m == nh3_ndx ) then - heff(:,k,m) = heff(:,k,m)*(1._r8 + dk1s(:)*ph/dk2s(:)) - else - write(iulog,*) 'error in assigning henrys law coefficients' - write(iulog,*) 'species ',m - end if - end if - end if -! - end do - end do -! - if ( debug .and. masterproc ) then - print '(a)','neu_wetdep_tend: ' - do m=1,gas_wetdep_cnt - print '(a,a)','wetdep species name: ',trim(gas_wetdep_list(m)) - l = mapping_to_heff(m) - print '(a,50e12.4)','dheff(1,l): ', dheff(1,l) - print '(a,50e12.4)','dheff(1,l): ', dheff(2,l) - print '(a,50e12.4)','dheff(1,l): ', dheff(3,l) - print '(a,50e12.4)','dheff(1,l): ', dheff(4,l) - print '(a,50e12.4)','dheff(1,l): ', dheff(5,l) - print '(a,50e12.4)','dheff(1,l): ', dheff(6,l) - print '(a,50f8.2)','tckaqb ',tckaqb(m) - print '(a,50e12.4)','heff ',heff(1,1,m) - print '(a,50i4)' ,'ice_uptake ',ice_uptake(m) - print '(a,50f8.2)','mol_weight ',mol_weight(m) - print '(a,50f8.2)','temp ',temp(1,m) - print '(a,50f8.2)','p ',p (1,m) - enddo - end if -! -! call J. Neu's subroutine -! - do i=1,ncol -! - call washo(pver,gas_wetdep_cnt,delt,trc_mass(i,:,:),mass_in_layer(i,:),p(i,:),delz(i,:) & - ,rls(i,:),cldliq(i,:),cldice(i,:),cldfrc(i,:),temp(i,:),evaprate(i,:) & - ,area(i),heff(i,:,:),mol_weight(:),tckaqb(:),ice_uptake(:) & - ,qt_rain(i,:),qt_rime(i,:),qt_wash(i,:),qt_evap(i,:) ) -! - end do -! -! compute tendencies and convert back to mmr -! on original vertical grid -! - do k=1,pver - kk = pver - k + 1 - do i=1,ncol -! -! convert tracer mass from kg -! - wd_mmr(i,kk,:) = trc_mass(i,k,:) / mass_in_layer(i,k) -! - end do - end do -! -! tendency calculation (on model grid) -! - dtwr(1:ncol,:,:) = wd_mmr(1:ncol,:,:) - dtwr(1:ncol,:,:) - dtwr(1:ncol,:,:) = dtwr(1:ncol,:,:) / delt - -! polarward of 60S, 60N and <200hPa set to zero! - call get_rlat_all_p(lchnk, pcols, lats ) - do k = 1, pver - do i= 1, ncol - if ( abs( lats(i)*rad2deg ) > 60._r8 ) then - if ( pmid(i,k) < 20000._r8) then - dtwr(i,k,:) = 0._r8 - endif - endif - end do - end do -! -! output tendencies -! - do m=1,gas_wetdep_cnt - wd_tend(1:ncol,:,mapping_to_mmr(m)) = wd_tend(1:ncol,:,mapping_to_mmr(m)) + dtwr(1:ncol,:,m) - call outfld( 'DTWR_'//trim(gas_wetdep_list(m)),dtwr(:,:,m),ncol,lchnk ) - - call outfld( 'HEFF_'//trim(gas_wetdep_list(m)),heff(:,pver:1:-1,m),ncol,lchnk ) -! -! vertical integrated wet deposition rate [kg/m2/s] -! - wk_out = 0._r8 - do k=1,pver - kk = pver - k + 1 - wk_out(1:ncol) = wk_out(1:ncol) + (dtwr(1:ncol,k,m) * mass_in_layer(1:ncol,kk)/area(1:ncol)) - end do - call outfld( 'WD_'//trim(gas_wetdep_list(m)),wk_out,ncol,lchnk ) -! -! to be used in mo_chm_diags to compute wet_deposition_NOy_as_N and wet_deposition_NHx_as_N (units: kg/m2/s) -! - if ( debug .and. masterproc ) print *,'neu_wetdep_tend: ',mapping_to_mmr(m),(wk_out(1:ncol)) - wd_tend_int(1:ncol,mapping_to_mmr(m)) = wk_out(1:ncol) -! - end do -! - if ( do_diag ) then - call outfld('QT_RAIN_HNO3', qt_rain, ncol, lchnk ) - call outfld('QT_RIME_HNO3', qt_rime, ncol, lchnk ) - call outfld('QT_WASH_HNO3', qt_wash, ncol, lchnk ) - call outfld('QT_EVAP_HNO3', qt_evap, ncol, lchnk ) - end if -! - return -end subroutine neu_wetdep_tend - -!----------------------------------------------------------------------- -! -! Original code from Jessica Neu -! Updated by S. Walters and J.-F. Lamarque (March-April 2011) -! -!----------------------------------------------------------------------- - - subroutine WASHO(LPAR,NTRACE,DTSCAV,QTTJFL,QM,POFL,DELZ, & - RLS,CLWC,CIWC,CFR,TEM,EVAPRATE,GAREA,HSTAR,TCMASS,TCKAQB, & - TCNION, qt_rain, qt_rime, qt_wash, qt_evap) -! - implicit none - -!----------------------------------------------------------------------- -!---p-conde 5.4 (2007) -----called from main----- -!---called from pmain to calculate rainout and washout of tracers -!---revised by JNEU 8/2007 -!--- -!-LAER has been removed - no scavenging for aerosols -!-LAER could be used as LWASHTYP -!---WILL THIS WORK FOR T42->T21??????????? -!----------------------------------------------------------------------- - - integer LPAR, NTRACE - real(r8), intent(inout) :: QTTJFL(LPAR,NTRACE) - real(r8), intent(in) :: DTSCAV, QM(LPAR),POFL(LPAR),DELZ(LPAR),GAREA - real(r8), intent(in) :: RLS(LPAR),CLWC(LPAR),CIWC(LPAR),CFR(LPAR),TEM(LPAR), & - EVAPRATE(LPAR) - real(r8), intent(in) :: HSTAR(LPAR,NTRACE),TCMASS(NTRACE) - logical , intent(in) :: TCKAQB(NTRACE),TCNION(NTRACE) -! - real(r8), intent(inout) :: qt_rain(lpar) - real(r8), intent(inout) :: qt_rime(lpar) - real(r8), intent(inout) :: qt_wash(lpar) - real(r8), intent(inout) :: qt_evap(lpar) -! - integer I,J,L,N,LE, LM1 - real(r8), dimension(LPAR) :: CFXX - real(r8), dimension(LPAR) :: QTT, QTTNEW - - real(r8) WRK, RNEW_TST - real(r8) CLWX - real(r8) RNEW,RPRECIP,DELTARIMEMASS,DELTARIME,RAMPCT - real(r8) MASSLOSS - real(r8) DOR,DNEW,DEMP,COLEFFSNOW,RHOSNOW - real(r8) WEMP,REMP,RRAIN,RWASH - real(r8) QTPRECIP,QTRAIN,QTCXA,QTAX,QTOC - - real(r8) FAMA,RAMA,DAMA,FCA,RCA,DCA - real(r8) FAX,RAX,DAX,FCXA,RCXA,DCXA,FCXB,RCXB,DCXB - real(r8) RAXADJ,FAXADJ,RAXADJF - real(r8) QTDISCF,QTDISRIME,QTDISCXA - real(r8) QTEVAPAXP,QTEVAPAXW,QTEVAPAX - real(r8) QTWASHAX - real(r8) QTEVAPCXAP,QTEVAPCXAW,QTEVAPCXA - real(r8) QTWASHCXA,QTRIMECXA - real(r8) QTRAINCXA,QTRAINCXB - real(r8) QTTOPCA,QTTOPAA,QTTOPCAX,QTTOPAAX - - real(r8) AMPCT,AMCLPCT,CLNEWPCT,CLNEWAMPCT,CLOLDPCT,CLOLDAMPCT - real(r8) RAXLOC,RCXALOC,RCXBLOC,RCALOC,RAMALOC,RCXPCT - - real(r8) QTNETLCXA,QTNETLCXB,QTNETLAX,QTNETL - real(r8) QTDISSTAR - - - real(r8), parameter :: CFMIN=0.1_r8 - real(r8), parameter :: CWMIN=1.0e-5_r8 - real(r8), parameter :: DMIN=1.0e-1_r8 !mm - real(r8), parameter :: VOLPOW=1._r8/3._r8 - real(r8), parameter :: RHORAIN=1.0e3_r8 !kg/m3 - real(r8), parameter :: RHOSNOWFIX=1.0e2_r8 !kg/m3 - real(r8), parameter :: COLEFFRAIN=0.7_r8 - real(r8), parameter :: TMIX=258._r8 - real(r8), parameter :: TFROZ=240._r8 - real(r8), parameter :: COLEFFAER=0.05_r8 -! -! additional work arrays and diagnostics -! - real(r8) :: rls_wrk(lpar) - real(r8) :: rnew_wrk(lpar) - real(r8) :: rca_wrk(lpar) - real(r8) :: fca_wrk(lpar) - real(r8) :: rcxa_wrk(lpar) - real(r8) :: fcxa_wrk(lpar) - real(r8) :: rcxb_wrk(lpar) - real(r8) :: fcxb_wrk(lpar) - real(r8) :: rax_wrk(lpar,2) - real(r8) :: fax_wrk(lpar,2) - real(r8) :: rama_wrk(lpar) - real(r8) :: fama_wrk(lpar) - real(r8) :: deltarime_wrk(lpar) - real(r8) :: clwx_wrk(lpar) - real(r8) :: frc(lpar,3) - real(r8) :: rlsog(lpar) -! - logical :: is_hno3 - logical :: rls_flag(lpar) - logical :: rnew_flag(lpar) - logical :: cf_trigger(lpar) - logical :: freezing(lpar) -! - real(r8), parameter :: four = 4._r8 - real(r8), parameter :: adj_factor = one + 10._r8*epsilon( one ) -! - integer :: LWASHTYP,LICETYP -! - if ( debug .and. masterproc ) then - print '(a,50f8.2)','tckaqb ',tckaqb - print '(a,50e12.4)','hstar ',hstar(1,:) - print '(a,50i4)' ,'ice_uptake ',TCNION - print '(a,50f8.2)','mol_weight ',TCMASS(:) - print '(a,50f8.2)','temp ',tem(:) - print '(a,50f8.2)','p ',pofl(:) - end if - -!----------------------------------------------------------------------- - LE = LPAR-1 -! - rls_flag(1:le) = rls(1:le) > zero - freezing(1:le) = tem(1:le) < tice - rlsog(1:le) = rls(1:le)/garea -! -species_loop : & - do N = 1,NTRACE - QTT(:lpar) = QTTJFL(:lpar,N) - QTTNEW(:lpar) = QTTJFL(:lpar,N) - is_hno3 = n == hno3_ndx - if( is_hno3 ) then - qt_rain(:lpar) = zero - qt_rime(:lpar) = zero - qt_wash(:lpar) = zero - qt_evap(:lpar) = zero - rca_wrk(:lpar) = zero - fca_wrk(:lpar) = zero - rcxa_wrk(:lpar) = zero - fcxa_wrk(:lpar) = zero - rcxb_wrk(:lpar) = zero - fcxb_wrk(:lpar) = zero - rls_wrk(:lpar) = zero - rnew_wrk(:lpar) = zero - cf_trigger(:lpar) = .false. - clwx_wrk(:lpar) = -9999._r8 - deltarime_wrk(:lpar) = -9999._r8 - rax_wrk(:lpar,:) = zero - fax_wrk(:lpar,:) = zero - endif - -!----------------------------------------------------------------------- -! check whether soluble in ice -!----------------------------------------------------------------------- - if( TCNION(N) ) then - LICETYP = 1 - else - LICETYP = 2 - end if - -!----------------------------------------------------------------------- -! initialization -!----------------------------------------------------------------------- - QTTOPAA = zero - QTTOPCA = zero - - RCA = zero - FCA = zero - DCA = zero - RAMA = zero - FAMA = zero - DAMA = zero - - AMPCT = zero - AMCLPCT = zero - CLNEWPCT = zero - CLNEWAMPCT = zero - CLOLDPCT = zero - CLOLDAMPCT = zero - - -!----------------------------------------------------------------------- -! Check whether precip in top layer - if so, require CF ge 0.2 -!----------------------------------------------------------------------- - if( RLS(LE) > zero ) then - CFXX(LE) = max( CFMIN,CFR(LE) ) - else - CFXX(LE) = CFR(LE) - endif - - rnew_flag(1:le) = .false. - -level_loop : & - do L = LE,1,-1 - LM1 = L - 1 - FAX = zero - RAX = zero - DAX = zero - FCXA = zero - FCXB = zero - DCXA = zero - DCXB = zero - RCXA = zero - RCXB = zero - - QTDISCF = zero - QTDISRIME = zero - QTDISCXA = zero - - QTEVAPAXP = zero - QTEVAPAXW = zero - QTEVAPAX = zero - QTWASHAX = zero - - QTEVAPCXAP = zero - QTEVAPCXAW = zero - QTEVAPCXA = zero - QTRIMECXA = zero - QTWASHCXA = zero - QTRAINCXA = zero - QTRAINCXB = zero - - RAMPCT = zero - RCXPCT = zero - - RCXALOC = zero - RCXBLOC = zero - RAXLOC = zero - RAMALOC = zero - RCALOC = zero - - RPRECIP = zero - DELTARIMEMASS = zero - DELTARIME = zero - DOR = zero - DNEW = zero - - QTTOPAAX = zero - QTTOPCAX = zero - -has_rls : & - if( rls_flag(l) ) then -!----------------------------------------------------------------------- -!-----Evaporate ambient precip and decrease area------------------------- -!-----If ice, diam=diam falling from above If rain, diam=4mm (not used) -!-----Evaporate tracer contained in evaporated precip -!-----Can't evaporate more than we start with----------------------------- -!-----Don't do washout until we adjust ambient precip to match Rbot if needed -!------(after RNEW if statements) -!----------------------------------------------------------------------- - FAX = max( zero,FAMA*(one - evaprate(l)) ) - RAX = RAMA !kg/m2/s - if ( debug .and. masterproc ) then - if( (l == 3 .or. l == 2) ) then - write(*,*) 'washout: l,rls,fax = ',l,rls(l),fax - endif - endif - if( FAMA > zero ) then - if( freezing(l) ) then - DAX = DAMA !mm - else - DAX = four !mm - not necessary - endif - else - DAX = zero - endif - - if( RAMA > zero ) then - QTEVAPAXP = min( QTTOPAA,EVAPRATE(L)*QTTOPAA ) - else - QTEVAPAXP = zero - endif - if( is_hno3 ) then - rax_wrk(l,1) = rax - fax_wrk(l,1) = fax - endif - - -!----------------------------------------------------------------------- -! Determine how much the in-cloud precip rate has increased------ -!----------------------------------------------------------------------- - WRK = RAX*FAX + RCA*FCA - if( WRK > 0._r8 ) then - RNEW_TST = RLS(L)/(GAREA * WRK) - else - RNEW_TST = 10._r8 - endif - RNEW = RLSOG(L) - (RAX*FAX + RCA*FCA) !GBA*CF - rnew_wrk(l) = rnew_tst - if ( debug .and. masterproc ) then - if( is_hno3 .and. l == kdiag-1 ) then - write(*,*) ' ' - write(*,*) 'washout: rls,rax,fax,rca,fca' - write(*,'(1p,5g15.7)') rls(l),rax,fax,rca,fca - write(*,*) ' ' - endif - endif -!----------------------------------------------------------------------- -! if RNEW>0, there is growth and/or new precip formation -!----------------------------------------------------------------------- -has_rnew: if( rlsog(l) > adj_factor*(rax*fax + rca*fca) ) then -!----------------------------------------------------------------------- -! Min cloudwater requirement for cloud with new precip -! Min CF is set at top for LE, at end for other levels -! CWMIN is only needed for new precip formation - do not need for RNEW<0 -!----------------------------------------------------------------------- - if( cfxx(l) == zero ) then - if ( do_diag ) then - write(*,*) 'cfxx(l) == zero',l - write(*,*) qttjfl(:,n) - write(*,*) qm(:) - write(*,*) pofl(:) - write(*,*) delz(:) - write(*,*) rls(:) - write(*,*) clwc(:) - write(*,*) ciwc(:) - write(*,*) cfr(:) - write(*,*) tem(:) - write(*,*) evaprate(:) - write(*,*) hstar(:,n) - end if -! -! if we are here,, that means that there is -! a inconsistency and this will lead to a division -! by 0 later on! This column should then be skipped -! - QTTJFL(:lpar,n) = QTT(:lpar) - cycle species_loop -! -! call endrun() -! - endif - rnew_flag(l) = .true. - CLWX = max( CLWC(L)+CIWC(L),CWMIN*CFXX(L) ) - if( is_hno3 ) then - clwx_wrk(l) = clwx - endif -!----------------------------------------------------------------------- -! Area of old cloud and new cloud -!----------------------------------------------------------------------- - FCXA = FCA - FCXB = max( zero,CFXX(L)-FCXA ) -!----------------------------------------------------------------------- -! ICE -! For ice and mixed phase, grow precip in old cloud by riming -! Use only portion of cloudwater in old cloud fraction -! and rain above old cloud fraction -! COLEFF from Lohmann and Roeckner (1996), Loss rate from Rotstayn (1997) -!----------------------------------------------------------------------- -is_freezing : & - if( freezing(l) ) then - COLEFFSNOW = exp( 2.5e-2_r8*(TEM(L) - TICE) ) - if( TEM(L) <= TFROZ ) then - RHOSNOW = RHOSNOWFIX - else - RHOSNOW = 0.303_r8*(TEM(L) - TFROZ)*RHOSNOWFIX - endif - if( FCXA > zero ) then - if( DCA > zero ) then - DELTARIMEMASS = CLWX*QM(L)*(FCXA/CFXX(L))* & - (one - exp( (-COLEFFSNOW/(DCA*1.e-3_r8))*((RCA)/(2._r8*RHOSNOW))*DTSCAV )) !uses GBA R - else - DELTARIMEMASS = zero - endif - else - DELTARIMEMASS = zero - endif -!----------------------------------------------------------------------- -! Increase in precip rate due to riming (kg/m2/s): -! Limit to total increase in R in cloud -!----------------------------------------------------------------------- - if( FCXA > zero ) then - DELTARIME = min( RNEW/FCXA,DELTARIMEMASS/(FCXA*GAREA*DTSCAV) ) !GBA - else - DELTARIME = zero - endif - if( is_hno3 ) then - deltarime_wrk(l) = deltarime - endif -!----------------------------------------------------------------------- -! Find diameter of rimed precip, must be at least .1mm -!----------------------------------------------------------------------- - if( RCA > zero ) then - DOR = max( DMIN,(((RCA+DELTARIME)/RCA)**VOLPOW)*DCA ) - else - DOR = zero - endif -!----------------------------------------------------------------------- -! If there is some in-cloud precip left, we have new precip formation -! Will be spread over whole cloud fraction -!----------------------------------------------------------------------- -! Calculate precip rate in old and new cloud fractions -!----------------------------------------------------------------------- - RPRECIP = (RNEW-(DELTARIME*FCXA))/CFXX(L) !kg/m2/s !GBA -!----------------------------------------------------------------------- -! Calculate precip rate in old and new cloud fractions -!----------------------------------------------------------------------- - RCXA = RCA + DELTARIME + RPRECIP !kg/m2/s GBA - RCXB = RPRECIP !kg/m2/s GBA - -!----------------------------------------------------------------------- -! Find diameter of new precip from empirical relation using Rprecip -! in given area of box- use density of water, not snow, to convert kg/s -! to mm/s -> as given in Field and Heymsfield -! Also calculate diameter of mixed precip,DCXA, from empirical relation -! using total R in FCXA - this will give larger particles than averaging DOR and -! DNEW in the next level -! DNEW and DCXA must be at least .1mm -!----------------------------------------------------------------------- - if( RPRECIP > zero ) then - WEMP = (CLWX*QM(L))/(GAREA*CFXX(L)*DELZ(L)) !kg/m3 - REMP = RPRECIP/((RHORAIN/1.e3_r8)) !mm/s local - DNEW = DEMPIRICAL( WEMP, REMP ) - if ( debug .and. masterproc ) then - if( is_hno3 .and. l >= 15 ) then - write(*,*) ' ' - write(*,*) 'washout: wemp,remp.dnew @ l = ',l - write(*,'(1p,3g15.7)') wemp,remp,dnew - write(*,*) ' ' - endif - endif - DNEW = max( DMIN,DNEW ) - if( FCXB > zero ) then - DCXB = DNEW - else - DCXB = zero - endif - else - DCXB = zero - endif - - if( FCXA > zero ) then - WEMP = (CLWX*QM(L)*(FCXA/CFXX(L)))/(GAREA*FCXA*DELZ(L)) !kg/m3 - REMP = RCXA/((RHORAIN/1.e3_r8)) !mm/s local - DEMP = DEMPIRICAL( WEMP, REMP ) - DCXA = ((RCA+DELTARIME)/RCXA)*DOR + (RPRECIP/RCXA)*DNEW - DCXA = max( DEMP,DCXA ) - DCXA = max( DMIN,DCXA ) - else - WEMP = zero - REMP = zero - DEMP = zero - DCXA = zero - endif - if ( debug .and. masterproc ) then - if( is_hno3 .and. l >= 15 ) then - write(*,*) ' ' - write(*,*) 'washout: rca,rcxa,deltarime,dor,rprecip,dnew @ l = ',l - write(*,'(1p,6g15.7)') rca,rcxa,deltarime,dor,rprecip,dnew - write(*,*) 'washout: dcxa,dcxb,wemp,remp,demp' - write(*,'(1p,5g15.7)') dcxa,dcxb,wemp,remp,demp - write(*,*) ' ' - end if - endif - - if( QTT(L) > zero ) then -!----------------------------------------------------------------------- -! ICE SCAVENGING -!----------------------------------------------------------------------- -! For ice, rainout only hno3/aerosols using new precip -! Tracer dissolved given by Kaercher and Voigt (2006) for T<258K -! For T>258K, use Henry's Law with Retention coefficient -! Rain out in whole CF -!----------------------------------------------------------------------- - if( RPRECIP > zero ) then - if( LICETYP == 1 ) then - RRAIN = RPRECIP*GAREA !kg/s local - call DISGAS( CLWX, CFXX(L), TCMASS(N), HSTAR(L,N), & - TEM(L),POFL(L),QM(L), & - QTT(L)*CFXX(L),QTDISCF ) - call RAINGAS( RRAIN, DTSCAV, CLWX, CFXX(L), & - QM(L), QTT(L), QTDISCF, QTRAIN ) - WRK = QTRAIN/CFXX(L) - QTRAINCXA = FCXA*WRK - QTRAINCXB = FCXB*WRK - elseif( LICETYP == 2 ) then - QTRAINCXA = zero - QTRAINCXB = zero - endif - if( debug .and. masterproc .and. is_hno3 .and. l == kdiag ) then - write(*,*) ' ' - write(*,*) 'washout: Ice Scavenging' - write(*,*) 'washout: qtraincxa, qtraincxb, fcxa, fcxb, qt_rain, cfxx(l), wrk @ level = ',l - write(*,'(1p,7g15.7)') qtraincxa, qtraincxb, fcxa, fcxb, qt_rain(l), cfxx(l), wrk - write(*,*) ' ' - endif - endif -!----------------------------------------------------------------------- -! For ice, accretion removal for hno3 and aerosols is propotional to riming, -! no accretion removal for gases -! remove only in mixed portion of cloud -! Limit DELTARIMEMASS to RNEW*DTSCAV for ice - evaporation of rimed ice to match -! RNEW precip rate would result in HNO3 escaping from ice (no trapping) -!----------------------------------------------------------------------- - if( DELTARIME > zero ) then - if( LICETYP == 1 ) then - if( TEM(L) <= TFROZ ) then - RHOSNOW = RHOSNOWFIX - else - RHOSNOW = 0.303_r8*(TEM(L) - TFROZ)*RHOSNOWFIX - endif - QTCXA = QTT(L)*FCXA - call DISGAS( CLWX*(FCXA/CFXX(L)), FCXA, TCMASS(N), & - HSTAR(L,N), TEM(L), POFL(L), & - QM(L), QTCXA, QTDISRIME ) - QTDISSTAR = (QTDISRIME*QTCXA)/(QTDISRIME + QTCXA) - if ( debug .and. masterproc ) then - if( is_hno3 .and. l >= 15 ) then - write(*,*) ' ' - write(*,*) 'washout: fcxa,dca,rca,qtdisstar @ l = ',l - write(*,'(1p,4g15.7)') fcxa,dca,rca,qtdisstar - write(*,*) ' ' - endif - endif - QTRIMECXA = QTCXA* & - (one - exp((-COLEFFSNOW/(DCA*1.e-3_r8))* & - (RCA/(2._r8*RHOSNOW))* & !uses GBA R - (QTDISSTAR/QTCXA)*DTSCAV)) - QTRIMECXA = min( QTRIMECXA, & - ((RNEW*GAREA*DTSCAV)/(CLWX*QM(L)*(FCXA/CFXX(L))))*QTDISSTAR) - elseif( LICETYP == 2 ) then - QTRIMECXA = zero - endif - endif - else - QTRAINCXA = zero - QTRAINCXB = zero - QTRIMECXA = zero - endif -!----------------------------------------------------------------------- -! For ice, no washout in interstitial cloud air -!----------------------------------------------------------------------- - QTWASHCXA = zero - QTEVAPCXA = zero - -!----------------------------------------------------------------------- -! RAIN -! For rain, accretion increases rain rate but diameter remains constant -! Diameter is 4mm (not used) -!----------------------------------------------------------------------- - else is_freezing - if( FCXA > zero ) then - DELTARIMEMASS = (CLWX*QM(L))*(FCXA/CFXX(L))* & - (one - exp( -0.24_r8*COLEFFRAIN*((RCA)**0.75_r8)*DTSCAV )) !local - else - DELTARIMEMASS = zero - endif -!----------------------------------------------------------------------- -! Increase in precip rate due to riming (kg/m2/s): -! Limit to total increase in R in cloud -!----------------------------------------------------------------------- - if( FCXA > zero ) then - DELTARIME = min( RNEW/FCXA,DELTARIMEMASS/(FCXA*GAREA*DTSCAV) ) !GBA - else - DELTARIME = zero - endif -!----------------------------------------------------------------------- -! If there is some in-cloud precip left, we have new precip formation -!----------------------------------------------------------------------- - RPRECIP = (RNEW-(DELTARIME*FCXA))/CFXX(L) !GBA - - RCXA = RCA + DELTARIME + RPRECIP !kg/m2/s GBA - RCXB = RPRECIP !kg/m2/s GBA - DCXA = FOUR - if( FCXB > zero ) then - DCXB = FOUR - else - DCXB = zero - endif -!----------------------------------------------------------------------- -! RAIN SCAVENGING -! For rain, rainout both hno3/aerosols and gases using new precip -!----------------------------------------------------------------------- - if( QTT(L) > zero ) then - if( RPRECIP > zero ) then - RRAIN = (RPRECIP*GAREA) !kg/s local - call DISGAS( CLWX, CFXX(L), TCMASS(N), HSTAR(L,N), & - TEM(L), POFL(L), QM(L), & - QTT(L)*CFXX(L), QTDISCF ) - call RAINGAS( RRAIN, DTSCAV, CLWX, CFXX(L), & - QM(L), QTT(L), QTDISCF, QTRAIN ) - WRK = QTRAIN/CFXX(L) - QTRAINCXA = FCXA*WRK - QTRAINCXB = FCXB*WRK - if( debug .and. masterproc .and. is_hno3 .and. l == kdiag ) then - write(*,*) ' ' - write(*,*) 'washout: Rain Scavenging' - write(*,*) 'washout: qtraincxa, qtraincxb, fcxa, fcxb, qt_rain, cfxx(l), wrk @ level = ',l - write(*,'(1p,7g15.7)') qtraincxa, qtraincxb, fcxa, fcxb, qt_rain(l), cfxx(l), wrk - write(*,*) ' ' - endif - endif -!----------------------------------------------------------------------- -! For rain, accretion removal is propotional to riming -! caclulate for hno3/aerosols and gases -! Remove only in mixed portion of cloud -! Limit DELTARIMEMASS to RNEW*DTSCAV -!----------------------------------------------------------------------- - if( DELTARIME > zero ) then - QTCXA = QTT(L)*FCXA - call DISGAS( CLWX*(FCXA/CFXX(L)), FCXA, TCMASS(N), & - HSTAR(L,N), TEM(L), POFL(L), & - QM(L), QTCXA, QTDISRIME ) - QTDISSTAR = (QTDISRIME*QTCXA)/(QTDISRIME + QTCXA) - QTRIMECXA = QTCXA* & - (one - exp(-0.24_r8*COLEFFRAIN* & - ((RCA)**0.75_r8)* & !local - (QTDISSTAR/QTCXA)*DTSCAV)) - QTRIMECXA = min( QTRIMECXA, & - ((RNEW*GAREA*DTSCAV)/(CLWX*QM(L)*(FCXA/CFXX(L))))*QTDISSTAR) - else - QTRIMECXA = zero - endif - else - QTRAINCXA = zero - QTRAINCXB = zero - QTRIMECXA = zero - endif -!----------------------------------------------------------------------- -! For rain, washout gases and HNO3/aerosols using rain from above old cloud -! Washout for HNO3/aerosols is only on non-dissolved portion, impaction-style -! Washout for gases is on non-dissolved portion, limited by QTTOP+QTRIME -!----------------------------------------------------------------------- - if( RCA > zero ) then - QTPRECIP = FCXA*QTT(L) - QTDISRIME - if( HSTAR(L,N) > 1.e4_r8 ) then - if( QTPRECIP > zero ) then - QTWASHCXA = QTPRECIP*(one - exp( -0.24_r8*COLEFFAER*((RCA)**0.75_r8)*DTSCAV )) !local - else - QTWASHCXA = zero - endif - QTEVAPCXA = zero - else - RWASH = RCA*GAREA !kg/s local - if( QTPRECIP > zero ) then - call WASHGAS( RWASH, FCA, DTSCAV, QTTOPCA+QTRIMECXA, & - HSTAR(L,N), TEM(L), POFL(L), & - QM(L), QTPRECIP, QTWASHCXA, QTEVAPCXA ) - else - QTWASHCXA = zero - QTEVAPCXA = zero - endif - endif - endif - endif is_freezing -!----------------------------------------------------------------------- -! If RNEW zero ) then - RCXA = min( RCA,RLS(L)/(GAREA*FCXA) ) !kg/m2/s GBA - if( FAX > zero .and. ((RCXA+1.e-12_r8) < RLS(L)/(GAREA*FCXA)) ) then - RAXADJF = RLS(L)/GAREA - RCXA*FCXA - RAMPCT = RAXADJF/(RAX*FAX) - FAXADJ = RAMPCT*FAX - if( FAXADJ > zero ) then - RAXADJ = RAXADJF/FAXADJ - else - RAXADJ = zero - endif - else - RAXADJ = zero - RAMPCT = zero - FAXADJ = zero - endif - else - RCXA = zero - if( FAX > zero ) then - RAXADJF = RLS(L)/GAREA - RAMPCT = RAXADJF/(RAX*FAX) - FAXADJ = RAMPCT*FAX - if( FAXADJ > zero ) then - RAXADJ = RAXADJF/FAXADJ - else - RAXADJ = zero - endif - else - RAXADJ = zero - RAMPCT = zero - FAXADJ = zero - endif - endif - - QTEVAPAXP = min( QTTOPAA,QTTOPAA - (RAMPCT*(QTTOPAA-QTEVAPAXP)) ) - FAX = FAXADJ - RAX = RAXADJ - if ( debug .and. masterproc ) then - if( (l == 3 .or. l == 2) ) then - write(*,*) 'washout: l,fcxa,fax = ',l,fcxa,fax - endif - endif - -!----------------------------------------------------------------------- -! IN-CLOUD EVAPORATION/WASHOUT -! If precip out the bottom of the cloud is 0, evaporate everything -! If there is no cloud, QTTOPCA=0, so nothing happens -!----------------------------------------------------------------------- - if( RCXA <= zero ) then - QTEVAPCXA = QTTOPCA - RCXA = zero - DCXA = zero - else -!----------------------------------------------------------------------- -! If rain out the bottom of the cloud is >0 (but .le. RCA): -! For ice, decrease particle size, -! no washout -! no evap for non-ice gases (b/c there is nothing in ice) -! TTmix, hno3&aerosols are incorporated into ice structure: -! do not release -! For rain, assume full evaporation of some raindrops -! proportional evaporation for all species -! washout for gases using Rbot -! impact washout for hno3/aerosol portion in gas phase -!----------------------------------------------------------------------- -! if (TEM(L) < TICE ) then -is_freezing_a : & - if( freezing(l) ) then - QTWASHCXA = zero - DCXA = ((RCXA/RCA)**VOLPOW)*DCA - if( LICETYP == 1 ) then - if( TEM(L) <= TMIX ) then - MASSLOSS = (RCA-RCXA)*FCXA*GAREA*DTSCAV -!----------------------------------------------------------------------- -! note-QTT doesn't matter b/c T<258K -!----------------------------------------------------------------------- - call DISGAS( (MASSLOSS/QM(L)), FCXA, TCMASS(N), & - HSTAR(L,N), TEM(L), POFL(L), & - QM(L), QTT(L), QTEVAPCXA ) - QTEVAPCXA = min( QTTOPCA,QTEVAPCXA ) - else - QTEVAPCXA = zero - endif - elseif( LICETYP == 2 ) then - QTEVAPCXA = zero - endif - else is_freezing_a - QTEVAPCXAP = (RCA - RCXA)/RCA*QTTOPCA - DCXA = FOUR - QTCXA = FCXA*QTT(L) - if( HSTAR(L,N) > 1.e4_r8 ) then - if( QTT(L) > zero ) then - call DISGAS( CLWX*(FCXA/CFXX(L)), FCXA, TCMASS(N), & - HSTAR(L,N), TEM(L), POFL(L), & - QM(L), QTCXA, QTDISCXA ) - if( QTCXA > QTDISCXA ) then - QTWASHCXA = (QTCXA - QTDISCXA)*(one - exp( -0.24_r8*COLEFFAER*((RCXA)**0.75_r8)*DTSCAV )) !local - else - QTWASHCXA = zero - endif - QTEVAPCXAW = zero - else - QTWASHCXA = zero - QTEVAPCXAW = zero - endif - else - RWASH = RCXA*GAREA !kg/s local - call WASHGAS( RWASH, FCXA, DTSCAV, QTTOPCA, HSTAR(L,N), & - TEM(L), POFL(L), QM(L), & - QTCXA-QTDISCXA, QTWASHCXA, QTEVAPCXAW ) - endif - QTEVAPCXA = QTEVAPCXAP + QTEVAPCXAW - endif is_freezing_a - endif - endif has_rnew - -!----------------------------------------------------------------------- -! AMBIENT WASHOUT -! Ambient precip is finalized - if it is rain, washout -! no ambient washout for ice, since gases are in vapor phase -!----------------------------------------------------------------------- - if( RAX > zero ) then - if( .not. freezing(l) ) then - QTAX = FAX*QTT(L) - if( HSTAR(L,N) > 1.e4_r8 ) then - QTWASHAX = QTAX* & - (one - exp(-0.24_r8*COLEFFAER* & - ((RAX)**0.75_r8)*DTSCAV)) !local - QTEVAPAXW = zero - else - RWASH = RAX*GAREA !kg/s local - call WASHGAS( RWASH, FAX, DTSCAV, QTTOPAA, HSTAR(L,N), & - TEM(L), POFL(L), QM(L), QTAX, & - QTWASHAX, QTEVAPAXW ) - endif - else - QTEVAPAXW = zero - QTWASHAX = zero - endif - else - QTEVAPAXW = zero - QTWASHAX = zero - endif - QTEVAPAX = QTEVAPAXP + QTEVAPAXW - -!----------------------------------------------------------------------- -! END SCAVENGING -! Require CF if our ambient evaporation rate would give less -! precip than R from model. -!----------------------------------------------------------------------- - if( do_diag .and. is_hno3 ) then - rls_wrk(l) = rls(l)/garea - rca_wrk(l) = rca - fca_wrk(l) = fca - rcxa_wrk(l) = rcxa - fcxa_wrk(l) = fcxa - rcxb_wrk(l) = rcxb - fcxb_wrk(l) = fcxb - rax_wrk(l,2) = rax - fax_wrk(l,2) = fax - endif -upper_level : & - if( L > 1 ) then - FAMA = max( FCXA + FCXB + FAX - CFR(LM1),zero ) - if( FAX > zero ) then - RAXLOC = RAX/FAX - else - RAXLOC = zero - endif - if( FCXA > zero ) then - RCXALOC = RCXA/FCXA - else - RCXALOC = zero - endif - if( FCXB > zero ) then - RCXBLOC = RCXB/FCXB - else - RCXBLOC = zero - endif - - if( CFR(LM1) >= CFMIN ) then - CFXX(LM1) = CFR(LM1) - else - if( adj_factor*RLSOG(LM1) >= (RCXA*FCXA + RCXB*FCXB + RAX*FAX)*(one - EVAPRATE(LM1)) ) then - CFXX(LM1) = CFMIN - cf_trigger(lm1) = .true. - else - CFXX(LM1) = CFR(LM1) - endif - if( is_hno3 .and. lm1 == kdiag .and. debug .and. masterproc ) then - write(*,*) ' ' - write(*,*) 'washout: rls,garea,rcxa,fcxa,rcxb,fcxb,rax,fax' - write(*,'(1p,8g15.7)') rls(lm1),garea,rcxa,fcxa,rcxb,fcxb,rax,fax - write(*,*) ' ' - endif - endif -!----------------------------------------------------------------------- -! Figure out what will go into ambient and cloud below -! Don't do for lowest level -!----------------------------------------------------------------------- - if( FAX > zero ) then - RAXLOC = RAX/FAX - AMPCT = max( zero,min( one,(CFXX(L) + FAX - CFXX(LM1))/FAX ) ) - AMCLPCT = one - AMPCT - else - RAXLOC = zero - AMPCT = zero - AMCLPCT = zero - endif - if( FCXB > zero ) then - RCXBLOC = RCXB/FCXB - CLNEWPCT = max( zero,min( (CFXX(LM1) - FCXA)/FCXB,one ) ) - CLNEWAMPCT = one - CLNEWPCT - else - RCXBLOC = zero - CLNEWPCT = zero - CLNEWAMPCT = zero - endif - if( FCXA > zero ) then - RCXALOC = RCXA/FCXA - CLOLDPCT = max( zero,min( CFXX(LM1)/FCXA,one ) ) - CLOLDAMPCT = one - CLOLDPCT - else - RCXALOC = zero - CLOLDPCT = zero - CLOLDAMPCT = zero - endif -!----------------------------------------------------------------------- -! Remix everything for the next level -!----------------------------------------------------------------------- - FCA = min( CFXX(LM1),FCXA*CLOLDPCT + CLNEWPCT*FCXB + AMCLPCT*FAX ) - if( FCA > zero ) then -!----------------------------------------------------------------------- -! Maintain cloud core by reducing NC and AM area going into cloud below -!----------------------------------------------------------------------- - RCA = (RCXA*FCXA*CLOLDPCT + RCXB*FCXB*CLNEWPCT + RAX*FAX*AMCLPCT)/FCA - if ( debug .and. masterproc ) then - if( is_hno3 ) then - write(*,*) ' ' - write(*,*) 'washout: rcxa,fcxa,cloldpctrca,rca,fca,dcxa @ l = ',l - write(*,'(1p,6g15.7)') rcxa,fcxa,cloldpct,rca,fca,dcxa - write(*,*) 'washout: rcxb,fcxb,clnewpct,dcxb' - write(*,'(1p,4g15.7)') rcxb,fcxb,clnewpct,dcxb - write(*,*) 'washout: rax,fax,amclpct,dax' - write(*,'(1p,4g15.7)') rax,fax,amclpct,dax - write(*,*) ' ' - endif - endif - - if (RCA > zero) then - DCA = (RCXA*FCXA*CLOLDPCT)/(RCA*FCA)*DCXA + & - (RCXB*FCXB*CLNEWPCT)/(RCA*FCA)*DCXB + & - (RAX*FAX*AMCLPCT)/(RCA*FCA)*DAX - else - DCA = zero - FCA = zero - endif - - else - FCA = zero - DCA = zero - RCA = zero - endif - - FAMA = FCXA + FCXB + FAX - CFXX(LM1) - if( FAMA > zero ) then - RAMA = (RCXA*FCXA*CLOLDAMPCT + RCXB*FCXB*CLNEWAMPCT + RAX*FAX*AMPCT)/FAMA - if( RAMA > zero ) then - DAMA = (RCXA*FCXA*CLOLDAMPCT)/(RAMA*FAMA)*DCXA + & - (RCXB*FCXB*CLNEWAMPCT)/(RAMA*FAMA)*DCXB + & - (RAX*FAX*AMPCT)/(RAMA*FAMA)*DAX - else - FAMA = zero - DAMA = zero - endif - else - FAMA = zero - DAMA = zero - RAMA = zero - endif - else upper_level - AMPCT = zero - AMCLPCT = zero - CLNEWPCT = zero - CLNEWAMPCT = zero - CLOLDPCT = zero - CLOLDAMPCT = zero - endif upper_level - else has_rls - RNEW = zero - QTEVAPCXA = QTTOPCA - QTEVAPAX = QTTOPAA - if( L > 1 ) then - if( RLS(LM1) > zero ) then - CFXX(LM1) = max( CFMIN,CFR(LM1) ) -! if( CFR(LM1) >= CFMIN ) then -! CFXX(LM1) = CFR(LM1) -! else -! CFXX(LM1) = CFMIN -! endif - else - CFXX(LM1) = CFR(LM1) - endif - endif - AMPCT = zero - AMCLPCT = zero - CLNEWPCT = zero - CLNEWAMPCT = zero - CLOLDPCT = zero - CLOLDAMPCT = zero - RCA = zero - RAMA = zero - FCA = zero - FAMA = zero - DCA = zero - DAMA = zero - endif has_rls - - if( do_diag .and. is_hno3 ) then - fama_wrk(l) = fama - rama_wrk(l) = rama - endif -!----------------------------------------------------------------------- -! Net loss can not exceed QTT in each region -!----------------------------------------------------------------------- - QTNETLCXA = QTRAINCXA + QTRIMECXA + QTWASHCXA - QTEVAPCXA - QTNETLCXA = min( QTT(L)*FCXA,QTNETLCXA ) - - QTNETLCXB =QTRAINCXB - QTNETLCXB = min( QTT(L)*FCXB,QTNETLCXB ) - - QTNETLAX = QTWASHAX - QTEVAPAX - QTNETLAX = min( QTT(L)*FAX,QTNETLAX ) - - QTTNEW(L) = QTT(L) - (QTNETLCXA + QTNETLCXB + QTNETLAX) - - if( do_diag .and. is_hno3 ) then - qt_rain(l) = qtraincxa + qtraincxb - qt_rime(l) = qtrimecxa - qt_wash(l) = qtwashcxa + qtwashax - qt_evap(l) = qtevapcxa + qtevapax - frc(l,1) = qtnetlcxa - frc(l,2) = qtnetlcxb - frc(l,3) = qtnetlax - endif - if( debug .and. masterproc .and. is_hno3 .and. l == kdiag ) then - write(*,*) ' ' - write(*,*) 'washout: qtraincxa, qtraincxb, qtrimecxa @ level = ',l - write(*,'(1p,3g15.7)') qtraincxa, qtraincxb, qtrimecxa - write(*,*) ' ' - endif - if ( debug .and. masterproc ) then - if( (l == 3 .or. l == 2) ) then - write(*,*) 'washout: hno3, hno3, qtnetlca,b, qtnetlax @ level = ',l - write(*,'(1p,5g15.7)') qttnew(l), qtt(l), qtnetlcxa, qtnetlcxb, qtnetlax - write(*,*) 'washout: qtwashax, qtevapax,fax,fama' - write(*,'(1p,5g15.7)') qtwashax, qtevapax, fax, fama - endif - endif - - QTTOPCAX = (QTTOPCA + QTNETLCXA)*CLOLDPCT + QTNETLCXB*CLNEWPCT + (QTTOPAA + QTNETLAX)*AMCLPCT - QTTOPAAX = (QTTOPCA + QTNETLCXA)*CLOLDAMPCT + QTNETLCXB*CLNEWAMPCT + (QTTOPAA + QTNETLAX)*AMPCT - QTTOPCA = QTTOPCAX - QTTOPAA = QTTOPAAX - end do level_loop - - if ( debug .and. masterproc) then - if( is_hno3 ) then - write(*,*) ' ' - write(*,*) 'washout: clwx_wrk' - write(*,'(1p,5g15.7)') clwx_wrk(1:le) - write(*,*) 'washout: cfr' - write(*,'(1p,5g15.7)') cfr(1:le) - write(*,*) 'washout: cfxx' - write(*,'(1p,5g15.7)') cfxx(1:le) - write(*,*) 'washout: cf trigger' - write(*,'(10l4)') cf_trigger(1:le) - write(*,*) 'washout: evaprate' - write(*,'(1p,5g15.7)') evaprate(1:le) - write(*,*) 'washout: rls' - write(*,'(1p,5g15.7)') rls(1:le) - write(*,*) 'washout: rls/garea' - write(*,'(1p,5g15.7)') rls_wrk(1:le) - write(*,*) 'washout: rnew_wrk' - write(*,'(1p,5g15.7)') rnew_wrk(1:le) - write(*,*) 'washout: rnew_flag' - write(*,'(10l4)') rnew_flag(1:le) - write(*,*) 'washout: deltarime_wrk' - write(*,'(1p,5g15.7)') deltarime_wrk(1:le) - write(*,*) 'washout: rama_wrk' - write(*,'(1p,5g15.7)') rama_wrk(1:le) - write(*,*) 'washout: fama_wrk' - write(*,'(1p,5g15.7)') fama_wrk(1:le) - write(*,*) 'washout: rca_wrk' - write(*,'(1p,5g15.7)') rca_wrk(1:le) - write(*,*) 'washout: fca_wrk' - write(*,'(1p,5g15.7)') fca_wrk(1:le) - write(*,*) 'washout: rcxa_wrk' - write(*,'(1p,5g15.7)') rcxa_wrk(1:le) - write(*,*) 'washout: fcxa_wrk' - write(*,'(1p,5g15.7)') fcxa_wrk(1:le) - write(*,*) 'washout: rcxb_wrk' - write(*,'(1p,5g15.7)') rcxb_wrk(1:le) - write(*,*) 'washout: fcxb_wrk' - write(*,'(1p,5g15.7)') fcxb_wrk(1:le) - write(*,*) 'washout: rax1_wrk' - write(*,'(1p,5g15.7)') rax_wrk(1:le,1) - write(*,*) 'washout: fax1_wrk' - write(*,'(1p,5g15.7)') fax_wrk(1:le,1) - write(*,*) 'washout: rax2_wrk' - write(*,'(1p,5g15.7)') rax_wrk(1:le,2) - write(*,*) 'washout: fax2_wrk' - write(*,'(1p,5g15.7)') fax_wrk(1:le,2) - write(*,*) 'washout: rls_flag' - write(*,'(1p,10l4)') rls_flag(1:le) - write(*,*) 'washout: freezing' - write(*,'(1p,10l4)') freezing(1:le) - write(*,*) 'washout: qtnetlcxa' - write(*,'(1p,5g15.7)') frc(1:le,1) - write(*,*) 'washout: qtnetlcxb' - write(*,'(1p,5g15.7)') frc(1:le,2) - write(*,*) 'washout: qtnetlax' - write(*,'(1p,5g15.7)') frc(1:le,3) - write(*,*) ' ' - endif - endif -!----------------------------------------------------------------------- -! reload new tracer mass and rescale moments: check upper limits (LE) -!----------------------------------------------------------------------- - QTTJFL(:le,N) = QTTNEW(:le) - - end do species_loop -! - return - end subroutine washo -!--------------------------------------------------------------------- - subroutine DISGAS (CLWX,CFX,MOLMASS,HSTAR,TM,PR,QM,QT,QTDIS) -!--------------------------------------------------------------------- - implicit none - real(r8), intent(in) :: CLWX,CFX !cloud water,cloud fraction - real(r8), intent(in) :: MOLMASS !molecular mass of tracer - real(r8), intent(in) :: HSTAR !Henry's Law coeffs A*exp(-B/T) - real(r8), intent(in) :: TM !temperature of box (K) - real(r8), intent(in) :: PR !pressure of box (hPa) - real(r8), intent(in) :: QM !air mass in box (kg) - real(r8), intent(in) :: QT !tracer in box (kg) - real(r8), intent(out) :: QTDIS !tracer dissolved in aqueous phase - - real(r8) MUEMP - real(r8), parameter :: INV298 = 1._r8/298._r8 - real(r8), parameter :: TMIX=258._r8 - real(r8), parameter :: RETEFF=0.5_r8 -!---Next calculate rate of uptake of tracer - -!---effective Henry's Law constant: H* = moles-T / liter-precip / press(atm-T) -!---p(atm of tracer-T) = (QT/QM) * (.029/MolWt-T) * pressr(hPa)/1000 -!---limit temperature effects to T above freezing -!----MU from fit to Kaercher and Voigt (2006) - - if(TM .ge. TICE) then - QTDIS=(HSTAR*(QT/(QM*CFX))*0.029_r8*(PR/1.0e3_r8))*(CLWX*QM) - elseif (TM .le. TMIX) then - MUEMP=exp(-14.2252_r8+(1.55704e-1_r8*TM)-(7.1929e-4_r8*(TM**2.0_r8))) - QTDIS=MUEMP*(MOLMASS/18._r8)*(CLWX*QM) - else - QTDIS=RETEFF*((HSTAR*(QT/(QM*CFX))*0.029_r8*(PR/1.0e3_r8))*(CLWX*QM)) - endif - - return - end subroutine DISGAS - -!----------------------------------------------------------------------- - subroutine RAINGAS (RRAIN,DTSCAV,CLWX,CFX,QM,QT,QTDIS,QTRAIN) -!----------------------------------------------------------------------- -!---New trace-gas rainout from large-scale precip with two time scales, -!---one based on precip formation from cloud water and one based on -!---Henry's Law solubility: correct limit for delta-t -!--- -!---NB this code does not consider the aqueous dissociation (eg, C-q) -!--- that makes uptake of HNO3 and H2SO4 so complete. To do so would -!--- require that we keep track of the pH of the falling rain. -!---THUS the Henry's Law coefficient KHA needs to be enhanced to incldue this! -!---ALSO the possible formation of other soluble species from, eg, CH2O, H2O2 -!--- can be considered with enhanced values of KHA. -!--- -!---Does NOT now use RMC (moist conv rain) but could, assuming 30% coverage -!----------------------------------------------------------------------- - implicit none - real(r8), intent(in) :: RRAIN !new rain formation in box (kg/s) - real(r8), intent(in) :: DTSCAV !time step (s) - real(r8), intent(in) :: CLWX,CFX !cloud water and cloud fraction - real(r8), intent(in) :: QM !air mass in box (kg) - real(r8), intent(in) :: QT !tracer in box (kg) - real(r8), intent(in) :: QTDIS !tracer in aqueous phase (kg) - real(r8), intent(out) :: QTRAIN !tracer picked up by new rain - - real(r8) QTLF,QTDISSTAR - - - - - - QTDISSTAR=(QTDIS*(QT*CFX))/(QTDIS+(QT*CFX)) - -!---Tracer Loss frequency (1/s) within cloud fraction: - QTLF = (RRAIN*QTDISSTAR)/(CLWX*QM*QT*CFX) - -!---in time = DTSCAV, the amount of QTT scavenged is calculated -!---from CF*AMOUNT OF UPTAKE - QTRAIN = QT*CFX*(1._r8 - exp(-DTSCAV*QTLF)) - - return - end subroutine RAINGAS - - -!----------------------------------------------------------------------- - subroutine WASHGAS (RWASH,BOXF,DTSCAV,QTRTOP,HSTAR,TM,PR,QM, & - QT,QTWASH,QTEVAP) -!----------------------------------------------------------------------- -!---for most gases below-cloud washout assume Henry-Law equilib with precip -!---assumes that precip is liquid, if frozen, do not call this sub -!---since solubility is moderate, fraction of box with rain does not matter -!---NB this code does not consider the aqueous dissociation (eg, C-q) -!--- that makes uptake of HNO3 and H2SO4 so complete. To do so would -!--- require that we keep track of the pH of the falling rain. -!---THUS the Henry's Law coefficient KHA needs to be enhanced to incldue this! -!---ALSO the possible formation of other soluble species from, eg, CH2O, H2O2 -!--- can be considered with enhanced values of KHA. -!----------------------------------------------------------------------- - implicit none - real(r8), intent(in) :: RWASH ! precip leaving bottom of box (kg/s) - real(r8), intent(in) :: BOXF ! fraction of box with washout - real(r8), intent(in) :: DTSCAV ! time step (s) - real(r8), intent(in) :: QTRTOP ! tracer-T in rain entering top of box -! over time step (kg) - real(r8), intent(in) :: HSTAR ! Henry's Law coeffs A*exp(-B/T) - real(r8), intent(in) :: TM ! temperature of box (K) - real(r8), intent(in) :: PR ! pressure of box (hPa) - real(r8), intent(in) :: QT ! tracer in box (kg) - real(r8), intent(in) :: QM ! air mass in box (kg) - real(r8), intent(out) :: QTWASH ! tracer picked up by precip (kg) - real(r8), intent(out) :: QTEVAP ! tracer evaporated from precip (kg) - - real(r8), parameter :: INV298 = 1._r8/298._r8 - real(r8) :: FWASH, QTMAX, QTDIF - -!---effective Henry's Law constant: H* = moles-T / liter-precip / press(atm-T) -!---p(atm of tracer-T) = (QT/QM) * (.029/MolWt-T) * pressr(hPa)/1000 -!---limit temperature effects to T above freezing - -! -! jfl -! -! added test for BOXF = 0. -! - if ( BOXF == 0._r8 ) then - QTWASH = 0._r8 - QTEVAP = 0._r8 - return - end if - -!---effective washout frequency (1/s): - FWASH = (RWASH*HSTAR*29.e-6_r8*PR)/(QM*BOXF) -!---equilib amount of T (kg) in rain thru bottom of box over time step - QTMAX = QT*FWASH*DTSCAV - if (QTMAX .gt. QTRTOP) then -!---more of tracer T can go into rain - QTDIF = min (QT, QTMAX-QTRTOP) - QTWASH = QTDIF * (1._r8 - exp(-DTSCAV*FWASH)) - QTEVAP=0._r8 - else -!--too much of T in rain, must degas/evap T - QTWASH = 0._r8 - QTEVAP = QTRTOP - QTMAX - endif - - return - end subroutine WASHGAS - -!----------------------------------------------------------------------- - function DEMPIRICAL (CWATER,RRATE) -!----------------------------------------------------------------------- - use shr_spfn_mod, only: shr_spfn_gamma - - implicit none - real(r8), intent(in) :: CWATER - real(r8), intent(in) :: RRATE - - real(r8) :: DEMPIRICAL - - real(r8) RRATEX,WX,THETA,PHI,ETA,BETA,ALPHA,BEE - real(r8) GAMTHETA,GAMBETA - - - - RRATEX=RRATE*3600._r8 !mm/hr - WX=CWATER*1.0e3_r8 !g/m3 - - if(RRATEX .gt. 0.04_r8) then - THETA=exp(-1.43_r8*dlog10(7._r8*RRATEX))+2.8_r8 - else - THETA=5._r8 - endif - PHI=RRATEX/(3600._r8*10._r8) !cgs units - ETA=exp((3.01_r8*THETA)-10.5_r8) - BETA=THETA/(1._r8+0.638_r8) - ALPHA=exp(4._r8*(BETA-3.5_r8)) - BEE=(.638_r8*THETA/(1._r8+.638_r8))-1.0_r8 - GAMTHETA = shr_spfn_gamma(THETA) - GAMBETA = shr_spfn_gamma(BETA+1._r8) - DEMPIRICAL=(((WX*ETA*GAMTHETA)/(1.0e6_r8*ALPHA*PHI*GAMBETA))** & - (-1._r8/BEE))*10._r8 ! in mm (wx/1e6 for cgs) - - - return - end function DEMPIRICAL -! -end module mo_neu_wetdep diff --git a/src/chemistry/mozart/mo_neu_wetdep.F90 b/src/chemistry/mozart/mo_neu_wetdep.F90 index 0b2d3ff35e..ed6a39171b 100644 --- a/src/chemistry/mozart/mo_neu_wetdep.F90 +++ b/src/chemistry/mozart/mo_neu_wetdep.F90 @@ -51,7 +51,7 @@ subroutine neu_wetdep_init ! use constituents, only : cnst_get_ind,cnst_mw use cam_history, only : addfld, add_default, horiz_only - use phys_control, only : phys_getopts + use phys_control, only : phys_getopts, cam_chempkg_is ! integer :: m,l character*20 :: test_name @@ -85,6 +85,9 @@ subroutine neu_wetdep_init ! mapping based on the MOZART4 wet removal subroutine; ! this might need to be redone (JFL: Sep 2010) ! +! Skip mapping if using GEOS-Chem; all GEOS-Chem species are in dep_data_file +! (heff table) specified in namelist drv_flds_in (EWL: Dec 2022) + if ( .not. cam_chempkg_is('geoschem_mam4') ) then select case( trim(test_name) ) ! ! CCMI: added SO2t and NH_50W @@ -108,6 +111,7 @@ subroutine neu_wetdep_init case( 'SOAGbb4' ) test_name = 'SOAGff4' end select + endif ! do l = 1,n_species_table ! From c7d196c3438065e192b2b04aa57ba874eb46ea9d Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 4 Jan 2023 12:41:49 -0700 Subject: [PATCH 083/160] Use mozart chem_prod_loss_diags.F90 rather than copy if GEOS-Chem enabled Signed-off-by: Lizzie Lundgren --- .../geoschem/chem_prod_loss_diags.F90 | 37 ------------------- 1 file changed, 37 deletions(-) delete mode 100644 src/chemistry/geoschem/chem_prod_loss_diags.F90 diff --git a/src/chemistry/geoschem/chem_prod_loss_diags.F90 b/src/chemistry/geoschem/chem_prod_loss_diags.F90 deleted file mode 100644 index b3eb614cf4..0000000000 --- a/src/chemistry/geoschem/chem_prod_loss_diags.F90 +++ /dev/null @@ -1,37 +0,0 @@ -module chem_prod_loss_diags - use shr_kind_mod, only : r8 => shr_kind_r8 - use chem_mods, only : clscnt1, clscnt4, gas_pcnst, clsmap, permute - use ppgrid, only : pver - use chem_mods, only : rxntot - use cam_history, only : addfld, outfld, add_default - !use mo_tracname, only : solsym - - implicit none - - private - public :: chem_prod_loss_diags_init - public :: chem_prod_loss_diags_out - -contains - - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - subroutine chem_prod_loss_diags_init - - end subroutine chem_prod_loss_diags_init - - !----------------------------------------------------------------------------- - !----------------------------------------------------------------------------- - subroutine chem_prod_loss_diags_out( ncol, lchnk, base_sol, reaction_rates, prod_in, loss_in, xhnm ) - - integer, intent(in) :: ncol, lchnk - real(r8), intent(in) :: base_sol(ncol,pver,gas_pcnst) - real(r8), intent(in) :: reaction_rates(ncol,pver,max(1,rxntot)) - real(r8), intent(in) :: prod_in(ncol,pver,max(1,clscnt4)) - real(r8), intent(in) :: loss_in(ncol,pver,max(1,clscnt4)) - real(r8), intent(in) :: xhnm(ncol,pver) - - end subroutine chem_prod_loss_diags_out - -end module chem_prod_loss_diags - From ae549e22f1e3d2f02d68826221c36a5f9f3b5e2e Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 9 Jan 2023 12:41:43 -0700 Subject: [PATCH 084/160] Modifications to use Mozart short_lived_species module in GEOS-Chem Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chem_mods.F90 | 6 +- src/chemistry/geoschem/chemistry.F90 | 15 +- .../geoschem/short_lived_species.F90 | 221 ------------------ src/chemistry/mozart/short_lived_species.F90 | 70 +++++- src/chemistry/pp_none/chem_mods.F90 | 1 + src/chemistry/pp_terminator/chem_mods.F90 | 1 + src/chemistry/pp_trop_mam3/chem_mods.F90 | 1 + src/chemistry/pp_trop_mam4/chem_mods.F90 | 1 + src/chemistry/pp_trop_mam5/chem_mods.F90 | 1 + src/chemistry/pp_trop_mam7/chem_mods.F90 | 1 + src/chemistry/pp_trop_mozart/chem_mods.F90 | 1 + .../pp_trop_strat_mam4_ts2/chem_mods.F90 | 1 + .../pp_trop_strat_mam4_vbs/chem_mods.F90 | 1 + .../pp_trop_strat_mam4_vbsext/chem_mods.F90 | 1 + src/chemistry/pp_waccm_ma/chem_mods.F90 | 1 + src/chemistry/pp_waccm_ma_mam4/chem_mods.F90 | 1 + .../pp_waccm_ma_sulfur/chem_mods.F90 | 1 + src/chemistry/pp_waccm_mad/chem_mods.F90 | 1 + src/chemistry/pp_waccm_mad_mam4/chem_mods.F90 | 1 + src/chemistry/pp_waccm_sc/chem_mods.F90 | 1 + src/chemistry/pp_waccm_sc_mam4/chem_mods.F90 | 1 + .../pp_waccm_tsmlt_mam4/chem_mods.F90 | 1 + .../pp_waccm_tsmlt_mam5/chem_mods.F90 | 1 + 23 files changed, 97 insertions(+), 234 deletions(-) delete mode 100644 src/chemistry/geoschem/short_lived_species.F90 diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index 03c0805ffc..bbd21c9b2b 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -79,8 +79,8 @@ module chem_mods indexh2o = 4, & ! index of water vapor density clsze = 1, & ! loop length for implicit chemistry rxt_tag_cnt = 95, & - enthalpy_cnt = 0 -! nslvd = 0 + enthalpy_cnt = 0, & + nslvd = 86 ! number of short-lived (non-advected) species integer :: clscnt(5) = 0 integer :: cls_rxt_cnt(4,5) = 0 integer :: clsmap(gas_pcnst,5) = 0 @@ -101,8 +101,6 @@ module chem_mods logical :: frc_from_dataset(max(1,extcnt)) logical :: is_vector logical :: is_scalar -! character(len=16) :: slvd_lst(max(1,nslvd)) - integer :: nslvd character(len=255), allocatable :: slvd_lst(:) real(r8), allocatable :: slvd_ref_mmr(:) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 46dcf32309..10d11d95d8 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -890,8 +890,11 @@ subroutine chem_readnl(nlfile) CALL MPIBCAST (h2orates, LEN(h2orates), MPICHAR, 0, MPICOM) #endif - ! Update "short_lived_species" arrays - nSlvd = nSls + IF ( nSls .NE. nSlvd ) THEN + write(iulog,'(a,i4)') 'nSlvd in geoschem/chem_mods.F90 does not match # non-advected KPP species. Set nSlvd to ', nSls + CALL ENDRUN('Failure while allocating slvd_Lst') + ENDIF + ALLOCATE(slvd_Lst(nSlvd), STAT=IERR) IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating slvd_Lst') ALLOCATE(slvd_ref_MMR(nSlvd), STAT=IERR) @@ -1892,8 +1895,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Grid area use Phys_Grid, only : get_area_all_p, get_lat_all_p, get_lon_all_p - use short_lived_species, only : get_short_lived_species - use short_lived_species, only : set_short_lived_species + use short_lived_species, only : get_short_lived_species_gc + use short_lived_species, only : set_short_lived_species_gc #if defined( MODAL_AERO ) ! Aqueous chemistry and aerosol growth @@ -2163,7 +2166,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Retrieve previous value of species data SlsData(:,:,:) = 0.0e+0_r8 - CALL get_short_lived_species( SlsData, LCHNK, nY, pbuf ) + CALL get_short_lived_species_gc( SlsData, LCHNK, nY, pbuf ) IF ( iStep == 1 ) THEN ! Retrieve list of species with surface boundary conditions (copied from @@ -4051,7 +4054,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF ( M <= 0 ) CYCLE SlsData(:nY,nZ:1:-1,N) = REAL(State_Chm(LCHNK)%Species(M)%Conc(1,:nY,:nZ),r8) ENDDO - CALL set_short_lived_species( SlsData, LCHNK, nY, pbuf ) + CALL set_short_lived_species_gc( SlsData, LCHNK, nY, pbuf ) ! Apply tendencies to GEOS-Chem species DO N = 1, pcnst diff --git a/src/chemistry/geoschem/short_lived_species.F90 b/src/chemistry/geoschem/short_lived_species.F90 deleted file mode 100644 index 293aaa65cd..0000000000 --- a/src/chemistry/geoschem/short_lived_species.F90 +++ /dev/null @@ -1,221 +0,0 @@ -!--------------------------------------------------------------------- -! Manages the storage of non-transported short-lived chemical species -! in the physics buffer. -! -! Created by: Francis Vitt -- 20 Aug 2008 -!--------------------------------------------------------------------- -module short_lived_species - - use shr_kind_mod, only : r8 => shr_kind_r8 - use chem_mods, only : slvd_lst, nslvd, gas_pcnst, slvd_ref_mmr - use cam_logfile, only : iulog - use ppgrid, only : pcols, pver, begchunk, endchunk - use spmd_utils, only : masterproc - - - implicit none - - save - private - public :: register_short_lived_species - public :: short_lived_species_initic - public :: short_lived_species_writeic - public :: initialize_short_lived_species - public :: set_short_lived_species - public :: get_short_lived_species - public :: slvd_index - public :: pbf_idx - - integer :: pbf_idx - - character(len=16), parameter :: pbufname = 'ShortLivedSpecies' - -contains - -!--------------------------------------------------------------------- -!--------------------------------------------------------------------- - subroutine register_short_lived_species - use physics_buffer, only : pbuf_add_field, dtype_r8 - - implicit none - - integer :: m - - if ( nslvd < 1 ) return - - call pbuf_add_field(pbufname,'global',dtype_r8,(/pcols,pver,nslvd/),pbf_idx) - - end subroutine register_short_lived_species - -!--------------------------------------------------------------------- -!--------------------------------------------------------------------- - subroutine short_lived_species_initic -#ifdef WACCMX_IONOS - use cam_history, only : addfld, add_default - - integer :: m - character(len=24) :: varname - - do m=1,nslvd - varname = trim(slvd_lst(m))//'&IC' - call addfld (varname, (/ 'lev' /),'I','kg/kg',trim(varname)//' not-transported species',gridname='physgrid') - call add_default (varname,0, 'I') - enddo -#endif - end subroutine short_lived_species_initic - -!--------------------------------------------------------------------- -!--------------------------------------------------------------------- - subroutine short_lived_species_writeic( lchnk, pbuf ) - use cam_history, only : outfld, write_inithist - use physics_buffer, only : physics_buffer_desc, pbuf_get_field - - integer , intent(in) :: lchnk ! chunk identifier - type(physics_buffer_desc), pointer :: pbuf(:) -#ifdef WACCMX_IONOS - real(r8),pointer :: tmpptr(:,:) - integer :: m - character(len=24) :: varname - - if ( write_inithist() ) then - do m=1,nslvd - varname = trim(slvd_lst(m))//'&IC' - call pbuf_get_field(pbuf, pbf_idx, tmpptr, start=(/1,1,m/), kount=(/ pcols,pver,1 /)) - call outfld(varname, tmpptr, pcols,lchnk) - enddo - endif -#endif - end subroutine short_lived_species_writeic - -!--------------------------------------------------------------------- -!--------------------------------------------------------------------- - subroutine initialize_short_lived_species(ncid_ini, pbuf2d) - use cam_grid_support, only : cam_grid_check, cam_grid_id - use cam_grid_support, only : cam_grid_get_dim_names - use cam_abortutils, only : endrun - !use mo_tracname, only : solsym !TMMF - use ncdio_atm, only : infld - use pio, only : file_desc_t - use physics_buffer, only : physics_buffer_desc, pbuf_set_field, pbuf_get_chunk, pbuf_get_field - - implicit none - - type(file_desc_t), intent(inout) :: ncid_ini - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - - integer :: m,n,lchnk - integer :: grid_id - character(len=255) :: fieldname - character(len=4) :: dim1name, dim2name - logical :: found - real(r8),pointer :: tmpptr(:,:,:) ! temporary pointer - real(r8),pointer :: tmpptr2(:,:,:) ! temporary pointer - character(len=*), parameter :: subname='INITIALIZE_SHORT_LIVED_SPECIES' - - if ( nslvd < 1 ) return - - found = .false. - - grid_id = cam_grid_id('physgrid') - if (.not. cam_grid_check(grid_id)) then - call endrun(trim(subname)//': Internal error, no "physgrid" grid') - end if - call cam_grid_get_dim_names(grid_id, dim1name, dim2name) - - call pbuf_set_field(pbuf2d, pbf_idx, 0._r8) - - allocate(tmpptr(pcols,pver,begchunk:endchunk)) - - do m=1,nslvd - write(fieldname,'(a,a)') trim(slvd_lst(m)) - call infld( fieldname,ncid_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tmpptr, found, gridname='physgrid') - - if (.not.found) then - !tmpptr(:,:,:) = 1.e-36_r8 - tmpptr(:,:,:) = slvd_ref_mmr(m) - endif - - call pbuf_set_field(pbuf2d, pbf_idx, tmpptr, start=(/1,1,m/),kount=(/pcols,pver,1/)) - - if (MasterProc) write(iulog,'(a20,a)') TRIM(fieldname), ' is set to short-lived' - ! DEBUG: remove as this will be confusing to most due to the negative - ! dummy MW which was used to calculate the reference MMR - if (MasterProc) write(iulog,'(a, E16.5E4)') ' --> reference MMR: ', slvd_ref_mmr(m) - - enddo - - deallocate(tmpptr) - - end subroutine initialize_short_lived_species - -!--------------------------------------------------------------------- -!--------------------------------------------------------------------- - subroutine set_short_lived_species( q, lchnk, ncol, pbuf ) - - use physics_buffer, only : physics_buffer_desc, pbuf_set_field - - implicit none - - real(r8), intent(in) :: q(pcols,pver,nslvd) - integer, intent(in) :: lchnk, ncol - type(physics_buffer_desc), pointer :: pbuf(:) - - integer :: m,n - - if ( nslvd < 1 ) return - - do m=1,nslvd - call pbuf_set_field(pbuf, pbf_idx, q(:,:,m), start=(/1,1,m/),kount=(/pcols,pver,1/)) - enddo - - end subroutine set_short_lived_species - -!--------------------------------------------------------------------- -!--------------------------------------------------------------------- - subroutine get_short_lived_species( q, lchnk, ncol, pbuf ) - use physics_buffer, only : physics_buffer_desc, pbuf_get_field - - implicit none - - real(r8), intent(inout) :: q(pcols,pver,nslvd) - integer, intent(in) :: lchnk, ncol - type(physics_buffer_desc), pointer :: pbuf(:) - real(r8),pointer :: tmpptr(:,:) - - - integer :: m,n - - if ( nslvd < 1 ) return - - do m=1,nslvd - call pbuf_get_field(pbuf, pbf_idx, tmpptr, start=(/1,1,m/), kount=(/ pcols,pver,1 /)) - q(:ncol,:,m) = tmpptr(:ncol,:) - enddo - - endsubroutine get_short_lived_species - -!--------------------------------------------------------------------- -!--------------------------------------------------------------------- - function slvd_index( name ) - implicit none - - character(len=*) :: name - integer :: slvd_index - - integer :: m - - slvd_index = -1 - - if ( nslvd < 1 ) return - - do m=1,nslvd - if ( name == slvd_lst(m) ) then - slvd_index = m - return - endif - enddo - - endfunction slvd_index - -end module short_lived_species diff --git a/src/chemistry/mozart/short_lived_species.F90 b/src/chemistry/mozart/short_lived_species.F90 index 76fb30b20e..3ceff24e75 100644 --- a/src/chemistry/mozart/short_lived_species.F90 +++ b/src/chemistry/mozart/short_lived_species.F90 @@ -23,7 +23,9 @@ module short_lived_species public :: short_lived_species_writeic public :: initialize_short_lived_species public :: set_short_lived_species + public :: set_short_lived_species_gc ! for GEOS-Chem chemistry public :: get_short_lived_species + public :: get_short_lived_species_gc ! for GEOS-Chem chemistry public :: slvd_index public :: pbf_idx @@ -91,9 +93,11 @@ subroutine initialize_short_lived_species(ncid_ini, pbuf2d) use cam_grid_support, only : cam_grid_check, cam_grid_id use cam_grid_support, only : cam_grid_get_dim_names use cam_abortutils, only : endrun + use chem_mods, only : slvd_ref_mmr use mo_tracname, only : solsym use ncdio_atm, only : infld use pio, only : file_desc_t + use phys_control, only : cam_chempkg_is use physics_buffer, only : physics_buffer_desc, pbuf_set_field implicit none @@ -124,19 +128,31 @@ subroutine initialize_short_lived_species(ncid_ini, pbuf2d) allocate(tmpptr(pcols,pver,begchunk:endchunk)) do m=1,nslvd - n = map(m) - fieldname = solsym(n) + + if (cam_chempkg_is('geoschem_mam4')) then + write(fieldname,'(a,a)') trim(slvd_lst(m)) + else + n = map(m) + fieldname = solsym(n) + end if + call infld( fieldname,ncid_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & tmpptr, found, gridname='physgrid') if (.not.found) then - tmpptr(:,:,:) = 1.e-36_r8 + if ( cam_chempkg_is('geoschem_mam4') ) then + tmpptr(:,:,:) = slvd_ref_mmr(m) + else + tmpptr(:,:,:) = 1.e-36_r8 + endif endif call pbuf_set_field(pbuf2d, pbf_idx, tmpptr, start=(/1,1,m/),kount=(/pcols,pver,1/)) if (masterproc) write(iulog,*) fieldname, ' is set to short-lived' + if (cam_chempkg_is('geoschem_mam4') .and. masterproc) write(iulog,'(a, E16.5E4)') ' --> reference MMR: ', slvd_ref_mmr(m) + enddo deallocate(tmpptr) @@ -166,6 +182,29 @@ subroutine set_short_lived_species( q, lchnk, ncol, pbuf ) end subroutine set_short_lived_species +!--------------------------------------------------------------------- +!--------------------------------------------------------------------- + subroutine set_short_lived_species_gc( q, lchnk, ncol, pbuf ) + + use physics_buffer, only : physics_buffer_desc, pbuf_set_field + + implicit none + + ! 3rd dimension of out array is nslvd if using GEOS-Chem chemistry + real(r8), intent(in) :: q(pcols,pver,nslvd) + integer, intent(in) :: lchnk, ncol + type(physics_buffer_desc), pointer :: pbuf(:) + + integer :: m + + if ( nslvd < 1 ) return + + do m=1,nslvd + call pbuf_set_field(pbuf, pbf_idx, q(:,:,m), start=(/1,1,m/),kount=(/pcols,pver,1/)) + enddo + + end subroutine set_short_lived_species_gc + !--------------------------------------------------------------------- !--------------------------------------------------------------------- subroutine get_short_lived_species( q, lchnk, ncol, pbuf ) @@ -191,6 +230,31 @@ subroutine get_short_lived_species( q, lchnk, ncol, pbuf ) endsubroutine get_short_lived_species +!--------------------------------------------------------------------- +!--------------------------------------------------------------------- + subroutine get_short_lived_species_gc( q, lchnk, ncol, pbuf ) + use physics_buffer, only : physics_buffer_desc, pbuf_get_field + + implicit none + + ! 3rd dimension of out array is nslvd if using GEOS-Chem chemistry + real(r8), intent(inout) :: q(pcols,pver,nslvd) + integer, intent(in) :: lchnk, ncol + type(physics_buffer_desc), pointer :: pbuf(:) + real(r8),pointer :: tmpptr(:,:) + + + integer :: m + + if ( nslvd < 1 ) return + + do m=1,nslvd + call pbuf_get_field(pbuf, pbf_idx, tmpptr, start=(/1,1,m/), kount=(/ pcols,pver,1 /)) + q(:ncol,:,m) = tmpptr(:ncol,:) + enddo + + endsubroutine get_short_lived_species_gc + !--------------------------------------------------------------------- !--------------------------------------------------------------------- function slvd_index( name ) diff --git a/src/chemistry/pp_none/chem_mods.F90 b/src/chemistry/pp_none/chem_mods.F90 index 4dc00c6ced..845261c628 100644 --- a/src/chemistry/pp_none/chem_mods.F90 +++ b/src/chemistry/pp_none/chem_mods.F90 @@ -46,4 +46,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_terminator/chem_mods.F90 b/src/chemistry/pp_terminator/chem_mods.F90 index 31d67260c3..ceb2107303 100644 --- a/src/chemistry/pp_terminator/chem_mods.F90 +++ b/src/chemistry/pp_terminator/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_mam3/chem_mods.F90 b/src/chemistry/pp_trop_mam3/chem_mods.F90 index 69af9e22ab..645b62fba5 100644 --- a/src/chemistry/pp_trop_mam3/chem_mods.F90 +++ b/src/chemistry/pp_trop_mam3/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_mam4/chem_mods.F90 b/src/chemistry/pp_trop_mam4/chem_mods.F90 index 0b97007e7b..76424a61a3 100644 --- a/src/chemistry/pp_trop_mam4/chem_mods.F90 +++ b/src/chemistry/pp_trop_mam4/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_mam5/chem_mods.F90 b/src/chemistry/pp_trop_mam5/chem_mods.F90 index 0638b442d5..f7c002b820 100644 --- a/src/chemistry/pp_trop_mam5/chem_mods.F90 +++ b/src/chemistry/pp_trop_mam5/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_mam7/chem_mods.F90 b/src/chemistry/pp_trop_mam7/chem_mods.F90 index b40e9525b6..872c68441f 100644 --- a/src/chemistry/pp_trop_mam7/chem_mods.F90 +++ b/src/chemistry/pp_trop_mam7/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_mozart/chem_mods.F90 b/src/chemistry/pp_trop_mozart/chem_mods.F90 index 9b41d9c1cb..edae88dc29 100644 --- a/src/chemistry/pp_trop_mozart/chem_mods.F90 +++ b/src/chemistry/pp_trop_mozart/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_strat_mam4_ts2/chem_mods.F90 b/src/chemistry/pp_trop_strat_mam4_ts2/chem_mods.F90 index 70d339afc3..414491243e 100644 --- a/src/chemistry/pp_trop_strat_mam4_ts2/chem_mods.F90 +++ b/src/chemistry/pp_trop_strat_mam4_ts2/chem_mods.F90 @@ -47,5 +47,6 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 b/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 index 9af6c6de37..75737d5bf7 100644 --- a/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 +++ b/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 @@ -47,5 +47,6 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 b/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 index 81fd6d4a31..1225023e14 100644 --- a/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 +++ b/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 @@ -47,5 +47,6 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_waccm_ma/chem_mods.F90 b/src/chemistry/pp_waccm_ma/chem_mods.F90 index 4daa9f36ee..94dad43671 100644 --- a/src/chemistry/pp_waccm_ma/chem_mods.F90 +++ b/src/chemistry/pp_waccm_ma/chem_mods.F90 @@ -47,5 +47,6 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_waccm_ma_mam4/chem_mods.F90 b/src/chemistry/pp_waccm_ma_mam4/chem_mods.F90 index b3d2ff52e0..9b6c1a3141 100644 --- a/src/chemistry/pp_waccm_ma_mam4/chem_mods.F90 +++ b/src/chemistry/pp_waccm_ma_mam4/chem_mods.F90 @@ -47,5 +47,6 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_waccm_ma_sulfur/chem_mods.F90 b/src/chemistry/pp_waccm_ma_sulfur/chem_mods.F90 index 2dfcf62986..f8995051c9 100644 --- a/src/chemistry/pp_waccm_ma_sulfur/chem_mods.F90 +++ b/src/chemistry/pp_waccm_ma_sulfur/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_waccm_mad/chem_mods.F90 b/src/chemistry/pp_waccm_mad/chem_mods.F90 index c524ffab6b..ff996a00d4 100644 --- a/src/chemistry/pp_waccm_mad/chem_mods.F90 +++ b/src/chemistry/pp_waccm_mad/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_waccm_mad_mam4/chem_mods.F90 b/src/chemistry/pp_waccm_mad_mam4/chem_mods.F90 index 6c202fdba7..eb95c69127 100644 --- a/src/chemistry/pp_waccm_mad_mam4/chem_mods.F90 +++ b/src/chemistry/pp_waccm_mad_mam4/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_waccm_sc/chem_mods.F90 b/src/chemistry/pp_waccm_sc/chem_mods.F90 index b89c8308f5..cf5e4ac056 100644 --- a/src/chemistry/pp_waccm_sc/chem_mods.F90 +++ b/src/chemistry/pp_waccm_sc/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_waccm_sc_mam4/chem_mods.F90 b/src/chemistry/pp_waccm_sc_mam4/chem_mods.F90 index f75b1c9a8a..5fca9dfce2 100644 --- a/src/chemistry/pp_waccm_sc_mam4/chem_mods.F90 +++ b/src/chemistry/pp_waccm_sc_mam4/chem_mods.F90 @@ -47,4 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_waccm_tsmlt_mam4/chem_mods.F90 b/src/chemistry/pp_waccm_tsmlt_mam4/chem_mods.F90 index 336ce725db..56f1a58f89 100644 --- a/src/chemistry/pp_waccm_tsmlt_mam4/chem_mods.F90 +++ b/src/chemistry/pp_waccm_tsmlt_mam4/chem_mods.F90 @@ -47,5 +47,6 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_waccm_tsmlt_mam5/chem_mods.F90 b/src/chemistry/pp_waccm_tsmlt_mam5/chem_mods.F90 index 5cdd14dcd5..3e28b7c55f 100644 --- a/src/chemistry/pp_waccm_tsmlt_mam5/chem_mods.F90 +++ b/src/chemistry/pp_waccm_tsmlt_mam5/chem_mods.F90 @@ -47,5 +47,6 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) + real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods From 08ea9a38ae17ce4f2c7cc8d97ba6c2fc0002be91 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 10 Jan 2023 15:13:40 -0700 Subject: [PATCH 085/160] Add missing GEOS-Chem diagnostics subroutine calls; cleanup other files Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chemistry.F90 | 27 +++++++++++++++++++++++++++ src/cpl/mct/cam_cpl_indices.F90 | 8 -------- src/cpl/nuopc/atm_comp_nuopc.F90 | 18 ------------------ src/physics/cam/physpkg.F90 | 5 ----- 4 files changed, 27 insertions(+), 31 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 10d11d95d8..0ec367f543 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -1850,6 +1850,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use modal_aero_data, only : lptr2_soa_a_amode, lptr2_soa_g_amode #endif + use Diagnostics_Mod, only : Zero_Diagnostics_StartOfTimestep + use Diagnostics_Mod, only : Set_Diagnostics_EndofTimestep + use Aerosol_Mod, only : Set_AerMass_Diagnostic use Olson_Landmap_Mod, only : Compute_Olson_Landmap use Modis_LAI_Mod, only : Compute_XLAI use CMN_Size_Mod, only : NSURFTYPE @@ -2216,6 +2219,13 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDDO ENDIF + !----------------------------------------------------------------------- + ! ... Reset certain GEOS-Chem diagnostics at start of timestep + !----------------------------------------------------------------------- + CALL Zero_Diagnostics_StartOfTimestep( Input_Opt = Input_Opt, & + State_Diag = State_Diag(LCHNK), & + RC = RC ) + !----------------------------------------------------------------------- ! ... Set atmosphere mean mass !----------------------------------------------------------------------- @@ -4147,6 +4157,23 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) mmr_tend = mmr_tend, & LCHNK = LCHNK ) + CALL Set_Diagnostics_EndofTimestep( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + + + IF ( State_Diag(LCHNK)%Archive_AerMass ) THEN + CALL Set_AerMass_Diagnostic( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + RC = RC ) + ENDIF + ! Compute new GEOS-Chem diagnostics into CESM History (hplin, 10/31/22) ! Note that the containers (data pointers) actually need to be updated every time step, ! because the State_Chm(LCHNK) target changes. There is some registry lookup overhead diff --git a/src/cpl/mct/cam_cpl_indices.F90 b/src/cpl/mct/cam_cpl_indices.F90 index 2dc5b8e014..ba38a67fe4 100644 --- a/src/cpl/mct/cam_cpl_indices.F90 +++ b/src/cpl/mct/cam_cpl_indices.F90 @@ -92,10 +92,6 @@ module cam_cpl_indices integer :: index_x2a_So_re ! square of atm/ocn exch. coeff integer :: index_x2a_So_ssq ! surface saturation specific humidity in ocean integer :: index_x2a_Sl_ddvel ! dry deposition velocities from land - !ewl: comment out what Thibaud added - !integer :: index_x2a_Sl_lwtgcell ! landunit area weights - !integer :: index_x2a_Sl_pwtgcell ! patch area weights - !integer :: index_x2a_Sl_lai ! leaf area indices integer :: index_x2a_Sx_u10 ! 10m wind contains @@ -170,10 +166,6 @@ subroutine cam_cpl_indices_set( ) index_x2a_Sl_ddvel = mct_avect_indexra(x2a, trim(drydep_fields_token)) else index_x2a_Sl_ddvel = 0 - ! ewl: comment out what thibaud added - !index_x2a_Sl_lwtgcell = 0 - !index_x2a_Sl_pwtgcell = 0 - !index_x2a_Sl_lai = 0 end if index_a2x_Sa_z = mct_avect_indexra(a2x,'Sa_z') diff --git a/src/cpl/nuopc/atm_comp_nuopc.F90 b/src/cpl/nuopc/atm_comp_nuopc.F90 index 9e51d370de..87077ea3a6 100644 --- a/src/cpl/nuopc/atm_comp_nuopc.F90 +++ b/src/cpl/nuopc/atm_comp_nuopc.F90 @@ -622,8 +622,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) stop_ymd=stop_ymd, stop_tod=stop_tod, curr_ymd=curr_ymd, curr_tod=curr_tod, & cam_out=cam_out, cam_in=cam_in) - if ( masterproc) print *, "ewl: in atm_comp_nuopc.F90: after cam_init" - if (mediator_present) then if (single_column) then @@ -747,8 +745,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) end if ! end of mediator_present if-block - if ( masterproc) print *, "ewl: in atm_comp_nuopc.F90: after mediator_present block" - call shr_file_setLogUnit (shrlogunit) #if (defined _MEMTRACE) @@ -764,8 +760,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) end if - if ( masterproc) print *, "ewl: in atm_comp_nuopc.F90: end of InitializeRealize" - end subroutine InitializeRealize !=============================================================================== @@ -1013,8 +1007,6 @@ subroutine ModelAdvance(gcomp, rc) rc = ESMF_SUCCESS - if ( masterproc) print *, "ewl: At start of ModelAdvance" - !$ call omp_set_num_threads(nthrds) call shr_file_getLogUnit (shrlogunit) @@ -1114,20 +1106,14 @@ subroutine ModelAdvance(gcomp, rc) ! Run CAM (run2, run3, run4) - if ( masterproc) print *, "ewl: In ModelAdvance: before cam_run2" - call t_startf ('CAM_run2') call cam_run2( cam_out, cam_in ) call t_stopf ('CAM_run2') - if ( masterproc) print *, "ewl: In ModelAdvance: before cam_run3" - call t_startf ('CAM_run3') call cam_run3( cam_out ) call t_stopf ('CAM_run3') - if ( masterproc) print *, "ewl: In ModelAdvance: before cam_run4" - call t_startf ('CAM_run4') call cam_run4( cam_out, cam_in, rstwr, nlend, & yr_spec=yr_sync, mon_spec=mon_sync, day_spec=day_sync, sec_spec=tod_sync) @@ -1135,16 +1121,12 @@ subroutine ModelAdvance(gcomp, rc) ! Advance cam time step - if ( masterproc) print *, "ewl: In ModelAdvance: advancing timestep" - call t_startf ('CAM_adv_timestep') call advance_timestep() call t_stopf ('CAM_adv_timestep') ! Run cam radiation/clouds (run1) - if ( masterproc) print *, "ewl: In ModelAdvance: before cam_run1" - call t_startf ('CAM_run1') call cam_run1 ( cam_in, cam_out ) call t_stopf ('CAM_run1') diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index f049e06439..d2d72b2f00 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -1619,7 +1619,6 @@ subroutine tphysac (ztodt, cam_in, & !------------------------------------------ ! Call major diffusion for extended model !------------------------------------------ - if ( waccmx_is('ionosphere') .or. waccmx_is('neutral') ) then call waccmx_phys_mspd_tend (ztodt ,state ,ptend) endif @@ -1646,7 +1645,6 @@ subroutine tphysac (ztodt, cam_in, & !=================================================== ! Rayleigh friction calculation !=================================================== - call t_startf('rayleigh_friction') call rayleigh_friction_tend( ztodt, state, ptend) if ( ptend%lu ) then @@ -1701,7 +1699,6 @@ subroutine tphysac (ztodt, cam_in, & ! that cam_out%xxxdryxxx fields have already been set for CAM aerosols and cam_out ! can be added to for CARMA aerosols. if (carma_do_aerosol) then - call t_startf('carma_timestep_tend') call carma_timestep_tend(state, cam_in, cam_out, ptend, ztodt, pbuf, obklen=obklen, ustar=surfric) call physics_update(state, ptend, ztodt, tend) @@ -1714,7 +1711,6 @@ subroutine tphysac (ztodt, cam_in, & !--------------------------------------------------------------------------------- ! ... enforce charge neutrality !--------------------------------------------------------------------------------- - call charge_balance(state, pbuf) !=================================================== @@ -1807,7 +1803,6 @@ subroutine tphysac (ztodt, cam_in, & !---------------------------------------------------------------------------- ! Call ionosphere routines for extended model if mode is set to ionosphere !---------------------------------------------------------------------------- - if( waccmx_is('ionosphere') ) then call waccmx_phys_ion_elec_temp_tend(state, ptend, pbuf, ztodt) endif From f60ef7a859f12d682432683c80da16e2d92d5a37 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 11 Jan 2023 14:38:46 -0700 Subject: [PATCH 086/160] Update GEOS-Chem compset diagnostics list; fix build-namelist permissions Signed-off-by: Lizzie Lundgren --- bld/build-namelist | 0 .../use_cases/2000_geoschem.xml | 118 +++++++++- .../use_cases/2010_geoschem.xml | 113 ++++++++- .../use_cases/hist_geoschem.xml | 216 +++++++++--------- .../use_cases/hist_geoschem_nudged.xml | 216 +++++++++--------- bld/namelist_files/use_cases/sd_geoschem.xml | 211 +++++++++-------- 6 files changed, 555 insertions(+), 319 deletions(-) mode change 100644 => 100755 bld/build-namelist diff --git a/bld/build-namelist b/bld/build-namelist old mode 100644 new mode 100755 diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index 670cff6809..e7be6f4774 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -76,14 +76,118 @@ .false. .false. - - 'Q', 'U', 'V', 'OMEGA', 'T', 'PS', +'AREA', +'HEIGHT', +'T', +'U', +'V', +'Q', +'PS', +'CLOUD', +'TROPP_P', +'TROPP_T', +'TROPP_Z', +'DF_CO', +'DF_O3', +'DF_NO2', +'DF_SO4', +'DF_NIT', +'CT_O3', +'CT_OH', +'OHwgtByAirMassColumnFull', +'Chem_SO3AQ', +'Jval_Cl2O2', +'Jval_H2O2', +'Jval_NO2', +'Jval_PAN', +'JvalO3O3P', +'JvalO3O1D', +'LNO_COL_PROD', +'Prod_Ox', +'Prod_SO4', +'Prod_CO', +'Prod_H2O2', +'ProdCOfromCH4', +'ProdCOfromNMVOC', +'Loss_Ox', +'Loss_CH4', +'Loss_CO', +'LossOHbyCH4columnTrop', +'LossOHbyMCFcolumnTrop', +'LossHNO3onSeaSalt', +'ACET', +'ALD2', +'ALK4', +'BR', +'BRCL', +'BRNO3', +'BRO', +'BROX', +'BROY', +'C3H8', +'CH2O', +'CH3CL', +'CH4', +'CL', +'CLNO3', +'CLO', +'CLOX', +'CLOY', +'CO', +'DMS', +'EOH', +'H2O', +'H2O2', +'H2SO4', +'HO2', +'HOX', +'HBR', +'HCL', +'HOBR', +'HOCL', +'HNO3', +'HNO4', +'ISOP', +'MACR', +'MAP', +'MEK', +'MOH', +'MVK', +'N2O', +'N2O5', +'NHX', +'NIT', +'NO', +'NO2', +'NO3', +'NOX', +'NOY', +'O3', +'OH', +'PAN', +'PM25', +'RCHO', +'SALA', +'SALC', +'SO2', +'SO4', +'SOX', +'TOLU', +'bc_a1', +'bc_a4', +'dst_a1', +'dst_a2', +'dst_a3', +'num_a1', +'num_a2', +'num_a3', +'num_a4', +'pom_a1', +'pom_a4', +'so4_a1', +'so4_a2', +'so4_a3', - - - 'O3', 'NO', 'NO2', 'CO', 'HNO3', 'CH4', 'NIT', 'NH4', 'NH3', 'SO4', 'SO2', 'OH', - - diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index 847a245a70..56d1182cd8 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -72,9 +72,118 @@ .false. .false. - - 'Q', 'U', 'V', 'OMEGA', 'T', 'PS', +'AREA', +'HEIGHT', +'T', +'U', +'V', +'Q', +'PS', +'CLOUD', +'TROPP_P', +'TROPP_T', +'TROPP_Z', +'DF_CO', +'DF_O3', +'DF_NO2', +'DF_SO4', +'DF_NIT', +'CT_O3', +'CT_OH', +'OHwgtByAirMassColumnFull', +'Chem_SO3AQ', +'Jval_Cl2O2', +'Jval_H2O2', +'Jval_NO2', +'Jval_PAN', +'JvalO3O3P', +'JvalO3O1D', +'LNO_COL_PROD', +'Prod_Ox', +'Prod_SO4', +'Prod_CO', +'Prod_H2O2', +'ProdCOfromCH4', +'ProdCOfromNMVOC', +'Loss_Ox', +'Loss_CH4', +'Loss_CO', +'LossOHbyCH4columnTrop', +'LossOHbyMCFcolumnTrop', +'LossHNO3onSeaSalt', +'ACET', +'ALD2', +'ALK4', +'BR', +'BRCL', +'BRNO3', +'BRO', +'BROX', +'BROY', +'C3H8', +'CH2O', +'CH3CL', +'CH4', +'CL', +'CLNO3', +'CLO', +'CLOX', +'CLOY', +'CO', +'DMS', +'EOH', +'H2O', +'H2O2', +'H2SO4', +'HO2', +'HOX', +'HBR', +'HCL', +'HOBR', +'HOCL', +'HNO3', +'HNO4', +'ISOP', +'MACR', +'MAP', +'MEK', +'MOH', +'MVK', +'N2O', +'N2O5', +'NHX', +'NIT', +'NO', +'NO2', +'NO3', +'NOX', +'NOY', +'O3', +'OH', +'PAN', +'PM25', +'RCHO', +'SALA', +'SALC', +'SO2', +'SO4', +'SOX', +'TOLU', +'bc_a1', +'bc_a4', +'dst_a1', +'dst_a2', +'dst_a3', +'num_a1', +'num_a2', +'num_a3', +'num_a4', +'pom_a1', +'pom_a4', +'so4_a1', +'so4_a2', +'so4_a3', diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 6e0c1cee83..161db508ee 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -70,112 +70,118 @@ .false. .false. - - - 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', - 'LNO_COL_PROD', 'NO2_CLXF', 'SFNO', 'SFNH3', 'BRO', - 'CH3CL', 'CLO', 'CO2', 'HCL', 'HO2', 'HOCL', 'PHIS', 'Z3', - 'BENZ', 'C2H6', 'C3H8', 'CCL4', 'CFC11', 'CFC113', 'CFC12', - 'CH2O', 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'ACET', 'MOH', 'CH4', - 'CO', 'H2O2', 'HCFC22', 'HNO3', 'ISOP', 'MTPA', 'N2O', 'O3', - 'PAN', 'SO2', 'OH', 'ALK4', 'PRPE', 'BR', 'BRCL', 'BRO', 'BRNO3', - 'EOH', 'ETP', 'PRPE', 'RA3P', 'CCL4', 'H1211', 'H1301', - 'CFC11', 'CFC113', 'CFC114', 'CFC115', 'CFC12', 'CH2BR2', 'CH2O', - 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'MGLY', 'ACTA', 'MAP', 'MP', - 'CH4', 'CHBR3', 'CL', 'CL2', 'CL2O2', 'CLO', 'CLNO3', 'CO', - 'CO2', 'DMS', 'GLYC', 'GLYX', - 'H', 'H2', 'H2402', 'H2O2', 'HBR', 'HCFC141B', 'HCFC142B', 'HCFC22', - 'HCL', 'HNO3', 'HNO4', 'HOBR', 'HOCL', 'HONIT', 'HPALD1', 'HPALD2', 'HPALD3', - 'HPALD4', 'HAC', 'HC5A', 'IEPOXA', 'IEPOXB', 'IEPOXD', 'ISOP', 'IHN1', 'IHN2', 'IHN3', - 'IHN4', 'INO2B', 'INO2D', 'INPB', 'INPD', 'RIPA', 'RIPB', 'RIPC', 'RIPD', - 'MACR', 'MVKHP', 'MEK', 'MCRDH', 'MPAN', 'MVK', 'N', 'N2O', 'N2O5', 'ICN', - 'NH3', 'NH4', 'NO', 'NO2', 'NO3', 'PROPNN', 'OLND', 'OLNN', 'O', 'OCLO', - 'OCS', 'PAN', 'SO2', 'SO4', 'TOLU', 'XYLE', - 'R4O2', 'BRO2', 'ETO2', 'A3O2', 'MCO3', 'MO2', 'HO2', 'O1D', 'OH', - 'TSOA0', 'TSOA1', 'TSOA2', 'TSOA3', 'ASOAN', 'ASOA1', 'ASOA2', 'ASOA3', - 'SOAIE', 'SOAGX', - 'H2O', 'SAD_PSC', 'SAD_SULFC', 'SAD_TROP', 'SAD_AERO', 'REFF_AERO', - 'PDELDRY', 'RAD_PSC', 'RAD_SULFC', - 'HNO3_GAS', 'HNO3_STS', 'HNO3_NAT', 'NOX', 'NOY', 'CLOX', 'CLOY', - 'BROX', 'BROY', 'TCLY', 'TOTH', 'MASS', 'TBRY', 'HCL_GAS', - 'HCL_GAS', 'dgnumwet1', 'dgnumwet2', 'dgnumwet3', 'ABSORB', - 'AODVISdn', 'AODdnMODE1', 'AODVISstdn', 'AODNIRstdn', - 'AODUVstdn', 'AODdnMODE2', 'AODdnMODE3', 'AODdnDUST1', 'AODdnDUST2', - 'AODdnDUST3', 'AODVISstdn', 'AODUVstdn', 'AODNIRstdn', - 'AODNIRstdn', 'AODVISdn', 'AODUVdn', 'EXTINCTdn', 'EXTxASYMdn', - 'EXTINCTNIRdn', 'EXTINCTUVdn', - 'WD_EOH', 'WD_ETP', 'WD_RA3P', 'WD_CH2O', 'WD_ALD2', - 'WD_MGLY', 'WD_ACTA', 'WD_MAP', 'WD_MOH', 'WD_MP', - 'WD_GLYC', 'WD_H2O2', 'WD_SO4', 'WD_HBR', 'WD_HCL', - 'WD_HNO3', 'WD_HOBR', 'WD_HOCL', 'WD_HONIT', 'WD_HAC', 'WD_IEPOXA', - 'WD_IEPOXB', 'WD_IEPOXD', 'WD_MVK', 'WD_NH3', 'WD_NH4', 'WD_SO2', - 'DF_EOH', 'DF_ETP', 'DF_RA3P', 'DF_CH2O', 'DF_ALD2', 'DF_ACET', - 'DF_MGLY', 'DF_ACTA', 'DF_MAP', 'DF_MOH', 'DF_MP', 'DF_CO', - 'DF_GLYC', 'DF_H2O2', 'DF_SO4', 'DF_HNO3', 'DF_HNO4', - 'DF_HONIT', 'DF_HPALD1', 'DF_HPALD2', 'DF_HPALD3', 'DF_HPALD4', - 'DF_HAC', 'DF_IEPOXA', 'DF_IEPOXB', 'DF_IEPOXD', - 'DF_MPAN', 'DF_NH3', 'DF_NH4', 'DF_NO', - 'DF_NO2', 'DF_O3', 'DF_PAN', 'DF_SO2', - 'SO2_CLXF', 'SO2_XFRC', - 'CO_CLXF', 'NO2_CLXF', 'LNO_PROD', 'LNO_COL_PROD', - 'SFEOH', 'SFALD2', 'SFMEK', 'SFCH2O', 'SFC2H6', 'SFC3H8', - 'SFALK4', 'SFPRPE', 'SFBENZ', 'SFTOLU', 'SFXYLE', - 'SFNO', 'SFACTA', 'SFDMS', 'SFMEK', 'SFSO2', 'SFNH3', - 'SFISOP', 'SFMTPA', 'SFMOH', 'SFACET', 'SFCO', - 'MEG_ISOP', 'MEG_MOH', 'MEG_EOH', 'MEG_CH2O', 'MEG_ALD2', 'MEG_ACTA', - 'MEG_ACET', 'MEG_HCOOH', 'MEG_HCN', 'MEG_CO', 'MEG_C2H6', 'MEG_C2H4', - 'MEG_C3H8', 'MEG_ALK4', 'MEG_PRPE', 'MEG_TOLU', 'MEG_LIMO', 'MEG_MTPA', - 'MEG_MTPO', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', - 'DHNO3CHM', 'DH2O2CHM', 'DO3CHM', 'DCOCHM', 'AQ_SO2', 'GS_SO2', 'SO2_CLXF', - 'MASS', 'ABSORB', - 'JvalO3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', - 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a1', - 'ncl_a2', 'ncl_a3', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', - 'soa1_a1', 'soa2_a1', 'soa3_a1', 'soa4_a1', 'soa5_a1', 'soa1_a2', 'soa2_a2', 'soa3_a2', - 'soa4_a2', 'soa5_a2', 'bc_c1', 'bc_c4', 'dst_c1', 'dst_c2', 'dst_c3', 'ncl_c1', 'ncl_c1', - 'ncl_c2', 'ncl_c3', 'pom_c1', 'pom_c4', 'so4_c1', 'so4_c2', 'so4_c3', 'soa1_c1', 'soa2_c1', - 'soa3_c1', 'soa4_c1', 'soa5_c1', 'soa1_c2', 'soa2_c2', 'soa3_c2', 'soa4_c2', 'soa5_c2', - 'bc_a1SFWET', 'num_a1','num_a2','num_a3','num_a4','num_c1','num_c2','num_c3','num_c4', - 'bc_a1SFWET', 'bc_a4SFWET', 'dst_a1SFWET', 'dst_a2SFWET', 'dst_a3SFWET', 'ncl_a1SFWET', - 'ncl_a2SFWET', 'ncl_a3SFWET', 'pom_a1SFWET', 'pom_a4SFWET', - 'so4_a1SFWET', 'so4_a2SFWET', 'so4_a3SFWET', 'soa1_a1SFWET', 'soa1_a2SFWET', - 'soa2_a1SFWET', 'soa2_a2SFWET', 'soa3_a1SFWET', 'soa3_a2SFWET', - 'soa4_a1SFWET', 'soa4_a2SFWET', 'soa5_a1SFWET', 'soa5_a2SFWET', 'bc_c1SFWET', - 'bc_c4SFWET', 'dst_c1SFWET', 'dst_c2SFWET', 'dst_c3SFWET', - 'ncl_c1SFWET', 'ncl_c2SFWET', 'ncl_c3SFWET', 'pom_c1SFWET', 'pom_c4SFWET', - 'so4_c1SFWET', 'so4_c2SFWET', 'so4_c3SFWET', 'soa1_c1SFWET', - 'soa1_c2SFWET', 'soa2_c1SFWET', 'soa2_c2SFWET', 'soa3_c1SFWET', 'soa3_c2SFWET', - 'soa4_c1SFWET', 'soa4_c2SFWET', 'soa5_c1SFWET', 'soa5_c2SFWET', - 'bc_a1DDF', 'bc_a4DDF', 'dst_a1DDF', 'dst_a2DDF', 'dst_a3DDF', 'ncl_a1DDF', - 'ncl_a2DDF', 'ncl_a3DDF', 'pom_a1DDF', - 'pom_a4DDF', 'so4_a1DDF', 'so4_a2DDF', 'so4_a3DDF', 'soa1_a1DDF', - 'soa1_a2DDF', 'soa2_a1DDF', 'soa2_a2DDF', 'soa3_a1DDF', - 'soa3_a2DDF', 'soa4_a1DDF', 'soa4_a2DDF', 'soa5_a1DDF', 'soa5_a2DDF', - 'bc_c1DDF', 'bc_c4DDF', 'dst_c1DDF', 'dst_c2DDF', - 'dst_c3DDF', 'ncl_c1DDF', 'ncl_c2DDF', 'ncl_c3DDF', 'pom_c1DDF', - 'pom_c4DDF', 'so4_c1DDF', 'so4_c2DDF', 'so4_c3DDF', - 'soa1_c1DDF', 'soa1_c2DDF', 'soa2_c1DDF', 'soa2_c2DDF', 'soa3_c1DDF', - 'soa3_c2DDF', 'soa4_c1DDF', 'soa4_c2DDF', 'soa5_c1DDF', - 'soa5_c2DDF', 'num_a1DDF', 'num_a2DDF', 'num_a3DDF', 'num_a4DDF', - 'num_c1DDF', 'num_c2DDF', 'num_c3DDF', 'num_c4DDF', - 'bc_a4_CLXF', 'pom_a4_CLXF', 'so4_a1_CLXF', 'so4_a2_CLXF', - 'num_a1_CLXF', 'num_a2_CLXF', 'SFbc_a4', 'SFpom_a4', 'SFso4_a1', - 'SFso4_a2', 'SFnum_a1', 'SFnum_a2', 'SFnum_a3', 'so4_a1_sfgaex1', - 'so4_a2_sfgaex1', 'so4_a3_sfgaex1', 'soa1_a1_sfgaex1', 'soa1_a2_sfgaex1', - 'soa2_a1_sfgaex1', 'soa2_a2_sfgaex1', 'soa3_a1_sfgaex1', 'soa3_a2_sfgaex1', - 'soa4_a1_sfgaex1', 'soa4_a2_sfgaex1', 'soa5_a1_sfgaex1', 'soa5_a2_sfgaex1', - 'so4_a2_sfnnuc1', 'so4_c1AQH2SO4', 'so4_c2AQH2SO4', 'so4_c3AQH2SO4', - 'so4_c1AQSO4', 'so4_c2AQSO4', 'so4_c3AQSO4', 'SFdst_a1', 'SFdst_a2', 'SFdst_a3', - 'SFncl_a1', 'SFncl_a2', 'SFncl_a3', - 'TMOCS', 'TMSO2', 'TMso4_a1', 'TMso4_a2', 'TMso4_a3', - 'BURDENDUSTdn', 'BURDENPOMdn', 'BURDENSO4dn', 'BURDENSOAdn', - 'BURDENSEASALTdn','BURDENBCdn', 'PM25' +'AREA', +'HEIGHT', +'T', +'U', +'V', +'Q', +'PS', +'CLOUD', +'TROPP_P', +'TROPP_T', +'TROPP_Z', +'DF_CO', +'DF_O3', +'DF_NO2', +'DF_SO4', +'DF_NIT', +'CT_O3', +'CT_OH', +'OHwgtByAirMassColumnFull', +'Chem_SO3AQ', +'Jval_Cl2O2', +'Jval_H2O2', +'Jval_NO2', +'Jval_PAN', +'JvalO3O3P', +'JvalO3O1D', +'LNO_COL_PROD', +'Prod_Ox', +'Prod_SO4', +'Prod_CO', +'Prod_H2O2', +'ProdCOfromCH4', +'ProdCOfromNMVOC', +'Loss_Ox', +'Loss_CH4', +'Loss_CO', +'LossOHbyCH4columnTrop', +'LossOHbyMCFcolumnTrop', +'LossHNO3onSeaSalt', +'ACET', +'ALD2', +'ALK4', +'BR', +'BRCL', +'BRNO3', +'BRO', +'BROX', +'BROY', +'C3H8', +'CH2O', +'CH3CL', +'CH4', +'CL', +'CLNO3', +'CLO', +'CLOX', +'CLOY', +'CO', +'DMS', +'EOH', +'H2O', +'H2O2', +'H2SO4', +'HO2', +'HOX', +'HBR', +'HCL', +'HOBR', +'HOCL', +'HNO3', +'HNO4', +'ISOP', +'MACR', +'MAP', +'MEK', +'MOH', +'MVK', +'N2O', +'N2O5', +'NHX', +'NIT', +'NO', +'NO2', +'NO3', +'NOX', +'NOY', +'O3', +'OH', +'PAN', +'PM25', +'RCHO', +'SALA', +'SALC', +'SO2', +'SO4', +'SOX', +'TOLU', +'bc_a1', +'bc_a4', +'dst_a1', +'dst_a2', +'dst_a3', +'num_a1', +'num_a2', +'num_a3', +'num_a4', +'pom_a1', +'pom_a4', +'so4_a1', +'so4_a2', +'so4_a3', - - diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml index d5ab458374..2b1bcf64f9 100644 --- a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -125,112 +125,118 @@ .false. .false. - - - 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', - 'LNO_COL_PROD', 'NO2_CLXF', 'SFNO', 'SFNH3', 'BRO', - 'CH3CL', 'CLO', 'CO2', 'HCL', 'HO2', 'HOCL', 'PHIS', 'Z3', - 'BENZ', 'C2H6', 'C3H8', 'CCL4', 'CFC11', 'CFC113', 'CFC12', - 'CH2O', 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'ACET', 'MOH', 'CH4', - 'CO', 'H2O2', 'HCFC22', 'HNO3', 'ISOP', 'MTPA', 'N2O', 'O3', - 'PAN', 'SO2', 'OH', 'ALK4', 'PRPE', 'BR', 'BRCL', 'BRO', 'BRNO3', - 'EOH', 'ETP', 'PRPE', 'RA3P', 'CCL4', 'H1211', 'H1301', - 'CFC11', 'CFC113', 'CFC114', 'CFC115', 'CFC12', 'CH2BR2', 'CH2O', - 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'MGLY', 'ACTA', 'MAP', 'MP', - 'CH4', 'CHBR3', 'CL', 'CL2', 'CL2O2', 'CLO', 'CLNO3', 'CO', - 'CO2', 'DMS', 'GLYC', 'GLYX', - 'H', 'H2', 'H2402', 'H2O2', 'HBR', 'HCFC141B', 'HCFC142B', 'HCFC22', - 'HCL', 'HNO3', 'HNO4', 'HOBR', 'HOCL', 'HONIT', 'HPALD1', 'HPALD2', 'HPALD3', - 'HPALD4', 'HAC', 'HC5A', 'IEPOXA', 'IEPOXB', 'IEPOXD', 'ISOP', 'IHN1', 'IHN2', 'IHN3', - 'IHN4', 'INO2B', 'INO2D', 'INPB', 'INPD', 'RIPA', 'RIPB', 'RIPC', 'RIPD', - 'MACR', 'MVKHP', 'MEK', 'MCRDH', 'MPAN', 'MVK', 'N', 'N2O', 'N2O5', 'ICN', - 'NH3', 'NH4', 'NO', 'NO2', 'NO3', 'PROPNN', 'OLND', 'OLNN', 'O', 'OCLO', - 'OCS', 'PAN', 'SO2', 'SO4', 'TOLU', 'XYLE', - 'R4O2', 'BRO2', 'ETO2', 'A3O2', 'MCO3', 'MO2', 'HO2', 'O1D', 'OH', - 'TSOA0', 'TSOA1', 'TSOA2', 'TSOA3', 'ASOAN', 'ASOA1', 'ASOA2', 'ASOA3', - 'SOAIE', 'SOAGX', - 'H2O', 'SAD_PSC', 'SAD_SULFC', 'SAD_TROP', 'SAD_AERO', 'REFF_AERO', - 'PDELDRY', 'RAD_PSC', 'RAD_SULFC', - 'HNO3_GAS', 'HNO3_STS', 'HNO3_NAT', 'NOX', 'NOY', 'CLOX', 'CLOY', - 'BROX', 'BROY', 'TCLY', 'TOTH', 'MASS', 'TBRY', 'HCL_GAS', - 'HCL_GAS', 'dgnumwet1', 'dgnumwet2', 'dgnumwet3', 'ABSORB', - 'AODVISdn', 'AODdnMODE1', 'AODVISstdn', 'AODNIRstdn', - 'AODUVstdn', 'AODdnMODE2', 'AODdnMODE3', 'AODdnDUST1', 'AODdnDUST2', - 'AODdnDUST3', 'AODVISstdn', 'AODUVstdn', 'AODNIRstdn', - 'AODNIRstdn', 'AODVISdn', 'AODUVdn', 'EXTINCTdn', 'EXTxASYMdn', - 'EXTINCTNIRdn', 'EXTINCTUVdn', - 'WD_EOH', 'WD_ETP', 'WD_RA3P', 'WD_CH2O', 'WD_ALD2', - 'WD_MGLY', 'WD_ACTA', 'WD_MAP', 'WD_MOH', 'WD_MP', - 'WD_GLYC', 'WD_H2O2', 'WD_SO4', 'WD_HBR', 'WD_HCL', - 'WD_HNO3', 'WD_HOBR', 'WD_HOCL', 'WD_HONIT', 'WD_HAC', 'WD_IEPOXA', - 'WD_IEPOXB', 'WD_IEPOXD', 'WD_MVK', 'WD_NH3', 'WD_NH4', 'WD_SO2', - 'DF_EOH', 'DF_ETP', 'DF_RA3P', 'DF_CH2O', 'DF_ALD2', 'DF_ACET', - 'DF_MGLY', 'DF_ACTA', 'DF_MAP', 'DF_MOH', 'DF_MP', 'DF_CO', - 'DF_GLYC', 'DF_H2O2', 'DF_SO4', 'DF_HNO3', 'DF_HNO4', - 'DF_HONIT', 'DF_HPALD1', 'DF_HPALD2', 'DF_HPALD3', 'DF_HPALD4', - 'DF_HAC', 'DF_IEPOXA', 'DF_IEPOXB', 'DF_IEPOXD', - 'DF_MPAN', 'DF_NH3', 'DF_NH4', 'DF_NO', - 'DF_NO2', 'DF_O3', 'DF_PAN', 'DF_SO2', - 'SO2_CLXF', 'SO2_XFRC', - 'CO_CLXF', 'NO2_CLXF', 'LNO_PROD', 'LNO_COL_PROD', - 'SFEOH', 'SFALD2', 'SFMEK', 'SFCH2O', 'SFC2H6', 'SFC3H8', - 'SFALK4', 'SFPRPE', 'SFBENZ', 'SFTOLU', 'SFXYLE', - 'SFNO', 'SFACTA', 'SFDMS', 'SFMEK', 'SFSO2', 'SFNH3', - 'SFISOP', 'SFMTPA', 'SFMOH', 'SFACET', 'SFCO', - 'MEG_ISOP', 'MEG_MOH', 'MEG_EOH', 'MEG_CH2O', 'MEG_ALD2', 'MEG_ACTA', - 'MEG_ACET', 'MEG_HCOOH', 'MEG_HCN', 'MEG_CO', 'MEG_C2H6', 'MEG_C2H4', - 'MEG_C3H8', 'MEG_ALK4', 'MEG_PRPE', 'MEG_TOLU', 'MEG_LIMO', 'MEG_MTPA', - 'MEG_MTPO', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', - 'DHNO3CHM', 'DH2O2CHM', 'DO3CHM', 'DCOCHM', 'AQ_SO2', 'GS_SO2', 'SO2_CLXF', - 'MASS', 'ABSORB', - 'JvalO3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', - 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a1', - 'ncl_a2', 'ncl_a3', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', - 'soa1_a1', 'soa2_a1', 'soa3_a1', 'soa4_a1', 'soa5_a1', 'soa1_a2', 'soa2_a2', 'soa3_a2', - 'soa4_a2', 'soa5_a2', 'bc_c1', 'bc_c4', 'dst_c1', 'dst_c2', 'dst_c3', 'ncl_c1', 'ncl_c1', - 'ncl_c2', 'ncl_c3', 'pom_c1', 'pom_c4', 'so4_c1', 'so4_c2', 'so4_c3', 'soa1_c1', 'soa2_c1', - 'soa3_c1', 'soa4_c1', 'soa5_c1', 'soa1_c2', 'soa2_c2', 'soa3_c2', 'soa4_c2', 'soa5_c2', - 'bc_a1SFWET', 'num_a1','num_a2','num_a3','num_a4','num_c1','num_c2','num_c3','num_c4', - 'bc_a1SFWET', 'bc_a4SFWET', 'dst_a1SFWET', 'dst_a2SFWET', 'dst_a3SFWET', 'ncl_a1SFWET', - 'ncl_a2SFWET', 'ncl_a3SFWET', 'pom_a1SFWET', 'pom_a4SFWET', - 'so4_a1SFWET', 'so4_a2SFWET', 'so4_a3SFWET', 'soa1_a1SFWET', 'soa1_a2SFWET', - 'soa2_a1SFWET', 'soa2_a2SFWET', 'soa3_a1SFWET', 'soa3_a2SFWET', - 'soa4_a1SFWET', 'soa4_a2SFWET', 'soa5_a1SFWET', 'soa5_a2SFWET', 'bc_c1SFWET', - 'bc_c4SFWET', 'dst_c1SFWET', 'dst_c2SFWET', 'dst_c3SFWET', - 'ncl_c1SFWET', 'ncl_c2SFWET', 'ncl_c3SFWET', 'pom_c1SFWET', 'pom_c4SFWET', - 'so4_c1SFWET', 'so4_c2SFWET', 'so4_c3SFWET', 'soa1_c1SFWET', - 'soa1_c2SFWET', 'soa2_c1SFWET', 'soa2_c2SFWET', 'soa3_c1SFWET', 'soa3_c2SFWET', - 'soa4_c1SFWET', 'soa4_c2SFWET', 'soa5_c1SFWET', 'soa5_c2SFWET', - 'bc_a1DDF', 'bc_a4DDF', 'dst_a1DDF', 'dst_a2DDF', 'dst_a3DDF', 'ncl_a1DDF', - 'ncl_a2DDF', 'ncl_a3DDF', 'pom_a1DDF', - 'pom_a4DDF', 'so4_a1DDF', 'so4_a2DDF', 'so4_a3DDF', 'soa1_a1DDF', - 'soa1_a2DDF', 'soa2_a1DDF', 'soa2_a2DDF', 'soa3_a1DDF', - 'soa3_a2DDF', 'soa4_a1DDF', 'soa4_a2DDF', 'soa5_a1DDF', 'soa5_a2DDF', - 'bc_c1DDF', 'bc_c4DDF', 'dst_c1DDF', 'dst_c2DDF', - 'dst_c3DDF', 'ncl_c1DDF', 'ncl_c2DDF', 'ncl_c3DDF', 'pom_c1DDF', - 'pom_c4DDF', 'so4_c1DDF', 'so4_c2DDF', 'so4_c3DDF', - 'soa1_c1DDF', 'soa1_c2DDF', 'soa2_c1DDF', 'soa2_c2DDF', 'soa3_c1DDF', - 'soa3_c2DDF', 'soa4_c1DDF', 'soa4_c2DDF', 'soa5_c1DDF', - 'soa5_c2DDF', 'num_a1DDF', 'num_a2DDF', 'num_a3DDF', 'num_a4DDF', - 'num_c1DDF', 'num_c2DDF', 'num_c3DDF', 'num_c4DDF', - 'bc_a4_CLXF', 'pom_a4_CLXF', 'so4_a1_CLXF', 'so4_a2_CLXF', - 'num_a1_CLXF', 'num_a2_CLXF', 'SFbc_a4', 'SFpom_a4', 'SFso4_a1', - 'SFso4_a2', 'SFnum_a1', 'SFnum_a2', 'SFnum_a3', 'so4_a1_sfgaex1', - 'so4_a2_sfgaex1', 'so4_a3_sfgaex1', 'soa1_a1_sfgaex1', 'soa1_a2_sfgaex1', - 'soa2_a1_sfgaex1', 'soa2_a2_sfgaex1', 'soa3_a1_sfgaex1', 'soa3_a2_sfgaex1', - 'soa4_a1_sfgaex1', 'soa4_a2_sfgaex1', 'soa5_a1_sfgaex1', 'soa5_a2_sfgaex1', - 'so4_a2_sfnnuc1', 'so4_c1AQH2SO4', 'so4_c2AQH2SO4', 'so4_c3AQH2SO4', - 'so4_c1AQSO4', 'so4_c2AQSO4', 'so4_c3AQSO4', 'SFdst_a1', 'SFdst_a2', 'SFdst_a3', - 'SFncl_a1', 'SFncl_a2', 'SFncl_a3', - 'TMOCS', 'TMSO2', 'TMso4_a1', 'TMso4_a2', 'TMso4_a3', - 'BURDENDUSTdn', 'BURDENPOMdn', 'BURDENSO4dn', 'BURDENSOAdn', - 'BURDENSEASALTdn','BURDENBCdn', 'PM25' +'AREA', +'HEIGHT', +'T', +'U', +'V', +'Q', +'PS', +'CLOUD', +'TROPP_P', +'TROPP_T', +'TROPP_Z', +'DF_CO', +'DF_O3', +'DF_NO2', +'DF_SO4', +'DF_NIT', +'CT_O3', +'CT_OH', +'OHwgtByAirMassColumnFull', +'Chem_SO3AQ', +'Jval_Cl2O2', +'Jval_H2O2', +'Jval_NO2', +'Jval_PAN', +'JvalO3O3P', +'JvalO3O1D', +'LNO_COL_PROD', +'Prod_Ox', +'Prod_SO4', +'Prod_CO', +'Prod_H2O2', +'ProdCOfromCH4', +'ProdCOfromNMVOC', +'Loss_Ox', +'Loss_CH4', +'Loss_CO', +'LossOHbyCH4columnTrop', +'LossOHbyMCFcolumnTrop', +'LossHNO3onSeaSalt', +'ACET', +'ALD2', +'ALK4', +'BR', +'BRCL', +'BRNO3', +'BRO', +'BROX', +'BROY', +'C3H8', +'CH2O', +'CH3CL', +'CH4', +'CL', +'CLNO3', +'CLO', +'CLOX', +'CLOY', +'CO', +'DMS', +'EOH', +'H2O', +'H2O2', +'H2SO4', +'HO2', +'HOX', +'HBR', +'HCL', +'HOBR', +'HOCL', +'HNO3', +'HNO4', +'ISOP', +'MACR', +'MAP', +'MEK', +'MOH', +'MVK', +'N2O', +'N2O5', +'NHX', +'NIT', +'NO', +'NO2', +'NO3', +'NOX', +'NOY', +'O3', +'OH', +'PAN', +'PM25', +'RCHO', +'SALA', +'SALC', +'SO2', +'SO4', +'SOX', +'TOLU', +'bc_a1', +'bc_a4', +'dst_a1', +'dst_a2', +'dst_a3', +'num_a1', +'num_a2', +'num_a3', +'num_a4', +'pom_a1', +'pom_a4', +'so4_a1', +'so4_a2', +'so4_a3', - - diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index a398cc0a5e..04e5e60e5a 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -89,107 +89,118 @@ .false. .false. - - - 'AODDUST', 'AODDUST2', 'T', 'U', 'V', 'O3', 'OH', 'NO3', 'HO2', - 'LNO_COL_PROD', 'NO2_CLXF', 'SFNO', 'SFNH3', 'BRO', - 'CH3CL', 'CLO', 'CO2', 'HCL', 'HO2', 'HOCL', 'PHIS', 'Z3', - 'BENZ', 'C2H6', 'C3H8', 'CCL4', 'CFC11', 'CFC113', 'CFC12', - 'CH2O', 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'ACET', 'MOH', 'CH4', - 'CO', 'H2O2', 'HCFC22', 'HNO3', 'ISOP', 'MTPA', 'N2O', 'O3', - 'PAN', 'SO2', 'OH', 'ALK4', 'PRPE', 'BR', 'BRCL', 'BRO', 'BRNO3', - 'EOH', 'ETP', 'PRPE', 'RA3P', 'CCL4', 'H1211', 'H1301', - 'CFC11', 'CFC113', 'CFC114', 'CFC115', 'CFC12', 'CH2BR2', 'CH2O', - 'CH3BR', 'CH3CCL3', 'ALD2', 'CH3CL', 'MGLY', 'ACTA', 'MAP', 'MP', - 'CH4', 'CHBR3', 'CL', 'CL2', 'CL2O2', 'CLO', 'CLNO3', 'CO', - 'CO2', 'DMS', 'GLYC', 'GLYX', - 'H', 'H2', 'H2402', 'H2O2', 'HBR', 'HCFC141B', 'HCFC142B', 'HCFC22', - 'HCL', 'HNO3', 'HNO4', 'HOBR', 'HOCL', 'HONIT', 'HPALD1', 'HPALD2', 'HPALD3', - 'HPALD4', 'HAC', 'HC5A', 'IEPOXA', 'IEPOXB', 'IEPOXD', 'ISOP', 'IHN1', 'IHN2', 'IHN3', - 'IHN4', 'INO2B', 'INO2D', 'INPB', 'INPD', 'RIPA', 'RIPB', 'RIPC', 'RIPD', - 'MACR', 'MVKHP', 'MEK', 'MCRDH', 'MPAN', 'MVK', 'N', 'N2O', 'N2O5', 'ICN', - 'NH3', 'NH4', 'NO', 'NO2', 'NO3', 'PROPNN', 'OLND', 'OLNN', 'O', 'OCLO', - 'OCS', 'PAN', 'SO2', 'SO4', 'TOLU', 'XYLE', - 'R4O2', 'BRO2', 'ETO2', 'A3O2', 'MCO3', 'MO2', 'HO2', 'O1D', 'OH', - 'TSOA0', 'TSOA1', 'TSOA2', 'TSOA3', 'ASOAN', 'ASOA1', 'ASOA2', 'ASOA3', - 'SOAIE', 'SOAGX', - 'H2O', 'SAD_PSC', 'SAD_SULFC', 'SAD_TROP', 'SAD_AERO', 'REFF_AERO', - 'PDELDRY', 'RAD_PSC', 'RAD_SULFC', - 'HNO3_GAS', 'HNO3_STS', 'HNO3_NAT', 'NOX', 'NOY', 'CLOX', 'CLOY', - 'BROX', 'BROY', 'TCLY', 'TOTH', 'MASS', 'TBRY', 'HCL_GAS', - 'HCL_GAS', 'dgnumwet1', 'dgnumwet2', 'dgnumwet3', 'ABSORB', - 'AODVISdn', 'AODdnMODE1', 'AODVISstdn', 'AODNIRstdn', - 'AODUVstdn', 'AODdnMODE2', 'AODdnMODE3', 'AODdnDUST1', 'AODdnDUST2', - 'AODdnDUST3', 'AODVISstdn', 'AODUVstdn', 'AODNIRstdn', - 'AODNIRstdn', 'AODVISdn', 'AODUVdn', 'EXTINCTdn', 'EXTxASYMdn', - 'EXTINCTNIRdn', 'EXTINCTUVdn', - 'WD_EOH', 'WD_ETP', 'WD_RA3P', 'WD_CH2O', 'WD_ALD2', - 'WD_MGLY', 'WD_ACTA', 'WD_MAP', 'WD_MOH', 'WD_MP', - 'WD_GLYC', 'WD_H2O2', 'WD_SO4', 'WD_HBR', 'WD_HCL', - 'WD_HNO3', 'WD_HOBR', 'WD_HOCL', 'WD_HONIT', 'WD_HAC', 'WD_IEPOXA', - 'WD_IEPOXB', 'WD_IEPOXD', 'WD_MVK', 'WD_NH3', 'WD_NH4', 'WD_SO2', - 'DF_EOH', 'DF_ETP', 'DF_RA3P', 'DF_CH2O', 'DF_ALD2', 'DF_ACET', - 'DF_MGLY', 'DF_ACTA', 'DF_MAP', 'DF_MOH', 'DF_MP', 'DF_CO', - 'DF_GLYC', 'DF_H2O2', 'DF_SO4', 'DF_HNO3', 'DF_HNO4', - 'DF_HONIT', 'DF_HPALD1', 'DF_HPALD2', 'DF_HPALD3', 'DF_HPALD4', - 'DF_HAC', 'DF_IEPOXA', 'DF_IEPOXB', 'DF_IEPOXD', - 'DF_MPAN', 'DF_NH3', 'DF_NH4', 'DF_NO', - 'DF_NO2', 'DF_O3', 'DF_PAN', 'DF_SO2', - 'SO2_CLXF', 'SO2_XFRC', - 'CO_CLXF', 'NO2_CLXF', 'LNO_PROD', 'LNO_COL_PROD', - 'SFEOH', 'SFALD2', 'SFMEK', 'SFCH2O', 'SFC2H6', 'SFC3H8', - 'SFALK4', 'SFPRPE', 'SFBENZ', 'SFTOLU', 'SFXYLE', - 'SFNO', 'SFACTA', 'SFDMS', 'SFMEK', 'SFSO2', 'SFNH3', - 'SFISOP', 'SFMTPA', 'SFMOH', 'SFACET', 'SFCO', - 'MEG_ISOP', 'MEG_MOH', 'MEG_EOH', 'MEG_CH2O', 'MEG_ALD2', 'MEG_ACTA', - 'MEG_ACET', 'MEG_HCOOH', 'MEG_HCN', 'MEG_CO', 'MEG_C2H6', 'MEG_C2H4', - 'MEG_C3H8', 'MEG_ALK4', 'MEG_PRPE', 'MEG_TOLU', 'MEG_LIMO', 'MEG_MTPA', - 'MEG_MTPO', 'Dso4_a1CHM', 'Dso4_a2CHM', 'Dso4_a3CHM', 'DO3CHM', 'DCOCHM', - 'DHNO3CHM', 'DH2O2CHM', 'DO3CHM', 'DCOCHM', 'AQ_SO2', 'GS_SO2', 'SO2_CLXF', - 'MASS', 'ABSORB', - 'JvalO3O1D', 'Jval_NO2', 'Jval_PAN', 'Jval_H2O2', 'Jval_Cl2O2', - 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a1', - 'ncl_a2', 'ncl_a3', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', - 'soa1_a1', 'soa2_a1', 'soa3_a1', 'soa4_a1', 'soa5_a1', 'soa1_a2', 'soa2_a2', 'soa3_a2', - 'soa4_a2', 'soa5_a2', 'bc_c1', 'bc_c4', 'dst_c1', 'dst_c2', 'dst_c3', 'ncl_c1', 'ncl_c1', - 'ncl_c2', 'ncl_c3', 'pom_c1', 'pom_c4', 'so4_c1', 'so4_c2', 'so4_c3', 'soa1_c1', 'soa2_c1', - 'soa3_c1', 'soa4_c1', 'soa5_c1', 'soa1_c2', 'soa2_c2', 'soa3_c2', 'soa4_c2', 'soa5_c2', - 'bc_a1SFWET', 'num_a1','num_a2','num_a3','num_a4','num_c1','num_c2','num_c3','num_c4', - 'bc_a1SFWET', 'bc_a4SFWET', 'dst_a1SFWET', 'dst_a2SFWET', 'dst_a3SFWET', 'ncl_a1SFWET', - 'ncl_a2SFWET', 'ncl_a3SFWET', 'pom_a1SFWET', 'pom_a4SFWET', - 'so4_a1SFWET', 'so4_a2SFWET', 'so4_a3SFWET', 'soa1_a1SFWET', 'soa1_a2SFWET', - 'soa2_a1SFWET', 'soa2_a2SFWET', 'soa3_a1SFWET', 'soa3_a2SFWET', - 'soa4_a1SFWET', 'soa4_a2SFWET', 'soa5_a1SFWET', 'soa5_a2SFWET', 'bc_c1SFWET', - 'bc_c4SFWET', 'dst_c1SFWET', 'dst_c2SFWET', 'dst_c3SFWET', - 'ncl_c1SFWET', 'ncl_c2SFWET', 'ncl_c3SFWET', 'pom_c1SFWET', 'pom_c4SFWET', - 'so4_c1SFWET', 'so4_c2SFWET', 'so4_c3SFWET', 'soa1_c1SFWET', - 'soa1_c2SFWET', 'soa2_c1SFWET', 'soa2_c2SFWET', 'soa3_c1SFWET', 'soa3_c2SFWET', - 'soa4_c1SFWET', 'soa4_c2SFWET', 'soa5_c1SFWET', 'soa5_c2SFWET', - 'bc_a1DDF', 'bc_a4DDF', 'dst_a1DDF', 'dst_a2DDF', 'dst_a3DDF', 'ncl_a1DDF', - 'ncl_a2DDF', 'ncl_a3DDF', 'pom_a1DDF', - 'pom_a4DDF', 'so4_a1DDF', 'so4_a2DDF', 'so4_a3DDF', 'soa1_a1DDF', - 'soa1_a2DDF', 'soa2_a1DDF', 'soa2_a2DDF', 'soa3_a1DDF', - 'soa3_a2DDF', 'soa4_a1DDF', 'soa4_a2DDF', 'soa5_a1DDF', 'soa5_a2DDF', - 'bc_c1DDF', 'bc_c4DDF', 'dst_c1DDF', 'dst_c2DDF', - 'dst_c3DDF', 'ncl_c1DDF', 'ncl_c2DDF', 'ncl_c3DDF', 'pom_c1DDF', - 'pom_c4DDF', 'so4_c1DDF', 'so4_c2DDF', 'so4_c3DDF', - 'soa1_c1DDF', 'soa1_c2DDF', 'soa2_c1DDF', 'soa2_c2DDF', 'soa3_c1DDF', - 'soa3_c2DDF', 'soa4_c1DDF', 'soa4_c2DDF', 'soa5_c1DDF', - 'soa5_c2DDF', 'num_a1DDF', 'num_a2DDF', 'num_a3DDF', 'num_a4DDF', - 'num_c1DDF', 'num_c2DDF', 'num_c3DDF', 'num_c4DDF', - 'bc_a4_CLXF', 'pom_a4_CLXF', 'so4_a1_CLXF', 'so4_a2_CLXF', - 'num_a1_CLXF', 'num_a2_CLXF', 'SFbc_a4', 'SFpom_a4', 'SFso4_a1', - 'SFso4_a2', 'SFnum_a1', 'SFnum_a2', 'SFnum_a3', 'so4_a1_sfgaex1', - 'so4_a2_sfgaex1', 'so4_a3_sfgaex1', 'soa1_a1_sfgaex1', 'soa1_a2_sfgaex1', - 'soa2_a1_sfgaex1', 'soa2_a2_sfgaex1', 'soa3_a1_sfgaex1', 'soa3_a2_sfgaex1', - 'soa4_a1_sfgaex1', 'soa4_a2_sfgaex1', 'soa5_a1_sfgaex1', 'soa5_a2_sfgaex1', - 'so4_a2_sfnnuc1', 'so4_c1AQH2SO4', 'so4_c2AQH2SO4', 'so4_c3AQH2SO4', - 'so4_c1AQSO4', 'so4_c2AQSO4', 'so4_c3AQSO4', 'SFdst_a1', 'SFdst_a2', 'SFdst_a3', - 'SFncl_a1', 'SFncl_a2', 'SFncl_a3', - 'TMOCS', 'TMSO2', 'TMso4_a1', 'TMso4_a2', 'TMso4_a3', - 'BURDENDUSTdn', 'BURDENPOMdn', 'BURDENSO4dn', 'BURDENSOAdn', - 'BURDENSEASALTdn','BURDENBCdn', 'PM25' +'AREA', +'HEIGHT', +'T', +'U', +'V', +'Q', +'PS', +'CLOUD', +'TROPP_P', +'TROPP_T', +'TROPP_Z', +'DF_CO', +'DF_O3', +'DF_NO2', +'DF_SO4', +'DF_NIT', +'CT_O3', +'CT_OH', +'OHwgtByAirMassColumnFull', +'Chem_SO3AQ', +'Jval_Cl2O2', +'Jval_H2O2', +'Jval_NO2', +'Jval_PAN', +'JvalO3O3P', +'JvalO3O1D', +'LNO_COL_PROD', +'Prod_Ox', +'Prod_SO4', +'Prod_CO', +'Prod_H2O2', +'ProdCOfromCH4', +'ProdCOfromNMVOC', +'Loss_Ox', +'Loss_CH4', +'Loss_CO', +'LossOHbyCH4columnTrop', +'LossOHbyMCFcolumnTrop', +'LossHNO3onSeaSalt', +'ACET', +'ALD2', +'ALK4', +'BR', +'BRCL', +'BRNO3', +'BRO', +'BROX', +'BROY', +'C3H8', +'CH2O', +'CH3CL', +'CH4', +'CL', +'CLNO3', +'CLO', +'CLOX', +'CLOY', +'CO', +'DMS', +'EOH', +'H2O', +'H2O2', +'H2SO4', +'HO2', +'HOX', +'HBR', +'HCL', +'HOBR', +'HOCL', +'HNO3', +'HNO4', +'ISOP', +'MACR', +'MAP', +'MEK', +'MOH', +'MVK', +'N2O', +'N2O5', +'NHX', +'NIT', +'NO', +'NO2', +'NO3', +'NOX', +'NOY', +'O3', +'OH', +'PAN', +'PM25', +'RCHO', +'SALA', +'SALC', +'SO2', +'SO4', +'SOX', +'TOLU', +'bc_a1', +'bc_a4', +'dst_a1', +'dst_a2', +'dst_a3', +'num_a1', +'num_a2', +'num_a3', +'num_a4', +'pom_a1', +'pom_a4', +'so4_a1', +'so4_a2', +'so4_a3', From f9de91643febc094af55578bded6f6aae3ce5efd Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 12 Jan 2023 10:19:32 -0700 Subject: [PATCH 087/160] Update cam_physics_mesh defaults for HEMCO Signed-off-by: Lizzie Lundgren --- bld/namelist_files/namelist_defaults_cam.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 34c67a5fd7..12b2bd0290 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -779,8 +779,9 @@ atm/cam/coords/ne16np4_esmf_c210305.nc atm/cam/coords/ne30np4_esmf_c210305.nc atm/cam/coords/ne30pg3_esmf_20200428.nc -atm/cam/coords/fv0.9x1.25_esmf_141008.nc' -atm/cam/coords/fv1.9x2.5_esmf_141008.nc' +atm/cam/coords/fv0.9x1.25_esmf_c210305.nc +atm/cam/coords/fv1.9x2.5_esmf_200428.nc +atm/cam/coords/ne30np4_esmf_c210305.nc 1.00D0 From 0d98d570a6769294e82dc9f566ba78b869cdcfeb Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 20 Jan 2023 14:01:20 -0500 Subject: [PATCH 088/160] Draft commit to support HEMCO_CESM v1.1.0. - Only emissions in extfrc_lst (in mo_sim_dat) will have 3-D emissions now, as only these will have a 3-D pbuf available to save memory. This is accounted for in cesmgc_emissions_mod.F90. - The list of species with 3-D emissions in GEOS-Chem are now listed in mo_sim_dat.F90. - The number of species with 3-D emissions (length of extfrc_lst) is now specified in extcnt in chem_mods.F90. This is a preliminary commit. Further updates are needed to update the HEMCO_CESM external to the appropriate version, as well as moving up to HEMCO 3.6.0. --- .../geoschem/cesmgc_emissions_mod.F90 | 41 +++++++++++++++---- src/chemistry/geoschem/chem_mods.F90 | 2 +- src/chemistry/geoschem/mo_sim_dat.F90 | 20 ++++++++- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 index 3b4eaf35ad..4ab4304cce 100644 --- a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 @@ -52,9 +52,12 @@ MODULE CESMGC_Emissions_Mod INTEGER, ALLOCATABLE :: megan_indices_map(:) REAL(r8), ALLOCATABLE :: megan_wght_factors(:) + ! Cache for is_extfrc? + LOGICAL :: pcnst_is_extfrc(iFirstCnst:pcnst) ! no idea why the indexing is not 1:gas_pcnst or why iFirstCnst can be < 0 ! ! !REVISION HISTORY: ! 07 Oct 2020 - T. M. Fritz - Initial version +! 20 Jan 2023 - H.P. Lin - Update for 2D/3D pbuf switches !EOP !------------------------------------------------------------------------------ !BOC @@ -80,7 +83,7 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) USE PHYSICS_TYPES, ONLY : physics_state USE CONSTITUENTS, ONLY : cnst_get_ind USE PHYS_CONTROL, ONLY : phys_getopts - USE MO_CHEM_UTLS, ONLY : get_spc_ndx + USE MO_CHEM_UTLS, ONLY : get_spc_ndx, get_extfrc_ndx USE CAM_HISTORY, ONLY : addfld, add_default, horiz_only USE MO_LIGHTNING, ONLY : lightning_inti USE FIRE_EMISSIONS, ONLY : fire_emissions_init @@ -244,6 +247,12 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) !----------------------------------------------------------------------- CALL fire_emissions_init() + ! Initialize pcnst_is_extfrc cache to avoid lengthy lookups in future timesteps + ! on the get_extfrc_ndx routine. (hplin 1/20/23) + do n = iFirstCnst, pcnst + pcnst_is_extfrc(n) = (get_extfrc_ndx(trim(cnst_name(n))) > 0) + enddo + END SUBROUTINE CESMGC_Emissions_Init !EOC !------------------------------------------------------------------------------ @@ -368,16 +377,32 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS ELSE ! This is already in chunk, retrieve it pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) - CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) - IF ( .NOT. ASSOCIATED(pbuf_ik) ) THEN ! Sanity check - CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_ik not associated") - ENDIF + ! Check if we need to get 3-D, or 2-D data + IF (pcnst_is_extfrc(N)) THEN + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) + + IF ( .NOT. ASSOCIATED(pbuf_ik) ) THEN ! Sanity check + CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_ik not associated (E-1)") + ENDIF + + eflx(1:nY,:nZ,N) = pbuf_ik(1:nY,:nZ) - eflx(1:nY,:nZ,N) = pbuf_ik(1:nY,:nZ) + ! Reset pointers + pbuf_ik => NULL() + ELSE ! 2-D + CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) + + IF ( .NOT. ASSOCIATED(pbuf_i) ) THEN ! Sanity check + CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_i not associated (E-2)") + ENDIF + + eflx(1:nY,:nZ,N) = pbuf_i(1:nY) + + ! Reset pointers + pbuf_i => NULL() + ENDIF - ! Reset pointers - pbuf_ik => NULL() pbuf_chnk => NULL() !IF ( MINVAL(eflx(:nY,:nZ,N)) < 0.0e+00_r8 ) THEN diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index bbd21c9b2b..c19edcfb37 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -69,7 +69,7 @@ module chem_mods relcnt = 0, & ! number of relationship species grpcnt = 0, & ! number of group members nzcnt = 824, & ! number of non-zero matrix entries - extcnt = 0, & ! number of species with external forcing + extcnt = 34, & ! number of species with external forcing, aka 3-D emissions clscnt1 = 8, & ! number of species in explicit class clscnt2 = 0, & ! number of species in hov class clscnt3 = 0, & ! number of species in ebi class diff --git a/src/chemistry/geoschem/mo_sim_dat.F90 b/src/chemistry/geoschem/mo_sim_dat.F90 index 5bd6d5a199..13f5740645 100644 --- a/src/chemistry/geoschem/mo_sim_dat.F90 +++ b/src/chemistry/geoschem/mo_sim_dat.F90 @@ -237,9 +237,25 @@ subroutine set_sim_dat 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, 250.445000_r8, & 44.010000_r8, 33.0100000_r8, 17.0100000_r8 /) - extfrc_lst(: 1) = (/ ' ' /) + extfrc_lst(: 34) = (/ 'NO ', 'CO ', 'SO2 ', 'SO4 ', & + 'NH3 ', 'ACET ', 'ALD2 ', 'ALK4 ', & + 'C2H6 ', 'C3H8 ', 'CH2O ', 'PRPE ', & + 'MACR ', 'RCHO ', 'BCPI ', 'OCPI ', & + 'HNO2 ', 'NO2 ', 'so4_a1 ', 'num_a1 ', & + 'H2O ', 'bc_a4 ', 'pom_a4 ', 'num_a4 ', & + 'MEK ', 'POG1 ', 'POG2 ', 'MTPA ', & + 'BENZ ', 'TOLU ', 'XYLE ', 'NAP ', & + 'EOH ', 'MOH ' /) - frc_from_dataset(: 1) = (/ .false. /) + frc_from_dataset(: 34) = (/ .false., .false., .false., .false., & + .false., .false., .false., .false., & + .false., .false., .false., .false., & + .false., .false., .false., .false., & + .false., .false., .false., .false., & + .false., .false., .false., .false., & + .false., .false., .false., .false., & + .false., .false., .false., .false., & + .false., .false. /) ! crb_mass(:221) = (/ 60.055000_r8, 60.055000_r8, 12.011000_r8, 12.011000_r8, 12.011000_r8, & ! 180.165000_r8, 72.066000_r8, 72.066000_r8, 72.066000_r8, 60.055000_r8, & From 60861dca9d4c380b42605970baf4ce47a85e5be5 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 9 Feb 2023 14:11:54 -0500 Subject: [PATCH 089/160] Tag to upstream HEMCO-CESM 1.1.0 and HEMCO 3.6.0 --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 5cbbf4cbfc..d20ea57a7e 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -84,7 +84,7 @@ local_path = src/chemistry/geoschem/geoschem_src required = True [hemco] -tag = hemco-cesm1_0_hemco3_5_1 +tag = hemco-cesm1_1_0_hemco3_6_0 protocol = git repo_url = https://github.com/ESCOMP/HEMCO_CESM.git local_path = src/hemco From 99e30ec788fc125928829c8f0951ed57253d2b6e Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 13 Feb 2023 14:25:06 -0500 Subject: [PATCH 090/160] Fix automatic array indexing --- src/chemistry/geoschem/cesmgc_emissions_mod.F90 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 index 4ab4304cce..5995014efb 100644 --- a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_emissions_mod.F90 @@ -53,7 +53,7 @@ MODULE CESMGC_Emissions_Mod REAL(r8), ALLOCATABLE :: megan_wght_factors(:) ! Cache for is_extfrc? - LOGICAL :: pcnst_is_extfrc(iFirstCnst:pcnst) ! no idea why the indexing is not 1:gas_pcnst or why iFirstCnst can be < 0 + LOGICAL, ALLOCATABLE :: pcnst_is_extfrc(:) ! no idea why the indexing is not 1:gas_pcnst or why iFirstCnst can be < 0 ! ! !REVISION HISTORY: ! 07 Oct 2020 - T. M. Fritz - Initial version @@ -249,8 +249,11 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) ! Initialize pcnst_is_extfrc cache to avoid lengthy lookups in future timesteps ! on the get_extfrc_ndx routine. (hplin 1/20/23) + if(.not. allocated(pcnst_is_extfrc)) then + allocate(pcnst_is_extfrc(pcnst - iFirstCnst + 1)) + endif do n = iFirstCnst, pcnst - pcnst_is_extfrc(n) = (get_extfrc_ndx(trim(cnst_name(n))) > 0) + pcnst_is_extfrc(n - iFirstCnst + 1) = (get_extfrc_ndx(trim(cnst_name(n))) > 0) enddo END SUBROUTINE CESMGC_Emissions_Init @@ -379,7 +382,7 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS pbuf_chnk => pbuf_get_chunk(hco_pbuf2d, LCHNK) ! Check if we need to get 3-D, or 2-D data - IF (pcnst_is_extfrc(N)) THEN + IF (pcnst_is_extfrc(N - iFirstCnst + 1)) THEN CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) IF ( .NOT. ASSOCIATED(pbuf_ik) ) THEN ! Sanity check @@ -397,7 +400,8 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_i not associated (E-2)") ENDIF - eflx(1:nY,:nZ,N) = pbuf_i(1:nY) + ! note: write to nZ level here as this is surface + eflx(1:nY,nZ,N) = pbuf_i(1:nY) ! Reset pointers pbuf_i => NULL() From fb7acecad6906a187f19d380096902d92efbe76a Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 2 Mar 2023 12:08:34 -0500 Subject: [PATCH 091/160] Updates H2SO4 production rate passed to MAM4 sulfate nucleation to use actual H2SO4 production rate computed by KPP in GEOS-Chem (SO2 + OH). This commit requires GEOS-Chem 14.1.1. --- src/chemistry/geoschem/chemistry.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 0ec367f543..bbf0687e81 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -3867,8 +3867,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF ! Amount of chemically-produced H2SO4 (mol/mol) - del_h2so4_gasprod(:nY,:nZ) = vmr1(:nY,:nZ,l_H2SO4) & - - vmr0(:nY,:nZ,l_H2SO4) + ! This is archived from fullchem_mod.F90 using SO2 + OH rate from KPP (hplin, 1/25/23) + del_h2so4_gasprod(:nY,:nZ) = State_Chm(LCHNK)%H2SO4_PRDR(1,:nY,nZ:1:-1) call aero_model_gasaerexch( loffset = iFirstCnst - 1, & ncol = NCOL, & From c5f6792faeb80281d00ab3256f730fea6d4ffe3b Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 2 Mar 2023 12:17:31 -0500 Subject: [PATCH 092/160] Use online CLM albedo for CESM-GC simulations instead of offline albedo from archive --- src/chemistry/geoschem/chemistry.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 0ec367f543..7c999d079b 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -1167,7 +1167,7 @@ subroutine chem_init(phys_state, pbuf2d) ! onlineAlbedo -> True (use CLM albedo) ! -> False (read monthly-mean albedo from HEMCO) - Input_Opt%onlineAlbedo = .False. + Input_Opt%onlineAlbedo = .true. ! applyQtend: apply tendencies of water vapor to specific humidity Input_Opt%applyQtend = .False. From f501dfba11305d94b7e9d434298d3a02a4338083 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 2 Mar 2023 13:41:38 -0500 Subject: [PATCH 093/160] Set rxt_tag_cnt to 0 in GEOS-Chem as feature is unused --- src/chemistry/geoschem/chem_mods.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index bbd21c9b2b..e45464731b 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -78,7 +78,7 @@ module chem_mods indexm = 1, & ! index of total atm density in invariant array indexh2o = 4, & ! index of water vapor density clsze = 1, & ! loop length for implicit chemistry - rxt_tag_cnt = 95, & + rxt_tag_cnt = 0, & ! number of tagged reactions (unused in GEOS-Chem) enthalpy_cnt = 0, & nslvd = 86 ! number of short-lived (non-advected) species integer :: clscnt(5) = 0 From 9126efbe78796ea7675ab76a452d39ad10809ed1 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 2 Mar 2023 15:19:43 -0500 Subject: [PATCH 094/160] Update cesmgc_diag_mod for moved ucx_mod module variables --- src/chemistry/geoschem/cesmgc_diag_mod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chemistry/geoschem/cesmgc_diag_mod.F90 b/src/chemistry/geoschem/cesmgc_diag_mod.F90 index b689ef3bb5..3db38020ec 100644 --- a/src/chemistry/geoschem/cesmgc_diag_mod.F90 +++ b/src/chemistry/geoschem/cesmgc_diag_mod.F90 @@ -890,7 +890,7 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & ! !INPUT PARAMETERS: ! TYPE(OptInput), INTENT(IN) :: Input_Opt ! Input options - TYPE(ChmState), INTENT(IN) :: State_Chm ! Chemistry State object + TYPE(ChmState), INTENT(INOUT) :: State_Chm ! Chemistry State object TYPE(DgnState), INTENT(IN) :: State_Diag ! Diag State object TYPE(GrdState), INTENT(IN) :: State_Grid ! Grid State object TYPE(MetState), INTENT(IN) :: State_Met ! Meteorology State object @@ -1250,7 +1250,7 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & radTmp = 0.0e+00_r8 DO J = 1, nY DO L = 1, nZ - CALL GET_STRAT_OPT(1,J,L,1,RAER,REFF,SADSTRAT,XSASTRAT) + CALL GET_STRAT_OPT(State_Chm,1,J,L,1,RAER,REFF,SADSTRAT,XSASTRAT) outTmp(J,nZ+1-L) = SADSTRAT radTmp(J,nZ+1-L) = RAER ENDDO @@ -1263,7 +1263,7 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & outTmp = 0.0e+00_r8 DO J = 1, nY DO L = 1, nZ - CALL GET_STRAT_OPT(1,J,L,2,RAER,REFF,SADSTRAT,XSASTRAT) + CALL GET_STRAT_OPT(State_Chm,1,J,L,2,RAER,REFF,SADSTRAT,XSASTRAT) outTmp(J,nZ+1-L) = SADSTRAT radTmp(J,nZ+1-L) = RAER ENDDO From 37b34b1dd4d731d3db6ce4edf00f05c2c85fe6c8 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 2 Mar 2023 15:22:58 -0500 Subject: [PATCH 095/160] Remove LWI; remove cleanup_ucx --- src/chemistry/geoschem/chemistry.F90 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 0ec367f543..684d1ffba1 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -3204,12 +3204,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) IF ( iMaxLoc(1) == 3 ) iMaxLoc(1) = 0 ! reset ocean to 0 - ! Field : LWI - ! Description: Land/water indices - ! Unit : - - ! Dimensions : nX, nY - State_Met(LCHNK)%LWI(1,J) = FLOAT( iMaxLoc(1) ) - IF ( iMaxLoc(1) == 0 ) THEN State_Met(LCHNK)%isLand(1,J) = .False. State_Met(LCHNK)%isWater(1,J) = .True. @@ -4272,7 +4266,6 @@ subroutine chem_final use State_Met_Mod, only : Cleanup_State_Met use Error_Mod, only : Cleanup_Error use Fullchem_Mod, only : Cleanup_FullChem - use UCX_Mod, only : Cleanup_UCX use Drydep_Mod, only : Cleanup_Drydep use Carbon_Mod, only : Cleanup_Carbon use Dust_Mod, only : Cleanup_Dust @@ -4300,7 +4293,6 @@ subroutine chem_final ! Finalize GEOS-Chem - CALL Cleanup_UCX CALL Cleanup_Aerosol CALL Cleanup_Carbon CALL Cleanup_Drydep From 0fadb7bd2e5985a0f3978e462ca8a1c2fdab517e Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 2 Mar 2023 18:12:18 -0500 Subject: [PATCH 096/160] Update to upstream HEMCO-CESM 1.1.1 and HEMCO 3.6.2 --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index d20ea57a7e..857b1c7058 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -84,7 +84,7 @@ local_path = src/chemistry/geoschem/geoschem_src required = True [hemco] -tag = hemco-cesm1_1_0_hemco3_6_0 +tag = hemco-cesm1_1_1_hemco3_6_2 protocol = git repo_url = https://github.com/ESCOMP/HEMCO_CESM.git local_path = src/hemco From 9af0d172a5c3feaaf3efc7b67ae4ab8697f02e53 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 3 Mar 2023 14:44:06 -0500 Subject: [PATCH 097/160] Also run Init_UCX per State_Chm, not just once --- src/chemistry/geoschem/chemistry.F90 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 684d1ffba1..c2eba8e780 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -1609,11 +1609,17 @@ subroutine chem_init(phys_state, pbuf2d) ENDIF ENDIF + ! hplin 3/3/23: note, since we moved UCX module variables to + ! individual State_Chm variables, Init_UCX has to be called + ! for all chunks (all State_Chm) to properly initialize all + ! variables. IF ( Input_Opt%LChem ) THEN - CALL Init_UCX( Input_Opt = Input_Opt, & - State_Chm = State_Chm(BEGCHUNK), & - State_Diag = State_Diag(BEGCHUNK), & - State_Grid = maxGrid ) + DO I = BEGCHUNK, ENDCHUNK + CALL Init_UCX( Input_Opt = Input_Opt, & + State_Chm = State_Chm(I), & + State_Diag = State_Diag(I), & + State_Grid = State_Grid(I) ) + ENDDO ENDIF IF ( Input_Opt%Linear_Chem ) THEN From a6a71d62a98359f56d9c3e9b47a0c0dc4696f86f Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 3 Mar 2023 18:52:57 -0500 Subject: [PATCH 098/160] Add comments on aerosol mapping code --- src/chemistry/geoschem/chemistry.F90 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index c2eba8e780..f9b07f810a 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -2278,6 +2278,27 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDDO ! Compute ratios of bin to bulk mass + !------------------------------------------------------------------------------------------ + ! Notes for the indices used here (hplin 3/3/23): + ! + ! K = GEOS-Chem species index in State_Chm%Species(K). + ! P = constituent index for BULK lumped tracer in GEOS-Chem (BCPI, BCPO, DST1, DST4, SO4, SALA, SALC, OCPI, OCPO) + ! N = constituent index for MODAL tracer in MAM4 (bc_a1, bc_a4, ...) + ! each combination of species and mode is described by (SM, M) + ! SM = species (i.e., bc, dst, so4, ncl, pom) in mode M + ! M = mode number + ! constituent indices are used in state%q(column number,level number,constituent index) + ! chemical tracer index (NOT constituent index) is used in mo_sim_dat, e.g., adv_mass(tracer index) + ! + ! Mapping functions: maps from... ...to + ! mapCnst(constituent index) constituent index chemical tracer index + ! lmassptr_amode(SM, M) SM, M constituent index (modal) + ! map2GC(bulk constituent index) constituent index (bulk) GEOS-Chem species index (bulk) + ! map2MAM4(SM, M) SM, M (modal) constituent index (bulk) this is a N to 1 operation. + ! + ! Query functions: + ! xname_massptr(SM, M) SM, M NAME of modal aer (bc_a1, bc_a4, ...) + !------------------------------------------------------------------------------------------ binRatio = 0.0e+00_r8 DO M = 1, ntot_amode DO SM = 1, nspec_amode(M) From 5afb2934a8324ad0614dae2a891dde1e9908c1cc Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 6 Mar 2023 10:34:36 -0700 Subject: [PATCH 099/160] Change GEOS-Chem version tag to 14.1.1 Signed-off-by: Lizzie Lundgren --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 857b1c7058..b38b933ff1 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -77,7 +77,7 @@ hash = ff76a231 required = True [geoschem] -tag = 14.0.1 +tag = 14.1.1 protocol = git repo_url = https://github.com/geoschem/geos-chem.git local_path = src/chemistry/geoschem/geoschem_src From 1cb122379822256a5311d122ea453e7ef7babaa3 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 6 Mar 2023 11:12:27 -0700 Subject: [PATCH 100/160] Change names of GEOS-Chem diagnostic and emissions modules and subroutines The three GEOS-Chem modules for diagnostics and emissions are now prefixed with 'geoschem_' and contain submodules prefixed with 'GC_'. "Diag" is also expanded to "Diagnostics". Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chemistry.F90 | 56 +++++++-------- ...g_mod.F90 => geoschem_diagnostics_mod.F90} | 42 +++++------ ...ons_mod.F90 => geoschem_emissions_mod.F90} | 72 +++++++++---------- ...story_mod.F90 => geoschem_history_mod.F90} | 28 ++++---- 4 files changed, 99 insertions(+), 99 deletions(-) rename src/chemistry/geoschem/{cesmgc_diag_mod.F90 => geoschem_diagnostics_mod.F90} (98%) rename src/chemistry/geoschem/{cesmgc_emissions_mod.F90 => geoschem_emissions_mod.F90} (89%) rename src/chemistry/geoschem/{cesmgc_history_mod.F90 => geoschem_history_mod.F90} (98%) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index f282c09811..c6d43ba2df 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -37,7 +37,7 @@ module chemistry !-------------------------------------------------------------------- ! GEOS-Chem History exports module !-------------------------------------------------------------------- - use CESMGC_History_Mod + use GeosChem_History_Mod !-------------------------------------------------------------------- ! CAM modules @@ -1012,8 +1012,8 @@ subroutine chem_init(phys_state, pbuf2d) use tracer_cnst, only : tracer_cnst_init use tracer_srcs, only : tracer_srcs_init - use CESMGC_Emissions_Mod, only : CESMGC_Emissions_Init - use CESMGC_Diag_Mod, only : CESMGC_Diag_Init + use GeosChem_Emissions_Mod, only : GC_Emissions_Init + use GeosChem_Diagnostics_Mod, only : GC_Diagnostics_Init TYPE(physics_state), INTENT(IN ) :: phys_state(BEGCHUNK:ENDCHUNK) TYPE(physics_buffer_desc), POINTER, INTENT(INOUT) :: pbuf2d(:,:) @@ -1408,7 +1408,7 @@ subroutine chem_init(phys_state, pbuf2d) ! within HistoryConfig to mimic the properties of GCHP. ! ! The above original implementation is similar to GC-Classic and WRF-GC, - ! and is used by cesmgc_diag_mod for lookups for certain diagnostic + ! and is used by geoschem_diagnostics_mod for lookups for certain diagnostic ! fields for compatibility with CAM-chem outputs. ! (hplin, 10/31/22) CALL HistoryExports_SetServices(am_I_Root = masterproc, & @@ -1688,12 +1688,12 @@ subroutine chem_init(phys_state, pbuf2d) ENDIF ! Initialize diagnostics interface - CALL CESMGC_Diag_Init( Input_Opt = Input_Opt, & - State_Chm = State_Chm(BEGCHUNK), & - State_Met = State_Met(BEGCHUNK) ) + CALL GC_Diagnostics_Init( Input_Opt = Input_Opt, & + State_Chm = State_Chm(BEGCHUNK), & + State_Met = State_Met(BEGCHUNK) ) ! Initialize emissions interface - CALL CESMGC_Emissions_Init( lght_no_prd_factor = lght_no_prd_factor ) + CALL GC_Emissions_Init( lght_no_prd_factor = lght_no_prd_factor ) hco_pbuf2d => pbuf2d @@ -1887,9 +1887,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use Linear_Chem_Mod, only : TrID_GC, GC_Bry_TrID, NSCHEM use Linear_Chem_Mod, only : BrPtrDay, BrPtrNight, PLVEC, GMI_OH - use CESMGC_Emissions_Mod,only : CESMGC_Emissions_Calc - use CESMGC_Diag_Mod, only : CESMGC_Diag_Calc - use CESMGC_Diag_Mod, only : wetdep_name, wtrate_name + use GeosChem_Emissions_Mod, only : GC_Emissions_Calc + use GeosChem_Diagnostics_Mod, only : GC_Diagnostics_Calc + use GeosChem_Diagnostics_Mod, only : wetdep_name, wtrate_name use Tropopause, only : Tropopause_findChemTrop, Tropopause_Find use HCO_Interface_GC_Mod ! Utility routines for GC-HEMCO interface @@ -3644,12 +3644,12 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Add surface emissions to cam_in !----------------------------------------------------------------------- - CALL CESMGC_Emissions_Calc( state = state, & - hco_pbuf2d = hco_pbuf2d, & - State_Met = State_Met(LCHNK), & - cam_in = cam_in, & - eflx = eflx, & - iStep = iStep ) + CALL GC_Emissions_Calc( state = state, & + hco_pbuf2d = hco_pbuf2d, & + State_Met = State_Met(LCHNK), & + cam_in = cam_in, & + eflx = eflx, & + iStep = iStep ) !----------------------------------------------------------------------- ! Add dry deposition flux @@ -4168,15 +4168,15 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ptend%q(:,:,cQ) = ptend%q(:,:,cH2O) ENDIF - CALL CESMGC_Diag_Calc( Input_Opt = Input_Opt, & - State_Chm = State_Chm(LCHNK), & - State_Diag = State_Diag(LCHNK), & - State_Grid = State_Grid(LCHNK), & - State_Met = State_Met(LCHNK), & - cam_in = cam_in, & - state = state, & - mmr_tend = mmr_tend, & - LCHNK = LCHNK ) + CALL GC_Diagnostics_Calc( Input_Opt = Input_Opt, & + State_Chm = State_Chm(LCHNK), & + State_Diag = State_Diag(LCHNK), & + State_Grid = State_Grid(LCHNK), & + State_Met = State_Met(LCHNK), & + cam_in = cam_in, & + state = state, & + mmr_tend = mmr_tend, & + LCHNK = LCHNK ) CALL Set_Diagnostics_EndofTimestep( Input_Opt = Input_Opt, & State_Chm = State_Chm(LCHNK), & @@ -4310,7 +4310,7 @@ subroutine chem_final use Diag_Mod, only : Cleanup_Diag #endif - use CESMGC_Emissions_Mod, only: CESMGC_Emissions_Final + use GeosChem_Emissions_Mod, only: GC_Emissions_Final ! Local variables INTEGER :: I, RC @@ -4335,7 +4335,7 @@ subroutine chem_final CALL Cleanup_Sulfate CALL Cleanup_Linear_Chem - CALL CESMGC_Emissions_Final + CALL GC_Emissions_Final CALL Cleanup_CMN_FJX( RC ) IF ( RC /= GC_SUCCESS ) THEN diff --git a/src/chemistry/geoschem/cesmgc_diag_mod.F90 b/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 similarity index 98% rename from src/chemistry/geoschem/cesmgc_diag_mod.F90 rename to src/chemistry/geoschem/geoschem_diagnostics_mod.F90 index 3db38020ec..1b729121f1 100644 --- a/src/chemistry/geoschem/cesmgc_diag_mod.F90 +++ b/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 @@ -1,17 +1,17 @@ !------------------------------------------------------------------------------ -! "GEOS-Chem" chemistry diagnostics interface ! +! GEOS-Chem chemistry diagnostics interface ! !------------------------------------------------------------------------------ !BOP ! -! !MODULE: cesmgc_diag_mod.F90 +! !MODULE: geoschem_diagnostics_mod.F90 ! -! !DESCRIPTION: Module cesmgc\_diag\_mod contains routines which aim to +! !DESCRIPTION: Module geoschem\_diagnostics\_mod contains routines which aim to ! diagnose variables from GEOS-Chem !\\ !\\ ! !INTERFACE: ! -MODULE CESMGC_Diag_Mod +MODULE GeosChem_Diagnostics_Mod ! ! !USES: ! @@ -36,8 +36,8 @@ MODULE CESMGC_Diag_Mod ! ! !PUBLIC MEMBER FUNCTIONS: ! - PUBLIC :: CESMGC_Diag_Init - PUBLIC :: CESMGC_Diag_Calc + PUBLIC :: GC_Diagnostics_Init + PUBLIC :: GC_Diagnostics_Calc PUBLIC :: wetdep_name, wtrate_name CHARACTER(LEN=fieldname_len) :: srcnam(gas_pcnst) ! Names of source/sink tendencies @@ -137,15 +137,15 @@ MODULE CESMGC_Diag_Mod !------------------------------------------------------------------------------ !BOP ! -! !IROUTINE: cesmgc_diag_init +! !IROUTINE: gc_diagnostics_init ! -! !DESCRIPTION: Subroutine CESMGC\_Diag\_Init declares the variables to +! !DESCRIPTION: Subroutine GC\_Diagnostics\_Init declares the variables to ! diagnosethe !\\ !\\ ! !INTERFACE: ! - SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) + SUBROUTINE GC_Diagnostics_Init( Input_Opt, State_Chm, State_Met ) ! ! !USES: ! @@ -220,7 +220,7 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) TYPE(RegItem ), POINTER :: Item !================================================================= - ! CESMGC_Diag_Init begins here! + ! GC_Diagnostics_Init begins here! !================================================================= ! Initialize pointers @@ -845,22 +845,22 @@ SUBROUTINE CESMGC_Diag_Init( Input_Opt, State_Chm, State_Met ) Current => NULL() Item => NULL() - END SUBROUTINE CESMGC_Diag_Init + END SUBROUTINE GC_Diagnostics_Init !EOC !------------------------------------------------------------------------------ !BOP ! -! !IROUTINE: cesmgc_diag_calc +! !IROUTINE: gc_diagnostics_calc ! -! !DESCRIPTION: Subroutine CESMGC\_Diag\_Calc passes the diagnostics variable +! !DESCRIPTION: Subroutine GC\_Diagnostics\_Calc passes the diagnostics variable ! to the CAM History routines !\\ !\\ ! !INTERFACE: ! - SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & - State_Grid, State_Met, cam_in, state, & - mmr_tend, LCHNK ) + SUBROUTINE GC_Diagnostics_Calc( Input_Opt, State_Chm, State_Diag, & + State_Grid, State_Met, cam_in, state, & + mmr_tend, LCHNK ) ! ! !USES: ! @@ -947,7 +947,7 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & TYPE(RegItem ), POINTER :: Item !================================================================= - ! CESMGC_Diag_Calc begins here! + ! GC_Diagnostics_Calc begins here! !================================================================= nY = State_Grid%nY @@ -959,8 +959,8 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & Item => NULL() ! For error trapping - ErrMsg = '' - ThisLoc = ' -> at CESMGC_Diag_Calc (in chemistry/geoschem/cesmgc_diag_mod.F90)' + ErrMsg = '' + ThisLoc = ' -> at GC_Diagnostics_Calc (in chemistry/geoschem/geoschem_diagnostics_mod.F90)' ! Define rootChunk rootChunk = ( MasterProc.and.(LCHNK==BEGCHUNK) ) @@ -1438,8 +1438,8 @@ SUBROUTINE CESMGC_Diag_Calc( Input_Opt, State_Chm, State_Diag, & Ptr2d_8 => NULL() Ptr3d_8 => NULL() - END SUBROUTINE CESMGC_Diag_Calc + END SUBROUTINE GC_Diagnostics_Calc !EOC !------------------------------------------------------------------------------ - END MODULE CESMGC_Diag_Mod + END MODULE GeosChem_Diagnostics_Mod diff --git a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 b/src/chemistry/geoschem/geoschem_emissions_mod.F90 similarity index 89% rename from src/chemistry/geoschem/cesmgc_emissions_mod.F90 rename to src/chemistry/geoschem/geoschem_emissions_mod.F90 index 5995014efb..4859aee573 100644 --- a/src/chemistry/geoschem/cesmgc_emissions_mod.F90 +++ b/src/chemistry/geoschem/geoschem_emissions_mod.F90 @@ -3,15 +3,15 @@ !------------------------------------------------------------------------------ !BOP ! -! !MODULE: cesmgc_emissions_mod.F90 +! !MODULE: geoschem_emissions_mod.F90 ! -! !DESCRIPTION: Module cesmgc\_emissions\_mod contains routines which retrieve +! !DESCRIPTION: Module geoschem\_emissions\_mod contains routines which retrieve ! emission fluxes from HEMCO and transfers it back to the CESM-GC interface !\\ !\\ ! !INTERFACE: ! -MODULE CESMGC_Emissions_Mod +MODULE GeosChem_Emissions_Mod ! ! !USES: ! @@ -30,9 +30,9 @@ MODULE CESMGC_Emissions_Mod ! ! !PUBLIC MEMBER FUNCTIONS: ! - PUBLIC :: CESMGC_Emissions_Init - PUBLIC :: CESMGC_Emissions_Calc - PUBLIC :: CESMGC_Emissions_Final + PUBLIC :: GC_Emissions_Init + PUBLIC :: GC_Emissions_Calc + PUBLIC :: GC_Emissions_Final ! Constituent number for NO INTEGER :: iNO @@ -68,15 +68,15 @@ MODULE CESMGC_Emissions_Mod !------------------------------------------------------------------------------ !BOP ! -! !IROUTINE: cesmgc_emissions_init +! !IROUTINE: gc_emissions_init ! -! !DESCRIPTION: Subroutine CESMGC\_Emissions\_Init initializes the emissions +! !DESCRIPTION: Subroutine GC\_Emissions\_Init initializes the emissions ! routine !\\ !\\ ! !INTERFACE: ! - SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) + SUBROUTINE GC_Emissions_Init( lght_no_prd_factor ) ! ! !USES: ! @@ -117,7 +117,7 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) REAL(r8) :: MW !================================================================= - ! CESMGC_Emissions_Init begins here! + ! GC_Emissions_Init begins here! !================================================================= CALL phys_getopts( history_aerosol_out = history_aerosol, & @@ -256,21 +256,21 @@ SUBROUTINE CESMGC_Emissions_Init( lght_no_prd_factor ) pcnst_is_extfrc(n - iFirstCnst + 1) = (get_extfrc_ndx(trim(cnst_name(n))) > 0) enddo - END SUBROUTINE CESMGC_Emissions_Init + END SUBROUTINE GC_Emissions_Init !EOC !------------------------------------------------------------------------------ !BOP ! -! !IROUTINE: cesmgc_emissions_calc +! !IROUTINE: gc_emissions_calc ! -! !DESCRIPTION: Subroutine CESMGC\_Emissions\_Calc retrieves emission fluxes +! !DESCRIPTION: Subroutine GC\_Emissions\_Calc retrieves emission fluxes ! from HEMCO and returns a 3-D array of emission flux to the CESM-GC ! interface. On top of passing data, this routine handles a number of checks. !\\ !\\ ! !INTERFACE: ! - SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iStep ) + SUBROUTINE GC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iStep ) ! ! !USES: ! @@ -352,7 +352,7 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS CHARACTER(LEN=255) :: fldname_ns ! field name HCO_* !================================================================= - ! CESMGC_Emissions_Calc begins here! + ! GC_Emissions_Calc begins here! !================================================================= ! Initialize pointers @@ -375,7 +375,7 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS tmpIdx = pbuf_get_index(fldname_ns, RC) IF ( tmpIdx < 0 .OR. ( iStep == 1 ) ) THEN - IF ( rootChunk ) Write(iulog,'(a,a)') " CESMGC_Emissions_Calc: Field not found ", & + IF ( rootChunk ) Write(iulog,'(a,a)') " GC_Emissions_Calc: Field not found ", & TRIM(fldname_ns) ELSE ! This is already in chunk, retrieve it @@ -386,7 +386,7 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_ik) IF ( .NOT. ASSOCIATED(pbuf_ik) ) THEN ! Sanity check - CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_ik not associated (E-1)") + CALL ENDRUN("GC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_ik not associated (E-1)") ENDIF eflx(1:nY,:nZ,N) = pbuf_ik(1:nY,:nZ) @@ -397,7 +397,7 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) IF ( .NOT. ASSOCIATED(pbuf_i) ) THEN ! Sanity check - CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_i not associated (E-2)") + CALL ENDRUN("GC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_i not associated (E-2)") ENDIF ! note: write to nZ level here as this is surface @@ -410,16 +410,16 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS pbuf_chnk => NULL() !IF ( MINVAL(eflx(:nY,:nZ,N)) < 0.0e+00_r8 ) THEN - ! Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO emission flux is negative for ", & + ! Write(iulog,*) " GC_Emissions_Calc: HEMCO emission flux is negative for ", & ! TRIM(cnst_name(N)), " with value ", MINVAL(eflx(:nY,:nZ,N)), " at ", & ! MINLOC(eflx(:nY,:nZ,N)) !ENDIF IF ( rootChunk .AND. (iStep == 2) .AND. ( MAXVAL(eflx(:nY,:nZ,N)) > 0.0e+0_r8 ) ) THEN ! Only print this once - Write(iulog,'(a,a,a,a)') " CESMGC_Emissions_Calc: HEMCO flux ", & + Write(iulog,'(a,a,a,a)') " GC_Emissions_Calc: HEMCO flux ", & TRIM(fldname_ns), " added to ", TRIM(cnst_name(N)) - Write(iulog,'(a,a,E16.4)') " CESMGC_Emissions_Calc: Maximum flux ", & + Write(iulog,'(a,a,E16.4)') " GC_Emissions_Calc: Maximum flux ", & TRIM(fldname_ns), MAXVAL(eflx(:nY,:nZ,N)) ENDIF ENDIF @@ -449,20 +449,20 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) IF ( .NOT. ASSOCIATED(pbuf_i) ) THEN ! Sanity check - CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_i not associated (2)") + CALL ENDRUN("GC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_i not associated (2)") ENDIF ! apply loss flux to surface (level nZ) eflx(1:NY,nZ,id_O3) = eflx(1:NY,nZ,id_O3) - pbuf_i(1:nY) !IF ( MINVAL(eflx(:nY,nZ,id_O3)) < 0.0e+00_r8 ) THEN - ! Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO sfc flux after ParaNOx is negative for O3 with value ", MINVAL(eflx(:nY,:nZ,id_O3)), " at ", & + ! Write(iulog,*) " GC_Emissions_Calc: HEMCO sfc flux after ParaNOx is negative for O3 with value ", MINVAL(eflx(:nY,:nZ,id_O3)), " at ", & ! MINLOC(eflx(:nY,nZ,id_O3)) !ENDIF IF ( rootChunk .and. ( MINVAL(pbuf_i(1:nY)) < 0.0e+0_r8 ) ) THEN - Write(iulog,'(a,a,a,a)') " CESMGC_Emissions_Calc: HEMCO dflx(paranox) O3 added to ", TRIM(cnst_name(id_O3)) - Write(iulog,'(a,a,E16.4)') " CESMGC_Emissions_Calc: Minval dflx(paranox), eflx(sfc) O3 ", MINVAL(pbuf_i(1:nY)), MINVAL(eflx(:nY,nZ,id_O3)) + Write(iulog,'(a,a,a,a)') " GC_Emissions_Calc: HEMCO dflx(paranox) O3 added to ", TRIM(cnst_name(id_O3)) + Write(iulog,'(a,a,E16.4)') " GC_Emissions_Calc: Minval dflx(paranox), eflx(sfc) O3 ", MINVAL(pbuf_i(1:nY)), MINVAL(eflx(:nY,nZ,id_O3)) ENDIF ! Reset pointers @@ -478,19 +478,19 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS CALL pbuf_get_field(pbuf_chnk, tmpIdx, pbuf_i) IF ( .NOT. ASSOCIATED(pbuf_i) ) THEN ! Sanity check - CALL ENDRUN("CESMGC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_i not associated (3)") + CALL ENDRUN("GC_Emissions_Calc: FATAL - tmpIdx > 0 but pbuf_i not associated (3)") ENDIF eflx(1:NY,nZ,id_HNO3) = eflx(1:NY,nZ,id_HNO3) - pbuf_i(1:nY) !IF ( MINVAL(eflx(:nY,nZ,id_HNO3)) < 0.0e+00_r8 ) THEN - ! Write(iulog,*) " CESMGC_Emissions_Calc: HEMCO sfc flux after ParaNOx is negative for HNO3 with value ", MINVAL(eflx(:nY,nZ,id_HNO3)), " at ", & + ! Write(iulog,*) " GC_Emissions_Calc: HEMCO sfc flux after ParaNOx is negative for HNO3 with value ", MINVAL(eflx(:nY,nZ,id_HNO3)), " at ", & ! MINLOC(eflx(:nY,nZ,id_HNO3)) !ENDIF IF ( rootChunk .and. ( MINVAL(pbuf_i(1:nY)) < 0.0e+0_r8 ) ) THEN - Write(iulog,'(a,a,a,a)') " CESMGC_Emissions_Calc: HEMCO dflx(paranox) HNO3 added to ", TRIM(cnst_name(id_HNO3)) - Write(iulog,'(a,a,E16.4)') " CESMGC_Emissions_Calc: Minval dflx(paranox), eflx(sfc) HNO3 ", MINVAL(pbuf_i(1:nY)), MINVAL(eflx(:nY,nZ,id_HNO3)) + Write(iulog,'(a,a,a,a)') " GC_Emissions_Calc: HEMCO dflx(paranox) HNO3 added to ", TRIM(cnst_name(id_HNO3)) + Write(iulog,'(a,a,E16.4)') " GC_Emissions_Calc: Minval dflx(paranox), eflx(sfc) HNO3 ", MINVAL(pbuf_i(1:nY)), MINVAL(eflx(:nY,nZ,id_HNO3)) ENDIF ! Reset pointers @@ -607,19 +607,19 @@ SUBROUTINE CESMGC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iS cam_in%cflx(1:nY,:) = cam_in%cflx(1:nY,:) + eflx(1:nY,nZ,:) eflx(1:nY,nZ,:) = 0.0e+00_r8 - END SUBROUTINE CESMGC_Emissions_Calc + END SUBROUTINE GC_Emissions_Calc !EOC !------------------------------------------------------------------------------ !BOP ! -! !IROUTINE: cesmgc_emissions_final +! !IROUTINE: gc_emissions_final ! -! !DESCRIPTION: Subroutine CESMGC\_Emissions\_Final cleans up the module +! !DESCRIPTION: Subroutine GC\_Emissions\_Final cleans up the module !\\ !\\ ! !INTERFACE: ! - SUBROUTINE CESMGC_Emissions_Final + SUBROUTINE GC_Emissions_Final ! ! !REVISION HISTORY: ! 07 Oct 2020 - T. M. Fritz - Initial version @@ -628,14 +628,14 @@ SUBROUTINE CESMGC_Emissions_Final !BOC ! !================================================================= - ! CESMGC_Emissions_Final begins here! + ! GC_Emissions_Final begins here! !================================================================= IF ( ALLOCATED( megan_indices_map ) ) DEALLOCATE( megan_indices_map ) IF ( ALLOCATED( megan_wght_factors ) ) DEALLOCATE( megan_wght_factors ) - END SUBROUTINE CESMGC_Emissions_Final + END SUBROUTINE GC_Emissions_Final !EOC !------------------------------------------------------------------------------ !EOC - END MODULE CESMGC_Emissions_Mod + END MODULE GeosChem_Emissions_Mod diff --git a/src/chemistry/geoschem/cesmgc_history_mod.F90 b/src/chemistry/geoschem/geoschem_history_mod.F90 similarity index 98% rename from src/chemistry/geoschem/cesmgc_history_mod.F90 rename to src/chemistry/geoschem/geoschem_history_mod.F90 index 5e221cdafb..fb722c44a5 100644 --- a/src/chemistry/geoschem/cesmgc_history_mod.F90 +++ b/src/chemistry/geoschem/geoschem_history_mod.F90 @@ -1,4 +1,4 @@ -#define _ASSERT(cond,msg) if(.not.cond) then; print *, "assertion error: ", Iam, __LINE__; call endrun("assertion error - look above - in cesmgc_history_mod.F90"); endif +#define _ASSERT(cond,msg) if(.not.cond) then; print *, "assertion error: ", Iam, __LINE__; call endrun("assertion error - look above - in geoschem_history_mod.F90"); endif #define _Iam_(name) character(len=255) :: Iam=name #define __Iam__(name) integer :: STATUS; _Iam_(name) ! Above are compatibility shorthands to avoid excessive divergence from @@ -8,9 +8,9 @@ !------------------------------------------------------------------------------ !BOP ! -! !MODULE: cesmgc_history_mod.F90 +! !MODULE: geoschem_history_mod.F90 ! -! !DESCRIPTION: Module CESMGC\_History\_Mod interfaces between the CAM history +! !DESCRIPTION: Module GeosChem\_History\_Mod interfaces between the CAM history ! component, the HISTORY.rc configuration file, and the GEOS-Chem State registry. ! This module is based off GCHP\_HistoryExports\_Mod originally developed by ! Lizzie Lundgren for GCHP. @@ -18,7 +18,7 @@ !\\ ! !INTERFACE: ! -MODULE CESMGC_History_Mod +MODULE GeosChem_History_Mod ! ! !USES: ! @@ -151,7 +151,7 @@ SUBROUTINE Init_HistoryConfig ( am_I_Root, HistoryConfig, configFile, RC ) !EOP !------------------------------------------------------------------------------ !BOC - __Iam__('Init_HistoryConfig (cesmgc_history_mod.F90)') + __Iam__('Init_HistoryConfig (geoschem_history_mod.F90)') RC = GC_SUCCESS ALLOCATE(HistoryConfig) HistoryConfig%ROOT = '' @@ -237,7 +237,7 @@ SUBROUTINE Init_HistoryExportsList ( am_I_Root, HistoryConfig, RC ) ! ================================================================ ! Init_HistoryExportsList begins here ! ================================================================ - __Iam__('Init_HistoryExportsList (cesmgc_history_mod.F90)') + __Iam__('Init_HistoryExportsList (geoschem_history_mod.F90)') RC = GC_SUCCESS ! Init @@ -425,7 +425,7 @@ SUBROUTINE Init_HistoryExport ( am_I_Root, NewHistExp, name, & !EOP !------------------------------------------------------------------------------ !BOC - __Iam__('Init_HistoryExport (cesmgc_history_mod.F90)') + __Iam__('Init_HistoryExport (geoschem_history_mod.F90)') RC = GC_SUCCESS ALLOCATE(NewHistExp) @@ -560,7 +560,7 @@ SUBROUTINE Append_HistoryExportsList ( am_I_Root, HistoryExport, & ! ================================================================ ! Append_HistoryExportsList begins here ! ================================================================ - __Iam__('Append_HistoryExportsList (cesmgc_history_mod.F90)') + __Iam__('Append_HistoryExportsList (geoschem_history_mod.F90)') RC = GC_SUCCESS ! Add new object to the beginning of the linked list @@ -610,7 +610,7 @@ SUBROUTINE Check_HistoryExportsList ( am_I_Root, name, & ! TYPE(HistoryExportObj), POINTER :: current - __Iam__('Check_HistoryExportsList (cesmgc_history_mod.F90)') + __Iam__('Check_HistoryExportsList (geoschem_history_mod.F90)') RC = GC_SUCCESS ! Assume not found @@ -682,7 +682,7 @@ SUBROUTINE HistoryExports_SetServices( am_I_Root, config_file, & ! ================================================================ ! For error handling (defines Iam and STATUS) - __Iam__('HistoryExports_SetServices (cesmgc_history_mod.F90)') + __Iam__('HistoryExports_SetServices (geoschem_history_mod.F90)') RC = GC_SUCCESS ! Create a config object if it does not already exist @@ -817,7 +817,7 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig ! ================================================================ ! CopyGCStates2Exports begins here ! ================================================================ - __Iam__('CopyGCStates2Exports (cesmgc_history_mod.F90)') + __Iam__('CopyGCStates2Exports (geoschem_history_mod.F90)') RC = GC_SUCCESS ! Loop over the History Exports list @@ -939,7 +939,7 @@ SUBROUTINE Print_HistoryExportsList( am_I_Root, HistoryConfig, RC ) ! ================================================================ ! Print_HistoryExportsList begins here ! ================================================================ - __Iam__('Print_HistoryExportsList (cesmgc_history_mod.F90)') + __Iam__('Print_HistoryExportsList (geoschem_history_mod.F90)') RC = GC_SUCCESS ! Loop over the History Exports list @@ -1158,7 +1158,7 @@ SUBROUTINE Destroy_HistoryConfig ( am_I_Root, HistoryConfig, RC ) ! ================================================================ ! Destroy_HistoryConfig begins here ! ================================================================ - __Iam__('Destroy_HistoryConfig (cesmgc_history_mod.F90)') + __Iam__('Destroy_HistoryConfig (geoschem_history_mod.F90)') current => NULL() next => NULL() @@ -1188,4 +1188,4 @@ SUBROUTINE Destroy_HistoryConfig ( am_I_Root, HistoryConfig, RC ) END SUBROUTINE Destroy_HistoryConfig !EOC -END MODULE CESMGC_History_Mod \ No newline at end of file +END MODULE GeosChem_History_Mod From 99a66984ac2619a5cc243e84a0887c78c01799d2 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 6 Mar 2023 14:36:53 -0700 Subject: [PATCH 101/160] Move short-lived reference MMR array from chem_mods to short-lived module Reference mixing ratios for short-lived species can now be passed to subroutine register_short_lived_species as an optional argument. If passed then the new module variable for reference values will be allocated and set using the values. Later during initialization these values will be used if the module array is allocated. Also added is a new finalize subroutine for the short_lived_species module so that the module array is deallocated. Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chem_mods.F90 | 2 -- src/chemistry/geoschem/chemistry.F90 | 30 +++++++++---------- src/chemistry/mozart/chemistry.F90 | 2 ++ src/chemistry/mozart/short_lived_species.F90 | 26 ++++++++++++---- src/chemistry/pp_none/chem_mods.F90 | 1 - src/chemistry/pp_terminator/chem_mods.F90 | 1 - src/chemistry/pp_trop_mam3/chem_mods.F90 | 1 - src/chemistry/pp_trop_mam4/chem_mods.F90 | 1 - src/chemistry/pp_trop_mam5/chem_mods.F90 | 1 - src/chemistry/pp_trop_mam7/chem_mods.F90 | 1 - src/chemistry/pp_trop_mozart/chem_mods.F90 | 1 - .../pp_trop_strat_mam4_ts2/chem_mods.F90 | 1 - .../pp_trop_strat_mam4_vbs/chem_mods.F90 | 1 - .../pp_trop_strat_mam4_vbsext/chem_mods.F90 | 1 - src/chemistry/pp_waccm_ma_mam4/chem_mods.F90 | 1 - .../pp_waccm_ma_sulfur/chem_mods.F90 | 1 - src/chemistry/pp_waccm_mad/chem_mods.F90 | 1 - src/chemistry/pp_waccm_mad_mam4/chem_mods.F90 | 1 - src/chemistry/pp_waccm_sc/chem_mods.F90 | 1 - src/chemistry/pp_waccm_sc_mam4/chem_mods.F90 | 1 - .../pp_waccm_tsmlt_mam4/chem_mods.F90 | 1 - .../pp_waccm_tsmlt_mam5/chem_mods.F90 | 1 - 22 files changed, 37 insertions(+), 41 deletions(-) diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index 1f46975f39..40a8828dbb 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -21,7 +21,6 @@ module chem_mods INTEGER :: nSls CHARACTER(LEN=255) :: slsNames(nSlsMax) CHARACTER(LEN=255) :: slsLongnames(nSlsMax) - REAL(r8) :: sls_Ref_MMR(nSlsMax) ! Mapping between constituents and GEOS-Chem tracers INTEGER :: map2GC(pcnst) @@ -102,7 +101,6 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=255), allocatable :: slvd_lst(:) - real(r8), allocatable :: slvd_ref_mmr(:) ! Mapping between chemical species and GEOS-Chem species/other tracers INTEGER :: map2chm(gas_pcnst) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index c6d43ba2df..e801587b1e 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -32,7 +32,7 @@ module chemistry USE Error_Mod ! For error checking USE Precision_Mod, ONLY : fp, f4 ! Flexible precision - use chem_mods, only : nSlvd, slvd_Lst, slvd_ref_MMR + use chem_mods, only : nSlvd, slvd_Lst !-------------------------------------------------------------------- ! GEOS-Chem History exports module @@ -55,7 +55,6 @@ module chemistry use chem_mods, only : nSlsMax use chem_mods, only : nSls use chem_mods, only : slsNames - use chem_mods, only : sls_ref_MMR use chem_mods, only : nAerMax use chem_mods, only : nAer use chem_mods, only : aerNames @@ -200,9 +199,7 @@ subroutine chem_register use physics_buffer, only : pbuf_add_field, dtype_r8 use PhysConst, only : MWDry - - use Short_Lived_Species, only : Register_Short_Lived_Species - + use short_lived_species, only : Register_Short_Lived_Species use State_Grid_Mod, only : Init_State_Grid, Cleanup_State_Grid use State_Chm_Mod, only : Init_State_Chm, Cleanup_State_Chm use State_Chm_Mod, only : Ind_ @@ -236,6 +233,7 @@ subroutine chem_register REAL(r8) :: MWTmp REAL(r8) :: qmin REAL(r8) :: refmmr, refvmr + REAL(r8), ALLOCATABLE :: slvd_refmmr(:) CHARACTER(LEN=128) :: mixtype CHARACTER(LEN=128) :: molectype CHARACTER(LEN=128) :: lngName @@ -478,23 +476,23 @@ subroutine chem_register ! Now unadvected species map2GC_Sls = 0 - sls_ref_MMR(:) = 0.0e+0_r8 - DO I = 1, nSls + ALLOCATE(slvd_refmmr(nslvd), STAT=IERR) + slvd_refmmr(:) = 0.0e+0_r8 + IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate map2MAM4') + DO I = 1, nSlvd N = Ind_(slsNames(I)) IF ( N .GT. 0 ) THEN ThisSpc => SC%SpcData(N)%Info MWTmp = REAL(ThisSpc%MW_g,r8) refvmr = REAL(ThisSpc%BackgroundVV,r8) lngName = TRIM(ThisSpc%FullName) - sls_ref_MMR(I) = refvmr / (MWDry / MWTmp) + slvd_refmmr(I) = refvmr / (MWDry / MWTmp) map2GC_Sls(I) = N ThisSpc => NULL() ENDIF ENDDO - - ! Pass information to "short_lived_species" module - slvd_ref_MMR(1:nSls) = sls_ref_MMR(1:nSls) - CALL Register_Short_Lived_Species() + CALL Register_Short_Lived_Species(slvd_refmmr) + DEALLOCATE(slvd_refmmr) ! More information: ! http://www.cesm.ucar.edu/models/atm-cam/docs/phys-interface/node5.html @@ -897,8 +895,6 @@ subroutine chem_readnl(nlfile) ALLOCATE(slvd_Lst(nSlvd), STAT=IERR) IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating slvd_Lst') - ALLOCATE(slvd_ref_MMR(nSlvd), STAT=IERR) - IF ( IERR .NE. 0 ) CALL ENDRUN('Failure while allocating slvd_ref_MMR') DO I = 1, nSls slvd_Lst(I) = TRIM(slsNames(I)) ENDDO @@ -4310,7 +4306,8 @@ subroutine chem_final use Diag_Mod, only : Cleanup_Diag #endif - use GeosChem_Emissions_Mod, only: GC_Emissions_Final + use GeosChem_Emissions_Mod, only : GC_Emissions_Final + use short_lived_species, only : short_lived_species_final ! Local variables INTEGER :: I, RC @@ -4337,6 +4334,8 @@ subroutine chem_final CALL GC_Emissions_Final + CALL short_lived_species_final() + CALL Cleanup_CMN_FJX( RC ) IF ( RC /= GC_SUCCESS ) THEN ErrMsg = 'Error encountered in "Cleanup_CMN_FJX"!' @@ -4373,7 +4372,6 @@ subroutine chem_final IF ( ALLOCATED( State_Met ) ) DEALLOCATE( State_Met ) IF ( ALLOCATED( slvd_Lst ) ) DEALLOCATE( slvd_Lst ) - IF ( ALLOCATED( slvd_ref_MMR ) ) DEALLOCATE( slvd_ref_MMR ) RETURN diff --git a/src/chemistry/mozart/chemistry.F90 b/src/chemistry/mozart/chemistry.F90 index 5637ebc1f7..13bd39761e 100644 --- a/src/chemistry/mozart/chemistry.F90 +++ b/src/chemistry/mozart/chemistry.F90 @@ -1296,7 +1296,9 @@ end subroutine chem_timestep_tend !------------------------------------------------------------------- subroutine chem_final() use mee_ionization, only: mee_ion_final + use short_lived_species, only: short_lived_species_final call mee_ion_final() + call short_lived_species_final() end subroutine chem_final !------------------------------------------------------------------- diff --git a/src/chemistry/mozart/short_lived_species.F90 b/src/chemistry/mozart/short_lived_species.F90 index 3ceff24e75..8807776d98 100644 --- a/src/chemistry/mozart/short_lived_species.F90 +++ b/src/chemistry/mozart/short_lived_species.F90 @@ -12,7 +12,6 @@ module short_lived_species use ppgrid, only : pcols, pver, begchunk, endchunk use spmd_utils, only : masterproc - implicit none save @@ -28,21 +27,31 @@ module short_lived_species public :: get_short_lived_species_gc ! for GEOS-Chem chemistry public :: slvd_index public :: pbf_idx + public :: short_lived_species_final integer :: pbf_idx integer :: map(nslvd) character(len=*), parameter :: pbufname = 'ShortLivedSpecies' + real(r8), allocatable :: slvd_ref_mmr(:) + contains !--------------------------------------------------------------------- !--------------------------------------------------------------------- - subroutine register_short_lived_species + subroutine register_short_lived_species (ref_mmr) use physics_buffer, only : pbuf_add_field, dtype_r8 + real(r8), optional :: ref_mmr(nslvd) + if ( nslvd < 1 ) return + if ( present(ref_mmr) ) then + allocate(slvd_ref_mmr(nslvd)) + slvd_ref_mmr = ref_mmr + endif + call pbuf_add_field(pbufname,'global',dtype_r8,(/pcols,pver,nslvd/),pbf_idx) end subroutine register_short_lived_species @@ -93,7 +102,6 @@ subroutine initialize_short_lived_species(ncid_ini, pbuf2d) use cam_grid_support, only : cam_grid_check, cam_grid_id use cam_grid_support, only : cam_grid_get_dim_names use cam_abortutils, only : endrun - use chem_mods, only : slvd_ref_mmr use mo_tracname, only : solsym use ncdio_atm, only : infld use pio, only : file_desc_t @@ -140,7 +148,7 @@ subroutine initialize_short_lived_species(ncid_ini, pbuf2d) tmpptr, found, gridname='physgrid') if (.not.found) then - if ( cam_chempkg_is('geoschem_mam4') ) then + if ( allocated(slvd_ref_mmr) ) then tmpptr(:,:,:) = slvd_ref_mmr(m) else tmpptr(:,:,:) = 1.e-36_r8 @@ -151,7 +159,7 @@ subroutine initialize_short_lived_species(ncid_ini, pbuf2d) if (masterproc) write(iulog,*) fieldname, ' is set to short-lived' - if (cam_chempkg_is('geoschem_mam4') .and. masterproc) write(iulog,'(a, E16.5E4)') ' --> reference MMR: ', slvd_ref_mmr(m) + if ( allocated(slvd_ref_mmr) .and. masterproc) write(iulog,'(a, E16.5E4)') ' --> reference MMR: ', slvd_ref_mmr(m) enddo @@ -278,4 +286,12 @@ function slvd_index( name ) endfunction slvd_index +!--------------------------------------------------------------------- +!--------------------------------------------------------------------- + subroutine short_lived_species_final + + if ( allocated(slvd_ref_mmr) ) deallocate(slvd_ref_mmr) + + end subroutine short_lived_species_final + end module short_lived_species diff --git a/src/chemistry/pp_none/chem_mods.F90 b/src/chemistry/pp_none/chem_mods.F90 index 845261c628..4dc00c6ced 100644 --- a/src/chemistry/pp_none/chem_mods.F90 +++ b/src/chemistry/pp_none/chem_mods.F90 @@ -46,5 +46,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_terminator/chem_mods.F90 b/src/chemistry/pp_terminator/chem_mods.F90 index ceb2107303..31d67260c3 100644 --- a/src/chemistry/pp_terminator/chem_mods.F90 +++ b/src/chemistry/pp_terminator/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_mam3/chem_mods.F90 b/src/chemistry/pp_trop_mam3/chem_mods.F90 index 645b62fba5..69af9e22ab 100644 --- a/src/chemistry/pp_trop_mam3/chem_mods.F90 +++ b/src/chemistry/pp_trop_mam3/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_mam4/chem_mods.F90 b/src/chemistry/pp_trop_mam4/chem_mods.F90 index 76424a61a3..0b97007e7b 100644 --- a/src/chemistry/pp_trop_mam4/chem_mods.F90 +++ b/src/chemistry/pp_trop_mam4/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_mam5/chem_mods.F90 b/src/chemistry/pp_trop_mam5/chem_mods.F90 index f7c002b820..0638b442d5 100644 --- a/src/chemistry/pp_trop_mam5/chem_mods.F90 +++ b/src/chemistry/pp_trop_mam5/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_mam7/chem_mods.F90 b/src/chemistry/pp_trop_mam7/chem_mods.F90 index 872c68441f..b40e9525b6 100644 --- a/src/chemistry/pp_trop_mam7/chem_mods.F90 +++ b/src/chemistry/pp_trop_mam7/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_mozart/chem_mods.F90 b/src/chemistry/pp_trop_mozart/chem_mods.F90 index edae88dc29..9b41d9c1cb 100644 --- a/src/chemistry/pp_trop_mozart/chem_mods.F90 +++ b/src/chemistry/pp_trop_mozart/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_trop_strat_mam4_ts2/chem_mods.F90 b/src/chemistry/pp_trop_strat_mam4_ts2/chem_mods.F90 index 414491243e..70d339afc3 100644 --- a/src/chemistry/pp_trop_strat_mam4_ts2/chem_mods.F90 +++ b/src/chemistry/pp_trop_strat_mam4_ts2/chem_mods.F90 @@ -47,6 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 b/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 index 75737d5bf7..9af6c6de37 100644 --- a/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 +++ b/src/chemistry/pp_trop_strat_mam4_vbs/chem_mods.F90 @@ -47,6 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 b/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 index 1225023e14..81fd6d4a31 100644 --- a/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 +++ b/src/chemistry/pp_trop_strat_mam4_vbsext/chem_mods.F90 @@ -47,6 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_waccm_ma_mam4/chem_mods.F90 b/src/chemistry/pp_waccm_ma_mam4/chem_mods.F90 index 9b6c1a3141..b3d2ff52e0 100644 --- a/src/chemistry/pp_waccm_ma_mam4/chem_mods.F90 +++ b/src/chemistry/pp_waccm_ma_mam4/chem_mods.F90 @@ -47,6 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_waccm_ma_sulfur/chem_mods.F90 b/src/chemistry/pp_waccm_ma_sulfur/chem_mods.F90 index f8995051c9..2dfcf62986 100644 --- a/src/chemistry/pp_waccm_ma_sulfur/chem_mods.F90 +++ b/src/chemistry/pp_waccm_ma_sulfur/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_waccm_mad/chem_mods.F90 b/src/chemistry/pp_waccm_mad/chem_mods.F90 index ff996a00d4..c524ffab6b 100644 --- a/src/chemistry/pp_waccm_mad/chem_mods.F90 +++ b/src/chemistry/pp_waccm_mad/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_waccm_mad_mam4/chem_mods.F90 b/src/chemistry/pp_waccm_mad_mam4/chem_mods.F90 index eb95c69127..6c202fdba7 100644 --- a/src/chemistry/pp_waccm_mad_mam4/chem_mods.F90 +++ b/src/chemistry/pp_waccm_mad_mam4/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_waccm_sc/chem_mods.F90 b/src/chemistry/pp_waccm_sc/chem_mods.F90 index cf5e4ac056..b89c8308f5 100644 --- a/src/chemistry/pp_waccm_sc/chem_mods.F90 +++ b/src/chemistry/pp_waccm_sc/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_waccm_sc_mam4/chem_mods.F90 b/src/chemistry/pp_waccm_sc_mam4/chem_mods.F90 index 5fca9dfce2..f75b1c9a8a 100644 --- a/src/chemistry/pp_waccm_sc_mam4/chem_mods.F90 +++ b/src/chemistry/pp_waccm_sc_mam4/chem_mods.F90 @@ -47,5 +47,4 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) end module chem_mods diff --git a/src/chemistry/pp_waccm_tsmlt_mam4/chem_mods.F90 b/src/chemistry/pp_waccm_tsmlt_mam4/chem_mods.F90 index 56f1a58f89..336ce725db 100644 --- a/src/chemistry/pp_waccm_tsmlt_mam4/chem_mods.F90 +++ b/src/chemistry/pp_waccm_tsmlt_mam4/chem_mods.F90 @@ -47,6 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/chemistry/pp_waccm_tsmlt_mam5/chem_mods.F90 b/src/chemistry/pp_waccm_tsmlt_mam5/chem_mods.F90 index 3e28b7c55f..5cdd14dcd5 100644 --- a/src/chemistry/pp_waccm_tsmlt_mam5/chem_mods.F90 +++ b/src/chemistry/pp_waccm_tsmlt_mam5/chem_mods.F90 @@ -47,6 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods From a924520cbb4b252e0601bdc3afebfa5ddf09c3c7 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 7 Mar 2023 09:22:02 -0700 Subject: [PATCH 102/160] Delete unused GEOS-Chem build code Code removal guided by: 1. chem value 'geoschem' is not used. Only 'geoschem_mam4' is used 2. CLM version CPP definition -DCLM[40,45,50] no longer used in GEOS-Chem 3. Only CAM60 is used Signed-off-by: Lizzie Lundgren --- bld/config_files/definition.xml | 4 ++-- bld/configure | 19 ++----------------- cime_config/config_component.xml | 3 +-- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/bld/config_files/definition.xml b/bld/config_files/definition.xml index 84f55922bf..e198e1bd65 100644 --- a/bld/config_files/definition.xml +++ b/bld/config_files/definition.xml @@ -98,8 +98,8 @@ meteor_smoke (Meteor Smoke), mixed_sulfate (Meteor Smoke and Sulfate), pmc (Pola sulfate (Sulfate Aerosols), tholin (early earth haze), test_detrain (Detrainment), test_growth (Particle Growth), test_passive (Passive Dust), test_radiative (Radiatively Active Dust), test_swelling (Sea Salt), test_tracers (Asian Monsoon), test_tracers2 (Guam). - - Chemistry package: none,terminator,trop_mam3,trop_mam4,trop_mam7,trop_mozart,trop_strat_mam4_ts2,trop_strat_mam4_vbs,trop_strat_mam4_vbsext,trop_strat_mam5_ts2,trop_strat_mam5_vbs,trop_strat_mam5_vbsext,waccm_ma,waccm_mad,waccm_ma_sulfur,waccm_sc,waccm_sc_mam4,waccm_mad_mam4,waccm_ma_mam4,waccm_tsmlt_mam4,waccm_tsmlt_mam4_vbsext,waccm_mad_mam5,waccm_ma_mam5,waccm_tsmlt_mam5,waccm_tsmlt_mam5_vbsext,geoschem,geoschem_mam4 + + Chemistry package: none,terminator,trop_mam3,trop_mam4,trop_mam7,trop_mozart,trop_strat_mam4_ts2,trop_strat_mam4_vbs,trop_strat_mam4_vbsext,trop_strat_mam5_ts2,trop_strat_mam5_vbs,trop_strat_mam5_vbsext,waccm_ma,waccm_mad,waccm_ma_sulfur,waccm_sc,waccm_sc_mam4,waccm_mad_mam4,waccm_ma_mam4,waccm_tsmlt_mam4,waccm_tsmlt_mam4_vbsext,waccm_mad_mam5,waccm_ma_mam5,waccm_tsmlt_mam5,waccm_tsmlt_mam5_vbsext,geoschem_mam4 Prognostic mozart species packages: list of any subset of the following: DST,SSLT,SO4,GHG,OC,BC,CARBON16 diff --git a/bld/configure b/bld/configure index 6560aabcfe..05509afaec 100755 --- a/bld/configure +++ b/bld/configure @@ -67,11 +67,8 @@ OPTIONS trop_strat_mam4_vbs | trop_strat_mam4_vbsext | trop_strat_mam5_ts2 | trop_strat_mam5_vbs | trop_strat_mam5_vbsext | waccm_ma | waccm_mad | waccm_ma_sulfur | waccm_sc | waccm_sc_mam4 | waccm_mad_mam4 | waccm_ma_mam4 | waccm_tsmlt_mam4 | waccm_tsmlt_mam4_vbsext | waccm_mad_mam5 | - waccm_ma_mam5 | waccm_tsmlt_mam5 | waccm_tsmlt_mam5_vbsext | geoschem | geoschem_mam4 ]. + waccm_ma_mam5 | waccm_tsmlt_mam5 | waccm_tsmlt_mam5_vbsext | geoschem_mam4 ]. Default: trop_mam4 for cam6 and trop_mam3 for cam5. - -clm_vers Version of land model to use. This option is only used when chem - is set to 'geoschem'. - [ 4.0 | 4.5 | 5.0 ] -[no]clubb_sgs Switch on [off] CLUBB_SGS. Default: on for cam6, otherwise off. -clubb_opts Comma separated list of CLUBB options to turn on/off. By default they are all off. Current option is: clubb_do_adv (Advect CLUBB moments) @@ -251,7 +248,6 @@ GetOptions( "cc=s" => \$opts{'cc'}, "cflags=s" => \$opts{'cflags'}, "chem=s" => \$opts{'chem'}, - "clm_vers=s" => \$opts{'clm_vers'}, "clubb_sgs!" => \$opts{'clubb_sgs'}, "clubb_opts=s" => \$opts{'clubb_opts'}, "co2_cycle" => \$opts{'co2_cycle'}, @@ -1401,21 +1397,10 @@ if ($chem_pkg =~ '_mam3') { $chem_cppdefs = ' -DMODAL_AERO -DMODAL_AERO_7MODE '; } -# TMMF - wedge in GEOS-Chem CPP definitions here +# Set GEOS-Chem CPP definitions here if ($chem_pkg =~ 'geoschem') { $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING -DLINUX_IFORT -DUSE_REAL8 -DMODEL_ -DMODEL_CESM'; $chem_nadv = 267; # includes GC advected species (233), CO2 (1), and MAM aerosols (33) - if (defined $opts{'clm_vers'}) { - if ($opts{'clm_vers'} =~ 'CLM4.0') { - $chem_cppdefs .= ' -DCLM40' - } - elsif ($opts{'clm_vers'} =~ 'CLM4.5') { - $chem_cppdefs .= ' -DCLM45' - } - elsif ($opts{'clm_vers'} =~ 'CLM5.0') { - $chem_cppdefs .= ' -DCLM50' - } - } } diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 83df6df22e..b09dd13d17 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -131,12 +131,11 @@ -phys cam_dev -chem trop_strat_mam5_vbs - -chem geoschem_mam4 -hemco + -chem geoschem_mam4 -hemco -chem trop_mam7 -chem trop_strat_mam5_vbsext -chem trop_strat_mam5_ts2 - -chem geoschem -hemco -clubb_sgs -dyn eul -scam -rad camrt -chem none -spcam_nx 32 -spcam_ny 1 -spcam_dx 4000 -spcam_dt 20 -phys spcam_sam1mom From 66887030c4d2fe284cc21606c3abe1e859ae997e Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 7 Mar 2023 12:14:16 -0700 Subject: [PATCH 103/160] Assorted minor code cleanup; add preliminary GEOS-Chem tests Signed-off-by: Lizzie Lundgren --- cime_config/testdefs/testlist_cam.xml | 38 +++++++++++++++++++++++++ src/chemistry/pp_waccm_ma/chem_mods.F90 | 1 - src/cpl/mct/cam_cpl_indices.F90 | 2 +- src/physics/cam/physpkg.F90 | 9 ------ 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 7e94ce3d6a..9ffad598cd 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -17,6 +17,14 @@ + + + + + + + + @@ -43,6 +51,14 @@ + + + + + + + + @@ -1529,6 +1545,14 @@ + + + + + + + + @@ -1579,6 +1603,15 @@ + + + + + + + + + @@ -1753,6 +1786,11 @@ + + + + + diff --git a/src/chemistry/pp_waccm_ma/chem_mods.F90 b/src/chemistry/pp_waccm_ma/chem_mods.F90 index 94dad43671..4daa9f36ee 100644 --- a/src/chemistry/pp_waccm_ma/chem_mods.F90 +++ b/src/chemistry/pp_waccm_ma/chem_mods.F90 @@ -47,6 +47,5 @@ module chem_mods logical :: is_vector logical :: is_scalar character(len=16) :: slvd_lst(max(1,nslvd)) - real(r8), allocatable :: slvd_ref_mmr(max(1,nslvd)) integer, parameter :: veclen = 32 end module chem_mods diff --git a/src/cpl/mct/cam_cpl_indices.F90 b/src/cpl/mct/cam_cpl_indices.F90 index ba38a67fe4..f5fe1ef26c 100644 --- a/src/cpl/mct/cam_cpl_indices.F90 +++ b/src/cpl/mct/cam_cpl_indices.F90 @@ -165,7 +165,7 @@ subroutine cam_cpl_indices_set( ) if ( n_drydep>0 )then index_x2a_Sl_ddvel = mct_avect_indexra(x2a, trim(drydep_fields_token)) else - index_x2a_Sl_ddvel = 0 + index_x2a_Sl_ddvel = 0 end if index_a2x_Sa_z = mct_avect_indexra(a2x,'Sa_z') diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index 7f7c7261cb..c726eb490e 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -1427,7 +1427,6 @@ subroutine tphysac (ztodt, cam_in, & integer :: ixq logical :: labort ! abort flag - logical :: debug ! enable status prints real(r8) tvm(pcols,pver) ! virtual temperature real(r8) prect(pcols) ! total precipitation @@ -1463,8 +1462,6 @@ subroutine tphysac (ztodt, cam_in, & nstep = get_nstep() call cnst_get_ind('Q', ixq) - debug = .false. - ! Adjust the surface fluxes to reduce instabilities in near sfc layer if (phys_do_flux_avg()) then call flux_avg_run(state, cam_in, pbuf, nstep, ztodt) @@ -1588,10 +1585,8 @@ subroutine tphysac (ztodt, cam_in, & fh2o, surfric, obklen, flx_heat) end if - if (debug .and. masterproc) print *, "cam/physpkg.F90: calling chem_timestep_tend" call chem_timestep_tend(state, ptend, cam_in, cam_out, ztodt, & pbuf, fh2o=fh2o) - if (debug .and. masterproc) print *, "cam/physpkg.F90: chem_timestep_tend complete" if ( (trim(cam_take_snapshot_after) == "chem_timestep_tend") .and. & (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then @@ -1681,8 +1676,6 @@ subroutine tphysac (ztodt, cam_in, & fh2o, surfric, obklen, flx_heat) end if - if (debug .and. masterproc) print *, "cam/physpkg.F90: calling aero_model_drydep" - call aero_model_drydep( state, pbuf, obklen, surfric, cam_in, ztodt, cam_out, ptend ) if ( (trim(cam_take_snapshot_after) == "aero_model_drydep") .and. & (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then @@ -1690,8 +1683,6 @@ subroutine tphysac (ztodt, cam_in, & end if call physics_update(state, ptend, ztodt, tend) - if (debug .and. masterproc) print *, "cam/physpkg.F90: aero_model_drydep complete" - if (trim(cam_take_snapshot_after) == "aero_model_drydep") then call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& fh2o, surfric, obklen, flx_heat) From 1dc70198bbcc3a8f195ddeaa22c09826aa35e489 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 8 Mar 2023 15:56:45 -0500 Subject: [PATCH 104/160] Now emit surface emissions consistently as a 3-D flux term. This is for consistency with recent updates to HEMCO within CAM-chem where emission fluxes are applied as a 3-D flux, even for surface emissions. Signed-off-by: Haipeng Lin --- .../geoschem/geoschem_emissions_mod.F90 | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/chemistry/geoschem/geoschem_emissions_mod.F90 b/src/chemistry/geoschem/geoschem_emissions_mod.F90 index 4859aee573..cc3160d212 100644 --- a/src/chemistry/geoschem/geoschem_emissions_mod.F90 +++ b/src/chemistry/geoschem/geoschem_emissions_mod.F90 @@ -317,6 +317,7 @@ SUBROUTINE GC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iStep ! ! !REVISION HISTORY: ! 07 Oct 2020 - T. M. Fritz - Initial version +! 06 Mar 2023 - H.P. Lin - Now emit surface fluxes directly !EOP !------------------------------------------------------------------------------ !BOC @@ -429,10 +430,10 @@ SUBROUTINE GC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iStep ! Deposition fluxes from HEMCO !----------------------------------------------------------------------- - ! Part 1: Eventually retrieve deposition velocities [1/s] from HEMCO - ! and convert to negative flux and apply. - ! TODO hplin 3/24/21 - + ! Deposition velocities in HEMCO are now handled within HEMCO_CESM for a + ! hardcoded list of species, primarily for the SeaFlux extension. + ! This is not to be confused with dry deposition fluxes which are not + ! handled by HEMCO. ! Part 2: Handle special deposition fluxes for the ParaNOx extension ! for PAR_O3_DEP and PAR_HNO3_DEP @@ -601,11 +602,14 @@ SUBROUTINE GC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iStep ! TMMF - vertical distribution of fire emissions is not implemented yet !CALL fire_emissions_vrt( nY, LCHNK, zint, cam_in%fireflx, cam_in%fireztop, extfrc ) - !----------------------------------------------------------------------- - ! Add near-surface emissions to surface flux boundary condition - !----------------------------------------------------------------------- - cam_in%cflx(1:nY,:) = cam_in%cflx(1:nY,:) + eflx(1:nY,nZ,:) - eflx(1:nY,nZ,:) = 0.0e+00_r8 + ! Near-surface emissions are now emitted directly to GEOS-Chem Species array + ! for consistency with CAM-chem implementation of HEMCO + ! (but not with GEOS-Chem standalone, where fluxes are mixed by the turbulence routines) + ! Refer to discussion here: https://github.com/ESCOMP/CAM/pull/560#discussion_r1084559191 + ! + ! To replicate old behavior, uncomment these two lines below: + ! cam_in%cflx(1:nY,:) = cam_in%cflx(1:nY,:) + eflx(1:nY,nZ,:) + ! eflx(1:nY,nZ,:) = 0.0e+00_r8 END SUBROUTINE GC_Emissions_Calc !EOC From 1a3fbcff71cc0903289ed87e47a9066d693e5c98 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 17 Mar 2023 18:14:39 -0400 Subject: [PATCH 105/160] Fix SOA mapping indices --- src/chemistry/geoschem/chemistry.F90 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index e801587b1e..dd8f0c9b1a 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -2430,25 +2430,28 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) K4 = Ind_(speciesName_4) DO J = 1, nY DO L = 1, nZ + ! Total SOA aerosol masses from GC are available. Partition according to the ratio given in speciesId_N to totMass summed above. IF ( totMass(J,L) > 0.0e+00_r8 ) THEN IF ( K1 > 0 ) State_Chm(LCHNK)%Species(K1)%Conc(1,J,L) = state%q(J,nZ+1-L,speciesId_1) / totMass(J,nZ+1-L) * bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_1)) / tmpMW_g - IF ( K2 > 0 ) State_Chm(LCHNK)%Species(K1)%Conc(1,J,L) = state%q(J,nZ+1-L,speciesId_2) / totMass(J,nZ+1-L) * bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_2)) / tmpMW_g + IF ( K2 > 0 ) State_Chm(LCHNK)%Species(K2)%Conc(1,J,L) = state%q(J,nZ+1-L,speciesId_2) / totMass(J,nZ+1-L) * bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_2)) / tmpMW_g IF ( K3 > 0 ) State_Chm(LCHNK)%Species(K3)%Conc(1,J,L) = state%q(J,nZ+1-L,speciesId_3) / totMass(J,nZ+1-L) * bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_3)) / tmpMW_g IF ( K4 > 0 ) State_Chm(LCHNK)%Species(K4)%Conc(1,J,L) = state%q(J,nZ+1-L,speciesId_4) / totMass(J,nZ+1-L) * bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_4)) / tmpMW_g ELSE + ! Total SOA aerosol masses from GC are unknown. In this case partition the bulkMass by 1/2 to K1 and K2. IF ( K1 == K2 ) THEN + ! ... go in same bin. This actually does not exist in the partitioning above. State_Chm(LCHNK)%Species(K1)%Conc(1,J,L) = bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_1)) / tmpMW_g ELSE State_Chm(LCHNK)%Species(K1)%Conc(1,J,L) = bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_1)) / tmpMW_g / 2.0_r8 - State_Chm(LCHNK)%Species(K1)%Conc(1,J,L) = bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_1)) / tmpMW_g / 2.0_r8 + State_Chm(LCHNK)%Species(K2)%Conc(1,J,L) = bulkMass(J,nZ+1-L) * adv_mass(mapCnst(speciesId_2)) / tmpMW_g / 2.0_r8 ENDIF ENDIF ENDDO ENDDO IF ( K1 > 0 ) MMR_Beg(:nY,:nZ,K1) = State_Chm(LCHNK)%Species(K1)%Conc(1,:nY,:nZ) IF ( K2 > 0 ) MMR_Beg(:nY,:nZ,K2) = State_Chm(LCHNK)%Species(K2)%Conc(1,:nY,:nZ) - IF ( K3 > 0 ) MMR_Beg(:nY,:nZ,K4) = State_Chm(LCHNK)%Species(K3)%Conc(1,:nY,:nZ) - IF ( K4 > 0 ) MMR_Beg(:nY,:nZ,K3) = State_Chm(LCHNK)%Species(K4)%Conc(1,:nY,:nZ) + IF ( K3 > 0 ) MMR_Beg(:nY,:nZ,K3) = State_Chm(LCHNK)%Species(K3)%Conc(1,:nY,:nZ) + IF ( K4 > 0 ) MMR_Beg(:nY,:nZ,K4) = State_Chm(LCHNK)%Species(K4)%Conc(1,:nY,:nZ) ENDDO ENDIF From e07c7d67bb217fb71f43c36a50dcbd611082285d Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 20 Mar 2023 15:38:22 -0400 Subject: [PATCH 106/160] Fix TSKIN field to correct value --- src/chemistry/geoschem/chemistry.F90 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index e801587b1e..14fae16d66 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -2782,12 +2782,18 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Dimensions : nX, nY State_Met(LCHNK)%SLP (1,:nY) = state%ps(:nY)*0.01e+0_fp - ! Field : TS, TSKIN - ! Description: Surface temperature, surface skin temperature + ! Field : TS + ! Description: Surface temperature ! Unit : K ! Dimensions : nX, nY State_Met(LCHNK)%TS (1,:nY) = cam_in%TS(:nY) - State_Met(LCHNK)%TSKIN (1,:nY) = cam_in%TS(:nY) + + ! Field : TSKIN + ! Description: Surface skin temperature + ! Remarks : NOT to be confused with TS (T at 2m) (hplin, 3/20/23) + ! Unit : K + ! Dimensions : nX, nY + State_Met(LCHNK)%TSKIN (1,:nY) = cam_in%SST(:nY) ! Field : SWGDN ! Description: Incident radiation @ ground From bda2db3104138b810df8a2888c033400d1376ddf Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 20 Mar 2023 15:48:21 -0400 Subject: [PATCH 107/160] Update upstream HEMCO-CESM 1.1.3 --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 19fd8351de..15aa548487 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -84,7 +84,7 @@ local_path = src/chemistry/geoschem/geoschem_src required = True [hemco] -tag = hemco-cesm1_1_1_hemco3_6_2 +tag = hemco-cesm1_1_3_hemco3_6_2 protocol = git repo_url = https://github.com/ESCOMP/HEMCO_CESM.git local_path = src/hemco From 935edbb2e2ef27f6d3d7a32c5b9c6a3092786ae6 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 30 Mar 2023 17:38:27 -0400 Subject: [PATCH 108/160] Fix other indices in the reverse direction. --- src/chemistry/geoschem/chemistry.F90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index dd8f0c9b1a..9127d3bc6a 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -3927,8 +3927,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! First deal with lowest two volatility bins speciesName_1 = 'TSOA0' speciesName_2 = 'ASOAN' - speciesName_2 = 'SOAIE' - speciesName_2 = 'SOAGX' + speciesName_3 = 'SOAIE' + speciesName_4 = 'SOAGX' K1 = get_spc_ndx(TRIM(speciesName_1), compare_uppercase=.true.) K2 = get_spc_ndx(TRIM(speciesName_2), compare_uppercase=.true.) K3 = get_spc_ndx(TRIM(speciesName_3), compare_uppercase=.true.) @@ -3986,11 +3986,12 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDDO ! Now deal with gaseous SOA species - ! Deal with lowest two volatility bins + ! Deal with lowest two volatility bins - TSOG0 corresponds to SOAG0 and SOAG1 speciesName_1 = 'TSOG0' K1 = get_spc_ndx(TRIM(speciesName_1), compare_uppercase=.true.) N = lptr2_soa_g_amode(1) P = mapCnst(N) + ! current mode other modes (this mapping was verified to be correct.) vmr1(:nY,:nZ,P) = vmr0(:nY,:nZ,P) / (vmr0(:nY,:nZ,P) + vmr0(:nY,:nZ,mapCnst(lptr2_soa_g_amode(2)))) & * vmr1(:nY,:nZ,K1) N = lptr2_soa_g_amode(2) From 794d1baf1bcd6c7857bbed3dd81dc11f12407f9c Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 18 Apr 2023 14:33:24 -0400 Subject: [PATCH 109/160] Fix dry and wet deposition for GEOS-Chem non-gas species. --- bld/namelist_files/use_cases/2000_geoschem.xml | 6 +++--- bld/namelist_files/use_cases/2010_geoschem.xml | 6 +++--- bld/namelist_files/use_cases/hist_geoschem.xml | 6 +++--- bld/namelist_files/use_cases/hist_geoschem_nudged.xml | 8 +++++--- bld/namelist_files/use_cases/sd_geoschem.xml | 6 +++--- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index e7be6f4774..49b49d6cd6 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -12,7 +12,7 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc +/glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc @@ -43,12 +43,12 @@ -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' -'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index 56d1182cd8..cf9ae2af8b 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -10,7 +10,7 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc +/glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc @@ -39,12 +39,12 @@ -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' -'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 161db508ee..83d3fc39ba 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -12,7 +12,7 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc +/glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc @@ -37,12 +37,12 @@ -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' -'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml index 2b1bcf64f9..cf75619028 100644 --- a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -12,7 +12,7 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc +/glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc @@ -91,13 +91,15 @@ + + -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' -'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index 04e5e60e5a..41647f8ecb 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -14,7 +14,7 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f09_f09_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc atm/cam/met/MERRA2/0.9x1.25/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_MERRA2_c171218.nc -/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc +/glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc @@ -57,12 +57,12 @@ -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' -'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2' +'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' From a16a4ffbe3c5c10ac844abd56a27dcb52777a083 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 18 Apr 2023 16:09:21 -0600 Subject: [PATCH 110/160] Fix GEOS-Chem tests by replacing StrSplit in chem_readnl For some reason the StrSplit routine in GEOS-Chem charpak_mod.F90 has unexpected behavior when run within the CAM test suite. Replacing it with basic Fortran fixes the issue reading advected species from geoschem_config.yml. Signed-off-by: Lizzie Lundgren --- cime_config/testdefs/testlist_cam.xml | 2 +- src/chemistry/geoschem/chemistry.F90 | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 9ffad598cd..4806d18d52 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -19,7 +19,7 @@ - + diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 41b1464d51..dea62ead0e 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -686,7 +686,6 @@ subroutine chem_readnl(nlfile) #endif use gckpp_Model, only : nSpec, Spc_Names use chem_mods, only : drySpc_ndx - use charpak_mod, only : strsplit ! args CHARACTER(LEN=*), INTENT(IN) :: nlfile ! filepath for file containing namelist input @@ -771,7 +770,6 @@ subroutine chem_readnl(nlfile) Write(iulog,'(/,a,/)') 'Now defining GEOS-Chem tracers and dry deposition mapping...' - !============================================================== ! Read GEOS-Chem advected species from geoschem_config.yml !============================================================== @@ -791,7 +789,7 @@ subroutine chem_readnl(nlfile) IF ( INDEX( LINE, 'transported_species' ) > 0 ) EXIT ENDDO - if (debug .and. masterproc) write(iulog,'(a)') 'chem_readnl: reading advected species list from geoschem_config.yml' + if (debug) write(iulog,'(a)') 'chem_readnl: reading advected species list from geoschem_config.yml' ! Read in all advected species names and add them to tracer names list nTracers = 0 @@ -799,12 +797,11 @@ subroutine chem_readnl(nlfile) READ(unitn,'(a)', IOSTAT=IERR) line IF ( IERR .NE. 0 ) CALL ENDRUN('chem_readnl: error setting adv spc list') line = ADJUSTL( ADJUSTR( line ) ) - IF ( INDEX( line, 'passive_species' ) > 0 ) EXIT - CALL StrSplit( line, '-', substrs, N ) IF ( INDEX( LINE, '-' ) > 0 ) THEN + substrs(1) = LINE(3:) substrs(1) = ADJUSTL( ADJUSTR( substrs(1) ) ) - + ! Remove quotes (i.e. 'NO' -> NO) I = INDEX( substrs(1), "'" ) IF ( I > 0 ) THEN @@ -857,7 +854,11 @@ subroutine chem_readnl(nlfile) !============================================================== unitn = getunit() - OPEN( unitn, FILE=TRIM(nlfile), STATUS='old' ) + OPEN( unitn, FILE=TRIM(nlfile), STATUS='old', IOSTAT=IERR ) + IF (IERR .NE. 0) THEN + CALL ENDRUN('chem_readnl: ERROR opening '//TRIM(nlfile)) + ENDIF + CALL find_group_name(unitn, 'chem_inparm', STATUS=IERR) IF (IERR == 0) THEN READ(unitn, chem_inparm, IOSTAT=IERR) From acfe4267ad7cea29c1afe74ada17153314023bd9 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 18 May 2023 14:36:53 -0600 Subject: [PATCH 111/160] Update lightning emissions code in GEOS-Chem interface for compatibility These updates are necessary when updating from cam3_6_095 to cam3_6_111 Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chemistry.F90 | 12 +++++------- src/chemistry/geoschem/geoschem_emissions_mod.F90 | 12 +----------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index dea62ead0e..49faa7d6a1 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -166,9 +166,6 @@ module chemistry CHARACTER(len=shr_kind_cl) :: bndtvg = ' ' ! pathname for greenhouse gas loss rate CHARACTER(len=shr_kind_cl) :: h2orates = ' ' ! pathname for greenhouse gas (lyman-alpha H2O loss) - ! lightning - REAL(r8) :: lght_no_prd_factor = 1._r8 - ! Strings CHARACTER(LEN=255) :: ThisLoc CHARACTER(LEN=255) :: ErrMsg @@ -681,6 +678,7 @@ subroutine chem_readnl(nlfile) use dust_model, only : dust_readnl #endif use gas_wetdep_opts, only : gas_wetdep_readnl + use mo_lightning, only : lightning_readnl #ifdef SPMD use mpishorthand #endif @@ -700,8 +698,7 @@ subroutine chem_readnl(nlfile) ! Assume a successful return until otherwise RC = GC_SUCCESS - namelist /chem_inparm/ lght_no_prd_factor, & - depvel_lnd_file + namelist /chem_inparm/ depvel_lnd_file ! ghg chem @@ -754,6 +751,8 @@ subroutine chem_readnl(nlfile) CALL gas_wetdep_readnl(nlfile) + CALL lightning_readnl(nlfile) + CALL gc_readnl(nlfile) IF ( MasterProc ) THEN @@ -883,7 +882,6 @@ subroutine chem_readnl(nlfile) ! Broadcast namelist variables CALL MPIBCAST (depvel_lnd_file, LEN(depvel_lnd_file), MPICHAR, 0, MPICOM) - CALL MPIBCAST (lght_no_prd_factor, 1, MPIR8, 0, MPICOM) CALL MPIBCAST (ghg_chem, 1, MPILOG, 0, MPICOM) CALL MPIBCAST (bndtvg, LEN(bndtvg), MPICHAR, 0, MPICOM) CALL MPIBCAST (h2orates, LEN(h2orates), MPICHAR, 0, MPICOM) @@ -1690,7 +1688,7 @@ subroutine chem_init(phys_state, pbuf2d) State_Met = State_Met(BEGCHUNK) ) ! Initialize emissions interface - CALL GC_Emissions_Init( lght_no_prd_factor = lght_no_prd_factor ) + CALL GC_Emissions_Init( ) hco_pbuf2d => pbuf2d diff --git a/src/chemistry/geoschem/geoschem_emissions_mod.F90 b/src/chemistry/geoschem/geoschem_emissions_mod.F90 index cc3160d212..99bc9eff7f 100644 --- a/src/chemistry/geoschem/geoschem_emissions_mod.F90 +++ b/src/chemistry/geoschem/geoschem_emissions_mod.F90 @@ -76,7 +76,7 @@ MODULE GeosChem_Emissions_Mod !\\ ! !INTERFACE: ! - SUBROUTINE GC_Emissions_Init( lght_no_prd_factor ) + SUBROUTINE GC_Emissions_Init( ) ! ! !USES: ! @@ -85,15 +85,10 @@ SUBROUTINE GC_Emissions_Init( lght_no_prd_factor ) USE PHYS_CONTROL, ONLY : phys_getopts USE MO_CHEM_UTLS, ONLY : get_spc_ndx, get_extfrc_ndx USE CAM_HISTORY, ONLY : addfld, add_default, horiz_only - USE MO_LIGHTNING, ONLY : lightning_inti USE FIRE_EMISSIONS, ONLY : fire_emissions_init USE CHEM_MODS, ONLY : adv_mass USE INFNAN, ONLY : NaN, assignment(=) ! -! !INPUT PARAMETERS: -! - REAL(r8), INTENT(IN ) :: lght_no_prd_factor ! Lightning scaling factor -! ! !REVISION HISTORY: ! 07 Oct 2020 - T. M. Fritz - Initial version !EOP @@ -127,11 +122,6 @@ SUBROUTINE GC_Emissions_Init( lght_no_prd_factor ) ! Get constituent index for NO CALL cnst_get_ind('NO', iNO, abort=.True.) - !----------------------------------------------------------------------- - ! ... initialize the lightning module - !----------------------------------------------------------------------- - CALL lightning_inti(lght_no_prd_factor) - !----------------------------------------------------------------------- ! ... MEGAN emissions !----------------------------------------------------------------------- From f71850c17ca06cbf48f1a4aa18bb1c34695b08a5 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 28 Jul 2023 09:47:03 -0600 Subject: [PATCH 112/160] Post-merge update to add pbuf argument to GEOS-Chem chem_emissions This update enables GEOS-Chem compsets to compile following update to a more recent version of CAM. Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chemistry.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 49faa7d6a1..59c14be74b 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -4452,14 +4452,16 @@ end subroutine chem_read_restart !================================================================================ - subroutine chem_emissions( state, cam_in ) + subroutine chem_emissions( state, cam_in, pbuf ) + use physics_buffer, only : physics_buffer_desc use camsrfexch, only : cam_in_t ! Arguments: TYPE(physics_state), INTENT(IN) :: state ! Physics state variables TYPE(cam_in_t), INTENT(INOUT) :: cam_in ! import state + TYPE(physics_buffer_desc), pointer :: pbuf(:) ! Physics buffer in chunk, for HEMCO INTEGER :: M, N INTEGER :: LCHNK, nY From 5eb55a137df149328a8cc52a4cd580b263aa5ec1 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 28 Jul 2023 15:17:35 -0600 Subject: [PATCH 113/160] Updates to use HEMCO for GEOS-Chem compset These updates are necessary following changes to how HEMCO is integrated into CESM. Signed-off-by: Lizzie Lundgren --- bld/namelist_files/use_cases/2000_geoschem.xml | 3 +++ bld/namelist_files/use_cases/2010_geoschem.xml | 4 ++++ bld/namelist_files/use_cases/hist_geoschem.xml | 3 +++ bld/namelist_files/use_cases/hist_geoschem_nudged.xml | 3 +++ bld/namelist_files/use_cases/sd_geoschem.xml | 3 +++ cime_config/config_component.xml | 2 +- cime_config/config_compsets.xml | 10 +++++----- 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index 49b49d6cd6..d967d25c41 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -14,6 +14,9 @@ /glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc +HEMCO_Config.rc +HEMCO_Diagn.rc + 00010101 diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index cf9ae2af8b..b0bce3ae6b 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -12,6 +12,10 @@ /glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc +HEMCO_Config.rc +HEMCO_Diagn.rc + + 00010101 diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 83d3fc39ba..6e4c1d181b 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -14,6 +14,9 @@ /glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc +HEMCO_Config.rc +HEMCO_Diagn.rc + 00010101 diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml index cf75619028..13afb38906 100644 --- a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -14,6 +14,9 @@ /glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc +HEMCO_Config.rc +HEMCO_Diagn.rc + 00010101 diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index 41647f8ecb..8691b5babb 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -16,6 +16,9 @@ /glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc +HEMCO_Config.rc +HEMCO_Diagn.rc + diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index ce2432a7cd..c368028508 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -141,7 +141,7 @@ -phys cam_dev -chem ghg_mam4 -chem trop_strat_mam5_vbs - -chem geoschem_mam4 -hemco + -chem geoschem_mam4 -chem trop_mam7 -chem trop_strat_mam5_vbsext diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 38fdeedf98..7ca1787566 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -563,27 +563,27 @@ FC2000climo_GC - 2000_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV + 2000_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV%HEMCO FC2010climo_GC - 2010_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV + 2010_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV%HEMCO FCHIST_GC - HIST_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV + HIST_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV%HEMCO FCSD_GC - HIST_CAM60%GC%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + HIST_CAM60%GC%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV%HEMCO FCnudged_GC - HIST_CAM60%GC%NUDG_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + HIST_CAM60%GC%NUDG_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV%HEMCO From 4563541e7f2fd32e1b11ef43b3c2da9819860191 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 28 Jul 2023 15:17:50 -0600 Subject: [PATCH 114/160] Minor cleanup changes Signed-off-by: Lizzie Lundgren --- bld/build-namelist | 2 +- cime_config/config_component.xml | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 9289a0ebd5..b36f5d7cb5 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -2473,7 +2473,7 @@ if (($chem =~ /_mam4/ or $chem =~ /_mam5/) and ($phys =~ /cam6/ or $phys =~ /cam $first = 0; } } - if ($chem !~ /geoschem/) { + if ($chem !~ /geoschem/) { add_default($nl, 'ext_frc_specifier', 'val'=>$val); unless (defined $nl->get_value('ext_frc_type')) { add_default($nl, 'ext_frc_type', 'val'=>"'CYCLICAL'"); diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index c368028508..899c6083ae 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -187,7 +187,6 @@ -phys tj2016 -analytic_ic -phys grayrad -analytic_ic -phys held_suarez -analytic_ic - -phys held_suarez -chem geoschem -hemco -analytic_ic -phys kessler -chem terminator -analytic_ic -nadv_tt=6 @@ -228,11 +227,6 @@ waccmxie_ma_2000_cam4 waccmx_ma_2000_cam4 - geoschem - geoschem - geoschem - geoschem_baro_moist - 2000_cam6 2000_cam6 waccm_tsmlt_2000_cam6 @@ -278,7 +272,7 @@ hist_trop_strat_vbsext_cam6 hist_trop_strat_vbsfire_cam6 hist_geoschem - hist_geoschem_nudged + hist_geoschem_nudged waccmx_ma_hist_cam6 1850-PD_cam5 From 38d51b7131c07e22e68df085114566895568b39c Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 29 Aug 2023 14:57:41 -0600 Subject: [PATCH 115/160] Remove HEMCO from src/control/cam_comp.F90 This update is needed to run with the latest cam_development which already had the update. The old code came in with the recent merge. Signed-off-by: Lizzie Lundgren --- src/control/cam_comp.F90 | 42 ---------------------------------------- 1 file changed, 42 deletions(-) diff --git a/src/control/cam_comp.F90 b/src/control/cam_comp.F90 index f4091fda1a..3bb1052288 100644 --- a/src/control/cam_comp.F90 +++ b/src/control/cam_comp.F90 @@ -81,10 +81,6 @@ subroutine cam_init( & use stepon, only: stepon_init use ionosphere_interface, only: ionosphere_init -#if (defined HEMCO_CESM) - use hemco_interface, only: HCOI_Chunk_Init -#endif - use camsrfexch, only: hub2atm_alloc, atm2hub_alloc use cam_history, only: intht use history_scam, only: scm_intht @@ -186,11 +182,6 @@ subroutine cam_init( & ! initialize ionosphere call ionosphere_init() -#if (defined HEMCO_CESM) - ! initialize harmonized emissions component (HEMCO) - call hcoi_chunk_init() -#endif - if (initial_run_in) then call dyn_init(dyn_in, dyn_out) @@ -239,10 +230,6 @@ subroutine cam_run1(cam_in, cam_out) use stepon, only: stepon_run1 use ionosphere_interface,only: ionosphere_run1 -#if (defined HEMCO_CESM) - use hemco_interface, only: HCOI_Chunk_Run -#endif - type(cam_in_t) :: cam_in(begchunk:endchunk) type(cam_out_t) :: cam_out(begchunk:endchunk) @@ -264,13 +251,6 @@ subroutine cam_run1(cam_in, cam_out) !---------------------------------------------------------- call ionosphere_run1(pbuf2d) -#if (defined HEMCO_CESM) - !---------------------------------------------------------- - ! run hemco (first phase?) - !---------------------------------------------------------- - call HCOI_Chunk_Run(cam_in, phys_state, pbuf2d, 1) -#endif - ! !---------------------------------------------------------- ! PHYS_RUN Call the Physics package @@ -302,10 +282,6 @@ subroutine cam_run2( cam_out, cam_in ) use stepon, only: stepon_run2 use ionosphere_interface, only: ionosphere_run2 -#if (defined HEMCO_CESM) - use hemco_interface, only: HCOI_Chunk_Run -#endif - type(cam_out_t), intent(inout) :: cam_out(begchunk:endchunk) type(cam_in_t), intent(inout) :: cam_in(begchunk:endchunk) @@ -314,13 +290,6 @@ subroutine cam_run2( cam_out, cam_in ) return endif -#if (defined HEMCO_CESM) - !---------------------------------------------------------- - ! run hemco (phase 2 before chemistry) - !---------------------------------------------------------- - call HCOI_Chunk_Run(cam_in, phys_state, pbuf2d, 2) -#endif - ! ! Second phase of physics (after surface model update) ! @@ -458,10 +427,6 @@ subroutine cam_final( cam_out, cam_in ) use ionosphere_interface, only: ionosphere_final use cam_control_mod, only: initial_run -#if (defined HEMCO_CESM) - use hemco_interface, only: HCOI_Chunk_Final -#endif - ! ! Arguments ! @@ -476,13 +441,6 @@ subroutine cam_final( cam_out, cam_in ) call stepon_final(dyn_in, dyn_out) call ionosphere_final() -#if (defined HEMCO_CESM) - !---------------------------------------------------------- - ! cleanup hemco - !---------------------------------------------------------- - call HCOI_Chunk_Final() -#endif - if (initial_run) then call cam_initfiles_close() end if From 8796376f28d658c948dc67dcac8bd0a413e769f8 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 29 Aug 2023 14:59:25 -0600 Subject: [PATCH 116/160] Fix how HEMCO is specified in GEOS-Chem compset configuration Signed-off-by: Lizzie Lundgren --- cime_config/config_compsets.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 7ca1787566..cd274d95ef 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -563,27 +563,27 @@ FC2000climo_GC - 2000_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV%HEMCO + 2000_CAM60%GC%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV FC2010climo_GC - 2010_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV%HEMCO + 2010_CAM60%GC%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV FCHIST_GC - HIST_CAM60%GC_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV%HEMCO + HIST_CAM60%GC%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV FCSD_GC - HIST_CAM60%GC%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV%HEMCO + HIST_CAM60%GC%HEMCO%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV FCnudged_GC - HIST_CAM60%GC%NUDG_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV%HEMCO + HIST_CAM60%GC%HEMCO%NUDG_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV From 750cf521fb1807b3ecba933688bf3ea69b58b198 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 29 Aug 2023 15:11:59 -0600 Subject: [PATCH 117/160] Use HEMCO config files in Buildconf/camconf when running with GEOS-Chem GEOS-Chem expects to use HEMCO configuration files that are included in the GEOS-Chem repository. Those files get copied into Buildconf/camconf during the first build of any GEOS-Chem compset. If not using GEOS-Chem then HEMCO files are read from the input data path specified as namelist defaults. This update adds a modifier to change the hemco_config_file and hemco_diagn_file namelist parameters when building the namelist for a GEOS-Chem compset to be simply HEMCO_Config.rc and HEMCO_Diagn.rc, with no absolute path specified. Signed-off-by: Lizzie Lundgren --- bld/build-namelist | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bld/build-namelist b/bld/build-namelist index b36f5d7cb5..a2bf6393f1 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -2963,6 +2963,12 @@ if ($nl->get_value('use_hemco') =~ m/$TRUE/io) { # ignored at runtime when HEMCO is used. $nl->delete_variable('chem_inparm', 'ext_frc_specifier'); $nl->delete_variable('chem_inparm', 'srf_emis_specifier'); + + # If using GEOS-Chem reset paths of HEMCO configuration files to local filename only + if ($chem =~ /geoschem/) { + $nl->set_variable_value('hemco_nl', 'hemco_config_file', "'HEMCO_Config.rc'"); + $nl->set_variable_value('hemco_nl', 'hemco_diagn_file', "'HEMCO_Diagn.rc'"); + } } # Physics options From dae6502d255057b071e658d3b2d8c25b83cb2344 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 6 Sep 2023 11:59:01 -0400 Subject: [PATCH 118/160] Remove unused code in configure and build-namelist Signed-off-by: Lizzie Lundgren --- bld/build-namelist | 4 ---- bld/configure | 11 ----------- 2 files changed, 15 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 6952455a16..f01e6def03 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -2051,10 +2051,6 @@ if ($chem =~ /geoschem/) { my @files; # Datasets - #@files = ( 'soil_erod_file', 'flbc_file', - # 'xs_coef_file','xs_short_file', - # 'xs_long_file', 'rsf_file', - # 'exo_coldens_file', 'sulf_file' ); @files = ( 'soil_erod_file', 'flbc_file' ); foreach my $file (@files) { add_default($nl, $file); diff --git a/bld/configure b/bld/configure index 516fb9cdc0..da7330152a 100755 --- a/bld/configure +++ b/bld/configure @@ -80,7 +80,6 @@ OPTIONS -cpl Coupling framework [mct | nuopc]. Default: mct. -dyn Dynamical core option: [eul | fv | se | fv3 | mpas]. Default: fv. -edit_chem_mech Invokes CAMCHEM_EDITOR to allow the user to edit the chemistry mechanism file - -hemco Switch enables the use of the Harmonized Emissions Component. -hgrid Specify horizontal grid. Use nlatxnlon for spectral grids; dlatxdlon for fv grids (dlat and dlon are the grid cell size in degrees for latitude and longitude respectively); nexnp for @@ -264,7 +263,6 @@ GetOptions( "fv3core_libdir=s" => \$opts{'fv3core_libdir'}, "gmake=s" => \$opts{'gmake'}, "h|help" => \$opts{'help'}, - "hemco" => \$opts{'hemco'}, "hgrid=s" => \$opts{'hgrid'}, "ionosphere=s" => \$opts{'ionosphere'}, "lapack_libdir=s" => \$opts{'lapack_libdir'}, @@ -1574,14 +1572,6 @@ else { $nadv = $cfg_ref->get('nadv'); if ($print>=2) { print "Total advected constituents: $nadv$eol"; } -#----------------------------------------------------------------------------------------------- - -# Harmonized Emissions Component (HEMCO) -if (defined $opts{'hemco'}) { - $cfg_ref->set('hemco', $opts{'hemco'}); -} -my $hemco = $cfg_ref->get('hemco'); - #----------------------------------------------------------------------------------------------- # Makefile configuration ####################################################################### #----------------------------------------------------------------------------------------------- @@ -2112,7 +2102,6 @@ sub write_filepath my $waccm_phys = $cfg_ref->get('waccm_phys'); my $waccmx = $cfg_ref->get('waccmx'); my $ionos = $cfg_ref->get('ionosphere'); - my $hemco = $cfg_ref->get('hemco'); my $carma = $cfg_ref->get('carma'); my $rad = $cfg_ref->get('rad'); my $dyn = $cfg_ref->get('dyn'); From e1a6fd2460a6f78dff174379954df78034ed7d6b Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 6 Sep 2023 12:02:42 -0400 Subject: [PATCH 119/160] Use shr_kind_cl in GEOS-Chem character declarations; remove SPMD cpp defs This commit also removes some unused lines of code. Signed-off-by: Lizzie Lundgren --- src/chemistry/geoschem/chem_mods.F90 | 16 ++--- src/chemistry/geoschem/chemistry.F90 | 60 ++++++++----------- .../geoschem/geoschem_diagnostics_mod.F90 | 20 +++---- .../geoschem/geoschem_emissions_mod.F90 | 10 ++-- .../geoschem/geoschem_history_mod.F90 | 2 - 5 files changed, 50 insertions(+), 58 deletions(-) diff --git a/src/chemistry/geoschem/chem_mods.F90 b/src/chemistry/geoschem/chem_mods.F90 index 40a8828dbb..2d8a500253 100644 --- a/src/chemistry/geoschem/chem_mods.F90 +++ b/src/chemistry/geoschem/chem_mods.F90 @@ -2,25 +2,27 @@ module chem_mods !-------------------------------------------------------------- ! ... Basic chemistry parameters and arrays !-------------------------------------------------------------- - use shr_kind_mod, only : r8 => shr_kind_r8 + use shr_kind_mod, only : r8 => shr_kind_r8, shr_kind_cl use constituents, only : pcnst implicit none save INTEGER, PARAMETER :: nTracersMax = 267 ! Must be equal to chem_nadv INTEGER :: nTracers - CHARACTER(LEN=255) :: tracerNames(nTracersMax) - CHARACTER(LEN=255) :: tracerLongNames(nTracersMax) REAL(r8) :: ref_MMR(pcnst) + CHARACTER(LEN=shr_kind_cl) :: tracerNames(nTracersMax) + CHARACTER(LEN=shr_kind_cl) :: tracerLongNames(nTracersMax) + ! Index of first constituent INTEGER :: iFirstCnst ! Short-lived species (i.e. not advected) INTEGER, PARAMETER :: nSlsMax = 500 ! UNadvected species only - INTEGER :: nSls - CHARACTER(LEN=255) :: slsNames(nSlsMax) - CHARACTER(LEN=255) :: slsLongnames(nSlsMax) + INTEGER :: nSls + + CHARACTER(LEN=shr_kind_cl) :: slsNames(nSlsMax) + CHARACTER(LEN=shr_kind_cl) :: slsLongnames(nSlsMax) ! Mapping between constituents and GEOS-Chem tracers INTEGER :: map2GC(pcnst) @@ -100,7 +102,7 @@ module chem_mods logical :: frc_from_dataset(max(1,extcnt)) logical :: is_vector logical :: is_scalar - character(len=255), allocatable :: slvd_lst(:) + character(len=shr_kind_cl), allocatable :: slvd_lst(:) ! Mapping between chemical species and GEOS-Chem species/other tracers INTEGER :: map2chm(gas_pcnst) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 59c14be74b..678a64f21d 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -98,7 +98,7 @@ module chemistry CHARACTER(LEN=500) :: speciesDB = 'species_database.yml' ! Location of chemistry input - CHARACTER(LEN=256) :: gc_cheminputs + CHARACTER(LEN=shr_kind_cl) :: gc_cheminputs ! Debugging LOGICAL :: debug = .TRUE. @@ -167,8 +167,8 @@ module chemistry CHARACTER(len=shr_kind_cl) :: h2orates = ' ' ! pathname for greenhouse gas (lyman-alpha H2O loss) ! Strings - CHARACTER(LEN=255) :: ThisLoc - CHARACTER(LEN=255) :: ErrMsg + CHARACTER(LEN=shr_kind_cl) :: ThisLoc + CHARACTER(LEN=shr_kind_cl) :: ErrMsg ! For dry deposition character(len=shr_kind_cl) :: depvel_lnd_file = 'depvel_lnd_file' @@ -874,7 +874,6 @@ subroutine chem_readnl(nlfile) ! Broadcast to all processors !================================================================== -#if defined( SPMD ) CALL MPIBCAST ( nTracers, 1, MPIINT, 0, MPICOM ) CALL MPIBCAST ( tracerNames, LEN(tracerNames(1))*nTracersMax, MPICHAR, 0, MPICOM ) CALL MPIBCAST ( nSls, 1, MPIINT, 0, MPICOM ) @@ -885,7 +884,6 @@ subroutine chem_readnl(nlfile) CALL MPIBCAST (ghg_chem, 1, MPILOG, 0, MPICOM) CALL MPIBCAST (bndtvg, LEN(bndtvg), MPICHAR, 0, MPICOM) CALL MPIBCAST (h2orates, LEN(h2orates), MPICHAR, 0, MPICOM) -#endif IF ( nSls .NE. nSlvd ) THEN write(iulog,'(a,i4)') 'nSlvd in geoschem/chem_mods.F90 does not match # non-advected KPP species. Set nSlvd to ', nSls @@ -1033,8 +1031,8 @@ subroutine chem_init(phys_state, pbuf2d) LOGICAL :: Found ! Strings - CHARACTER(LEN=255) :: historyConfigFile - CHARACTER(LEN=255) :: SpcName + CHARACTER(LEN=shr_kind_cl) :: historyConfigFile + CHARACTER(LEN=shr_kind_cl) :: SpcName ! Objects TYPE(Species), POINTER :: SpcInfo @@ -1274,9 +1272,7 @@ subroutine chem_init(phys_state, pbuf2d) ! Copy the data to a temporary array linozData = REAL(Input_Opt%LINOZ_TPARM, r8) ENDIF -#if defined( SPMD ) CALL MPIBCAST( linozData, nLinoz, MPIR8, 0, MPICOM ) -#endif IF ( .NOT. MasterProc ) THEN Input_Opt%LINOZ_TPARM = REAL(linozData,fp) ENDIF @@ -1810,10 +1806,8 @@ subroutine gc_readnl(nlfile) CALL freeunit(unitn) ENDIF -#ifdef SPMD ! Broadcast namelist variables CALL MPIBCAST(gc_cheminputs, LEN(gc_cheminputs), MPICHAR, 0, MPICOM) -#endif end subroutine !EOC @@ -1995,10 +1989,11 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) REAL(r8) :: eflx(pcols,pver,pcnst) ! 3-D emissions in kg/m2/s ! For GEOS-Chem diagnostics - REAL(r8) :: mmr_tend(state%NCOL,PVER,gas_pcnst) - REAL(r8) :: wk_out(state%NCOL) - LOGICAL :: Found - CHARACTER(LEN=255) :: tagName + REAL(r8) :: mmr_tend(state%NCOL,PVER,gas_pcnst) + REAL(r8) :: wk_out(state%NCOL) + LOGICAL :: Found + + CHARACTER(LEN=shr_kind_cl) :: tagName REAL(r8), PARAMETER :: zlnd = 0.01_r8 ! Roughness length for soil [m] REAL(r8), PARAMETER :: zslnd = 0.0024_r8 ! Roughness length for snow [m] @@ -2030,8 +2025,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Calculating SZA REAL(r8) :: Calday - CHARACTER(LEN=255) :: SpcName - CHARACTER(LEN=255) :: Prefix, FieldName + CHARACTER(LEN=shr_kind_cl) :: SpcName + CHARACTER(LEN=shr_kind_cl) :: Prefix, FieldName + LOGICAL :: FND INTEGER :: SpcId TYPE(Species), POINTER :: SpcInfo @@ -4389,9 +4385,9 @@ end subroutine chem_final !=============================================================================== subroutine chem_init_restart(File) - use tracer_cnst, only: init_tracer_cnst_restart - use tracer_srcs, only: init_tracer_srcs_restart - use pio, only : file_desc_t + use tracer_cnst, only : init_tracer_cnst_restart + use tracer_srcs, only : init_tracer_srcs_restart + use pio, only : file_desc_t IMPLICIT NONE @@ -4411,43 +4407,39 @@ end subroutine chem_init_restart !=============================================================================== subroutine chem_write_restart( File ) - use tracer_cnst, only: write_tracer_cnst_restart - use tracer_srcs, only: write_tracer_srcs_restart - !use linoz_data, only: write_linoz_data_restart - use pio, only : file_desc_t + use tracer_cnst, only : write_tracer_cnst_restart + use tracer_srcs, only : write_tracer_srcs_restart + use pio, only : file_desc_t IMPLICIT NONE TYPE(file_desc_t) :: File WRITE(iulog,'(a)') 'chem_write_restart: writing restarts for tracer sources and offline fields' - ! + ! data for offline tracers - ! call write_tracer_cnst_restart(File) call write_tracer_srcs_restart(File) - !call write_linoz_data_restart(File) + end subroutine chem_write_restart !=============================================================================== subroutine chem_read_restart( File ) - use tracer_cnst, only: read_tracer_cnst_restart - use tracer_srcs, only: read_tracer_srcs_restart - !use linoz_data, only: read_linoz_data_restart - use pio, only : file_desc_t + use tracer_cnst, only : read_tracer_cnst_restart + use tracer_srcs, only : read_tracer_srcs_restart + use pio, only : file_desc_t IMPLICIT NONE TYPE(file_desc_t) :: File WRITE(iulog,'(a)') 'GCCALL CHEM_READ_RESTART' - ! + ! data for offline tracers - ! call read_tracer_cnst_restart(File) call read_tracer_srcs_restart(File) - !call read_linoz_data_restart(File) + end subroutine chem_read_restart !================================================================================ diff --git a/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 b/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 index 1b729121f1..f40ca20d92 100644 --- a/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 +++ b/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 @@ -15,7 +15,7 @@ MODULE GeosChem_Diagnostics_Mod ! ! !USES: ! - USE SHR_KIND_MOD, ONLY : r8 => shr_kind_r8 + USE SHR_KIND_MOD, ONLY : r8 => shr_kind_r8, shr_kind_cl USE SHR_CONST_MOD, ONLY : pi => shr_const_pi USE CAM_HISTORY, ONLY : fieldname_len USE CONSTITUENTS, ONLY : pcnst @@ -208,11 +208,11 @@ SUBROUTINE GC_Diagnostics_Init( Input_Opt, State_Chm, State_Met ) ! liquid budgets. ! Strings - CHARACTER(LEN=255) :: SpcName - CHARACTER(LEN=255) :: tagName - CHARACTER(LEN=255) :: ThisLoc - CHARACTER(LEN=255) :: ErrMsg - CHARACTER(LEN=2) :: unit_basename ! Units 'kg' or '1' + CHARACTER(LEN=shr_kind_cl) :: SpcName + CHARACTER(LEN=shr_kind_cl) :: tagName + CHARACTER(LEN=shr_kind_cl) :: ThisLoc + CHARACTER(LEN=shr_kind_cl) :: ErrMsg + CHARACTER(LEN=2) :: unit_basename ! Units 'kg' or '1' ! Objects TYPE(Species), POINTER :: SpcInfo @@ -921,10 +921,10 @@ SUBROUTINE GC_Diagnostics_Calc( Input_Opt, State_Chm, State_Diag, & ! on level edges (T/F) ! Strings - CHARACTER(LEN=255) :: ThisLoc - CHARACTER(LEN=255) :: ErrMsg - CHARACTER(LEN=255) :: SpcName - CHARACTER(LEN=255) :: tagName + CHARACTER(LEN=shr_kind_cl) :: ThisLoc + CHARACTER(LEN=shr_kind_cl) :: ErrMsg + CHARACTER(LEN=shr_kind_cl) :: SpcName + CHARACTER(LEN=shr_kind_cl) :: tagName ! Real REAL(r8) :: wgt diff --git a/src/chemistry/geoschem/geoschem_emissions_mod.F90 b/src/chemistry/geoschem/geoschem_emissions_mod.F90 index 99bc9eff7f..37142e4d5b 100644 --- a/src/chemistry/geoschem/geoschem_emissions_mod.F90 +++ b/src/chemistry/geoschem/geoschem_emissions_mod.F90 @@ -15,7 +15,7 @@ MODULE GeosChem_Emissions_Mod ! ! !USES: ! - USE SHR_KIND_MOD, ONLY : r8 => shr_kind_r8 + USE SHR_KIND_MOD, ONLY : r8 => shr_kind_r8, shr_kind_cl USE SPMD_UTILS, ONLY : MasterProc USE CAM_ABORTUTILS, ONLY : endrun USE CHEM_MODS, ONLY : iFirstCnst @@ -105,8 +105,8 @@ SUBROUTINE GC_Emissions_Init( ) LOGICAL :: history_cesm_forcing ! Strings - CHARACTER(LEN=255) :: SpcName - CHARACTER(LEN=255) :: Description + CHARACTER(LEN=shr_kind_cl) :: SpcName + CHARACTER(LEN=shr_kind_cl) :: Description ! Real REAL(r8) :: MW @@ -339,8 +339,8 @@ SUBROUTINE GC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iStep REAL(r8), PARAMETER :: m2km = 1.e-3_r8 ! Strings - CHARACTER(LEN=255) :: SpcName - CHARACTER(LEN=255) :: fldname_ns ! field name HCO_* + CHARACTER(LEN=shr_kind_cl) :: SpcName + CHARACTER(LEN=shr_kind_cl) :: fldname_ns ! field name HCO_* !================================================================= ! GC_Emissions_Calc begins here! diff --git a/src/chemistry/geoschem/geoschem_history_mod.F90 b/src/chemistry/geoschem/geoschem_history_mod.F90 index fb722c44a5..40da3f37dc 100644 --- a/src/chemistry/geoschem/geoschem_history_mod.F90 +++ b/src/chemistry/geoschem/geoschem_history_mod.F90 @@ -27,8 +27,6 @@ MODULE GeosChem_History_Mod USE ErrCode_Mod USE Precision_Mod - USE cam_abortutils, only : endrun - IMPLICIT NONE PRIVATE ! From 8b3dff50761b8c8cae8a8b6e38df1b4c1c5e6bb9 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 6 Sep 2023 12:04:07 -0400 Subject: [PATCH 120/160] Always use ONLY keyword in USE statements This commit also includes reorganizing of all GEOS-Chem interface USE statements so that they are split into three categories: CAM modules, GEOS-Chem interface modules in CAM, and GEOS-Chem modules. They are alphabetized within each section. An extraneous hemco_interface declaration and new line are also removed. --- src/chemistry/geoschem/chemistry.F90 | 607 ++++++++---------- .../geoschem/geoschem_diagnostics_mod.F90 | 201 ++---- .../geoschem/geoschem_emissions_mod.F90 | 215 ++----- .../geoschem/geoschem_history_mod.F90 | 53 +- src/control/cam_comp.F90 | 1 - src/control/runtime_opts.F90 | 4 - 6 files changed, 408 insertions(+), 673 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 678a64f21d..4bf7fbaa67 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -1,81 +1,50 @@ -!================================================================================================ -! This is the "GEOS-Chem" chemistry module. -!================================================================================================ - module chemistry - use shr_kind_mod, only : r8 => shr_kind_r8, shr_kind_cl - use physics_types, only : physics_state, physics_ptend, physics_ptend_init + + ! CAM modules + use cam_abortutils, only : endrun + use cam_logfile, only : iulog + use chem_mods, only : nTracersMax, nTracers, tracerNames + use chem_mods, only : gas_pcnst, adv_mass, ref_MMR, iFirstCnst + use chem_mods, only : nSlsMax, nSls, slsNames, nSlvd, slvd_Lst + use chem_mods, only : nAerMax, nAer, aerNames, aerAdvMass + use chem_mods, only : map2GC, map2GCinv, map2GC_Sls + use chem_mods, only : mapCnst, map2chm, map2MAM4 + use constituents, only : pcnst, cnst_add, cnst_get_ind, cnst_name + use mo_tracname, only : solsym use physics_buffer, only : physics_buffer_desc - use ppgrid, only : begchunk, endchunk, pcols - use ppgrid, only : pver, pverp - use constituents, only : pcnst, cnst_add, cnst_get_ind - use constituents, only : cnst_name + use physics_types, only : physics_state, physics_ptend, physics_ptend_init + use ppgrid, only : begchunk, endchunk, pcols, pver, pverp use shr_const_mod, only : molw_dryair=>SHR_CONST_MWDAIR use shr_drydep_mod, only : nddvels => n_drydep, drydep_list + use shr_kind_mod, only : r8 => shr_kind_r8, shr_kind_cl use spmd_utils, only : MasterProc, myCPU=>Iam, nCPUs=>npes - use cam_logfile, only : iulog use string_utils, only : to_upper - - !-------------------------------------------------------------------- - ! Basic GEOS-Chem modules - !-------------------------------------------------------------------- - USE DiagList_Mod, ONLY : DgnList ! Derived type for diagnostics list - USE TaggedDiagList_Mod, ONLY : TaggedDgnList ! Derived type for tagged diagnostics list - USE Input_Opt_Mod, ONLY : OptInput ! Derived type for Input Options - USE State_Chm_Mod, ONLY : ChmState ! Derived type for Chemistry State object - USE State_Diag_Mod, ONLY : DgnState ! Derived type for Diagnostics State object - USE State_Grid_Mod, ONLY : GrdState ! Derived type for Grid State object - USE State_Met_Mod, ONLY : MetState ! Derived type for Meteorology State object - USE Species_Mod, ONLY : Species ! Derived type for Species object - USE GC_Environment_Mod ! Runtime GEOS-Chem environment - USE ErrCode_Mod ! Error codes for success or failure - USE Error_Mod ! For error checking - USE Precision_Mod, ONLY : fp, f4 ! Flexible precision - - use chem_mods, only : nSlvd, slvd_Lst - - !-------------------------------------------------------------------- - ! GEOS-Chem History exports module - !-------------------------------------------------------------------- - use GeosChem_History_Mod - - !-------------------------------------------------------------------- - ! CAM modules - !-------------------------------------------------------------------- - ! Exit routine in CAM - use cam_abortutils, only : endrun - - use chem_mods, only : nTracersMax - use chem_mods, only : nTracers - use chem_mods, only : gas_pcnst - use chem_mods, only : tracerNames - use chem_mods, only : adv_mass - use chem_mods, only : ref_MMR - use chem_mods, only : iFirstCnst - use chem_mods, only : nSlsMax - use chem_mods, only : nSls - use chem_mods, only : slsNames - use chem_mods, only : nAerMax - use chem_mods, only : nAer - use chem_mods, only : aerNames - use chem_mods, only : aerAdvMass - use chem_mods, only : map2GC, map2GCinv - use chem_mods, only : map2GC_Sls - use chem_mods, only : mapCnst - use chem_mods, only : map2chm - use chem_mods, only : map2MAM4 #if defined( MODAL_AERO ) use modal_aero_data, only : ntot_amode #endif - - use mo_tracname, only : solsym + + ! GEOS-Chem derived types + USE DiagList_Mod, ONLY : DgnList ! Diagnostics list object + use GeosChem_History_Mod, ONLY : HistoryConfigObj ! History diagnostic object + USE Input_Opt_Mod, ONLY : OptInput ! Input Options + USE Species_Mod, ONLY : Species ! Species object + USE State_Chm_Mod, ONLY : ChmState ! Chemistry State object + USE State_Diag_Mod, ONLY : DgnState ! Diagnostics State object + USE State_Grid_Mod, ONLY : GrdState ! Grid State object + USE State_Met_Mod, ONLY : MetState ! Meteorology State object + USE TaggedDiagList_Mod, ONLY : TaggedDgnList ! Ragged diagnostics list + + ! GEOS-Chem utilities + USE ErrCode_Mod, ONLY : GC_SUCCESS, GC_FAILURE + USE ErrCode_Mod, ONLY : GC_Error, GC_CheckVar, GC_Warning + USE Error_Mod, ONLY : Error_Stop + USE Precision_Mod, ONLY : fp, f4 ! Flexible precision IMPLICIT NONE PRIVATE SAVE - ! + ! Public interfaces - ! public :: chem_is ! identify which chemistry is being used public :: chem_register ! register consituents public :: chem_is_active ! returns true if this package is active (ghg_chem=.true.) @@ -88,7 +57,6 @@ module chemistry public :: chem_read_restart public :: chem_init_restart public :: chem_readnl ! read chem namelist - public :: chem_emissions public :: chem_timestep_init @@ -103,20 +71,16 @@ module chemistry ! Debugging LOGICAL :: debug = .TRUE. - !----------------------------- ! Derived type objects - !----------------------------- - TYPE(OptInput) :: Input_Opt ! Input Options object - TYPE(ChmState),ALLOCATABLE :: State_Chm(:) ! Chemistry State object - TYPE(DgnState),ALLOCATABLE :: State_Diag(:) ! Diagnostics State object - TYPE(GrdState),ALLOCATABLE :: State_Grid(:) ! Grid State object - TYPE(MetState),ALLOCATABLE :: State_Met(:) ! Meteorology State object - TYPE(DgnList ) :: Diag_List ! Diagnostics list object - TYPE(TaggedDgnList ) :: TaggedDiag_List ! Tagged diagnostics list object - - TYPE(HistoryConfigObj), POINTER :: HistoryConfig ! HistoryConfig object for History diagn. - - type(physics_buffer_desc), pointer :: hco_pbuf2d(:,:) ! Pointer to 2D pbuf + TYPE(OptInput) :: Input_Opt ! Input Options object + TYPE(ChmState),ALLOCATABLE :: State_Chm(:) ! Chemistry State object + TYPE(DgnState),ALLOCATABLE :: State_Diag(:) ! Diagnostics State object + TYPE(GrdState),ALLOCATABLE :: State_Grid(:) ! Grid State object + TYPE(MetState),ALLOCATABLE :: State_Met(:) ! Meteorology State object + TYPE(DgnList ) :: Diag_List ! Diagnostics list object + TYPE(TaggedDgnList ) :: TaggedDiag_List ! Tagged diagnostics list object + TYPE(HistoryConfigObj), POINTER :: HistoryConfig ! HistoryConfig object for History diagn. + type(physics_buffer_desc), POINTER :: hco_pbuf2d(:,:) ! Pointer to 2D pbuf ! Mimic code in sfcvmr_mod.F90 TYPE :: SfcMrObj @@ -131,7 +95,6 @@ module chemistry ! Field prefix CHARACTER(LEN=63), PARAMETER :: Prefix_SfcVMR = 'VMR_' - ! Indices of critical species in GEOS-Chem INTEGER :: iH2O, iO3, iCO2, iSO4 INTEGER :: iO, iH, iO2 @@ -161,7 +124,6 @@ module chemistry INTEGER :: ixNDrop ! Cloud droplet number index ! ghg - LOGICAL :: ghg_chem = .false. ! .true. => use ghg chem package CHARACTER(len=shr_kind_cl) :: bndtvg = ' ' ! pathname for greenhouse gas loss rate CHARACTER(len=shr_kind_cl) :: h2orates = ' ' ! pathname for greenhouse gas (lyman-alpha H2O loss) @@ -173,16 +135,18 @@ module chemistry ! For dry deposition character(len=shr_kind_cl) :: depvel_lnd_file = 'depvel_lnd_file' -!================================================================================================ + contains -!================================================================================================ + !================================================================================================ + ! function chem_is + !================================================================================================ function chem_is (name) result (chem_name_is) + ! CAM modules use string_utils, only : to_lower character(len=*), intent(in) :: name - logical :: chem_name_is chem_name_is = (( to_lower(name) == 'geoschem' ) .or. & @@ -190,21 +154,17 @@ function chem_is (name) result (chem_name_is) end function chem_is -!================================================================================================ - + !================================================================================================ + ! subroutine chem_register + !================================================================================================ subroutine chem_register + ! CAM modules + use chem_mods, only : drySpc_ndx + use mo_chem_utls, only : get_spc_ndx + use physconst, only : MWDry use physics_buffer, only : pbuf_add_field, dtype_r8 - use PhysConst, only : MWDry use short_lived_species, only : Register_Short_Lived_Species - use State_Grid_Mod, only : Init_State_Grid, Cleanup_State_Grid - use State_Chm_Mod, only : Init_State_Chm, Cleanup_State_Chm - use State_Chm_Mod, only : Ind_ - use Input_Opt_Mod, only : Set_Input_Opt, Cleanup_Input_Opt - - use mo_sim_dat, only : set_sim_dat - use mo_chem_utls, only : get_spc_ndx - use chem_mods, only : drySpc_ndx #if defined( MODAL_AERO ) use aero_model, only : aero_model_register use modal_aero_data, only : nspec_max @@ -212,6 +172,15 @@ subroutine chem_register use modal_aero_data, only : xname_massptr #endif + ! GEOS-Chem interface modules in CAM + use mo_sim_dat, only : set_sim_dat + + ! GEOS-Chem modules + use GC_Environment_Mod, ONLY : GC_Init_Grid + use Input_Opt_Mod, only : Set_Input_Opt, Cleanup_Input_Opt + use State_Chm_Mod, only : Init_State_Chm, Cleanup_State_Chm, Ind_ + use State_Grid_Mod, only : Init_State_Grid, Cleanup_State_Grid + !----------------------------------------------------------------------- ! ! Purpose: register advected constituents for chemistry @@ -515,10 +484,10 @@ subroutine chem_register CALL cnst_get_ind('H2O', cH2O, abort=.True.) CALL cnst_get_ind('H2SO4', cH2SO4, abort=.True.) - !============================================================== + !------------------------------------------------------------ ! Get mapping between dry deposition species and species set - !============================================================== - + !------------------------------------------------------------ + nIgnored = 0 if (debug .and. masterproc) write(iulog,'(a,i4,a)') 'chem_register: looping over gas dry deposition list with ', nddvels, ' species' @@ -622,10 +591,7 @@ subroutine chem_register #endif - !============================================================== ! Print summary - !============================================================== - IF ( MasterProc ) THEN Write(iulog,'(/, a)') '### Summary of GEOS-Chem species (end of chem_register): ' Write(iulog,'( a)') REPEAT( '-', 50 ) @@ -666,24 +632,26 @@ subroutine chem_register end subroutine chem_register -!=============================================================================== - + !================================================================================================ + ! subroutine chem_readnl + !================================================================================================ subroutine chem_readnl(nlfile) + ! CAM modules use cam_abortutils, only : endrun - use units, only : getunit, freeunit + use chem_mods, only : drySpc_ndx + use gas_wetdep_opts, only : gas_wetdep_readnl + use gckpp_Model, only : nSpec, Spc_Names use namelist_utils, only : find_group_name + use mo_lightning, only : lightning_readnl + use units, only : getunit, freeunit #if defined( MODAL_AERO ) use aero_model, only : aero_model_readnl use dust_model, only : dust_readnl #endif - use gas_wetdep_opts, only : gas_wetdep_readnl - use mo_lightning, only : lightning_readnl #ifdef SPMD use mpishorthand #endif - use gckpp_Model, only : nSpec, Spc_Names - use chem_mods, only : drySpc_ndx ! args CHARACTER(LEN=*), INTENT(IN) :: nlfile ! filepath for file containing namelist input @@ -710,9 +678,7 @@ subroutine chem_readnl(nlfile) IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate drySpc_ndx') #if defined( MODAL_AERO_4MODE ) - !============================================================== ! Get names and molar weights of aerosols in MAM4 - !============================================================== nAer = 33 @@ -769,9 +735,9 @@ subroutine chem_readnl(nlfile) Write(iulog,'(/,a,/)') 'Now defining GEOS-Chem tracers and dry deposition mapping...' - !============================================================== + !---------------------------------------------------------- ! Read GEOS-Chem advected species from geoschem_config.yml - !============================================================== + !---------------------------------------------------------- unitn = getunit() @@ -823,11 +789,11 @@ subroutine chem_readnl(nlfile) WRITE(tracerNames(I),'(a,I0.4)') 'GCTRC_', I ENDDO - !============================================================== + !---------------------------------------------------------- ! Now go through the KPP mechanism and add any species not ! implemented by the tracer list in geoschem_config.yml - !============================================================== - + !---------------------------------------------------------- + IF ( nSpec > nSlsMax ) THEN CALL ENDRUN('chem_readnl: too many species - increase nSlsmax') ENDIF @@ -850,8 +816,6 @@ subroutine chem_readnl(nlfile) ENDIF ENDDO - !============================================================== - unitn = getunit() OPEN( unitn, FILE=TRIM(nlfile), STATUS='old', IOSTAT=IERR ) IF (IERR .NE. 0) THEN @@ -870,10 +834,10 @@ subroutine chem_readnl(nlfile) ENDIF - !================================================================== + !---------------------------------------------------------- ! Broadcast to all processors - !================================================================== - + !---------------------------------------------------------- + CALL MPIBCAST ( nTracers, 1, MPIINT, 0, MPICOM ) CALL MPIBCAST ( tracerNames, LEN(tracerNames(1))*nTracersMax, MPICHAR, 0, MPICOM ) CALL MPIBCAST ( nSls, 1, MPIINT, 0, MPICOM ) @@ -900,37 +864,31 @@ subroutine chem_readnl(nlfile) end subroutine chem_readnl -!================================================================================================ - + !================================================================================================ + ! function chem_is_active + !================================================================================================ function chem_is_active() - !----------------------------------------------------------------------- + logical :: chem_is_active - !----------------------------------------------------------------------- chem_is_active = .true. end function chem_is_active -!================================================================================================ - + !================================================================================================ + ! function chem_implements_cnst + !================================================================================================ function chem_implements_cnst(name) - !----------------------------------------------------------------------- - ! ! Purpose: return true if specified constituent is implemented by this package - ! ! Author: B. Eaton - ! - !----------------------------------------------------------------------- + IMPLICIT NONE - !-----------------------------Arguments--------------------------------- CHARACTER(LEN=*), INTENT(IN) :: name ! constituent name LOGICAL :: chem_implements_cnst ! return value - INTEGER :: M chem_implements_cnst = .false. - DO M = 1, gas_pcnst IF (TRIM(solsym(M)) .eq. TRIM(name)) THEN chem_implements_cnst = .true. @@ -940,8 +898,9 @@ function chem_implements_cnst(name) end function chem_implements_cnst -!=============================================================================== - + !================================================================================================ + ! subroutine chem_init + !================================================================================================ subroutine chem_init(phys_state, pbuf2d) !----------------------------------------------------------------------- ! @@ -949,21 +908,24 @@ subroutine chem_init(phys_state, pbuf2d) ! (and declare history variables) ! !----------------------------------------------------------------------- - use physics_buffer, only : physics_buffer_desc, pbuf_get_index - use chem_mods, only : map2GC_dryDep, drySpc_ndx -#ifdef SPMD - use mpishorthand -#endif + ! CAM modules use cam_abortutils, only : endrun - use mo_chem_utls, only : get_spc_ndx - - use Phys_Grid, only : get_Area_All_p - use hycoef, only : ps0, hyai, hybi, hyam - + use chem_mods, only : map2GC_dryDep, drySpc_ndx use gas_wetdep_opts, only : gas_wetdep_method + use hycoef, only : ps0, hyai, hybi, hyam + use mo_chem_utls, only : get_spc_ndx + use mo_ghg_chem, only : ghg_chem_init + use mo_mean_mass, only : init_mean_mass use mo_neu_wetdep, only : neu_wetdep_init - + use mo_setinv, only : setinv_inti + use Phys_Grid, only : get_Area_All_p + use physics_buffer, only : physics_buffer_desc, pbuf_get_index + use tracer_cnst, only : tracer_cnst_init + use tracer_srcs, only : tracer_srcs_init +#ifdef SPMD + use mpishorthand +#endif #if defined( MODAL_AERO ) use aero_model, only : aero_model_init use mo_setsox, only : sox_inti @@ -972,41 +934,32 @@ subroutine chem_init(phys_state, pbuf2d) use modal_aero_data, only : xname_massptr #endif - use Input_Opt_Mod - use State_Chm_Mod - use State_Grid_Mod - use State_Met_Mod + ! GEOS-Chem interface modules in CAM + use geoschem_diagnostics_mod, only : GC_Diagnostics_Init + use geoschem_emissions_mod, only : GC_Emissions_Init + use geoschem_history_mod, only : HistoryExports_SetServices + + ! GEOS-Chem modules + use Chemistry_Mod, only : Init_Chemistry use DiagList_Mod, only : Init_DiagList, Print_DiagList - use TaggedDiagList_Mod, only : Init_TaggedDiagList, Print_TaggedDiagList + use Drydep_Mod, only : depName, Ndvzind + use Error_Mod, only : Init_Error + use GC_Environment_Mod, only : GC_Init_Grid, GC_Init_StateObj + use GC_Environment_Mod, only : GC_Init_Extra, GC_Allocate_All use GC_Grid_Mod, only : SetGridFromCtrEdges - - ! Use GEOS-Chem versions of physical constants - use PhysConstants, only : PI, PI_180, Re - - use Time_Mod, only : Accept_External_Date_Time + use Input_Mod, only : Read_Input_File, Validate_Directories + use Input_Opt_Mod, only : Set_Input_Opt + use isorropiaII_Mod, only : Init_IsorropiaII + use Linear_Chem_Mod, only : Init_Linear_Chem use Linoz_Mod, only : Linoz_Read - - use CMN_Size_Mod - - use Drydep_Mod, only : depName, Ndvzind + use PhysConstants, only : PI, PI_180, Re use Pressure_Mod, only : Accept_External_ApBp - use Chemistry_Mod, only : Init_Chemistry + use State_Chm_Mod, only : Ind_ + use State_Grid_Mod, only : Init_State_Grid, Cleanup_State_Grid + use TaggedDiagList_Mod, only : Init_TaggedDiagList, Print_TaggedDiagList + use Time_Mod, only : Accept_External_Date_Time use Ucx_Mod, only : Init_Ucx - use Linear_Chem_Mod, only : Init_Linear_Chem - use isorropiaII_Mod, only : Init_IsorropiaII - use Input_Mod, only : Read_Input_File - use Input_Mod, only : Validate_Directories - use Olson_Landmap_Mod - use Vdiff_Mod - - use mo_setinv, only : setinv_inti - use mo_mean_mass, only : init_mean_mass - use mo_ghg_chem, only : ghg_chem_init - use tracer_cnst, only : tracer_cnst_init - use tracer_srcs, only : tracer_srcs_init - - use GeosChem_Emissions_Mod, only : GC_Emissions_Init - use GeosChem_Diagnostics_Mod, only : GC_Diagnostics_Init + use Vdiff_Mod, only : Max_PblHt_For_Vdiff TYPE(physics_state), INTENT(IN ) :: phys_state(BEGCHUNK:ENDCHUNK) TYPE(physics_buffer_desc), POINTER, INTENT(INOUT) :: pbuf2d(:,:) @@ -1154,10 +1107,10 @@ subroutine chem_init(phys_state, pbuf2d) Input_Opt%SpcDatabaseFile = TRIM(speciesDB) Input_Opt%FAST_JX_DIR = TRIM(gc_cheminputs)//'FAST_JX/v2020-02/' - !================================================================== + !---------------------------------------------------------- ! CESM-specific input flags - !================================================================== - + !---------------------------------------------------------- + ! onlineAlbedo -> True (use CLM albedo) ! -> False (read monthly-mean albedo from HEMCO) Input_Opt%onlineAlbedo = .true. @@ -1450,13 +1403,13 @@ subroutine chem_init(phys_state, pbuf2d) ENDIF IF ( Input_Opt%LDryD ) THEN - !============================================================== + !---------------------------------------------------------- ! Get mapping between CESM dry deposited species and the ! indices of State_Chm%DryDepVel. This needs to be done after ! Init_Drydep ! Thibaud M. Fritz - 04 Mar 2020 - !============================================================== - + !---------------------------------------------------------- + ALLOCATE(map2GC_dryDep(nddvels), STAT=IERR) IF ( IERR .NE. 0 ) CALL ENDRUN('Failed to allocate map2GC_dryDep') @@ -1695,14 +1648,16 @@ subroutine chem_init(phys_state, pbuf2d) end subroutine chem_init -!=============================================================================== - + !================================================================================================ + ! chem_timestep_init + !================================================================================================ subroutine chem_timestep_init(phys_state, pbuf2d) - use physics_buffer, only : physics_buffer_desc + ! CAM modules use mo_flbc, only : flbc_chk use mo_ghg_chem, only : ghg_chem_timestep_init - + use physics_buffer, only : physics_buffer_desc + TYPE(physics_state), INTENT(IN):: phys_state(begchunk:endchunk) TYPE(physics_buffer_desc), POINTER :: pbuf2d(:,:) @@ -1719,10 +1674,12 @@ subroutine chem_timestep_init(phys_state, pbuf2d) end subroutine chem_timestep_init -!=============================================================================== - - subroutine GC_Update_Timesteps(DT) + !================================================================================================ + ! subroutine gc_update_timesteps + !================================================================================================ + subroutine gc_update_timesteps(DT) + ! GEOS-Chem modules use Time_Mod, only : Set_Timesteps REAL(r8), INTENT(IN) :: DT @@ -1750,47 +1707,25 @@ subroutine GC_Update_Timesteps(DT) DT_MIN_LAST = DT_MIN ENDIF - end subroutine + end subroutine gc_update_timesteps -!=============================================================================== - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: gc_readnl -! -! !DESCRIPTION: Reads the namelist from cam/src/control/runtime_opts. -!\\ -!\\ -! !INTERFACE: -! + !================================================================================================ + ! subroutine gc_readnl + !================================================================================================ subroutine gc_readnl(nlfile) -! -! !USES: -! + ! Purpose: reads the namelist from cam/src/control/runtime_opts + + ! CAM modules + use mpishorthand use namelist_utils, only: find_group_name use units, only: getunit, freeunit - use mpishorthand -! -! !INPUT PARAMETERS: -! + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input -! -! !REVISION HISTORY: -! 21 Jan 2021 - T.M. Fritz - Initial version -!EOP -!------------------------------------------------------------------------------ -!BOC -! -! !LOCAL VARIABLES: -! integer :: unitn, ierr character(len=*), parameter :: subname = 'gc_readnl' namelist /gc_nl/ gc_cheminputs - !----------------------------------------------------------------------------- - ! Read namelist IF ( MasterProc ) THEN unitn = getunit() @@ -1809,104 +1744,79 @@ subroutine gc_readnl(nlfile) ! Broadcast namelist variables CALL MPIBCAST(gc_cheminputs, LEN(gc_cheminputs), MPICHAR, 0, MPICOM) - end subroutine -!EOC - -!=============================================================================== + end subroutine gc_readnl + !================================================================================================ + ! subroutine chem_timestep_tend + !================================================================================================ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) - use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx - use physics_buffer, only : pbuf_get_chunk, pbuf_get_index - use perf_mod, only : t_startf, t_stopf + ! CAM modules use cam_history, only : outfld, hist_fld_active use camsrfexch, only : cam_in_t, cam_out_t - -#ifdef SPMD - use mpishorthand -#endif - - use phys_grid, only : get_ncols_p, get_rlat_all_p, get_rlon_all_p - - use mo_chem_utls, only : get_spc_ndx use chem_mods, only : drySpc_ndx, map2GC_dryDep use chem_mods, only : nfs, indexm, gas_pcnst - use mo_mean_mass, only : set_mean_mass - use mo_setinv, only : setinv + use gas_wetdep_opts, only : gas_wetdep_method + use mo_chem_utls, only : get_spc_ndx use mo_flbc, only : flbc_set use mo_ghg_chem, only : ghg_chem_set_flbc + use mo_mean_mass, only : set_mean_mass use mo_neu_wetdep, only : neu_wetdep_tend - use gas_wetdep_opts, only : gas_wetdep_method + use mo_setinv, only : setinv + use orbit, only : zenith ! For computing SZA + use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx + use physics_buffer, only : pbuf_get_chunk, pbuf_get_index + use perf_mod, only : t_startf, t_stopf + use phys_grid, only : get_ncols_p, get_rlat_all_p, get_rlon_all_p + use phys_grid, only : get_area_all_p, get_lat_all_p, get_lon_all_p + use physconst, only : MWDry, Gravit + use rad_constituents, only : rad_cnst_get_info + use short_lived_species, only : get_short_lived_species_gc, set_short_lived_species_gc + use time_manager, only : Get_Curr_Calday, Get_Curr_Date ! For computing SZA + use tropopause, only : Tropopause_findChemTrop, Tropopause_Find + use wv_saturation, only : QSat #if defined( MODAL_AERO ) + use aero_model, only : aero_model_gasaerexch ! Aqueous chemistry and aerosol growth use modal_aero_data, only : ntot_amode, nspec_amode use modal_aero_data, only : nspec_max, nsoa use modal_aero_data, only : lmassptr_amode, numptr_amode use modal_aero_data, only : lptr_so4_a_amode use modal_aero_data, only : lptr2_soa_a_amode, lptr2_soa_g_amode #endif +#ifdef SPMD + use mpishorthand +#endif + + ! GEOS-Chem interface modules in CAM + use GeosChem_Emissions_Mod, only : GC_Emissions_Calc + use GeosChem_Diagnostics_Mod, only : GC_Diagnostics_Calc, wetdep_name, wtrate_name + use GeosChem_History_Mod, only : HistoryExports_SetDataPointers, CopyGCStates2Exports - use Diagnostics_Mod, only : Zero_Diagnostics_StartOfTimestep - use Diagnostics_Mod, only : Set_Diagnostics_EndofTimestep + ! GEOS-Chem modules use Aerosol_Mod, only : Set_AerMass_Diagnostic - use Olson_Landmap_Mod, only : Compute_Olson_Landmap - use Modis_LAI_Mod, only : Compute_XLAI - use CMN_Size_Mod, only : NSURFTYPE - use Drydep_Mod, only : Do_Drydep - use Drydep_Mod, only : DEPNAME, NDVZIND - use Drydep_Mod, only : Update_DryDepFreq - - use Calc_Met_Mod, only : Set_Dry_Surface_Pressure - use Calc_Met_Mod, only : AirQnt - use GC_Grid_Mod, only : SetGridFromCtr - use Pressure_Mod, only : Set_Floating_Pressures - use Pressure_Mod, only : Accept_External_Pedge - use Time_Mod, only : Accept_External_Date_Time - use Toms_Mod, only : Compute_Overhead_O3 + use Calc_Met_Mod, only : Set_Dry_Surface_Pressure, AirQnt use Chemistry_Mod, only : Do_Chemistry - use Wetscav_Mod, only : Setup_Wetscav - use CMN_Size_Mod, only : PTop - use PBL_Mix_Mod, only : Compute_PBL_Height - use UCX_Mod, only : Set_H2O_Trac use CMN_FJX_MOD, only : ZPJ + use CMN_Size_Mod, only : NSURFTYPE, PTop + use Diagnostics_Mod, only : Zero_Diagnostics_StartOfTimestep, Set_Diagnostics_EndofTimestep + use Drydep_Mod, only : Do_Drydep, DEPNAME, NDVZIND, Update_DryDepFreq use FAST_JX_MOD, only : RXN_NO2, RXN_O3_1 - use State_Diag_Mod, only : get_TagInfo - use Unitconv_Mod, only : Convert_Spc_Units - use State_Chm_Mod, only : Ind_ - + use GC_Grid_Mod, only : SetGridFromCtr + use HCO_Interface_GC_Mod,only : Compute_Sflx_For_Vdiff use Linear_Chem_Mod, only : TrID_GC, GC_Bry_TrID, NSCHEM use Linear_Chem_Mod, only : BrPtrDay, BrPtrNight, PLVEC, GMI_OH - - use GeosChem_Emissions_Mod, only : GC_Emissions_Calc - use GeosChem_Diagnostics_Mod, only : GC_Diagnostics_Calc - use GeosChem_Diagnostics_Mod, only : wetdep_name, wtrate_name - - use Tropopause, only : Tropopause_findChemTrop, Tropopause_Find - use HCO_Interface_GC_Mod ! Utility routines for GC-HEMCO interface - - ! For calculating SZA - use Orbit, only : zenith - use Time_Manager, only : Get_Curr_Calday, Get_Curr_Date - - ! Calculating relative humidity - use WV_Saturation, only : QSat - - ! Grid area - use Phys_Grid, only : get_area_all_p, get_lat_all_p, get_lon_all_p - - use short_lived_species, only : get_short_lived_species_gc - use short_lived_species, only : set_short_lived_species_gc - -#if defined( MODAL_AERO ) - ! Aqueous chemistry and aerosol growth - use aero_model, only : aero_model_gasaerexch -#endif - - use rad_constituents, only : rad_cnst_get_info - - ! GEOS-Chem version of physical constants + use Olson_Landmap_Mod, only : Compute_Olson_Landmap + use Modis_LAI_Mod, only : Compute_XLAI + use PBL_Mix_Mod, only : Compute_PBL_Height use PhysConstants, only : PI, PI_180, g0, AVO, Re, g0_100 - ! CAM version of physical constants - use PhysConst, only : MWDry, Gravit + use Pressure_Mod, only : Set_Floating_Pressures, Accept_External_Pedge + use State_Chm_Mod, only : Ind_ + use State_Diag_Mod, only : get_TagInfo + use Time_Mod, only : Accept_External_Date_Time + use Toms_Mod, only : Compute_Overhead_O3 + use UCX_Mod, only : Set_H2O_Trac + use Unitconv_Mod, only : Convert_Spc_Units + use Wetscav_Mod, only : Setup_Wetscav REAL(r8), INTENT(IN) :: dT ! Time step TYPE(physics_state), INTENT(IN) :: state ! Physics State variables @@ -4251,8 +4161,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) end subroutine chem_timestep_tend -!=============================================================================== - + !================================================================================================ + ! subroutine chem_init_cnst + !================================================================================================ subroutine chem_init_cnst(name, latvals, lonvals, mask, q) CHARACTER(LEN=*), INTENT(IN) :: name ! constituent name @@ -4283,36 +4194,35 @@ subroutine chem_init_cnst(name, latvals, lonvals, mask, q) end subroutine chem_init_cnst -!=============================================================================== - + !================================================================================================ + ! subroutine chem_final + !================================================================================================ subroutine chem_final + ! CAM modules + use short_lived_species, only : short_lived_species_final + + ! GEOS-Chem interface modules in CAM + use geoschem_emissions_mod, only : GC_Emissions_Final + use geoschem_history_mod, only : Destroy_HistoryConfig + + ! GEOS-Chem modules + use Aerosol_Mod, only : Cleanup_Aerosol + use Carbon_Mod, only : Cleanup_Carbon + use CMN_FJX_Mod, only : Cleanup_CMN_FJX + use Drydep_Mod, only : Cleanup_Drydep + use Dust_Mod, only : Cleanup_Dust + use Error_Mod, only : Cleanup_Error + use Fullchem_Mod, only : Cleanup_FullChem use Input_Opt_Mod, only : Cleanup_Input_Opt + use Linear_Chem_Mod, only : Cleanup_Linear_Chem + use Pressure_Mod, only : Cleanup_Pressure + use Seasalt_Mod, only : Cleanup_Seasalt use State_Chm_Mod, only : Cleanup_State_Chm use State_Diag_Mod, only : Cleanup_State_Diag use State_Grid_Mod, only : Cleanup_State_Grid use State_Met_Mod, only : Cleanup_State_Met - use Error_Mod, only : Cleanup_Error - use Fullchem_Mod, only : Cleanup_FullChem - use Drydep_Mod, only : Cleanup_Drydep - use Carbon_Mod, only : Cleanup_Carbon - use Dust_Mod, only : Cleanup_Dust - use Seasalt_Mod, only : Cleanup_Seasalt - use Aerosol_Mod, only : Cleanup_Aerosol use Sulfate_Mod, only : Cleanup_Sulfate - use Pressure_Mod, only : Cleanup_Pressure - use Linear_Chem_Mod, only : Cleanup_Linear_Chem - - use CMN_FJX_Mod, only : Cleanup_CMN_FJX - -#ifdef BPCH_DIAG - use CMN_O3_Mod, only : Cleanup_CMN_O3 - ! Special: cleans up after NDXX_Setup - use Diag_Mod, only : Cleanup_Diag -#endif - - use GeosChem_Emissions_Mod, only : GC_Emissions_Final - use short_lived_species, only : short_lived_species_final ! Local variables INTEGER :: I, RC @@ -4347,17 +4257,6 @@ subroutine chem_final CALL Error_Stop( ErrMsg, ThisLoc ) ENDIF -#ifdef BPCH_DIAG - CALL Cleanup_Diag - - ! Call extra cleanup routines, from modules in Headers/ - CALL Cleanup_CMN_O3( RC ) - IF ( RC /= GC_SUCCESS ) THEN - ErrMsg = 'Error encountered in "Cleanup_CMN_O3"!' - CALL Error_Stop( ErrMsg, ThisLoc ) - ENDIF -#endif - ! Cleanup Input_Opt CALL Cleanup_Input_Opt( Input_Opt, RC ) @@ -4382,12 +4281,15 @@ subroutine chem_final end subroutine chem_final -!=============================================================================== - + !================================================================================================ + ! subroutine chem_init_restart + !================================================================================================ subroutine chem_init_restart(File) + + ! CAM modules + use pio, only : file_desc_t use tracer_cnst, only : init_tracer_cnst_restart use tracer_srcs, only : init_tracer_srcs_restart - use pio, only : file_desc_t IMPLICIT NONE @@ -4404,12 +4306,15 @@ subroutine chem_init_restart(File) end subroutine chem_init_restart -!=============================================================================== - + !================================================================================================ + ! subroutine chem_write_restart + !================================================================================================ subroutine chem_write_restart( File ) + + ! CAM modules + use pio, only : file_desc_t use tracer_cnst, only : write_tracer_cnst_restart use tracer_srcs, only : write_tracer_srcs_restart - use pio, only : file_desc_t IMPLICIT NONE @@ -4423,12 +4328,15 @@ subroutine chem_write_restart( File ) end subroutine chem_write_restart -!=============================================================================== - + !================================================================================================ + ! subroutine chem_read_restart + !================================================================================================ subroutine chem_read_restart( File ) + + ! CAM modules + use pio, only : file_desc_t use tracer_cnst, only : read_tracer_cnst_restart use tracer_srcs, only : read_tracer_srcs_restart - use pio, only : file_desc_t IMPLICIT NONE @@ -4442,34 +4350,27 @@ subroutine chem_read_restart( File ) end subroutine chem_read_restart -!================================================================================ - + !================================================================================================ + ! subroutine chem_emissions + !================================================================================================ subroutine chem_emissions( state, cam_in, pbuf ) - use physics_buffer, only : physics_buffer_desc + ! CAM modules use camsrfexch, only : cam_in_t - - ! Arguments: + use physics_buffer, only : physics_buffer_desc TYPE(physics_state), INTENT(IN) :: state ! Physics state variables TYPE(cam_in_t), INTENT(INOUT) :: cam_in ! import state TYPE(physics_buffer_desc), pointer :: pbuf(:) ! Physics buffer in chunk, for HEMCO INTEGER :: M, N - INTEGER :: LCHNK, nY + INTEGER :: nY LOGICAL :: rootChunk + nY = state%NCOL ! number of atmospheric columns on this chunk + rootChunk = ( MasterProc .and. (state%LCHNK .eq. BEGCHUNK) ) - ! LCHNK: which chunk we have on this process - LCHNK = state%LCHNK - ! NCOL: number of atmospheric columns on this chunk - nY = state%NCOL - rootChunk = ( MasterProc.and.(LCHNK.EQ.BEGCHUNK) ) - - !----------------------------------------------------------------------- ! Reset surface fluxes - !----------------------------------------------------------------------- - DO M = iFirstCnst, pcnst !N = map2chm(M) !IF ( N > 0 ) cam_in%cflx(1:nY,N) = 0.0e+0_r8 @@ -4478,6 +4379,4 @@ subroutine chem_emissions( state, cam_in, pbuf ) end subroutine chem_emissions -!=============================================================================== - end module chemistry diff --git a/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 b/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 index f40ca20d92..9defdf4e58 100644 --- a/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 +++ b/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 @@ -1,44 +1,27 @@ -!------------------------------------------------------------------------------ -! GEOS-Chem chemistry diagnostics interface ! -!------------------------------------------------------------------------------ -!BOP -! -! !MODULE: geoschem_diagnostics_mod.F90 -! -! !DESCRIPTION: Module geoschem\_diagnostics\_mod contains routines which aim to -! diagnose variables from GEOS-Chem -!\\ -!\\ -! !INTERFACE: -! MODULE GeosChem_Diagnostics_Mod -! -! !USES: -! - USE SHR_KIND_MOD, ONLY : r8 => shr_kind_r8, shr_kind_cl - USE SHR_CONST_MOD, ONLY : pi => shr_const_pi - USE CAM_HISTORY, ONLY : fieldname_len - USE CONSTITUENTS, ONLY : pcnst - USE CHEM_MODS, ONLY : gas_pcnst, map2chm - USE CHEM_MODS, ONLY : iFirstCnst - USE MO_TRACNAME, ONLY : solsym - USE SPMD_UTILS, ONLY : MasterProc - USE PPGRID, ONLY : begchunk, pver - USE CAM_LOGFILE, ONLY : iulog - USE STRING_UTILS, ONLY : to_upper - USE Error_Mod ! For error checking - USE ErrCode_Mod ! Error codes for success or failure + + ! CAM modules + use cam_history, only : fieldname_len + use cam_logfile, only : iulog + use chem_mods, only : gas_pcnst, map2chm, iFirstCnst + use constituents, only : pcnst + use mo_tracname, only : solsym + use ppgrid, only : begchunk, pver + use shr_const_mod, only : pi => shr_const_pi + use shr_kind_mod, only : r8 => shr_kind_r8, shr_kind_cl + use spmd_utils, only : MasterProc + use string_utils, only : to_upper + + ! GEOS-Chem modules + use ErrCode_Mod, only : GC_SUCCESS IMPLICIT NONE PRIVATE -! -! !PUBLIC MEMBER FUNCTIONS: -! PUBLIC :: GC_Diagnostics_Init PUBLIC :: GC_Diagnostics_Calc - PUBLIC :: wetdep_name, wtrate_name + PUBLIC :: wetdep_name, wtrate_name, dtchem_name CHARACTER(LEN=fieldname_len) :: srcnam(gas_pcnst) ! Names of source/sink tendencies CHARACTER(LEN=fieldname_len) :: wetdep_name(gas_pcnst) ! Wet deposition tendencies @@ -124,58 +107,34 @@ MODULE GeosChem_Diagnostics_Mod integer :: id_o,id_o2,id_h,id_n2o integer :: id_co2,id_o3,id_oh,id_ho2,id_so4_a1,id_so4_a2,id_so4_a3 integer :: id_num_a2,id_num_a3,id_dst_a3,id_ncl_a3 -! + ! !REVISION HISTORY: ! 28 Oct 2020 - T. M. Fritz - Initial version -!EOP -!------------------------------------------------------------------------------ -!BOC -! + CONTAINS -! -!EOC -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: gc_diagnostics_init -! -! !DESCRIPTION: Subroutine GC\_Diagnostics\_Init declares the variables to -! diagnosethe -!\\ -!\\ -! !INTERFACE: -! + SUBROUTINE GC_Diagnostics_Init( Input_Opt, State_Chm, State_Met ) -! -! !USES: -! - USE Input_Opt_Mod, ONLY : OptInput - USE State_Chm_Mod, ONLY : ChmState - USE State_Met_Mod, ONLY : MetState - USE State_Diag_Mod, ONLY : get_TagInfo - USE Species_Mod, ONLY : Species - USE Registry_Mod, ONLY : MetaRegItem, RegItem - USE State_Chm_Mod, ONLY : Ind_ - USE CONSTITUENTS, ONLY : cnst_name, sflxnam - USE CONSTITUENTS, ONLY : cnst_get_ind - USE CAM_HISTORY, ONLY : addfld, add_default, horiz_only - USE PHYS_CONTROL, ONLY : phys_getopts - USE DRYDEP_MOD, ONLY : depName - USE MO_CHEM_UTLS, ONLY : get_spc_ndx -! -! !INPUT PARAMETERS: -! + + ! CAM modules + use cam_history, only : addfld, add_default, horiz_only + use constituents, only : cnst_name, sflxnam, cnst_get_ind + use mo_chem_utls, only : get_spc_ndx + use phys_control, only : phys_getopts + + ! GEOS-Chem modules + use Input_Opt_Mod, only : OptInput + use State_Chm_Mod, only : ChmState + use State_Met_Mod, only : MetState + use State_Diag_Mod, only : get_TagInfo + use Species_Mod, only : Species + use Registry_Mod, only : MetaRegItem, RegItem + use State_Chm_Mod, only : Ind_ + use DryDep_Mod, only : depName + TYPE(OptInput), INTENT(IN) :: Input_Opt ! Input options TYPE(ChmState), INTENT(IN) :: State_Chm ! Chemistry State object TYPE(MetState), INTENT(IN) :: State_Met ! Meteorology State object -! -! !REVISION HISTORY: -! 20 Oct 2020 - T. M. Fritz - Initial version -!EOP -!------------------------------------------------------------------------------ -!BOC -! - ! Integer + INTEGER :: M, N, K, SM INTEGER :: idx INTEGER :: RC @@ -189,7 +148,6 @@ SUBROUTINE GC_Diagnostics_Init( Input_Opt, State_Chm, State_Met ) INTEGER :: history_budget_histfile_num ! output history file number ! for budget fields - ! Logical LOGICAL :: Found LOGICAL :: compare_uppercase ! Compare upper-case names LOGICAL :: history_aerosol ! Output the MAM aerosol @@ -207,7 +165,6 @@ SUBROUTINE GC_Diagnostics_Init( Input_Opt, State_Chm, State_Met ) ! cloud ice and cloud ! liquid budgets. - ! Strings CHARACTER(LEN=shr_kind_cl) :: SpcName CHARACTER(LEN=shr_kind_cl) :: tagName CHARACTER(LEN=shr_kind_cl) :: ThisLoc @@ -839,56 +796,39 @@ SUBROUTINE GC_Diagnostics_Init( Input_Opt, State_Chm, State_Met ) CALL Addfld( 'CT_H2O_GHG', (/ 'lev' /), 'A','kg/kg/s', 'ghg-chem h2o source/sink' ) - !======================================================================= - ! Cleanup and quit - !======================================================================= + + ! Cleanup Current => NULL() Item => NULL() END SUBROUTINE GC_Diagnostics_Init -!EOC -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: gc_diagnostics_calc -! -! !DESCRIPTION: Subroutine GC\_Diagnostics\_Calc passes the diagnostics variable -! to the CAM History routines -!\\ -!\\ -! !INTERFACE: -! + SUBROUTINE GC_Diagnostics_Calc( Input_Opt, State_Chm, State_Diag, & State_Grid, State_Met, cam_in, state, & mmr_tend, LCHNK ) -! -! !USES: -! - USE Input_Opt_Mod, ONLY : OptInput - USE State_Chm_Mod, ONLY : ChmState - USE State_Met_Mod, ONLY : MetState - USE State_Diag_Mod, ONLY : DgnState - USE State_Diag_Mod, ONLY : get_TagInfo - USE State_Grid_Mod, ONLY : GrdState - USE Species_Mod, ONLY : Species - USE Registry_Mod, ONLY : MetaRegItem, RegItem - USE Registry_Mod, ONLY : Registry_Lookup - USE Registry_Params_Mod - USE PRECISION_MOD - USE CHEM_MODS, ONLY : adv_mass - USE CAM_HISTORY, ONLY : outfld, hist_fld_active - USE CONSTITUENTS, ONLY : cnst_name, sflxnam - USE DRYDEP_MOD, ONLY : depName, Ndvzind - USE CAMSRFEXCH, ONLY : cam_in_t - USE PHYSICS_TYPES, ONLY : physics_state - USE SPMD_UTILS, ONLY : MasterProc - USE PHYSCONST, ONLY : MWDry - USE UCX_MOD, ONLY : GET_STRAT_OPT!, AERFRAC - USE CMN_SIZE_MOD, ONLY : NDUST - USE CMN_FJX_MOD -! -! !INPUT PARAMETERS: -! + + ! CAM modules + use cam_history, only : outfld, hist_fld_active + use camsrfexch, only : cam_in_t + use chem_mods, only : adv_mass + use constituents, only : cnst_name, sflxnam + use physconst, only : MWDry + use physics_types, only : physics_state + use spmd_utils, only : MasterProc + + ! GEOS-Chem modules + use CMN_Size_Mod, only : NDUST + use DryDep_Mod, only : depName, Ndvzind + use Input_Opt_Mod, only : OptInput + use Precision_Mod, only : f8 + use Species_Mod, only : Species + use State_Chm_Mod, only : ChmState + use State_Diag_Mod, only : DgnState, get_TagInfo + use State_Grid_Mod, only : GrdState + use State_Met_Mod, only : MetState + use Registry_Mod, only : MetaRegItem, RegItem, Registry_Lookup + use UCX_Mod, only : GET_STRAT_OPT + TYPE(OptInput), INTENT(IN) :: Input_Opt ! Input options TYPE(ChmState), INTENT(INOUT) :: State_Chm ! Chemistry State object TYPE(DgnState), INTENT(IN) :: State_Diag ! Diag State object @@ -899,13 +839,7 @@ SUBROUTINE GC_Diagnostics_Calc( Input_Opt, State_Chm, State_Diag, & REAL(r8), INTENT(IN) :: mmr_tend(state%ncol,pver,gas_pcnst) ! Net tendency from chemistry in kg/s INTEGER, INTENT(IN) :: LCHNK ! Chunk number -! -! !REVISION HISTORY: -! 20 Oct 2020 - T. M. Fritz - Initial version -!EOP -!------------------------------------------------------------------------------ -!BOC -! + ! Integers INTEGER :: I, J, L, M, N, ND, SM INTEGER :: idx @@ -1428,9 +1362,7 @@ SUBROUTINE GC_Diagnostics_Calc( Input_Opt, State_Chm, State_Diag, & CALL Outfld( TRIM(SpcName), outTmp(:nY,:) , nY, LCHNK ) ENDIF - !======================================================================= - ! Cleanup and quit - !======================================================================= + ! Cleanup Current => NULL() Item => NULL() Ptr0d_8 => NULL() @@ -1439,7 +1371,6 @@ SUBROUTINE GC_Diagnostics_Calc( Input_Opt, State_Chm, State_Diag, & Ptr3d_8 => NULL() END SUBROUTINE GC_Diagnostics_Calc -!EOC -!------------------------------------------------------------------------------ + END MODULE GeosChem_Diagnostics_Mod diff --git a/src/chemistry/geoschem/geoschem_emissions_mod.F90 b/src/chemistry/geoschem/geoschem_emissions_mod.F90 index 37142e4d5b..9d9dfc6bd1 100644 --- a/src/chemistry/geoschem/geoschem_emissions_mod.F90 +++ b/src/chemistry/geoschem/geoschem_emissions_mod.F90 @@ -1,35 +1,21 @@ -!------------------------------------------------------------------------------ -! "GEOS-Chem" chemistry emissions interface ! -!------------------------------------------------------------------------------ -!BOP -! -! !MODULE: geoschem_emissions_mod.F90 -! -! !DESCRIPTION: Module geoschem\_emissions\_mod contains routines which retrieve -! emission fluxes from HEMCO and transfers it back to the CESM-GC interface -!\\ -!\\ -! !INTERFACE: -! +! Module geoschem_emissions_mod contains routines which retrieve +! emission fluxes from HEMCO and transfers it back to the CESM-GC interface +! 07 Oct 2020 - T. M. Fritz - Initial version MODULE GeosChem_Emissions_Mod -! -! !USES: -! - USE SHR_KIND_MOD, ONLY : r8 => shr_kind_r8, shr_kind_cl - USE SPMD_UTILS, ONLY : MasterProc - USE CAM_ABORTUTILS, ONLY : endrun - USE CHEM_MODS, ONLY : iFirstCnst - USE CONSTITUENTS, ONLY : pcnst, cnst_name - USE SHR_MEGAN_MOD, ONLY : shr_megan_mechcomps, shr_megan_mechcomps_n - USE CAM_LOGFILE, ONLY : iulog + + ! CAM modules + use cam_abortutils, only : endrun + use cam_logfile, only : iulog + use chem_mods, only : iFirstCnst + use constituents, only : pcnst, cnst_name + use shr_kind_mod, only : r8 => shr_kind_r8, shr_kind_cl + use shr_megan_mod, only : shr_megan_mechcomps, shr_megan_mechcomps_n + use spmd_utils, only : MasterProc IMPLICIT NONE PRIVATE -! -! !PUBLIC MEMBER FUNCTIONS: -! PUBLIC :: GC_Emissions_Init PUBLIC :: GC_Emissions_Calc PUBLIC :: GC_Emissions_Final @@ -54,47 +40,21 @@ MODULE GeosChem_Emissions_Mod ! Cache for is_extfrc? LOGICAL, ALLOCATABLE :: pcnst_is_extfrc(:) ! no idea why the indexing is not 1:gas_pcnst or why iFirstCnst can be < 0 -! -! !REVISION HISTORY: -! 07 Oct 2020 - T. M. Fritz - Initial version -! 20 Jan 2023 - H.P. Lin - Update for 2D/3D pbuf switches -!EOP -!------------------------------------------------------------------------------ -!BOC -! + CONTAINS -! -!EOC -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: gc_emissions_init -! -! !DESCRIPTION: Subroutine GC\_Emissions\_Init initializes the emissions -! routine -!\\ -!\\ -! !INTERFACE: -! + SUBROUTINE GC_Emissions_Init( ) -! -! !USES: -! - USE PHYSICS_TYPES, ONLY : physics_state - USE CONSTITUENTS, ONLY : cnst_get_ind - USE PHYS_CONTROL, ONLY : phys_getopts - USE MO_CHEM_UTLS, ONLY : get_spc_ndx, get_extfrc_ndx - USE CAM_HISTORY, ONLY : addfld, add_default, horiz_only - USE FIRE_EMISSIONS, ONLY : fire_emissions_init - USE CHEM_MODS, ONLY : adv_mass - USE INFNAN, ONLY : NaN, assignment(=) -! -! !REVISION HISTORY: -! 07 Oct 2020 - T. M. Fritz - Initial version -!EOP -!------------------------------------------------------------------------------ -!BOC -! + + ! CAM modules + use cam_history, only : addfld, add_default, horiz_only + use chem_mods, only : adv_mass + use constituents, only : cnst_get_ind + use fire_emissions, only : fire_emissions_init + use infnan, only : NaN, assignment(=) + use mo_chem_utls, only : get_spc_ndx, get_extfrc_ndx + use phys_control, only : phys_getopts + use physics_types, only : physics_state + ! Integers INTEGER :: IERR INTEGER :: N, II @@ -111,10 +71,6 @@ SUBROUTINE GC_Emissions_Init( ) ! Real REAL(r8) :: MW - !================================================================= - ! GC_Emissions_Init begins here! - !================================================================= - CALL phys_getopts( history_aerosol_out = history_aerosol, & history_chemistry_out = history_chemistry, & history_cesm_forcing_out = history_cesm_forcing ) @@ -247,73 +203,39 @@ SUBROUTINE GC_Emissions_Init( ) enddo END SUBROUTINE GC_Emissions_Init -!EOC -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: gc_emissions_calc -! -! !DESCRIPTION: Subroutine GC\_Emissions\_Calc retrieves emission fluxes -! from HEMCO and returns a 3-D array of emission flux to the CESM-GC -! interface. On top of passing data, this routine handles a number of checks. -!\\ -!\\ -! !INTERFACE: -! + SUBROUTINE GC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iStep ) -! -! !USES: -! - USE State_Met_Mod, ONLY : MetState - USE CAMSRFEXCH, ONLY : cam_in_t - USE CONSTITUENTS, ONLY : cnst_get_ind, cnst_mw - USE PHYSICS_TYPES, ONLY : physics_state - USE PHYSICS_BUFFER, ONLY : pbuf_get_index, pbuf_get_chunk - USE PHYSICS_BUFFER, ONLY : physics_buffer_desc, pbuf_get_field - USE PPGRID, ONLY : pcols, pver, begchunk - USE CAM_HISTORY, ONLY : outfld - USE STRING_UTILS, ONLY : to_upper - USE PHYSCONSTANTS, ONLY : PI - - ! Lightning emissions - USE MO_LIGHTNING, ONLY : prod_NO - - ! MEGAN emissions - USE SRF_FIELD_CHECK, ONLY : active_Fall_flxvoc - - ! Fire emissions - USE FIRE_EMISSIONS, ONLY : fire_emissions_srf - USE FIRE_EMISSIONS, ONLY : fire_emissions_vrt - - ! Aerosol emissions - USE AERO_MODEL, ONLY : aero_model_emissions - - ! GEOS-Chem version of physical constants - USE PHYSCONSTANTS, ONLY : AVO - ! CAM version of physical constants - USE PHYSCONST, ONLY : rga, avogad -! -! !INPUT PARAMETERS: -! + ! Subroutine GC_Emissions_Calc retrieves emission fluxes + ! from HEMCO and returns a 3-D array of emission flux to the CESM-GC + ! interface. On top of passing data, this routine handles a number of checks. + + ! CAM modules + use aero_model, only : aero_model_emissions ! Aerosol emissions + use cam_history, only : outfld + use camsrfexch, only : cam_in_t + use constituents, only : cnst_get_ind, cnst_mw + use fire_emissions, only : fire_emissions_srf, fire_emissions_vrt ! Fire emissions + use mo_lightning, only : prod_NO! Lightning emissions + use physconst, only : rga, avogad + use physics_buffer, only : pbuf_get_index, pbuf_get_chunk + use physics_buffer, only : physics_buffer_desc, pbuf_get_field + use physics_types, only : physics_state + use ppgrid, only : pcols, pver, begchunk + use srf_field_check, only : active_Fall_flxvoc ! MEGAN emissions + use string_utils, only : to_upper + + ! GEOS-Chem modules + use PhysConstants, only : AVO, PI + use State_Met_Mod, only : MetState + TYPE(physics_state), INTENT(IN ) :: state ! Physics state variables TYPE(physics_buffer_desc), POINTER, INTENT(IN ) :: hco_pbuf2d(:,:) ! Pointer to 2-D pbuf TYPE(MetState), INTENT(IN ) :: State_Met ! Meteorology State object INTEGER, INTENT(IN ) :: iStep -! -! !OUTPUT PARAMETERS: -! - TYPE(cam_in_t), INTENT(INOUT) :: cam_in ! import state + + TYPE(cam_in_t), INTENT(INOUT) :: cam_in ! import state REAL(r8), INTENT( OUT) :: eflx(pcols,pver,pcnst) ! 3-D emissions in kg/m2/s -! -! !REVISION HISTORY: -! 07 Oct 2020 - T. M. Fritz - Initial version -! 06 Mar 2023 - H.P. Lin - Now emit surface fluxes directly -!EOP -!------------------------------------------------------------------------------ -!BOC -! -! !LOCAL VARIABLES: -! + ! Integers INTEGER :: LCHNK INTEGER :: nY, nZ @@ -342,10 +264,7 @@ SUBROUTINE GC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iStep CHARACTER(LEN=shr_kind_cl) :: SpcName CHARACTER(LEN=shr_kind_cl) :: fldname_ns ! field name HCO_* - !================================================================= - ! GC_Emissions_Calc begins here! - !================================================================= - + ! Initialize pointers pbuf_chnk => NULL() pbuf_ik => NULL() @@ -602,34 +521,12 @@ SUBROUTINE GC_Emissions_Calc( state, hco_pbuf2d, State_Met, cam_in, eflx, iStep ! eflx(1:nY,nZ,:) = 0.0e+00_r8 END SUBROUTINE GC_Emissions_Calc -!EOC -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: gc_emissions_final -! -! !DESCRIPTION: Subroutine GC\_Emissions\_Final cleans up the module -!\\ -!\\ -! !INTERFACE: -! + SUBROUTINE GC_Emissions_Final -! -! !REVISION HISTORY: -! 07 Oct 2020 - T. M. Fritz - Initial version -!EOP -!------------------------------------------------------------------------------ -!BOC -! - !================================================================= - ! GC_Emissions_Final begins here! - !================================================================= IF ( ALLOCATED( megan_indices_map ) ) DEALLOCATE( megan_indices_map ) IF ( ALLOCATED( megan_wght_factors ) ) DEALLOCATE( megan_wght_factors ) END SUBROUTINE GC_Emissions_Final -!EOC -!------------------------------------------------------------------------------ -!EOC - END MODULE GeosChem_Emissions_Mod + +END MODULE GeosChem_Emissions_Mod diff --git a/src/chemistry/geoschem/geoschem_history_mod.F90 b/src/chemistry/geoschem/geoschem_history_mod.F90 index 40da3f37dc..ef4c2044e1 100644 --- a/src/chemistry/geoschem/geoschem_history_mod.F90 +++ b/src/chemistry/geoschem/geoschem_history_mod.F90 @@ -22,11 +22,17 @@ MODULE GeosChem_History_Mod ! ! !USES: ! - USE DiagList_Mod - USE TaggedDiagList_Mod - USE ErrCode_Mod - USE Precision_Mod - + ! CAM modules + USE cam_abortutils, ONLY : endrun + + ! GEOS-Chem modules + USE DiagList_Mod, ONLY : DgnItem, DgnList + USE DiagList_Mod, ONLY : Init_DiagList, Print_DiagList + USE ErrCode_Mod, ONLY : GC_SUCCESS, GC_FAILURE, GC_ERROR + USE Precision_Mod, ONLY : fp, f4, f8 + USE TaggedDiagList_Mod, ONLY : TaggedDgnList + USE TaggedDiagList_Mod, ONLY : Init_TaggedDiagList, Print_TaggedDiagList + IMPLICIT NONE PRIVATE ! @@ -201,9 +207,10 @@ SUBROUTINE Init_HistoryExportsList ( am_I_Root, HistoryConfig, RC ) ! ! !USES: ! - USE State_Chm_Mod, ONLY: Get_Metadata_State_Chm - USE State_Diag_Mod, ONLY: Get_Metadata_State_Diag - USE State_Met_Mod, ONLY: Get_Metadata_State_Met + ! GEOS-Chem modules + USE State_Chm_Mod, ONLY : Get_Metadata_State_Chm + USE State_Diag_Mod, ONLY : Get_Metadata_State_Diag + USE State_Met_Mod, ONLY : Get_Metadata_State_Met ! ! !INPUT PARAMETERS: ! @@ -643,8 +650,11 @@ SUBROUTINE HistoryExports_SetServices( am_I_Root, config_file, & ! ! !USES: ! - USE cam_history, only: addfld, add_default, horiz_only - USE Registry_Params_Mod + ! CAM modules + USE cam_history, ONLY : addfld, add_default, horiz_only + + ! GEOS-Chem modules + USE Registry_Params_Mod, ONLY : VLocationCenter, VLocationEdge ! ! !INPUT PARAMETERS: ! @@ -769,12 +779,14 @@ SUBROUTINE CopyGCStates2Exports( am_I_Root, Input_Opt, State_Grid, HistoryConfig ! ! !USES: ! - USE HCO_Interface_GC_Mod, ONLY : HCOI_GC_WriteDiagn - USE Input_Opt_Mod, ONLY : OptInput - USE State_Grid_Mod, ONLY : GrdState - - USE cam_history, ONLY : hist_fld_active, outfld - USE SHR_KIND_MOD, ONLY : shr_kind_r8 + ! CAM modules + USE cam_history, ONLY : hist_fld_active, outfld + USE shr_kind_mod, ONLY : shr_kind_r8 + + ! GEOS-Chem modules + USE HCO_Interface_GC_Mod, ONLY : HCOI_GC_WriteDiagn + USE Input_Opt_Mod, ONLY : OptInput + USE State_Grid_Mod, ONLY : GrdState ! ! !INPUT PARAMETERS: ! @@ -987,14 +999,15 @@ SUBROUTINE HistoryExports_SetDataPointers( am_I_Root, & ! ! !USES: ! + ! CAM modules + USE cam_history, ONLY : hist_fld_active + + ! GEOS-Chem modules USE Registry_Mod, ONLY : Registry_Lookup - USE State_Grid_Mod, ONLY : GrdState USE State_Chm_Mod, ONLY : ChmState USE State_Diag_Mod, ONLY : DgnState + USE State_Grid_Mod, ONLY : GrdState USE State_Met_Mod, ONLY : MetState - USE Registry_Params_Mod - - use cam_history, only: hist_fld_active ! ! !INPUT PARAMETERS: ! diff --git a/src/control/cam_comp.F90 b/src/control/cam_comp.F90 index 3bb1052288..9982df6d2c 100644 --- a/src/control/cam_comp.F90 +++ b/src/control/cam_comp.F90 @@ -80,7 +80,6 @@ subroutine cam_init( & use cam_restart, only: cam_read_restart use stepon, only: stepon_init use ionosphere_interface, only: ionosphere_init - use camsrfexch, only: hub2atm_alloc, atm2hub_alloc use cam_history, only: intht use history_scam, only: scm_intht diff --git a/src/control/runtime_opts.F90 b/src/control/runtime_opts.F90 index f40d24d50f..3f95e1c704 100644 --- a/src/control/runtime_opts.F90 +++ b/src/control/runtime_opts.F90 @@ -105,10 +105,6 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon) use phys_grid_ctem, only: phys_grid_ctem_readnl use mo_lightning, only: lightning_readnl -#if (defined HEMCO_CESM) - use hemco_interface, only: hemco_readnl -#endif - !---------------------------Arguments----------------------------------- character(len=*), intent(in) :: nlfilename From ac9e5471bed4e9a0015ab2b59a51dba5b698bbea Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 7 Sep 2023 09:28:38 -0600 Subject: [PATCH 121/160] rename optional arg compare_uppercase; use spmd_utils and mpi_bcast --- src/chemistry/geoschem/chemistry.F90 | 100 +++++++++++------- .../geoschem/geoschem_diagnostics_mod.F90 | 94 ++++++++-------- src/chemistry/mozart/mo_chem_utls.F90 | 8 +- 3 files changed, 113 insertions(+), 89 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 4bf7fbaa67..2466a80779 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -434,7 +434,7 @@ subroutine chem_register map2GCinv(M) = N ENDIF ! Map constituent onto chemically-active species (aka as indexed in solsym) - M = get_spc_ndx(TRIM(trueName), compare_uppercase=.true.) + M = get_spc_ndx(TRIM(trueName), ignore_case=.true.) IF ( M > 0 ) THEN mapCnst(N) = M ENDIF @@ -496,7 +496,7 @@ subroutine chem_register ! The species names need to be convert to upper case as, ! for instance, BR2 != Br2 - drySpc_ndx(N) = get_spc_ndx( to_upper(drydep_list(N)), compare_uppercase=.true. ) + drySpc_ndx(N) = get_spc_ndx( to_upper(drydep_list(N)), ignore_case=.true. ) if (debug .and. masterproc) write(iulog,'(a,a,a,i4,a,i4)') ' -> species ', trim(drydep_list(N)), ' in dry deposition list at index ', N, ' maps to species in solsym at index ', drySpc_ndx(N) @@ -644,14 +644,13 @@ subroutine chem_readnl(nlfile) use gckpp_Model, only : nSpec, Spc_Names use namelist_utils, only : find_group_name use mo_lightning, only : lightning_readnl + use spmd_utils, only : mpicom, masterprocid, mpi_success + use spmd_utils, only : mpi_character, mpi_integer, mpi_logical use units, only : getunit, freeunit #if defined( MODAL_AERO ) use aero_model, only : aero_model_readnl use dust_model, only : dust_readnl #endif -#ifdef SPMD - use mpishorthand -#endif ! args CHARACTER(LEN=*), INTENT(IN) :: nlfile ! filepath for file containing namelist input @@ -661,6 +660,7 @@ subroutine chem_readnl(nlfile) INTEGER :: UNITN, IERR, RC CHARACTER(LEN=500) :: line CHARACTER(LEN=63) :: substrs(2) + CHARACTER(LEN=*), PARAMETER :: subname = 'chem_readnl' LOGICAL :: validSLS, v_bool ! Assume a successful return until otherwise @@ -837,17 +837,40 @@ subroutine chem_readnl(nlfile) !---------------------------------------------------------- ! Broadcast to all processors !---------------------------------------------------------- - - CALL MPIBCAST ( nTracers, 1, MPIINT, 0, MPICOM ) - CALL MPIBCAST ( tracerNames, LEN(tracerNames(1))*nTracersMax, MPICHAR, 0, MPICOM ) - CALL MPIBCAST ( nSls, 1, MPIINT, 0, MPICOM ) - CALL MPIBCAST ( slsNames, LEN(slsNames(1))*nSlsMax, MPICHAR, 0, MPICOM ) + CALL mpi_bcast(nTracers, 1, mpi_integer, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: nTracers') + ENDIF + CALL mpi_bcast(tracerNames, LEN(tracerNames(1))*nTracersMax, mpi_character, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: tracerNames') + ENDIF + CALL mpi_bcast(nSls, 1, mpi_integer, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: nSls') + ENDIF + CALL mpi_bcast(slsNames, LEN(slsNames(1))*nSlsMax, mpi_character, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: slsNames') + ENDIF ! Broadcast namelist variables - CALL MPIBCAST (depvel_lnd_file, LEN(depvel_lnd_file), MPICHAR, 0, MPICOM) - CALL MPIBCAST (ghg_chem, 1, MPILOG, 0, MPICOM) - CALL MPIBCAST (bndtvg, LEN(bndtvg), MPICHAR, 0, MPICOM) - CALL MPIBCAST (h2orates, LEN(h2orates), MPICHAR, 0, MPICOM) + CALL mpi_bcast(depvel_lnd_file, LEN(depvel_lnd_file), mpi_character, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: depvel_lnd_file') + ENDIF + CALL mpi_bcast(ghg_chem, 1, mpi_logical, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: ghg_chem') + ENDIF + CALL mpi_bcast(bndtvg, LEN(bndtvg), mpi_character, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: bndtvg') + ENDIF + CALL mpi_bcast(h2orates, LEN(h2orates), mpi_character, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: h2orates') + ENDIF IF ( nSls .NE. nSlvd ) THEN write(iulog,'(a,i4)') 'nSlvd in geoschem/chem_mods.F90 does not match # non-advected KPP species. Set nSlvd to ', nSls @@ -921,11 +944,9 @@ subroutine chem_init(phys_state, pbuf2d) use mo_setinv, only : setinv_inti use Phys_Grid, only : get_Area_All_p use physics_buffer, only : physics_buffer_desc, pbuf_get_index + use spmd_utils, only : mpicom, masterprocid, mpi_real8, mpi_success use tracer_cnst, only : tracer_cnst_init use tracer_srcs, only : tracer_srcs_init -#ifdef SPMD - use mpishorthand -#endif #if defined( MODAL_AERO ) use aero_model, only : aero_model_init use mo_setsox, only : sox_inti @@ -984,8 +1005,9 @@ subroutine chem_init(phys_state, pbuf2d) LOGICAL :: Found ! Strings - CHARACTER(LEN=shr_kind_cl) :: historyConfigFile - CHARACTER(LEN=shr_kind_cl) :: SpcName + CHARACTER(LEN=shr_kind_cl) :: historyConfigFile + CHARACTER(LEN=shr_kind_cl) :: SpcName + CHARACTER(LEN=*), PARAMETER :: subname = 'chem_init' ! Objects TYPE(Species), POINTER :: SpcInfo @@ -1225,7 +1247,10 @@ subroutine chem_init(phys_state, pbuf2d) ! Copy the data to a temporary array linozData = REAL(Input_Opt%LINOZ_TPARM, r8) ENDIF - CALL MPIBCAST( linozData, nLinoz, MPIR8, 0, MPICOM ) + CALL mpi_bcast(linozData, nLinoz, mpi_real8, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: linozData') + ENDIF IF ( .NOT. MasterProc ) THEN Input_Opt%LINOZ_TPARM = REAL(linozData,fp) ENDIF @@ -1599,8 +1624,8 @@ subroutine chem_init(phys_state, pbuf2d) ! Free pointer SpcInfo => NULL() - l_H2SO4 = get_spc_ndx('H2SO4', compare_uppercase=.true.) - l_SO4 = get_spc_ndx('SO4', compare_uppercase=.true.) + l_H2SO4 = get_spc_ndx('H2SO4', ignore_case=.true.) + l_SO4 = get_spc_ndx('SO4', ignore_case=.true.) ! Get indices for physical fields in physics buffer NDX_PBLH = pbuf_get_index('pblh' ) @@ -1716,7 +1741,7 @@ subroutine gc_readnl(nlfile) ! Purpose: reads the namelist from cam/src/control/runtime_opts ! CAM modules - use mpishorthand + use spmd_utils, only : mpicom, masterprocid, mpi_character, mpi_success use namelist_utils, only: find_group_name use units, only: getunit, freeunit @@ -1742,7 +1767,10 @@ subroutine gc_readnl(nlfile) ENDIF ! Broadcast namelist variables - CALL MPIBCAST(gc_cheminputs, LEN(gc_cheminputs), MPICHAR, 0, MPICOM) + CALL mpi_bcast(gc_cheminputs, LEN(gc_cheminputs), mpi_character, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: gc_cheminputs') + ENDIF end subroutine gc_readnl @@ -1772,6 +1800,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use physconst, only : MWDry, Gravit use rad_constituents, only : rad_cnst_get_info use short_lived_species, only : get_short_lived_species_gc, set_short_lived_species_gc + use spmd_utils, only : masterproc use time_manager, only : Get_Curr_Calday, Get_Curr_Date ! For computing SZA use tropopause, only : Tropopause_findChemTrop, Tropopause_Find use wv_saturation, only : QSat @@ -1783,10 +1812,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) use modal_aero_data, only : lptr_so4_a_amode use modal_aero_data, only : lptr2_soa_a_amode, lptr2_soa_g_amode #endif -#ifdef SPMD - use mpishorthand -#endif - + ! GEOS-Chem interface modules in CAM use GeosChem_Emissions_Mod, only : GC_Emissions_Calc use GeosChem_Diagnostics_Mod, only : GC_Diagnostics_Calc, wetdep_name, wtrate_name @@ -3840,10 +3866,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) speciesName_2 = 'ASOAN' speciesName_3 = 'SOAIE' speciesName_4 = 'SOAGX' - K1 = get_spc_ndx(TRIM(speciesName_1), compare_uppercase=.true.) - K2 = get_spc_ndx(TRIM(speciesName_2), compare_uppercase=.true.) - K3 = get_spc_ndx(TRIM(speciesName_3), compare_uppercase=.true.) - K4 = get_spc_ndx(TRIM(speciesName_4), compare_uppercase=.true.) + K1 = get_spc_ndx(TRIM(speciesName_1), ignore_case=.true.) + K2 = get_spc_ndx(TRIM(speciesName_2), ignore_case=.true.) + K3 = get_spc_ndx(TRIM(speciesName_3), ignore_case=.true.) + K4 = get_spc_ndx(TRIM(speciesName_4), ignore_case=.true.) bulkMass(:nY,:nZ) = 0.0e+00_r8 DO iBin = 1, 2 DO M = 1, ntot_amode @@ -3877,8 +3903,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) speciesName_1 = 'TSOA3' speciesName_2 = 'ASOA3' ENDIF - K1 = get_spc_ndx(TRIM(speciesName_1), compare_uppercase=.true. ) - K2 = get_spc_ndx(TRIM(speciesName_2), compare_uppercase=.true. ) + K1 = get_spc_ndx(TRIM(speciesName_1), ignore_case=.true. ) + K2 = get_spc_ndx(TRIM(speciesName_2), ignore_case=.true. ) bulkMass(:nY,:nZ) = 0.0e+00_r8 DO M = 1, ntot_amode N = lptr2_soa_a_amode(M,iBin) @@ -3899,7 +3925,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Now deal with gaseous SOA species ! Deal with lowest two volatility bins - TSOG0 corresponds to SOAG0 and SOAG1 speciesName_1 = 'TSOG0' - K1 = get_spc_ndx(TRIM(speciesName_1), compare_uppercase=.true.) + K1 = get_spc_ndx(TRIM(speciesName_1), ignore_case=.true.) N = lptr2_soa_g_amode(1) P = mapCnst(N) ! current mode other modes (this mapping was verified to be correct.) @@ -3924,8 +3950,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) speciesName_1 = 'TSOG3' speciesName_2 = 'ASOG3' ENDIF - K1 = get_spc_ndx(TRIM(speciesName_1), compare_uppercase=.true.) - K2 = get_spc_ndx(TRIM(speciesName_2), compare_uppercase=.true.) + K1 = get_spc_ndx(TRIM(speciesName_1), ignore_case=.true.) + K2 = get_spc_ndx(TRIM(speciesName_2), ignore_case=.true.) IF ( P > 0 .AND. K1 > 0 .AND. K2 > 0 ) vmr1(:nY,:nZ,P) = vmr1(:nY,:nZ,K1) + vmr1(:nY,:nZ,K2) ENDDO diff --git a/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 b/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 index 9defdf4e58..447d2c29cd 100644 --- a/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 +++ b/src/chemistry/geoschem/geoschem_diagnostics_mod.F90 @@ -149,7 +149,6 @@ SUBROUTINE GC_Diagnostics_Init( Input_Opt, State_Chm, State_Met ) ! for budget fields LOGICAL :: Found - LOGICAL :: compare_uppercase ! Compare upper-case names LOGICAL :: history_aerosol ! Output the MAM aerosol ! tendencies LOGICAL :: history_chemistry @@ -197,53 +196,52 @@ SUBROUTINE GC_Diagnostics_Init( Input_Opt, State_Chm, State_Met ) history_scwaccm_forcing_out = history_scwaccm_forcing, & history_dust_out = history_dust ) - compare_uppercase = .true. - - id_no3 = get_spc_ndx( 'NO3', compare_uppercase ) - id_o3 = get_spc_ndx( 'O3', compare_uppercase ) - id_oh = get_spc_ndx( 'OH', compare_uppercase ) - id_ho2 = get_spc_ndx( 'HO2', compare_uppercase ) - id_so4_a1 = get_spc_ndx( 'so4_a1', compare_uppercase ) - id_so4_a2 = get_spc_ndx( 'so4_a2', compare_uppercase ) - id_so4_a3 = get_spc_ndx( 'so4_a3', compare_uppercase ) - id_num_a2 = get_spc_ndx( 'num_a2', compare_uppercase ) - id_num_a3 = get_spc_ndx( 'num_a3', compare_uppercase ) - id_dst_a3 = get_spc_ndx( 'dst_a3', compare_uppercase ) - id_ncl_a3 = get_spc_ndx( 'ncl_a3', compare_uppercase ) - id_co2 = get_spc_ndx( 'CO2', compare_uppercase ) - id_no = get_spc_ndx( 'NO', compare_uppercase ) - id_h = get_spc_ndx( 'H', compare_uppercase ) - id_o = get_spc_ndx( 'O', compare_uppercase ) - id_o2 = get_spc_ndx( 'O2', compare_uppercase ) - id_ch4 = get_spc_ndx( 'CH4', compare_uppercase ) - id_h2o = get_spc_ndx( 'H2O', compare_uppercase ) - id_n2o = get_spc_ndx( 'N2O', compare_uppercase ) - id_cfc11 = get_spc_ndx( 'CFC11', compare_uppercase ) - id_cfc12 = get_spc_ndx( 'CFC12', compare_uppercase ) - - id_bry = get_spc_ndx( 'BRY', compare_uppercase ) - id_cly = get_spc_ndx( 'CLY', compare_uppercase ) - - id_dst01 = get_spc_ndx( 'DST01', compare_uppercase ) - id_dst02 = get_spc_ndx( 'DST02', compare_uppercase ) - id_dst03 = get_spc_ndx( 'DST03', compare_uppercase ) - id_dst04 = get_spc_ndx( 'DST04', compare_uppercase ) - id_sslt01 = get_spc_ndx( 'SSLT01', compare_uppercase ) - id_sslt02 = get_spc_ndx( 'SSLT02', compare_uppercase ) - id_sslt03 = get_spc_ndx( 'SSLT03', compare_uppercase ) - id_sslt04 = get_spc_ndx( 'SSLT04', compare_uppercase ) - id_soa = get_spc_ndx( 'SOA', compare_uppercase ) - id_so4 = get_spc_ndx( 'SO4', compare_uppercase ); id_so4 = -1 ! Don't pick up GEOS-Chem's SO4! - id_oc1 = get_spc_ndx( 'OC1', compare_uppercase ) - id_oc2 = get_spc_ndx( 'OC2', compare_uppercase ) - id_cb1 = get_spc_ndx( 'CB1', compare_uppercase ) - id_cb2 = get_spc_ndx( 'CB2', compare_uppercase ) - id_nh4no3 = get_spc_ndx( 'NH4NO3', compare_uppercase ) - id_soam = get_spc_ndx( 'SOAM', compare_uppercase ) - id_soai = get_spc_ndx( 'SOAI', compare_uppercase ) - id_soat = get_spc_ndx( 'SOAT', compare_uppercase ) - id_soab = get_spc_ndx( 'SOAB', compare_uppercase ) - id_soax = get_spc_ndx( 'SOAX', compare_uppercase ) + id_no3 = get_spc_ndx( 'NO3', ignore_case=.true. ) + id_o3 = get_spc_ndx( 'O3', ignore_case=.true. ) + id_oh = get_spc_ndx( 'OH', ignore_case=.true. ) + id_ho2 = get_spc_ndx( 'HO2', ignore_case=.true. ) + id_so4_a1 = get_spc_ndx( 'so4_a1', ignore_case=.true. ) + id_so4_a2 = get_spc_ndx( 'so4_a2', ignore_case=.true. ) + id_so4_a3 = get_spc_ndx( 'so4_a3', ignore_case=.true. ) + id_num_a2 = get_spc_ndx( 'num_a2', ignore_case=.true. ) + id_num_a3 = get_spc_ndx( 'num_a3', ignore_case=.true. ) + id_dst_a3 = get_spc_ndx( 'dst_a3', ignore_case=.true. ) + id_ncl_a3 = get_spc_ndx( 'ncl_a3', ignore_case=.true. ) + id_co2 = get_spc_ndx( 'CO2', ignore_case=.true. ) + id_no = get_spc_ndx( 'NO', ignore_case=.true. ) + id_h = get_spc_ndx( 'H', ignore_case=.true. ) + id_o = get_spc_ndx( 'O', ignore_case=.true. ) + id_o2 = get_spc_ndx( 'O2', ignore_case=.true. ) + id_ch4 = get_spc_ndx( 'CH4', ignore_case=.true. ) + id_h2o = get_spc_ndx( 'H2O', ignore_case=.true. ) + id_n2o = get_spc_ndx( 'N2O', ignore_case=.true. ) + id_cfc11 = get_spc_ndx( 'CFC11', ignore_case=.true. ) + id_cfc12 = get_spc_ndx( 'CFC12', ignore_case=.true. ) + + id_bry = get_spc_ndx( 'BRY', ignore_case=.true. ) + id_cly = get_spc_ndx( 'CLY', ignore_case=.true. ) + + id_dst01 = get_spc_ndx( 'DST01', ignore_case=.true. ) + id_dst02 = get_spc_ndx( 'DST02', ignore_case=.true. ) + id_dst03 = get_spc_ndx( 'DST03', ignore_case=.true. ) + id_dst04 = get_spc_ndx( 'DST04', ignore_case=.true. ) + id_sslt01 = get_spc_ndx( 'SSLT01', ignore_case=.true. ) + id_sslt02 = get_spc_ndx( 'SSLT02', ignore_case=.true. ) + id_sslt03 = get_spc_ndx( 'SSLT03', ignore_case=.true. ) + id_sslt04 = get_spc_ndx( 'SSLT04', ignore_case=.true. ) + id_soa = get_spc_ndx( 'SOA', ignore_case=.true. ) + !id_so4 = get_spc_ndx( 'SO4', ignore_case=.true. )i + id_so4 = -1 ! Don't pick up GEOS-Chem's SO4! + id_oc1 = get_spc_ndx( 'OC1', ignore_case=.true. ) + id_oc2 = get_spc_ndx( 'OC2', ignore_case=.true. ) + id_cb1 = get_spc_ndx( 'CB1', ignore_case=.true. ) + id_cb2 = get_spc_ndx( 'CB2', ignore_case=.true. ) + id_nh4no3 = get_spc_ndx( 'NH4NO3', ignore_case=.true. ) + id_soam = get_spc_ndx( 'SOAM', ignore_case=.true. ) + id_soai = get_spc_ndx( 'SOAI', ignore_case=.true. ) + id_soat = get_spc_ndx( 'SOAT', ignore_case=.true. ) + id_soab = get_spc_ndx( 'SOAB', ignore_case=.true. ) + id_soax = get_spc_ndx( 'SOAX', ignore_case=.true. ) bulkaero_species(:) = -1 bulkaero_species(1:20) = (/ id_dst01, id_dst02, id_dst03, id_dst04, & diff --git a/src/chemistry/mozart/mo_chem_utls.F90 b/src/chemistry/mozart/mo_chem_utls.F90 index 992e0789e7..d444a89d5e 100644 --- a/src/chemistry/mozart/mo_chem_utls.F90 +++ b/src/chemistry/mozart/mo_chem_utls.F90 @@ -9,7 +9,7 @@ module mo_chem_utls contains - integer function get_spc_ndx( spc_name, compare_uppercase ) + integer function get_spc_ndx( spc_name, ignore_case ) !----------------------------------------------------------------------- ! ... return overall species index associated with spc_name !----------------------------------------------------------------------- @@ -24,7 +24,7 @@ integer function get_spc_ndx( spc_name, compare_uppercase ) ! ... dummy arguments !----------------------------------------------------------------------- character(len=*), intent(in) :: spc_name - logical, intent(in), optional :: compare_uppercase + logical, intent(in), optional :: ignore_case !----------------------------------------------------------------------- ! ... local variables @@ -34,8 +34,8 @@ integer function get_spc_ndx( spc_name, compare_uppercase ) logical :: match convert_to_upper = .false. - if ( present( compare_uppercase ) ) then - convert_to_upper = compare_uppercase + if ( present( ignore_case ) ) then + convert_to_upper = ignore_case endif get_spc_ndx = -1 From 9418375f794170cb6d98947252ebd19db82c2bc3 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 7 Sep 2023 20:02:36 -0600 Subject: [PATCH 122/160] Change modal aerosol species name retrieval method --- src/chemistry/geoschem/chemistry.F90 | 23 +++++++++++--------- src/chemistry/modal_aero/modal_aero_data.F90 | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 2466a80779..f5534a0ee8 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -169,7 +169,7 @@ subroutine chem_register use aero_model, only : aero_model_register use modal_aero_data, only : nspec_max use modal_aero_data, only : ntot_amode, nspec_amode - use modal_aero_data, only : xname_massptr + use rad_constituents, only : rad_cnst_get_info #endif ! GEOS-Chem interface modules in CAM @@ -205,6 +205,7 @@ subroutine chem_register CHARACTER(LEN=128) :: lngName CHARACTER(LEN=64) :: cnstName CHARACTER(LEN=64) :: trueName + CHARACTER(LEN=64) :: aerName LOGICAL :: camout LOGICAL :: ic_from_cam2 LOGICAL :: has_fixed_ubc @@ -539,18 +540,22 @@ subroutine chem_register map2MAM4(:,:) = -1 iSulf(:) = -1 + ! ewl notes: xname_massptr returns a name. The select case subsets characters? e.g. 1:3, 4:5, 5:6. + ! so want to get a name give an L and M. Need anything else??? + DO M = 1, ntot_amode DO L = 1, nspec_amode(M) - SELECT CASE ( to_upper(xname_massptr(L,M)(:3)) ) + call rad_cnst_get_info(0,M,L,spec_name=aername) + SELECT CASE ( to_upper(aername(:3)) ) CASE ( 'BC_' ) - SELECT CASE ( to_upper(xname_massptr(L,M)(4:5)) ) + SELECT CASE ( to_upper(aername(4:5)) ) CASE ( 'A1' ) CALL cnst_get_ind( 'BCPI', map2MAM4(L,M) ) CASE ( 'A4' ) CALL cnst_get_ind( 'BCPO', map2MAM4(L,M) ) END SELECT CASE ( 'DST' ) - SELECT CASE ( to_upper(xname_massptr(L,M)(5:6)) ) + SELECT CASE ( to_upper(aername(5:6)) ) ! DST1 - Dust aerosol, Reff = 0.7 micrometers ! DST2 - Dust aerosol, Reff = 1.4 micrometers ! DST3 - Dust aerosol, Reff = 2.4 micrometers @@ -568,7 +573,7 @@ subroutine chem_register CALL cnst_get_ind( 'SO4', map2MAM4(L,M) ) iSulf(M) = L CASE ( 'NCL' ) - SELECT CASE ( to_upper(xname_massptr(L,M)(5:6)) ) + SELECT CASE ( to_upper(aername(5:6)) ) ! SALA - Fine (0.01-0.05 micros) sea salt aerosol ! SALC - Coarse (0.5-8 micros) sea salt aerosol CASE ( 'A1' ) @@ -579,7 +584,7 @@ subroutine chem_register CALL cnst_get_ind( 'SALC', map2MAM4(L,M) ) END SELECT CASE ( 'POM' ) - SELECT CASE ( to_upper(xname_massptr(L,M)(5:6)) ) + SELECT CASE ( to_upper(aername(5:6)) ) CASE ( 'A1' ) CALL cnst_get_ind( 'OCPI', map2MAM4(L,M) ) CASE ( 'A4' ) @@ -952,7 +957,6 @@ subroutine chem_init(phys_state, pbuf2d) use mo_setsox, only : sox_inti use mo_drydep, only : drydep_inti use modal_aero_data, only : ntot_amode, nspec_amode - use modal_aero_data, only : xname_massptr #endif ! GEOS-Chem interface modules in CAM @@ -2221,10 +2225,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! mapCnst(constituent index) constituent index chemical tracer index ! lmassptr_amode(SM, M) SM, M constituent index (modal) ! map2GC(bulk constituent index) constituent index (bulk) GEOS-Chem species index (bulk) - ! map2MAM4(SM, M) SM, M (modal) constituent index (bulk) this is a N to 1 operation. + ! map2MAM4(SM, M) SM, M (modal) constituent index (bulk) + ! (map2MAM4 is a N to 1 operation) ! - ! Query functions: - ! xname_massptr(SM, M) SM, M NAME of modal aer (bc_a1, bc_a4, ...) !------------------------------------------------------------------------------------------ binRatio = 0.0e+00_r8 DO M = 1, ntot_amode diff --git a/src/chemistry/modal_aero/modal_aero_data.F90 b/src/chemistry/modal_aero/modal_aero_data.F90 index 6e1fbd5502..15b247584d 100644 --- a/src/chemistry/modal_aero/modal_aero_data.F90 +++ b/src/chemistry/modal_aero/modal_aero_data.F90 @@ -111,7 +111,7 @@ module modal_aero_data logical, public, protected :: soa_multi_species = .false. - character(len=16), public, protected, allocatable :: xname_massptr(:,:) ! names of species in each mode + character(len=16), allocatable :: xname_massptr(:,:) ! names of species in each mode character(len=16), allocatable :: xname_massptrcw(:,:) ! names of cloud-borne species in each mode complex(r8), allocatable :: & From d37e70a4486796ce9f1f70ad4f1022b5a0670ccb Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 29 Sep 2023 13:43:53 -0600 Subject: [PATCH 123/160] Unused code deletion and update setting short-lived species fieldnames Signed-off-by: Lizzie Lundgren --- src/chemistry/mozart/mo_chem_utls.F90 | 12 ------------ src/chemistry/mozart/short_lived_species.F90 | 2 +- src/control/runtime_opts.F90 | 3 --- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/chemistry/mozart/mo_chem_utls.F90 b/src/chemistry/mozart/mo_chem_utls.F90 index d444a89d5e..dbed06c9e8 100644 --- a/src/chemistry/mozart/mo_chem_utls.F90 +++ b/src/chemistry/mozart/mo_chem_utls.F90 @@ -3,7 +3,6 @@ module mo_chem_utls private public :: get_spc_ndx, get_het_ndx, get_extfrc_ndx, get_rxt_ndx, get_inv_ndx - public :: utls_chem_is save @@ -174,15 +173,4 @@ integer function get_rxt_ndx( rxt_tag ) end function get_rxt_ndx - logical function utls_chem_is (name) result(chem_is) - use string_utils, only : to_lower - - character(len=*), intent(in) :: name - chem_is = .false. - if ( to_lower(name) == 'mozart' ) then - chem_is = .true. - endif - - end function utls_chem_is - end module mo_chem_utls diff --git a/src/chemistry/mozart/short_lived_species.F90 b/src/chemistry/mozart/short_lived_species.F90 index 8807776d98..37a43d90bb 100644 --- a/src/chemistry/mozart/short_lived_species.F90 +++ b/src/chemistry/mozart/short_lived_species.F90 @@ -138,7 +138,7 @@ subroutine initialize_short_lived_species(ncid_ini, pbuf2d) do m=1,nslvd if (cam_chempkg_is('geoschem_mam4')) then - write(fieldname,'(a,a)') trim(slvd_lst(m)) + fieldname = trim(slvd_lst(m)) else n = map(m) fieldname = solsym(n) diff --git a/src/control/runtime_opts.F90 b/src/control/runtime_opts.F90 index 3f95e1c704..6d5a6e1058 100644 --- a/src/control/runtime_opts.F90 +++ b/src/control/runtime_opts.F90 @@ -209,9 +209,6 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon) call hemco_readnl(nlfilename) call cam_budget_readnl(nlfilename) call phys_grid_ctem_readnl(nlfilename) -#if (defined HEMCO_CESM) - call hemco_readnl(nlfilename) -#endif end subroutine read_namelist From d43c4e840ababc03928976e22b774c3225de01e5 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 2 Oct 2023 11:43:36 -0600 Subject: [PATCH 124/160] Add script to copy GEOS-Chem config files during case setup Signed-off-by: Lizzie Lundgren --- cime_config/cam.case_setup | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 cime_config/cam.case_setup diff --git a/cime_config/cam.case_setup b/cime_config/cam.case_setup new file mode 100755 index 0000000000..fc0f6d2742 --- /dev/null +++ b/cime_config/cam.case_setup @@ -0,0 +1,30 @@ +#! /usr/bin/env bash + +# This script is run from CIME when calling case.setup + +cam_root=$1 +cam_config=$2 +case_root=$3 + +# GEOS-Chem only: copy config files to case +gc_option="-chem geoschem" +if [[ "${cam_config}" == *"${gc_option}"* ]]; then + geoschem_config_src="${cam_root}/src/chemistry/geoschem/geoschem_src/run/CESM" + if [ ! -d "${geoschem_config_src}" ]; then + echo "ERROR: Did not find path to GEOS-Chem source code at ${geoschem_config_src}" + exit 1 + fi + fnames=('species_database.yml', 'geoschem_config.yml', 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc') + for fname in ${fnames[*]}; do + sourcefile="${cam_root}/${geoschem_config_src}/${fname}" + targetfile="${case_root}/${fileName}" + if [ ! -f "${sourcefile}" ]; then + echo "ERROR: Cannot find GEOS-Chem configuration file to move: ${sourcefile}" + exit 1 + fi + if [ ! -f "${targetfile}" ]; then + echo "CAM namelist one-time copy of GEOS-Chem run directory files: from ${sourcefile} to ${targetfile}" + fi + cp ${sourcefile} ${targetfile} + done +fi From 675afd0aa21b328d12aef5cd085142000c66b4e1 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 5 Oct 2023 11:43:55 -0600 Subject: [PATCH 125/160] Update deposition input file path used for GEOS-Chem Signed-off-by: Lizzie Lundgren --- bld/namelist_files/namelist_defaults_cam.xml | 2 +- bld/namelist_files/namelist_definition.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 64f0436c5b..b0c8f6a04f 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1928,7 +1928,7 @@ atm/cam/chem/trop_mozart/dvel/dep_data_c20221208.nc -/glade/u/home/elundgren/drydep_henrys_law_nc/dep_data_file_geoschem.nc +atm/cam/chem/geoschem/dvel/dep_data_file_geoschem_2022Sep21.nc atm/waccm/phot/effxstex.txt diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index d49905044b..ac5f287841 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -7300,9 +7300,9 @@ List of species that undergo dry deposition. Default: set by build-namelist. - -Full pathname of file containing gas phase deposition data including effective +Pathname of file containing gas phase deposition data including effective Henry's law coefficients. Default: set by build-namelist. From 4e552bbf4c8bfe7f82d069973ba46a64ea61dc45 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 5 Oct 2023 11:44:37 -0600 Subject: [PATCH 126/160] Copy GEOS-Chem configuration files from caseroot to run directory Previously files were copied from camconf. Signed-off-by: Lizzie Lundgren --- cime_config/buildnml | 50 +++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index c35f7c6243..98789a6f5e 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -191,42 +191,17 @@ def buildnml(case, caseroot, compname): rc, out, err = run_cmd(cmd, from_dir=camconf) expect(rc==0,"Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) - # ----------------------------------------------------- - # For GEOS-Chem / HEMCO only: - # Copy input files from storage location into Buildconf/camconf - # This only needs to be done once - # ----------------------------------------------------- - - # We use this to figure out if we are using the GEOS-Chem chemistry - # mechanism. - # Might have to do something else with HEMCO_CESM? - if '-chem geoschem' in CAM_CONFIG_OPTS: - geoschem_src = os.path.join(srcroot, "src/chemistry/geoschem/geoschem_src") - if not os.path.isdir(geoschem_src): - raise SystemExit("ERROR: Did not find path to GEOS-Chem source code at {:s}".format(geoschem_src)) - if os.path.isdir(rundir): - for fileName in ['species_database.yml', 'geoschem_config.yml', - 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc']: - file1 = os.path.join(geoschem_src, "run/CESM", fileName) - file2 = os.path.join(camconf, fileName) - if not os.path.exists(file2): - logger.info("CAM namelist one-time copy: file1 %s file2 %s ", file1, file2) - shutil.copy(file1,file2) - # ----------------------------------------------------- # copy resolved namelist, atm_in, to rundir # ----------------------------------------------------- if os.path.isdir(rundir): - for fileName in ['atm_in', 'species_database.yml', 'geoschem_config.yml', - 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc']: - file1 = os.path.join(camconf, fileName) - file2 = os.path.join(rundir, fileName) - if fileName == 'atm_in' and ninst > 1: - file2 += inst_string - if os.path.exists(file1) or fileName == 'atm_in': - logger.info("CAM namelist copy: file1 %s file2 %s ", file1, file2) - shutil.copy(file1,file2) + file1 = os.path.join(camconf, "atm_in") + file2 = os.path.join(rundir, "atm_in") + if ninst > 1: + file2 += inst_string + logger.info("CAM namelist copy: file1 %s file2 %s ", file1, file2) + shutil.copy(file1,file2) # ----------------------------------------------------- # copy drv_flds_in to rundir if it does not exist @@ -237,6 +212,19 @@ def buildnml(case, caseroot, compname): if (os.path.isfile(file1)) and (not os.path.isfile(file2)): shutil.copy(file1,file2) + # ----------------------------------------------------- + # copy geos-chem config files to rundir if using geos-chem chemistry + # ----------------------------------------------------- + + if os.path.isdir(rundir) and '-chem geoschem' in CAM_CONFIG_OPTS: + for fname in ['species_database.yml', 'geoschem_config.yml', + 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc']: + file1 = os.path.join(caseroot, fname) + file2 = os.path.join(rundir, fname) + if not os.path.exists(file2): + logger.info("GEOS-Chem config file copy: file1 %s file2 %s ", file1, file2) + shutil.copy(file1,file2) + ############################################################################### def _main_func(): From 99361e130b072275b365d00c6bb01015c1680460 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 13 Oct 2023 11:24:34 -0600 Subject: [PATCH 127/160] Updates to copy GEOS-Chem files to case and then run directory Signed-off-by: Lizzie Lundgren --- cime_config/buildnml | 5 ++--- cime_config/cam.case_setup | 29 ++++++++++++++--------------- src/physics/cam/physpkg.F90 | 1 + 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 98789a6f5e..79552907a0 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -221,9 +221,8 @@ def buildnml(case, caseroot, compname): 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc']: file1 = os.path.join(caseroot, fname) file2 = os.path.join(rundir, fname) - if not os.path.exists(file2): - logger.info("GEOS-Chem config file copy: file1 %s file2 %s ", file1, file2) - shutil.copy(file1,file2) + logger.info("GEOS-Chem config file copy: file1 %s file2 %s ", file1, file2) + shutil.copy(file1,file2) ############################################################################### def _main_func(): diff --git a/cime_config/cam.case_setup b/cime_config/cam.case_setup index fc0f6d2742..092ab49ee7 100755 --- a/cime_config/cam.case_setup +++ b/cime_config/cam.case_setup @@ -2,29 +2,28 @@ # This script is run from CIME when calling case.setup -cam_root=$1 -cam_config=$2 -case_root=$3 +case_root=$1 +cam_root=$2 +cam_options=$3 -# GEOS-Chem only: copy config files to case -gc_option="-chem geoschem" -if [[ "${cam_config}" == *"${gc_option}"* ]]; then +# Copy GEOS-Chem configuration files from source code to case +if [[ "${cam_options}" == *"geoschem"* ]]; then geoschem_config_src="${cam_root}/src/chemistry/geoschem/geoschem_src/run/CESM" if [ ! -d "${geoschem_config_src}" ]; then - echo "ERROR: Did not find path to GEOS-Chem source code at ${geoschem_config_src}" + echo "ERROR: GEOS-Chem source code not found at ${geoschem_config_src}" exit 1 fi - fnames=('species_database.yml', 'geoschem_config.yml', 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc') + fnames=('species_database.yml' 'geoschem_config.yml' 'HISTORY.rc' 'HEMCO_Config.rc' 'HEMCO_Diagn.rc') for fname in ${fnames[*]}; do - sourcefile="${cam_root}/${geoschem_config_src}/${fname}" - targetfile="${case_root}/${fileName}" - if [ ! -f "${sourcefile}" ]; then - echo "ERROR: Cannot find GEOS-Chem configuration file to move: ${sourcefile}" + source_file="${geoschem_config_src}/${fname}" + target_file="${case_root}/${fname}" + if [ ! -f "${source_file}" ]; then + echo "ERROR: Cannot find GEOS-Chem configuration file ${source_file}" exit 1 fi - if [ ! -f "${targetfile}" ]; then - echo "CAM namelist one-time copy of GEOS-Chem run directory files: from ${sourcefile} to ${targetfile}" + if [ ! -f "${target_file}" ]; then + echo "One-time copy of GEOS-Chem run directory files from ${source_file} to ${target_file}" fi - cp ${sourcefile} ${targetfile} + cp ${source_file} ${target_file} done fi diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index 62fa13b6fd..706b9dcdee 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -1616,6 +1616,7 @@ subroutine tphysac (ztodt, cam_in, & call chem_timestep_tend(state, ptend, cam_in, cam_out, ztodt, & pbuf, fh2o=fh2o) + if ( (trim(cam_take_snapshot_after) == "chem_timestep_tend") .and. & (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then call cam_snapshot_ptend_outfld(ptend, lchnk) From 2731270797495a077c90c5a14a0ada6c1411a018 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 13 Oct 2023 14:28:39 -0600 Subject: [PATCH 128/160] Change cam case_setup script from bash to python This update requires cime updates at: https://github.com/ESMCI/cime/pull/4497 Signed-off-by: Lizzie Lundgren --- cime_config/cam.case_setup | 29 ----------------------------- cime_config/cam.case_setup.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 29 deletions(-) delete mode 100755 cime_config/cam.case_setup create mode 100755 cime_config/cam.case_setup.py diff --git a/cime_config/cam.case_setup b/cime_config/cam.case_setup deleted file mode 100755 index 092ab49ee7..0000000000 --- a/cime_config/cam.case_setup +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/env bash - -# This script is run from CIME when calling case.setup - -case_root=$1 -cam_root=$2 -cam_options=$3 - -# Copy GEOS-Chem configuration files from source code to case -if [[ "${cam_options}" == *"geoschem"* ]]; then - geoschem_config_src="${cam_root}/src/chemistry/geoschem/geoschem_src/run/CESM" - if [ ! -d "${geoschem_config_src}" ]; then - echo "ERROR: GEOS-Chem source code not found at ${geoschem_config_src}" - exit 1 - fi - fnames=('species_database.yml' 'geoschem_config.yml' 'HISTORY.rc' 'HEMCO_Config.rc' 'HEMCO_Diagn.rc') - for fname in ${fnames[*]}; do - source_file="${geoschem_config_src}/${fname}" - target_file="${case_root}/${fname}" - if [ ! -f "${source_file}" ]; then - echo "ERROR: Cannot find GEOS-Chem configuration file ${source_file}" - exit 1 - fi - if [ ! -f "${target_file}" ]; then - echo "One-time copy of GEOS-Chem run directory files from ${source_file} to ${target_file}" - fi - cp ${source_file} ${target_file} - done -fi diff --git a/cime_config/cam.case_setup.py b/cime_config/cam.case_setup.py new file mode 100755 index 0000000000..19bea2c567 --- /dev/null +++ b/cime_config/cam.case_setup.py @@ -0,0 +1,28 @@ +#! /usr/bin/env python3 + +""" +Script run from CIME when calling case.setup +Expects 3 arguments: + (1) case root path + (2) cam root path + (3) cam configuration options +""" + +import sys, os, shutil + +case_root = sys.argv[1] +cam_root = sys.argv[2] +cam_options = sys.argv[3] + +# If using GEOS-Chem chemistry then copy GEOS-Chem configuration files from source code to case +if '-chem geoschem' in cam_options: + geoschem_src = os.path.join(cam_root,'src','chemistry','geoschem','geoschem_src') + if not os.path.isdir(geoschem_src): + raise SystemExit("ERROR: Did not find path to GEOS-Chem source code at {:s}".format(geoschem_src)) + for fname in ['species_database.yml', 'geoschem_config.yml', + 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc']: + file1 = os.path.join(geoschem_src, 'run','CESM', fname) + if not os.path.exists(file1): + raise SystemExit("ERROR: GEOS-Chem configuration file does not exist: {}".format(file1)) + file2 = os.path.join(case_root, fname) + shutil.copy(file1,file2) From c44c904445d52b334d0e7e9aabe40c8a008a24ae Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 13 Oct 2023 14:32:57 -0600 Subject: [PATCH 129/160] Fix typo in error message Signed-off-by: Lizzie Lundgren --- src/physics/cam/constituents.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/constituents.F90 b/src/physics/cam/constituents.F90 index cda9c82db4..b93cf060b3 100644 --- a/src/physics/cam/constituents.F90 +++ b/src/physics/cam/constituents.F90 @@ -173,7 +173,7 @@ subroutine cnst_add (name, mwc, cpc, qminc, & padv = padv+1 ind = padv if (padv > pcnst) then - write(errmsg, *) sub//': FATAL: advected tracer (', trim(name), ') index for greater than pcnst=', pcnst + write(errmsg, *) sub//': FATAL: advected tracer (', trim(name), ') index is greater than number of constituents' call endrun(errmsg) end if From ba3134841b6258f4ff516eb6f4f91e876ba5a781 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 13 Oct 2023 15:21:45 -0600 Subject: [PATCH 130/160] Change GEOS-Chem acronym in compset long name from GC to GEOSCHEM The compset aliases will continue to use GC, e.g. FCnudged_GC Signed-off-by: Lizzie Lundgren --- cime_config/config_component.xml | 20 ++++++++--------- cime_config/config_compsets.xml | 38 ++++++++++++++++---------------- cime_config/config_pes.xml | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 899c6083ae..ab760aeede 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -8,9 +8,9 @@ CAM =============== --> - CAM cam6 physics: - CAM cam5 physics: - CAM cam4 physics: + CAM cam6 physics: + CAM cam5 physics: + CAM cam4 physics: CAM cam3 physics: CAM simplified and non-versioned physics : CAM7 development physics: @@ -38,7 +38,7 @@ --> CAM-Chem troposphere/stratosphere chemistry with simplified VBS-SOA: CAM-Chem troposphere/stratosphere chemistry with simplified VBS-SOA and expanded isoprene and terpene oxidation: - GEOS-Chem troposphere/stratosphere chemistry : + GEOS-Chem troposphere/stratosphere chemistry : CAM-Chem troposphere/stratosphere chem with simplified volatility basis set SOA scheme and fire emissons : CAM CLUBB - turned on by default in CAM60: CAM-Chem troposphere/stratosphere chem with extended volatility basis set SOA scheme and modal aersols : @@ -141,7 +141,7 @@ -phys cam_dev -chem ghg_mam4 -chem trop_strat_mam5_vbs - -chem geoschem_mam4 + -chem geoschem_mam4 -chem trop_mam7 -chem trop_strat_mam5_vbsext @@ -175,7 +175,7 @@ -offline_dyn -nlev 56 -nlev 56 - -nlev 56 + -nlev 56 -nlev 88 -nlev 145 -nlev 58 -model_top lt @@ -233,7 +233,7 @@ waccm_ma_2000_cam6 waccm_sc_2000_cam6 2000_trop_strat_vbs_cam6 - 2000_geoschem + 2000_geoschem waccmx_ma_2000_cam6 aquaplanet_cam3 @@ -250,7 +250,7 @@ 2010_trop_strat_vbs_cam6 waccm_tsmlt_2010_cam6 waccm_sc_2010_cam6 - 2010_geoschem + 2010_geoschem 1850-2005_cam5 1850-2005_cam4 @@ -271,8 +271,8 @@ hist_trop_strat_nudged_cam6 hist_trop_strat_vbsext_cam6 hist_trop_strat_vbsfire_cam6 - hist_geoschem - hist_geoschem_nudged + hist_geoschem + hist_geoschem_nudged waccmx_ma_hist_cam6 1850-PD_cam5 diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 1ab4866706..ce65ad81e1 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -563,27 +563,27 @@ FC2000climo_GC - 2000_CAM60%GC%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV + 2000_CAM60%GEOSCHEM%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV FC2010climo_GC - 2010_CAM60%GC%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV + 2010_CAM60%GEOSCHEM%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV FCHIST_GC - HIST_CAM60%GC%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV + HIST_CAM60%GEOSCHEM%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV FCSD_GC - HIST_CAM60%GC%HEMCO%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + HIST_CAM60%GEOSCHEM%HEMCO%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV FCnudged_GC - HIST_CAM60%GC%HEMCO%NUDG_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + HIST_CAM60%GEOSCHEM%HEMCO%NUDG_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV @@ -599,18 +599,18 @@ 1980-01-01 1850-01-01 2010-01-01 - 2015-01-01 + 2015-01-01 2013-01-01 1995-01-01 1995-01-01 2005-01-01 2005-01-01 - 2015-01-01 + 2015-01-01 2010-01-01 1980-01-01 2000-01-01 - 2000-01-01 - 2010-01-01 + 2000-01-01 + 2010-01-01 2004-01-01 1950-01-01 @@ -649,7 +649,7 @@ 1 1 - 1 + 1 @@ -657,7 +657,7 @@ 1 1 - 1 + 1 @@ -665,7 +665,7 @@ 1 1 - 1 + 1 @@ -673,7 +673,7 @@ 1 1 - 1 + 1 @@ -681,7 +681,7 @@ 1 1 - 1 + 1 @@ -689,7 +689,7 @@ 1 1 - 1 + 1 @@ -697,7 +697,7 @@ 1 1 - 1 + 1 @@ -705,7 +705,7 @@ 1 1 - 1 + 1 @@ -713,7 +713,7 @@ 1 1 - 1 + 1 @@ -721,7 +721,7 @@ 1 1 - 1 + 1 diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index 49a5a4594b..fd0d3694ad 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -1769,7 +1769,7 @@ 1 - + 1 1 From da76f711576ac0143d5202aec009cdd54dfa548c Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 16 Oct 2023 13:40:14 -0600 Subject: [PATCH 131/160] Change GEOS-Chem namelist and its parameter to use geoschem not gc This update also changes the subroutine used to read the namelist from gc_readnl to geoschem_readnl. Signed-off-by: Lizzie Lundgren --- bld/namelist_files/namelist_definition.xml | 4 +-- .../use_cases/2000_geoschem.xml | 2 +- .../use_cases/2010_geoschem.xml | 2 +- .../use_cases/hist_geoschem.xml | 2 +- .../use_cases/hist_geoschem_nudged.xml | 2 +- bld/namelist_files/use_cases/sd_geoschem.xml | 2 +- src/chemistry/geoschem/chemistry.F90 | 26 +++++++++---------- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index b9bfa1e0ec..613ee17492 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -5100,8 +5100,8 @@ Default: set by build-namelist for climo cases, otherwise -1 to use model clock. - + Full pathname to GEOS-Chem chemistry inputs directory Default: set by build-namelist. diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index d967d25c41..11a3b20b03 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -6,7 +6,7 @@ -/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ +/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index b0bce3ae6b..04bd57b1ba 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -4,7 +4,7 @@ -/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ +/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 6e4c1d181b..5d1ec8e1e4 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -6,7 +6,7 @@ -/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ +/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml index 13afb38906..9e71a46303 100644 --- a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -6,7 +6,7 @@ -/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ +/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml index 8691b5babb..a29c3f9ed6 100644 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ b/bld/namelist_files/use_cases/sd_geoschem.xml @@ -6,7 +6,7 @@ -/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ +/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f19_f19_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc atm/cam/met/MERRA2/1.9x2.5/fv_1.9x2.5_nc3000_Nsw084_Nrs016_Co120_Fi001_ZR_GRNL_MERRA2_c190617.nc diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index f5534a0ee8..c947494808 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -66,7 +66,7 @@ module chemistry CHARACTER(LEN=500) :: speciesDB = 'species_database.yml' ! Location of chemistry input - CHARACTER(LEN=shr_kind_cl) :: gc_cheminputs + CHARACTER(LEN=shr_kind_cl) :: geoschem_cheminputs ! Debugging LOGICAL :: debug = .TRUE. @@ -724,7 +724,7 @@ subroutine chem_readnl(nlfile) CALL lightning_readnl(nlfile) - CALL gc_readnl(nlfile) + CALL geoschem_readnl(nlfile) IF ( MasterProc ) THEN @@ -1129,9 +1129,9 @@ subroutine chem_init(phys_state, pbuf2d) RC = RC ) ! First setup directories - Input_Opt%Chem_Inputs_Dir = TRIM(gc_cheminputs) + Input_Opt%Chem_Inputs_Dir = TRIM(geoschem_cheminputs) Input_Opt%SpcDatabaseFile = TRIM(speciesDB) - Input_Opt%FAST_JX_DIR = TRIM(gc_cheminputs)//'FAST_JX/v2020-02/' + Input_Opt%FAST_JX_DIR = TRIM(geoschem_cheminputs)//'FAST_JX/v2020-02/' !---------------------------------------------------------- ! CESM-specific input flags @@ -1739,9 +1739,9 @@ subroutine gc_update_timesteps(DT) end subroutine gc_update_timesteps !================================================================================================ - ! subroutine gc_readnl + ! subroutine geoschem_readnl !================================================================================================ - subroutine gc_readnl(nlfile) + subroutine geoschem_readnl(nlfile) ! Purpose: reads the namelist from cam/src/control/runtime_opts ! CAM modules @@ -1751,17 +1751,17 @@ subroutine gc_readnl(nlfile) character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input integer :: unitn, ierr - character(len=*), parameter :: subname = 'gc_readnl' + character(len=*), parameter :: subname = 'geoschem_readnl' - namelist /gc_nl/ gc_cheminputs + namelist /geoschem_nl/ geoschem_cheminputs ! Read namelist IF ( MasterProc ) THEN unitn = getunit() OPEN( unitn, FILE=TRIM(nlfile), STATUS='old' ) - CALL find_group_name(unitn, 'gc_nl', STATUS=ierr) + CALL find_group_name(unitn, 'geoschem_nl', STATUS=ierr) IF ( ierr == 0 ) THEN - READ(unitn, gc_nl, IOSTAT=ierr) + READ(unitn, geoschem_nl, IOSTAT=ierr) IF ( ierr /= 0 ) THEN CALL ENDRUN(subname // ':: ERROR reading namelist') ENDIF @@ -1771,12 +1771,12 @@ subroutine gc_readnl(nlfile) ENDIF ! Broadcast namelist variables - CALL mpi_bcast(gc_cheminputs, LEN(gc_cheminputs), mpi_character, masterprocid, mpicom, ierr) + CALL mpi_bcast(geoschem_cheminputs, LEN(geoschem_cheminputs), mpi_character, masterprocid, mpicom, ierr) IF ( ierr /= mpi_success ) then - CALL endrun(subname//': MPI_BCAST ERROR: gc_cheminputs') + CALL endrun(subname//': MPI_BCAST ERROR: geoschem_cheminputs') ENDIF - end subroutine gc_readnl + end subroutine geoschem_readnl !================================================================================================ ! subroutine chem_timestep_tend From 7f1d0993528283e53e692046d66d8411b447a0f1 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 17 Oct 2023 11:19:39 -0400 Subject: [PATCH 132/160] Updates for paper, SE grid compatibility, bug fixes - Support Input_Opt%correctConvUTLS to correct for convective scavenging of soluble tracers (science update, upcoming paper) - Update to UCX mpi broadcast of State_Chm%NOXCOEFF as SE grid not all CPUs have same amount of chunks and MPI code has to be moved to higher level that is aware of chunking - Update to drydep namelist for SE compatibility - Fix for incorrect SOA mapping inconsistent with published Fritz et al. (2022) methodology Signed-off-by: Haipeng Lin --- src/chemistry/geoschem/chemistry.F90 | 88 ++++++++++++++++++---------- 1 file changed, 58 insertions(+), 30 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index c947494808..43357aa854 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -656,6 +656,8 @@ subroutine chem_readnl(nlfile) use aero_model, only : aero_model_readnl use dust_model, only : dust_readnl #endif + ! For dry deposition on unstructured grids + use mo_drydep, only : drydep_srf_file ! args CHARACTER(LEN=*), INTENT(IN) :: nlfile ! filepath for file containing namelist input @@ -672,9 +674,9 @@ subroutine chem_readnl(nlfile) RC = GC_SUCCESS namelist /chem_inparm/ depvel_lnd_file + namelist /chem_inparm/ drydep_srf_file ! ghg chem - namelist /chem_inparm/ bndtvg, h2orates, ghg_chem if (debug .and. masterproc) write(iulog,'(a)') 'chem_readnl: reading namelists for GEOS-Chem chemistry' @@ -831,7 +833,7 @@ subroutine chem_readnl(nlfile) IF (IERR == 0) THEN READ(unitn, chem_inparm, IOSTAT=IERR) IF (IERR /= 0) THEN - CALL endrun('chem_readnl: ERROR reading namelist') + CALL endrun('chem_readnl: ERROR reading namelist chem_inparm') ENDIF ENDIF CLOSE(unitn) @@ -864,6 +866,10 @@ subroutine chem_readnl(nlfile) IF ( ierr /= mpi_success ) then CALL endrun(subname//': MPI_BCAST ERROR: depvel_lnd_file') ENDIF + CALL mpi_bcast(drydep_srf_file, LEN(drydep_srf_file), mpi_character, masterprocid, mpicom, ierr) + IF ( ierr /= mpi_success ) then + CALL endrun(subname//': MPI_BCAST ERROR: drydep_srf_file') + ENDIF CALL mpi_bcast(ghg_chem, 1, mpi_logical, masterprocid, mpicom, ierr) IF ( ierr /= mpi_success ) then CALL endrun(subname//': MPI_BCAST ERROR: ghg_chem') @@ -1122,32 +1128,31 @@ subroutine chem_init(phys_state, pbuf2d) Input_Opt%thisCPU = myCPU Input_Opt%amIRoot = MasterProc - !IF ( MasterProc ) THEN - IF ( .True. ) THEN - CALL Read_Input_File( Input_Opt = Input_Opt, & - State_Grid = maxGrid, & - RC = RC ) - - ! First setup directories - Input_Opt%Chem_Inputs_Dir = TRIM(geoschem_cheminputs) - Input_Opt%SpcDatabaseFile = TRIM(speciesDB) - Input_Opt%FAST_JX_DIR = TRIM(geoschem_cheminputs)//'FAST_JX/v2020-02/' + CALL Read_Input_File( Input_Opt = Input_Opt, & + State_Grid = maxGrid, & + RC = RC ) - !---------------------------------------------------------- - ! CESM-specific input flags - !---------------------------------------------------------- - - ! onlineAlbedo -> True (use CLM albedo) - ! -> False (read monthly-mean albedo from HEMCO) - Input_Opt%onlineAlbedo = .true. + ! First setup directories + Input_Opt%Chem_Inputs_Dir = TRIM(geoschem_cheminputs) + Input_Opt%SpcDatabaseFile = TRIM(speciesDB) + Input_Opt%FAST_JX_DIR = TRIM(geoschem_cheminputs)//'FAST_JX/v2020-02/' + + !---------------------------------------------------------- + ! CESM-specific input flags + !---------------------------------------------------------- - ! applyQtend: apply tendencies of water vapor to specific humidity - Input_Opt%applyQtend = .False. + ! onlineAlbedo -> True (use CLM albedo) + ! -> False (read monthly-mean albedo from HEMCO) + Input_Opt%onlineAlbedo = .true. - IF ( .NOT. Input_Opt%LSOA ) THEN - CALL ENDRUN('CESM2-GC requires the complex SOA option to be on!') - ENDIF + ! applyQtend: apply tendencies of water vapor to specific humidity + Input_Opt%applyQtend = .False. + ! correctConvUTLS: Apply photolytic correction for convective scavenging of soluble tracers? + Input_Opt%correctConvUTLS = .true. + + IF ( .NOT. Input_Opt%LSOA ) THEN + CALL ENDRUN('CESM2-GC requires the complex SOA option to be on!') ENDIF CALL Validate_Directories( Input_Opt, RC ) @@ -1482,7 +1487,7 @@ subroutine chem_init(phys_state, pbuf2d) CALL aero_model_init( pbuf2d ) ! Initialize drydep - CALL drydep_inti( depvel_lnd_file) + CALL drydep_inti( depvel_lnd_file ) #endif IF ( gas_wetdep_method == 'NEU' ) THEN @@ -1592,6 +1597,18 @@ subroutine chem_init(phys_state, pbuf2d) State_Chm = State_Chm(I), & State_Diag = State_Diag(I), & State_Grid = State_Grid(I) ) + + ! Because not all CPUs in the communicator have the same amount of chunks, + ! it is only guaranteed that the first chunk in all CPUs can participate in + ! MPI_bcast of the NOXCOEFF array. So only the root CPU & root chunk will + ! read the NOXCOEFF array from disk, then broadcast to all other CPU's first + ! chunks, then remaining chunks can be copied locally without MPI. (hplin, 10/17/23) + IF( I == BEGCHUNK ) THEN + CALL mpi_bcast( State_Chm(I)%NOXCOEFF, size(State_Chm(I)%NOXCOEFF), mpi_real8, masterprocid, mpicom, ierr ) + IF ( ierr /= mpi_success ) CALL endrun('Error in mpi_bcast of NOXCOEFF in first chunk') + ELSE + State_CHM(I)%NOXCOEFF = State_Chm(BEGCHUNK)%NOXCOEFF + ENDIF ENDDO ENDIF @@ -1673,7 +1690,7 @@ subroutine chem_init(phys_state, pbuf2d) ! Cleanup Call Cleanup_State_Grid( maxGrid, RC ) - if (debug .and. masterproc) write(iulog,'(a)') 'chem_init: GEOS-Chem chemistry initialization complete' + if (masterproc) write(iulog,'(a)') 'chem_init: GEOS-Chem chemistry initialization complete' end subroutine chem_init @@ -2180,6 +2197,12 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDDO #if defined( MODAL_AERO ) + ! NOTE: GEOS-Chem bulk aerosol concentrations (BCPI, BCPO, SO4, ...) are ZEROED OUT + ! here in order to be reconstructed from the modal concentrations. + ! + ! This means that any changes to the BULK mass will be ignored between the end + ! of the gas_phase_chemdr and the beginning of the next!! + ! ! First reset State_Chm%Species to zero out MAM-inherited GEOS-Chem aerosols DO M = 1, ntot_amode DO SM = 1, nspec_amode(M) @@ -2227,7 +2250,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! map2GC(bulk constituent index) constituent index (bulk) GEOS-Chem species index (bulk) ! map2MAM4(SM, M) SM, M (modal) constituent index (bulk) ! (map2MAM4 is a N to 1 operation) - ! + ! Query functions: + ! xname_massptr(SM, M) SM, M NAME of modal aer (bc_a1, bc_a4, ...) !------------------------------------------------------------------------------------------ binRatio = 0.0e+00_r8 DO M = 1, ntot_amode @@ -2405,15 +2429,18 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ENDIF #endif + ! Convert mass fluxes to VMR as needed for MAM4 aerosols (these operate on vmr0 - initial and vmr1 - end of timestep) DO N = 1, gas_pcnst ! See definition of map2chm M = map2chm(N) IF ( M > 0 ) THEN + ! Is a GEOS-Chem species? vmr0(:nY,:nZ,N) = State_Chm(LCHNK)%Species(M)%Conc(1,:nY,nZ:1:-1) * & MWDry / adv_mass(N) ! We'll substract concentrations after chemistry later mmr_tend(:nY,:nZ,N) = REAL(State_Chm(LCHNK)%Species(M)%Conc(1,:nY,nZ:1:-1),r8) ELSEIF ( M < 0 ) THEN + ! Is a MAM4 species? Get VMR from state%q directly. vmr0(:nY,:nZ,N) = state%q(:nY,:nZ,-M) * & MWDry / adv_mass(N) mmr_tend(:nY,:nZ,N) = state%q(:nY,:nZ,-M) @@ -3865,6 +3892,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) ! Deal with aerosol SOA species ! First deal with lowest two volatility bins + ! Only map TOSA0 (K1) and ASOAN (K2) to soa1_ and soa2_, according to Fritz et al. + ! SOAIE (K3) and SOAGX (K4) were mapped in the code but are inconsistent with the model description paper. speciesName_1 = 'TSOA0' speciesName_2 = 'ASOAN' speciesName_3 = 'SOAIE' @@ -3886,10 +3915,9 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) N = lptr2_soa_a_amode(M,iBin) IF ( N <= 0 ) CYCLE P = mapCnst(N) - IF ( P > 0 .AND. K1 > 0 .AND. K2 > 0 .AND. K3 > 0 .AND. K4 > 0 ) THEN + IF ( P > 0 .AND. K1 > 0 .AND. K2 > 0 ) THEN vmr1(:nY,:nZ,P) = state%q(:nY,:nZ,N) / bulkMass(:nY,:nZ) & - * (vmr1(:nY,:nZ,K1) + vmr1(:nY,:nZ,K2) + & - vmr1(:nY,:nZ,K3) + vmr1(:nY,:nZ,K4)) + * (vmr1(:nY,:nZ,K1) + vmr1(:nY,:nZ,K2)) ENDIF ENDDO ENDDO From a66be1578443f84c546a795cf9b4f168d5d019e4 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 19 Oct 2023 00:14:55 -0400 Subject: [PATCH 133/160] Slight formatting updates to GEOS-Chem run log output --- src/chemistry/geoschem/chemistry.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chemistry/geoschem/chemistry.F90 b/src/chemistry/geoschem/chemistry.F90 index 43357aa854..ec38b67918 100644 --- a/src/chemistry/geoschem/chemistry.F90 +++ b/src/chemistry/geoschem/chemistry.F90 @@ -4210,8 +4210,8 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o ) Nullify(NEvapr ) Nullify(cmfdqr ) - IF ( rootChunk ) WRITE(iulog,*) ' GEOS-Chem Chemistry step ', iStep, ' completed' - IF ( lastChunk ) WRITE(iulog,*) ' Chemistry completed on all chunks completed of MasterProc' + IF ( rootChunk ) WRITE(iulog,*) 'GEOS-Chem Chemistry step ', iStep, ' completed' + IF ( lastChunk ) WRITE(iulog,*) 'Chemistry completed on all chunks of root CPU' IF ( FIRST ) THEN FIRST = .false. ENDIF From 972c057e14c63a6e4a0cd5ec20d3ed66c6fe3c04 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 20 Oct 2023 11:24:47 -0400 Subject: [PATCH 134/160] Update GEOS-Chem external tag to 14.1.2 --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 122a8bb0f0..5be47f26cb 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -80,7 +80,7 @@ required = True local_path = src/chemistry/geoschem/geoschem_src protocol = git repo_url = https://github.com/geoschem/geos-chem.git -tag = 14.1.1 +tag = 14.1.2 required = True [hemco] From 95bc735e49a1d454cc82550b901d690b3582248b Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 20 Oct 2023 11:20:01 -0600 Subject: [PATCH 135/160] Remove unnecessary comment about NTHRDS Signed-off-by: Lizzie Lundgren --- cime_config/config_compsets.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index ce65ad81e1..f64c1dd507 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -555,12 +555,6 @@ HIST_CAM60%WXIED%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV - - - - - - FC2000climo_GC 2000_CAM60%GEOSCHEM%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV From cf0e7b66249fc3e9b605676cea232e66f304cc13 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 30 Oct 2023 11:12:42 -0400 Subject: [PATCH 136/160] Update Externals_CAM.cfg to use hash as 14.1.2 matches branch as well --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 5be47f26cb..2228f18644 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -80,7 +80,7 @@ required = True local_path = src/chemistry/geoschem/geoschem_src protocol = git repo_url = https://github.com/geoschem/geos-chem.git -tag = 14.1.2 +hash = 28345ee7 required = True [hemco] From 95cd2a57782266451154f4dab74ec4111071570a Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 30 Oct 2023 13:43:03 -0400 Subject: [PATCH 137/160] Revert "Update Externals_CAM.cfg to use hash as 14.1.2 matches branch as well" This reverts commit cf0e7b66249fc3e9b605676cea232e66f304cc13. --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 2228f18644..5be47f26cb 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -80,7 +80,7 @@ required = True local_path = src/chemistry/geoschem/geoschem_src protocol = git repo_url = https://github.com/geoschem/geos-chem.git -hash = 28345ee7 +tag = 14.1.2 required = True [hemco] From 1b5c2811b48449d6e8ebfa65acde229d87cb30d7 Mon Sep 17 00:00:00 2001 From: Steve Goldhaber Date: Mon, 2 Oct 2023 21:32:27 +0200 Subject: [PATCH 138/160] Suggested changes to cam.case_setup.py --- cime_config/cam.case_setup.py | 93 +++++++++++++++++++++++++---------- 1 file changed, 67 insertions(+), 26 deletions(-) diff --git a/cime_config/cam.case_setup.py b/cime_config/cam.case_setup.py index 19bea2c567..be04d3e039 100755 --- a/cime_config/cam.case_setup.py +++ b/cime_config/cam.case_setup.py @@ -1,28 +1,69 @@ #! /usr/bin/env python3 -""" -Script run from CIME when calling case.setup -Expects 3 arguments: - (1) case root path - (2) cam root path - (3) cam configuration options -""" - -import sys, os, shutil - -case_root = sys.argv[1] -cam_root = sys.argv[2] -cam_options = sys.argv[3] - -# If using GEOS-Chem chemistry then copy GEOS-Chem configuration files from source code to case -if '-chem geoschem' in cam_options: - geoschem_src = os.path.join(cam_root,'src','chemistry','geoschem','geoschem_src') - if not os.path.isdir(geoschem_src): - raise SystemExit("ERROR: Did not find path to GEOS-Chem source code at {:s}".format(geoschem_src)) - for fname in ['species_database.yml', 'geoschem_config.yml', - 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc']: - file1 = os.path.join(geoschem_src, 'run','CESM', fname) - if not os.path.exists(file1): - raise SystemExit("ERROR: GEOS-Chem configuration file does not exist: {}".format(file1)) - file2 = os.path.join(case_root, fname) - shutil.copy(file1,file2) +"""Copy GEOS-Chem configuration files from source to the case directory. +This script is run from CIME when calling case.setup""" + +import logging +import os +import shutil +import sys + +_CIMEROOT = os.environ.get("CIMEROOT") +if _CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") +# end if +_LIBDIR = os.path.join(_CIMEROOT, "CIME", "Tools") +sys.path.append(_LIBDIR) +sys.path.insert(0, _CIMEROOT) + +#pylint: disable=wrong-import-position +from CIME.case import Case + +logger = logging.getLogger(__name__) + +if len(sys.argv) != 3: + raise SystemExit(f"Incorrect call to {sys.argv[0]}, need CAM root and case root") +# end if +cam_root = sys.argv[1] +case_root = sys.argv[2] + +with Case(case_root) as case: + cam_config = case.get_value('CAM_CONFIG_OPTS') + # Gather case information (from _build_usernl_files in case_setup.py) + comp_interface = case.get_value("COMP_INTERFACE") + + if comp_interface == "nuopc": + ninst = case.get_value("NINST") + elif ninst == 1: + ninst = case.get_value("NINST_CAM") + # end if +# end with + +# GEOS-Chem only: copy config files to case +if '-chem geoschem' in cam_config: + geoschem_config_src = os.path.join(cam_root, 'src', 'chemistry', + 'geoschem', 'geoschem_src', 'run', 'CESM') + if not os.path.isdir(geoschem_config_src): + raise SystemExit(f"ERROR: Did not find path to GEOS-Chem source code at {geoschem_config_src}") + # end if + for fileName in ['species_database.yml', 'geoschem_config.yml', 'HISTORY.rc', + 'HEMCO_Config.rc', 'HEMCO_Diagn.rc']: + source_file = os.path.join(cam_root, geoschem_config_src, fileName) + if not os.path.exists(source_file): + raise SystemExit(f"ERROR: Did not find source file, {fileName}") + # end if + spaths = source_file.splitext(source_file) + for inst_num in range(ninst): + if ninst > 1: + target_file = f"{spaths[0]}_{inst_num+1:04d}{spaths[1]}" + else: + target_file = os.path.join(case_root, fileName) + # end if + if not os.path.exists(target_file): + logger.info("CAM namelist one-time copy of GEOS-Chem run directory files: source_file %s target_file %s ", + source_file, target_file) + shutil.copy(source_file, target_file) + # end if + # end for + # end for +# end if From 0d4bf3fb07fbad54d31173f9da2650da9162138d Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 31 Oct 2023 09:46:05 -0600 Subject: [PATCH 139/160] Fix bug and change error messages in cam.case_setup.py Signed-off-by: Lizzie Lundgren --- cime_config/cam.case_setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cime_config/cam.case_setup.py b/cime_config/cam.case_setup.py index be04d3e039..e8cb17c5a6 100755 --- a/cime_config/cam.case_setup.py +++ b/cime_config/cam.case_setup.py @@ -44,15 +44,15 @@ geoschem_config_src = os.path.join(cam_root, 'src', 'chemistry', 'geoschem', 'geoschem_src', 'run', 'CESM') if not os.path.isdir(geoschem_config_src): - raise SystemExit(f"ERROR: Did not find path to GEOS-Chem source code at {geoschem_config_src}") + raise SystemExit(f"ERROR: Did not find path to GEOS-Chem config files at {geoschem_config_src}") # end if for fileName in ['species_database.yml', 'geoschem_config.yml', 'HISTORY.rc', 'HEMCO_Config.rc', 'HEMCO_Diagn.rc']: source_file = os.path.join(cam_root, geoschem_config_src, fileName) if not os.path.exists(source_file): - raise SystemExit(f"ERROR: Did not find source file, {fileName}") + raise SystemExit(f"ERROR: Did not find source file, {source_file}") # end if - spaths = source_file.splitext(source_file) + spaths = os.path.splitext(source_file) for inst_num in range(ninst): if ninst > 1: target_file = f"{spaths[0]}_{inst_num+1:04d}{spaths[1]}" From 84e830df9a6490f8b83a4a5e933527b9fc71e63e Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 3 Nov 2023 09:14:27 -0600 Subject: [PATCH 140/160] Remove the FCSD_GC compset This compset for GEOS-Chem is not currently functional. We can bring back the option in the future if there is demand. Signed-off-by: Lizzie Lundgren --- bld/namelist_files/use_cases/sd_geoschem.xml | 209 ------------------- cime_config/config_component.xml | 2 - cime_config/config_compsets.xml | 6 - cime_config/testdefs/testlist_cam.xml | 8 - 4 files changed, 225 deletions(-) delete mode 100644 bld/namelist_files/use_cases/sd_geoschem.xml diff --git a/bld/namelist_files/use_cases/sd_geoschem.xml b/bld/namelist_files/use_cases/sd_geoschem.xml deleted file mode 100644 index a29c3f9ed6..0000000000 --- a/bld/namelist_files/use_cases/sd_geoschem.xml +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - -/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ - -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f19_f19_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc -atm/cam/met/MERRA2/1.9x2.5/fv_1.9x2.5_nc3000_Nsw084_Nrs016_Co120_Fi001_ZR_GRNL_MERRA2_c190617.nc - -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FCSD.f09_f09_mg17.cesm2.1-exp002.001.cam.i.2005-01-01-00000_c180801.nc -atm/cam/met/MERRA2/0.9x1.25/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_MERRA2_c171218.nc - -/glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc - -HEMCO_Config.rc -HEMCO_Diagn.rc - - - - -20150101 - -50. -.true. - - -2015/MERRA2_1.9x2.5_20150101.nc -atm/cam/met/MERRA2/1.9x2.5 -atm/cam/met/MERRA2/1.9x2.5/filenames_list_c20210302 - -2015/MERRA2_0.9x1.25_20150101.nc -atm/cam/met/MERRA2/0.9x1.25 -atm/cam/met/MERRA2/0.9x1.25/filenames_1975-2017_c190125.txt - -2010/MERRA2_0.5x0.63_20100101.nc -atm/cam/met/MERRA2/0.5x0.63 -atm/cam/met/MERRA2/0.5x0.63/filenames_list_c180612 - - -atm/cam/solar/SolarForcingNRLSSI2_daily_s18820101_e20171231_c191122.nc -SERIAL - - -.true. -.true. -.false. -0.25D0 - - -SERIAL -atm/waccm/lb/LBC_1750-2014_CMIP6_0p5degLat_c170126.nc - - - - - - - -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' - - - - -'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - - - 1,30,365,240,240,480,365,73,30 - 0,-24,-24,-3,-1,1,-24,-120,-240 -'A','A','A','A','A','A','A','A','I' - -.true. -.false. -.false. -.false. -.false. -.false. -.false. -.false. -.false. - - -'AREA', -'HEIGHT', -'T', -'U', -'V', -'Q', -'PS', -'CLOUD', -'TROPP_P', -'TROPP_T', -'TROPP_Z', -'DF_CO', -'DF_O3', -'DF_NO2', -'DF_SO4', -'DF_NIT', -'CT_O3', -'CT_OH', -'OHwgtByAirMassColumnFull', -'Chem_SO3AQ', -'Jval_Cl2O2', -'Jval_H2O2', -'Jval_NO2', -'Jval_PAN', -'JvalO3O3P', -'JvalO3O1D', -'LNO_COL_PROD', -'Prod_Ox', -'Prod_SO4', -'Prod_CO', -'Prod_H2O2', -'ProdCOfromCH4', -'ProdCOfromNMVOC', -'Loss_Ox', -'Loss_CH4', -'Loss_CO', -'LossOHbyCH4columnTrop', -'LossOHbyMCFcolumnTrop', -'LossHNO3onSeaSalt', -'ACET', -'ALD2', -'ALK4', -'BR', -'BRCL', -'BRNO3', -'BRO', -'BROX', -'BROY', -'C3H8', -'CH2O', -'CH3CL', -'CH4', -'CL', -'CLNO3', -'CLO', -'CLOX', -'CLOY', -'CO', -'DMS', -'EOH', -'H2O', -'H2O2', -'H2SO4', -'HO2', -'HOX', -'HBR', -'HCL', -'HOBR', -'HOCL', -'HNO3', -'HNO4', -'ISOP', -'MACR', -'MAP', -'MEK', -'MOH', -'MVK', -'N2O', -'N2O5', -'NHX', -'NIT', -'NO', -'NO2', -'NO3', -'NOX', -'NOY', -'O3', -'OH', -'PAN', -'PM25', -'RCHO', -'SALA', -'SALC', -'SO2', -'SO4', -'SOX', -'TOLU', -'bc_a1', -'bc_a4', -'dst_a1', -'dst_a2', -'dst_a3', -'num_a1', -'num_a2', -'num_a3', -'num_a4', -'pom_a1', -'pom_a4', -'so4_a1', -'so4_a2', -'so4_a3', - - - diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index ab760aeede..9f8e3a5698 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -175,7 +175,6 @@ -offline_dyn -nlev 56 -nlev 56 - -nlev 56 -nlev 88 -nlev 145 -nlev 58 -model_top lt @@ -299,7 +298,6 @@ sd_waccm_ma_cam4 sd_trop_strat_vbs_cam6 sd_trop_strat2_cam6 - sd_geoschem sd_cam6 dabi_p2004 diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index f64c1dd507..2408be5b95 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -570,11 +570,6 @@ HIST_CAM60%GEOSCHEM%HEMCO_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV - - FCSD_GC - HIST_CAM60%GEOSCHEM%HEMCO%SDYN_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV - - FCnudged_GC HIST_CAM60%GEOSCHEM%HEMCO%NUDG_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV @@ -599,7 +594,6 @@ 1995-01-01 2005-01-01 2005-01-01 - 2015-01-01 2010-01-01 1980-01-01 2000-01-01 diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 60035ac588..90a3f6ee17 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -1635,14 +1635,6 @@ - - - - - - - - From 15bbeef4b0556509d1db473b80e235f02e6cb11b Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 3 Nov 2023 09:19:12 -0600 Subject: [PATCH 141/160] Remove NTHRDS overrides for GEOS-Chem NTHRDS is 1 by default when using GEOS-Chem compsets so these overrides are not necessary. We find that manually changing NTHRDS to something other than 1 breaks the model, but this is the case with non-GEOS-Chem compsets as well. Unless this becomes a problem the overrides are not needed at this time. Signed-off-by: Lizzie Lundgren --- cime_config/config_compsets.xml | 10 ---------- cime_config/config_pes.xml | 12 ------------ 2 files changed, 22 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 2408be5b95..d2aec47d2e 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -637,7 +637,6 @@ 1 1 - 1 @@ -645,7 +644,6 @@ 1 1 - 1 @@ -653,7 +651,6 @@ 1 1 - 1 @@ -661,7 +658,6 @@ 1 1 - 1 @@ -669,7 +665,6 @@ 1 1 - 1 @@ -677,7 +672,6 @@ 1 1 - 1 @@ -685,7 +679,6 @@ 1 1 - 1 @@ -693,7 +686,6 @@ 1 1 - 1 @@ -701,7 +693,6 @@ 1 1 - 1 @@ -709,7 +700,6 @@ 1 1 - 1 diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index fd0d3694ad..42fe06d64a 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -1769,18 +1769,6 @@ 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - From 392e9e33494b472b4367152d6b4a96c1fc22d37d Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 8 Nov 2023 13:25:31 -0700 Subject: [PATCH 142/160] Remove redundant includes of src/hemco in .gitignore Signed-off-by: Lizzie Lundgren --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index b2434334bb..0c9f941a97 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ src/physics/clubb src/physics/cosp2/src src/physics/silhs src/chemistry/geoschem/geoschem_src -src/hemco src/physics/pumas src/physics/pumas-frozen src/dynamics/fv3/atmos_cubed_sphere From 12d89ea1e334b8f7ef9920a1846bef2198c48a52 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 14 Nov 2023 21:13:57 -0500 Subject: [PATCH 143/160] Exit with warning in build-namelist if hemco_config_file or hemco_diagn_file are specified in user namelist. Current behavior in build-namelist enforces use of config files in case directory which are copied to run directory at submit time. User customization to user_nl_cam for the path of HEMCO config files will not take effect when running with GEOS-Chem chemistry, instead the user should edit or symlink from the files in the case directory similar to standalone GEOS-Chem operation. This commit adds a check in build-namelist for this customization and aborts with error to warn user that this is unsupported. Signed-off-by: Haipeng Lin --- bld/build-namelist | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 3f92d38125..2dda74cf0b 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -2960,10 +2960,27 @@ if ($nl->get_value('use_hemco') =~ m/$TRUE/io) { $nl->delete_variable('chem_inparm', 'ext_frc_specifier'); $nl->delete_variable('chem_inparm', 'srf_emis_specifier'); - # If using GEOS-Chem reset paths of HEMCO configuration files to local filename only if ($chem =~ /geoschem/) { - $nl->set_variable_value('hemco_nl', 'hemco_config_file', "'HEMCO_Config.rc'"); - $nl->set_variable_value('hemco_nl', 'hemco_diagn_file', "'HEMCO_Diagn.rc'"); + + # For now, HEMCO config and diagnostic configuration files are always used from + # the case directory. Exit if user has specified other paths in the user namelist + # because it will not work. + if ($nl->get_value('hemco_config_file') ne "'" . $inputdata_rootdir . "/HEMCO_Config.rc'") { + die "CAM Namelist ERROR: When running with GEOS-Chem chemistry, hemco_config_file\n". + "must not be manually set in the namelist. Instead, modify (or symlink from) the HEMCO_Config.rc\n". + "in the case directory, which will be copied to the run directory when submitting,\n". + "Then remove the hemco_config_file option from the user namelist.\n"; + } + + if ($nl->get_value('hemco_diagn_file') ne "'" . $inputdata_rootdir . "/HEMCO_Diagn.rc'") { + die "CAM Namelist ERROR: When running with GEOS-Chem chemistry, hemco_diagn_file\n". + "must not be manually set in the namelist. Instead, modify (or symlink from) the HEMCO_Diagn.rc\n". + "in the case directory, which will be copied to the run directory when submitting.\n". + "Then remove the hemco_diagn_file option from the user namelist.\n"; + } + + $nl->set_variable_value('hemco_nl', 'hemco_config_file', "'HEMCO_Config.rc'"); + $nl->set_variable_value('hemco_nl', 'hemco_diagn_file', "'HEMCO_Diagn.rc'"); } } From 5c048af25496932af3fd43cbfd94cfa63b20611b Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 15 Nov 2023 15:08:47 -0500 Subject: [PATCH 144/160] Fix typo; indent with spaces --- bld/build-namelist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 2dda74cf0b..5f70e2b523 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -2968,7 +2968,7 @@ if ($nl->get_value('use_hemco') =~ m/$TRUE/io) { if ($nl->get_value('hemco_config_file') ne "'" . $inputdata_rootdir . "/HEMCO_Config.rc'") { die "CAM Namelist ERROR: When running with GEOS-Chem chemistry, hemco_config_file\n". "must not be manually set in the namelist. Instead, modify (or symlink from) the HEMCO_Config.rc\n". - "in the case directory, which will be copied to the run directory when submitting,\n". + "in the case directory, which will be copied to the run directory when submitting.\n". "Then remove the hemco_config_file option from the user namelist.\n"; } @@ -2980,7 +2980,7 @@ if ($nl->get_value('use_hemco') =~ m/$TRUE/io) { } $nl->set_variable_value('hemco_nl', 'hemco_config_file', "'HEMCO_Config.rc'"); - $nl->set_variable_value('hemco_nl', 'hemco_diagn_file', "'HEMCO_Diagn.rc'"); + $nl->set_variable_value('hemco_nl', 'hemco_diagn_file', "'HEMCO_Diagn.rc'"); } } From cc85a5be56669162cecee534ab966625fb2604f8 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 16 Nov 2023 13:08:09 -0700 Subject: [PATCH 145/160] Split master deposition lists into two: mozart and geoschem Deposition lists are no longer stored in GEOS-Chem use case files. Set_dep_lists now takes chem as an argument and picks the appropriate master deposition list file to use, either Mozart or GEOS-Chem. Signed-off-by: Lizzie Lundgren --- bld/build-namelist | 2 +- .../geoschem_master_aer_drydep_list.xml | 91 ++++++++++ .../geoschem_master_aer_wetdep_list.xml | 89 +++++++++ .../geoschem_master_gas_drydep_list.xml | 170 ++++++++++++++++++ .../geoschem_master_gas_wetdep_list.xml | 152 ++++++++++++++++ ....xml => mozart_master_aer_drydep_list.xml} | 0 ....xml => mozart_master_aer_wetdep_list.xml} | 0 ....xml => mozart_master_gas_drydep_list.xml} | 0 ....xml => mozart_master_gas_wetdep_list.xml} | 0 .../use_cases/2000_geoschem.xml | 20 --- .../use_cases/2010_geoschem.xml | 20 --- .../use_cases/hist_geoschem.xml | 20 --- .../use_cases/hist_geoschem_nudged.xml | 22 --- bld/perl5lib/Build/ChemNamelist.pm | 110 ++++-------- 14 files changed, 541 insertions(+), 155 deletions(-) create mode 100644 bld/namelist_files/geoschem_master_aer_drydep_list.xml create mode 100644 bld/namelist_files/geoschem_master_aer_wetdep_list.xml create mode 100644 bld/namelist_files/geoschem_master_gas_drydep_list.xml create mode 100644 bld/namelist_files/geoschem_master_gas_wetdep_list.xml rename bld/namelist_files/{master_aer_drydep_list.xml => mozart_master_aer_drydep_list.xml} (100%) rename bld/namelist_files/{master_aer_wetdep_list.xml => mozart_master_aer_wetdep_list.xml} (100%) rename bld/namelist_files/{master_gas_drydep_list.xml => mozart_master_gas_drydep_list.xml} (100%) rename bld/namelist_files/{master_gas_wetdep_list.xml => mozart_master_gas_wetdep_list.xml} (100%) diff --git a/bld/build-namelist b/bld/build-namelist index 5f70e2b523..7cf81732ec 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -576,7 +576,7 @@ if ( ($chem ne 'none') or ( $prog_species ) ){ my ( $gas_wetdep_list, $aer_wetdep_list, $aer_sol_facti, $aer_sol_factb, $aer_scav_coef, $aer_drydep_list, $gas_drydep_list ) = - set_dep_lists( $cfgdir, $chem_proc_src, $chem_src_dir, $nl, $print ); + set_dep_lists( $chem, $cfgdir, $chem_proc_src, $chem_src_dir, $nl, $print ); if (length($gas_wetdep_list)>2){ add_default($nl, 'gas_wetdep_method' ); diff --git a/bld/namelist_files/geoschem_master_aer_drydep_list.xml b/bld/namelist_files/geoschem_master_aer_drydep_list.xml new file mode 100644 index 0000000000..a31d3ff31c --- /dev/null +++ b/bld/namelist_files/geoschem_master_aer_drydep_list.xml @@ -0,0 +1,91 @@ + + + + + + + dst_a1 + so4_a1 + nh4_a1 + pom_a1 + pomff1_a1 + pombb1_a1 + soa_a1 + bc_a1 + ncl_a1 + num_a1 + so4_a2 + nh4_a2 + soa_a2 + ncl_a2 + dst_a2 + num_a2 + dst_a3 + ncl_a3 + so4_a3 + pom_a3 + bc_a3 + num_a3 + ncl_a4 + so4_a4 + pom_a4 + pomff1_a4 + pombb1_a4 + bc_a4 + nh4_a4 + num_a4 + dst_a5 + so4_a5 + nh4_a5 + num_a5 + ncl_a6 + so4_a6 + nh4_a6 + num_a6 + dst_a7 + so4_a7 + nh4_a7 + num_a7 + soa1_a1 + soa1_a2 + soa2_a1 + soa2_a2 + soa3_a1 + soa3_a2 + soa4_a1 + soa4_a2 + soa5_a1 + soa5_a2 + soaff1_a1 + soaff2_a1 + soaff3_a1 + soaff4_a1 + soaff5_a1 + soabb1_a1 + soabb2_a1 + soabb3_a1 + soabb4_a1 + soabb5_a1 + soabg1_a1 + soabg2_a1 + soabg3_a1 + soabg4_a1 + soabg5_a1 + soaff1_a2 + soaff2_a2 + soaff3_a2 + soaff4_a2 + soaff5_a2 + soabb1_a2 + soabb2_a2 + soabb3_a2 + soabb4_a2 + soabb5_a2 + soabg1_a2 + soabg2_a2 + soabg3_a2 + soabg4_a2 + soabg5_a2 + + + diff --git a/bld/namelist_files/geoschem_master_aer_wetdep_list.xml b/bld/namelist_files/geoschem_master_aer_wetdep_list.xml new file mode 100644 index 0000000000..16391485fe --- /dev/null +++ b/bld/namelist_files/geoschem_master_aer_wetdep_list.xml @@ -0,0 +1,89 @@ + + + + + dst_a1 + so4_a1 + nh4_a1 + pom_a1 + pomff1_a1 + pombb1_a1 + soa_a1 + bc_a1 + ncl_a1 + num_a1 + so4_a2 + nh4_a2 + soa_a2 + ncl_a2 + dst_a2 + num_a2 + dst_a3 + ncl_a3 + so4_a3 + pom_a3 + bc_a3 + num_a3 + ncl_a4 + so4_a4 + pom_a4 + pomff1_a4 + pombb1_a4 + bc_a4 + nh4_a4 + num_a4 + dst_a5 + so4_a5 + nh4_a5 + num_a5 + ncl_a6 + so4_a6 + nh4_a6 + num_a6 + dst_a7 + so4_a7 + nh4_a7 + num_a7 + soa1_a1 + soa1_a2 + soa2_a1 + soa2_a2 + soa3_a1 + soa3_a2 + soa4_a1 + soa4_a2 + soa5_a1 + soa5_a2 + soaff1_a1 + soaff2_a1 + soaff3_a1 + soaff4_a1 + soaff5_a1 + soabb1_a1 + soabb2_a1 + soabb3_a1 + soabb4_a1 + soabb5_a1 + soabg1_a1 + soabg2_a1 + soabg3_a1 + soabg4_a1 + soabg5_a1 + soaff1_a2 + soaff2_a2 + soaff3_a2 + soaff4_a2 + soaff5_a2 + soabb1_a2 + soabb2_a2 + soabb3_a2 + soabb4_a2 + soabb5_a2 + soabg1_a2 + soabg2_a2 + soabg3_a2 + soabg4_a2 + soabg5_a2 + + + diff --git a/bld/namelist_files/geoschem_master_gas_drydep_list.xml b/bld/namelist_files/geoschem_master_gas_drydep_list.xml new file mode 100644 index 0000000000..eebafa33a7 --- /dev/null +++ b/bld/namelist_files/geoschem_master_gas_drydep_list.xml @@ -0,0 +1,170 @@ + + + + + + + ACET + ACTA + ALD2 + AROMP4 + AROMP5 + ATOOH + BALD + BENZP + BR2 + BRCL + BRNO3 + BZCO3H + BZPAN + CH2O + CL2 + CLNO2 + CLNO3 + CLO + CLOO + CSL + EOH + ETHLN + ETHN + ETHP + ETNO3 + ETP + GLYC + GLYX + H2O2 + HAC + HBR + HC5A + HCL + HCOOH + HI + HMHP + HMML + HNO3 + HOBR + HOCL + HOI + HONIT + HPALD1 + HPALD2 + HPALD3 + HPALD4 + HPETHNL + I2 + I2O2 + I2O3 + I2O4 + IBR + ICHE + ICL + ICN + ICPDH + IDC + IDCHP + IDHDP + IDHPE + IDN + IEPOXA + IEPOXB + IEPOXD + IHN1 + IHN2 + IHN3 + IHN4 + INPB + INPD + IONO + IONO2 + IPRNO3 + ITCN + ITHN + LIMO + LVOC + LVOCOA + MACR + MACR1OOH + MAP + MCRDH + MCRENOL + MCRHN + MCRHNB + MCRHP + MCT + MENO3 + MGLY + MOH + MONITS + MONITU + MPAN + MTPA + MTPO + MVK + MVKDH + MVKHC + MVKHCB + MVKHP + MVKN + MVKPC + N2O5 + NH3 + NO2 + NPHEN + NPRNO3 + O3 + PAN + PHEN + PP + PPN + PROPNN + PRPN + PYAC + R4N2 + R4P + RA3P + RB3P + RIPA + RIPB + RIPC + RIPD + RP + SO2 + AERI + AONITA + ASOA1 + ASOA2 + ASOA3 + ASOAN + ASOG1 + ASOG2 + ASOG3 + BRSALA + BRSALC + INDIOL + IONITA + ISALA + ISALC + MONITA + MSA + NH4 + NIT + NITS + SALAAL + SALACL + SALCAL + SALCCL + SO4S + SOAGX + SOAIE + TSOA0 + TSOA1 + TSOA2 + TSOA3 + TSOG0 + TSOG1 + TSOG2 + TSOG3 + PFE + + + diff --git a/bld/namelist_files/geoschem_master_gas_wetdep_list.xml b/bld/namelist_files/geoschem_master_gas_wetdep_list.xml new file mode 100644 index 0000000000..419f518c32 --- /dev/null +++ b/bld/namelist_files/geoschem_master_gas_wetdep_list.xml @@ -0,0 +1,152 @@ + + + + + ACTA + ALD2 + AROMP4 + AROMP5 + ATOOH + BALD + BENZP + BR2 + BRCL + BZCO3H + BZPAN + CH2O + CSL + EOH + ETHLN + ETHN + ETHP + ETP + GLYC + GLYX + H2O2 + HAC + HBR + HC5A + HCL + HCOOH + HI + HMHP + HMML + HNO3 + HOBR + HOCL + HOI + HONIT + HPETHNL + I2 + I2O2 + I2O3 + I2O4 + IBR + ICHE + ICL + ICN + ICPDH + IDCHP + IDHDP + IDHPE + IDN + IEPOXA + IEPOXB + IEPOXD + IHN1 + IHN2 + IHN3 + IHN4 + INPB + INPD + IONO + IONO2 + ITCN + ITHN + LIMO + LVOC + LVOCOA + MACR1OOH + MAP + MCRDH + MCRENOL + MCRHN + MCRHNB + MCRHP + MCT + MEK + MGLY + MOH + MONITS + MONITU + MP + MPAN + MPN + MTPA + MTPO + MVK + MVKDH + MVKHC + MVKHCB + MVKHP + MVKN + MVKPC + NH3 + NPHEN + PAN + PHEN + PP + PPN + PROPNN + PRPE + PRPN + PYAC + R4N2 + R4P + RA3P + RB3P + RIPA + RIPB + RIPC + RIPD + RP + SO2 + AERI + AONITA + ASOA1 + ASOA2 + ASOA3 + ASOAN + ASOG1 + ASOG2 + ASOG3 + BRSALA + BRSALC + INDIOL + IONITA + ISALA + ISALC + MONITA + MSA + NH4 + NIT + NITS + SALAAL + SALACL + SALCAL + SALCCL + SO4S + SOAGX + SOAIE + TSOA0 + TSOA1 + TSOA2 + TSOA3 + TSOG0 + TSOG1 + TSOG2 + TSOG3 + PFE + + + diff --git a/bld/namelist_files/master_aer_drydep_list.xml b/bld/namelist_files/mozart_master_aer_drydep_list.xml similarity index 100% rename from bld/namelist_files/master_aer_drydep_list.xml rename to bld/namelist_files/mozart_master_aer_drydep_list.xml diff --git a/bld/namelist_files/master_aer_wetdep_list.xml b/bld/namelist_files/mozart_master_aer_wetdep_list.xml similarity index 100% rename from bld/namelist_files/master_aer_wetdep_list.xml rename to bld/namelist_files/mozart_master_aer_wetdep_list.xml diff --git a/bld/namelist_files/master_gas_drydep_list.xml b/bld/namelist_files/mozart_master_gas_drydep_list.xml similarity index 100% rename from bld/namelist_files/master_gas_drydep_list.xml rename to bld/namelist_files/mozart_master_gas_drydep_list.xml diff --git a/bld/namelist_files/master_gas_wetdep_list.xml b/bld/namelist_files/mozart_master_gas_wetdep_list.xml similarity index 100% rename from bld/namelist_files/master_gas_wetdep_list.xml rename to bld/namelist_files/mozart_master_gas_wetdep_list.xml diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index 11a3b20b03..f82bcaa4b5 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -43,26 +43,6 @@ - - - -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' - - - - -'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - 1,30,365,240,240,480,365,73,30 diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index 04bd57b1ba..b8ef551202 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -40,26 +40,6 @@ - - - -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' - - - - -'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - 1,30,365,240,240,480,365,73,30 diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 5d1ec8e1e4..86720663c7 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -37,26 +37,6 @@ 'noy', 'nhx' - - - -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' - - - - -'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - 1,30,365,240,240,480,365,73,30 diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml index 9e71a46303..345347ab89 100644 --- a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -92,28 +92,6 @@ 0.1 .false. - - - - - -'ACET','ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BRNO3','BZCO3H','BZPAN','CH2O','CL2','CLNO2','CLNO3','CLO','CLOO','CSL','EOH','ETHLN','ETHN','ETHP','ETNO3','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPALD1','HPALD2','HPALD3','HPALD4','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDC','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','IPRNO3','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MENO3','MGLY','MOH','MONITS','MONITU','MPAN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','N2O5','NH3','NO2','NPHEN','NPRNO3','O3','PAN','PHEN','PP','PPN','PROPNN','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' - - - - -'ACTA','ALD2','AROMP4','AROMP5','ATOOH','BALD','BENZP','BR2','BRCL','BZCO3H','BZPAN','CH2O','CSL','EOH','ETHLN','ETHN','ETHP','ETP','GLYC','GLYX','H2O2','HAC','HBR','HC5A','HCL','HCOOH','HI','HMHP','HMML','HNO3','HOBR','HOCL','HOI','HONIT','HPETHNL','I2','I2O2','I2O3','I2O4','IBR','ICHE','ICL','ICN','ICPDH','IDCHP','IDHDP','IDHPE','IDN','IEPOXA','IEPOXB','IEPOXD','IHN1','IHN2','IHN3','IHN4','INPB','INPD','IONO','IONO2','ITCN','ITHN','LIMO','LVOC','LVOCOA','MACR1OOH','MAP','MCRDH','MCRENOL','MCRHN','MCRHNB','MCRHP','MCT','MEK','MGLY','MOH','MONITS','MONITU','MP','MPAN','MPN','MTPA','MTPO','MVK','MVKDH','MVKHC','MVKHCB','MVKHP','MVKN','MVKPC','NH3','NPHEN','PAN','PHEN','PP','PPN','PROPNN','PRPE','PRPN','PYAC','R4N2','R4P','RA3P','RB3P','RIPA','RIPB','RIPC','RIPD','RP','SO2','AERI','AONITA','ASOA1','ASOA2','ASOA3','ASOAN','ASOG1','ASOG2','ASOG3','BRSALA','BRSALC','INDIOL','IONITA','ISALA','ISALC','MONITA','MSA','NH4','NIT','NITS','SALAAL','SALACL','SALCAL','SALCCL','SO4S','SOAGX','SOAIE','TSOA0','TSOA1','TSOA2','TSOA3','TSOG0','TSOG1','TSOG2','TSOG3','PFE' - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - -'dst_a1','so4_a1','nh4_a1','pom_a1','pomff1_a1','pombb1_a1','soa_a1','bc_a1','ncl_a1','num_a1','so4_a2','nh4_a2','soa_a2','ncl_a2','dst_a2','num_a2','dst_a3','ncl_a3','so4_a3','pom_a3','bc_a3','num_a3','ncl_a4','so4_a4','pom_a4','pomff1_a4','pombb1_a4','bc_a4','nh4_a4','num_a4','dst_a5','so4_a5','nh4_a5','num_a5','ncl_a6','so4_a6','nh4_a6','num_a6','dst_a7','so4_a7','nh4_a7','num_a7','soa1_a1','soa1_a2','soa2_a1','soa2_a2','soa3_a1','soa3_a2','soa4_a1','soa4_a2','soa5_a1','soa5_a2','soaff1_a1','soaff2_a1','soaff3_a1','soaff4_a1','soaff5_a1','soabb1_a1','soabb2_a1','soabb3_a1','soabb4_a1','soabb5_a1','soabg1_a1','soabg2_a1','soabg3_a1','soabg4_a1','soabg5_a1','soaff1_a2','soaff2_a2','soaff3_a2','soaff4_a2','soaff5_a2','soabb1_a2','soabb2_a2','soabb3_a2','soabb4_a2','soabb5_a2','soabg1_a2','soabg2_a2','soabg3_a2','soabg4_a2','soabg5_a2' - - - 1,30,365,240,240,480,365,73,30 diff --git a/bld/perl5lib/Build/ChemNamelist.pm b/bld/perl5lib/Build/ChemNamelist.pm index 88d573afe1..7d4f5a6103 100644 --- a/bld/perl5lib/Build/ChemNamelist.pm +++ b/bld/perl5lib/Build/ChemNamelist.pm @@ -44,7 +44,7 @@ sub chem_has_species #------------------------------------------------------------------------------- sub set_dep_lists { - my ( $cfgdir, $chem_proc_src, $chem_src_dir, $nl, $print_lvl ) = @_; + my ( $chem, $cfgdir, $chem_proc_src, $chem_src_dir, $nl, $print_lvl ) = @_; my ( $gas_wetdep_list, $aer_wetdep_list, $aer_drydep_list, $aer_sol_facti, $aer_sol_factb, $aer_scav_coef, $gas_drydep_list ) ; @@ -71,37 +71,17 @@ sub set_dep_lists if ($print_lvl>=2) {print "Chemistry species : @species_list \n" ;} if ($print_lvl>=2) {print "Not transported species : @nottransported_list \n" ;} - if (!defined $nl->get_value('gas_wetdep_list')) { - $gas_wetdep_list = get_gas_wetdep_list( $cfgdir, $print_lvl, \@species_list, \@nottransported_list ); - } else { - $gas_wetdep_list = $nl->get_value('gas_wetdep_list'); - $gas_wetdep_list = filter_dep_list( $gas_wetdep_list, $print_lvl, \@species_list, \@nottransported_list ); - if ($print_lvl>=2) {print " gas wet dep list : $gas_wetdep_list \n" ;} - } + $gas_wetdep_list = get_gas_wetdep_list( $chem, $cfgdir, $print_lvl, \@species_list, \@nottransported_list ); + if ($print_lvl>=2) {print " gas wet dep list : $gas_wetdep_list \n" ;} - if (!defined $nl->get_value('aer_wetdep_list')) { - $aer_wetdep_list = get_aer_wetdep_list( $cfgdir, $print_lvl, \@species_list, \@nottransported_list ); - } else { - $aer_wetdep_list = $nl->get_value('aer_wetdep_list'); - $aer_wetdep_list = filter_dep_list( $aer_wetdep_list, $print_lvl, \@species_list, \@nottransported_list ); - if ($print_lvl>=2) {print " aer wet dep list : $aer_wetdep_list \n" ;} - } + $aer_wetdep_list = get_aer_wetdep_list( $chem, $cfgdir, $print_lvl, \@species_list, \@nottransported_list ); + if ($print_lvl>=2) {print " aer wet dep list : $aer_wetdep_list \n" ;} - if (!defined $nl->get_value('drydep_list')) { - $gas_drydep_list = get_gas_drydep_list( $cfgdir, $print_lvl, \@species_list, \@nottransported_list ); - } else { - $gas_drydep_list = $nl->get_value('drydep_list'); - $gas_drydep_list = filter_dep_list( $gas_drydep_list, $print_lvl, \@species_list, \@nottransported_list ); - if ($print_lvl>=2) {print " dry dep list : $gas_drydep_list \n" ;} - } + $gas_drydep_list = get_gas_drydep_list( $chem, $cfgdir, $print_lvl, \@species_list, \@nottransported_list ); + if ($print_lvl>=2) {print " dry dep list : $gas_drydep_list \n" ;} - if (!defined $nl->get_value('aer_drydep_list')) { - $aer_drydep_list = get_aer_drydep_list( $cfgdir, $print_lvl, \@species_list, \@nottransported_list ); - } else { - $aer_drydep_list = $nl->get_value('aer_drydep_list'); - $aer_drydep_list = filter_dep_list( $aer_drydep_list, $print_lvl, \@species_list, \@nottransported_list ); - if ($print_lvl>=2) {print " aer dry dep list : $aer_drydep_list \n" ;} - } + $aer_drydep_list = get_aer_drydep_list( $chem, $cfgdir, $print_lvl, \@species_list, \@nottransported_list ); + if ($print_lvl>=2) {print " aer dry dep list : $aer_drydep_list \n" ;} # set solubility factors for aerosols if (length($aer_wetdep_list)>2){ @@ -229,9 +209,14 @@ sub print_modal_info #------------------------------------------------------------------------------- sub get_gas_drydep_list { - my ($cfg_dir,$print_lvl,$species_list,$nottransported_list) = @_; + my ($chem,$cfg_dir,$print_lvl,$species_list,$nottransported_list) = @_; - my $master_file = "$cfg_dir/namelist_files/master_gas_drydep_list.xml"; + my $master_file = ''; + if ($chem =~ /geoschem/) { + $master_file = "$cfg_dir/namelist_files/geoschem_master_gas_drydep_list.xml"; + } else { + $master_file = "$cfg_dir/namelist_files/mozart_master_gas_drydep_list.xml"; + } my $list = get_dep_list($master_file,$print_lvl,$species_list,$nottransported_list); @@ -244,9 +229,14 @@ sub get_gas_drydep_list #------------------------------------------------------------------------------- sub get_aer_drydep_list { - my ($cfg_dir,$print_lvl,$species_list,$nottransported_list) = @_; + my ($chem,$cfg_dir,$print_lvl,$species_list,$nottransported_list) = @_; - my $master_file = "$cfg_dir/namelist_files/master_aer_drydep_list.xml"; + my $master_file = ''; + if ($chem =~ /geoschem/) { + $master_file = "$cfg_dir/namelist_files/geoschem_master_aer_drydep_list.xml"; + } else { + $master_file = "$cfg_dir/namelist_files/mozart_master_aer_drydep_list.xml"; + } my $list = get_dep_list($master_file,$print_lvl,$species_list,$nottransported_list); @@ -257,10 +247,15 @@ sub get_aer_drydep_list #------------------------------------------------------------------------------- sub get_aer_wetdep_list { - my ($cfg_dir,$print_lvl,$species_list,$nottransported_list) = @_; - - my $master_file = "$cfg_dir/namelist_files/master_aer_wetdep_list.xml"; + my ($chem,$cfg_dir,$print_lvl,$species_list,$nottransported_list) = @_; + my $master_file = ''; + if ($chem =~ /geoschem/) { + $master_file = "$cfg_dir/namelist_files/geoschem_master_aer_wetdep_list.xml"; + } else { + $master_file = "$cfg_dir/namelist_files/mozart_master_aer_wetdep_list.xml"; + } + my $list = get_dep_list($master_file,$print_lvl,$species_list,$nottransported_list); if ($print_lvl>=2) {print " aer wet dep list : $list \n" ;} @@ -270,9 +265,14 @@ sub get_aer_wetdep_list #------------------------------------------------------------------------------- sub get_gas_wetdep_list { - my ($cfg_dir,$print_lvl,$species_list,$nottransported_list) = @_; + my ($chem,$cfg_dir,$print_lvl,$species_list,$nottransported_list) = @_; - my $master_file = "$cfg_dir/namelist_files/master_gas_wetdep_list.xml"; + my $master_file = ''; + if ($chem =~ /geoschem/) { + $master_file = "$cfg_dir/namelist_files/geoschem_master_gas_wetdep_list.xml"; + } else { + $master_file = "$cfg_dir/namelist_files/mozart_master_gas_wetdep_list.xml"; + } my $list = get_dep_list($master_file,$print_lvl,$species_list,$nottransported_list); @@ -310,40 +310,6 @@ sub get_dep_list return ($list); } - -#------------------------------------------------------------------------------- -#------------------------------------------------------------------------------- -sub filter_dep_list -{ - my ( $input_list, $print_lvl, $species_list_ref, $nottransported_list_ref ) = @_; - - if ($print_lvl>=2){ print "Filtering deposition species list \n"; } - - my @species_list = @{$species_list_ref}; - my @nottransported_list = @{$nottransported_list_ref}; - - my @master_list = split( ('\s+|\s*,+\s*'), $input_list); - - my $list = ''; - my $first = 1; my $pre = ""; - foreach my $name (sort @species_list) { - foreach my $item (@master_list) { - $item =~ s/['"]//g; #"' - if (!($item ~~ @nottransported_list)) { - if ($name eq $item) { - $list .= $pre . quote_string($name) ; - if ($first) { $pre = ","; $first = 0; } - } - } - } - } - - if ( length($list)<1 ) {$list = quote_string(' ') ;} - - return ($list); - -} - #------------------------------------------------------------------------------- sub read_master_list_file { From dcc7e204afa92c52ce94be22dcf2d4d3147b6794 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 16 Nov 2023 15:19:22 -0700 Subject: [PATCH 146/160] Revert dep_data_file input_pathname to "abs"; use new file for geoschem Previously the dep_data_file default for GEOS-Chem was not actually being used due to inclusion in the use case files. This let a bug go under the radar that dep_data_file input_pathname="abs" was removed from the namelist definitions, meaning the configured inputdata path would not be used as a prefix to whatever dep_data_file was set as. This allowed GEOS-Chem compsets to work since the full path was in the use case files, but it resulted in non-GEOS-Chem compsets failing due to an incomplete path for the deposition netcdf file containing Henry's Law coeffs et al. This update restores using inputdata path as a prefix to dep_data_file, and so fixes the non-GEOS-Chem compsets. It also removes the setting of dep_data_file in the GEOS-Chem compsets and updates the filename in the namelist defaults for dep_data_file if using GEOS-Chem. GEOS-Chem compsets will not work until someone at NCAR moves the file to the target inputdata directory. The request to do this has been made. Signed-off-by: Lizzie Lundgren --- bld/namelist_files/namelist_defaults_cam.xml | 2 +- bld/namelist_files/namelist_definition.xml | 4 ++-- bld/namelist_files/use_cases/2000_geoschem.xml | 2 -- bld/namelist_files/use_cases/2010_geoschem.xml | 2 -- bld/namelist_files/use_cases/hist_geoschem.xml | 2 -- bld/namelist_files/use_cases/hist_geoschem_nudged.xml | 2 -- 6 files changed, 3 insertions(+), 11 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 6bc286eec6..9d9190b103 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1932,7 +1932,7 @@ atm/cam/chem/trop_mozart/dvel/dep_data_c20221208.nc -atm/cam/chem/geoschem/dvel/dep_data_file_geoschem_2022Sep21.nc +atm/cam/chem/geoschem/dvel/dep_data_file_geoschem_c230417.nc atm/waccm/phot/effxstex.txt diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 613ee17492..a6c4a3eab1 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -7307,9 +7307,9 @@ List of species that undergo dry deposition. Default: set by build-namelist. - -Pathname of file containing gas phase deposition data including effective +Full pathname of file containing gas phase deposition data including effective Henry's law coefficients. Default: set by build-namelist. diff --git a/bld/namelist_files/use_cases/2000_geoschem.xml b/bld/namelist_files/use_cases/2000_geoschem.xml index f82bcaa4b5..f85e1dd4ef 100644 --- a/bld/namelist_files/use_cases/2000_geoschem.xml +++ b/bld/namelist_files/use_cases/2000_geoschem.xml @@ -12,8 +12,6 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc - HEMCO_Config.rc HEMCO_Diagn.rc diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index b8ef551202..72685aa4d2 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -10,8 +10,6 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc - HEMCO_Config.rc HEMCO_Diagn.rc diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 86720663c7..ea28eca22c 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -12,8 +12,6 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc - HEMCO_Config.rc HEMCO_Diagn.rc diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml index 345347ab89..8a32ee167b 100644 --- a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -12,8 +12,6 @@ /glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/p/univ/umit0034/Shared/dep_data_file_geoschem_c230417.nc - HEMCO_Config.rc HEMCO_Diagn.rc From 3558a95178d9a2a2abea6bf88d2e1309f836f326 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 18 Jan 2024 16:21:36 -0500 Subject: [PATCH 147/160] Update bld/configure Remove redundant/over limiting CCP definitions for GEOS-Chem Co-authored-by: Brian Eaton --- bld/configure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bld/configure b/bld/configure index 2e310c9969..5e9fb96d6a 100755 --- a/bld/configure +++ b/bld/configure @@ -1410,11 +1410,11 @@ if ($chem_pkg =~ '_mam3') { # Set GEOS-Chem CPP definitions here if ($chem_pkg =~ 'geoschem') { - $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING -DLINUX_IFORT -DUSE_REAL8 -DMODEL_ -DMODEL_CESM'; - $chem_nadv = 267; # includes GC advected species (233), CO2 (1), and MAM aerosols (33) + $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING'; + if ($chem_pkg eq 'geoschem_mam4') { + $chem_nadv = 267; # includes GC advected species (233), CO2 (1), and MAM aerosols (33) + } } - - # CARMA sectional microphysics # # New CARMA models need to define the number of advected constituents. From 14b6813e931f7a4622c5175ca007d9c371ea76d7 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 18 Jan 2024 14:37:19 -0700 Subject: [PATCH 148/160] Clean up GEOS-Chem code in configure based on suggestions from Brian Easton Signed-off-by: Lizzie Lundgren --- bld/configure | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bld/configure b/bld/configure index 5e9fb96d6a..c44ea94669 100755 --- a/bld/configure +++ b/bld/configure @@ -592,10 +592,9 @@ if (defined $opts{'chem'}) { # If the user has specified a simple physics package... if ($simple_phys) { - # the only valid chemistry options are 'none', 'terminator' and 'geoschem' - if (($chem_pkg ne 'none') and ($chem_pkg ne 'terminator') and !($chem_pkg =~ 'geoschem')) { + if (($chem_pkg ne 'none') and ($chem_pkg ne 'terminator')) { die "configure ERROR: -phys=$phys_pkg -chem=$chem_pkg\n". - " -chem can only be set to 'none', 'terminator' or 'geoschem'.\n"; + " -chem can only be set to 'none' or 'terminator'.\n"; } } elsif ($phys_pkg =~ m/^cam3$|^cam4$|^spcam_sam1mom$/) { @@ -1408,9 +1407,8 @@ if ($chem_pkg =~ '_mam3') { $chem_cppdefs = ' -DMODAL_AERO -DMODAL_AERO_7MODE '; } -# Set GEOS-Chem CPP definitions here +# Customize GEOS-Chem advected species if ($chem_pkg =~ 'geoschem') { - $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING'; if ($chem_pkg eq 'geoschem_mam4') { $chem_nadv = 267; # includes GC advected species (233), CO2 (1), and MAM aerosols (33) } @@ -1684,7 +1682,7 @@ elsif ($fc =~ /nvfor/) { $fc_type = 'nvhpc'; } # User override for Fortran compiler type if (defined $opts{'fc_type'}) { $fc_type = $opts{'fc_type'}; } -if ($fc_type == "oneapi") {$fc_type = 'intel'; } +if ($fc_type eq "oneapi") {$fc_type = 'intel'; } if ($fc_type) { $cfg_ref->set('fc_type', $fc_type); if ($print>=2) { print "Fortran compiler type: $fc_type$eol"; } @@ -1950,6 +1948,13 @@ if ($unicon) { $cfg_cppdefs .= ' -DUSE_UNICON'; } # HEMCO_CESM - indicates CESM model environment. Deprecated, will be removed soon. $cfg_cppdefs .= ' -DMODEL_ -DMODEL_CESM -DHEMCO_CESM -DUSE_REAL8 '; +# Compiler CPP definitions for GEOS-Chem +if ($chem_pkg =~ 'geoschem') { + $chem_cppdefs .= ' -DEXTERNAL_GRID -DEXTERNAL_FORCING'; + if ($fc_type eq 'intel') { $cfg_cppdefs .= ' -DLINUX_IFORT'; } + elsif ($fc_type eq 'gnu') { $cfg_cppdefs .= ' -DLINUX_GFORTRAN'; } +} + #----------------------------------------------------------------------------------------------- # CPP defines to put on Makefile From 6319c77344c79f6ec393dbc4dfc8bb27612624f5 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 23 Jan 2024 09:40:11 -0700 Subject: [PATCH 149/160] Remove unnecessary changes made for GEOS-Chem; minor bug fix for GNU Signed-off-by: Lizzie Lundgren --- bld/build-namelist | 4 ---- bld/namelist_files/namelist_definition.xml | 2 +- cime_config/config_component.xml | 2 -- src/chemistry/geoschem/chemistry.F90 | 6 +++--- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 48fdd72a73..1440069dd2 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -583,10 +583,6 @@ if ( ($chem ne 'none') or ( $prog_species ) ){ add_default($nl, 'gas_wetdep_list', 'val'=>$gas_wetdep_list ); } - if ($chem =~ /geoschem/) { - $prescribe_aerosols = $FALSE; - } - if (length($aer_wetdep_list)>2){ # determine if prescribed aerosols are not needed ... if ($aer_wetdep_list =~ /so4/i && diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index ebf84d5788..d7fab81ada 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -6028,7 +6028,7 @@ radiatively passive. Default: FALSE - Wet deposition method used MOZ --> mozart scheme is used diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 9f8e3a5698..21d3ec6d4b 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -50,7 +50,6 @@ CAM super-parameterized CAM one moment SAM microphysics CAM super-parameterized CAM one moment SAM microphysics using CLUBB CAM super-parameterized CAM double moment m2005 SAM microphysics - CAM super-parameterized CAM double moment m2005 SAM microphysics using GEOS-Chem CAM super-parameterized CAM double moment m2005 SAM microphysics using CLUBB CAM tropospheric chemistry with bulk aerosols: @@ -83,7 +82,6 @@ CAM moist Held-Suarez forcing (Thatcher and Jablonowski, 2016): CAM moist simple model (Frierson, 2006): CAM dry Held-Suarez forcing (Held and Suarez (1994)): - CAM with GEOS-Chem dycore test: CAM moist dynamical core test with Ullrich et al. (2014) baroclinic wave IC, Kessler physics and terminator chemistry: -/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ +atm/cam/geoschem/ExtData/CHEM_INPUTS/ -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +atm/cam/geoschem/initial_conditions/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +atm/cam/geoschem/initial_conditions/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc HEMCO_Config.rc HEMCO_Diagn.rc diff --git a/bld/namelist_files/use_cases/2010_geoschem.xml b/bld/namelist_files/use_cases/2010_geoschem.xml index 72685aa4d2..2d3ee5db95 100644 --- a/bld/namelist_files/use_cases/2010_geoschem.xml +++ b/bld/namelist_files/use_cases/2010_geoschem.xml @@ -4,11 +4,11 @@ -/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ +atm/cam/geoschem/ExtData/CHEM_INPUTS/ -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +atm/cam/geoschem/initial_conditions/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +atm/cam/geoschem/initial_conditions/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc HEMCO_Config.rc HEMCO_Diagn.rc diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index ea28eca22c..78b681e572 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -6,11 +6,11 @@ -/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ +atm/cam/geoschem/ExtData/CHEM_INPUTS/ -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +atm/cam/geoschem/initial_conditions/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +atm/cam/geoschem/initial_conditions/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc HEMCO_Config.rc HEMCO_Diagn.rc diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml index 8a32ee167b..0550880d80 100644 --- a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -6,11 +6,11 @@ -/glade/p/univ/umit0034/ExtData/CHEM_INPUTS/ +atm/cam/geoschem/ExtData/CHEM_INPUTS/ -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +atm/cam/geoschem/initial_conditions/f.e20.FC2010.f09_f09.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc -/glade/p/univ/umit0034/Shared/GEOS-Chem/f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc +atm/cam/geoschem/initial_conditions//f.e20.FC2010.f19_f19.144.GC_vbsext.001.cam.i.0007-01-01-00000.nc HEMCO_Config.rc HEMCO_Diagn.rc From c18380c179a758804ecf437e7f4c91f1bd9fcf6b Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 30 Jan 2024 15:27:01 -0700 Subject: [PATCH 152/160] Updated GEOs-Chem tests from cheyenne to derecho Signed-off-by: Lizzie Lundgren --- cime_config/testdefs/testlist_cam.xml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 2a508ee4d0..2842400c22 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -19,7 +19,7 @@ - + @@ -44,7 +44,7 @@ - + @@ -1725,15 +1725,16 @@ - + - + - + + - + @@ -1946,7 +1947,7 @@ - + From 5d05e8c5320c752006a4fb0248ce6206cd2c730e Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 30 Jan 2024 15:34:18 -0700 Subject: [PATCH 153/160] Add categories prealpha and aux_cam to all GEOS-Chem compset tests Signed-off-by: Lizzie Lundgren --- cime_config/testdefs/testlist_cam.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 2842400c22..5cd268c466 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -20,6 +20,8 @@ + + @@ -45,6 +47,8 @@ + + @@ -1728,6 +1732,8 @@ + + @@ -1948,6 +1954,8 @@ + + From 5fa370c9c6bfc17dcaffbf3bd6625f400af23dc4 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 31 Jan 2024 08:17:40 -0700 Subject: [PATCH 154/160] Delete redundant setting of deposition lists in namelists Signed-off-by: Lizzie Lundgren --- bld/build-namelist | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 1440069dd2..ff3375bd1b 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -613,10 +613,6 @@ if ( ($chem ne 'none') or ( $prog_species ) ){ if (length($aer_drydep_list)>2){ add_default($nl, 'aer_drydep_list', 'val'=>$aer_drydep_list ); } - $nl->set_variable_value('aerosol_nl', 'aer_drydep_list', $aer_drydep_list); - $nl->set_variable_value('aerosol_nl', 'aer_wetdep_list', $aer_wetdep_list); - $nl->set_variable_value('drydep_inparm', 'drydep_list', $gas_drydep_list); - $nl->set_variable_value('wetdep_inparm', 'gas_wetdep_list', $gas_wetdep_list); } if ($chem) { # drydep_srf_file is only needed for prognostic MAM when the grid is unstructured. From 28412bfe7f7eff39c5e870a3e26012dabb333c45 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 31 Jan 2024 08:22:23 -0700 Subject: [PATCH 155/160] Reduce GEOS-Chem tests to one aux_cam and one prealpha across two compsets Signed-off-by: Lizzie Lundgren --- cime_config/testdefs/testlist_cam.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 5cd268c466..2ec7898bd9 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -20,8 +20,6 @@ - - @@ -47,8 +45,6 @@ - - @@ -1733,7 +1729,6 @@ - @@ -1954,7 +1949,6 @@ - From 40371e470698906677ec4d3835248ba1dbdc06de Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Wed, 31 Jan 2024 14:51:06 -0700 Subject: [PATCH 156/160] Change FCnudged_GC derecho test to not use zonal mean nudging I previously changed the test to zonal mean nudging when updating from cheyenne to derecho. Apparently the compset is not set up to do this and I therefore reverted to the previous test which is basic nuging. Signed-off-by: Lizzie Lundgren --- cime_config/testdefs/testlist_cam.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index ccb48d54d9..070c80eb2e 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -1705,14 +1705,13 @@ - + - - + From ffec5d1e2301aa8a93197970e5baf53c186d3599 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Thu, 1 Feb 2024 08:35:11 -0700 Subject: [PATCH 157/160] skip over geoschem in r8 kind checker --- test/system/TR8.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/system/TR8.sh b/test/system/TR8.sh index e107c702d3..f56c9bc636 100755 --- a/test/system/TR8.sh +++ b/test/system/TR8.sh @@ -54,12 +54,12 @@ fi #Check Chemistry if [ -d "${CAM_ROOT}/components/cam" ]; then -ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/chemistry +ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/components/cam/src/chemistry -s geoschem rc=`expr $? + $rc` else -ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/chemistry +ruby $ADDREALKIND_EXE -r r8 -l 1 -d $CAM_ROOT/src/chemistry -s geoschem rc=`expr $? + $rc` fi From a5e78df39702959a7dd69d504927bdd69f98934d Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Thu, 1 Feb 2024 09:37:12 -0700 Subject: [PATCH 158/160] Update Changelog Signed-off-by: Lizzie Lundgren --- doc/ChangeLog | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index a219f92580..a81de9b635 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,169 @@ =============================================================== +Tag name: cam6_3_147 +Originator(s): lizziel, jimmielin, fritzt +Date: +One-line Summary: Add GEOS-Chem chemistry as new chemistry option in CAM +Github PR URL: https://github.com/ESCOMP/CAM/pull/484 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - Include GEOS-Chem 14.1.2 chemistry as alternative to CAM-chem + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: fvitt, brian-eaton, cacraigucar, gold2718, jedwards4b + +List all files that are renamed and why: +R100 bld/namelist_files/master_aer_drydep_list.xml +R100 bld/namelist_files/master_aer_wetdep_list.xml +R100 bld/namelist_files/master_gas_drydep_list.xml +R100 bld/namelist_files/master_gas_wetdep_list.xml + - Renamed with prefix mozart_ to distinguish from GEOS-Chem lists + +R099 src/chemistry/aerosol/drydep_mod.F90 + - Renamed to aer_drydep_mod.F90 to avoid module conflict name in GEOS-Chem + - Changed module name in file from drydep_mod to aer_drydep_mod + +List all files added and what they do: +A bld/namelist_files/geoschem_master_aer_drydep_list.xml +A bld/namelist_files/geoschem_master_aer_wetdep_list.xml +A bld/namelist_files/geoschem_master_gas_drydep_list.xml +A bld/namelist_files/geoschem_master_gas_wetdep_list.xml + - New deposition lists for use in GEOS-Chem only + +A bld/namelist_files/use_cases/2000_geoschem.xml +A bld/namelist_files/use_cases/2010_geoschem.xml +A bld/namelist_files/use_cases/hist_geoschem.xml +A bld/namelist_files/use_cases/hist_geoschem_nudged.xml + - Use case files for four GEOS-Chem chemistry compsets + +A cime_config/cam.case_setup.py + - Script called during CESM case setup for CAM-specific commands + - Copies GEOS-Chem config files from source to case directory if using GEOS-Chem + +A src/chemistry/geoschem/.exclude + - List of GEOS-Chem source files to skip during build + +A src/chemistry/geoschem/chem_mods.F90 + - GEOS-Chem version of chem_mods.F90 equivalent to Mozart pre-processed files + +A src/chemistry/geoschem/chemistry.F90 + - GEOS-Chem implementation of chemistry module used in CAM + +A src/chemistry/geoschem/geoschem_diagnostics_mod.F90 + - GEOS-Chem diagnostics module + +A src/chemistry/geoschem/geoschem_emissions_mod.F90 + - GEOS-Chem emissions module + +A src/chemistry/geoschem/geoschem_history_mod.F90 + - Interface file to connect GEOS-Chem state arrays to CAM history + +A src/chemistry/geoschem/m_spc_id.F90 + - GEOS-Chem version of m_spc_id.F90 equivalent to Mozart pre-processed files + +A src/chemistry/geoschem/mo_sim_dat.F90 + - GEOS-Chem version of m_spc_id.F90 equivalent to Mozart pre-processed files + +List all existing files that have been modified, and describe the changes: +M .gitignore + - Added GEOS-Chem directory which is its own git repository + +M Externals_CAM.cfg + - Added GEOS-Chem repository, tag 14.1.2 + +M bld/build-namelist + - Updates for GEOS-Chem namelists + +M bld/config_files/definition.xml + - Added geoschem_mam4 to list of chemistry packages + +M bld/configure + - Updates to build GEOS-Chem + +M bld/namelist_files/namelist_defaults_cam.xml + - Set GEOS-Chem default wave params and path to Henry's coeff file for deposition + +M bld/namelist_files/namelist_definition.xml + - Added GEOS-Chem input data path as new entry + - Added geoschem_mam4 to chem package list + +M bld/perl5lib/Build/ChemNamelist.pm + - Added log prints of all deposition species lists + - Updates to use different deposition lists based on chemistry selection + +M cime_config/buildnml + - Copy GEOS-Chem config files from case to run directory if using GEOS-Chem + +M cime_config/config_component.xml + - Added GEOS-Chem as chemistry option + - Set GEOS-Chem compset aliases + +M cime_config/config_compsets.xml + - Defined four GEOS-Chem compsets + +M cime_config/testdefs/testlist_cam.xml + - Added tests for all four GEOS-Chem compsets as category geoschem + - Included FCHIST_GC in aux_cam tests and FCnudged_GC in prealpha tests + +M doc/ChangeLog +M src/chemistry/bulk_aero/aero_model.F90 + - Renamed drydep_mod to aer_drydep_mod in use statements + +M src/chemistry/modal_aero/aero_model.F90 + - Renamed drydep_mod to aer_drydep_mod in use statements + +M src/chemistry/modal_aero/modal_aero_data.F90 + - Distinguish between SOAG and SOAGX since SOAGX a species in GEOS-Chem + +M src/chemistry/modal_aero/modal_aero_gasaerexch.F90 + - Skip MSA tendency if using GEOS-Chem + +M src/chemistry/modal_aero/sox_cldaero_mod.F90 + - Exit prior to in-cloud sulfur oxidation if using GEOS-Chem to avoid double-counting + +M src/chemistry/mozart/chemistry.F90 + - Add call to new subroutine short_lived_species_final + +M src/chemistry/mozart/mo_chem_utls.F90 + - Add optional argument in get_spc_ndx to ignore case in string compariosn + +M src/chemistry/mozart/mo_neu_wetdep.F90 + - Skip aerosol mapping if using GEOS-Chem; assume all species in dep_data_file + +M src/chemistry/mozart/short_lived_species.F90 + - Added array slvd_ref_mmr to store short-lived species reference values + - Initialized short-lived species not found to ref values if available + - Initialized GEOS-Chem short-lived species from slvd_lst not solsym + - Added set/get subroutines for GEOS-Chem short-lived species + - Added new subroutine short_lived_species_final to deallocate new array + +M src/cpl/nuopc/atm_import_export.F90 + - Added So_ustar to atm imports for use in GEOS-Chem dry dep over ocean + +M src/physics/cam/constituents.F90 + - Improved existing error handling messages for clarity + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +derecho/intel/aux_cam: + +izumi/nag/aux_cam: + +izumi/gnu/aux_cam: + +=============================================================== +=============================================================== + Tag name: cam6_3_146 Originator(s): cacraig Date: Jan 23, 2024 From 4442c2a2a783ba65be5bd519c67339530a2c9f4f Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Thu, 1 Feb 2024 09:57:13 -0700 Subject: [PATCH 159/160] include commit and time limit to goes-chem tests --- cime_config/testdefs/testlist_cam.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 070c80eb2e..4b6647697d 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -1712,9 +1712,9 @@ + - @@ -1922,7 +1922,7 @@ - + @@ -1930,6 +1930,10 @@ + + + + From 86720ccfd55278efd108ae06c58dc635c63823d1 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Fri, 2 Feb 2024 09:08:26 -0700 Subject: [PATCH 160/160] update ChangLog --- doc/ChangeLog | 120 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index a81de9b635..9d40f7ba63 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,12 +2,13 @@ Tag name: cam6_3_147 Originator(s): lizziel, jimmielin, fritzt -Date: +Date: 2 Feb 2024 One-line Summary: Add GEOS-Chem chemistry as new chemistry option in CAM Github PR URL: https://github.com/ESCOMP/CAM/pull/484 Purpose of changes (include the issue number and title text for each relevant GitHub issue): - Include GEOS-Chem 14.1.2 chemistry as alternative to CAM-chem + (issue #424 -- Implementing GEOS-Chem chemistry in CESM (CESM-GC)) Describe any changes made to build system: N/A @@ -156,10 +157,127 @@ then copy the lines from the td.*.status files for the failed tests to the appropriate machine below. All failed tests must be justified. derecho/intel/aux_cam: + PEND ERP_Ln9_Vnuopc.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 + FAIL ERP_Ln9_Vnuopc.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s + - pre-existing failures + + FAIL SMS_Ld1_Vnuopc.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d + - expected failure due to goeschem config file copy issue + + DIFF ERC_D_Ln9_P144x1_Vnuopc.ne16pg3_ne16pg3_mg17.QPC6HIST.derecho_intel.cam-outfrq3s_ttrac_usecase + DIFF ERC_D_Ln9_Vnuopc.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp + DIFF ERC_D_Ln9_Vnuopc.f19_f19_mg17.QPMOZ.derecho_intel.cam-outfrq3s + DIFF ERC_D_Ln9_Vnuopc.f19_f19_mg17.QPX2000.derecho_intel.cam-outfrq3s + DIFF ERC_D_Ln9_Vnuopc.ne16_ne16_mg17.QPC5HIST.derecho_intel.cam-outfrq3s_usecase + DIFF ERI_D_Ln18_Vnuopc.f45_f45_mg37.QPC41850.derecho_intel.cam-co2rmp_usecase + DIFF ERP_D_Ln9.ne30pg3_ne30pg3_mg17.FLTHIST.derecho_intel.cam-outfrq9s + DIFF ERP_D_Ln9_Vnuopc.f09_f09_mg17.QSC6.derecho_intel.cam-outfrq9s + DIFF ERP_D_Ln9_Vnuopc.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq9s + DIFF ERP_D_Ln9_Vnuopc.ne30pg3_ne30pg3_mg17.F2000dev.derecho_intel.cam-outfrq9s + DIFF ERP_Ld3_Vnuopc.f09_f09_mg17.FWHIST.derecho_intel.cam-reduced_hist1d + DIFF ERP_Lh12_Vnuopc.f19_f19_mg17.FW4madSD.derecho_intel.cam-outfrq3h + DIFF ERP_Ln9_P24x3_Vnuopc.f45_f45_mg37.QPWmaC6.derecho_intel.cam-outfrq9s_mee_fluxes + DIFF ERP_Ln9_Vnuopc.f09_f09_mg17.F1850.derecho_intel.cam-outfrq9s + DIFF ERP_Ln9_Vnuopc.f09_f09_mg17.F2000climo.derecho_intel.cam-outfrq9s + DIFF ERP_Ln9_Vnuopc.f09_f09_mg17.F2000dev.derecho_intel.cam-outfrq9s_mg3 + DIFF ERP_Ln9_Vnuopc.f09_f09_mg17.F2010climo.derecho_intel.cam-outfrq9s + DIFF ERP_Ln9_Vnuopc.f09_f09_mg17.FHIST_BDRD.derecho_intel.cam-outfrq9s + DIFF ERP_Ln9_Vnuopc.f19_f19_mg17.FWsc1850.derecho_intel.cam-outfrq9s + DIFF ERP_Ln9_Vnuopc.ne30_ne30_mg17.FCnudged.derecho_intel.cam-outfrq9s + DIFF ERP_Ln9_Vnuopc.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s + DIFF ERS_Ld3_Vnuopc.f10_f10_mg37.F1850.derecho_intel.cam-outfrq1d_14dec_ghg_cam_dev + DIFF ERS_Ln9_P288x1_Vnuopc.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 + DIFF ERS_Ln9_P36x1_Vnuopc.mpasa480_mpasa480.F2000climo.derecho_intel.cam-outfrq9s_mpasa480 + DIFF ERS_Ln9_Vnuopc.f09_f09_mg17.FX2000.derecho_intel.cam-outfrq9s + DIFF ERS_Ln9_Vnuopc.f19_f19_mg17.FSPCAMS.derecho_intel.cam-outfrq9s + DIFF ERS_Ln9_Vnuopc.f19_f19_mg17.FXSD.derecho_intel.cam-outfrq9s + DIFF SCT_D_Ln7_Vnuopc.T42_T42_mg17.QPC5.derecho_intel.cam-scm_prep + DIFF SMS_D_Ld2_Vnuopc.f19_f19_mg17.QPC5HIST.derecho_intel.cam-volc_usecase + DIFF SMS_D_Ln9.ne30pg3_ne30pg3_mg17.FMTHIST.derecho_intel.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday + DIFF SMS_D_Ln9_Vnuopc.f09_f09_mg17.FCvbsxHIST.derecho_intel.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc.f09_f09_mg17.FSD.derecho_intel.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 + DIFF SMS_D_Ln9_Vnuopc.f19_f19_mg17.FXHIST.derecho_intel.cam-outfrq9s_amie + DIFF SMS_D_Ln9_Vnuopc.f19_f19_mg17.QPC2000climo.derecho_intel.cam-outfrq3s_usecase + DIFF SMS_D_Ln9_Vnuopc.f19_f19_mg17.QPC5M7.derecho_intel.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc.ne16_ne16_mg17.FX2000.derecho_intel.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc.ne16_ne16_mg17.QPX2000.derecho_intel.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc_P1280x1.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc_P1280x1.ne30pg3_ne30pg3_mg17.FCLTHIST.derecho_intel.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc.T42_T42.FSCAM.derecho_intel.cam-outfrq9s + DIFF SMS_Ld1_Vnuopc.f09_f09_mg17.FW2000climo.derecho_intel.cam-outfrq1d + DIFF SMS_Ld1_Vnuopc.f19_f19.F2000dev.derecho_intel.cam-outfrq1d + DIFF SMS_Ld1_Vnuopc.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d + DIFF SMS_Lh12_Vnuopc.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h + DIFF SMS_Lm13_Vnuopc.f10_f10_mg37.F2000climo.derecho_intel.cam-outfrq1m + DIFF SMS_Ln9_Vnuopc.f09_f09_mg17.F2010climo.derecho_intel.cam-nudging + DIFF SMS_Ln9_Vnuopc.f09_f09_mg17.FW1850.derecho_intel.cam-reduced_hist3s + DIFF SMS_Ln9_Vnuopc.f19_f19.F2000climo.derecho_intel.cam-silhs + DIFF SMS_Ln9_Vnuopc.f19_f19_mg17.FHIST.derecho_intel.cam-outfrq9s_nochem + - differences are only in Med_aoflux_atm_So_ustar mediator field resulting from adding + So_ustar to atm imports, otherwise all other fields bit-for-bit izumi/nag/aux_cam: + FAIL DAE_Vnuopc.f45_f45_mg37.FHS94.izumi_nag.cam-dae + - pre-existing failure + + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPC5.izumi_nag.cam-carma_sea_salt + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_cosp + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_am + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_cospsathist + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPWmaC6.izumi_nag.cam-outfrq3s + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QSPCAMS.izumi_nag.cam-outfrq3s + DIFF ERC_D_Ln9_Vnuopc.ne16_ne16_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase + DIFF ERC_D_Ln9_Vnuopc.ne16pg3_ne16pg3_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase + DIFF ERC_D_Ln9_Vnuopc.ne5_ne5_mg37.QPC5.izumi_nag.cam-outfrq3s_ttrac + DIFF ERC_D_Ln9_Vnuopc.T5_T5_mg37.QPC4.izumi_nag.cam-outfrq3s_usecase + DIFF ERI_D_Ln18_Vnuopc.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac + DIFF ERI_D_Ln18_Vnuopc.f19_f19_mg17.QPC6.izumi_nag.cam-ghgrmp_e8 + DIFF ERP_Ln9_Vnuopc.ne5pg3_ne5pg3_mg37.QPC6.izumi_nag.cam-outfrq9s_clubbmf + DIFF PLB_D_Ln9_Vnuopc.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal0 + DIFF PLB_D_Ln9_Vnuopc.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal1 + DIFF PLB_D_Ln9_Vnuopc.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal3 + DIFF PLB_D_Ln9_Vnuopc.ne5_ne5_mg37.QPC5.izumi_nag.cam-ttrac_loadbal0 + DIFF PLB_D_Ln9_Vnuopc.ne5_ne5_mg37.QPC5.izumi_nag.cam-ttrac_loadbal1 + DIFF PLB_D_Ln9_Vnuopc.ne5_ne5_mg37.QPC5.izumi_nag.cam-ttrac_loadbal3 + DIFF SMS_D_Ln3_Vnuopc.ne5pg3_ne5pg3_mg37.QPX2000.izumi_nag.cam-outfrq3s + DIFF SMS_D_Ln6_Vnuopc.ne5_ne5_mg37.QPWmaC4.izumi_nag.cam-outfrq3s_physgrid_tem + DIFF SMS_D_Ln7_Vnuopc.T42_T42_mg17.QPSCAMC5.izumi_nag.cam-scmarm + DIFF SMS_D_Ln9_Vnuopc.f10_f10_mg37.QPC5.izumi_nag.cam-rad_diag_mam + DIFF SMS_D_Ln9_Vnuopc.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_ba + DIFF SMS_P48x1_D_Ln3_Vnuopc.f09_f09_mg17.QPC6HIST.izumi_nag.cam-outfrq3s_co2cycle_usecase + DIFF SUB_D_Ln9_Vnuopc.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s + - differences are only in Med_aoflux_atm_So_ustar mediator field resulting from adding + So_ustar to atm imports, otherwise all other fields bit-for-bit izumi/gnu/aux_cam: + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPC4.izumi_gnu.cam-outfrq3s_diags + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPC5.izumi_gnu.cam-outfrq3s_unicon + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPC5.izumi_gnu.cam-rad_diag + DIFF ERC_D_Ln9_Vnuopc.f10_f10_mg37.QPSPCAMM.izumi_gnu.cam-outfrq3s + DIFF ERC_D_Ln9_Vnuopc.ne5_ne5_mg37.QPC4.izumi_gnu.cam-outfrq3s_nudging_ne5_L26 + DIFF ERC_D_Ln9_Vnuopc.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq3s_ba + DIFF ERI_D_Ln18_Vnuopc.T5_T5_mg37.QPC4.izumi_gnu.cam-co2rmp + DIFF ERP_Ln9_Vnuopc.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq9s + DIFF PLB_D_Ln9_Vnuopc.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-ttrac_loadbal0 + DIFF PLB_D_Ln9_Vnuopc.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-ttrac_loadbal1 + DIFF PLB_D_Ln9_Vnuopc.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-ttrac_loadbal3 + DIFF SCT_D_Ln7_Vnuopc.T42_T42_mg17.QPC4.izumi_gnu.cam-scm_prep + DIFF SCT_D_Ln7_Vnuopc.T42_T42_mg17.QPC6.izumi_gnu.cam-scm_prep_c6 + DIFF SMS_D_Ln3_Vnuopc.f10_f10_mg37.QPMOZ.izumi_gnu.cam-outfrq3s_chemproc + DIFF SMS_D_Ln9.f10_f10_mg37.2000_CAM%DEV%GHGMAM4_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV_SESP.izumi_gnu.cam-outfrq9s + DIFF SMS_D_Ln9_Vnuopc.f10_f10_mg37.QPWmaC4.izumi_gnu.cam-outfrq9s_apmee + DIFF SMS_D_Ln9_Vnuopc.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-outfrq3s_ttrac + DIFF SMS_P48x1_D_Ln9_Vnuopc.f19_f19_mg17.FW4madSD.izumi_gnu.cam-outfrq9s + - differences are only in Med_aoflux_atm_So_ustar mediator field resulting from adding + So_ustar to atm imports, otherwise all other fields bit-for-bit + +Summarize any changes to answers: bit-for-bit unchanged =============================================================== ===============================================================