geoschem / geos-chem

GEOS-Chem "Science Codebase" repository. Contains GEOS-Chem science routines, run directory generation scripts, and interface code. This repository is used as a submodule within the GCClassic and GCHP wrappers, as well as in other modeling contexts (external ESMs).
http://geos-chem.org
Other
169 stars 165 forks source link

[BUG/ISSUE] Restart files in Hg simulation #957

Closed CharikleiaGRN closed 3 years ago

CharikleiaGRN commented 3 years ago

Dear all,

I would like to make a question. I am using geos chem 13.0.2 for mercury simulation on 2x2.5 grid.

my mercury menu in input.geos is the following:

%%% MERCURY MENU %%% :
Error check tag/tot Hg? : F
Use dynamic ocean Hg? : F
Preindustrial sim? : F
Use GTMM soil model? : F
GTMM Hg rst file (bpch) : GTM.totHg.YYYYMMDDhh
Use Arctic river Hg? : T
Tie HgII(aq) red to UVB?: T.

The error reported is about the restart files and related with the snowpack hg source.

Restart.filename: './GEOSChem.Restart.%y4%m2%d2_%h2%n2z.nc4',
Restart.format: 'CFIO',
Restart.frequency: 00000100 000000
Restart.duration: 00000100 000000
Restart.mode: 'time-averaged'
Restart.fields: 'SpeciesRst_?ALL? ', 'GIGCchem',
'Met_DELPDRY ', 'GIGCchem',
'Met_PS1WET ', 'GIGCchem',
'Met_PS1DRY ', 'GIGCchem',
'Met_SPHU1 ', 'GIGCchem',
'Met_TMPU1 ', 'GIGCchem',
# 'Chem_OceanHg0 ', 'GIGCchem',
# 'Chem_OceanHg2 ', 'GIGCchem',
# 'Chem_OceanHgP ', 'GIGCchem',
# 'Chem_SnowHgOcean ', 'GIGCchem',
# 'Chem_SnowHgLand ', 'GIGCchem',
# 'Chem_SnowHgOceanStored ', 'GIGCchem',
# 'Chem_SnowHgLandStored ', 'GIGCchem',

When the restart fields are including ONLY the SpeciesRst_Hg0-Hg2-HgP and the MET fields, the simulation is running.

When I add the 'Chem_OceanHg0 ', 'Chem_OceanHg2 ','Chem_OceanHgP ', 'GIGCchem' 'Chem_SnowHgOcean ', 'Chem_SnowHgLand ', 'Chem_SnowHgOceanStored ', 'Chem_SnowHgLandStored ', I am getting the following error for each one of the snow/ocean variables:

HISTORY (INIT): Opening ./HISTORY.rc
===============================================================================
GEOS-Chem ERROR: CHEM_OCEANHG0 is not found in the registry for the CHEM object!
-> at Registry_Lookup (in Headers/registry_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR: Could not locate Chem_OceanHg0 chemistry state registry.
-> History_AddItemToCollection (in History/history_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR: Could not add diagnostic "Chem_OceanHg0" to collection: Restart
-> at History_ReadCollectionData (in module History/history_mod.F90)

-> ERROR occurred at (or near) line 70 of the HISTORY.rc file
===============================================================================

Is it a variable name bug, the way things are computed changed or I am doing something wrong??Is it sure that this, is not affecting the other mechanisms and the results?

Looking forward to your reply,

Thank you very much!

yantosca commented 3 years ago

Thanks for writing @HarrietGRN. For the restart files, variable names have to start with SpeciesRst_. So SpeciesRst_OceanHg0, etc.

CharikleiaGRN commented 3 years ago

I tried it now. I get the same error.

Restart.filename:           './GEOSChem.Restart.%y4%m2%d2_%h2%n2z.nc4',
  Restart.format:             'CFIO',
  Restart.frequency:          00000100 000000
  Restart.duration:           00000100 000000
  Restart.mode:               'time-averaged'
  Restart.fields:             'SpeciesRst_?ALL?               ', 'GIGCchem',
                              'Met_DELPDRY                    ', 'GIGCchem',
                              'Met_PS1WET                     ', 'GIGCchem',
                              'Met_PS1DRY                     ', 'GIGCchem',
                              'Met_SPHU1                      ', 'GIGCchem',
                              'Met_TMPU1                      ', 'GIGCchem',
                              'SpeciesRst_OceanHg0', 'GIGCchem',
                              'SpeciesRst_OceanHg2', 'GIGCchem',
                              'SpeciesRst_OceanHgP                  ', 'GIGCchem',
                              'SpeciesRst_SnowHgOcean               ', 'GIGCchem',
                              'SpeciesRst_SnowHgLand                ', 'GIGCchem',
                              'SpeciesRst_SnowHgOceanStored         ', 'GIGCchem',
                              'SpeciesRst_SnowHgLandStored          ', 'GIGCchem',
HISTORY (INIT): Opening ./HISTORY.rc
===============================================================================
GEOS-Chem ERROR: SPECIESRST_OCEANHG0 is not found in the registry for the DIAG object!
 -> at Registry_Lookup (in Headers/registry_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR: Could not locate SPECIESRST_OCEANHG0 diagnostics state registry.
 -> History_AddItemToCollection (in History/history_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR: Could not add diagnostic "SPECIESRST_OCEANHG0" to collection: Restart
 -> at History_ReadCollectionData (in module History/history_mod.F90)

 -> ERROR occurred at (or near) line     70 of the HISTORY.rc file
===============================================================================

===============================================================================
GEOS-Chem ERROR: Error encountered in "History_ReadCollectionData"!
 -> at History_Init (in module History/history_mod.F90)
===============================================================================

===============================================================================
GEOS-CHEM ERROR: Error encountered in "History_Init"!
STOP at  -> at GEOS-Chem (in GeosCore/main.F90)
===============================================================================
yantosca commented 3 years ago

I was able to reproduce this issue. It seems that the various State_Chm%OceanHg0 etc. fields have not been registered for the diagnostics. This was probably an oversight or was lost in the shuffle as we modernized the code. I can work on a solution.

yantosca commented 3 years ago

Actually upon further review, these fields should be getting registered in this code in state_chm_mod.F90 (at least it is in v13):

https://github.com/geoschem/geos-chem/blob/ba58da4a6e447e47714fe5e7da488d15432a6fdc/Headers/state_chm_mod.F90#L2378-L2648

I can look into why this isn't working further.

yantosca commented 3 years ago

It looks like there is an issue in the wildcarding of the species

 CHEM_SNOWHGLANDSTORED_         | Non-reducible Hg sno | xy    | kg
 CHEM_SNOWHGOCEANSTORED_        | Non-reducible Hg sno | xy    | kg
 CHEM_SNOWHGLAND_               | Reducible Hg snowpac | xy    | kg
 CHEM_SNOWHGOCEAN_              | Reducible Hg snowpac | xy    | kg
 CHEM_OCEANHGP_                 | HgP ocean mass       | xy    | kg
 CHEM_OCEANHG2_                 | Hg(II) ocean mass    | xy    | kg
 CHEM_OCEANHG0_                 | Hg(0) ocean mass     | xy    | kg
yantosca commented 3 years ago

This issue should now be fixed with commit 51fa209141a075c0b39c2ef0622137e9ae11e886. The issue was that we were trying to add a second underscore into the diagnostic name, but the second but this is not necessary. I will merge this into 13.3.1.

NOTE: The tagged Hg simulation now appears to be broken but we look to the community to fix this.

yantosca commented 3 years ago

PR #986 has now been merged into the 13.3.1 development stream, so we can close this issue.

CharikleiaGRN commented 3 years ago

Ciao again!

I made the modifications in 13.0.2 code and it now reads and feeds the snowpack and ocean variables. However, I used a produced restart file to set up a new simulation and I am getting another error for the restart file. I am wondering whether I am missing another related bug fix or we still have work to do for Hg simulation or I am doing something wrong.

restartfiles.txt HEMCO.log

Thank you!!!!!

yantosca commented 3 years ago

@CharikleiaGRN, try changing the time cycle flag for the SPC_RST entry in your HEMCO_Config.rc file to CYS. In GEOS-Chem 13 we added some checks to make sure that the run will stop if the restart file time does not match the simulation time. See issue #971.

CharikleiaGRN commented 3 years ago

I will check it out now. thanks for the answer.