13#include "cantera/numerics/eigen_sparse.h"
28 FlowDevice(shared_ptr<ReactorBase> r0, shared_ptr<ReactorBase> r1,
29 const string&
name=
"(none)");
32 string type()
const override {
38 if (m_mdot ==
Undef) {
40 "Flow device is not ready. Try initializing the reactor network.");
79 virtual void setPrimary(shared_ptr<ConnectorNode> primary) {
104 double coeff,
bool includePressureSpecies=
true);
123 SparseTriplets& trips,
size_t row,
size_t k,
double coeff,
124 bool includeComposition=
true,
bool includePressureSpecies=
true);
140 bool includeComposition=
true);
145 virtual bool ready() {
146 return (m_in != 0 && m_out != 0);
215 double m_mdot =
Undef;
234 vector<size_t> m_in2out, m_out2in;
Base class for exceptions thrown by Cantera classes.
Base class for walls and flow devices connecting reactors.
string name() const
Retrieve connector name.
ConnectorNode(const string &name="(none)")
Transitional constructor.
Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors.
double outletSpeciesMassFlowRate(size_t k)
Mass flow rate (kg/s) of outlet species k.
void addInletEnthalpyJacobian(SparseTriplets &trips, size_t row, double coeff, bool includeComposition=true)
Add Jacobian terms for the inlet enthalpy dependence on upstream state.
virtual void addMassFlowRateJacobian(SparseTriplets &trips, size_t row, double coeff, bool includePressureSpecies=true)
Add Jacobian terms proportional to derivatives of the mass flow rate.
double m_time
Current reactor network time.
virtual void setMassFlowRate(double mdot)
Set the fixed mass flow rate (kg/s) through a flow device.
double m_coeff
Coefficient set by derived classes; used by updateMassFlowRate.
void setSimTime(double time)
Set current reactor network time.
string type() const override
String indicating the connector implemented.
double enthalpy_mass()
specific enthalpy
double deviceCoefficient() const
Get the device coefficient (defined by derived class).
ReactorBase & in() const
Return a reference to the upstream reactor.
virtual void setTimeFunction(shared_ptr< Func1 > g)
Set a function of time to modulate the mass flow rate.
void addOutletSpeciesMassFlowRateJacobian(SparseTriplets &trips, size_t row, size_t k, double coeff, bool includeComposition=true, bool includePressureSpecies=true)
Add Jacobian terms proportional to derivatives of outletSpeciesMassFlowRate(k).
double massFlowRate()
Mass flow rate (kg/s).
void setDeviceCoefficient(double c)
Set the device coefficient (defined by derived class).
const ReactorBase & out() const
Return a const reference to the downstream reactor.
double evalTimeFunction()
Return current value of the time function.
ReactorBase & out()
Return a mutable reference to the downstream reactor.
virtual void setPressureFunction(shared_ptr< Func1 > f)
Set a function of pressure to modify the pressure response.
virtual double massFlowRate_ddP() const
Derivative of mass flow rate with respect to pressure difference.
shared_ptr< Func1 > m_tfunc
Function set by setTimeFunction; used by updateMassFlowRate.
virtual void updateMassFlowRate(double time)
Update the mass flow rate at time 'time'.
double evalPressureFunction()
Return current value of the pressure function.
shared_ptr< Func1 > m_pfunc
Function set by setPressureFunction; used by updateMassFlowRate.
double pressureFunction_ddP(double deltaP) const
Return the derivative of the pressure function at deltaP.
virtual void setPrimary(shared_ptr< ConnectorNode > primary)
Set the primary mass flow controller.
An error indicating that an unimplemented function has been called.
Base class for reactor objects.
This file contains definitions of constants, types and terms that are used in internal routines and a...
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
Namespace for the Cantera kernel.
const double Undef
Fairly random number to be used to initialize variables against to see if they are subsequently defin...