geoschem / HEMCO

The Harmonized Emissions Component (HEMCO), developed by the GEOS-Chem Support Team.
https://hemco.readthedocs.io
Other
16 stars 32 forks source link

[BUG/ISSUE] Possible parallelization (or precision) bug in MEGAN affecting biogenic MOH #78

Closed yantosca closed 2 years ago

yantosca commented 3 years ago

I think I may have discovered an issue in the HEMCO MEGAN extension. There seems to be either a precision or a parallelization error affecting biogenic MOH (methanol). The following snippet of my differences log (full file here] shows the full set of differences between my Ref run and Dev run (which skips chemistry).

Variable               Ref=run_ref_20m          Dev=run_dev_20m          Dev-Ref
EmisACET_Biogenic    : 2.1356122e-12          | 2.1356122e-12          | 0.0 
EmisALD2_Biogenic    : 6.471076e-13           | 6.471076e-13           | 0.0 
EmisEOH_Biogenic     : 6.468924e-13           | 6.468924e-13           | 0.0 
EmisISOP_Biogenic    : 8.184055e-12           | 8.184055e-12           | 0.0 
EmisLIMO_Biogenic    : 4.7234845e-13          | 4.7234845e-13          | 0.0 
EmisMOH_Biogenic     : 3.6319125e-12          | 3.6494805e-12          | 1.756797832208612e-14 
EmisMTPA_Biogenic    : 3.53478e-12            | 3.53478e-12            | 0.0 
EmisMTPO_Biogenic    : 1.5019414e-12          | 1.5019414e-12          | 0.0 
EmisPRPE_Biogenic    : 1.0279757e-12          | 1.0279757e-12          | 0.0 
EmisSOAP_Biogenic    : 4.7507186e-13          | 4.7507186e-13          | 0.0 
EmisSOAS_Biogenic    : 4.7507186e-13          | 4.7507186e-13          | 0.0 

In each column is the sum of the each diagnostic array in both Ref & Dev codes, and the difference. I use this as a quick check... where I see zeroes means that all elements of the diagnostic array in both Def & Rev are equal.

In these runs, both OFFLINE_BIOGENICVOC and MEGAN were turned on. I tried turning off OFFLINE_BIOGENICVOC while keeping MEGAN turned on (in both Dev & Ref), but still found different total values for MOH:

EmisMOH_Biogenic     : 3.644906e-12           | 3.642867e-12           | -2.0391674460107367e-15

I've also tried commenting out the code where MOH is returned from GET_MEGAN_EMISSIONS

       ! ---------------------------------------------------
       ! MEGAN Methanol
       IF ( Inst%IDTMOH > 0 ) THEN
          CALL GET_MEGAN_EMISSIONS( HcoState, ExtState, &
                                    Inst, I, J, 'MOH', EMIS_MOH, RC)
          IF ( RC /= HCO_SUCCESS ) THEN
             CALL HCO_ERROR( HcoState%Config%Err,  &
                             'GET_MEGAN_EMISSIONS_MOH', RC )
             ERR = .TRUE.
             EXIT
          ENDIF

          ! Add to tracer tendency array [kg/m2/s]
          Inst%FLUXMOH(I,J) = EMIS_MOH
       ENDIF

in both my Dev & Ref codes but that didn't prevent the difference in MOH.

I found that the only way to prevent differences in Dev & Ref is to turn off OFFLINE_BIOGENICVOC and the MEGAN extension. I'll do that for further testing, as I need to have zero diffs before making a bunch of changes to chemistry (so that I can be sure that any diffs are from chemistry and not emissions).

Also I should mention, the error is apparent after only one emissions timestep (20 minutes).

@msulprizio, @lizziel, @jimmielin

yantosca commented 3 years ago

Also see #109

lizziel commented 2 years ago

I am testing output from identical runs in 13.3.0-alpha.12 and am not able to reproduce differences in MOH emissions. I will close out this issue now since it seems to be fixed.