Cantera  4.0.0a1
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 MoleReactor(shared_ptr<Solution> sol, const string& name="(none)");
24 MoleReactor(shared_ptr<Solution> sol, bool clone, const string& name="(none)");
25
26 string type() const override {
27 return "MoleReactor";
28 }
29
30 void getState(double* y) override;
31 void updateState(double* y) override;
32 void eval(double t, double* LHS, double* RHS) override;
33 size_t componentIndex(const string& nm) const override;
34 string componentName(size_t k) override;
35 double upperBound(size_t k) const override;
36 double lowerBound(size_t k) const override;
37 void resetBadValues(double* y) override;
38
39protected:
40 //! Get moles of the system from mass fractions stored by thermo object
41 //! @param y vector for moles to be put into
42 void getMoles(double* y);
43
44 //! Set internal mass variable based on moles given
45 //! @param y vector of moles of the system
46 void setMassFromMoles(double* y);
47
48 //! const value for the species start index
49 const size_t m_sidx = 2;
50};
51
52}
53
54#endif
MoleReactor is meant to serve the same purpose as the reactor class but with a state vector composed ...
Definition MoleReactor.h:21
double upperBound(size_t k) const override
Get the upper bound on the k-th component of the local state vector.
void resetBadValues(double *y) override
Reset physically or mathematically problematic values, such as negative species concentrations.
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:26
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:49
void setMassFromMoles(double *y)
Set internal mass variable based on moles given.
void getState(double *y) override
Get the current state of the reactor.
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.
string name() const
Return the name of this reactor.
Definition ReactorBase.h:81
Class Reactor is a general-purpose class for stirred reactors.
Definition Reactor.h:47
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595