75 m_nfall = right.m_nfall;
76 m_fallindx = right.m_fallindx;
77 m_falloff_low_rates = right.m_falloff_low_rates;
78 m_falloff_high_rates = right.m_falloff_high_rates;
79 m_rates = right.m_rates;
80 m_index = right.m_index;
81 m_falloffn = right.m_falloffn;
82 m_3b_concm = right.m_3b_concm;
83 m_falloff_concm = right.m_falloff_concm;
84 m_irrev = right.m_irrev;
85 m_plog_rates = right.m_plog_rates;
86 m_cheb_rates = right.m_cheb_rates;
88 m_rxnstoich = right.m_rxnstoich;
90 m_fwdOrder = right.m_fwdOrder;
91 m_nirrev = right.m_nirrev;
92 m_nrev = right.m_nrev;
93 m_rgroups = right.m_rgroups;
94 m_pgroups = right.m_pgroups;
95 m_rxntype = right.m_rxntype;
96 m_rrxn = right.m_rrxn;
97 m_prxn = right.m_prxn;
99 m_revindex = right.m_revindex;
100 m_rxneqn = right.m_rxneqn;
102 m_logp_ref = right.m_logp_ref;
103 m_logc_ref = right.m_logc_ref;
104 m_logStandConc = right.m_logStandConc;
105 m_ropf = right.m_ropf;
106 m_ropr = right.m_ropr;
107 m_ropnet = right.m_ropnet;
108 m_rfn_low = right.m_rfn_low;
109 m_rfn_high = right.m_rfn_high;
110 m_ROP_ok = right.m_ROP_ok;
111 m_temp = right.m_temp;
113 falloff_work = right.falloff_work;
114 concm_3b_values = right.concm_3b_values;
115 concm_falloff_values = right.concm_falloff_values;
116 m_rkcn = right.m_rkcn;
118 m_conc = right.m_conc;
120 m_finalized = right.m_finalized;
123 "Unfinished implementation");
162 m_logStandConc = log(
thermo().standardConcentration());
163 doublereal logT = log(T);
164 if (!m_rfn.empty()) {
165 m_rates.
update(T, logT, &m_rfn[0]);
168 if (!m_rfn_low.empty()) {
169 m_falloff_low_rates.
update(T, logT, &m_rfn_low[0]);
170 m_falloff_high_rates.
update(T, logT, &m_rfn_high[0]);
172 if (!falloff_work.empty()) {
175 if (m_plog_rates.nReactions()) {
176 m_plog_rates.
update(T, logT, &m_rfn[0]);
179 if (m_cheb_rates.nReactions()) {
180 m_cheb_rates.
update(T, logT, &m_rfn[0]);
197 if (!concm_3b_values.empty()) {
198 m_3b_concm.update(m_conc, ctot, &concm_3b_values[0]);
202 if (!concm_falloff_values.empty()) {
203 m_falloff_concm.update(m_conc, ctot, &concm_falloff_values[0]);
207 if (m_plog_rates.nReactions()) {
208 double logP = log(
thermo().pressure());
213 if (m_cheb_rates.nReactions()) {
214 double log10P = log10(
thermo().pressure());
227 fill(m_rkcn.begin(), m_rkcn.end(), 0.0);
233 for (
size_t i = 0; i < m_nrev; i++) {
234 size_t irxn = m_revindex[i];
235 m_rkcn[irxn] =
std::min(exp(m_rkcn[irxn]*rrt -
m_dn[irxn]*m_logStandConc),
239 for (
size_t i = 0; i != m_nirrev; ++i) {
240 m_rkcn[ m_irrev[i] ] = 0.0;
252 fill(m_rkcn.begin(), m_rkcn.end(), 0.0);
258 for (
size_t i = 0; i <
m_ii; i++) {
259 kc[i] = exp(-m_rkcn[i]*rrt +
m_dn[i]*m_logStandConc);
390 for (
size_t k = 0; k <
m_kk; k++) {
420 for (
size_t k = 0; k <
m_kk; k++) {
481 void GasKinetics::processFalloffReactions()
486 for (
size_t i = 0; i < m_nfall; i++) {
487 pr[i] = concm_falloff_values[i] * m_rfn_low[i] / m_rfn_high[i];
490 double* work = (falloff_work.empty()) ? 0 : &falloff_work[0];
493 for (
size_t i = 0; i < m_nfall; i++) {
494 pr[i] *= m_rfn_high[i];
498 m_ropf.begin(), m_fallindx.begin());
502 void GasKinetics::updateROP()
512 copy(m_rfn.begin(), m_rfn.end(), m_ropf.begin());
515 if (!concm_3b_values.empty()) {
516 m_3b_concm.multiply(&m_ropf[0], &concm_3b_values[0]);
520 processFalloffReactions();
527 copy(m_ropf.begin(), m_ropf.end(), m_ropr.begin());
543 for (
size_t j = 0; j !=
m_ii; ++j) {
544 m_ropnet[j] = m_ropf[j] - m_ropr[j];
565 copy(m_rfn.begin(), m_rfn.end(), m_ropf.begin());
568 if (!concm_3b_values.empty()) {
569 m_3b_concm.multiply(&m_ropf[0], &concm_3b_values[0]);
577 processFalloffReactions();
583 for (
size_t i = 0; i <
m_ii; i++) {
609 if (doIrreversible) {
611 for (
size_t i = 0; i <
m_ii; i++) {
612 krev[i] /= m_ropnet[i];
616 for (
size_t i = 0; i <
m_ii; i++) {
617 krev[i] *= m_rkcn[i];
625 switch (r.reactionType) {
627 addElementaryReaction(r);
630 addThreeBodyReaction(r);
633 addFalloffReaction(r);
639 addChebyshevReaction(r);
642 throw CanteraError(
"GasKinetics::addReaction",
"Invalid reaction type specified");
647 installGroups(reactionNumber(), r.rgroups, r.pgroups);
649 m_rxneqn.push_back(r.equation);
654 addFalloffReaction(ReactionData& r)
658 size_t iloc = m_falloff_high_rates.
install(m_nfall, r);
659 m_rfn_high.push_back(r.rateCoeffParameters[0]);
660 std::swap(r.rateCoeffParameters, r.auxRateCoeffParameters);
661 m_falloff_low_rates.
install(m_nfall, r);
662 m_rfn_low.push_back(r.rateCoeffParameters[0]);
666 m_rfn.push_back(0.0);
670 m_fallindx.push_back(reactionNumber());
674 m_falloff_concm.install(m_nfall, r.thirdBodyEfficiencies,
679 m_falloffn.
install(m_nfall, r.falloffType, r.falloffParameters);
683 m_fwdOrder.push_back(r.reactants.size());
687 registerReaction(reactionNumber(),
FALLOFF_RXN, iloc);
692 addElementaryReaction(ReactionData& r)
695 size_t iloc = m_rates.
install(reactionNumber(), r);
698 m_rfn.push_back(r.rateCoeffParameters[0]);
701 m_fwdOrder.push_back(r.reactants.size());
707 addThreeBodyReaction(ReactionData& r)
710 size_t iloc = m_rates.
install(reactionNumber(), r);
713 m_rfn.push_back(r.rateCoeffParameters[0]);
716 m_fwdOrder.push_back(r.reactants.size() + 1);
718 m_3b_concm.install(reactionNumber(), r.thirdBodyEfficiencies,
724 void GasKinetics::addPlogReaction(ReactionData& r)
727 size_t iloc = m_plog_rates.
install(reactionNumber(), r);
730 m_rfn.push_back(0.0);
732 m_fwdOrder.push_back(r.reactants.size());
733 registerReaction(reactionNumber(),
PLOG_RXN, iloc);
736 void GasKinetics::addChebyshevReaction(ReactionData& r)
739 size_t iloc = m_cheb_rates.
install(reactionNumber(), r);
742 m_rfn.push_back(0.0);
744 m_fwdOrder.push_back(r.reactants.size());
748 void GasKinetics::installReagents(
const ReactionData& r)
750 m_ropf.push_back(0.0);
751 m_ropr.push_back(0.0);
752 m_ropnet.push_back(0.0);
755 doublereal reactantGlobalOrder = 0.0;
756 doublereal productGlobalOrder = 0.0;
757 size_t rnum = reactionNumber();
759 std::vector<size_t> rk;
760 size_t nr = r.reactants.size();
761 for (n = 0; n < nr; n++) {
762 nsFlt = r.rstoich[n];
763 reactantGlobalOrder += nsFlt;
765 if ((doublereal) ns != nsFlt) {
770 if (r.rstoich[n] != 0.0) {
771 m_rrxn[r.reactants[n]][rnum] += r.rstoich[n];
773 for (m = 0; m < ns; m++) {
774 rk.push_back(r.reactants[n]);
779 std::vector<size_t> pk;
780 size_t np = r.products.size();
781 for (n = 0; n < np; n++) {
782 nsFlt = r.pstoich[n];
783 productGlobalOrder += nsFlt;
785 if ((
double) ns != nsFlt) {
790 if (r.pstoich[n] != 0.0) {
791 m_prxn[r.products[n]][rnum] += r.pstoich[n];
793 for (m = 0; m < ns; m++) {
794 pk.push_back(r.products[n]);
798 m_rkcn.push_back(0.0);
799 m_rxnstoich.
add(reactionNumber(), r);
802 m_dn.push_back(productGlobalOrder - reactantGlobalOrder);
803 m_revindex.push_back(reactionNumber());
806 m_dn.push_back(productGlobalOrder - reactantGlobalOrder);
807 m_irrev.push_back(reactionNumber());
814 void GasKinetics::installGroups(
size_t irxn,
815 const vector<grouplist_t>& r,
const vector<grouplist_t>& p)
819 m_rgroups[reactionNumber()] = r;
820 m_pgroups[reactionNumber()] = p;
838 falloff_work.resize(m_falloffn.
workSize());
839 concm_3b_values.resize(m_3b_concm.workSize());
840 concm_falloff_values.resize(m_falloff_concm.workSize());
847 m_ropf.resize(1, 0.0);
848 m_ropr.resize(1, 0.0);
849 m_ropnet.resize(1, 0.0);
850 m_rkcn.resize(1, 0.0);
857 return (m_finalized);