diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a8a64731..09cd81cf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - GCClassic integration tests now display proper commit info in `results.compile.log` - Stopped OCEAN_CONC from needlessly being pushed through vertical regridding for Hg simulations - Added warning in GCHP HISTORY.rc about outputting area-dependent variables on custom grids +- Added option to use a single advected species in the carbon simulation ### Changed - Update `DiagnFreq` in GCClassic integration tests to ensure HEMCO diagnostic output @@ -101,7 +102,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Change RTOL value from 0.5e-3 back to 0.5e-2 to address model slowdown - Allow the use of OFFLINE_SEASALT for seasalt alkalinity, Cl, and Br in GEOS-Chem within CESM - Renamed TransportTracer species for consistency with GMAO's TR_GridComp -- See `KPP/fullchem/CHANGELOG_fullchem.md` for fullchem-mechanism changes +- See `KPP/fullchem/CHANGELOG_fullchem.md` for fullchem-mechanism + changes +- Update template `HEMCO_Config.rc.carbon` files to allow running the carbon simulation with only a single species. ### Fixed - Fixed typo in `GCClassic/createRunDir.sh` preventing benchmark run script from being copied to the run directory diff --git a/GeosCore/carbon_gases_mod.F90 b/GeosCore/carbon_gases_mod.F90 index eff5cf1ae..fdf4f4f45 100644 --- a/GeosCore/carbon_gases_mod.F90 +++ b/GeosCore/carbon_gases_mod.F90 @@ -369,7 +369,7 @@ END SUBROUTINE Emiss_Carbon_Gases ! !INTERFACE: ! SUBROUTINE Chem_Carbon_Gases( Input_Opt, State_Met, State_Chm, & - State_Grid, State_Diag, RC ) + State_Grid, State_Diag, RC ) ! ! !USES: ! @@ -684,7 +684,16 @@ SUBROUTINE Chem_Carbon_Gases( Input_Opt, State_Met, State_Chm, & ! Update reaction rates !=================================================================== - ! Start timer + ! Stop KPP timer + IF ( Input_Opt%useTimers ) THEN + CALL Timer_End( & + timerName = " -> KPP", & + inLoop = .TRUE., & + threadNum = ThreadNum, & + RC = RC ) + ENDIF + + ! Start RCONST timer IF ( Input_Opt%useTimers ) THEN CALL Timer_Start( & timerName = " RCONST", & @@ -756,6 +765,15 @@ SUBROUTINE Chem_Carbon_Gases( Input_Opt, State_Met, State_Chm, & ! Trap potential errors IF ( IERR /= 1 ) failed = .TRUE. + ! Start KPP timer + IF ( Input_Opt%useTimers ) THEN + CALL Timer_End( & + timerName = " -> KPP", & + inLoop = .TRUE., & + threadNum = ThreadNum, & + RC = RC ) + ENDIF + !===================================================================== ! HISTORY: Archive KPP solver diagnostics !===================================================================== diff --git a/GeosCore/chemistry_mod.F90 b/GeosCore/chemistry_mod.F90 index 471d556b4..3ca289bbd 100644 --- a/GeosCore/chemistry_mod.F90 +++ b/GeosCore/chemistry_mod.F90 @@ -988,6 +988,11 @@ SUBROUTINE Do_Chemistry( Input_Opt, State_Chm, State_Diag, & !===================================================================== ELSE IF ( Input_Opt%ITS_A_CARBON_SIM ) THEN + ! Start "FlexChem" timer + IF ( Input_Opt%useTimers ) THEN + CALL Timer_Start( "=> FlexChem", RC ) + ENDIF + ! Do carbon chemistry CALL Chem_Carbon_Gases( Input_Opt = Input_Opt, & State_Met = State_Met, & @@ -1003,11 +1008,21 @@ SUBROUTINE Do_Chemistry( Input_Opt, State_Chm, State_Diag, & RETURN ENDIF + ! Stop "FlexChem" timer + IF ( Input_Opt%useTimers ) THEN + CALL Timer_End( "=> FlexChem", RC ) + ENDIF + !==================================================================== ! Mercury (configure with -DMECH=Hg) !===================================================================== ELSE IF ( Input_Opt%ITS_A_MERCURY_SIM ) THEN + ! Start "FlexChem" timer + IF ( Input_Opt%useTimers ) THEN + CALL Timer_Start( "=> FlexChem", RC ) + ENDIF + ! Do Hg chemistry CALL ChemMercury( Input_Opt = Input_Opt, & State_Chm = State_Chm, & @@ -1023,6 +1038,11 @@ SUBROUTINE Do_Chemistry( Input_Opt, State_Chm, State_Diag, & RETURN ENDIF + ! Stop "FlexChem" timer + IF ( Input_Opt%useTimers ) THEN + CALL Timer_End( "=> FlexChem", RC ) + ENDIF + !===================================================================== ! POPs (only used when compiled with BPCH_DIAG=y) !===================================================================== diff --git a/run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon b/run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon index 3bf391d0e..75842702d 100644 --- a/run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon +++ b/run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon @@ -1307,7 +1307,6 @@ ${RUNDIR_GLOBAL_OH} #------------------------------------------------------------------------------ # --- Quantities needed for CH4 chemistry --- #------------------------------------------------------------------------------ -(((USE_CH4_DATA # --- Global CH4 loss frequencies [1/s] ----------- (((CH4_LOSS_FREQ @@ -1319,12 +1318,9 @@ ${RUNDIR_CH4_LOSS} ${RUNDIR_GLOBAL_Cl} )))GLOBAL_CL -)))USE_CH4_DATA - #------------------------------------------------------------------------------ # --- Quantities needed for CO chemistry --- #------------------------------------------------------------------------------ -(((USE_CO_DATA # -- P(CO) from CH4 and NMVOC from the last 10-yr benchmark [molec/cm3/s] --- (((PROD_CO_CH4 @@ -1336,13 +1332,21 @@ ${RUNDIR_PCO_NMVOC} # --- GMI chemistry: prod/loss rates (for strato-/mesosphere) --- # --- Units: prod [v/v/s]; loss [1/s] --- +(((USE_CO_DATA (((GMI_PROD_LOSS -${RUNDIR_GMI_LOSS_CO} -${RUNDIR_GMI_PROD_CO} +* GMI_LOSS_CO $ROOT/GMI/v2022-11/gmi.clim.CO.geos5.2x25.nc loss 2005/1-12/1/0 C xyz s-1 CO - 1 1 +* GMI_PROD_CO $ROOT/GMI/v2022-11/gmi.clim.CO.geos5.2x25.nc prod 2005/1-12/1/0 C xyz v/v/s CO - 1 1 )))GMI_PROD_LOSS - )))USE_CO_DATA +# If CO is not an advected species, then just read as a chemistry input +(((.not.USE_CO_DATA +(((GMI_PROD_LOSS +* GMI_LOSS_CO $ROOT/GMI/v2022-11/gmi.clim.CO.geos5.2x25.nc loss 2005/1-12/1/0 C xyz s-1 * - 1 1 +* GMI_PROD_CO $ROOT/GMI/v2022-11/gmi.clim.CO.geos5.2x25.nc prod 2005/1-12/1/0 C xyz v/v/s * - 1 1 +)))GMI_PROD_LOSS +))).not.USE_CO_DATA + #------------------------------------------------------------------------------ # --- Quantities needed for CO2 chemistry --- #------------------------------------------------------------------------------ @@ -1350,14 +1354,11 @@ ${RUNDIR_GMI_PROD_CO} # --- CHEMICAL PRODUCTION FROM CO OXIDATION ------ # --- Recommended for use in forward modelling --- # --- Optional for inversion/assimilation -------- -(((USE_CO2_DATA (((CO2_COPROD ${RUNDIR_CO2_COPROD} )))CO2_COPROD -)))USE_CO2_DATA - )))CHEMISTRY_INPUT ### END SECTION BASE EMISSIONS ### @@ -1690,12 +1691,15 @@ ${RUNDIR_CO2_COPROD} 2008 AFRICA_MASK $ROOT/MASKS/v2018-09/AF_LANDMASK.geos.05x0666.global.nc LANDMASK 1985/1/1/0 C xy 1 1 -20/-37/54/40 )))DICE_Africa +)))USE_CO_DATA.or.USE_CO2_DATA + +#============================================================================== +# --- Masks used for CH4, CO and CO2 simulation emissions --- +#============================================================================== (((CEDSv2.or.CEDS_GBDMAPS.or.CEDS_GBDMAPS_byFuelType 2009 CHINA_MASK $ROOT/MASKS/v2018-09/China_mask.generic.1x1.nc MASK 2000/1/1/0 C xy 1 1 70/10/150/60 )))CEDSv2.or.CEDS_GBDMAPS.or.CEDS_GBDMAPS_byFuelType -)))USE_CO_DATA.or.USE_CO2_DATA - )))EMISSIONS ### END SECTION MASKS ### diff --git a/run/GCClassic/HEMCO_Diagn.rc.templates/HEMCO_Diagn.rc.carbon b/run/GCClassic/HEMCO_Diagn.rc.templates/HEMCO_Diagn.rc.carbon index fc71f5dba..47504a22c 100644 --- a/run/GCClassic/HEMCO_Diagn.rc.templates/HEMCO_Diagn.rc.carbon +++ b/run/GCClassic/HEMCO_Diagn.rc.templates/HEMCO_Diagn.rc.carbon @@ -16,9 +16,8 @@ # Name Spec ExtNr Cat Hier Dim OutUnit LongName ############################################################################### -##### CH4 sources ##### +##### CH4 sources ##### ############################################################################### - EmisCH4_Total CH4 -1 -1 -1 2 kg/m2/s CH4_emissions_from_all_sectors EmisCH4_Oil CH4 0 1 -1 2 kg/m2/s CH4_emissions_from_oil EmisCH4_Gas CH4 0 2 -1 2 kg/m2/s CH4_emissions_from_gas @@ -42,7 +41,7 @@ EmisCH4_Reservoirs CH4 0 15 -1 2 kg/m2/s CH4_emissions_from_hydr EmisCO_Total CO -1 -1 -1 3 kg/m2/s CO_emission_flux_from_all_sectors EmisCO_Aircraft CO 0 20 -1 3 kg/m2/s CO_emission_flux_from_aircraft EmisCO_Anthro CO 0 1 -1 3 kg/m2/s CO_emission_flux_from_anthropogenic -EmisCO_BioBurn CO 0 5 -1 2 kg/m2/s CO_emission_flux_from_biomass_burning +EmisCO_BiomassBurn CO 111 -1 -1 2 kg/m2/s CO_emission_flux_from_biomass_burning EmisCO_Ship CO 0 10 -1 2 kg/m2/s CO_emission_flux_from_ships ############################################################################### @@ -56,13 +55,7 @@ EmisCO2_NetTerrExch CO2 0 5 -1 2 kg/m2/s CO2_net_terrestrial_exc EmisCO2_Ship CO2 0 6 -1 2 kg/m2/s CO2_ship_emissions EmisCO2_Aviation CO2 0 7 -1 3 kg/m2/s CO2_aviation_emissions EmisCO2_CO2SurfCorr CO2 0 8 -1 2 kg/m2/s CO2_surface_correction_for_CO_oxidation - -#NOTE: Biomass burning doesn't seem to work. Keep here for now. -# Uncomment this if GFED is used -#EmisCO2_Biomass_GFED CO2 111 1 1 2 kg/m2/s CO2_biomass_burning_emissions_from_GFED4 - -# Uncomment this if FINN is used -#EmisCO2_Biomass_FINN CO2 114 1 1 2 kg/m2/s CO2_biomass_burning_emissions_from_FINN +EmisCO2_BiomassBurn CO2 111 -1 -1 2 kg/m2/s CO2_biomass_burning_emissions_from_GFED4 ############################################################################### ##### OCS sources ##### @@ -72,77 +65,3 @@ EmisOCS_Anthro OCS 0 1 -1 2 kg/m2/s OCS_emission_flux_from_ EmisOCS_Bioburn OCS 0 2 -1 2 kg/m2/s OCS_emission_flux_from_biomass_burning EmisOCS_MissingOcean OCS 0 3 -1 2 kg/m2/s OCS_emission_flux_from_missing_ocean EmisOCS_Ocean OCS 0 4 -1 2 kg/m2/s OCS_emission_flux_from_ocean - -# Tagged CO species, uncomment if needed -# -################################################################################ -###### COus sources ##### -################################################################################ -#EmisCOus_Total COus -1 -1 -1 3 kg/m2/s COus_emission_flux_from_all_sectors -#EmisCOus_Aircraft COus 0 20 -1 3 kg/m2/s COus_emission_flux_from_aircraft -#EmisCOus_Anthro COus 0 1 -1 3 kg/m2/s COus_emission_flux_from_anthropogenic -#EmisCOus_BioBurn COus 0 5 -1 2 kg/m2/s COus_emission_flux_from_biomass_burning -#EmisCOus_Ship COus 0 10 -1 2 kg/m2/s COus_emission_flux_from_ships -# -################################################################################ -###### COeur sources ##### -################################################################################ -#EmisCOeur_Total COeur -1 -1 -1 3 kg/m2/s COeur_emission_flux_from_all_sectors -#EmisCOeur_Aircraft COeur 0 20 -1 3 kg/m2/s COeur_emission_flux_from_aircraft -#EmisCOeur_Anthro COeur 0 1 -1 3 kg/m2/s COeur_emission_flux_from_anthropogenic -#EmisCOeur_BioBurn COeur 0 5 -1 2 kg/m2/s COeur_emission_flux_from_biomass_burning -#EmisCOeur_Ship COeur 0 10 -1 2 kg/m2/s COeur_emission_flux_from_ships -# -################################################################################ -###### COasia sources ##### -################################################################################ -#EmisCOasia_Total COasia -1 -1 -1 3 kg/m2/s COasia_emission_flux_from_all_sectors -#EmisCOasia_Aircraft COasia 0 20 -1 3 kg/m2/s COasia_emission_flux_from_aircraft -#EmisCOasia_Anthro COasia 0 1 -1 3 kg/m2/s COasia_emission_flux_from_anthropogenic -#EmisCOasia_BioBurn COasia 0 5 -1 2 kg/m2/s COasia_emission_flux_from_biomass_burning -#EmisCOasia_Ship COasia 0 10 -1 2 kg/m2/s COasia_emission_flux_from_ships -# -################################################################################ -###### COoth sources ##### -################################################################################ -#EmisCOoth_Total COoth -1 -1 -1 3 kg/m2/s COoth_emission_flux_from_all_sectors -#EmisCOoth_Aircraft COoth 0 20 -1 3 kg/m2/s COoth_emission_flux_from_aircraft -#EmisCOoth_Anthro COoth 0 1 -1 3 kg/m2/s COoth_emission_flux_from_anthropogenic -#EmisCOoth_BioBurn COoth 0 5 -1 2 kg/m2/s COoth_emission_flux_from_biomass_burning -#EmisCOoth_Ship COoth 0 10 -1 2 kg/m2/s COoth_emission_flux_from_ships -# -################################################################################ -###### COus sources ##### -################################################################################ -#EmisCOus_Total COus -1 -1 -1 3 kg/m2/s COus_emission_flux_from_all_sectors -#EmisCOus_Aircraft COus 0 20 -1 3 kg/m2/s COus_emission_flux_from_aircraft -#EmisCOus_Anthro COus 0 1 -1 3 kg/m2/s COus_emission_flux_from_anthropogenic -#EmisCOus_BioBurn COus 0 5 -1 2 kg/m2/s COus_emission_flux_from_biomass_burning -#EmisCOus_Ship COus 0 10 -1 2 kg/m2/s COus_emission_flux_from_ships -# -################################################################################ -###### COeur sources ##### -################################################################################ -#EmisCOeur_Total COeur -1 -1 -1 3 kg/m2/s COeur_emission_flux_from_all_sectors -#EmisCOeur_Aircraft COeur 0 20 -1 3 kg/m2/s COeur_emission_flux_from_aircraft -#EmisCOeur_Anthro COeur 0 1 -1 3 kg/m2/s COeur_emission_flux_from_anthropogenic -#EmisCOeur_BioBurn COeur 0 5 -1 2 kg/m2/s COeur_emission_flux_from_biomass_burning -#EmisCOeur_Ship COeur 0 10 -1 2 kg/m2/s COeur_emission_flux_from_ships -# -################################################################################ -###### COasia sources ##### -################################################################################ -#EmisCOasia_Total COasia -1 -1 -1 3 kg/m2/s COasia_emission_flux_from_all_sectors -#EmisCOasia_Aircraft COasia 0 20 -1 3 kg/m2/s COasia_emission_flux_from_aircraft -#EmisCOasia_Anthro COasia 0 1 -1 3 kg/m2/s COasia_emission_flux_from_anthropogenic -#EmisCOasia_BioBurn COasia 0 5 -1 2 kg/m2/s COasia_emission_flux_from_biomass_burning -#EmisCOasia_Ship COasia 0 10 -1 2 kg/m2/s COasia_emission_flux_from_ships -# -################################################################################ -###### COoth sources ##### -################################################################################ -#EmisCOoth_Total COoth -1 -1 -1 3 kg/m2/s COoth_emission_flux_from_all_sectors -#EmisCOoth_Aircraft COoth 0 20 -1 3 kg/m2/s COoth_emission_flux_from_aircraft -#EmisCOoth_Anthro COoth 0 1 -1 3 kg/m2/s COoth_emission_flux_from_anthropogenic -#EmisCOoth_BioBurn COoth 0 5 -1 2 kg/m2/s COoth_emission_flux_from_biomass_burning -#EmisCOoth_Ship COoth 0 10 -1 2 kg/m2/s COoth_emission_flux_from_ships \ No newline at end of file diff --git a/run/GCClassic/createRunDir.sh b/run/GCClassic/createRunDir.sh index cb157d54b..3fc4b6fda 100755 --- a/run/GCClassic/createRunDir.sh +++ b/run/GCClassic/createRunDir.sh @@ -43,6 +43,7 @@ cd ${srcrundir} # Source common bash functions from scripts in the run/shared folder . ${gcdir}/run/shared/setupConfigFiles.sh # Config file editing . ${gcdir}/run/shared/newUserRegistration.sh # 1st-time user registration +. ${gcdir}/run/shared/singleCarbonSpecies.sh # Single carbon species setup # Initialize run directory variables RUNDIR_VARS="" @@ -247,6 +248,34 @@ elif [[ ${sim_name} = "POPs" ]]; then printf "Invalid POPs type. Try again.\n" fi done + +# Ask user to specify carbon simulation options +elif [[ "x${sim_name}" == "xcarbon" ]]; then + printf "${thinline}Do you wish to use a single advected species?${thinline}" + printf " 1. Use all species\n" + printf " 2. Use CH4 only\n" + printf " 3. Use CO2 only\n" + printf " 4. Use CO only\n" + printf " 5. Use OCS only\n" + valid=0 + while [ "${valid}" -eq 0 ]; do + read -p "${USER_PROMPT}" prompt + valid=1 + if [[ "x${prompt}" == "x1" ]]; then + sim_extra_option="none" + elif [[ "x${prompt}" == "x2" ]]; then + sim_extra_option="CH4" + elif [[ "x${prompt}" == "x3" ]]; then + sim_extra_option="CO2" + elif [[ "x${prompt}" == "x4" ]]; then + sim_extra_option="CO" + elif [[ "x${prompt}" == "x5" ]]; then + sim_extra_option="OCS" + else + valid=0 + printf "Invalid selection. Try again.\n" + fi + done fi RUNDIR_VARS+="RUNDIR_SIM_EXTRA_OPTION=$sim_extra_option\n" @@ -725,12 +754,11 @@ while [ "$valid_path" -eq 0 ]; do exit 1 fi - # Replace ~ with the user's home directory - # NOTE: This is a safe algorithm. - if [[ "${rundir_path}" =~ '~' ]]; then - rundir_path="${rundir_path/#\~/$HOME}" - echo "Expanding to: ${rundir_path}" - fi + # Expand $rundir_path to an absolute path. + # Also replace ~ with $HOME. + rundir_path="${rundir_path/#\~/$HOME}" + rundir_path=$(realpath "${rundir_path}") + echo "Expanding to ${rundir_path}" # If this is just a new directory within an existing one, # give the user the option to proceed @@ -886,6 +914,7 @@ else startdate='20190701' enddate='20190801' fi + if [[ ${met} = "ModelE2.1" ]] || [[ ${met} = "ModelE2.2" ]]; then if [[ "$scenario" == "HIST" ]]; then startdate='20050701' @@ -977,6 +1006,7 @@ echo -e "$RUNDIR_VARS" > ${rundir_config_log} #sort -o ${rundir_config_log} ${rundir_config_log} # Initialize run directory +# NOTE: This also copies configuration files to the run directory! ${srcrundir}/init_rd.sh ${rundir_config_log} #-------------------------------------------------------------------- @@ -1140,9 +1170,14 @@ fi # input_options.yml and modifies diagnostic output based on simulation type. if [[ "x${sim_name}" = "xfullchem" ]]; then set_common_settings "${sim_extra_option}" "GCClassic" -fi +fi -# +# If necessary, edit config files for a carbon single species simulation +if [[ "x${sim_name}" == "xcarbon" ]]; then + if [[ "x${sim_extra_option}" != "xnone" ]]; then + singleCarbonSpecies "${sim_extra_option}" "${rundir}" + fi +fi #-------------------------------------------------------------------- # Navigate back to source code directory diff --git a/run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon b/run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon index 4ac469a56..5f343eec9 100644 --- a/run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon +++ b/run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon @@ -1307,7 +1307,6 @@ ${RUNDIR_GLOBAL_OH} #------------------------------------------------------------------------------ # --- Quantities needed for CH4 chemistry --- #------------------------------------------------------------------------------ -(((USE_CH4_DATA # --- Global CH4 loss frequencies [1/s] ----------- (((CH4_LOSS_FREQ @@ -1319,8 +1318,6 @@ ${RUNDIR_CH4_LOSS} ${RUNDIR_GLOBAL_Cl} )))GLOBAL_CL -)))USE_CH4_DATA - #------------------------------------------------------------------------------ # --- Quantities needed for CO chemistry --- #------------------------------------------------------------------------------ @@ -1336,13 +1333,21 @@ ${RUNDIR_PCO_NMVOC} # --- GMI chemistry: prod/loss rates (for strato-/mesosphere) --- # --- Units: prod [v/v/s]; loss [1/s] --- +(((USE_CO_DATA (((GMI_PROD_LOSS -${RUNDIR_GMI_LOSS_CO} -${RUNDIR_GMI_PROD_CO} +* GMI_LOSS_CO $ROOT/GMI/v2022-11/gmi.clim.CO.geos5.2x25.nc loss 2005/1-12/1/0 C xyz s-1 CO - 1 1 +* GMI_PROD_CO $ROOT/GMI/v2022-11/gmi.clim.CO.geos5.2x25.nc prod 2005/1-12/1/0 C xyz v/v/s CO - 1 1 )))GMI_PROD_LOSS - )))USE_CO_DATA +# If CO is not an advected species, then just read as a chemistry input +(((.not.USE_CO_DATA +(((GMI_PROD_LOSS +* GMI_LOSS_CO $ROOT/GMI/v2022-11/gmi.clim.CO.geos5.2x25.nc loss 2005/1-12/1/0 C xyz s-1 * - 1 1 +* GMI_PROD_CO $ROOT/GMI/v2022-11/gmi.clim.CO.geos5.2x25.nc prod 2005/1-12/1/0 C xyz v/v/s * - 1 1 +)))GMI_PROD_LOSS +))).not.USE_CO_DATA + #------------------------------------------------------------------------------ # --- Quantities needed for CO2 chemistry --- #------------------------------------------------------------------------------ @@ -1350,14 +1355,11 @@ ${RUNDIR_GMI_PROD_CO} # --- CHEMICAL PRODUCTION FROM CO OXIDATION ------ # --- Recommended for use in forward modelling --- # --- Optional for inversion/assimilation -------- -(((USE_CO2_DATA (((CO2_COPROD ${RUNDIR_CO2_COPROD} )))CO2_COPROD -)))USE_CO2_DATA - )))CHEMISTRY_INPUT ### END SECTION BASE EMISSIONS ### @@ -1690,12 +1692,15 @@ ${RUNDIR_CO2_COPROD} 2008 AFRICA_MASK $ROOT/MASKS/v2018-09/AF_LANDMASK.geos.05x0666.global.nc LANDMASK 1985/1/1/0 C xy 1 1 -20/-37/54/40 )))DICE_Africa +)))USE_CO_DATA.or.USE_CO2_DATA + +#============================================================================== +# --- Masks used for CH4, CO and CO2 simulation emissions --- +#============================================================================== (((CEDSv2.or.CEDS_GBDMAPS.or.CEDS_GBDMAPS_byFuelType 2009 CHINA_MASK $ROOT/MASKS/v2018-09/China_mask.generic.1x1.nc MASK 2000/1/1/0 C xy 1 1 70/10/150/60 )))CEDSv2.or.CEDS_GBDMAPS.or.CEDS_GBDMAPS_byFuelType -)))USE_CO_DATA.or.USE_CO2_DATA - )))EMISSIONS ### END SECTION MASKS ### diff --git a/run/GCHP/HEMCO_Diagn.rc.templates/HEMCO_Diagn.rc.carbon b/run/GCHP/HEMCO_Diagn.rc.templates/HEMCO_Diagn.rc.carbon index 43ed75773..73c1d3129 100644 --- a/run/GCHP/HEMCO_Diagn.rc.templates/HEMCO_Diagn.rc.carbon +++ b/run/GCHP/HEMCO_Diagn.rc.templates/HEMCO_Diagn.rc.carbon @@ -16,9 +16,8 @@ # Name Spec ExtNr Cat Hier Dim OutUnit LongName ############################################################################### -##### CH4 sources ##### +##### CH4 sources ##### ############################################################################### - EmisCH4_Total CH4 -1 -1 -1 2 kg/m2/s CH4_emissions_from_all_sectors EmisCH4_Oil CH4 0 1 -1 2 kg/m2/s CH4_emissions_from_oil EmisCH4_Gas CH4 0 2 -1 2 kg/m2/s CH4_emissions_from_gas @@ -28,7 +27,7 @@ EmisCH4_Landfills CH4 0 5 -1 2 kg/m2/s CH4_emissions_from_land EmisCH4_Wastewater CH4 0 6 -1 2 kg/m2/s CH4_emissions_from_wastewater EmisCH4_Rice CH4 0 7 -1 2 kg/m2/s CH4_emissions_from_rice EmisCH4_OtherAnth CH4 0 8 -1 2 kg/m2/s CH4_emissions_from_other_anthropogenic_sources -EmisCH4_BiomassBurn CH4 0 9 -1 2 kg/m2/s CH4_emissions_from_biomass_burning +EmisCH4_BiomassBurn CH4 111 -1 -1 2 kg/m2/s CH4_emissions_from_biomass_burning EmisCH4_Wetlands CH4 0 10 -1 2 kg/m2/s CH4_emissions_from_wetlands EmisCH4_Seeps CH4 0 11 -1 2 kg/m2/s CH4_emissions_from_geological_seeps EmisCH4_Lakes CH4 0 12 -1 2 kg/m2/s CH4_emissions_from_lakes @@ -42,7 +41,7 @@ EmisCH4_Reservoirs CH4 0 15 -1 2 kg/m2/s CH4_emissions_from_hydr EmisCO_Total CO -1 -1 -1 3 kg/m2/s CO_emission_flux_from_all_sectors EmisCO_Aircraft CO 0 20 -1 3 kg/m2/s CO_emission_flux_from_aircraft EmisCO_Anthro CO 0 1 -1 3 kg/m2/s CO_emission_flux_from_anthropogenic -EmisCO_BioBurn CO 0 5 -1 2 kg/m2/s CO_emission_flux_from_biomass_burning +EmisCO_BiomassBurn CO 111 -1 -1 2 kg/m2/s CO_emission_flux_from_biomass_burning EmisCO_Ship CO 0 10 -1 2 kg/m2/s CO_emission_flux_from_ships ############################################################################### @@ -56,13 +55,7 @@ EmisCO2_NetTerrExch CO2 0 5 -1 2 kg/m2/s CO2_net_terrestrial_exc EmisCO2_Ship CO2 0 6 -1 2 kg/m2/s CO2_ship_emissions EmisCO2_Aviation CO2 0 7 -1 3 kg/m2/s CO2_aviation_emissions EmisCO2_CO2SurfCorr CO2 0 8 -1 2 kg/m2/s CO2_surface_correction_for_CO_oxidation - -#NOTE: Biomass burning doesn't seem to work. Keep here for now. -# Uncomment this if GFED is used -#EmisCO2_Biomass_GFED CO2 111 1 1 2 kg/m2/s CO2_biomass_burning_emissions_from_GFED4 - -# Uncomment this if FINN is used -#EmisCO2_Biomass_FINN CO2 114 1 1 2 kg/m2/s CO2_biomass_burning_emissions_from_FINN +EmisCO2_BiomassBurn CO2 111 -1 -1 2 kg/m2/s CO2_biomass_burning_emissions_from_GFED4 ############################################################################### ##### OCS sources ##### @@ -73,76 +66,3 @@ EmisOCS_Bioburn OCS 0 2 -1 2 kg/m2/s OCS_emission_flux_from_ EmisOCS_MissingOcean OCS 0 3 -1 2 kg/m2/s OCS_emission_flux_from_missing_ocean EmisOCS_Ocean OCS 0 4 -1 2 kg/m2/s OCS_emission_flux_from_ocean -# Tagged CO species, uncomment if needed -# -################################################################################ -###### COus sources ##### -################################################################################ -#EmisCOus_Total COus -1 -1 -1 3 kg/m2/s COus_emission_flux_from_all_sectors -#EmisCOus_Aircraft COus 0 20 -1 3 kg/m2/s COus_emission_flux_from_aircraft -#EmisCOus_Anthro COus 0 1 -1 3 kg/m2/s COus_emission_flux_from_anthropogenic -#EmisCOus_BioBurn COus 0 5 -1 2 kg/m2/s COus_emission_flux_from_biomass_burning -#EmisCOus_Ship COus 0 10 -1 2 kg/m2/s COus_emission_flux_from_ships -# -################################################################################ -###### COeur sources ##### -################################################################################ -#EmisCOeur_Total COeur -1 -1 -1 3 kg/m2/s COeur_emission_flux_from_all_sectors -#EmisCOeur_Aircraft COeur 0 20 -1 3 kg/m2/s COeur_emission_flux_from_aircraft -#EmisCOeur_Anthro COeur 0 1 -1 3 kg/m2/s COeur_emission_flux_from_anthropogenic -#EmisCOeur_BioBurn COeur 0 5 -1 2 kg/m2/s COeur_emission_flux_from_biomass_burning -#EmisCOeur_Ship COeur 0 10 -1 2 kg/m2/s COeur_emission_flux_from_ships -# -################################################################################ -###### COasia sources ##### -################################################################################ -#EmisCOasia_Total COasia -1 -1 -1 3 kg/m2/s COasia_emission_flux_from_all_sectors -#EmisCOasia_Aircraft COasia 0 20 -1 3 kg/m2/s COasia_emission_flux_from_aircraft -#EmisCOasia_Anthro COasia 0 1 -1 3 kg/m2/s COasia_emission_flux_from_anthropogenic -#EmisCOasia_BioBurn COasia 0 5 -1 2 kg/m2/s COasia_emission_flux_from_biomass_burning -#EmisCOasia_Ship COasia 0 10 -1 2 kg/m2/s COasia_emission_flux_from_ships -# -################################################################################ -###### COoth sources ##### -################################################################################ -#EmisCOoth_Total COoth -1 -1 -1 3 kg/m2/s COoth_emission_flux_from_all_sectors -#EmisCOoth_Aircraft COoth 0 20 -1 3 kg/m2/s COoth_emission_flux_from_aircraft -#EmisCOoth_Anthro COoth 0 1 -1 3 kg/m2/s COoth_emission_flux_from_anthropogenic -#EmisCOoth_BioBurn COoth 0 5 -1 2 kg/m2/s COoth_emission_flux_from_biomass_burning -#EmisCOoth_Ship COoth 0 10 -1 2 kg/m2/s COoth_emission_flux_from_ships -# -################################################################################ -###### COus sources ##### -################################################################################ -#EmisCOus_Total COus -1 -1 -1 3 kg/m2/s COus_emission_flux_from_all_sectors -#EmisCOus_Aircraft COus 0 20 -1 3 kg/m2/s COus_emission_flux_from_aircraft -#EmisCOus_Anthro COus 0 1 -1 3 kg/m2/s COus_emission_flux_from_anthropogenic -#EmisCOus_BioBurn COus 0 5 -1 2 kg/m2/s COus_emission_flux_from_biomass_burning -#EmisCOus_Ship COus 0 10 -1 2 kg/m2/s COus_emission_flux_from_ships -# -################################################################################ -###### COeur sources ##### -################################################################################ -#EmisCOeur_Total COeur -1 -1 -1 3 kg/m2/s COeur_emission_flux_from_all_sectors -#EmisCOeur_Aircraft COeur 0 20 -1 3 kg/m2/s COeur_emission_flux_from_aircraft -#EmisCOeur_Anthro COeur 0 1 -1 3 kg/m2/s COeur_emission_flux_from_anthropogenic -#EmisCOeur_BioBurn COeur 0 5 -1 2 kg/m2/s COeur_emission_flux_from_biomass_burning -#EmisCOeur_Ship COeur 0 10 -1 2 kg/m2/s COeur_emission_flux_from_ships -# -################################################################################ -###### COasia sources ##### -################################################################################ -#EmisCOasia_Total COasia -1 -1 -1 3 kg/m2/s COasia_emission_flux_from_all_sectors -#EmisCOasia_Aircraft COasia 0 20 -1 3 kg/m2/s COasia_emission_flux_from_aircraft -#EmisCOasia_Anthro COasia 0 1 -1 3 kg/m2/s COasia_emission_flux_from_anthropogenic -#EmisCOasia_BioBurn COasia 0 5 -1 2 kg/m2/s COasia_emission_flux_from_biomass_burning -#EmisCOasia_Ship COasia 0 10 -1 2 kg/m2/s COasia_emission_flux_from_ships -# -################################################################################ -###### COoth sources ##### -################################################################################ -#EmisCOoth_Total COoth -1 -1 -1 3 kg/m2/s COoth_emission_flux_from_all_sectors -#EmisCOoth_Aircraft COoth 0 20 -1 3 kg/m2/s COoth_emission_flux_from_aircraft -#EmisCOoth_Anthro COoth 0 1 -1 3 kg/m2/s COoth_emission_flux_from_anthropogenic -#EmisCOoth_BioBurn COoth 0 5 -1 2 kg/m2/s COoth_emission_flux_from_biomass_burning -#EmisCOoth_Ship COoth 0 10 -1 2 kg/m2/s COoth_emission_flux_from_ships \ No newline at end of file diff --git a/run/GCHP/HISTORY.rc.templates/HISTORY.rc.carbon b/run/GCHP/HISTORY.rc.templates/HISTORY.rc.carbon index fa74116d8..690b02fea 100644 --- a/run/GCHP/HISTORY.rc.templates/HISTORY.rc.carbon +++ b/run/GCHP/HISTORY.rc.templates/HISTORY.rc.carbon @@ -130,7 +130,7 @@ COLLECTIONS: 'Emissions', 'EmisCO_Total ', 'GCHPchem', 'EmisCO_Aircraft ', 'GCHPchem', 'EmisCO_Anthro ', 'GCHPchem', - 'EmisCO_BioBurn ', 'GCHPchem', + 'EmisCO_BiomassBurn ', 'GCHPchem', 'EmisCO_Ship ', 'GCHPchem', 'EmisCO2_Total ', 'GCHPchem', 'EmisCO2_FossilFuel ', 'GCHPchem', @@ -140,7 +140,7 @@ COLLECTIONS: 'Emissions', 'EmisCO2_Ship ', 'GCHPchem', 'EmisCO2_Aviation ', 'GCHPchem', 'EmisCO2_CO2SurfCorr ', 'GCHPchem', - #'EmisCO2_Biomass_GFED ', 'GCHPchem', + 'EmisCO2_BiomassBurn ', 'GCHPchem', :: #============================================================================== # Budget defined as species kg/s in the column (full, troposphere, or PBL) diff --git a/run/GCHP/createRunDir.sh b/run/GCHP/createRunDir.sh index 6c353882c..985df82df 100755 --- a/run/GCHP/createRunDir.sh +++ b/run/GCHP/createRunDir.sh @@ -42,6 +42,7 @@ cd ${srcrundir} # Source common bash functions from scripts in the run/shared folder . ${gcdir}/run/shared/setupConfigFiles.sh # Config file editing . ${gcdir}/run/shared/newUserRegistration.sh # 1st-time user registration +. ${gcdir}/run/shared/singleCarbonSpecies.sh # Single carbon species setup # Initialize run directory variables RUNDIR_VARS="" @@ -204,6 +205,34 @@ if [[ ${sim_name} = "fullchem" ]]; then # Currently no transport tracer extra options elif [[ ${sim_name} = "TransportTracers" ]]; then sim_extra_option=none + +# Ask user to specify carbon simulation options +elif [[ "x${sim_name}" == "xcarbon" ]]; then + printf "${thinline}Do you wish to use a single advected species?${thinline}" + printf " 1. Use all species\n" + printf " 2. Use CH4 only\n" + printf " 3. Use CO2 only\n" + printf " 4. Use CO only\n" + printf " 5. Use OCS only\n" + valid=0 + while [ "${valid}" -eq 0 ]; do + read -p "${USER_PROMPT}" prompt + valid=1 + if [[ "x${prompt}" == "x1" ]]; then + sim_extra_option="none" + elif [[ "x${prompt}" == "x2" ]]; then + sim_extra_option="CH4" + elif [[ "x${prompt}" == "x3" ]]; then + sim_extra_option="CO2" + elif [[ "x${prompt}" == "x4" ]]; then + sim_extra_option="CO" + elif [[ "x${prompt}" == "x5" ]]; then + sim_extra_option="OCS" + else + valid=0 + printf "Invalid selection. Try again.\n" + fi + done fi RUNDIR_VARS+="RUNDIR_SIM_EXTRA_OPTION=$sim_extra_option\n" @@ -562,6 +591,13 @@ if [[ "x${sim_name}" = "xfullchem" ]]; then set_common_settings "${sim_extra_option}" "GCHP" fi +# If necessary, edit config files for a carbon single species simulation +if [[ "x${sim_name}" == "xcarbon" ]]; then + if [[ "x${sim_extra_option}" != "xnone" ]]; then + singleCarbonSpecies "${sim_extra_option}" "${rundir}" + fi +fi + # Call setCommonRunSettings.sh so that all config files are consistent with its # default settings. Suppress informational prints. chmod +x setCommonRunSettings.sh diff --git a/run/shared/singleCarbonSpecies.sh b/run/shared/singleCarbonSpecies.sh new file mode 100755 index 000000000..775a11574 --- /dev/null +++ b/run/shared/singleCarbonSpecies.sh @@ -0,0 +1,343 @@ +#!/bin/bash + +#------------------------------------------------------------------------------ +# GEOS-Chem Global Chemical Transport Model ! +#------------------------------------------------------------------------------ +#BOP +# +# !IROUTINE: singleCarbonSpecies.sh +# +# !DESCRIPTION: Updates carbon simulation configuration files so that +# a simulation with a single species can be performed. +# +# !CALLING SEQUENCE: +# ./singleCarbonSpecies.sh +# +# !REVISION HISTORY: +# 14 Sep 2023 - R. Yantosca - Initial version +# See the subsequent Git history with the gitk browser! +#EOP +#------------------------------------------------------------------------------ +#BOC + +# List of all advected species in the carbon simulation +ALL_SPECIES=(CO2 CO CH4 OCS) + + +function isItemInList() { + + #========================================================================= + # Test if an item is in a list. + # + # Arguments: + # ${1}: The item + # ${2}: Thie list + # + # Returns (via $?) + # 0 if item is in the list + # 1 if item is not in the list + # + # See stackoverflow.com/questions/8063228/check-if-a-variable-exists-in-a-list-in-bash + #========================================================================= + echo "${2}" | tr ' ' '\n' | grep -F -x -q "${1}" +} + + +function keyValueUpdate() { + + #========================================================================= + # Runs an sed command to update a "key: value" pair in a file + # + # Arguments: + # ${1} : Key + # ${2} : Value + # ${3} : Replacement value + # ${4) : File in which the text is found + #========================================================================= + cmd="s/${1}: ${2}/${1}: ${3}/" + sed -i -e "$cmd" "${4}" +} + + +function speciesToExclude() { + + #======================================================================== + # Returns the list of species to exclude + # + # Arguments: + # ${1} : Species to retain + # + # Returns: + # List of species to exclude + #======================================================================== + + # All species + list=("${ALL_SPECIES[@]}") + + # Keep all species except for the 1st argument + for i in "${!list[@]}"; do + if [[ "x${list[i]}" == "x${1}" ]]; then + unset 'list[i]' + fi + done + + # Print the result (that's how we return strings) + result="" + for spc in "${list[@]}"; do + result+="${spc} " + done + echo $result +} + + +function updateGeosChemConfig() { + + #======================================================================== + # Removes advected species from geoschem_config.yml + # + # Arguments: + # ${1} : List of species to exclude + # ${2} : Path to the run directory + #======================================================================== + + # File to modify + file="${2}/geoschem_config.yml" + + # Remove advected species (use \< and \> for exact match in order + # to prevent inadvertently removing CO2 with when spc is CO. + for spc in ${1}; do + cmd="/\s*\-\s*\<${spc}\>/d" + sed -i -e "${cmd}" "${file}" + done + + # NOTE: CH4 options are already deactivated + # in the out-of-the-box geoschem_config.yml + + # If CO2 is in the exclude list, turn off CO2 options + isItemInList "CO2" "${1}" + if [[ $? == 0 ]]; then + keys=("fossil_fuel_emissions" \ + "ocean_exchange" \ + "balanced_biosphere_exchange" \ + "net_terrestrial_exchange" \ + "ship_emissions" \ + "aviation_emissions" \ + "3D_chemical_oxidation_source" \ + "save_fossil_fuel_in_background" \ + "tag_bio_and_ocean_CO2" \ + "tag_land_fossil_fuel_CO2" \ + "tag_global_ship_CO2" \ + "tag_global_aircraft_CO2" ) + for key in ${keys[@]}; do + keyValueUpdate "${key}" "true" "false" "${file}" + done + fi +} + + +function updateHemcoConfig() { + + #======================================================================== + # Removes advected species from geoschem_config.yml + # + # Arguments: + # ${1} : List of species to exclude + # ${2} : Path to the run directory + #======================================================================== + + # File to be modified + file="${2}/HEMCO_Config.rc" + + # True/False values in the HEMCO extension switches section + true=" true" + false=" false" + + # If CO2 is in the exclude list, turn off CO2 options + # NOTE: This must precede CO to avoid unintended deletions + isItemInList "CO2" "${1}" + if [[ $? == 0 ]]; then + key="--> USE_CO2_DATA " + keyValueUpdate "${key}" "${true}" "${false}" "${file}" + fi + + # If CO is in the exclude list, turn off CO options + isItemInList "CO" "${1}" + if [[ $? == 0 ]]; then + key="--> USE_CO_DATA " + keyValueUpdate "${key}" "${true}" "${false}" "${file}" + fi + + # If CH4 is in the exclude list, turn off CH4 options + isItemInList "CH4" "${1}" + if [[ $? == 0 ]]; then + key="--> USE_CH4_DATA " + keyValueUpdate "${key}" "${true}" "${false}" "${file}" + fi + + # If OCS is in the exclude list, turn off OCS options + isItemInList "OCS" "${1}" + if [[ $? == 0 ]]; then + key="--> USE_OCS_DATA " + keyValueUpdate "${key}" "${true}" "${false}" "${file}" + fi +} + + +function updateHemcoDiagn() { + + #======================================================================== + # Comments out lines for unused species in HEMCO_Diagn.rc + # + # Arguments: + # ${1} : List of species to exclude + # ${2} : Path to the run directory + #======================================================================== + + # File to modify + file="${2}/HEMCO_Diagn.rc" + + # Remove entries for excluded species + exclude=("${1}") + for spc in ${exclude[@]}; do + sed -i "/Emis${spc}_/d" "${file}" + done + sed -i "/#####/d" "${file}" +} + + +function updateHistory() { + + #======================================================================== + # Removes entries in HISTORY.rc for unused species + # + # Arguments: + # ${1} : List of species to exclude + # ${2} : Path to the run directory + #======================================================================== + + # File to be modified + file="${2}/HISTORY.rc" + + # For GCHP: remove entries for species to be excluded + for spc in ${ALL_SPECIES[@]}; do + isItemInList "${spc}" "${1}" + if [[ $? == 0 ]]; then + sed -i "/\_${spc}/d" "${file}" + sed -i "/Emis${spc}/d" "${file}" + fi + done +} + + +function updateExtData() { + + #======================================================================== + # Removes entries in ExtData.rc for unused species (GCHP only) + # + # Arguments: + # ${1} : List of species to exclude + # ${2} : Path to the run directory + #======================================================================== + + # File to be modified + file="${2}/ExtData.rc" + + # Skip if there is no ExtData.rc file (e.g. for GCClassic) + [[ ! -f "${file}" ]] && return 0 + + # If CH4 is in the exclude list, remove CH4 entries. + isItemInList "CH4" "${1}" + if [[ $? == 0 ]]; then + sed -i "/^GHGI_/d" "${file}" + sed -i "/^MEX_/d" "${file}" + sed -i "/^CAN_/d" "${file}" + sed -i "/^GFEI_/d" "${file}" + sed -i "/^EDGAR7_CH4_/d" "${file}" + sed -i "/^CAN_/d" "${file}" + sed -i "/^UPDATED_GFED4_CH4/d" "${file}" + sed -i "/^JPLW_CH4/d" "${file}" + sed -i "/^CH4_/d" "${file}" + sed -i "/^\#CH4_/d" "${file}" + sed -i "/CMIP6_CH4_/d" "${file}" + sed -i "/CMIP6_BB_CH4/d" "${file}" + sed -i "/RCP3PD_CH4/d" "${file}" + sed -i "/RCP45_CH4/d" "${file}" + sed -i "/RCP60_CH4/d" "${file}" + sed -i "/RCP85_CH4/d" "${file}" + fi + + # If CO2 is in the exclude list, remove CO2 entries. + # NOTE: CO2 deletions must prececde CO deletions. + isItemInList "CO2" "${1}" + if [[ $? == 0 ]]; then + sed -i "/AEIC19_DAILY_CO2 /d" "${file}" # trailing space required + sed -i "/AEIC19_MONMEAN_CO2 /d" "${file}" # trailing space required + sed -i "/BBIOCO2_/d" "${file}" + sed -i "/^CEDS_CO2_/d" "${file}" + sed -i "/^CO2_/d" "${file}" + sed -i "/COPROD/d" "${file}" + sed -i "/FOSSILCO2_/d" "${file}" + sed -i "/ICOADS_CO2_/d" "${file}" + sed -i "/OCEANCO2_/d" "${file}" + sed -i "/SIB_BBIO_CO2/d" "${file}" + fi + + # If CO is in the exclude list, remove CO entries + isItemInList "CO" "${1}" + if [[ $? == 0 ]]; then + sed -i "/AEIC19_DAILY_CO /d" "${file}" # trailing space required + sed -i "/AEIC19_MONMEAN_CO /d" "${file}" # trailing space required + sed -i "/APEI_CO/d" "${file}" + sed -i "/^CEDS_CO/d" "${file}" + sed -i "/CMIP6_CO/d" "${file}" + sed -i "/\#DICE_/d" "${file}" + sed -i "/EDGAR_CO/d" "${file}" + sed -i "/EPA16_CO_/d" "${file}" + sed -i "/HTAP_CO_/d" "${file}" + sed -i "/RCP3PD_CO/d" "${file}" + sed -i "/RCP45_CO/d" "${file}" + sed -i "/RCP60_CO/d" "${file}" + sed -i "/RCP85_CO/d" "${file}" + fi + + # If OSC is in the exclude list, remove OCS entries + isItemInList "OCS" "${1}" + if [[ $? == 0 ]]; then + sed -i "/^OCS_/d" "${file}" + fi +} + + +function singleCarbonSpecies() { + + #======================================================================== + # Main function + # + # Arguments: + # ${1} : Species that you wish to retain + # ${2} : Path to the run directory + #======================================================================== + + # Error check arguments + if [[ "x${1}" == "x" ]]; then + echo "Need to pass the species to retain!" + exit 1 + fi + + # Path to the run directory + if [[ "x${2}" == "x" ]]; then + rundir="." + else + rundir="${2}" + fi + + # Get species to exclude + exclude=$(speciesToExclude "${1}") + + # Update configuration files + updateGeosChemConfig "${exclude}" "${rundir}" + updateHemcoConfig "${exclude}" "${rundir}" + updateHemcoDiagn "${exclude}" "${rundir}" + updateHistory "${exclude}" "${rundir}" + updateExtData "${exclude}" "${rundir}" +} diff --git a/test/integration/GCClassic/integrationTestCreate.sh b/test/integration/GCClassic/integrationTestCreate.sh index 350f2d2bd..c7b0dfdc5 100755 --- a/test/integration/GCClassic/integrationTestCreate.sh +++ b/test/integration/GCClassic/integrationTestCreate.sh @@ -169,7 +169,11 @@ create_rundir "4\n1\n1\n1\n${rundirsDir}\n\nn\n" "${log}" create_rundir "2\n1\n1\n1\n${rundirsDir}\n\nn\n" "${log}" # 4x5 merra2 carbon -create_rundir "12\n1\n1\n1\n${rundirsDir}\n\nn\n" "${log}" +create_rundir "12\n1\n1\n1\n1\n${rundirsDir}\n\nn\n" "${log}" + +# 4x5 merra2 carbon CH4 only +dir="gc_4x5_merra2_carbon_CH4only" +create_rundir "12\n2\n1\n1\n1\n${rundirsDir}\n${dir}\nn\n" "${log}" # 4x5 merra2 fullchem create_rundir "1\n1\n1\n1\n1\n${rundirsDir}\n\nn\n" "${log}"