Cantera  2.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ReactionStoichMgr Class Reference

Reaction mechanism stoichiometry manager. More...

#include <ReactionStoichMgr.h>

Public Member Functions

 ReactionStoichMgr ()
 Constructor.
 
virtual ~ReactionStoichMgr ()
 Destructor.
 
 ReactionStoichMgr (const ReactionStoichMgr &right)
 
ReactionStoichMgroperator= (const ReactionStoichMgr &right)
 
virtual void add (size_t rxn, const std::vector< size_t > &reactants, const std::vector< size_t > &products, bool reversible)
 Add a reaction with mass-action kinetics.
 
virtual void add (size_t rxn, const ReactionData &r)
 Add a reaction with specified, possibly non-integral, reaction orders.
 
virtual void getCreationRates (size_t nSpecies, const doublereal *fwdRatesOfProgress, const doublereal *revRatesOfProgress, doublereal *creationRates)
 Species creation rates.
 
virtual void getDestructionRates (size_t nSpecies, const doublereal *fwdRatesOfProgress, const doublereal *revRatesOfProgress, doublereal *destructionRates)
 Species destruction rates.
 
virtual void getNetProductionRates (size_t nsp, const doublereal *ropnet, doublereal *w)
 Given the array of the net rates of progress for all reactions, compute the species net production rates and return them in array w.
 
virtual void getReactionDelta (size_t nReactions, const doublereal *g, doublereal *dg)
 Calculates the change of a molar species property in a reaction.
 
virtual void getRevReactionDelta (size_t nr, const doublereal *g, doublereal *dg)
 Given an array of species properties 'g', return in array 'dg' the change in this quantity in the reversible reactions.
 
virtual void multiplyReactants (const doublereal *C, doublereal *R)
 Given an array of concentrations C, multiply the entries in array R by the concentration products for the reactants:

\[ R_i = R_i * \prod_k C_k^{o_{k,i}} \]

.

 
virtual void multiplyRevProducts (const doublereal *c, doublereal *r)
 Given an array of concentrations C, multiply the entries in array R by the concentration products for the products:

\[ R_i = R_i * \prod_k C_k^{\nu^{(p)}_{k,i}} \]

Here \( \nu^{(p)}_{k,i} \) is the product stoichiometric coefficient of species k in reaction i.

 
virtual void write (std::string filename)
 

Protected Member Functions

void writeCreationRates (std::ostream &f)
 
void writeDestructionRates (std::ostream &f)
 
void writeNetProductionRates (std::ostream &f)
 
void writeMultiplyReactants (std::ostream &f)
 
void writeMultiplyRevProducts (std::ostream &f)
 

Protected Attributes

StoichManagerN m_reactants
 
StoichManagerN m_revproducts
 
StoichManagerN m_irrevproducts
 
vector_fp m_dummy
 

Detailed Description

Reaction mechanism stoichiometry manager.

This is an internal class used by kinetics manager classes, and is not meant for direct use in user programs.

Class ReactionStoichMgr handles the calculation of quantities involving the stoichiometry of a set of reactions. The reactions may have integer or non-integer stoichiometric coefficients. Specifically, its methods compute

To use this class, method 'add' is first used to add each reaction. Once all reactions have been added, the methods that compute various quantities may be called.

The nomenclature used below to document the methods is as follows.

Definition at line 56 of file ReactionStoichMgr.h.

Constructor & Destructor Documentation

Constructor.

Definition at line 24 of file ReactionStoichMgr.cpp.

~ReactionStoichMgr ( )
virtual

Destructor.

Definition at line 29 of file ReactionStoichMgr.cpp.

Member Function Documentation

void add ( size_t  rxn,
const std::vector< size_t > &  reactants,
const std::vector< size_t > &  products,
bool  reversible 
)
virtual

Add a reaction with mass-action kinetics.

Vectors 'reactants' and 'products' contain the integer species indices of the reactants and products, respectively. Note that if more than one molecule of a given species is involved in the reaction, then its index is repeated.

For example, suppose a reaction mechanism involves the species N2, O2, O, N, NO. N2 is assigned index number 0, O2 number 1, and so on through NO with number 4. Then the representation of the following reactions is as shown here.

  • N + O = NO
    • reactants: (3, 2)
    • products: (4)
  • O + O = O2
    • reactants: (2, 2) [ note repeated index ]
    • products: (1)
Parameters
rxnReaction number. This number will be used as the index into the rate of progress vector in the methods below.
reactantsvector of integer reactant indices
productsvector of integer product indices
reversibletrue if the reaction is reversible, false otherwise

Definition at line 56 of file ReactionStoichMgr.cpp.

void add ( size_t  rxn,
const ReactionData &  r 
)
virtual

Add a reaction with specified, possibly non-integral, reaction orders.

Parameters
rxnReaction number
rData structure containing reactant and product vectors, etc.

Definition at line 72 of file ReactionStoichMgr.cpp.

void getCreationRates ( size_t  nSpecies,
const doublereal *  fwdRatesOfProgress,
const doublereal *  revRatesOfProgress,
doublereal *  creationRates 
)
virtual

Species creation rates.

Given the arrays of the forward and reverse rates of progress for all reactions, compute the species creation rates, given by

