Cantera  4.0.0a1
Loading...
Searching...
No Matches
IdealGasConstPressureMoleReactor.h
Go to the documentation of this file.
1//! @file IdealGasConstPressureMoleReactor.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_IDEALGASCONSTPRESSMOLE_REACTOR_H
7#define CT_IDEALGASCONSTPRESSMOLE_REACTOR_H
8
10
11namespace Cantera
12{
13
14/**
15 * IdealGasConstPressureMoleReactor is a class for constant-pressure reactors
16 * which use temperature and species moles as state variables. The class name is
17 * historical; this formulation is applicable to non-ideal equations of state
18 * where the ThermoPhase implements the required enthalpy and heat capacity
19 * properties.
20 * @since New in %Cantera 3.0
21 * @ingroup reactorGroup
22 */
24{
25public:
26 using ConstPressureMoleReactor::ConstPressureMoleReactor; // inherit constructors
27
28 string type() const override {
29 return "IdealGasConstPressureMoleReactor";
30 };
31
32 void getState(span<double> y) override;
33
34 void initialize(double t0=0.0) override;
35
36 void eval(double t, span<double> LHS, span<double> RHS) override;
37
38 void updateState(span<const double> y) override;
39 void getJacobianScalingFactors(double& f_species, span<double> f_energy) override;
40
41 //! Calculate an approximate Jacobian to accelerate preconditioned solvers
42
43 //! Neglects derivatives with respect to mole fractions that would generate a
44 //! fully-dense Jacobian. Currently also neglects terms related to interactions
45 //! between reactors, for example via inlets and outlets.
46 void getJacobianElements(vector<Eigen::Triplet<double>>& trips) override;
47
48 bool preconditionerSupported() const override { return true; };
49
50 size_t componentIndex(const string& nm) const override;
51 string componentName(size_t k) override;
52 double upperBound(size_t k) const override;
53 double lowerBound(size_t k) const override;
54
55protected:
56 vector<double> m_hk; //!< Species molar enthalpies
57 double m_TotalCp; //!< Total heat capacity (@f$ m c_p @f$) [J/K]
58};
59
60}
61
62#endif
ConstPressureMoleReactor is a class for constant-pressure reactors which use a state of moles.
IdealGasConstPressureMoleReactor is a class for constant-pressure reactors which use temperature and ...
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, span< double > LHS, span< 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 getJacobianElements(vector< Eigen::Triplet< double > > &trips) override
Calculate an approximate Jacobian to accelerate preconditioned solvers.
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 initialize(double t0=0.0) override
Initialize the reactor.
void updateState(span< const double > y) override
Set the state of the reactor to correspond to the state vector y.
vector< double > m_hk
Species molar enthalpies.
void getState(span< double > y) override
Get the current state of the reactor.
void getJacobianScalingFactors(double &f_species, span< double > f_energy) override
Get scaling factors for the Jacobian matrix terms proportional to .
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595