24 AqueousKinetics::AqueousKinetics(
thermo_t* thermo) :
34 "Unfinished implementation of this class will be removed.");
52 AqueousKinetics& AqueousKinetics::operator=(
const AqueousKinetics& right)
60 m_nfall = right.m_nfall;
61 m_rates = right.m_rates;
62 m_index = right.m_index;
63 m_irrev = right.m_irrev;
65 m_rxnstoich = right.m_rxnstoich;
67 m_fwdOrder = right.m_fwdOrder;
68 m_nirrev = right.m_nirrev;
69 m_nrev = right.m_nrev;
70 m_rgroups = right.m_rgroups;
71 m_pgroups = right.m_pgroups;
72 m_rxntype = right.m_rxntype;
73 m_rrxn = right.m_rrxn;
74 m_prxn = right.m_prxn;
76 m_revindex = right.m_revindex;
77 m_rxneqn = right.m_rxneqn;
79 m_ropf = right.m_ropf;
80 m_ropr = right.m_ropr;
81 m_ropnet = right.m_ropnet;
82 m_ROP_ok = right.m_ROP_ok;
83 m_temp = right.m_temp;
85 m_rkcn = right.m_rkcn;
87 m_conc = right.m_conc;
89 m_finalized = right.m_finalized;
91 throw CanteraError(
"GasKinetics::operator=()",
92 "Unfinished implementation");
105 void AqueousKinetics::
108 void AqueousKinetics::
114 doublereal logT = log(T);
115 m_rates.update(T, logT, &m_rfn[0]);
135 fill(m_rkcn.begin(), m_rkcn.end(), 0.0);
138 m_grt[k] -= rt * logStandConc_k;
146 for (
size_t i = 0; i < m_nrev; i++) {
147 size_t irxn = m_revindex[i];
148 m_rkcn[irxn] = exp(m_rkcn[irxn]*rrt);
151 for (
size_t i = 0; i != m_nirrev; ++i) {
152 m_rkcn[ m_irrev[i] ] = 0.0;
161 fill(m_rkcn.begin(), m_rkcn.end(), 0.0);
165 m_grt[k] -= rt * logStandConc_k;
172 for (
size_t i = 0; i <
m_ii; i++) {
173 kc[i] = exp(-m_rkcn[i]*rrt);
249 for (
size_t k = 0; k <
m_kk; k++) {
268 for (
size_t k = 0; k <
m_kk; k++) {
278 void AqueousKinetics::updateROP()
288 copy(m_rfn.begin(), m_rfn.end(), m_ropf.begin());
294 copy(m_ropf.begin(), m_ropf.end(), m_ropr.begin());
310 for (
size_t j = 0; j !=
m_ii; ++j) {
311 m_ropnet[j] = m_ropf[j] - m_ropr[j];
324 copy(m_rfn.begin(), m_rfn.end(), m_ropf.begin());
329 for (
size_t i = 0; i <
m_ii; i++) {
344 if (doIrreversible) {
346 for (
size_t i = 0; i <
m_ii; i++) {
347 krev[i] /= m_ropnet[i];
353 for (
size_t i = 0; i <
m_ii; i++) {
354 krev[i] *= m_rkcn[i];
362 addElementaryReaction(r);
372 void AqueousKinetics::addElementaryReaction(
ReactionData& r)
377 iloc = m_rates.install(reactionNumber(), r);
383 m_fwdOrder.push_back(r.
reactants.size());
387 void AqueousKinetics::installReagents(
const ReactionData& r)
390 m_ropf.push_back(0.0);
391 m_ropr.push_back(0.0);
392 m_ropnet.push_back(0.0);
395 doublereal reactantGlobalOrder = 0.0;
396 doublereal productGlobalOrder = 0.0;
397 size_t rnum = reactionNumber();
399 std::vector<size_t> rk;
400 size_t nr = r.reactants.size();
401 for (n = 0; n < nr; n++) {
402 nsFlt = r.rstoich[n];
403 reactantGlobalOrder += nsFlt;
405 if ((doublereal) ns != nsFlt) {
410 if (r.rstoich[n] != 0.0) {
411 m_rrxn[r.reactants[n]][rnum] += r.rstoich[n];
413 for (m = 0; m < ns; m++) {
414 rk.push_back(r.reactants[n]);
419 std::vector<size_t> pk;
420 size_t np = r.products.size();
421 for (n = 0; n < np; n++) {
422 nsFlt = r.pstoich[n];
423 productGlobalOrder += nsFlt;
425 if ((
double) ns != nsFlt) {
430 if (r.pstoich[n] != 0.0) {
431 m_prxn[r.products[n]][rnum] += r.pstoich[n];
433 for (m = 0; m < ns; m++) {
434 pk.push_back(r.products[n]);
439 m_rkcn.push_back(0.0);
441 m_rxnstoich.
add(reactionNumber(), r);
444 m_dn.push_back(productGlobalOrder - reactantGlobalOrder);
445 m_revindex.push_back(reactionNumber());
448 m_dn.push_back(productGlobalOrder - reactantGlobalOrder);
449 m_irrev.push_back(reactionNumber());
454 void AqueousKinetics::installGroups(
size_t irxn,
455 const vector<grouplist_t>& r,
456 const vector<grouplist_t>& p)
460 m_rgroups[reactionNumber()] = r;
461 m_pgroups[reactionNumber()] = p;
483 m_ropf.resize(1, 0.0);
484 m_ropr.resize(1, 0.0);
485 m_ropnet.resize(1, 0.0);
486 m_rkcn.resize(1, 0.0);
std::vector< grouplist_t > rgroups
Optional data used in reaction path diagrams.
Kinetics manager for elementary aqueous-phase chemistry.
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
virtual void init()
Prepare the class for the addition of reactions.
virtual void getDeltaEnthalpy(doublereal *deltaH)
Return the vector of values for the reactions change in enthalpy.
void incrementRxnCount()
Increment the number of reactions in the mechanism by one.
std::vector< std::vector< size_t > > m_reactants
This is a vector of vectors containing the reactants for each reaction.
int reactionType
Type of the reaction.
virtual void assignShallowPointers(const std::vector< thermo_t * > &tpVector)
Reassign the pointers within the Kinetics object.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
thermo_t & thermo(size_t n=0)
This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism...
size_t m_kk
The number of species in all of the phases that participate in this kinetics mechanism.
virtual void getDeltaGibbs(doublereal *deltaG)
Return the vector of values for the reaction gibbs free energy change.
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 rev...
virtual void addReaction(ReactionData &r)
Add a single reaction to the mechanism.
AqueousKinetics(thermo_t *thermo=0)
Constructor. Creates an empty reaction mechanism.
virtual void getRevRateConstants(doublereal *krev, bool doIrreversible=false)
Return the reverse rate constants.
virtual void getDeltaSSEntropy(doublereal *deltaS)
Return the vector of values for the change in the standard state entropies for each reaction...
virtual void getReactionDelta(size_t nReactions, const doublereal *g, doublereal *dg)
Calculates the change of a molar species property in a reaction.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
virtual void finalize()
Finish adding reactions and prepare for use.
virtual void getEquilibriumConstants(doublereal *kc)
Return a vector of Equilibrium constants.
void multiply_each(OutputIter x_begin, OutputIter x_end, InputIter y_begin)
Multiply each entry in x by the corresponding entry in y.
vector_fp rateCoeffParameters
Vector of rate coefficient parameters.
Base class for a phase with thermodynamic properties.
std::string equation
The reaction equation. Used only for display purposes.
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...
std::vector< grouplist_t > pgroups
Optional data used in reaction path diagrams.
vector_fp m_dn
Difference between the input global reactants order and the input global products order...
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
vector_fp m_perturb
Vector of perturbation factors for each reaction's rate of progress vector.
Public interface for kinetics managers.
Intermediate class which stores data about a reaction and its rate parameterization before adding the...
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Kinetics & operator=(const Kinetics &right)
Assignment operator.
std::vector< size_t > reactants
Indices of reactant species.
void updateKc()
Update the equilibrium constants in molar units.
size_t nSpecies() const
Returns the number of species in the phase.
virtual void getDeltaSSEnthalpy(doublereal *deltaH)
Return the vector of values for the change in the standard state enthalpies of reaction.
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
doublereal temperature() const
Temperature (K).
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
virtual bool ready() const
Returns true if the kinetics manager has been properly initialized and finalized. ...
std::vector< std::vector< size_t > > m_products
This is a vector of vectors containing the products for each reaction.
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
size_t m_ii
Number of reactions in the mechanism.
const int ELEMENTARY_RXN
A reaction with a rate coefficient that depends only on temperature.
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...
virtual void getFwdRateConstants(doublereal *kfwd)
Return the forward rate constants.
Contains declarations for string manipulation functions within Cantera.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
void writelog(const std::string &msg)
Write a message to the screen.
virtual void addPhase(thermo_t &thermo)
Add a phase to the kinetics manager object.
virtual Kinetics * duplMyselfAsKinetics(const std::vector< thermo_t * > &tpVector) const
Duplication routine for objects which inherit from Kinetics.
virtual void getDeltaEntropy(doublereal *deltaS)
Return the vector of values for the reactions change in entropy.
virtual void getDeltaSSGibbs(doublereal *deltaG)
Return the vector of values for the reaction standard state gibbs free energy change.
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.