//==================================================================================================================== void GasKinetics:: addReaction(ReactionData& r) { switch (r.reactionType) { case ELEMENTARY_RXN: addElementaryReaction(r); break; case THREE_BODY_RXN: addThreeBodyReaction(r); break; case FALLOFF_RXN: addFalloffReaction(r); break; case PLOG_RXN: addPlogReaction(r); break; case CHEBYSHEV_RXN: addChebyshevReaction(r); break; default: throw CanteraError("GasKinetics::addReaction", "Invalid reaction type specified"); } // operations common to all reaction types installReagents(r); installGroups(reactionNumber(), r.rgroups, r.pgroups); incrementRxnCount(); m_rxneqn.push_back(r.equation); }
bool GasKinetics::addReaction(shared_ptr<Reaction> r) { // operations common to all reaction types bool added = BulkKinetics::addReaction(r); if (!added) { return false; } switch (r->reaction_type) { case ELEMENTARY_RXN: addElementaryReaction(dynamic_cast<ElementaryReaction&>(*r)); break; case THREE_BODY_RXN: addThreeBodyReaction(dynamic_cast<ThreeBodyReaction&>(*r)); break; case FALLOFF_RXN: case CHEMACT_RXN: addFalloffReaction(dynamic_cast<FalloffReaction&>(*r)); break; case PLOG_RXN: addPlogReaction(dynamic_cast<PlogReaction&>(*r)); break; case CHEBYSHEV_RXN: addChebyshevReaction(dynamic_cast<ChebyshevReaction&>(*r)); break; default: throw CanteraError("GasKinetics::addReaction", "Unknown reaction type specified: " + int2str(r->reaction_type)); } return true; }
/** * Add a single reaction to the mechanism. This routine * must be called after init() and before finalize(). * This function branches on the types of reactions allowed * by the interfaceKinetics manager in order to install * the reaction correctly in the manager. * The manager allows the following reaction types * Elementary * Surface * Global * There is no difference between elementary and surface * reactions. */ void InterfaceKinetics:: addReaction(const ReactionData& r) { addElementaryReaction(r); // operations common to all reaction types installReagents( r ); //installGroups(reactionNumber(), r.rgroups, r.pgroups); incrementRxnCount(); m_rxneqn.push_back(r.equation); }
void AqueousKinetics::addReaction(ReactionData& r) { if (r.reactionType == ELEMENTARY_RXN) { addElementaryReaction(r); } // operations common to all reaction types installReagents(r); installGroups(reactionNumber(), r.rgroups, r.pgroups); incrementRxnCount(); m_rxneqn.push_back(r.equation); }
/** * Add a single reaction to the mechanism. This routine * must be called after init() and before finalize(). * This function branches on the types of reactions allowed * by the interfaceKinetics manager in order to install * the reaction correctly in the manager. * The manager allows the following reaction types * Elementary * Surface * Global * There is no difference between elementary and surface * reactions. */ void InterfaceKinetics::addReaction(const ReactionData& r) { /* * Install the rate coefficient for the current reaction * in the appropriate data structure. */ addElementaryReaction(r); /* * Add the reactants and products for m_ropnet;the current reaction * to the various stoichiometric coefficient arrays. */ installReagents(r); /* * Save the reaction and product groups, which are * part of the ReactionData class, in this class. * They aren't used for anything but reaction path * analysis. */ //installGroups(reactionNumber(), r.rgroups, r.pgroups); /* * Increase the internal number of reactions, m_ii, by one. * increase the size of m_perturb by one as well. */ incrementRxnCount(); m_rxneqn.push_back(r.equation); m_rxnPhaseIsReactant.resize(m_ii, 0); m_rxnPhaseIsProduct.resize(m_ii, 0); int np = nPhases(); int i = m_ii -1; m_rxnPhaseIsReactant[i] = new bool[np]; m_rxnPhaseIsProduct[i] = new bool[np]; for (int p = 0; p < np; p++) { m_rxnPhaseIsReactant[i][p] = false; m_rxnPhaseIsProduct[i][p] = false; } const vector_int& vr = reactants(i); for (int ik = 0; ik < (int) vr.size(); ik++) { int k = vr[ik]; int p = speciesPhaseIndex(k); m_rxnPhaseIsReactant[i][p] = true; } const vector_int& vp = products(i); for (int ik = 0; ik < (int) vp.size(); ik++) { int k = vp[ik]; int p = speciesPhaseIndex(k); m_rxnPhaseIsProduct[i][p] = true; } }
bool AqueousKinetics::addReaction(shared_ptr<Reaction> r) { bool added = BulkKinetics::addReaction(r); if (!added) { return false; } if (r->reaction_type == ELEMENTARY_RXN) { addElementaryReaction(dynamic_cast<ElementaryReaction&>(*r)); } else { throw CanteraError("AqueousKinetics::addReaction", "Invalid reaction type: {}", r->reaction_type); } return true; }