! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! ! The Reaction Rates File ! ! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor ! (http://www.cs.vt.edu/~asandu/Software/KPP) ! KPP is distributed under GPL, the general public licence ! (http://www.gnu.org/copyleft/gpl.html) ! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa ! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech ! With important contributions from: ! M. Damian, Villanova University, USA ! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany ! ! File : cbm_Rates.f90 ! Time : Fri Mar 15 14:04:58 2013 ! Working directory : /home/sandu/kpp-2.2.3/examples/Cbm_fortran ! Equation file : cbm.kpp ! Output root filename : cbm ! ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MODULE cbm_Rates USE cbm_Parameters USE cbm_Global IMPLICIT NONE CONTAINS ! Begin Rate Law Functions from KPP_HOME/util/UserRateLaws !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! User-defined Rate Law functions ! Note: the default argument type for rate laws, as read from the equations file, is single precision ! but all the internal calculations are performed in double precision !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !~~~> Arrhenius REAL(kind=dp) FUNCTION ARR( A0,B0,C0 ) REAL A0,B0,C0 ARR = DBLE(A0) * EXP(-DBLE(B0)/TEMP) * (TEMP/300.0_dp)**DBLE(C0) END FUNCTION ARR !~~~> Simplified Arrhenius, with two arguments !~~~> Note: The argument B0 has a changed sign when compared to ARR REAL(kind=dp) FUNCTION ARR2( A0,B0 ) REAL A0,B0 ARR2 = DBLE(A0) * EXP( DBLE(B0)/TEMP ) END FUNCTION ARR2 REAL(kind=dp) FUNCTION EP2(A0,C0,A2,C2,A3,C3) REAL A0,C0,A2,C2,A3,C3 REAL(kind=dp) K0,K2,K3 K0 = DBLE(A0) * EXP(-DBLE(C0)/TEMP) K2 = DBLE(A2) * EXP(-DBLE(C2)/TEMP) K3 = DBLE(A3) * EXP(-DBLE(C3)/TEMP) K3 = K3*CFACTOR*1.0E6_dp EP2 = K0 + K3/(1.0_dp+K3/K2 ) END FUNCTION EP2 REAL(kind=dp) FUNCTION EP3(A1,C1,A2,C2) REAL A1, C1, A2, C2 REAL(kind=dp) K1, K2 K1 = DBLE(A1) * EXP(-DBLE(C1)/TEMP) K2 = DBLE(A2) * EXP(-DBLE(C2)/TEMP) EP3 = K1 + K2*(1.0E6_dp*CFACTOR) END FUNCTION EP3 REAL(kind=dp) FUNCTION FALL ( A0,B0,C0,A1,B1,C1,CF) REAL A0,B0,C0,A1,B1,C1,CF REAL(kind=dp) K0, K1 K0 = DBLE(A0) * EXP(-DBLE(B0)/TEMP)* (TEMP/300.0_dp)**DBLE(C0) K1 = DBLE(A1) * EXP(-DBLE(B1)/TEMP)* (TEMP/300.0_dp)**DBLE(C1) K0 = K0*CFACTOR*1.0E6_dp K1 = K0/K1 FALL = (K0/(1.0_dp+K1))* & DBLE(CF)**(1.0_dp/(1.0_dp+(LOG10(K1))**2)) END FUNCTION FALL !--------------------------------------------------------------------------- ELEMENTAL REAL(kind=dp) FUNCTION k_3rd(temp,cair,k0_300K,n,kinf_300K,m,fc) INTRINSIC LOG10 REAL(kind=dp), INTENT(IN) :: temp ! temperature [K] REAL(kind=dp), INTENT(IN) :: cair ! air concentration [molecules/cm3] REAL, INTENT(IN) :: k0_300K ! low pressure limit at 300 K REAL, INTENT(IN) :: n ! exponent for low pressure limit REAL, INTENT(IN) :: kinf_300K ! high pressure limit at 300 K REAL, INTENT(IN) :: m ! exponent for high pressure limit REAL, INTENT(IN) :: fc ! broadening factor (usually fc=0.6) REAL(kind=dp) :: zt_help, k0_T, kinf_T, k_ratio zt_help = 300._dp/temp k0_T = k0_300K * zt_help**(n) * cair ! k_0 at current T kinf_T = kinf_300K * zt_help**(m) ! k_inf at current T k_ratio = k0_T/kinf_T k_3rd = k0_T/(1._dp+k_ratio)*fc**(1._dp/(1._dp+LOG10(k_ratio)**2)) END FUNCTION k_3rd !--------------------------------------------------------------------------- ELEMENTAL REAL(kind=dp) FUNCTION k_arr (k_298,tdep,temp) ! Arrhenius function REAL, INTENT(IN) :: k_298 ! k at T = 298.15K REAL, INTENT(IN) :: tdep ! temperature dependence REAL(kind=dp), INTENT(IN) :: temp ! temperature INTRINSIC EXP k_arr = k_298 * EXP(tdep*(1._dp/temp-3.3540E-3_dp)) ! 1/298.15=3.3540e-3 END FUNCTION k_arr !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! End of User-defined Rate Law functions !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! End Rate Law Functions from KPP_HOME/util/UserRateLaws ! Begin INLINED Rate Law Functions ! End INLINED Rate Law Functions ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! ! Update_SUN - update SUN light using TIME ! Arguments : ! ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SUBROUTINE Update_SUN() !USE cbm_Parameters !USE cbm_Global IMPLICIT NONE REAL(kind=dp) :: SunRise, SunSet REAL(kind=dp) :: Thour, Tlocal, Ttmp ! PI - Value of pi REAL(kind=dp), PARAMETER :: PI = 3.14159265358979d0 SunRise = 4.5_dp SunSet = 19.5_dp Thour = TIME/3600.0_dp Tlocal = Thour - (INT(Thour)/24)*24 IF ((Tlocal>=SunRise).AND.(Tlocal<=SunSet)) THEN Ttmp = (2.0*Tlocal-SunRise-SunSet)/(SunSet-SunRise) IF (Ttmp.GT.0) THEN Ttmp = Ttmp*Ttmp ELSE Ttmp = -Ttmp*Ttmp END IF SUN = ( 1.0_dp + COS(PI*Ttmp) )/2.0_dp ELSE SUN = 0.0_dp END IF END SUBROUTINE Update_SUN ! End of Update_SUN function ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! ! Update_RCONST - function to update rate constants ! Arguments : ! ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SUBROUTINE Update_RCONST ( ) ! Begin INLINED RCONST ! End INLINED RCONST RCONST(1) = (8.89E-3*SUN) RCONST(2) = (ARR2(1.4E+3,1175.0)) RCONST(3) = (ARR2(1.8E-12,-1370.0)) ! RCONST(4) = constant rate coefficient RCONST(5) = (ARR2(1.6E-13,687.0)) RCONST(6) = (ARR2(2.2E-13,602.0)) RCONST(7) = (ARR2(1.2E-13,-2450.0)) RCONST(8) = (3.556E-04*SUN) RCONST(9) = (2.489E-05*SUN) RCONST(10) = (ARR2(1.9E+8,390.0)) ! RCONST(11) = constant rate coefficient RCONST(12) = (ARR2(1.6E-12,-940.0)) RCONST(13) = (ARR2(1.4E-14,-580.0)) RCONST(14) = (1.378E-01*SUN) RCONST(15) = (ARR2(1.3E-11,250.0)) RCONST(16) = (ARR2(2.5E-14,-1230.0)) RCONST(17) = (ARR2(5.3E-13,256.0)) ! RCONST(18) = constant rate coefficient RCONST(19) = (ARR2(3.5E+14,-10897.0)) RCONST(20) = (ARR2(1.8E-20,530.0)) ! RCONST(21) = constant rate coefficient RCONST(22) = (ARR2(4.5E-13,806.0)) RCONST(23) = (1.511e-03*SUN) ! RCONST(24) = constant rate coefficient ! RCONST(25) = constant rate coefficient RCONST(26) = (ARR2(1.0E-12,713.0)) RCONST(27) = (ARR2(5.1E-15,1000.0)) RCONST(28) = (ARR2(3.7E-12,240.0)) RCONST(29) = (ARR2(1.2E-13,749.0)) RCONST(30) = (ARR2(4.8E+13,-10121.0)) RCONST(31) = (ARR2(1.3E-12,380.0)) RCONST(32) = (ARR2(5.9E-14,1150.0)) RCONST(33) = (ARR2(2.2E-38,5800.0)) RCONST(34) = (6.312E-06*SUN) RCONST(35) = (ARR2(3.1E-12,-187.0)) ! RCONST(36) = constant rate coefficient ! RCONST(37) = constant rate coefficient RCONST(38) = (2.845E-05*SUN) RCONST(39) = (3.734E-05*SUN) RCONST(40) = (ARR2(3.0E-11,-1550.0)) ! RCONST(41) = constant rate coefficient RCONST(42) = (ARR2(1.2E-11,-986.0)) RCONST(43) = (ARR2(7.0E-12,250.0)) ! RCONST(44) = constant rate coefficient RCONST(45) = (4.00E-06*SUN) RCONST(46) = (ARR2(5.4E-12,250.0)) RCONST(47) = (ARR2(8.0E-20,5500.0)) RCONST(48) = (ARR2(9.4E+16,-14000.0)) ! RCONST(49) = constant rate coefficient ! RCONST(50) = constant rate coefficient RCONST(51) = (ARR2(1.1E+2,-1710.0)) ! RCONST(52) = constant rate coefficient RCONST(53) = (ARR2(1.0E+15,-8000.0)) ! RCONST(54) = constant rate coefficient ! RCONST(55) = constant rate coefficient RCONST(56) = (ARR2(1.2E-11,-324.0)) RCONST(57) = (ARR2(5.2E-12,504.0)) RCONST(58) = (ARR2(1.4E-14,-2105.0)) ! RCONST(59) = constant rate coefficient RCONST(60) = (ARR2(1.0E-11,-792.0)) RCONST(61) = (ARR2(2.0E-12,411.0)) RCONST(62) = (ARR2(1.3E-14,-2633.0)) RCONST(63) = (ARR2(2.1E-12,322.0)) ! RCONST(64) = constant rate coefficient ! RCONST(65) = constant rate coefficient ! RCONST(66) = constant rate coefficient ! RCONST(67) = constant rate coefficient ! RCONST(68) = constant rate coefficient RCONST(69) = (ARR2(1.7E-11,116.0)) ! RCONST(70) = constant rate coefficient RCONST(71) = (5.334E-05*SUN) RCONST(72) = (ARR2(5.4E-17,-500.0)) ! RCONST(73) = constant rate coefficient RCONST(74) = (1.654E-04*SUN) ! RCONST(75) = constant rate coefficient ! RCONST(76) = constant rate coefficient ! RCONST(77) = constant rate coefficient ! RCONST(78) = constant rate coefficient ! RCONST(79) = constant rate coefficient RCONST(80) = (ARR2(1.7E-14,1300.0)) ! RCONST(81) = constant rate coefficient END SUBROUTINE Update_RCONST ! End of Update_RCONST function ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! ! Update_PHOTO - function to update photolytical rate constants ! Arguments : ! ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SUBROUTINE Update_PHOTO ( ) USE cbm_Global RCONST(1) = (8.89E-3*SUN) RCONST(8) = (3.556E-04*SUN) RCONST(9) = (2.489E-05*SUN) RCONST(14) = (1.378E-01*SUN) RCONST(23) = (1.511e-03*SUN) RCONST(34) = (6.312E-06*SUN) RCONST(38) = (2.845E-05*SUN) RCONST(39) = (3.734E-05*SUN) RCONST(45) = (4.00E-06*SUN) RCONST(71) = (5.334E-05*SUN) RCONST(74) = (1.654E-04*SUN) END SUBROUTINE Update_PHOTO ! End of Update_PHOTO function ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ END MODULE cbm_Rates