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

Bug fixes for Prod/Loss diagnostics for Hg simulation -- Closes #1284, #1285 #1356

Merged
merged 3 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions GeosCore/mercury_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1236,20 +1236,21 @@ SUBROUTINE ChemMercury( Input_Opt, State_Chm, State_Diag, &

! Chemical loss of species or families [molec/cm3/s]
IF ( State_Diag%Archive_Loss ) THEN
DO F = 1, State_Chm%nLoss
KppID = State_Chm%Map_Loss(F)
State_Diag%Loss(I,J,L,F) = VAR(KppID) / DT
DO S = 1, State_Diag%Map_Loss%nSlots
KppId = State_Diag%Map_Loss%slot2Id(S)
State_Diag%Loss(I,J,L,S) = C(KppID) / DT
ENDDO
ENDIF

! Chemical production of species or families [molec/cm3/s]
IF ( State_Diag%Archive_Prod ) THEN
DO F = 1, State_Chm%nProd
KppID = State_Chm%Map_Prod(F)
State_Diag%Prod(I,J,L,F) = VAR(KppID) / DT
DO S = 1, State_Diag%Map_Prod%nSlots
KppID = State_Diag%Map_Prod%slot2Id(S)
State_Diag%Prod(I,J,L,S) = C(KppID) / DT
ENDDO
ENDIF


!=====================================================================
! HISTORY (aka netCDF diagnostics)
!
Expand Down
18 changes: 12 additions & 6 deletions Headers/diaglist_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ MODULE DiagList_Mod
!=========================================================================
! Configurable Settings Used for Diagnostic Names at Run-time
!=========================================================================
CHARACTER(LEN=5), PUBLIC :: RadWL(3) ! Wavelengths in radiation menu
CHARACTER(LEN=4), PUBLIC :: RadOut(12) ! Names of RRTMG outputs (tags)
INTEGER, PUBLIC :: nRadOut ! # of selected RRTMG outputs
LOGICAL, PUBLIC :: IsFullChem ! Is this a fullchem simulation?
CHARACTER(LEN=10), PUBLIC :: AltAboveSfc ! Alt for O3, HNO3 diagnostics
CHARACTER(LEN=5), PUBLIC :: RadWL(3) ! Wavelengths in radiation menu
CHARACTER(LEN=4), PUBLIC :: RadOut(12) ! Names of RRTMG outputs (tags)
INTEGER, PUBLIC :: nRadOut ! # of selected RRTMG outputs
LOGICAL, PUBLIC :: IsFullChem ! Is it a fullchem simulation?
LOGICAL, PUBLIC :: IsHg ! Is it a Hg simulation?
LOGICAL, PUBLIC :: IsCarbonCycle ! Is it a carboncycle sim?
CHARACTER(LEN=10), PUBLIC :: AltAboveSfc ! Alt for O3, HNO3 diagnostics

!=========================================================================
! Derived type for Collections List
Expand Down Expand Up @@ -226,6 +228,8 @@ SUBROUTINE Init_DiagList ( am_I_Root, historyConfigFile, DiagList, RC )
RadOut = ''
nRadOut = 0
IsFullChem = .FALSE.
IsHg = .FALSE.
IsCarbonCycle = .FALSE.
InDefSection = .FALSE.
InFieldsSection = .FALSE.
Name = ''
Expand Down Expand Up @@ -264,7 +268,9 @@ SUBROUTINE Init_DiagList ( am_I_Root, historyConfigFile, DiagList, RC )
CALL QFYAML_CleanUp( ConfigAnchored )
RETURN
ENDIF
IsFullChem = ( To_UpperCase( v_str ) == "FULLCHEM" )
IsFullChem = ( To_UpperCase( v_str ) == "FULLCHEM" )
IsHg = ( To_UpperCase( v_str ) == "HG" )
IsCarbonCycle = ( To_UpperCase( v_str ) == "CARBONCYCLE" )

! Read the altitude above the surface in meters for drydep diags
key = "operations%dry_deposition%diag_alt_above_sfc_in_m"
Expand Down
20 changes: 10 additions & 10 deletions Headers/state_diag_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10571,8 +10571,8 @@ SUBROUTINE Get_Metadata_State_Diag( am_I_Root, metadataID, Found, &
!
! !USES:
!
USE Charpak_Mod, ONLY : StrSplit, To_UpperCase
USE DiagList_Mod, ONLY : IsFullChem
USE Charpak_Mod, ONLY : StrSplit, To_UpperCase
USE DiagList_Mod, ONLY : IsFullChem, IsCarbonCycle, IsHg
USE Registry_Params_Mod
!
! !INPUT PARAMETERS:
Expand Down Expand Up @@ -11500,11 +11500,11 @@ SUBROUTINE Get_Metadata_State_Diag( am_I_Root, metadataID, Found, &
IF ( isRank ) Rank = 3
IF ( isTagged ) TagId = 'LOS'

! NOTE: Units are different depending on simulation, due to historical
! baggage. Maybe clean this up at a later point to use the same units
! regardless of simulation type. (bmy, 12/4/17)
! NOTE: Prod/Loss units for simulations with KPP are molec/cm3/s,
! and are currently kg/s for other specialty simulations.
! This will need to be cleaned up later (Bob Yantosca, 22 Aug 2020).
IF ( isUnits ) THEN
IF ( IsFullChem ) THEN
IF ( IsFullChem .or. IsHg .or. IsCarbonCycle ) THEN
Units = 'molec cm-3 s-1'
ELSE
Units = 'kg s-1'
Expand All @@ -11516,11 +11516,11 @@ SUBROUTINE Get_Metadata_State_Diag( am_I_Root, metadataID, Found, &
IF ( isRank ) Rank = 3
IF ( isTagged ) TagId = 'PRD'

! NOTE: Units are different depending on simulation, due to historical
! baggage. Maybe clean this up at a later point to use the same units
! regardless of simulation type. (bmy, 12/4/17)
! NOTE: Prod/Loss units for simulations with KPP are molec/cm3/s,
! and are currently kg/s for other specialty simulations.
! This will need to be cleaned up later (Bob Yantosca, 22 Aug 2020).
IF ( isUnits ) THEN
IF ( IsFullChem ) THEN
IF ( IsFullChem .or. IsHg .or. IsCarbonCycle ) THEN
Units = 'molec cm-3 s-1'
ELSE
Units = 'kg s-1'
Expand Down
7 changes: 7 additions & 0 deletions KPP/Hg/Hg.kpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

#INCLUDE Hg.eqn { Chemical reactions for Hg mechanism }

#FAMILIES { Chemical families for prod/loss diagnostic }
PHg2 : HgBrNO2 + HgBrHO2 + HgBrClO + HgBrBrO + HgBr2 + HgBrOH + HgBrO + HgOHNO2 + HgOHHO2 + HgOHClO + HgOHBrO + HgOHOH + HgOHO + HgClNO2 + HgClHO2 + HgClClO + HgClBrO + HgClBr + HgClOH + HgClO + HgCl2 + Hg2ClP + Hg2ORGP + HgBr + HgOH + HgCl; {gross GOM production}
PHg0 : Hg0; {gross Hg0 production}
PHg2Br : HgBrNO2 + HgBrHO2 + HgBrClO + HgBrBrO + HgBr2 + HgBrOH + HgBrO + HgBr; {GOM production from Br}
PHg2OH : HgOHNO2 + HgOHHO2 + HgOHClO + HgOHBrO + HgOHOH + HgOHO + HgOH; {GOM production from OH}
PHg2Cl : HgClNO2 + HgClHO2 + HgClClO + HgClBrO + HgClBr + HgClOH + HgClO + HgCl2 + HgCl; {GOM production from Cl}

#INLINE F90_RATES
! All rates are included in Hg_RateLawFuncs.F90, which
! gets referenced directly from subroutine Update_Rconst.
Expand Down
27 changes: 14 additions & 13 deletions KPP/Hg/gckpp.map
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ REORDER - ON
### Parameters ----------------------------------------

! NSPEC - Number of chemical species
INTEGER, PARAMETER :: NSPEC = 38
INTEGER, PARAMETER :: NSPEC = 43
! NVAR - Number of Variable species
INTEGER, PARAMETER :: NVAR = 27
INTEGER, PARAMETER :: NVAR = 32
! NVARACT - Number of Active species
INTEGER, PARAMETER :: NVARACT = 26
! NFIX - Number of Fixed species
Expand All @@ -45,21 +45,22 @@ REORDER - ON
! NVARST - Starting of variables in conc. vect.
INTEGER, PARAMETER :: NVARST = 1
! NFIXST - Starting of fixed in conc. vect.
INTEGER, PARAMETER :: NFIXST = 28
INTEGER, PARAMETER :: NFIXST = 33

### Species -------------------------------------------

Variable species
1 = HgCl2 (r) 11 = HgBrNO2 (r) 21 = HgOHHO2 (r)
2 = Hg2ClP (n) 12 = HgBr2 (r) 22 = HgOHOH (r)
3 = HgBrClO (r) 13 = HgOHNO2 (r) 23 = Hg2ORGP (r)
4 = HgBrBrO (r) 14 = HgClO (r) 24 = HgOH (r)
5 = HgClClO (r) 15 = HgClHO2 (r) 25 = Hg0 (r)
6 = HgClBrO (r) 16 = HgClOH (r) 26 = HgBrOH (r)
7 = HgClBr (r) 17 = HgCl (r) 27 = HgBr (r)
8 = HgOHClO (r) 18 = HgBrO (r)
9 = HgOHBrO (r) 19 = HgBrHO2 (r)
10 = HgClNO2 (r) 20 = HgOHO (r)
1 = HgCl2 (r) 12 = HgOHBrO (r) 23 = HgBrHO2 (r)
2 = Hg2ClP (n) 13 = HgBrClO (r) 24 = HgClO (r)
3 = PHg2 (n) 14 = HgBrBrO (r) 25 = HgClHO2 (r)
4 = PHg0 (n) 15 = HgOHNO2 (r) 26 = HgClOH (r)
5 = PHg2Br (n) 16 = HgBrNO2 (r) 27 = HgCl (r)
6 = PHg2OH (n) 17 = HgClNO2 (r) 28 = Hg2ORGP (r)
7 = PHg2Cl (n) 18 = HgBr2 (r) 29 = HgOH (r)
8 = HgClClO (r) 19 = HgOHO (r) 30 = Hg0 (r)
9 = HgClBrO (r) 20 = HgOHOH (r) 31 = HgBrOH (r)
10 = HgClBr (r) 21 = HgOHHO2 (r) 32 = HgBr (r)
11 = HgOHClO (r) 22 = HgBrO (r)

Fixed species
1 = Br (r) 5 = NO (n) 9 = ClO (r)
Expand Down
Loading