| Cantera 3.0.0

Loading...
Searching...
No Matches
Classes | Functions
Kinetics Managers
Chemical Kinetics

Classes implementing models for chemical kinetics. More...

Collaboration diagram for Kinetics Managers:

## Detailed Description

Classes implementing models for chemical kinetics.

# Models and Managers

A kinetics manager is a C++ class that implements a kinetics model; a kinetics model is a set of mathematical equation describing how various kinetic quantities are to be computed – reaction rates, species production rates, etc. Many different kinetics models might be defined to handle different types of kinetic processes. For example, one kinetics model might use expressions valid for elementary reactions in ideal gas mixtures. It might, for example, require the reaction orders to be integral and equal to the forward stoichiometric coefficients, require that each reaction be reversible with a reverse rate satisfying detailed balance, include pressure-dependent unimolecular reactions, etc. Another kinetics model might be designed for heterogeneous chemistry at interfaces, and might allow empirical reaction orders, coverage-dependent activation energies, irreversible reactions, and include effects of potential differences across the interface on reaction rates.

A kinetics manager implements a kinetics model. Since the model equations may be complex and expensive to evaluate, a kinetics manager may adopt various strategies to 'manage' the computation and evaluate the expressions efficiently. For example, if there are rate coefficients or other quantities that depend only on temperature, a manager class may choose to store these quantities internally, and re-evaluate them only when the temperature has actually changed. Or a manager designed for use with reaction mechanisms with a few repeated activation energies might precompute the terms \( \exp(-E/RT) \), instead of evaluating the exponential repeatedly for each reaction. There are many other possible 'management styles', each of which might be better suited to some reaction mechanisms than others.

But however a manager structures the internal computation, the tasks the manager class must perform are, for the most part, the same. It must be able to compute reaction rates, species production rates, equilibrium constants, etc. Therefore, all kinetics manager classes should have a common set of public methods, but differ in how they implement these methods.

A kinetics manager computes reaction rates of progress, species production rates, equilibrium constants, and similar quantities for a reaction mechanism. All kinetics manager classes derive from class Kinetics, which defines a common public interface for all kinetics managers. Each derived class overloads the virtual methods of Kinetics to implement a particular kinetics model.

For example, class GasKinetics implements reaction rate expressions appropriate for homogeneous reactions in ideal gas mixtures, and class InterfaceKinetics implements expressions appropriate for heterogeneous mechanisms at interfaces, including how to handle reactions involving charged species of phases with different electric potentials — something that class GasKinetics doesn't deal with at all.

Many of the methods of class Kinetics write into arrays the values of some quantity for each species, for example the net production rate. These methods always write the results into flat arrays, ordered by phase in the order the phase was added, and within a phase in the order the species were added to the phase (which is the same ordering as in the input file). Example: suppose a heterogeneous mechanism involves three phases – a bulk phase 'a', another bulk phase 'b', and the surface phase 'a:b' at the a/b interface. Phase 'a' contains 12 species, phase 'b' contains 3, and at the interface there are 5 adsorbed species defined in phase 'a:b'. Then methods like getNetProductionRates(double* net) will write and output array of length 20, beginning at the location pointed to by 'net'. The first 12 values will be the net production rates for all 12 species of phase 'a' (even if some do not participate in the reactions), the next 3 will be for phase 'b', and finally the net production rates for the surface species will occupy the last 5 locations.

## Classes
class | BulkKinetics
| Specialization of Kinetics for chemistry in a single bulk phase. More...
class | EdgeKinetics
| Heterogeneous reactions at one-dimensional interfaces between multiple adjacent two-dimensional surfaces. More...
class | GasKinetics
| Kinetics manager for elementary gas-phase chemistry. More...
class | InterfaceKinetics
| A kinetics manager for heterogeneous reaction mechanisms. More...
class | Kinetics
| Public interface for kinetics managers. More...

## Functions
Kinetics * | newKineticsMgr (const string &model)
| Create a new kinetics manager.
shared_ptr< Kinetics > | newKinetics (const string &model)
| Create a new Kinetics instance.
shared_ptr< Kinetics > | newKinetics (const vector< shared_ptr< ThermoPhase > > &phases, const AnyMap &phaseNode, const AnyMap &rootNode=AnyMap(), shared_ptr< Solution > soln={})
| Create a new kinetics manager, initialize it, and add reactions.
unique_ptr< Kinetics > | newKinetics (const vector< ThermoPhase * > &phases, const AnyMap &phaseNode, const AnyMap &rootNode=AnyMap())
| Create a new kinetics manager, initialize it, and add reactions.
shared_ptr< Kinetics > | newKinetics (const vector< shared_ptr< ThermoPhase > > &phases, const string &filename, const string &phase_name="")
| Create a new kinetics manager, initialize it, and add reactions.
unique_ptr< Kinetics > | newKinetics (const vector< ThermoPhase * > &phases, const string &filename, const string &phase_name)
| Create a new kinetics manager, initialize it, and add reactions.
void | addReactions (Kinetics &kin, const AnyMap &phaseNode, const AnyMap &rootNode=AnyMap())
| Add reactions to a Kinetics object.

