SootLib
Loading...
Searching...
No Matches
sootModel_LOGN.cc
Go to the documentation of this file.
1#include "sootModel_LOGN.h"
2
3using namespace std;
4using namespace soot;
5
18
20 nucleationModel *nucl_,
21 growthModel *grow_,
22 oxidationModel *oxid_,
23 coagulationModel *coag_) :
24 sootModel(nsoot_, nucl_, grow_, oxid_, coag_) {
25
26 if (nsoot_ != 3)
27 throw runtime_error("LOGN requires nsoot=3");
28
32 throw runtime_error("LOGN requires coagulation to be FM or CONTINUUM or HM");
33
35}
36
49
51 nucleationMech Nmech,
52 growthMech Gmech,
53 oxidationMech Omech,
54 coagulationMech Cmech) :
55 sootModel(nsoot_, Nmech, Gmech, Omech, Cmech) {
56
57 if (nsoot_ != 3)
58 throw runtime_error("LOGN requires nsoot=3");
59
63 throw runtime_error("LOGN requires coagulation to be FM or CONTINUUM or HM");
64
66}
67
82
83double sootModel_LOGN::pahSootCollisionRatePerDimer(const state &state, const double mDimer) const {
84
86 return 0.0;
87
88 //----------- get moment values
89
90 const double M0 = state.sootVar[0];
91 const double M1 = state.sootVar[1];
92 const double M2 = state.sootVar[2];
93
94 //----------- reused Mr values
95
96 const double M26 = Mr( 2.0/6.0, M0, M1, M2);
97 const double M46 = Mr( 4.0/6.0, M0, M1, M2);
98 const double Mn36 = Mr(-3.0/6.0, M0, M1, M2);
99 const double Mn16 = Mr(-1.0/6.0, M0, M1, M2);
100 const double Mn26 = Mr(-2.0/6.0, M0, M1, M2);
101 const double Mn46 = Mr(-4.0/6.0, M0, M1, M2);
102 const double M16 = Mr( 1.0/6.0, M0, M1, M2);
103
104 const double mD16 = pow(mDimer, 1./6.);
105 const double mDn16 = pow(mDimer, -1./6.);
106 const double mDn36 = pow(mDimer, -0.5);
107 const double mD26 = pow(mDimer, onethird);
108 const double mDn26 = pow(mDimer, -onethird);
109 const double mD46 = pow(mDimer, twothird);
110 const double mDn46 = pow(mDimer, -twothird);
111
112 //----------- FM (variable name: I for integrated, as in moment)
113
114 const double Kfm = coag->getKfm(state);
115 const double Ifm1 = Kfm*bCoag * (M0 *mD16 + 2.*M26*mDn16 +
116 M46 *mDn36 + 2.*Mn16*mD26 +
117 Mn36*mD46 + M16);
118
119 //----------- continuum
120
121 const double Kc = coag->getKc( state);
122 const double Kcp = coag->getKcp(state);
123 const double Ic1 = Kc * ( 2.*M0 + Mn26*mD26 + M26*mDn26 +
124 Kcp*(M0*mDn26 + Mn26 + M26*mDn46 + Mn46*mD26) );
125
126 //---------- return harmonic mean
127
128 return Ifm1*Ic1/(Ifm1 + Ic1);
129}
130
142
144
145 double N0 = 0, N1 = 0, N2 = 0;
146 double G0 = 0, G1 = 0, G2 = 0;
147 double X0 = 0, X1 = 0, X2 = 0;
148 double C0 = 0, C1 = 0, C2 = 0;
149 double Cnd0 = 0, Cnd1 = 0, Cnd2 = 0;
150
151 //----------- get moment values
152
153 const double M0 = state.sootVar[0];
154 const double M1 = state.sootVar[1];
155 const double M2 = state.sootVar[2];
156
157 //----------- reused Mr values
158
159 const double M26 = Mr( 2.0/6.0, M0, M1, M2);
160 const double M46 = Mr( 4.0/6.0, M0, M1, M2);
161 const double Mn36 = Mr(-3.0/6.0, M0, M1, M2);
162 const double Mn16 = Mr(-1.0/6.0, M0, M1, M2);
163 const double Mn26 = Mr(-2.0/6.0, M0, M1, M2);
164 const double Mn46 = Mr(-4.0/6.0, M0, M1, M2);
165 const double M86 = Mr( 8.0/6.0, M0, M1, M2);
166 const double M106= Mr(10.0/6.0, M0, M1, M2);
167 const double M36 = Mr( 3.0/6.0, M0, M1, M2);
168 const double M56 = Mr( 5.0/6.0, M0, M1, M2);
169 const double M76 = Mr( 7.0/6.0, M0, M1, M2);
170 const double M16 = Mr( 1.0/6.0, M0, M1, M2);
171
172 //---------- nucleation terms
173
174 double Jnuc = nucl->getNucleationSootRate(state); // #/m3*s
175
176 const double mMin = state.cMin*gasSpMW[(int)gasSp::C]/Na;
177
179 N0 = Jnuc; // #/m3*s
180 N1 = Jnuc * mMin; // kg_soot/m3*s
181 N2 = Jnuc * mMin * mMin;
182 }
183
184 //---------- PAH condensation
185
187
188 double mDimer = nucl->DIMER.mDimer;
189 double nDimer = nucl->DIMER.nDimer;
190
191 const double mD16 = pow(mDimer, 1./6.);
192 const double mDn16 = pow(mDimer, -1./6.);
193 const double mDn36 = pow(mDimer, -0.5);
194 const double mD26 = pow(mDimer, onethird);
195 const double mDn26 = pow(mDimer, -onethird);
196 const double mD46 = pow(mDimer, twothird);
197 const double mDn46 = pow(mDimer, -twothird);
198
199 double Ifm1, Ifm2, Ic1, Ic2;
200
201 //----------- FM (variable name: I for integrated, as in moment)
202
203 double Kfm = coag->getKfm(state);
204
205 Ifm1 = Kfm*bCoag * (M0 *mD16 + 2.*M26*mDn16 +
206 M46 *mDn36 + 2.*Mn16*mD26 +
207 Mn36*mD46 + M16);
208
209 Ifm2 = 2.*Kfm*bCoag * (M1 *mD16 + 2.*M86*mDn16 +
210 M106*mDn36 + 2.*M56*mD26 +
211 M36 *mD46 + M76);
212
213 //----------- continuum
214
215 double Kc = coag->getKc( state);
216 double Kcp = coag->getKcp(state);
217
218 Ic1 = Kc * ( 2.*M0 + Mn26*mD26 + M26*mDn26 +
219 Kcp*(M0*mDn26 + Mn26 + M26*mDn46 + Mn46*mD26) );
220
221
222 Ic2 = 2.*Kc * ( 2.*M1 + M46 *mD26 + M86*mDn26 +
223 Kcp*(M1*mDn26 + M46 + M86*mDn46 + M26*mD26) );
224
225 //----------- source terms
226
227 Cnd0 = 0.0;
228 Cnd1 = mDimer*nDimer*(Ifm1*Ic1)/(Ifm1 + Ic1);
229 Cnd2 = mDimer*nDimer*(Ifm2*Ic2)/(Ifm2 + Ic2);
230 }
231
232 //---------- growth terms
233
235 double Kgrw = grow->getGrowthSootRate(state);
236
237 G0 = 0;
238 G1 = Kgrw*M_PI*pow(6./(M_PI*rhoSoot), twothird)*M46;
239 G2 = Kgrw*M_PI*pow(6./(M_PI*rhoSoot), twothird)*M106* 2.0;
240 }
241
242 //---------- oxidation terms
243
245 double Koxi = oxid->getOxidationSootRate(state);
246
247 X0 = 0;
248 X1 = -Koxi*M_PI*pow(6.0/(M_PI*rhoSoot), twothird)*M46;
249 X2 = -Koxi*M_PI*pow(6.0/(M_PI*rhoSoot), twothird)*M106* 2.0;
250 }
251
252 //---------- coagulation terms
253
255
256 double C0_fm, C2_fm, C0_c, C2_c;
257
260 double Kfm = coag->getKfm(state);
261 C0_fm = -Kfm*bCoag*(M0*M16 + 2.*M26*Mn16 + M46*Mn36); // free molecular
262 C2_fm = 2.*Kfm*bCoag*(M1*M76 + 2.*M86*M56 + M106*M36);
263 }
264
267 double Kc = coag->getKc( state);
268 double Kcp = coag->getKcp(state);
269 C0_c = -Kc*(M0*M0 + M26*Mn26 + Kcp*(M0*Mn26 + M26*Mn46)); // continuum
270 C2_c = 2.*Kc*(M1*M1 + M46*M86 + Kcp*(M1*M46 + M26*M86));
271 }
272
273
274 C1 = 0.0;
276 C0 = C0_fm;
277 C2 = C2_fm;
278 }
280 C0 = C0_c;
281 C2 = C2_c;
282 }
283 else { // harmonic mean
284 C0 = (C0_fm > 0 || C0_c > 0) ? C0_fm*C0_c/(C0_fm + C0_c) : 0.0;
285 C2 = (C2_fm > 0 || C2_c > 0) ? C2_fm*C2_c/(C2_fm + C2_c) : 0.0;
286 }
287 }
288
289 //---------- combine to make soot source terms
290
291 sources.sootSources[0] = (N0 + G0 + Cnd0 - X0 + C0); // #/m3*s
292 sources.sootSources[1] = (N1 + G1 + Cnd1 - X1 + C1); // kg/m3*s
293 sources.sootSources[2] = (N2 + G2 + Cnd2 - X2 + C2);
294
295 //---------- set gas source terms
296
297 vector<double> nucl_gasSources((size_t)gasSp::size, 0.0);
298 vector<double> grow_gasSources((size_t)gasSp::size, 0.0);
299 vector<double> oxid_gasSources((size_t)gasSp::size, 0.0);
300
301 nucl->getNucleationGasRates(N1, nucl_gasSources);
302 grow->getGrowthGasRates( G1, grow_gasSources);
303 oxid->getOxidationGasRates( X1, oxid_gasSources);
304
305 for (size_t sp=0; sp<(size_t)gasSp::size; sp++)
306 sources.gasSources[sp] = nucl_gasSources[sp] + grow_gasSources[sp] + oxid_gasSources[sp];
307
308 //---------- set PAH source terms
309
312
313}
314
325
326double sootModel_LOGN::Mr(double r, double M0, double M1, double M2) const {
327
328 if (M0 <= 0.0) return 0;
329
330 double M0_exp = 1. + 0.5*r*(r - 3.);
331 double M1_exp = r*(2. - r);
332 double M2_exp = 0.5*r*(r - 1.);
333
334 if ( (M0 <= 0.0 && M0_exp <= 0) || (M1 <= 0.0 && M1_exp <= 0) || (M2 <= 0.0 && M2_exp <= 0) )
335 return 0.0;
336 else
337 return pow(M0, M0_exp) * pow(M1, M1_exp) * pow(M2, M2_exp);
338
339}
virtual double getKcp(const state &state) const
coagulationMech mechType
identity of the type of coagulation (child)
virtual double getKfm(const state &state) const
virtual double getKc(const state &state) const
void getGrowthGasRates(const double &msootDotGrow, std::vector< double > &gasSourcesGrow) const
Definition: growthModel.cc:16
virtual double getGrowthSootRate(const state &state) const =0
growthMech mechType
identity of the type of growth (child)
Definition: growthModel.h:24
std::vector< double > nucleationPahRxnRates
mole ratios for PAH gas species rate coupling
void getNucleationGasRates(const double &msootDotNucl, std::vector< double > &gasSourcesNucl) const
dimerStruct DIMER
used for PAH nucleation only
nucleationMech mechType
identity of the type of nucleation (child)
virtual double getNucleationSootRate(state &state)=0
void getOxidationGasRates(const double &msootDotOxid, std::vector< double > &gasSourcesOxid) const
oxidationMech mechType
identity of the type of oxidation (child)
virtual double getOxidationSootRate(const state &state) const =0
double Mr(double k, double M0, double M1, double M2) const
sootModel_LOGN(size_t nsoot_, nucleationModel *nucl_, growthModel *grow_, oxidationModel *oxid_, coagulationModel *coag_)
virtual double pahSootCollisionRatePerDimer(const state &state, const double mDimer) const
virtual void setSourceTerms(state &state)
coagulationModel * coag
pointer to coagulation mechanism
Definition: sootModel.h:33
psdMech psdMechType
one of MONO, LOGN, QMOM, MOMIC, SECT, etc.
Definition: sootModel.h:37
sourceTerms sources
struct containing soot, gas, and pah source terms vectors
Definition: sootModel.h:42
nucleationModel * nucl
pointer to nucleation mechanism
Definition: sootModel.h:30
growthModel * grow
pointer to growth mechanism
Definition: sootModel.h:31
oxidationModel * oxid
pointer to oxidation mechanism
Definition: sootModel.h:32
std::vector< double > sootVar
soot variables (moments or # in sections>
Definition: state.h:32
double cMin
soot min num carbon atoms (dynamic for PAH nucleation)
Definition: state.h:36
Definition: sootDefs.h:11
oxidationMech
Definition: sootDefs.h:33
const double rhoSoot
soot particle density
Definition: sootDefs.h:21
const double onethird
Definition: sootDefs.h:24
coagulationMech
Definition: sootDefs.h:34
growthMech
Definition: sootDefs.h:32
nucleationMech
Definition: sootDefs.h:31
const double bCoag
coagulation constant, bounded 1/sqrt(2) < bCoag < 1
Definition: sootDefs.h:22
const double twothird
Definition: sootDefs.h:25
const double Na
Avogadro's constant: #/kmol.
Definition: sootDefs.h:15
const std::vector< double > gasSpMW
(kg/kmol); make sure the order corresponds to the gasSp enum
Definition: sootDefs.h:74
std::vector< double > pahSources
kg/m3*s
Definition: sootDefs.h:143
std::vector< double > gasSources
kg/m3*s
Definition: sootDefs.h:142
std::vector< double > sootSources
kg^r/m3*s (moments), or #/m3*s (sections)
Definition: sootDefs.h:141