Update Doxygen docs for other Reactor-related classes
This commit is contained in:
parent
5a94876c91
commit
8d004658d7
6 changed files with 88 additions and 149 deletions
|
|
@ -21,45 +21,29 @@ const int PressureController_Type = 2;
|
|||
const int Valve_Type = 3;
|
||||
|
||||
/**
|
||||
* Base class for 'flow devices' (valves, pressure regulators,
|
||||
* etc.) connecting reactors. Allowance is made for devices that
|
||||
* are closed-loop controllers. Several methods for these are
|
||||
* defined here that do nothing but may be overloaded to set or
|
||||
* get the setpoint, gains, etc. The behavior of overloaded
|
||||
* methods should be consistent with the behavior described
|
||||
* here. The base-class versions of these methods print a warning
|
||||
* if called.
|
||||
* Base class for 'flow devices' (valves, pressure regulators, etc.)
|
||||
* connecting reactors. Allowance is made for devices that are closed-loop
|
||||
* controllers. Several methods for these are defined here that do nothing but
|
||||
* may be overloaded to set or get the setpoint, gains, etc. The behavior of
|
||||
* overloaded methods should be consistent with the behavior described here.
|
||||
* The base-class versions of these methods print a warning if called.
|
||||
* @ingroup reactor0
|
||||
*/
|
||||
class FlowDevice
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
FlowDevice() : m_mdot(0.0), m_func(0), m_type(0),
|
||||
m_nspin(0), m_nspout(0),
|
||||
m_in(0), m_out(0) {}
|
||||
|
||||
/// Destructor (does nothing)
|
||||
virtual ~FlowDevice() {}
|
||||
|
||||
// /// Copy constructor.
|
||||
// FlowDevice(const FlowDevice& a) : m_in(a.m_in), m_out(a.m_out) {}
|
||||
|
||||
// /// Assignment operator
|
||||
// FlowDevice& operator=(const FlowDevice& a) {
|
||||
// if (this == &a) return *this;
|
||||
// m_in = a.m_in;
|
||||
// m_out = a.m_out;
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
//! Return an integer indicating the type of flow device
|
||||
int type() {
|
||||
return m_type;
|
||||
}
|
||||
|
||||
/**
|
||||
/*!
|
||||
* Mass flow rate (kg/s).
|
||||
*/
|
||||
doublereal massFlowRate(double time = -999.0) {
|
||||
|
|
@ -69,14 +53,17 @@ public:
|
|||
return m_mdot;
|
||||
}
|
||||
|
||||
// Update the mass flow rate at time 'time'. This must be
|
||||
// overloaded in subclassess to update m_mdot.
|
||||
//! Update the mass flow rate at time 'time'. This must be overloaded in
|
||||
//! subclassess to update m_mdot.
|
||||
virtual void updateMassFlowRate(doublereal time) {}
|
||||
|
||||
// mass flow rate of outlet species k
|
||||
/*!
|
||||
* Mass flow rate (kg/s) of outlet species k. Returns zero if this species
|
||||
* is not present in the upstream mixture.
|
||||
*/
|
||||
doublereal outletSpeciesMassFlowRate(size_t k);
|
||||
|
||||
// specific enthalpy
|
||||
//! specific enthalpy
|
||||
doublereal enthalpy_mass();
|
||||
|
||||
// /**
|
||||
|
|
@ -139,37 +126,39 @@ public:
|
|||
return (m_in != 0 && m_out != 0);
|
||||
}
|
||||
|
||||
/// Return a reference to the upstream reactor.
|
||||
//! Return a reference to the upstream reactor.
|
||||
ReactorBase& in() const {
|
||||
return *m_in;
|
||||
}
|
||||
|
||||
/// Return a const reference to the downstream reactor.
|
||||
//! Return a const reference to the downstream reactor.
|
||||
const ReactorBase& out() const {
|
||||
return *m_out;
|
||||
}
|
||||
|
||||
/// set parameters
|
||||
//! set parameters
|
||||
virtual void setParameters(int n, doublereal* coeffs) {
|
||||
m_coeffs.resize(n);
|
||||
std::copy(coeffs, coeffs + n, m_coeffs.begin());
|
||||
}
|
||||
|
||||
//! Set a function of a single variable that is used in determining the
|
||||
//! mass flow rate through the device. The meaning of this function
|
||||
//! depends on the parameterization of the derived type.
|
||||
void setFunction(Cantera::Func1* f);
|
||||
|
||||
//! Set the fixed mass flow rate (kg/s) through the flow device.
|
||||
void setMassFlowRate(doublereal mdot) {
|
||||
m_mdot = mdot;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
doublereal m_mdot;
|
||||
Cantera::Func1* m_func;
|
||||
vector_fp m_coeffs;
|
||||
int m_type;
|
||||
|
||||
private:
|
||||
|
||||
size_t m_nspin, m_nspout;
|
||||
ReactorBase* m_in;
|
||||
ReactorBase* m_out;
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ namespace Cantera
|
|||
|
||||
class Reservoir : public ReactorBase
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Reservoir() {}
|
||||
virtual int type() const {
|
||||
return ReservoirType;
|
||||
|
|
@ -26,12 +24,8 @@ public:
|
|||
void insert(Cantera::ThermoPhase& contents) {
|
||||
setThermoMgr(contents);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -20,33 +20,45 @@ class Kinetics;
|
|||
class Func1;
|
||||
class SurfPhase;
|
||||
|
||||
//! Represents a wall between between two ReactorBase objects.
|
||||
/*!
|
||||
* Walls can move (changing the volume of the adjacent reactors), allow heat
|
||||
* transfer between reactors, and provide a location for surface reactions to
|
||||
* take place.
|
||||
*/
|
||||
class Wall
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
Wall();
|
||||
|
||||
/// Destructor. Since Wall instances do not allocate memory,
|
||||
/// the destructor does nothing.
|
||||
virtual ~Wall() {}
|
||||
|
||||
|
||||
/// Rate of volume change (kg/s). Positive value increases
|
||||
/// volume of reactor on left, and decreases volume on right.
|
||||
//! Rate of volume change (m^3/s) for the adjacent reactors.
|
||||
/*! The volume rate of change is given by
|
||||
* \f[ \dot V = K A (P_{left} - P_{right}) + F(t) \f]
|
||||
* where *K* is the specified expansion rate coefficient, *A* is the wall
|
||||
* area, and *F(t)* is a specified function of time. Positive values for
|
||||
* `vdot` correspond to increases in the volume of reactor on left, and
|
||||
* decreases in the volume of the reactor on the right.
|
||||
*/
|
||||
virtual doublereal vdot(doublereal t);
|
||||
|
||||
/// Heat flow rate through the wall (W). Positive values
|
||||
/// denote a flux from left to right.
|
||||
//! Heat flow rate through the wall (W).
|
||||
/*!
|
||||
* The heat flux is given by
|
||||
* \f[ Q = h A (T_{left} - T_{right}) + A G(t) \f]
|
||||
* where *h* is the heat transfer coefficient, *A* is the wall area, and
|
||||
* *G(t)* is a specified function of time. Positive values denote a flux
|
||||
* from left to right.
|
||||
*/
|
||||
virtual doublereal Q(doublereal t);
|
||||
|
||||
/// Area in m^2.
|
||||
//! Area in m^2.
|
||||
doublereal area() {
|
||||
return m_area;
|
||||
}
|
||||
|
||||
/// Set the area [m^2].
|
||||
//! Set the area [m^2].
|
||||
void setArea(doublereal a) {
|
||||
m_area = a;
|
||||
}
|
||||
|
|
@ -60,7 +72,7 @@ public:
|
|||
m_rrth = 1.0/Rth;
|
||||
}
|
||||
|
||||
/// Set the overall heat transfer coefficient [W/m^2/K].
|
||||
//! Set the overall heat transfer coefficient [W/m^2/K].
|
||||
void setHeatTransferCoeff(doublereal U) {
|
||||
m_rrth = U;
|
||||
}
|
||||
|
|
@ -70,7 +82,7 @@ public:
|
|||
return m_rrth;
|
||||
}
|
||||
|
||||
/// Set the emissivity.
|
||||
//! Set the emissivity.
|
||||
void setEmissivity(doublereal epsilon) {
|
||||
if (epsilon > 1.0 || epsilon < 0.0)
|
||||
throw Cantera::CanteraError("Wall::setEmissivity",
|
||||
|
|
@ -82,16 +94,14 @@ public:
|
|||
return m_emiss;
|
||||
}
|
||||
|
||||
/** Set the piston velocity to a specified function. */
|
||||
//! Set the wall velocity to a specified function of time
|
||||
void setVelocity(Cantera::Func1* f=0) {
|
||||
if (f) {
|
||||
m_vf = f;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the expansion rate coefficient.
|
||||
*/
|
||||
//! Set the expansion rate coefficient.
|
||||
void setExpansionRateCoeff(doublereal k) {
|
||||
m_k = k;
|
||||
}
|
||||
|
|
@ -101,71 +111,65 @@ public:
|
|||
return m_k;
|
||||
}
|
||||
|
||||
/// Specify the heat flux function \f$ q_0(t) \f$.
|
||||
//! Specify the heat flux function \f$ q_0(t) \f$.
|
||||
void setHeatFlux(Cantera::Func1* q) {
|
||||
m_qf = q;
|
||||
}
|
||||
|
||||
/// Install the wall between two reactors or reservoirs
|
||||
//! Install the wall between two reactors or reservoirs
|
||||
bool install(ReactorBase& leftReactor, ReactorBase& rightReactor);
|
||||
|
||||
/// Called just before the start of integration
|
||||
//! Called just before the start of integration
|
||||
virtual void initialize();
|
||||
|
||||
/// True if the wall is correctly configured and ready to use.
|
||||
//! True if the wall is correctly configured and ready to use.
|
||||
virtual bool ready() {
|
||||
return (m_left != 0 && m_right != 0);
|
||||
}
|
||||
|
||||
// int type() { return 0; }
|
||||
|
||||
|
||||
/// Return a reference to the reactor or reservoir to the left
|
||||
/// of the wall.
|
||||
//! Return a reference to the Reactor or Reservoir to the left
|
||||
//! of the wall.
|
||||
ReactorBase& left() const {
|
||||
return *m_left;
|
||||
}
|
||||
|
||||
/// Return a reference to the reactor or reservoir to the
|
||||
/// right of the wall.
|
||||
//! Return a reference to the Reactor or Reservoir to the
|
||||
//! right of the wall.
|
||||
const ReactorBase& right() {
|
||||
return *m_right;
|
||||
}
|
||||
|
||||
// /// Set wall parameters.
|
||||
//virtual void setParameters(int n, doublereal* coeffs) {
|
||||
// m_coeffs.resize(n);
|
||||
// copy(coeffs, coeffs + n, m_coeffs.begin());
|
||||
//}
|
||||
|
||||
// Specify the heterogeneous reaction mechanisms for each side
|
||||
// of the wall.
|
||||
//! Specify the heterogeneous reaction mechanisms for each side of the
|
||||
//! wall. Passing a null pointer indicates that there is no reaction
|
||||
//! mechanism for the corresponding wall surface.
|
||||
void setKinetics(Cantera::Kinetics* leftMechanism,
|
||||
Cantera::Kinetics* rightMechanism);
|
||||
|
||||
/// Return a pointer to the surface phase object for the left
|
||||
/// or right wall surface.
|
||||
//! Return a pointer to the surface phase object for the left
|
||||
//! (`leftright=0`) or right (`leftright=1`) wall surface.
|
||||
Cantera::SurfPhase* surface(int leftright) {
|
||||
return m_surf[leftright];
|
||||
}
|
||||
|
||||
//! Return a pointer to the surface kinetics object for the left
|
||||
//! (`leftright=0`) or right (`leftright=1`) wall surface.
|
||||
Cantera::Kinetics* kinetics(int leftright) {
|
||||
return m_chem[leftright];
|
||||
}
|
||||
|
||||
/// Set the surface coverages on the left or right surface to
|
||||
/// the values in array 'cov'.
|
||||
//! Set the surface coverages on the left (`leftright = 0`) or right
|
||||
//! (`leftright = 1`) surface to the values in array `cov`.
|
||||
void setCoverages(int leftright, const doublereal* cov);
|
||||
|
||||
/// Write the coverages of the left or right surface into
|
||||
/// array cov.
|
||||
//! Write the coverages of the left or right surface into array `cov`.
|
||||
void getCoverages(int leftright, doublereal* cov);
|
||||
|
||||
/// Set the coverages in the surface phase object to the
|
||||
/// values for this wall surface.
|
||||
//! Set the coverages in the surface phase object to the
|
||||
//! values for this wall surface.
|
||||
void syncCoverages(int leftright);
|
||||
|
||||
|
||||
//! Number of sensitivity parameters associated with reactions on the left
|
||||
//! (`lr = 0`) or right (`lr = 1`) side of the wall.
|
||||
size_t nSensParams(int lr) const {
|
||||
if (lr == 0) {
|
||||
return m_pleft.size();
|
||||
|
|
@ -177,12 +181,7 @@ public:
|
|||
void setSensitivityParameters(int lr, double* params);
|
||||
void resetSensitivityParameters(int lr);
|
||||
|
||||
// int componentIndex(string nm) const;
|
||||
|
||||
protected:
|
||||
|
||||
//vector_fp m_coeffs;
|
||||
|
||||
ReactorBase* m_left;
|
||||
ReactorBase* m_right;
|
||||
Cantera::Kinetics* m_chem[2];
|
||||
|
|
@ -196,9 +195,6 @@ protected:
|
|||
|
||||
std::vector<size_t> m_pleft, m_pright;
|
||||
Cantera::vector_fp m_leftmult_save, m_rightmult_save;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,13 +16,12 @@
|
|||
namespace Cantera
|
||||
{
|
||||
/**
|
||||
* A class for mass flow controllers. The mass flow rate is constant,
|
||||
* independent of any other parameters.
|
||||
* A class for mass flow controllers. The mass flow rate is constant or
|
||||
* specified as a function of time..
|
||||
*/
|
||||
class MassFlowController : public FlowDevice
|
||||
{
|
||||
public:
|
||||
|
||||
MassFlowController() : FlowDevice() {
|
||||
m_type = MFC_Type;
|
||||
}
|
||||
|
|
@ -31,10 +30,9 @@ public:
|
|||
return FlowDevice::ready() && m_mdot >= 0.0;
|
||||
}
|
||||
|
||||
/// If a function of time has been specified for
|
||||
/// mdot, then update the stored mass flow rate.
|
||||
/// Otherwise, mdot is a constant, and does not need
|
||||
/// updating.
|
||||
/// If a function of time has been specified for mdot, then update the
|
||||
/// stored mass flow rate. Otherwise, mdot is a constant, and does not
|
||||
/// need updating.
|
||||
virtual void updateMassFlowRate(doublereal time) {
|
||||
if (m_func) {
|
||||
m_mdot = m_func->eval(time);
|
||||
|
|
@ -43,20 +41,16 @@ public:
|
|||
m_mdot = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
/**
|
||||
* A class for mass flow controllers. The mass flow rate is constant,
|
||||
* independent of any other parameters.
|
||||
* A class for flow controllers where the flow rate is equal to the flow rate
|
||||
* of a "master" mass flow controller plus a correction proportional to the
|
||||
* pressure difference between the inlet and outlet.
|
||||
*/
|
||||
class PressureController : public FlowDevice
|
||||
{
|
||||
public:
|
||||
|
||||
PressureController() : FlowDevice(), m_master(0) {
|
||||
m_type = PressureController_Type;
|
||||
}
|
||||
|
|
@ -80,20 +74,17 @@ public:
|
|||
|
||||
protected:
|
||||
FlowDevice* m_master;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
/// Valve objects supply a mass flow rate that is a function of the
|
||||
/// pressure drop across the valve. The default behavior is a linearly
|
||||
/// proportional to the pressure difference. Note that
|
||||
/// real valves do not have this behavior, so this class
|
||||
/// does not model real, physical valves.
|
||||
//! Supply a mass flow rate that is a function of the pressure drop across the valve.
|
||||
/*!
|
||||
* The default behavior is a linearly proportional to the pressure difference.
|
||||
* Note that real valves do not have this behavior, so this class does not
|
||||
* model real, physical valves.
|
||||
*/
|
||||
class Valve : public FlowDevice
|
||||
{
|
||||
public:
|
||||
|
||||
Valve() : FlowDevice() {
|
||||
m_type = Valve_Type;
|
||||
}
|
||||
|
|
@ -102,8 +93,7 @@ public:
|
|||
return FlowDevice::ready() && m_coeffs.size() >= 1;
|
||||
}
|
||||
|
||||
/// Compute the currrent mass flow rate, based on
|
||||
/// the pressure difference.
|
||||
/// Compute the currrent mass flow rate, based on the pressure difference.
|
||||
virtual void updateMassFlowRate(doublereal time) {
|
||||
double delta_P = in().pressure() - out().pressure();
|
||||
if (m_func) {
|
||||
|
|
@ -115,12 +105,7 @@ public:
|
|||
m_mdot = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#include "cantera/zeroD/FlowDevice.h"
|
||||
#include "cantera/zeroD/ReactorBase.h"
|
||||
#include "cantera/numerics/Func1.h"
|
||||
|
|
@ -45,11 +44,6 @@ void FlowDevice::setFunction(Func1* f)
|
|||
m_func = f;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mass flow rate of outlet species k. Returns zero if this
|
||||
* species is not present in the upstream mixture.
|
||||
*/
|
||||
doublereal FlowDevice::outletSpeciesMassFlowRate(size_t k)
|
||||
{
|
||||
if (k >= m_nspout) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
Wall::Wall() : m_left(0), m_right(0),
|
||||
m_area(0.0), m_k(0.0), m_rrth(0.0), m_emiss(0.0),
|
||||
m_vf(0), m_qf(0)
|
||||
|
|
@ -38,10 +37,6 @@ void Wall::initialize()
|
|||
std::sort(m_pright.begin(), m_pright.end());
|
||||
}
|
||||
|
||||
/** Specify the kinetics managers for the surface mechanisms on
|
||||
* the left side and right side of the wall. Enter 0 if there is
|
||||
* no reaction mechanism.
|
||||
*/
|
||||
void Wall::setKinetics(Kinetics* left, Kinetics* right)
|
||||
{
|
||||
m_chem[0] = left;
|
||||
|
|
@ -72,14 +67,6 @@ void Wall::setKinetics(Kinetics* left, Kinetics* right)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The volume rate of change is given by
|
||||
* \f[ \dot V = K A (P_{left} - P_{right}) + F(t) \f]
|
||||
* where \f$ F(t) \f$ is a specified function of time.
|
||||
*
|
||||
* This method is used by class Reactor to compute the
|
||||
* rate of volume change of the reactor.
|
||||
*/
|
||||
doublereal Wall::vdot(doublereal t)
|
||||
{
|
||||
double rate1 = m_k * m_area *
|
||||
|
|
@ -90,12 +77,6 @@ doublereal Wall::vdot(doublereal t)
|
|||
return rate1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The heat flux is given by
|
||||
* \f[ Q = h A (T_{left} - T_{right}) + A G(t) \f]
|
||||
* where h is the heat transfer coefficient, and
|
||||
* \f$ G(t) \f$ is a specified function of time.
|
||||
*/
|
||||
doublereal Wall::Q(doublereal t)
|
||||
{
|
||||
double q1 = (m_area * m_rrth) *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue