Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for the carbon simulation #1992

Merged
merged 24 commits into from
Apr 4, 2024
Merged

Conversation

yantosca
Copy link
Contributor

@yantosca yantosca commented Oct 16, 2023

Name and Institution (Required)

Name: Bob Yantosca
Institution: Harvard + GCST

Confirm you have reviewed the following documentation

Describe the update

This is the companion PR to #1984 and fixes several issues in the carbon simulation, notably:

  1. Added species ID flags for advected species so that we can block off code that is not relevant to single species simulations
  2. Fixed HEMCO_Config.rc template files for single-species simulations.

Still to do:

  1. Fix issues preventing the GCHP carbon simulations from running
  2. Improve performance in single-species simulations by only doing unit conversions for advected & deposited species

Expected changes

This PR will allow single-species carbon simulations and GCHP carbon simulations to proceed to completion. It will not affect any GEOS-Chem benchmark simulations.

Reference(s)

N/A

Related Github Issue(s)

Tagging @msulprizio @lizziel @hannahnesser @kbowman77

GeosCore/carbon_gases_mod.F90
- For clarity, remove the commented-out tagged species handling
  from the carbon_gases_mod.F90.  We are not planning on adding
  tagged species into the carbon simulation.

Signed-off-by: Bob Yantosca <[email protected]>
GeosCore/carbon_gases_mod.F90
- Removed tagged CO species ID flags
- Added species ID flags id_CH4_adv, id_CO2_adv, id_CO_adv, id_OCS_adv,
  which denote advected species indices
- Use advected species ID flags to block out code that is not relevant
  in single-species simulations

KPP/carbon/carbon_Funcs.F90
KPP/stubs/stub_carbon_Funcs.F90
- Remove id_COch4, id_COnmvoc from carbon_ConvertMolecCm3ToKg

Signed-off-by: Bob Yantosca <[email protected]>
run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
- Remove the USE_CH4_DATA.or.USE_CO2_DATA blocks around the GFED
  extension dry-matter and scaling entries.  GFED biomass is used
  for CH4, CO2, and CO.  For OCS, we will find a way to turn off the
  extension switch in the singleCarbonSpecies.sh script.

Signed-off-by: Bob Yantosca <[email protected]>
@yantosca yantosca added no-diff-to-benchmark This update will not change the results of fullchem benchmark simulations specialty simulations category: Bug Fix Fixes a previously-reported bug labels Oct 16, 2023
@yantosca yantosca self-assigned this Oct 16, 2023
@yantosca
Copy link
Contributor Author

yantosca commented Oct 17, 2023

Update 17 Oct 2023:

  1. When using a single carbon species for CO2, the simulation fails due to CH4-only IF blocks being activated.
    • Solution: define new species ID variables that test if species are advected (e.g. id_CH4_a = Ind_("CH4", "A")), and use these in IF block logic.

This is now fixed in commit 3549162.

1 similar comment
@yantosca
Copy link
Contributor Author

Update 17 Oct 2023:

  1. When using a single carbon species for CO2, the simulation fails due to CH4-only IF blocks being activated.
    • Solution: define new species ID variables that test if species are advected (e.g. id_CH4_a = Ind_("CH4", "A")), and use these in IF block logic.

This is now fixed in commit 3549162.

run/GCHP/createRunDir.sh
- Add the "carbon" simulation to the if block where the env variable
  RUNDIR_INITIAL_RESTART_SPECIES_REQUIRED='0' is set.  This wiil
  allow MAPL to bootstrap missing internal state variables to a
  default value.

Signed-off-by: Bob Yantosca <[email protected]>
This merge brings the dev/no-diff-to-benchmark branch into the
branch for PR #1992 (Fix issues in the carbon simulation, branch
feature/carbon-sim-fixes).  The latest update in the dev/no-diff-to
benchmark was the merge of PR #2062 (Updates from GMAO for GEOS,
by @lizziel.)