\[ C = N_p Q_f + N_r Q_r. \]

Definition at line 129 of file ReactionStoichMgr.cpp.

Referenced by AqueousKinetics::getCreationRates(), GasKinetics::getCreationRates(), and InterfaceKinetics::getCreationRates().

void getDestructionRates ( size_t  nSpecies,
const doublereal *  fwdRatesOfProgress,
const doublereal *  revRatesOfProgress,
doublereal *  destructionRates 
)
virtual

Species destruction rates.

Given the arrays of the forward and reverse rates of progress for all reactions, compute the species destruction rates, given by

\[ D = N_r Q_f + N_p Q_r, \]

Note that the stoichiometric coefficient matrices are very sparse, integer matrices.

Definition at line 144 of file ReactionStoichMgr.cpp.

Referenced by AqueousKinetics::getDestructionRates(), GasKinetics::getDestructionRates(), and InterfaceKinetics::getDestructionRates().

void getNetProductionRates ( size_t  nsp,
const doublereal *  ropnet,
doublereal *  w 
)
virtual

Given the array of the net rates of progress for all reactions, compute the species net production rates and return them in array w.

Species net production rates. Given the array of the net rates of progress for all reactions, compute the species net production rates, given by

\[ W = (N_r - N_p) Q_{\rm net}, \]

Definition at line 155 of file ReactionStoichMgr.cpp.

Referenced by AqueousKinetics::getNetProductionRates(), GasKinetics::getNetProductionRates(), and InterfaceKinetics::getNetProductionRates().

void getReactionDelta ( size_t  nReactions,
const doublereal *  g,
doublereal *  dg 
)
virtual

Calculates the change of a molar species property in a reaction.

Given an array of species properties 'g', return in array 'dg' the change in this quantity in the reactions. Array 'g' must have a length at least as great as the number of species, and array 'dg' must have a length as great as the total number of reactions.

\[ \delta g_i = \sum_k{\nu_{i,k} g_k } \]

Parameters
nReactionsNumber of reactions
gMolar property of the species. An example would be the partial molar enthalpy Length is equal to number of kinetic species
dgCalculated property change of the reaction. An example would be the delta change in enthalpy, i.e., the enthalpy of reaction.

Definition at line 166 of file ReactionStoichMgr.cpp.

Referenced by InterfaceKinetics::applyButlerVolmerCorrection(), InterfaceKinetics::getDeltaElectrochemPotentials(), AqueousKinetics::getDeltaEnthalpy(), GasKinetics::getDeltaEnthalpy(), InterfaceKinetics::getDeltaEnthalpy(), AqueousKinetics::getDeltaEntropy(), GasKinetics::getDeltaEntropy(), InterfaceKinetics::getDeltaEntropy(), AqueousKinetics::getDeltaGibbs(), GasKinetics::getDeltaGibbs(), InterfaceKinetics::getDeltaGibbs(), AqueousKinetics::getDeltaSSEnthalpy(), GasKinetics::getDeltaSSEnthalpy(), InterfaceKinetics::getDeltaSSEnthalpy(), AqueousKinetics::getDeltaSSEntropy(), GasKinetics::getDeltaSSEntropy(), InterfaceKinetics::getDeltaSSEntropy(), AqueousKinetics::getDeltaSSGibbs(), GasKinetics::getDeltaSSGibbs(), InterfaceKinetics::getDeltaSSGibbs(), AqueousKinetics::getEquilibriumConstants(), GasKinetics::getEquilibriumConstants(), and InterfaceKinetics::getEquilibriumConstants().

void getRevReactionDelta ( size_t  nr,
const doublereal *  g,
doublereal *  dg 
)
virtual

Given an array of species properties 'g', return in array 'dg' the change in this quantity in the reversible reactions.

Array 'g' must have a length at least as great as the number of species, and array 'dg' must have a length as great as the total number of reactions. This method only computes 'dg' for the reversible reactions, and the entries of 'dg' for the irreversible reactions are unaltered. This is primarily designed for use in calculating reveerse rate coefficients from thermochemistry for reversible reactions.

Definition at line 177 of file ReactionStoichMgr.cpp.

Referenced by AqueousKinetics::updateKc(), GasKinetics::updateKc(), and InterfaceKinetics::updateKc().

void multiplyReactants ( const doublereal *  C,
doublereal *  R 
)
virtual

Given an array of concentrations C, multiply the entries in array R by the concentration products for the reactants:

\[ R_i = R_i * \prod_k C_k^{o_{k,i}} \]

.

Here \( o_{k,i} \) is the reaction order of species k in reaction i.

Definition at line 185 of file ReactionStoichMgr.cpp.

Referenced by InterfaceKinetics::updateROP().

void multiplyRevProducts ( const doublereal *  c,
doublereal *  r 
)
virtual

Given an array of concentrations C, multiply the entries in array R by the concentration products for the products:

\[ R_i = R_i * \prod_k C_k^{\nu^{(p)}_{k,i}} \]

Here \( \nu^{(p)}_{k,i} \) is the product stoichiometric coefficient of species k in reaction i.

Definition at line 191 of file ReactionStoichMgr.cpp.

Referenced by InterfaceKinetics::updateROP().


The documentation for this class was generated from the following files: