Cantera 2.6.0
|
#include <StoichManager.h>
Public Member Functions | |
StoichManagerN () | |
Constructor for the StoichManagerN class. More... | |
void | resizeCoeffs (size_t nSpc, size_t nRxn) |
Resize the sparse coefficient matrix. More... | |
void | add (size_t rxn, const std::vector< size_t > &k) |
Add a single reaction to the list of reactions that this stoichiometric manager object handles. More... | |
void | add (size_t rxn, const std::vector< size_t > &k, const vector_fp &order) |
void | add (size_t rxn, const std::vector< size_t > &k, const vector_fp &order, const vector_fp &stoich) |
Add a single reaction to the list of reactions that this stoichiometric manager object handles. More... | |
void | multiply (const doublereal *input, doublereal *output) const |
void | incrementSpecies (const doublereal *input, doublereal *output) const |
void | decrementSpecies (const doublereal *input, doublereal *output) const |
void | incrementReactions (const doublereal *input, doublereal *output) const |
void | decrementReactions (const doublereal *input, doublereal *output) const |
const Eigen::SparseMatrix< double > & | stoichCoeffs () const |
Return matrix containing stoichiometric coefficients. More... | |
Eigen::SparseMatrix< double > | derivatives (const double *conc, const double *rates) |
Calculate derivatives with respect to species concentrations. More... | |
void | scale (const double *in, double *out, double factor) const |
Scale input by reaction order and factor. More... | |
Private Attributes | |
bool | m_ready |
Boolean flag indicating whether object is fully configured. More... | |
std::vector< C1 > | m_c1_list |
std::vector< C2 > | m_c2_list |
std::vector< C3 > | m_c3_list |
std::vector< C_AnyN > | m_cn_list |
SparseTriplets | m_coeffList |
Sparse matrices for stoichiometric coefficients. More... | |
Eigen::SparseMatrix< double > | m_stoichCoeffs |
std::vector< int > | m_outerIndices |
Storage indicies used to build derivatives. More... | |
std::vector< int > | m_innerIndices |
vector_fp | m_values |
This class handles operations involving the stoichiometric coefficients on one side of a reaction (reactant or product) for a set of reactions comprising a reaction mechanism. This class is used by class Kinetics, which contains three instances of this class (one to handle operations on the reactions, one for the products of reversible reactions, and one for the products of irreversible reactions).
This class is designed for use with elementary reactions, or at least ones with integral stoichiometric coefficients. Let \( M(i) \) be the number of molecules on the product or reactant side of reaction number i.
\[ r_i = \sum_m^{M_i} s_{k_{m,i}} \]
To understand the operations performed by this class, let \( N_{k,i}\) denote the stoichiometric coefficient of species k on one side (reactant or product) in reaction i. Then N is a sparse K by I matrix of stoichiometric coefficients.
The following matrix operations may be carried out with a vector S of length K, and a vector R of length I:
The actual implementation, however, does not compute these quantities by matrix multiplication. A faster algorithm is used that makes use of the fact that the integer-valued N matrix is very sparse, and the non-zero terms are small positive integers.
\[ S_k = R_{i1} + \dots + R_{iM} \]
where M is the number of molecules, and \( i(m) \) is the See Stoichiometry
Definition at line 594 of file StoichManager.h.
|
inline |
Constructor for the StoichManagerN class.
Consider adding defaulted entries here that supply the total number of reactions in the mechanism and the total number of species in the species list. Then, we could use those numbers to provide error checks during the construction of the object. Those numbers would also provide some clarity to the purpose and utility of this class.
DGG - the problem is that the number of reactions and species are not known initially.
Definition at line 610 of file StoichManager.h.
|
inline |
Resize the sparse coefficient matrix.
Definition at line 616 of file StoichManager.h.
References StoichManagerN::m_coeffList, StoichManagerN::m_outerIndices, and StoichManagerN::m_ready.
Referenced by Kinetics::resizeReactions().
|
inline |
Add a single reaction to the list of reactions that this stoichiometric manager object handles.
This function is the same as the add() function below. However, the order of each species in the power list expression is set to one automatically.
Definition at line 662 of file StoichManager.h.
References StoichManagerN::add().
Referenced by StoichManagerN::add(), and Kinetics::addReaction().
|
inline |
Definition at line 668 of file StoichManager.h.
|
inline |
Add a single reaction to the list of reactions that this stoichiometric manager object handles.
rxn | Reaction index of the current reaction. This is used as an index into vectors which have length n_total_rxn. |
k | This is a vector of integer values specifying the species indices. The length of this vector species the number of different species in the description. The value of the entries are the species indices. These are used as indexes into vectors which have length n_total_species. |
order | This is a vector of the same length as vector k. The order is used for the routine power(), which produces a power law expression involving the species vector. |
stoich | This is used to handle fractional stoichiometric coefficients on the product side of irreversible reactions. |
Definition at line 689 of file StoichManager.h.
References StoichManagerN::m_coeffList, and StoichManagerN::m_ready.
|
inline |
Definition at line 736 of file StoichManager.h.
|
inline |
Definition at line 743 of file StoichManager.h.
|
inline |
Definition at line 750 of file StoichManager.h.
|
inline |
Definition at line 757 of file StoichManager.h.
|
inline |
Definition at line 764 of file StoichManager.h.
|
inline |
Return matrix containing stoichiometric coefficients.
Definition at line 772 of file StoichManager.h.
References StoichManagerN::m_ready.
Referenced by Kinetics::creationRates_ddX(), Kinetics::destructionRates_ddX(), Kinetics::getCreationRates_ddC(), Kinetics::getCreationRates_ddP(), Kinetics::getCreationRates_ddT(), Kinetics::getDestructionRates_ddC(), Kinetics::getDestructionRates_ddP(), Kinetics::getDestructionRates_ddT(), Kinetics::productStoichCoeff(), Kinetics::productStoichCoeffs(), Kinetics::reactantStoichCoeff(), Kinetics::reactantStoichCoeffs(), Kinetics::resizeReactions(), and Kinetics::revProductStoichCoeffs().
|
inline |
Calculate derivatives with respect to species concentrations.
The species derivative is the term of the Jacobian that accounts for species products in the law of mass action. As StoichManagerN does not account for third bodies or rate constants that depend on species concentrations, corresponding derivatives are not included.
conc | Species concentration. |
rates | Rates-of-progress. |
Definition at line 794 of file StoichManager.h.
References StoichManagerN::m_outerIndices.
Referenced by GasKinetics::process_ddX().
|
inline |
Scale input by reaction order and factor.
Definition at line 809 of file StoichManager.h.
Referenced by GasKinetics::process_ddC().
|
private |
Boolean flag indicating whether object is fully configured.
Definition at line 818 of file StoichManager.h.
Referenced by StoichManagerN::add(), StoichManagerN::resizeCoeffs(), and StoichManagerN::stoichCoeffs().
|
private |
Definition at line 820 of file StoichManager.h.
|
private |
Definition at line 821 of file StoichManager.h.
|
private |
Definition at line 822 of file StoichManager.h.
|
private |
Definition at line 823 of file StoichManager.h.
|
private |
Sparse matrices for stoichiometric coefficients.
Definition at line 826 of file StoichManager.h.
Referenced by StoichManagerN::add(), and StoichManagerN::resizeCoeffs().
|
private |
Definition at line 827 of file StoichManager.h.
|
private |
Storage indicies used to build derivatives.
Definition at line 830 of file StoichManager.h.
Referenced by StoichManagerN::derivatives(), and StoichManagerN::resizeCoeffs().
|
private |
Definition at line 831 of file StoichManager.h.
|
private |
Definition at line 832 of file StoichManager.h.