Signed-off-by: Bob Yantosca <[email protected]>
@yantosca yantosca linked an issue Jan 9, 2024 that may be closed by this pull request
4 tasks
run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
- Change GHGI_COAST_LIVESTOCK__4A to GHGI_COAST_LIVESTOCK_ENT
- Change GHGI_COAST_LIVESTOCK__4B to GHGI_COAST_LIVESTOCK_MAN
- Change GHGI_EE_LIVESTOCK__4A to GHGI_EE_LIVESTOCK_ENT
- Change GHGI_EE_LIVESTOCK__4B to GHGI_EE_LIVESTOCK_MAN
- Change GHGI_EE_COAST_LIVESTOCK__4A to GHGI_EE_COAST_LIVESTOCK_ENT
- Change GHGI_EE_COAST_LIVESTOCK__4b to GHGI_EE_COAST_LIVESTOCK_MAN
- Remove ((( block around GFED data, GFED can be used for all emissions

run/GCHP/ExtData.rc.templates/ExtData.rc.carbon
- Rename GHGI v2 Express Extension entries from GHGI_* to GHGI_EE_*
- Make sure GHGI_EE_* entries are consistent with HEMCO_Config.rc.carbon
- Remove time refresh entry for CH4_RES_DAM, CH4_RES_SFC; these data
  are annual and only need to be read once
- Add GHGI_*_*_SF scale factor entries to be consistent with
  HEMCO_Config.rc.carbon

Signed-off-by: Bob Yantosca <[email protected]>
@yantosca
Copy link
Contributor Author

yantosca commented Jan 9, 2024

As raised in #2112, we need to fix the CH4 hydropower emissions files to cast the time dimension from int to float or dble, in order for GCHP to read them.

run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
- Set OLSON_LANDMAP to false (this is read by ExtData)
- Set YUAN_MODIS_LAI to false (this is read by ExtData)
- Wrap CO2_COPROD with (((USE_CO2_DATA and )))USE_CO2_DATA
- Wrap CO2_DIURNAL with (((USE_CO2_DATA and )))USE_CO2_DATA
- Wrap CO2_WEEKLY with (((USE_CO2_DATA and )))USE_CO2_DATA
- Wrap AVIATION_SURF_CORR with (((USE_CO2_DATA and )))USE_CO2_DATA

run/GCHP/ExtData.rc.templates/ExtData.rc.carbon
- Fix typo: GHGI_EE_LANDFILLS_MSQ -> GHGI_EE_LANDFILLS_MSW
- Fix typo: GHGI_EE_OTHER__MCOM -> GHGI_EE_OTHER__MCOMB
- Fix typo: GHGI_EE_OTHER__SCOM -> GHGI_EE_OTHER__SCOMB
- Fix typo: GHGI_EE_COAST_LANDFILLS_MSQ -> GHGI_EE_COAST_LANDFILLS_MSW
- Fix typo: GHGI_EE_COAST_OTHER__MCOM -> GHGI_EE_OTHER__MCOMB
- Fix typo: GHGI_EE_OTHER__SCOM -> GHGI_EE_OTHER__SCOMB
- Add "none none" to CH4_RES_DAM and CH4_RES_SFC entries
- Change $y4 to %y4 in GHGI scale factor entries

Signed-off-by: Bob Yantosca <[email protected]>
This commit applies fixes for the problem described in #2115

run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.CH4
run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.CH4
run/GCHP/ExtData.rc.templates/ExtData.rc.carbon
- Remove EDGAR7_CH4_OIL__1B2a, EDGAR7_CH4_OIL__1B2c, and
  EDGAR7_CH4_COAL__1B1a.  These entries read from files which do
  not exist in the EDGARv7 inventory.
- Add entry for EDGAR7_CH4_OILGASCOAL__1B1_1B2, which is the replacement
  for the previous entries.
- NOTE: Normally, these entries are superseded by GFEI, which has
  a higher hierarchy.  But these modifications are necessary if a user
  should ever disable GFEI emissions.

run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.tagCH4
- I wasn't sure how to update these entries, so I put a comment.
  Will get to this later.

Signed-off-by: Bob Yantosca <[email protected]>
run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
- Wrap CO2_CO2PROD entry with (((USE_CO2_DATA and )))USE_CO2_DATA

run/GCHP/ExtData.rc.templates/ExtData.rc.carbon
- Now read CO2_COPROD data from CO2_prod_rates.GEOS5_2x25.72L.nc,
  which is vertically interpolated from the 47L file.

run/shared/settings/gmao_hemco.txt
- Edit RUNDIR_CO2_CO2PROD entry to read CO2_prod_rates.GEOS5_2x25.72L.nc
run/gchp/ExtData.rc.templates/ExtData.rc.carbon
- Fix typo: emi_ch4_1B2b_Natural_Gas_Transmission should have been
  emi_ch4_1B2b_Natural_Gas_TransmissionStorage
- Update indentation of GHGI_EE_* filenames for consistency
- Reactivate the CO2_COPROD entry, and point to the 72L file
  (which was interpolated from the 47L file).

Signed-off-by: Bob Yantosca <[email protected]>
run/GCHP/ExtData.rc.templates/ExtData.rc.carbon
- As in the prior commit (d64bfd6), we needed to fix the variable
  name suffix (Transmission -> TransmissionStorage) for the
  GHGI_EE_COAST_GAS_TRANSMISSION entry.
- Also adjusted indentation to line up filenames for GHGI_EE_*

Signed-off-by: Bob Yantosca <[email protected]>
run/shared/settings/gmao_hemco.txt
- Change filename suffix for RUNDIR_GLOBAL_* entries:
  $YYYY$MM$DD -> $YYYY$MM01.  This is because these data are archived
  as monthly means and not daily files.

run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
- The GLOBAL_OH entry now reads from OH_3Dglobal.geos5.72L.4x5.nc OH.
  NOTE: This file path is ignored by GCHP, but this edit was made for
  consistency with the entry in the ExtData.rc file.

Signed-off-by: Bob Yantosca <[email protected]>
@yantosca yantosca linked an issue Jan 17, 2024 that may be closed by this pull request
4 tasks
run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
- Renamed the NEI2016_MONMEAN "CONUS_MASK" to "NEI_CONUS_MASK"
  in order to avoid a namespace collision w/ the GHGI CONUS MASK
  that would occur if NEI2016_MONMEAN is ever activated.

Signed-off-by: Bob Yantosca <[email protected]>
run/shared/singleCarbonSpecies.sh
- If CH4 is excluded, also remove these entries from ExtData.rc:
  - EMIS_SF, OH_SF, CH4_LOSS, GLOBAL_Cl, MANURE_SF, RICE_SF,
    EDGAR_SEASONAL_SF, CONUS_
- If CO2 is excluded, also remove these entries from ExtData.rc:
  - AVIATION_SURF_CORR
- If CO is excluded, also remove these entries from ExtData.rc:
  - PCO_CH4, PCO_NMVOC, GMI_LOSS_CO, GMI_PROD_CO, NEI99_DOW_CO, LIQFUEL_
- If OCS is excluded, also remove these entries from ExtData.rc:
  - StoOCS

This should prevent GCHP errors caused by ExtData.rc entries for other
species except the one being kept in a single-species carbon simulation.

Signed-off-by: Bob Yantosca <[email protected]>
run/shared/singleCarbonSpecies.sh
- Now only loop over the exclude list in function updateHistory
- Do not remove CH4_LOSS, GLOBAL_Cl, PCO_CH4, PCO_NMVOC,
  GMI_LOSS_CO, GMI_PROD_CO containers from ExtData.rc.  These are
  needed for chemistry inputs.

Signed-off-by: Bob Yantosca <[email protected]>
run/GCClassic/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
run/GCHP/HEMCO_Config.rc.templates/HEMCO_Config.rc.carbon
- Update file paths of certain inventories to use the corrected
  netCDF files in the HEMCO/CH4/v2024-01 subdirs
- Reorder scale factors section by CH4, CO, CO2, and wrap with
  (((USE_CH4_DATA, (((USE_CO_DATA, (((USE_CO2_DATA blocks.
- Comment out unused scale factors for EDGARv7

run/GCHP/ExtData.rc.templates/ExtData.rc.carbon
- Remove entries that are not defaults
- Also add comments to remind user to comment out entries
  when correspoinding entries in HEMCO_Config.rc are turned off

Signed-off-by: Bob Yantosca <[email protected]>
Copy link

stale bot commented Mar 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. If there are no updates within 7 days it will be closed. You can add the "never stale" tag to prevent the Stale bot from closing this issue.

@stale stale bot added the stale No recent activity on this issue label Mar 13, 2024
@yantosca yantosca added never stale Never label this issue as stale and removed stale No recent activity on this issue labels Mar 13, 2024
1. Deactivate saving SpeciesConcMND_* fields by default. This will reduce
   output file size.
2. Define the metrics diagnostic in GCHP's HISTORY.rc.carbon. That collection
   was listed at the top of the file but never defined below.

Signed-off-by: Melissa Sulprizio <[email protected]>
Run directories for carbon and CH4 simulations are now created for GCHP
integration tests. Additionally, minor changes have been made to script
integrationTestCreate.sh for both GCClassic and GCHP to make the two
versions consistent. Finally, GCHP's createRunDir.sh script has been
updated to name run directories in a consistent manner as in GCClassic.
That is, we now name GCHP run directories with gchp_met_sim-name (rather
than gchp_sim-name_met. This way, sim-extra-option strings are appended
immediately after sim-name strings.

Signed-off-by: Melissa Sulprizio <[email protected]>
@msulprizio
Copy link
Contributor

msulprizio commented Mar 27, 2024

I pushed a few additional fixes to HISTORY.rc and added carbon and carbon with CH4 only simulations to the GCHP integration tests. These simulations now run successfully and pass integration tests:

==============================================================================
GCHP: Execution Test Results

GCHP      #14cb756 Update version number to 14.3.0 in preparation for release
GEOS-Chem #96eabd7ac Activate carbon and CH4 integration tests for GCHP
HEMCO     #f807e1a Update HEMCO version number to 3.8.0 in preparation for release

Number of execution tests: 4

Submitted as SLURM job: 25321342
==============================================================================
 
Execution tests:
------------------------------------------------------------------------------
gchp_merra2_carbon..................................Execute Simulation....PASS
gchp_merra2_carbon_CH4..............................Execute Simulation....PASS
gchp_merra2_tagO3...................................Execute Simulation....PASS
gchp_merra2_TransportTracers........................Execute Simulation....PASS
 
Summary of test results:
------------------------------------------------------------------------------
Execution tests passed: 4
Execution tests failed: 0

@msulprizio msulprizio changed the title [WIP] Fixes for the carbon simulation Fixes for the carbon simulation Mar 27, 2024
@msulprizio msulprizio changed the base branch from dev/no-diff-to-benchmark to dev/14.4.0 March 27, 2024 14:54
1. HEMCO_Config.rc.CH4 contained an erroneous logical for USE_CH4_DATA that
   likely came in when syncing with the HEMCO_Config.rc.carbon file.
2. The date string in the CAN_MASK_MIRROR entry was incorrect in
   HEMCO_Config.rc.tagCH4 (v20 should be v2024-01).

Also increased memory requested in GCHP integration test to avoid out-of-
memory errors.

Signed-off-by: Melissa Sulprizio <[email protected]>
@msulprizio msulprizio marked this pull request as ready for review March 28, 2024 13:30
@msulprizio
Copy link
Contributor

msulprizio commented Mar 28, 2024

All GCClassic and GCHP integration tests on this branch now pass.

Note that now GCHP integration tests include the carbon and carbon with CH4 only simulations:

==============================================================================
GCHP: Execution Test Results

GCHP      #24d40b7 GEOS-Chem submod update: Merge PR #2211 (Initialize PBL variables)
GEOS-Chem #8a832f3b5 Fix typos in HEMCO_Config.rc for CH4 and tagCH4 simulations
HEMCO     #f807e1a Update HEMCO version number to 3.8.0 in preparation for release

Number of execution tests: 8

Submitted as SLURM job: 25420396
==============================================================================
 
Execution tests:
------------------------------------------------------------------------------
gchp_merra2_carbon..................................Execute Simulation....PASS
gchp_merra2_carbon_CH4..............................Execute Simulation....PASS
gchp_merra2_fullchem................................Execute Simulation....PASS
gchp_merra2_fullchem_benchmark......................Execute Simulation....PASS
gchp_merra2_fullchem_RRTMG..........................Execute Simulation....PASS
gchp_merra2_fullchem_TOMAS15........................Execute Simulation....PASS
gchp_merra2_tagO3...................................Execute Simulation....PASS
gchp_merra2_TransportTracers........................Execute Simulation....PASS
 
Summary of test results:
------------------------------------------------------------------------------
Execution tests passed: 8
Execution tests failed: 0
Execution tests not yet completed: 0

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%  All execution tests passed!  %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CHANGELOG.md Show resolved Hide resolved
GeosCore/carbon_gases_mod.F90 Show resolved Hide resolved
GeosCore/carbon_gases_mod.F90 Show resolved Hide resolved
run/GCHP/ExtData.rc.templates/ExtData.rc.carbon Outdated Show resolved Hide resolved
run/GCHP/ExtData.rc.templates/ExtData.rc.carbon Outdated Show resolved Hide resolved
run/GCHP/ExtData.rc.templates/ExtData.rc.carbon Outdated Show resolved Hide resolved
1. Added additional updates to CHANGELOG.md
2. Added comment in carbon_gases_mod.F90 to explain difference between id_*
   and id_*_adv values.
3. Removed unused reference to Ind_ in carbon_gases_mod.F90
4. Clean up comments in ExtData.rc.carbon

Signed-off-by: Melissa Sulprizio <[email protected]>
@msulprizio msulprizio requested a review from lizziel March 28, 2024 17:34
@kbowman77
Copy link

@msulprizio what does carbon with CH4 only simulation mean? Is there an equivalent simulation for the other carbon species?

@msulprizio
Copy link
Contributor

@kbowman77 The out-of-the-box carbon simulation includes CH4, CO, CO2, and OCS. Users may also choose to run the carbon simulation with individual species (CH4 only, CO2 only, etc.) to reproduce the preexisting specialty simulations.

I have been validating the traditional CH4 simulation against the carbon simulation (both with all species and with CH4 only) to confirm there are minimal, if any, differences. We would like the same to be done for the other carbon species.

@kbowman77
Copy link

kbowman77 commented Mar 29, 2024 via email

@msulprizio msulprizio added this to the 14.4.0 milestone Mar 29, 2024
@yantosca
Copy link
Contributor Author

@kbowman77: We are going to bring the carbon simulation updates into the 14.4.0 development stream following the 14.3.1 release. 14.3.1 contains some bug fixes and other updates e.g. to facilitate connecting GEOS-Chem to external models. We hope to do this in the next week or so (fingers crossed).

@yantosca yantosca added the topic: Carbon Gases Simulations Related to simulations with carbon gases (carbon, CO2, CH4, tagCH4, tagCO) label Mar 29, 2024
@msulprizio msulprizio merged commit 64796d8 into dev/14.4.0 Apr 4, 2024
@msulprizio msulprizio deleted the feature/carbon-sim-fixes branch April 4, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Bug Fix Fixes a previously-reported bug never stale Never label this issue as stale no-diff-to-benchmark This update will not change the results of fullchem benchmark simulations topic: Carbon Gases Simulations Related to simulations with carbon gases (carbon, CO2, CH4, tagCH4, tagCO)
Projects
None yet
4 participants