1 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
2 | ! |
---|
3 | ! The Reaction Rates File |
---|
4 | ! |
---|
5 | ! Generated by KPP-2.2.3 symbolic chemistry Kinetics PreProcessor |
---|
6 | ! (http://www.cs.vt.edu/~asandu/Software/KPP) |
---|
7 | ! KPP is distributed under GPL, the general public licence |
---|
8 | ! (http://www.gnu.org/copyleft/gpl.html) |
---|
9 | ! (C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa |
---|
10 | ! (C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech |
---|
11 | ! With important contributions from: |
---|
12 | ! M. Damian, Villanova University, USA |
---|
13 | ! R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany |
---|
14 | ! |
---|
15 | ! File : chem_gasphase_mod_Rates.f90 |
---|
16 | ! Time : Fri Dec 1 18:10:53 2017 |
---|
17 | ! Working directory : /data/kanani/branches/palm4u/GASPHASE_PREPROC/tmp_kpp4palm |
---|
18 | ! Equation file : chem_gasphase_mod.kpp |
---|
19 | ! Output root filename : chem_gasphase_mod |
---|
20 | ! |
---|
21 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
22 | |
---|
23 | |
---|
24 | |
---|
25 | MODULE chem_gasphase_mod_Rates |
---|
26 | |
---|
27 | USE chem_gasphase_mod_Parameters |
---|
28 | USE chem_gasphase_mod_Global |
---|
29 | IMPLICIT NONE |
---|
30 | |
---|
31 | CONTAINS |
---|
32 | |
---|
33 | |
---|
34 | |
---|
35 | ! Begin Rate Law Functions from KPP_HOME/util/UserRateLaws |
---|
36 | |
---|
37 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
38 | ! User-defined Rate Law functions |
---|
39 | ! Note: the default argument type for rate laws, as read from the equations file, is single precision |
---|
40 | ! but all the internal calculations are performed in double precision |
---|
41 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
42 | ! |
---|
43 | ! RFo: IMPORTANT: Comments must ALWAYS stand BEFORE the code to be processed |
---|
44 | ! |
---|
45 | ! This is just the working copy of UserRateLaws.f90 which is actually used. |
---|
46 | ! It is copied from GASPASE_PREPROC/mechanisms/UserRateLaws.f90 to kpp/util/UserRateLaws.f90 |
---|
47 | ! each time when run_kpp4palm.ksh is run. |
---|
48 | |
---|
49 | |
---|
50 | !~~~> Arrhenius |
---|
51 | REAL(kind=dp) FUNCTION ARR( A0,B0,C0 ) |
---|
52 | REAL A0,B0,C0 |
---|
53 | ARR = DBLE(A0) * EXP(-DBLE(B0)/TEMP) * (TEMP/300.0_dp)**DBLE(C0) |
---|
54 | END FUNCTION ARR |
---|
55 | |
---|
56 | |
---|
57 | !~~~> Simplified Arrhenius, with two arguments, fixed TEMP=20 deg C |
---|
58 | !~~~> Note: The argument B0 has a changed sign when compared to ARR |
---|
59 | ! |
---|
60 | !~~~> Simplified Arrhenius, with two arguments |
---|
61 | ! RFo: same as above, but with TEMP in parameter list and _dp |
---|
62 | ! REAL(kind=dp) (kind=dp) FUNCTION ARR2( A0, B0 ) |
---|
63 | ! REAL (kind=dp) A0,B0 |
---|
64 | ! ARR2 = A0 * EXP( B0 / 20.0_dp ) |
---|
65 | ! END FUNCTION ARR2 |
---|
66 | REAL(kind=dp) FUNCTION ARR2( a0, b0, temp ) |
---|
67 | REAL(kind=dp) :: temp |
---|
68 | REAL(kind=dp) :: a0,b0 |
---|
69 | ARR2 = a0 * EXP( -b0 / temp ) |
---|
70 | END FUNCTION ARR2 |
---|
71 | |
---|
72 | |
---|
73 | REAL(kind=dp) FUNCTION EP2(A0,C0,A2,C2,A3,C3) |
---|
74 | REAL A0,C0,A2,C2,A3,C3 |
---|
75 | REAL(kind=dp) K0,K2,K3 |
---|
76 | K0 = DBLE(A0) * EXP(-DBLE(C0)/TEMP) |
---|
77 | K2 = DBLE(A2) * EXP(-DBLE(C2)/TEMP) |
---|
78 | K3 = DBLE(A3) * EXP(-DBLE(C3)/TEMP) |
---|
79 | K3 = K3*CFACTOR*1.0E6_dp |
---|
80 | EP2 = K0 + K3/(1.0_dp+K3/K2 ) |
---|
81 | END FUNCTION EP2 |
---|
82 | |
---|
83 | REAL(kind=dp) FUNCTION EP3(A1,C1,A2,C2) |
---|
84 | REAL A1, C1, A2, C2 |
---|
85 | REAL(kind=dp) K1, K2 |
---|
86 | K1 = DBLE(A1) * EXP(-DBLE(C1)/TEMP) |
---|
87 | K2 = DBLE(A2) * EXP(-DBLE(C2)/TEMP) |
---|
88 | EP3 = K1 + K2*(1.0E6_dp*CFACTOR) |
---|
89 | END FUNCTION EP3 |
---|
90 | |
---|
91 | REAL(kind=dp) FUNCTION FALL ( A0,B0,C0,A1,B1,C1,CF) |
---|
92 | REAL A0,B0,C0,A1,B1,C1,CF |
---|
93 | REAL(kind=dp) K0, K1 |
---|
94 | K0 = DBLE(A0) * EXP(-DBLE(B0)/TEMP)* (TEMP/300.0_dp)**DBLE(C0) |
---|
95 | K1 = DBLE(A1) * EXP(-DBLE(B1)/TEMP)* (TEMP/300.0_dp)**DBLE(C1) |
---|
96 | K0 = K0*CFACTOR*1.0E6_dp |
---|
97 | K1 = K0/K1 |
---|
98 | FALL = (K0/(1.0_dp+K1))* & |
---|
99 | DBLE(CF)**(1.0_dp/(1.0_dp+(LOG10(K1))**2)) |
---|
100 | END FUNCTION FALL |
---|
101 | |
---|
102 | !--------------------------------------------------------------------------- |
---|
103 | |
---|
104 | ELEMENTAL REAL(kind=dp) FUNCTION k_3rd(temp,cair,k0_300K,n,kinf_300K,m,fc) |
---|
105 | |
---|
106 | INTRINSIC LOG10 |
---|
107 | |
---|
108 | REAL(kind=dp), INTENT(IN) :: temp ! temperature [K] |
---|
109 | REAL(kind=dp), INTENT(IN) :: cair ! air concentration [molecules/cm3] |
---|
110 | REAL, INTENT(IN) :: k0_300K ! low pressure limit at 300 K |
---|
111 | REAL, INTENT(IN) :: n ! exponent for low pressure limit |
---|
112 | REAL, INTENT(IN) :: kinf_300K ! high pressure limit at 300 K |
---|
113 | REAL, INTENT(IN) :: m ! exponent for high pressure limit |
---|
114 | REAL, INTENT(IN) :: fc ! broadening factor (usually fc=0.6) |
---|
115 | REAL(kind=dp) :: zt_help, k0_T, kinf_T, k_ratio |
---|
116 | |
---|
117 | zt_help = 300._dp/temp |
---|
118 | k0_T = k0_300K * zt_help**(n) * cair ! k_0 at current T |
---|
119 | kinf_T = kinf_300K * zt_help**(m) ! k_inf at current T |
---|
120 | k_ratio = k0_T/kinf_T |
---|
121 | k_3rd = k0_T/(1._dp+k_ratio)*fc**(1._dp/(1._dp+LOG10(k_ratio)**2)) |
---|
122 | |
---|
123 | END FUNCTION k_3rd |
---|
124 | |
---|
125 | !--------------------------------------------------------------------------- |
---|
126 | |
---|
127 | ELEMENTAL REAL(kind=dp) FUNCTION k_arr (k_298,tdep,temp) |
---|
128 | ! Arrhenius function |
---|
129 | |
---|
130 | REAL, INTENT(IN) :: k_298 ! k at T = 298.15K |
---|
131 | REAL, INTENT(IN) :: tdep ! temperature dependence |
---|
132 | REAL(kind=dp), INTENT(IN) :: temp ! temperature |
---|
133 | |
---|
134 | INTRINSIC EXP |
---|
135 | |
---|
136 | k_arr = k_298 * EXP(tdep*(1._dp/temp-3.3540E-3_dp)) ! 1/298.15=3.3540e-3 |
---|
137 | |
---|
138 | END FUNCTION k_arr |
---|
139 | |
---|
140 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
141 | ! End of User-defined Rate Law functions |
---|
142 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
143 | |
---|
144 | ! End Rate Law Functions from KPP_HOME/util/UserRateLaws |
---|
145 | |
---|
146 | |
---|
147 | ! Begin INLINED Rate Law Functions |
---|
148 | |
---|
149 | |
---|
150 | ! End INLINED Rate Law Functions |
---|
151 | |
---|
152 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
153 | ! |
---|
154 | ! Update_SUN - update SUN light using TIME |
---|
155 | ! Arguments : |
---|
156 | ! |
---|
157 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
158 | |
---|
159 | SUBROUTINE Update_SUN() |
---|
160 | !USE chem_gasphase_mod_Parameters |
---|
161 | !USE chem_gasphase_mod_Global |
---|
162 | |
---|
163 | IMPLICIT NONE |
---|
164 | |
---|
165 | REAL(kind=dp) :: SunRise, SunSet |
---|
166 | REAL(kind=dp) :: Thour, Tlocal, Ttmp |
---|
167 | ! PI - Value of pi |
---|
168 | REAL(kind=dp), PARAMETER :: PI = 3.14159265358979d0 |
---|
169 | |
---|
170 | SunRise = 4.5_dp |
---|
171 | SunSet = 19.5_dp |
---|
172 | Thour = TIME/3600.0_dp |
---|
173 | Tlocal = Thour - (INT(Thour)/24)*24 |
---|
174 | |
---|
175 | IF ((Tlocal>=SunRise).AND.(Tlocal<=SunSet)) THEN |
---|
176 | Ttmp = (2.0*Tlocal-SunRise-SunSet)/(SunSet-SunRise) |
---|
177 | IF (Ttmp.GT.0) THEN |
---|
178 | Ttmp = Ttmp*Ttmp |
---|
179 | ELSE |
---|
180 | Ttmp = -Ttmp*Ttmp |
---|
181 | END IF |
---|
182 | SUN = ( 1.0_dp + COS(PI*Ttmp) )/2.0_dp |
---|
183 | ELSE |
---|
184 | SUN = 0.0_dp |
---|
185 | END IF |
---|
186 | |
---|
187 | END SUBROUTINE Update_SUN |
---|
188 | |
---|
189 | ! End of Update_SUN function |
---|
190 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
191 | |
---|
192 | |
---|
193 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
194 | ! |
---|
195 | ! Update_RCONST - function to update rate constants |
---|
196 | ! Arguments : |
---|
197 | ! |
---|
198 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
199 | |
---|
200 | SUBROUTINE Update_RCONST ( ) |
---|
201 | |
---|
202 | |
---|
203 | |
---|
204 | |
---|
205 | ! Begin INLINED RCONST |
---|
206 | |
---|
207 | |
---|
208 | ! End INLINED RCONST |
---|
209 | |
---|
210 | RCONST(1) = (1.0_wp) |
---|
211 | RCONST(2) = (1.0_wp) |
---|
212 | RCONST(3) = (1.0_wp) |
---|
213 | |
---|
214 | END SUBROUTINE Update_RCONST |
---|
215 | |
---|
216 | ! End of Update_RCONST function |
---|
217 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
218 | |
---|
219 | |
---|
220 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
221 | ! |
---|
222 | ! Update_PHOTO - function to update photolytical rate constants |
---|
223 | ! Arguments : |
---|
224 | ! |
---|
225 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
226 | |
---|
227 | SUBROUTINE Update_PHOTO ( ) |
---|
228 | |
---|
229 | |
---|
230 | USE chem_gasphase_mod_Global |
---|
231 | |
---|
232 | |
---|
233 | END SUBROUTINE Update_PHOTO |
---|
234 | |
---|
235 | ! End of Update_PHOTO function |
---|
236 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
237 | |
---|
238 | |
---|
239 | |
---|
240 | END MODULE chem_gasphase_mod_Rates |
---|
241 | |
---|