1 | /* User-defined Rate Law functions |
---|
2 | Note: the default argument type for rate laws, as read from the equations file, is single precision |
---|
3 | but all the internal calculations are performed in double precision |
---|
4 | */ |
---|
5 | /* Arrhenius */ |
---|
6 | KPP_REAL ARR( float A0, float B0, float C0 ) |
---|
7 | { |
---|
8 | double ARR_RES; |
---|
9 | |
---|
10 | ARR_RES = (double)A0 * exp( -(double)B0/TEMP ) |
---|
11 | * pow( (TEMP/300.0), (double)C0 ); |
---|
12 | |
---|
13 | return (KPP_REAL)ARR_RES; |
---|
14 | } |
---|
15 | |
---|
16 | |
---|
17 | /* Simplified Arrhenius, with two arguments */ |
---|
18 | /* Note that the argument B0 has a changed sign when compared to ARR */ |
---|
19 | KPP_REAL ARR2( float A0, float B0 ) |
---|
20 | { |
---|
21 | double ARR_RES; |
---|
22 | |
---|
23 | ARR_RES = (double)A0 * exp( (double)B0/TEMP ); |
---|
24 | |
---|
25 | return (KPP_REAL)ARR_RES; |
---|
26 | } |
---|
27 | |
---|
28 | |
---|
29 | KPP_REAL EP2( float A0, float C0, float A2, float C2, float A3, float C3) |
---|
30 | { |
---|
31 | double K0, K2, K3, EP2_RES; |
---|
32 | |
---|
33 | K0 = (double)A0 * exp( -(double)C0/TEMP ); |
---|
34 | K2 = (double)A2 * exp( -(double)C2/TEMP ); |
---|
35 | K3 = (double)A3 * exp( -(double)C3/TEMP ); |
---|
36 | K3 = K3*CFACTOR*1.0e+6; |
---|
37 | EP2_RES = K0 + K3/( 1.0+K3/K2 ); |
---|
38 | |
---|
39 | return (KPP_REAL)EP2_RES; |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | KPP_REAL EP3( float A1, float C1, float A2, float C2) |
---|
44 | { |
---|
45 | double K1, K2, EP3_RES; |
---|
46 | |
---|
47 | K1 = (double)A1 * exp(-(double)C1/TEMP); |
---|
48 | K2 = (double)A2 * exp(-(double)C2/TEMP); |
---|
49 | EP3_RES = K1 + K2*(1.0e+6*CFACTOR); |
---|
50 | |
---|
51 | return (KPP_REAL)EP3_RES; |
---|
52 | } |
---|
53 | |
---|
54 | |
---|
55 | KPP_REAL FALL ( float A0, float B0, float C0, float A1, float B1, float C1, float CF) |
---|
56 | { |
---|
57 | double K0, K1, FALL_RES; |
---|
58 | |
---|
59 | K0 = (double)A0 * exp(-(double)B0/TEMP)* pow( (TEMP/300.0), (double)C0 ); |
---|
60 | K1 = (double)A1 * exp(-(double)B1/TEMP)* pow( (TEMP/300.0), (double)C1 ); |
---|
61 | K0 = K0*CFACTOR*1.0e+6; |
---|
62 | K1 = K0/K1; |
---|
63 | FALL_RES = (K0/(1.0+K1))* |
---|
64 | pow( (double)CF, ( 1.0/( 1.0+pow( (log10(K1)),2 ) ) ) ); |
---|
65 | |
---|
66 | return (KPP_REAL)FALL_RES; |
---|
67 | } |
---|