Cantera  4.0.0a1
Loading...
Searching...
No Matches
IdealGasMoleReactor.h
Go to the documentation of this file.
1//! @file IdealGasMoleReactor.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_IDEALGASMOLE_REACTOR_H
7#define CT_IDEALGASMOLE_REACTOR_H
8
10
11namespace Cantera
12{
13
14/**
15 * IdealGasMoleReactor is a class for ideal gas constant-volume reactors which use a
16 * state of moles.
17 * @since New in %Cantera 3.0
18 * @ingroup reactorGroup
19 */
21{
22public:
23 using MoleReactor::MoleReactor; // inherit constructors
24
25 string type() const override {
26 return "IdealGasMoleReactor";
27 }
28
29 size_t componentIndex(const string& nm) const override;
30 string componentName(size_t k) override;
31 double upperBound(size_t k) const override;
32 double lowerBound(size_t k) const override;
33 vector<size_t> initializeSteady() override;
34
35 void getState(double* y) override;
36
37 void initialize(double t0=0.0) override;
38
39 void eval(double t, double* LHS, double* RHS) override;
40 void evalSteady(double t, double* LHS, double* RHS) override;
41
42 void updateState(double* y) override;
43
44 //! Calculate an approximate Jacobian to accelerate preconditioned solvers
45
46 //! Neglects derivatives with respect to mole fractions that would generate a
47 //! fully-dense Jacobian. Currently, also neglects terms related to interactions
48 //! between reactors, for example via inlets and outlets.
49 void getJacobianElements(vector<Eigen::Triplet<double>>& trips) override;
50 void getJacobianScalingFactors(double& f_species, double* f_energy) override;
51
52 bool preconditionerSupported() const override {return true;};
53
54protected:
55 vector<double> m_uk; //!< Species molar internal energies
56 double m_TotalCv; //!< Total heat capacity (@f$ m c_v @f$) [J/K]
57
58 //! Initial volume [m³]; used for steady-state calculations
60
61 //! Initial temperature [K]; used for steady-state calculations
63};
64
65}
66
67#endif
IdealGasMoleReactor is a class for ideal gas constant-volume reactors which use a state of moles.
bool preconditionerSupported() const override
Return a false if preconditioning is not supported or true otherwise.
double upperBound(size_t k) const override
Get the upper bound on the k-th component of the local state vector.
void eval(double t, double *LHS, double *RHS) override
Evaluate the reactor governing equations.
string type() const override
String indicating the reactor model implemented.
size_t componentIndex(const string &nm) const override
Return the index in the solution vector for this reactor of the component named nm.
void evalSteady(double t, double *LHS, double *RHS) override
Evaluate the governing equations with modifications for the steady-state solver.
vector< double > m_uk
Species molar internal energies.
void getState(double *y) override
Get the current state of the reactor.
void getJacobianElements(vector< Eigen::Triplet< double > > &trips) override
Calculate an approximate Jacobian to accelerate preconditioned solvers.
vector< size_t > initializeSteady() override
Initialize the reactor before solving a steady-state problem.
double lowerBound(size_t k) const override
Get the lower bound on the k-th component of the local state vector.
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.
double m_initialTemperature
Initial temperature [K]; used for steady-state calculations.
double m_initialVolume
Initial volume [m³]; used for steady-state calculations.
void getJacobianScalingFactors(double &f_species, double *f_energy) override
Get scaling factors for the Jacobian matrix terms proportional to .
double m_TotalCv
Total heat capacity ( ) [J/K].
MoleReactor is meant to serve the same purpose as the reactor class but with a state vector composed ...
Definition MoleReactor.h:21
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595