Chemical Kinetics#
Kinetics#
- class Kinetics(ph, src, id, neighbor1, neighbor2, neighbor3, neighbor4)#
Kinetics class constructor.
Class Kinetics represents kinetics managers, which are classes that manage reaction mechanisms. The reaction mechanism attributes are specified in a YAML file. Instances of class
Kinetics()
are responsible for evaluating reaction rates of progress, species production rates, and other quantities pertaining to a reaction mechanism.- Parameters:
ph – An instance of class
ThermoPhase()
representing the phase in which reactions occursrc – Input string of YAML file name.
id – ID of the phase to import as specified in the input file. (optional)
neighbor1 – Instance of class
ThermoPhase()
orSolution()
representing a neighboring phase.neighbor2 – Instance of class
ThermoPhase()
orSolution()
representing a neighboring phase.neighbor3 – Instance of class
ThermoPhase()
orSolution()
representing a neighboring phase.neighbor4 – Instance of class
ThermoPhase()
orSolution()
representing a neighboring phase.
- Returns:
Instance of class
Kinetics()
- advanceCoverages(k, dt)#
Advance the surface coverages forward in time.
The bulk phase concentrations are held fixed during this operation.
- Parameters:
k – Instance of class
Interface()
with an associatedKinetics()
object.dt – Time interval by which the coverages should be advanced
- creationRates(a)#
Get the chemical creation rates.
See also:
destructionRates()
,netProdRates()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which creation rates are desired.- Returns:
Returns a column vector of the creation rates of all species. If the output is not assigned to a variable, a bar graph is produced. Units: kmol/m**3-s
- destructionRates(a)#
Get the chemical destruction rates.
See also:
creationRates()
,netProdRates()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which destruction rates are desired.- Returns:
Returns a column vector of the destruction rates of all species. If the output is not assigned to a variable, a bar graph is produced. Units: kmol/m**3-s
- equil_Kc(a)#
Get the equilibrium constants for all reactions
See also:
fwdRateConstants()
,revRateConstants()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which equilibrium constants are desired.- Returns:
Returns a column vector of the equilibrium constants for all reactions. The vector has an entry for every reaction, whether reversible or not, but non-zero values occur only for the reversible reactions. If the output is not assigned to a variable, a bar graph is produced instead.
- fwdRateConstants(a)#
Get the forward reaction rate constants.
The computed values include all temperature-dependent and pressure-dependent contributions. By default, third-body concentrations are only considered if they are part of the reaction rate definition; for a legacy implementation that includes third-body concentrations see
useLegacyRateConstants()
. Units are a combination of kmol, m^3 and s, that depend on the rate expression for the reaction.see also:
revRateConstants()
,equil_Kc()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which forward rate constants are desired.- Returns:
Returns a column vector of the forward rate constants of all of the reactions.
- getDeltaEnthalpies(a)#
Get the enthalpy of reaction for each reaction.
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the enthalpies of reaction are desired.- Returns:
Returns a vector of the enthalpy of reaction for each reaction. Units: J/kmol
- getDeltaEntropies(a)#
Get the entropy of reaction for each reaction.
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the entropies of reaction are desired.- Returns:
Returns a vector of the entropy of reaction for each reaction. Units: J/kmol-K
- getDeltaGibbs(a)#
Get the Gibbs free energy of reaction for each reaction.
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the Gibbs free energies of reaction are desired.- Returns:
Returns a vector of the Gibbs free energy of reaction for each reaction. Units: J/kmol
- isReversible(a, i)#
Get an array of flags indicating reversibility of a reaction.
A reversible reaction is one that runs in both the forward direction (reactants -> products) and in the reverse direction (products -> reactants). The reverse rate for reversible reactions can computed from thermochemistry, so that the reaction satisfies detailed balance, and the net rate of progress is zero in states of chemical equilibrium. The reverse rate can also be specified directly by a rate expression. An irreversible reaction is one whose reverse reaction rate is zero.
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the reversible flags are desired.i – Integer reaction number
- Returns:
1 if reaction number
i
is reversible, and 0 if it is irreversible.
- multiplier(a, irxn)#
Get the multiplier for reaction rate of progress.
The multiplier multiplies the reaction rate of progress. It may be used to implement sensitivity analysis, or to selectively disable reactions. For reversible reactions, it multiplies both the forward and reverse rates. By default, the multiplier value is 1.0, but it may be set to any other value by calling method
setMultiplier()
.- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the multipliers are desired.irxn – Integer reaction number for which the multiplier is desired.
- Returns:
Multiplier of the rate of progress of reaction number
irxn
- nReactions(a)#
Get the number of reactions.
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the number of reactions is desired.- Returns:
Integer number of reactions
- nTotalSpecies(a)#
Get the total number of species.
The total number of species, summed over all participating phases.
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the number of species is desired.- Returns:
Integer total number of species
- netProdRates(a)#
Get the net chemical production rates for all species.
See also:
creationRates()
,destructionRates()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which net production rates are desired.- Returns:
Returns a column vector of the net production (creation - destruction) rates of all species. If the output is not assigned to a variable, a bar plot is produced.
- reactionEqn(a, irxn)#
Get the reaction equation of a reaction.
If only the first argument is given, the reaction equations of all of the reactions are returned in a cell array. Otherwise,
irxn
must be an integer or vector of integers.- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the reaction equations are desired.irxn – Optional. Integer or vector of integer reaction numbers.
- Returns:
String or cell array of strings of the reaction equations.
- revRateConstants(a)#
Get the reverse reaction rate constants.
The computed values include all temperature-dependent and pressure-dependent contributions. By default, third-body concentrations are only considered if they are part of the reaction rate definition; for a legacy implementation that includes third-body concentrations see
useLegacyRateConstants()
. Units are a combination of kmol, m^3 and s, that depend on the rate expression for the reaction.See also:
fwdRateConstants()
,equil_KC()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which reverse rate constants are desired.- Returns:
Returns a column vector of the reverse rate constants of all of the reactions.
- rop(a)#
Get the forward and reverse rates of progress.
See also:
rop_f()
,rop_r()
,rop_net()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which forward and reverse rates of progress are desired.- Returns:
Returns an I x 2 array of reaction rates of progress, where I is the number of reactions. The first column contains the forward rates of progress, and the second column the reverse rates. If this function is called with no output argument, a bar graph is produced.
- rop_f(a)#
Forward rates of progress for all reactions.
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which forward rates of progress are desired.- Returns:
Returns a column vector of the forward rates of progress for all reactions. If this function is called with no output argument, a bar graph is produced.
- rop_net(a)#
Net rates of progress for all reactions.
See also:
rop_f()
,rop_r()
,rop()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the net rates of progress are desired.- Returns:
Returns a column vector of the net rates of progress for all reactions. If this function is called with no output argument, a bar graph is produced.
- rop_r(a)#
Get the reverse rates of progress for all reactions.
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which reverse rates of progress are desired.- Returns:
Returns a column vector of the reverse rates of progress for all reactions. If this function is called with no output argument, a bar graph is produced.
- setMultiplier(a, irxn, v)#
Set the multiplier for the reaction rate of progress.
The multiplier multiplies the reaction rate of progress. It may be used to implement sensitivity analysis, or to selectively disable reactions. For reversible reactions, it multiplies both the forward and reverse rates. By default, the multiplier value is 1.0, but the current value may be checked by calling method
multiplier()
.If only two arguments are given, it is assumed that the second is the desired multiplication factor for all of the reactions.
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the multipliers should be set.irxn – Integer or vector of integers. Reaction number(s) for which the multiplier should be set. Optional.
v – Value by which the reaction rate of progress should be multiplied
- stoich_net(a, species, rxns)#
Get the net stoichiometric coefficients.
See also:
stoich_r()
,stoich_p()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the net stoichiometric coefficients are desired.species – Species indices for which net stoichiometric coefficients should be retrieved. Optional argument; if specified,
rxns
must be specified as well.rxns – Reaction indices for which net stoichiometric coefficients should be retrieved. Optional argument; if specified,
species
must be specified as well.
- Returns:
Returns a sparse matrix of all net stoichiometric coefficients. The matrix element
nu(k,i)
is the stoichiometric coefficient of species k as a net in reaction i. Ifspecies
andrxns
are specified, the matrix will contain only entries for the specified species and reactions. For example,stoich_p(a,3,[1 3 5 7])
returns a sparse matrix containing only the coefficients for species 3 in reactions 1, 3, 5, and 7.
- stoich_p(a, species, rxns)#
Get the product stoichiometric coefficients.
See also:
stoich_r()
,stoich_net()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the product stoichiometric coefficients are desired.species – Species indices for which product stoichiometric coefficients should be retrieved. Optional argument; if specified,
rxns
must be specified as well.rxns – Reaction indices for which product stoichiometric coefficients should be retrieved. Optional argument; if specified,
species
must be specified as well.
- Returns:
Returns a sparse matrix of all product stoichiometric coefficients. The matrix element
nu(k,i)
is the stoichiometric coefficient of species k as a product in reaction i. Ifspecies
andrxns
are specified, the matrix will contain only entries for the specified species and reactions. For example,stoich_p(a,3,[1 3 5 7])
returns a sparse matrix containing only the coefficients for species 3 in reactions 1, 3, 5, and 7.
- stoich_r(a, species, rxns)#
Get the reactant stoichiometric coefficients.
See also:
stoich_p()
,stoich_net()
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the reactant stoichiometric coefficients are desired.species – Species indices for which reactant stoichiometric coefficients should be retrieved. Optional argument; if specified,
rxns
must be specified as well.rxns – Reaction indices for which reactant stoichiometric coefficients should be retrieved. Optional argument; if specified,
species
must be specified as well.
- Returns:
Returns a sparse matrix of all reactant stoichiometric coefficients. The matrix element
nu(k,i)
is the stoichiometric coefficient of species k as a reactant in reaction i. Ifspecies
andrxns
are specified, the matrix will contain only entries for the specified species and reactions. For example,stoich_r(a,3,[1 3 5 7])
returns a sparse matrix containing only the coefficients for species 3 in reactions 1, 3, 5, and 7.
- ydot(a)#
Get the mass production rates of the species.
Evaluates the source term \(\dot{\omega}_k M_k /\rho\)
- Parameters:
a – Instance of class
Kinetics()
(or another object deriving from Kinetics) for which the ydots are desired.- Returns:
Returns a vector of length nSpecies. Units: kg/s