Closed ohsangik98 closed 2 months ago
Additionally, there is a discrepancy in CH4 molar mass in global_ch4_mod.F90 and species_database.yml.
This doesn't affect my issue, which does not include any loss process to examine mass conservation. But it may cause a little issue in calculating the CH4 budget.
Thank you.
Thanks for reporting this @ohsangik98. We are also looking into this on our end and will update here.
Hi @ohsangik98 - I am able to replicate this lack of mass conservation in version 14.4.2. I ran 1 month simulations for January 2019 with all losses turned off (both the soil sink and 3D losses). In the first case, I also turn off emissions to show the minor noise from transport. In the other case, I leave emissions on and the mass balance gets progressively worse (linear plus some noise). Here, mass balance = mass(t=t) - mass(t=0) - sum(emissions(t=0:t))
.
I'm not sure what is causing this. Maybe it is related to HEMCO precision (described here and here), but I'm not sure if we would expect a precision issue to accumulate linearly like this (@jimmielin). What do you think @msulprizio @yantosca @lizziel? Happy to take a look elsewhere or try different tests if you have suggestions.
In case this is an accounting issue, here is the code used for running GC and for calculating the mass balance.
Thanks @nicholasbalasus for looking into this. We saw this during the implementation of flexible precision, which allows you to toggle between REAL*4
and REAL*8
at compile time. But in practice the REAL*4
precision leads to truncation that causes mass non-conservation.
One of our development items is to allow HEMCO to save output at either REAL*4
or REAL*8
. Right now it can only save out REAL*4
. This would likely remove the issue. @jimmielin @lizziel please feel free to comment further.
Thanks for all the advice from @yantosca and the GEOS-Chem team.
I just checked mass discrepancies between the three options below :
Thanks again for solving the issue.
Agreed! Thanks for finding this @ohsangik98!
Hi all. It seems that moving the HEMCO-specific code out of the vdiff_mod.F90
may be contributing to this error. Especially when emissions are turned off.
@msulprizio wrote:
Jintai Lin's original fix (in VDIFF, to correct for mass conservation) was fairly straightforward and can be seen here.
One thing that stands out to me is the description of the variable
sum_qp0
added by Jintai which says “total mass in the PBL (ignoring the v/v -> m/m conversion) including pre-mixing mass and surface flux (emis+drydep)”. I reviewed all changes tovdiff_mod.F90
since then and found that the HEMCO code (i.e. emissions/drydep) was removed in #311. This is part of an ongoing issue I believe (see #327). I wonder if this is contributing to the reintroduction of the mass conservation issue?
For now, we would recommend using TURBDAY for the CH4, CO2, or carbon simulations until we can provide a fix.
A quick fix might be to activate the HEMCO-specific code on each timestep but bracket out the HEMCO-specific part if emissions are turned off. Then that should allow for the drydep to be applied.
@ohsangik98 @nicholasbalasus @msulprizio: I've printed out the values of State_Chm%SurfaceFlx
(which is computed in the routine Surface_Flux_for_VDIFF
as emissions flux - drydep flux. These do not change with time for the CH4 simulation:
444: sflx TRACER 1 : 7.3325212413926914E-008
451: sflx TRACER 1 : 7.3325212413926914E-008
458: sflx TRACER 1 : 7.3325212413926914E-008
465: sflx TRACER 1 : 7.3325212413926914E-008
472: sflx TRACER 1 : 7.3325212413926914E-008
479: sflx TRACER 1 : 7.3325212413926914E-008
487: sflx TRACER 1 : 7.3325212413926914E-008
494: sflx TRACER 1 : 7.3325212413926914E-008
501: sflx TRACER 1 : 7.3325212413926914E-008
508: sflx TRACER 1 : 7.3325212413926914E-008
515: sflx TRACER 1 : 7.3325212413926914E-008
522: sflx TRACER 1 : 7.3325212413926914E-008
530: sflx TRACER 1 : 7.3325212413926914E-008
537: sflx TRACER 1 : 7.3325212413926914E-008
544: sflx TRACER 1 : 7.3325212413926914E-008
551: sflx TRACER 1 : 7.3325212413926914E-008
558: sflx TRACER 1 : 7.3325212413926914E-008
565: sflx TRACER 1 : 7.3325212413926914E-008
579: sflx TRACER 1 : 7.3325212413926914E-008
586: sflx TRACER 1 : 7.3325212413926914E-008
593: sflx TRACER 1 : 7.3325212413926914E-008
600: sflx TRACER 1 : 7.3325212413926914E-008
607: sflx TRACER 1 : 7.3325212413926914E-008
614: sflx TRACER 1 : 7.3325212413926914E-008
622: sflx TRACER 1 : 7.3325212413926914E-008
...
So this would lead me to believe that the non-conservation issue is in vdiff_mod.F90
I was able to check out and build the version of the code in which Jintai's updates went in (13.0.0-alpha.11). I had to manually comment out the places where we obtained the pointers to HEMCO in global_ch4_mod.F90
, Here we see that mass is conserved:
GC.log:972: ### CH4 after: 0.23785176364278848
GC.log:978: ### CH4 after: 0.23785206996431299
GC.log:984: ### CH4 after: 0.23785237635125683
GC.log:990: ### CH4 after: 0.23785268278374674
GC.log:996: ### CH4 after: 0.23785298925073003
GC.log:1002: ### CH4 after: 0.23785329574364100
GC.log:1009: ### CH4 after: 0.23785360244275555
GC.log:1015: ### CH4 after: 0.23785390892200831
GC.log:1021: ### CH4 after: 0.23785421537156171
GC.log:1027: ### CH4 after: 0.23785452180508559
GC.log:1033: ### CH4 after: 0.23785482822573739
GC.log:1039: ### CH4 after: 0.23785513463368330
GC.log:1046: ### CH4 after: 0.23785544268393111
GC.log:1052: ### CH4 after: 0.23785574982498067
GC.log:1058: ### CH4 after: 0.23785605663713910
GC.log:1064: ### CH4 after: 0.23785636328042969
GC.log:1070: ### CH4 after: 0.23785666982252773
GC.log:1076: ### CH4 after: 0.23785697629723396
GC.log:1089: ### CH4 after: 0.23785728537366271
GC.log:1095: ### CH4 after: 0.23785759530267203
GC.log:1101: ### CH4 after: 0.23785790312041294
GC.log:1107: ### CH4 after: 0.23785821073887994
GC.log:1113: ### CH4 after: 0.23785851823728288
...
Also, the surface fluxes (emissions - drydep) that are passed into VDIFF are constant, as they are in the current code:
971: sflx TRACER 1 : 7.5654374078286164E-008
977: sflx TRACER 1 : 7.5654374078286164E-008
983: sflx TRACER 1 : 7.5654374078286164E-008
989: sflx TRACER 1 : 7.5654374078286164E-008
995: sflx TRACER 1 : 7.5654374078286164E-008
1001: sflx TRACER 1 : 7.5654374078286164E-008
1008: sflx TRACER 1 : 7.5654374078286164E-008
1014: sflx TRACER 1 : 7.5654374078286164E-008
1020: sflx TRACER 1 : 7.5654374078286164E-008
1026: sflx TRACER 1 : 7.5654374078286164E-008
1032: sflx TRACER 1 : 7.5654374078286164E-008
1038: sflx TRACER 1 : 7.5654374078286164E-008
1045: sflx TRACER 1 : 7.5654374078286164E-008
1051: sflx TRACER 1 : 7.5654374078286164E-008
1057: sflx TRACER 1 : 7.5654374078286164E-008
1063: sflx TRACER 1 : 7.5654374078286164E-008
...
@msulprizio @nicholasbalasus: I am trying to find what is different in vdiff_mod.F90
between these 2 versions but if you have any insights, please let me know. I may try putting debug printout in both to see what happens.
Also note: emissions are different in the 2 versions but that shouldn't matter as much as we are looking for trends in mass.
This looks like it still exists back to 13.0.0 at least.
Just a quick clarification that Jintai's original mass conservation fix for non-local PBL mixing went into 12.1.0, not 13.0.0. See the original wiki post archived here.
The removal of the HEMCO code from vdiff_mod.F90 did go into 13.0. Since @nicholasbalasus found that the conservation issue is present in that version that still supports the theory that those updates may a have reintroduced the discrepancies in mass.
This unfortunately predates those changes and is present in at least 12.9.0. Thanks to @yantosca for knowing how to set up a 12.9.0 run directory :)
Thanks for everyone's effort.
When I printed the scale factor calculated by Jintai's mass conservation fix part, I found that it has a smaller order than mass unbalance scale, leading me to believe that the Jintai part is not the cause of our issue.
(Sorry for not attaching any plot or file.. I'm not available right now)
We can now close this issue as PR #2428 has been merged into the 14.5.0 development stream.
Your name
Sang-Ik, Oh
Your affiliation
Seoul National University, South Korea
What happened? What did you expect to happen?
I appreciate your efforts for GEOS-Chem.
The sums of methane mass have a difference between the one calculated from the HEMCO_diagonstics file, and the one derived from the SpeciesConc output.
I ran a CH4 specialty simulation for a month (2010.01.01~2010.02.01) without any chemical decaying. Then, I calculated the total mass of methane which was emitted during a month in two ways.
I archived the output of StatMet and SpeciesConc in an 'instantaneous' format. It is thought to be the same between two mass values.
I checked the log file with verbose mode and HEMCO/GC source files... but I couldn't find a potential reason, unfortunately.
What are the steps to reproduce the bug?
Run CH4 simulation with the options
Please attach any relevant configuration and log files.
HEMCO_Config.txt log.txt check_tag_sum_py.txt
I attach configuration, log, and simple Python code.
What GEOS-Chem version were you using?
14.3.1
What environment were you running GEOS-Chem on?
Local cluster
What compiler and version were you using?
ifort 15.0.0
Will you be addressing this bug yourself?
Yes
In what configuration were you running GEOS-Chem?
GCClassic
What simulation were you running?
CH4
As what resolution were you running GEOS-Chem?
2x2.5
What meterology fields did you use?
MERRA-2
Additional information
No response