LCOV - code coverage report
Current view: | top level - hemco/HEMCO/src/Shared/GeosUtil - hco_henry_mod.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 0 | 13 | 0.0 %
Date: | 2024-12-17 17:57:11 |  | Functions: | 0 | 2 | 0.0 %

              Line data    Source code
           1             : !------------------------------------------------------------------------------
           2             : !                   Harmonized Emissions Component (HEMCO)                    !
           3             : !------------------------------------------------------------------------------
           4             : !BOP
           5             : !
           6             : ! !MODULE: henry_mod.F90
           7             : !
           8             : ! !DESCRIPTION: Module HCO\_HENRY\_MOD contains routines to calculate
           9             : ! The dimensionless liquid-over-gas Henry constant KH as well as the
          10             : ! effective Henry constant HEFF, which accounts for hydrolysis.
          11             : !\\
          12             : !\\
          13             : ! KH   = K0 * exp ( CR * (1/T - 1/Tref)  ) * R * T / 101.325
          14             : !\\
          15             : !\\
          16             : ! HEFF = KH * ( 1 + 10\^(pH-pKa) )
          17             : !\\
          18             : !\\
          19             : ! where K0 is the value of KH at standard conditions [M/atm], CR is the
          20             : ! temperature dependency of KH [K], T is the temperature in Kelvin, Tref
          21             : ! is the reference temperature (298.15 K), and R is the universal gas
          22             : ! constant R = 8.314 JK-1mol-1.
          23             : !\\
          24             : !\\
          25             : ! References:
          26             : ! \begin{itemize}
          27             : ! \item Sander, R: Compilation of Henry's law constant for inorganic and
          28             : ! organic species of potential importance in environmental chemistry, 1999.
          29             : ! \item  http://www.mpch-mainz.mpg.de/~sander/res/henry.html.
          30             : ! \end{itemize}
          31             : !
          32             : ! !INTERFACE:
          33             : !
          34             : MODULE HCO_HENRY_MOD
          35             :
          36             :   IMPLICIT NONE
          37             :   PRIVATE
          38             : !
          39             : ! !PUBLIC MEMBER FUNCTIONS:
          40             : !
          41             :   PUBLIC :: CALC_KH
          42             :   PUBLIC :: CALC_HEFF
          43             : !
          44             : ! !REVISION HISTORY:
          45             : !  16 Apr 2013 - C. Keller   - Initial version
          46             : !  See https://github.com/geoschem/hemco for complete history
          47             : !EOP
          48             : !------------------------------------------------------------------------------
          49             : !BOC
          50             : !
          51             : ! !DEFINED PARAMETERS:
          52             : !
          53             :   REAL*8, PARAMETER :: TREF = 298.15d0      ! [K          ]
          54             :   REAL*8, PARAMETER :: R    = 8.3144598d0   ! [J K-1 mol-1]
          55             :   REAL*8, PARAMETER :: ATM  = 101.325d0     ! [mPa (!)    ]
          56             :
          57             : CONTAINS
          58             : !EOC
          59             : !------------------------------------------------------------------------------
          60             : !                   Harmonized Emissions Component (HEMCO)                    !
          61             : !------------------------------------------------------------------------------
          62             : !BOP
          63             : !
          64             : ! !IROUTINE: calc_kh
          65             : !
          66             : ! !DESCRIPTION: Function CALC\_KH calculates the liquid over gas
          67             : ! dimensionless Henry constant for the given tracer and temperature.
          68             : !
          69             : ! Reference: http://www.mpch-mainz.mpg.de/~sander/res/henry.html
          70             : !\\
          71             : !\\
          72             : ! !INTERFACE:
          73             : !
          74           0 :   SUBROUTINE CALC_KH ( thisK0, thisCR, TK, KH, RC )
          75             : !
          76             : ! !INPUT PARAMETERS:
          77             : !
          78             :     REAL*8,  INTENT(IN)    :: thisK0  ! [M/atm]
          79             :     REAL*8,  INTENT(IN)    :: thisCR  ! [-d ln kH / d(1/T) ]
          80             :     REAL*8,  INTENT(IN)    :: TK      ! Temperature [K]
          81             : !
          82             : ! !OUTPUT PARAMETERS:
          83             : !
          84             :     REAL*8,  INTENT(OUT)   :: KH      ! Henry liquid over gas constant [-]
          85             : !
          86             : ! !INPUT/OUTPUT PARAMETERS:
          87             : !
          88             :     INTEGER, INTENT(INOUT) :: RC      ! Error handling
          89             : !
          90             : ! !REVISION HISTORY:
          91             : !  16 Apr 2013 - C. Keller - Initial version
          92             : !  See https://github.com/geoschem/hemco for complete history
          93             : !EOP
          94             : !------------------------------------------------------------------------------
          95             : !BOC
          96             :     !=================================================================
          97             :     ! CALC_KH begins here!
          98             :     !=================================================================
          99             :
         100             :     ! Assume success
         101           0 :     RC = 0
         102             :
         103             :     ! Error if not defined
         104           0 :     IF ( thisK0 == 0d0 ) THEN
         105           0 :        RC = -999
         106           0 :        KH = -999
         107           0 :        RETURN
         108             :     ENDIF
         109             :
         110             :     ! Calculate Henry coefficient for given temperature
         111           0 :     KH = thisK0 * exp( thisCR * (1/TK - 1/TREF) ) * R * TK / ATM
         112             :
         113             :   END SUBROUTINE CALC_KH
         114             : !EOC
         115             : !------------------------------------------------------------------------------
         116             : !                   Harmonized Emissions Component (HEMCO)                    !
         117             : !------------------------------------------------------------------------------
         118             : !BOP
         119             : !
         120             : ! !IROUTINE: calc_heff
         121             : !
         122             : ! !DESCRIPTION: Function CALC\_HEFF calculates the effective Henry
         123             : ! constant taking into account hydrolysis effects. For instance, aqueous
         124             : ! HBr will dissociate to Br- (and H+), and often we are interested in the
         125             : ! total Br concentration in water, i.e. Brx = HBr + Br-, with the equilibrium
         126             : ! concentration of Brx and gaseous HBr being the effective Henry
         127             : ! constant. This function provides the correction factor to calculate
         128             : ! the effective Henry constant from the 'regular' Henry constant
         129             : ! (above):
         130             : !\\
         131             : !\\
         132             : ! Heff = KH * CORR
         133             : !\\
         134             : !\\
         135             : ! The correction term is derived as following:
         136             : !\\
         137             : !\\
         138             : ! The regular Henry constant is:   H    = HA(liq) / HA(g)
         139             : ! The effective Henry constant is: Heff = ( HA(liq) + A(liq)) / HA(g)
         140             : ! Equilibrium between HA and A is: pH = pK + log ( A/HA )
         141             : ! A(liq) hence becomes: HA(liq) * 10**(pH-pK)
         142             : !\\
         143             : !\\
         144             : ! ==> Heff = ( HA(liq) * ( 1 + 10**(pH-pK) ) / HA(g)
         145             : !          = HA(liq) / HA(g) * ( 1 + 10**(pH-pK) )
         146             : !          = H * ( 1 + 10**(pH-pK) )
         147             : !\\
         148             : !\\
         149             : ! ==> CORR = 1 + 10**(pH-pK)
         150             : !\\
         151             : !\\
         152             : ! !INTERFACE:
         153             : !
         154           0 :   SUBROUTINE CALC_HEFF ( thispKa, PH, KH, HEFF, RC )
         155             : !
         156             : ! !INPUT PARAMETERS:
         157             : !
         158             :     REAL*8,  INTENT(IN)    :: thispKa  ! pKa value [-]
         159             :     REAL*8,  INTENT(IN)    :: PH       ! PH value [-]
         160             :     REAL*8,  INTENT(IN)    :: KH       ! gas/aq Henry constant [-]
         161             : !
         162             : ! !OUTPUT PARAMETERS:
         163             : !
         164             :     REAL*8,  INTENT(OUT)   :: HEFF     ! effective gas/aq constant [-]
         165             : !
         166             : ! !INPUT/OUTPUT PARAMETERS:
         167             : !
         168             :     INTEGER, INTENT(INOUT) :: RC       ! for error handling
         169             : !
         170             : ! !REMARKS:
         171             : ! It should be noted that the correction term calculated here is from a
         172             : ! 'acid perspective', i.e. for compounds with the acid being in the
         173             : ! gaseous phase. The correction term reads 1 + 10**(-pH+pK) for
         174             : ! compounds with the base in the gas phase (e.g. ammonia).
         175             : !
         176             : ! The correction term becomes more complicated for compounds with more
         177             : ! than two equilibrium compounds that are relevant under the current
         178             : ! conditions (e.g. CO2).
         179             : !
         180             : ! We ignore any temperature dependencies of pKa for now.
         181             : !
         182             : ! !REVISION HISTORY:
         183             : !  16 Apr 2013 - C. Keller - Initial version
         184             : !  See https://github.com/geoschem/hemco for complete history
         185             : !EOP
         186             : !------------------------------------------------------------------------------
         187             : !BOC
         188             :     !=================================================================
         189             :     ! CALC_HEFF begins here!
         190             :     !=================================================================
         191             :
         192             :     ! Assume success
         193           0 :     RC = 0
         194             :
         195             :     ! Calculate correction term.
         196           0 :     IF ( thispKa > 0d0 ) THEN
         197           0 :        HEFF = KH * ( 1d0 + 10d0**( pH - thispKa ) )
         198             :     ELSE
         199           0 :        HEFF = KH
         200             :     ENDIF
         201             :
         202           0 :   END SUBROUTINE CALC_HEFF
         203             : !EOC
         204             : END MODULE HCO_HENRY_MOD

Generated by: LCOV version 1.14