Exemplo n.º 1
0
/**
 *
 * getFwdRateConstants():
 *
 * Update the rate of progress for the reactions.
 * This key routine makes sure that the rate of progress vectors
 * located in the solid kinetics data class are up to date.
 */
void GasKinetics::
getFwdRateConstants(doublereal* kfwd)
{
    _update_rates_C();
    _update_rates_T();

    // copy rate coefficients into ropf
    copy(m_rfn.begin(), m_rfn.end(), m_ropf.begin());

    // multiply ropf by enhanced 3b conc for all 3b rxns
    if (!concm_3b_values.empty()) {
        m_3b_concm.multiply(&m_ropf[0], &concm_3b_values[0]);
    }

    /*
     * This routine is hardcoded to replace some of the values
     * of the ropf vector.
     */
    if (m_nfall) {
        processFalloffReactions();
    }

    // multiply by perturbation factor
    multiply_each(m_ropf.begin(), m_ropf.end(), m_perturb.begin());

    for (size_t i = 0; i < m_ii; i++) {
        kfwd[i] = m_ropf[i];
    }
}
Exemplo n.º 2
0
void AqueousKinetics::updateROP()
{
    _update_rates_T();
    _update_rates_C();

    if (m_ROP_ok) {
        return;
    }

    // copy rate coefficients into ropf
    m_ropf = m_rfn;

    // multiply by perturbation factor
    multiply_each(m_ropf.begin(), m_ropf.end(), m_perturb.begin());

    // copy the forward rates to the reverse rates
    m_ropr = m_ropf;

    // for reverse rates computed from thermochemistry, multiply the forward
    // rates copied into m_ropr by the reciprocals of the equilibrium constants
    multiply_each(m_ropr.begin(), m_ropr.end(), m_rkcn.begin());

    // multiply ropf by concentration products
    m_reactantStoich.multiply(m_conc.data(), m_ropf.data());

    // for reversible reactions, multiply ropr by concentration products
    m_revProductStoich.multiply(m_conc.data(), m_ropr.data());

    for (size_t j = 0; j != nReactions(); ++j) {
        m_ropnet[j] = m_ropf[j] - m_ropr[j];
    }

    m_ROP_ok = true;
}
Exemplo n.º 3
0
    /**
     * Update the rates of progress of the reactions in the reaciton
     * mechanism. This routine operates on internal data.
     */
    void InterfaceKinetics::getFwdRateConstants(doublereal* kfwd) {

        _update_rates_T();
        _update_rates_C();

        const vector_fp& rf = m_kdata->m_rfn;

        // copy rate coefficients into kfwd
        copy(rf.begin(), rf.end(), kfwd);

        // multiply by perturbation factor
        multiply_each(kfwd, kfwd + nReactions(), m_perturb.begin());
           
    }
Exemplo n.º 4
0
void AqueousKinetics::getFwdRateConstants(doublereal* kfwd)
{
    _update_rates_T();
    _update_rates_C();

    // copy rate coefficients into ropf
    m_ropf = m_rfn;

    // multiply by perturbation factor
    multiply_each(m_ropf.begin(), m_ropf.end(), m_perturb.begin());

    for (size_t i = 0; i < nReactions(); i++) {
        kfwd[i] = m_ropf[i];
    }
}
Exemplo n.º 5
0
//====================================================================================================================
void GasKinetics::updateROP()
{
    _update_rates_C();
    _update_rates_T();

    if (m_ROP_ok) {
        return;
    }

    // copy rate coefficients into ropf
    copy(m_rfn.begin(), m_rfn.end(), m_ropf.begin());

    // multiply ropf by enhanced 3b conc for all 3b rxns
    if (!concm_3b_values.empty()) {
        m_3b_concm.multiply(&m_ropf[0], &concm_3b_values[0]);
    }

    if (m_nfall) {
        processFalloffReactions();
    }

    // multiply by perturbation factor
    multiply_each(m_ropf.begin(), m_ropf.end(), m_perturb.begin());

    // copy the forward rates to the reverse rates
    copy(m_ropf.begin(), m_ropf.end(), m_ropr.begin());

    // for reverse rates computed from thermochemistry, multiply
    // the forward rates copied into m_ropr by the reciprocals of
    // the equilibrium constants
    multiply_each(m_ropr.begin(), m_ropr.end(), m_rkcn.begin());

    // multiply ropf by concentration products
    m_rxnstoich.multiplyReactants(&m_conc[0], &m_ropf[0]);
    //m_reactantStoich.multiply(m_conc.begin(), ropf.begin());

    // for reversible reactions, multiply ropr by concentration
    // products
    m_rxnstoich.multiplyRevProducts(&m_conc[0], &m_ropr[0]);
    //m_revProductStoich.multiply(m_conc.begin(), ropr.begin());

    for (size_t j = 0; j != m_ii; ++j) {
        m_ropnet[j] = m_ropf[j] - m_ropr[j];
    }

    m_ROP_ok = true;
}
Exemplo n.º 6
0
    /**
     * Update the rates of progress of the reactions in the reaciton
     * mechanism. This routine operates on internal data.
     */
    void InterfaceKinetics::updateROP() {

        _update_rates_T();
        _update_rates_C();

        if (m_kdata->m_ROP_ok) return;

        const vector_fp& rf = m_kdata->m_rfn;
        const vector_fp& m_rkc = m_kdata->m_rkcn;
        array_fp& ropf = m_kdata->m_ropf;
        array_fp& ropr = m_kdata->m_ropr;
        array_fp& ropnet = m_kdata->m_ropnet;

        // copy rate coefficients into ropf
        copy(rf.begin(), rf.end(), ropf.begin());

        // multiply by perturbation factor
        multiply_each(ropf.begin(), ropf.end(), m_perturb.begin());
           
        // copy the forward rates to the reverse rates                
        copy(ropf.begin(), ropf.end(), ropr.begin());
        
        // for reverse rates computed from thermochemistry, multiply
        // the forward rates copied into m_ropr by the reciprocals of
        // the equilibrium constants
        multiply_each(ropr.begin(), ropr.end(), m_rkc.begin());

        // multiply ropf by concentration products
        m_rxnstoich.multiplyReactants(DATA_PTR(m_conc), DATA_PTR(ropf)); 
        //m_reactantStoich.multiply(m_conc.begin(), ropf.begin()); 

        // for reversible reactions, multiply ropr by concentration
        // products
        m_rxnstoich.multiplyRevProducts(DATA_PTR(m_conc), 
            DATA_PTR(ropr)); 
        //m_revProductStoich.multiply(m_conc.begin(), ropr.begin());

        // do global reactions
        //m_globalReactantStoich.power(m_conc.begin(), ropf.begin());

        for (int j = 0; j != m_ii; ++j) {
            ropnet[j] = ropf[j] - ropr[j];
        }        

        m_kdata->m_ROP_ok = true;
    }
