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 error in MEGAN extension #109

Closed yantosca closed 2 years ago

yantosca commented 3 years ago

While debugging the HMS chemistry for GEOS-Chem 13.3.0, I noticed that there may be a possible parallelization error in the HEMCO emissions extension (HEMCO/src/Extensions/hcox_megan_mod.F90). Below is shown some the output of debug print statements at grid box (64,16).

       !--------------------------------------------------------------------
       ! MEGAN Isoprene
       !--------------------------------------------------------------------

       ! Isoprene [kg/m2/s]
       CALL GET_MEGAN_EMISSIONS( HcoState, ExtState, Inst, &
                                 I, J, 'ISOP', EMIS_ISOP, RC )
       IF ( RC /= HCO_SUCCESS ) THEN
          CALL HCO_ERROR( HcoState%Config%Err, &
                          'GET_MEGAN_EMISSIONS_ISOP', RC )
          ERR = .TRUE.
          EXIT
       ENDIF

       IF ( I == 64 .and. J == 16 ) THEN
          print*, '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
          print*, '@@@ debug box         : ', I, J
          print*, '@@@ EMIS_ISOP         : ', EMIS_ISOP
       ENDIF

       !FP_ISOP (6/2009)
       EMIS_ISOP = Inst%ISOP_SCALING * EMIS_ISOP

       ! Write isoprene emissions into tracer tendency array
       IF ( Inst%IDTISOP > 0 ) THEN
          Inst%FLUXISOP(I,J) = EMIS_ISOP
       ENDIF

       ! Biogenic emissions of SOA and SOA-Precursor from isopene
       ! NOTE: These emission factors appear to be based on emissions
       !  in kgC/m2/s. Convert from kg/m2/s to kgC/m2/s.
       IF ( (Inst%IDTISOP>0) .AND. (Inst%IDTSOAP>0) ) THEN
          Inst%FLUXSOAP(I,J) = Inst%FLUXSOAP(I,J) + &
               ( EMIS_ISOP * MONOtoC ) * Inst%ISOPTOSOAP
       ENDIF
       IF ( (Inst%IDTISOP>0) .AND. (Inst%IDTSOAS>0) ) THEN
          Inst%FLUXSOAS(I,J) = Inst%FLUXSOAS(I,J) + &
               ( EMIS_ISOP * MONOtoC ) * Inst%ISOPTOSOAS
       ENDIF

       IF ( I == 64 .and. J == 16 ) THEN
          print*, '@@@ EMIS_ISOP, scaled : ', EMIS_ISOP
          print*, '@@@ Inst%FLUXISOP     : ', Inst%FluxISOP(I,J)
          print*, '@@@ MonoToC           : ', MonoToC
          print*, '@@@ Inst%ISOPtoSOAP   : ', Inst%ISOPtoSOAP 
          print*, '@@@ Inst%FLUXSOAP     : ', Inst%FluxSOAP(I,J)
          print*, '@@@ Inst%ISOPtoSOAS   : ', Inst%ISOPtoSOAS 
          print*, '@@@ Inst%FluxSOAS     : ', Inst%FluxSOAS(I,J)
       ENDIF

As you can see, a run with parallelization off and parallelization on (in GEOS-Chem Classic) gives different results for the same grid box.

threads = 1
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 @@@ debug box         :           64          16
 @@@ EMIS_ISOP         :    5.8587319979935122E-012
 @@@ EMIS_ISOP, scaled :    5.8587319979935122E-012
 @@@ Inst%FLUXISOP     :    5.8587319979935122E-012
 @@@ MonoToC           :   0.88066930867459270     
 @@@ Inst%ISOPtoSOAP   :    1.7009999155998230E-002
 @@@ Inst%FLUXSOAP     :    8.7764884492372937E-014
 @@@ Inst%ISOPtoSOAS   :    1.7009999155998230E-002
 @@@ Inst%FluxSOAS     :    8.7764884492372937E-014

threads = 6
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 @@@ debug box         :           64          16
 @@@ EMIS_ISOP         :    5.8591508679011592E-012
 @@@ EMIS_ISOP, scaled :    5.8591508679011592E-012
 @@@ Inst%FLUXISOP     :    5.8591508679011592E-012
 @@@ MonoToC           :   0.88066930867459270     
 @@@ Inst%ISOPtoSOAP   :    1.7009999155998230E-002
 @@@ Inst%FLUXSOAP     :    8.7771159240744168E-014
 @@@ Inst%ISOPtoSOAS   :    1.7009999155998230E-002
 @@@ Inst%FluxSOAS     :    8.7771159240744168E-014

@msulprizio and I were thinking that this may have come in with one of the recent MEGAN updates or LAI updates. This issue may have also gone undetected for a long time.

stale[bot] commented 2 years ago

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[bot] commented 2 years ago

Closing due to inactivity