Cantera  3.1.0a1
MoleReactor.h
Go to the documentation of this file.
1 //! @file MoleReactor.h
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at https://cantera.org/license.txt for license and copyright information.
5 
6 #ifndef CT_MOLEREACTOR_H
7 #define CT_MOLEREACTOR_H
8 
9 #include "Reactor.h"
10 
11 namespace Cantera
12 {
13 
14 /**
15  * MoleReactor is meant to serve the same purpose as the reactor class but with a state
16  * vector composed of moles. It also serves as the base class for other mole reactors.
17  * @since New in %Cantera 3.0
18  * @ingroup reactorGroup
19  */
20 class MoleReactor : public Reactor
21 {
22 public:
23  MoleReactor() {}
24 
25  string type() const override {
26  return "MoleReactor";
27  }
28 
29  void initialize(double t0=0.0) override;
30 
31  void getState(double* y) override;
32 
33  void updateState(double* y) override;
34 
35  void eval(double t, double* LHS, double* RHS) override;
36 
37  size_t componentIndex(const string& nm) const override;
38 
39  string componentName(size_t k) override;
40 
41 protected:
42  //! For each surface in the reactor, update vector of triplets with all relevant
43  //! surface jacobian derivatives of species with respect to species
44  //! which are appropriately offset to align with the reactor's state vector.
45  virtual void addSurfaceJacobian(vector<Eigen::Triplet<double>> &triplets);
46 
47  //! Get moles of the system from mass fractions stored by thermo object
48  //! @param y vector for moles to be put into
49  void getMoles(double* y);
50 
51  //! Set internal mass variable based on moles given
52  //! @param y vector of moles of the system
53  void setMassFromMoles(double* y);
54 
55  void evalSurfaces(double* LHS, double* RHS, double* sdot) override;
56 
57  void updateSurfaceState(double* y) override;
58 
59  void getSurfaceInitialConditions(double* y) override;
60 
61  //! const value for the species start index
62  const size_t m_sidx = 2;
63 };
64 
65 }
66 
67 #endif
MoleReactor is meant to serve the same purpose as the reactor class but with a state vector composed ...
Definition: MoleReactor.h:21
void evalSurfaces(double *LHS, double *RHS, double *sdot) override
Evaluate terms related to surface reactions.
Definition: MoleReactor.cpp:61
void getSurfaceInitialConditions(double *y) override
Get initial conditions for SurfPhase objects attached to this reactor.
Definition: MoleReactor.cpp:21
void getMoles(double *y)
Get moles of the system from mass fractions stored by thermo object.
void eval(double t, double *LHS, double *RHS) override
Evaluate the reactor governing equations.
string type() const override
String indicating the reactor model implemented.
Definition: MoleReactor.h:25
size_t componentIndex(const string &nm) const override
Return the index in the solution vector for this reactor of the component named nm.
const size_t m_sidx
const value for the species start index
Definition: MoleReactor.h:62
void setMassFromMoles(double *y)
Set internal mass variable based on moles given.
void getState(double *y) override
Get the the current state of the reactor.
virtual void addSurfaceJacobian(vector< Eigen::Triplet< double >> &triplets)
For each surface in the reactor, update vector of triplets with all relevant surface jacobian derivat...
Definition: MoleReactor.cpp:85
string componentName(size_t k) override
Return the name of the solution component with index i.
void updateState(double *y) override
Set the state of the reactor to correspond to the state vector y.
void initialize(double t0=0.0) override
Initialize the reactor.
Definition: MoleReactor.cpp:38
void updateSurfaceState(double *y) override
Update the state of SurfPhase objects attached to this reactor.
Definition: MoleReactor.cpp:44
Class Reactor is a general-purpose class for stirred reactors.
Definition: Reactor.h:44
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:564