Exemplo n.º 7
0
  /**
   * Update the rates of progress of the reactions in the reaction
   * mechanism. This routine operates on internal data.
   */
  void InterfaceKinetics::updateROP() {

    _update_rates_T();
    _update_rates_C();

    if (m_kdata->m_ROP_ok) return;

    const vector_fp& rf = m_kdata->m_rfn;
    const vector_fp& m_rkc = m_kdata->m_rkcn;
    array_fp& ropf = m_kdata->m_ropf;
    array_fp& ropr = m_kdata->m_ropr;
    array_fp& ropnet = m_kdata->m_ropnet;

    // copy rate coefficients into ropf
    copy(rf.begin(), rf.end(), ropf.begin());

    // multiply by perturbation factor
    multiply_each(ropf.begin(), ropf.end(), m_perturb.begin());
           
    // copy the forward rates to the reverse rates                
    copy(ropf.begin(), ropf.end(), ropr.begin());
        
    // for reverse rates computed from thermochemistry, multiply
    // the forward rates copied into m_ropr by the reciprocals of
    // the equilibrium constants
    multiply_each(ropr.begin(), ropr.end(), m_rkc.begin());

    // multiply ropf by concentration products
    m_rxnstoich.multiplyReactants(DATA_PTR(m_conc), DATA_PTR(ropf)); 
    //m_reactantStoich.multiply(m_conc.begin(), ropf.begin()); 

    // for reversible reactions, multiply ropr by concentration
    // products
    m_rxnstoich.multiplyRevProducts(DATA_PTR(m_conc), 
				    DATA_PTR(ropr)); 
    //m_revProductStoich.multiply(m_conc.begin(), ropr.begin());

    // do global reactions
    //m_globalReactantStoich.power(m_conc.begin(), ropf.begin());

    for (int j = 0; j != m_ii; ++j) {
      ropnet[j] = ropf[j] - ropr[j];
    }  


    /*
     *  For reactions involving multiple phases, we must check that the phase
     *  being consumed actually exists. This is particularly important for 
     *  phases that are stoichiometric phases containing one species with a unity activity
     */
    if (m_phaseExistsCheck) {
      for (int j = 0; j != m_ii; ++j) {
	if ((ropr[j] >  ropf[j]) && (ropr[j] > 0.0)) {
	  for (int p = 0; p < nPhases(); p++) {
	    if (m_rxnPhaseIsProduct[j][p]) {
	      if (! m_phaseExists[p]) {
		ropnet[j] = 0.0;
		ropr[j] = ropf[j];
		if (ropf[j] > 0.0) {
		  for (int rp = 0; rp < nPhases(); rp++) {
		    if (m_rxnPhaseIsReactant[j][rp]) {
		      if (! m_phaseExists[rp]) {
			ropnet[j] = 0.0;
			ropr[j] = ropf[j] = 0.0;;
		      }
		    }
		  }
		}
	      }
	    }
	    if (m_rxnPhaseIsReactant[j][p]) {
	      if (! m_phaseIsStable[p]) {
		ropnet[j] = 0.0;
		ropr[j] = ropf[j];
	      }
	    }
	  }
	} else if ((ropf[j] > ropr[j]) && (ropf[j] > 0.0)) {
	  for (int p = 0; p < nPhases(); p++) {
	    if (m_rxnPhaseIsReactant[j][p]) {
	      if (! m_phaseExists[p]) {
		ropnet[j] = 0.0;
		ropf[j] = ropr[j];     
		if (ropf[j] > 0.0) {
		  for (int rp = 0; rp < nPhases(); rp++) {
		    if (m_rxnPhaseIsProduct[j][rp]) {
		      if (! m_phaseExists[rp]) {
			ropnet[j] = 0.0;
			ropf[j] = ropr[j] = 0.0;
		      }
		    }
		  }
		}
	      }
	    }
	    if (m_rxnPhaseIsProduct[j][p]) {
	      if (! m_phaseIsStable[p]) {
		ropnet[j] = 0.0;
		ropf[j] = ropr[j];
	      }
	    }
	  }
	}
      }
    }

    m_kdata->m_ROP_ok = true;
  }
Exemplo n.º 8
0
 /*
  *  @param conc  (output) Vector of activity concentrations. Length is 
  *               equal to the number of species in the kinetics object
  */
 void InterfaceKinetics::getActivityConcentrations(doublereal * const conc) {
   _update_rates_C();
   copy(m_conc.begin(), m_conc.end(), conc);
 }