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. Connector terms are included for supported flow devices
45 //! and walls, subject to derivative settings that control sparse approximations.
46 void getJacobianElements(SparseTriplets& trips) override;
47 void addTemperatureJacobian(SparseTriplets& trips, size_t row,
48 double coeff) const override;
49 void addSpeciesMassFractionJacobian(SparseTriplets& trips, size_t row, size_t k,
50 double coeff) const override;
51 void addEnthalpyJacobian(SparseTriplets& trips, size_t row, double coeff,
52 bool includeComposition=true) const override;
53
54 bool preconditionerSupported() const override { return true; };
55
56 size_t componentIndex(const string& nm) const override;
57 string componentName(size_t k) override;
58 double upperBound(size_t k) const override;
59 double lowerBound(size_t k) const override;
60
61protected:
62 vector<double> m_hk; //!< Species molar enthalpies
63 double m_TotalCp; //!< Total heat capacity (@f$ m c_p @f$) [J/K]
64};
65
66}
67
68#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 addTemperatureJacobian(SparseTriplets &trips, size_t row, double coeff) const override
Add terms proportional to derivatives with respect to this reactor's temperature.
void eval(double t, span< double > LHS, span< double > RHS) override
Evaluate the reactor governing equations.
void addSpeciesMassFractionJacobian(SparseTriplets &trips, size_t row, size_t k, double coeff) const override
Add terms proportional to derivatives with respect to a species mass fraction.
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 addEnthalpyJacobian(SparseTriplets &trips, size_t row, double coeff, bool includeComposition=true) const override
Add terms proportional to derivatives of this reactor's specific enthalpy.
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 getJacobianElements(SparseTriplets &trips) override
Calculate an approximate Jacobian to accelerate preconditioned solvers.
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