28 AqueousKinetics::AqueousKinetics(
thermo_t* thermo) :
66 m_nfall = right.m_nfall;
67 m_rates = right.m_rates;
68 m_index = right.m_index;
69 m_irrev = right.m_irrev;
71 m_rxnstoich = right.m_rxnstoich;
73 m_fwdOrder = right.m_fwdOrder;
74 m_nirrev = right.m_nirrev;
75 m_nrev = right.m_nrev;
76 m_rgroups = right.m_rgroups;
77 m_pgroups = right.m_pgroups;
78 m_rxntype = right.m_rxntype;
79 m_rrxn = right.m_rrxn;
80 m_prxn = right.m_prxn;
82 m_revindex = right.m_revindex;
83 m_rxneqn = right.m_rxneqn;
85 m_ropf = right.m_ropf;
86 m_ropr = right.m_ropr;
87 m_ropnet = right.m_ropnet;
88 m_ROP_ok = right.m_ROP_ok;
89 m_temp = right.m_temp;
91 m_rkcn = right.m_rkcn;
93 m_conc = right.m_conc;
95 m_finalized = right.m_finalized;
97 throw CanteraError(
"GasKinetics::operator=()",
98 "Unfinished implementation");
119 void AqueousKinetics::
122 void AqueousKinetics::_update_rates_T()
125 doublereal logT = log(T);
126 m_rates.
update(T, logT, &m_rfn[0]);
154 fill(m_rkcn.begin(), m_rkcn.end(), 0.0);
157 m_grt[k] -= rt * logStandConc_k;
165 for (
size_t i = 0; i < m_nrev; i++) {
166 size_t irxn = m_revindex[i];
167 m_rkcn[irxn] = exp(m_rkcn[irxn]*rrt);
170 for (
size_t i = 0; i != m_nirrev; ++i) {
171 m_rkcn[ m_irrev[i] ] = 0.0;
184 fill(m_rkcn.begin(), m_rkcn.end(), 0.0);
188 m_grt[k] -= rt * logStandConc_k;
195 for (
size_t i = 0; i <
m_ii; i++) {
196 kc[i] = exp(-m_rkcn[i]*rrt);
327 for (
size_t k = 0; k <
m_kk; k++) {
357 for (
size_t k = 0; k <
m_kk; k++) {
369 void AqueousKinetics::updateROP()
379 copy(m_rfn.begin(), m_rfn.end(), m_ropf.begin());
385 copy(m_ropf.begin(), m_ropf.end(), m_ropr.begin());
401 for (
size_t j = 0; j !=
m_ii; ++j) {
402 m_ropnet[j] = m_ropf[j] - m_ropr[j];
423 copy(m_rfn.begin(), m_rfn.end(), m_ropf.begin());
428 for (
size_t i = 0; i <
m_ii; i++) {
454 if (doIrreversible) {
456 for (
size_t i = 0; i <
m_ii; i++) {
457 krev[i] /= m_ropnet[i];
463 for (
size_t i = 0; i <
m_ii; i++) {
464 krev[i] *= m_rkcn[i];
473 addElementaryReaction(r);
478 installGroups(reactionNumber(), r.rgroups, r.pgroups);
480 m_rxneqn.push_back(r.equation);
486 void AqueousKinetics::addElementaryReaction(ReactionData& r)
491 iloc = m_rates.
install(reactionNumber(), r);
494 m_rfn.push_back(r.rateCoeffParameters[0]);
497 m_fwdOrder.push_back(r.reactants.size());
504 void AqueousKinetics::installReagents(
const ReactionData& r)
507 m_ropf.push_back(0.0);
508 m_ropr.push_back(0.0);
509 m_ropnet.push_back(0.0);
512 doublereal reactantGlobalOrder = 0.0;
513 doublereal productGlobalOrder = 0.0;
514 size_t rnum = reactionNumber();
516 std::vector<size_t> rk;
517 size_t nr = r.reactants.size();
518 for (n = 0; n < nr; n++) {
519 nsFlt = r.rstoich[n];
520 reactantGlobalOrder += nsFlt;
522 if ((doublereal) ns != nsFlt) {
527 if (r.rstoich[n] != 0.0) {
528 m_rrxn[r.reactants[n]][rnum] += r.rstoich[n];
530 for (m = 0; m < ns; m++) {
531 rk.push_back(r.reactants[n]);
536 std::vector<size_t> pk;
537 size_t np = r.products.size();
538 for (n = 0; n < np; n++) {
539 nsFlt = r.pstoich[n];
540 productGlobalOrder += nsFlt;
542 if ((
double) ns != nsFlt) {
547 if (r.pstoich[n] != 0.0) {
548 m_prxn[r.products[n]][rnum] += r.pstoich[n];
550 for (m = 0; m < ns; m++) {
551 pk.push_back(r.products[n]);
556 m_rkcn.push_back(0.0);
558 m_rxnstoich.
add(reactionNumber(), r);
561 m_dn.push_back(productGlobalOrder - reactantGlobalOrder);
562 m_revindex.push_back(reactionNumber());
565 m_dn.push_back(productGlobalOrder - reactantGlobalOrder);
566 m_irrev.push_back(reactionNumber());
572 void AqueousKinetics::installGroups(
size_t irxn,
573 const vector<grouplist_t>& r,
574 const vector<grouplist_t>& p)
578 m_rgroups[reactionNumber()] = r;
579 m_pgroups[reactionNumber()] = p;
602 m_ropf.resize(1, 0.0);
603 m_ropr.resize(1, 0.0);
604 m_ropnet.resize(1, 0.0);
605 m_rkcn.resize(1, 0.0);
612 return (m_finalized);