Beispiel #1
0
//====================================================================================================================
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);
}
    /**
     * 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);
    }
Beispiel #3
0
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);
}
Beispiel #4
0
  /**
   * 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;
    }
 }