Cantera  3.1.0
Loading...
Searching...
No Matches
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
11namespace 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 */
20class MoleReactor : public Reactor
21{
22public:
23 using Reactor::Reactor; // inherit constructors
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
41protected:
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.
void getSurfaceInitialConditions(double *y) override
Get initial conditions for SurfPhase objects attached to this reactor.
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.
virtual void addSurfaceJacobian(vector< Eigen::Triplet< double > > &triplets)
For each surface in the reactor, update vector of triplets with all relevant surface jacobian derivat...
void getState(double *y) override
Get the the current state of the reactor.
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.
void updateSurfaceState(double *y) override
Update the state of SurfPhase objects attached to this reactor.
Class Reactor is a general-purpose class for stirred reactors.
Definition Reactor.h:47
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595