## Function Documentation

## ◆ newKineticsMgr()

Kinetics * newKineticsMgr | ( | const string & | model | ) |

Create a new kinetics manager.

Deprecated:
  To be removed after Cantera 3.0; superseded by newKinetics().

Definition at line 64 of file KineticsFactory.cpp.

## ◆ newKinetics() [1/5]

shared_ptr< Kinetics > newKinetics | ( | const string & | model | ) |

Create a new Kinetics instance.

Definition at line 71 of file KineticsFactory.cpp.

## ◆ newKinetics() [2/5]

shared_ptr< Kinetics > newKinetics | ( | const vector< shared_ptr< ThermoPhase > > & | phases,
|  | const AnyMap & | phaseNode,
|  | const AnyMap & | rootNode = `AnyMap()`,
|  | shared_ptr< Solution > | soln = `{}`
| ) |  |

Create a new kinetics manager, initialize it, and add reactions.

Parameters

  phases | Vector of phases containing species which participate in reactions, with the phase where the reactions occur (lowest-dimensional phase) listed first.
  phaseNode | Phase entry for the phase where the reactions occur. This phase definition is used to determine the source of the reactions added to the Kinetics object.
  rootNode | The root node of the file containing the phase definition, which will be treated as the default source for reactions
  soln | The Solution object that this Kinetics object is being added to.

Definition at line 77 of file KineticsFactory.cpp.

## ◆ newKinetics() [3/5]

unique_ptr< Kinetics > newKinetics | ( | const vector< ThermoPhase * > & | phases,
|  | const AnyMap & | phaseNode,
|  | const AnyMap & | rootNode = `AnyMap()`
| ) |  |

Create a new kinetics manager, initialize it, and add reactions.

See also
  newKinetics(const vector<shared_ptr<ThermoPhase>>&, const AnyMap&, const AnyMap&, shared_ptr<Solution>)

Deprecated:
  To be removed after Cantera 3.0; superseded by newKinetics() returning shared_ptr

Definition at line 110 of file KineticsFactory.cpp.

## ◆ newKinetics() [4/5]

shared_ptr< Kinetics > newKinetics | ( | const vector< shared_ptr< ThermoPhase > > & | phases,
|  | const string & | filename,
|  | const string & | phase_name = `""`
| ) |  |

Create a new kinetics manager, initialize it, and add reactions.

Parameters

  phases | Vector of phases containing species which participate in reactions, with the phase where the reactions occur (lowest-dimensional phase) listed first.
  filename | File containing the phase definition for the phase where the reactions occur. Searches the Cantera data for this file.
  phase_name | The name of the reacting phase in the input file (that is, the name of the first phase in the `phases` vector)

Deprecated:
  The 'phase_name' argument is deprecated and will be removed after Cantera 3.0.

Since
  Starting with Cantera 3.0, if the reacting phase is not the first item in the `phases` vector, a deprecation warning will be issued. In Cantera 3.1, this warning will become an error.

Definition at line 142 of file KineticsFactory.cpp.

## ◆ newKinetics() [5/5]

unique_ptr< Kinetics > newKinetics | ( | const vector< ThermoPhase * > & | phases,
|  | const string & | filename,
|  | const string & | phase_name
| ) |  |

Create a new kinetics manager, initialize it, and add reactions.

Parameters

  phases | Vector of phases containing species which participate in reactions, with the phase where the reactions occur (lowest-dimensional phase) listed first.
  filename | File containing the phase definition for the phase where the reactions occur. Searches the Cantera data for this file.
  phase_name | The name of the reacting phase in the input file (that is, the name of the first phase in the `phases` vector)

Deprecated:
  The 'phase_name' argument is deprecated and will be removed after Cantera 3.0.

Since
  Starting with Cantera 3.0, if the reacting phase is not the first item in the `phases` vector, a deprecation warning will be issued. In Cantera 3.1, this warning will become an error.

Deprecated:
  To be removed after Cantera 3.0; superseded by newKinetics() returning shared_ptr

Definition at line 157 of file KineticsFactory.cpp.

## ◆ addReactions()

void addReactions | ( | Kinetics & | kin,
|  | const AnyMap & | phaseNode,
|  | const AnyMap & | rootNode = `AnyMap()`
| ) |  |

Add reactions to a Kinetics object.

Parameters

  kin | The Kinetics object to be initialized
  phaseNode | Phase entry for the phase where the reactions occur. This phase definition is used to determine the source of the reactions added to the Kinetics object.
  rootNode | The root node of the file containing the phase definition, which will be treated as the default source for reactions

Definition at line 168 of file KineticsFactory.cpp.