CAMP 1.0.0
Chemistry Across Multiple Phases
util.h
Go to the documentation of this file.
1/* Copyright (C) 2021 Barcelona Supercomputing Center and University of
2 * Illinois at Urbana-Champaign
3 * SPDX-License-Identifier: MIT
4 *
5 * Utility functions and commonly used science property calculators
6 *
7 */
8/** \file
9 * \brief Utility functions and commonly used science property calculators
10 */
11#ifndef UTIL_H
12#define UTIL_H
13
14// Universal gas constant (J mol-1 K-1)
15#define UNIV_GAS_CONST_ 8.314472
16
17/** Calculate the mean speed of a gas-phase species
18 * [ \f$\mbox{m}\,\mbox{s}^{-1}\f$ ] :
19 * \f[
20 * v = \sqrt{\frac{8RT}{\pi MW}}
21 * \f]
22 * where R is the ideal gas constant [\f$\mbox{J}\, \mbox{K}^{-1}\,
23 * \mbox{mol}^{-1}\f$], T is temperature [K], and MW is the molecular weight of
24 * the gas-phase species
25 * [\f$\mbox{kg}\, \mbox{mol}^{-1}\f$]
26 * @param temperature__K Temperature [K]
27 * @param mw__kg_mol Molecular weight of the gas-phase species [\f$\mbox{kg}\,
28 * \mbox{mol}^{-1}\f$]
29 */
30static inline double mean_speed__m_s(double temperature__K,
31 double mw__kg_mol) {
32 return sqrt(8.0 * UNIV_GAS_CONST_ * temperature__K / (M_PI * mw__kg_mol));
33}
34
35/** Calculate the mean free path of a gas-phase species [m]
36 * \f[
37 * \lambda = 3.0 D_g / v
38 * \f]
39 * where \f$D_g\f$ is the gas-phase diffusion coefficient
40 * [\f$\mbox{m}^2\,\mbox{s}^{-1}\f$] and
41 * \f$v\f$ is the mean speed of the gas-phase molecules
42 * [ \f$\mbox{m}\,\mbox{s}^{-1}\f$ ].
43 *
44 * @param diffusion_coeff__m2_s Diffusion coefficient of the gas species
45 * [\f$\mbox{m}^2\, \mbox{s}^{-1}\f$]
46 * @param temperature__K Temperature [K]
47 * @param mw__kg_mol Molecular weight of the gas-phase species [\f$\mbox{kg}\,
48 * \mbox{mol}^{-1}\f$]
49 */
50static inline double mean_free_path__m(double diffusion_coeff__m2_s,
51 double temperature__K,
52 double mw__kg_mol) {
53 return 3.0 * diffusion_coeff__m2_s /
54 mean_speed__m_s(temperature__K, mw__kg_mol);
55}
56
57/** Calculate the transition regime correction factor [unitless] \cite Fuchs1971
58 * : \f[ f(K_n,\alpha) = \frac{0.75 \alpha ( 1 + K_n )}{K_n(1+K_n) + 0.283\alpha
59 * K_n + 0.75 \alpha} \f] where the Knudsen Number \f$K_n = \lambda / r\f$
60 * (where \f$\lambda\f$ is the mean free path [m] of the gas-phase species and
61 * \f$r\f$ is the effective radius of the particles [m]), and \f$ \alpha \f$ is
62 * the mass accomodation coefficient, which is typically assumed to equal 0.1
63 * \cite Zaveri2008.
64 *
65 * @param mean_free_path__m mean free path of the gas-phase species [m]
66 * @param radius__m Particle effective radius [m]
67 * @param alpha Mass accomodation coefficient [unitless]
68 */
70 double mean_free_path__m, double radius__m, double alpha) {
71 double K_n = mean_free_path__m / radius__m;
72 return (0.75 * alpha * (1.0 + K_n)) /
73 (K_n * K_n + (1.0 + 0.283 * alpha) * K_n + 0.75 * alpha);
74}
75
76/** Calculate the derivative of the transition regime correction factor by
77 * particle radius.
78 * \f[
79 * \frac{d f_{fs}}{d r} = \frac{0.75 \alpha \lambda (K_n^2 + 2K_n + 1 +
80 * (0.283-0.75)\alpha)}{r^2(K_n^2 + (1+0.283\alpha)K_n + 0.75\alpha)^2} \f]
81 * \todo double check the correction factor derivative equation
82 * where the Knudsen Number \f$K_n = \lambda / r\f$ (where \f$\lambda\f$ is the
83 * mean free path [m] of the gas-phase species and \f$r\f$ is the effective
84 * radius of the particles [m]), and \f$ \alpha \f$ is the mass accomodation
85 * coefficient, which is typically assumed to equal 0.1 \cite Zaveri2008.
86 *
87 * @param mean_free_path__m mean free path of the gas-phase species [m]
88 * @param radius__m Particle effective radius [m]
89 * @param alpha Mass accomodation coefficient [unitless]
90 */
92 double mean_free_path__m, double radius__m, double alpha) {
93 double K_n = mean_free_path__m / radius__m;
94 return (0.75 * alpha * mean_free_path__m *
95 (K_n * K_n + 2.0 * K_n + 1.0 + (0.283 - 0.75) * alpha)) /
96 pow(radius__m *
97 (K_n * K_n + (1.0 + 0.283 * alpha) * K_n + 0.75 * alpha),
98 2);
99}
100
101/** Calculate the gas-aerosol reaction rate constant for the transition regime
102 * [\f$\mbox{m}^3\, \mbox{particle}^{-1}\, \mbox{s}^{-1}\f$]
103 *
104 * The rate constant \f$k_c\f$ is calculated according to \cite Zaveri2008 as:
105 * \f[
106 * k_c = 4 \pi r D_g f_{fs}( K_n, \alpha )
107 * \f]
108 * where \f$r\f$ is the radius of the particle(s) [m], \f$D_g\f$ is the
109 * diffusion coefficient of the gas-phase species
110 * [\f$\mbox{m}^2\,\mbox{s}^{-1}\f$], \f$f_{fs}( K_n, \alpha )\f$ is the Fuchs
111 * Sutugin transition regime correction factor [unitless], \f$K_n\f$ is the
112 * Knudsen Number [unitess], and \f$\alpha\f$ is the mass accomodation
113 * coefficient.
114 *
115 * Rates can be calculated as:
116 * \f[
117 * r_c = [G] N_a k_c
118 * \f]
119 * where \f$[G]\f$ is the gas-phase species concentration [ppm], \f$N_a\f$ is
120 * the number concentration of particles [\f$\mbox{particle}\,\mbox{m}^{-3}\f$]
121 * and the rate \f$r_c\f$ is in [\f$\mbox{ppm}\,\mbox{s}^{-1}\f$].
122 *
123 * @param diffusion_coeff__m2_s Diffusion coefficent of the gas species
124 * [\f$\mbox{m}^2\, \mbox{s}^{-1}\f$]
125 * @param mean_free_path__m Mean free path of gas molecules [m]
126 * @param radius__m Particle radius [m]
127 * @param alpha Mass accomodation coefficient [unitless]
128 */
130 double diffusion_coeff__m2_s, double mean_free_path__m,
131 double radius__m, double alpha) {
132 return 4.0 * M_PI * radius__m * diffusion_coeff__m2_s *
134 alpha);
135}
136
137/** Calculate the derivative of a transition-regime gas-aerosol reaction
138 * rate by particle radius
139 * \f[
140 * \frac{d k_c}{d r} = 4 \pi D_g ( f_{fs} + r \frac{d_{fs}}{d r} )
141 * \f]
142 * where \f$r\f$ is the radius of the particle(s) [m], \f$D_g\f$ is the
143 * diffusion coefficient of the gas-phase species [\f$\mbox{m}^2\,
144 * \mbox{s}^{-1}\f$] and \f$f_{fs}( K_n, \alpha )\f$ is the Fuchs Sutugin
145 * transition regime correction factor [unitless] (\f$K_n\f$ is the Knudsen
146 * Number [unitess] and \f$\alpha\f$ is the mass accomodation coefficient.
147 *
148 * @param diffusion_coeff__m2_s Diffusion coefficent of the gas species
149 * [\f$\mbox{m}^2\, \mbox{s}^{-1}\f$]
150 * @param mean_free_path__m Mean free path of gas molecules [m]
151 * @param radius__m Particle radius [m]
152 * @param alpha Mass accomodation coefficient [unitless]
153 */
155 double diffusion_coeff__m2_s, double mean_free_path__m, double radius__m,
156 double alpha) {
157 return 4.0 * M_PI * diffusion_coeff__m2_s *
159 alpha) +
161 mean_free_path__m, radius__m, alpha));
162}
163
164/** Calculate the gas-aerosol reaction rate for the continuum regime \cite Tie2003
165 * [\f$\mbox{m}^3\, \mbox{particle}^{-1}\, \mbox{s}^{-1}\f$]
166 *
167 * The rate constant \f$k_c\f$ is calculated as:
168 * \f[
169 * k_c = \frac{4 \pi r^2_e}{\left(\frac{r}{D_g} + \frac{4}{v(T)\gamma}\right)}
170 * \f]
171 *
172 * where \f$r\f$ is the particle radius [m],
173 * \f$D_g\f$ is the gas-phase diffusion coefficient of the reactant
174 * [\f$\mbox{m}^2\mbox{s}^{-1}\f$], \f$\gamma\f$ is the reaction probability [unitless],
175 * and v is the mean free speed of the gas-phase reactant.
176 *
177 * @param diffusion_coeff__m2_s Diffusion coefficient of the gas species
178 * [\f$\mbox{m}^2\, \mbox{s}^{-1}\f$]
179 * @param mean_speed__m_s Mean speed of the gas molecule [m s-1]
180 * @param radius__m Particle radius [m]
181 * @param alpha Mass accomodation coefficient [unitless]
182 */
184 double diffusion_coeff__m2_s, double mean_speed__m_s,
185 double radius__m, double alpha) {
186 return 4.0 * M_PI * radius__m * radius__m /
187 ( radius__m / diffusion_coeff__m2_s +
188 4.0 / ( mean_speed__m_s * alpha ) );
189}
190
191/** Calculate the derivative of the continuum-regime gas-aerosol reaction rate
192 * constant by particle radius \cite Tie2003
193 * \f[
194 * \frac{dk_c}{dr} = 4 \pi \frac{\frac{r^2}{D_g} +
195 * \frac{8r}{v(T) \gamma}}{\left(\frac{r}{D_g} + \frac{4}{v(T) \gamma}\right)^2}
196 * \f]
197 *
198 * where \f$r\f$ is the particle radius [m],
199 * \f$D_g\f$ is the gas-phase diffusion coefficient of the reactant
200 * [\f$\mbox{m}^2\mbox{s}^{-1}\f$], \f$\gamma\f$ is the reaction probability [unitless],
201 * and v is the mean free speed of the gas-phase reactant.
202 *
203 * @param diffusion_coeff__m2_s Diffusion coefficient of the gas species
204 * [\f$\mbox{m}^2\, \mbox{s}^{-1}\f$]
205 * @param mean_speed__m_s Mean speed of the gas molecule [m s-1]
206 * @param radius__m Particle radius [m]
207 * @param alpha Mass accomodation coefficient [unitless]
208 */
210 double diffusion_coeff__m2_s, double mean_speed__m_s,
211 double radius__m, double alpha) {
212 double nom = radius__m * radius__m / diffusion_coeff__m2_s +
213 8.0 * radius__m / ( mean_speed__m_s * alpha );
214 double denom = radius__m / diffusion_coeff__m2_s +
215 4.0 / ( mean_speed__m_s * alpha );
216 return 4.0 * M_PI * nom / ( denom * denom );
217}
218#endif // UTIL_H
#define M_PI
Definition camp_common.h:48
static double transition_regime_correction_factor(double mean_free_path__m, double radius__m, double alpha)
Definition util.h:69
static double d_gas_aerosol_transition_rxn_rate_constant_d_radius(double diffusion_coeff__m2_s, double mean_free_path__m, double radius__m, double alpha)
Definition util.h:154
static double mean_speed__m_s(double temperature__K, double mw__kg_mol)
Definition util.h:30
static double d_gas_aerosol_continuum_rxn_rate_constant_d_radius(double diffusion_coeff__m2_s, double mean_speed__m_s, double radius__m, double alpha)
Definition util.h:209
static double gas_aerosol_transition_rxn_rate_constant(double diffusion_coeff__m2_s, double mean_free_path__m, double radius__m, double alpha)
Definition util.h:129
static double mean_free_path__m(double diffusion_coeff__m2_s, double temperature__K, double mw__kg_mol)
Definition util.h:50
static double d_transition_regime_correction_factor_d_radius(double mean_free_path__m, double radius__m, double alpha)
Definition util.h:91
#define UNIV_GAS_CONST_
Definition util.h:15
static double gas_aerosol_continuum_rxn_rate_constant(double diffusion_coeff__m2_s, double mean_speed__m_s, double radius__m, double alpha)
Definition util.h:183