Warning
This documentation is for an old version of Cantera. You can find docs for newer versions here.
Zero-dimensional reactors.
Base class for reactors and reservoirs.
Classes Reactor and Reservoir derive from a common base class ReactorBase. They have the same set of methods, which are all inherited from ReactorBase.
(This is not quite true in the corresponding classes in the Cantera C++ kernel. There class Reactor defines some methods that class Reservoir doesn’t. These are used internally by the ReactorNet instance that integrates the system of ODEs describing the network to evaluate the portion of the ODE system associated with that reactor.)
See Reactor for a description of the constructor parameters. The type parameter specifies whether a Reactor (type = 2) or Reservoir (type = 1) will be created.
Return an object representing the reactor contents, after first synchronizing its state with the current reactor state. This method is useful when some property of the fluid in the reactor is needed that is not provided by a method of Reactor.
>>> r = Reactor(gas)
>>> (statements that change the state of object 'gas')
>>> c = r.contents()
>>> print c.gibbs_mole(), c.chemPotentials()
Note that after calling contents(), object c references the same underlying kernel object as object gas does. Therefore, all properties of c and gas are identical. (Remember that Python objects are really C pointers; at the C level, both point to the same data structure.) It is also allowed to write
>>> gas = r.contents()
The density of the fluid in the reactor [kg/m^3].
The specific enthalpy of the fluid in the reactor [J/kg].
Return the list of flow devices installed on inlets to this reactor. This method can be used to access information about the flows entering the reactor:
>>> for n in r.inlets():
... print n.name(), n.massFlowRate()
Insert contents into the reactor. Sets the objects used to compute thermodynamic properties and kinetic rates.
The specific internal energy of the fluid in the reactor [J/kg].
The total mass of fluid in the reactor [kg].
The mass fraction of species s, specified either by name or index number.
>>> y1 = r.massFraction(7)
0.02
>>> y2 = r.massFraction('CH3O')
0.02
Return an array of the species mass fractions.
The mole fraction of species s, specified either by name or index number.
>>> x1 = r.moleFraction(9)
0.00012
>>> x2 = r.moleFraction('CH3')
0.00012
Return an array of the species mole fractions.
Number of sensitivity parameters for this reactor.
The name of the reactor.
Return the list of flow devices installed on outlets on this reactor.
>>> for o in r.outlets():
... print o.name(), o.massFlowRate()
The pressure in the reactor [Pa].
The integer index used to access the kernel reactor object. For internal use.
Set the state of the object representing the reactor contents to the current reactor state.
>>> r = Reactor(gas)
>>> (statements that change the state of object 'gas')
>>> r.syncContents()
After this statement, the state of object ‘gas’ is synchronized with the reactor state. See contents().
The temperature in the reactor [K].
The total reactor volume [m^3]. The volume may change with time if non-rigid walls are installed on the reactor.
Bases: Cantera.Reactor.ReactorBase
Zero-dimensional reactors. Instances of class Reactor represent zero-dimensional reactors. By default, they are closed (no inlets or outlets), have fixed volume, and have adiabatic, chemically-inert walls. These properties may all be changed by adding appropriate components. See Wall, MassFlowController, and Valve.
Parameters: |
|
---|
Some examples showing how to create Reactor objects are shown below.
>>> gas = GRI30()
>>> r1 = Reactor(gas)
This is equivalent to:
>>> r1 = Reactor()
>>> r1.insert(gas)
Arguments may be specified using keywords in any order:
>>> r2 = Reactor(contents = gas, energy = 'off',
... name = 'isothermal_reactor')
>>> r3 = Reactor(contents = gas, name = 'adiabatic_reactor')
Here’s an array of reactors:
>>> reactor_array = [Reactor(), Reactor(gas), Reactor(Air())]
Base class for devices that regulate the flow rate in a fluid line.
Create a new instance of type type
Install the device between the upstream and downstream reactors or reservoirs.
>>> f.install(upstream=reactor1, downstream=reservoir2)
Mass flow rate (kg/s).
The name specified when initially constructed.
Deprecated. Returns true if the device is ready to use.
Networks of reactors. ReactorNet objects are used to simultaneously advance the state of a set of coupled reactors.
Example:
>>> r1 = Reactor(gas1)
>>> r2 = Reactor(gas2)
>>> <... install walls, inlets, outlets, etc...>
>>> reactor_network = ReactorNet([r1, r2])
>>> reactor_network.advance(time)
Create a new ReactorNet instance. If a list of reactors is supplied, these will be added to the network.
Add a reactor to the network.
Advance the state of the reactor network in time from the current time to time ‘time’.
Number of sensitivity parameters.
The integer index used to access the kernel reactornet object. For internal use.
Return the list of reactors in the network.
Sensitivity of solution component component with respect to one or more parameters.
Parameters: |
|
---|
Set the initial time. Restarts integration from this time using the current state as the initial condition. Default: 0.0 s
Set the relative and absolute error tolerances used in integrating the reactor equations.
Take a single internal time step toward time time. The time after taking the step is returned.
The current time [s].
Bases: Cantera.Reactor.ReactorBase
Parameters: |
|
---|
Bases: Cantera.Reactor.ReactorBase
Parameters: |
|
---|
Bases: Cantera.Reactor.ReactorBase
A reservoir is a reactor with a constant state. The temperature, pressure, and chemical composition in a reservoir never change from their initial values.
Parameters: |
|
---|
Some examples showing how to create Reservoir objects are shown below.
>>> gas = GRI30()
>>> res1 = Reservoir(gas)
This is equivalent to:
>>> res1 = Reactor()
>>> res1.insert(gas)
Arguments may be specified using keywords in any order:
>>> res2 = Reservoir(contents=Air(), name='environment')
>>> res3 = Reservoir(contents=gas, name='upstream_state')
Deprecated. Do nothing.
Bases: Cantera.Reactor.FlowDevice
Mass flow controllers. A mass flow controller maintains a specified mass flow rate independent of upstream and downstream conditions. The equation used to compute the mass flow rate is
where \(\dot m_0\) is either a constant value or a function of time. Note that if \(\dot m_0 < 0\), the mass flow rate will be set to zero, since reversal of the flow direction is not allowed.
Unlike a real mass flow controller, a MassFlowController object will maintain the flow even if the downstream pressure is greater than the upstream pressure. This allows simple implementation of loops, in which exhaust gas from a reactor is fed back into it through an inlet. But note that this capability should be used with caution, since no account is taken of the work required to do this.
A mass flow controller is assumed to be adiabatic, non-reactive, and have negligible volume, so that it is internally always in steady-state even if the upstream and downstream reactors are not. The fluid enthalpy, chemical composition, and mass flow rate are constant across a mass flow controller, and the pressure difference equals the difference in pressure between the upstream and downstream reactors.
Examples:
>>> mfc1 = MassFlowController(upstream=res1, downstream=reactr,
... name='fuel_mfc', mdot = 0.1)
>>> air_mdot = Gaussian(A=0.1, t0=2.0, FWHM=0.1)
>>> mfc2 = MassFlowController(upstream=res2, downstream=reactr,
... name='air_mfc', mdot=air_mdot)
Parameters: |
|
---|
Set the mass flow rate [kg/s]. May be called at any time to change the mass flow rate to a new value, or to a new function of time.
>>> mfc.set(mdot = 0.2)
Bases: Cantera.Reactor.FlowDevice
Valves. In Cantera, a Valve object is a flow devices with mass flow rate that is a function of the pressure drop across it. The default behavior is linear:
if \(P_1 > P_2.\) Otherwise, \(\dot m = 0\). However, an arbitrary function can also be specified, such that
if \(P_1 > P_2\), or \(\dot m = 0\) otherwise. It is never possible for the flow to reverse and go from the downstream to the upstream reactor/reservoir through a line containing a Valve object.
Valve objects are often used between an upstream reactor and a downstream reactor or reservoir to maintain them both at nearly the same pressure. By setting the constant \(K_v\) to a sufficiently large value, very small pressure differences will result in flow between the reactors that counteracts the pressure difference.
A Valve is assumed to be adiabatic, non-reactive, and have negligible internal volume, so that it is internally always in steady-state even if the upstream and downstream reactors are not. The fluid enthalpy, chemical composition, and mass flow rate are constant across a Valve, and the pressure difference equals the difference in pressure between the upstream and downstream reactors.
Parameters: |
|
---|
Set or reset valve properties. All keywords are optional.
Parameters: |
|
---|
Set or reset the valve coefficient \(K_v\).
Bases: Cantera.Reactor.FlowDevice
A PressureController is designed to be used in conjunction with another ‘master’ flow controller, typically a MassFlowController. The master flow controller is installed on the inlet of the reactor, and the corresponding PressureController is installed on on outlet of the reactor. The PressureController mass flow rate is equal to the master mass flow rate, plus a small correction dependent on the pressure difference:
Parameters: |
|
---|
Set the master flow controller.
Set or reset the pressure coefficient \(K_v\).
Reactor walls.
A Wall separates two reactors, or a reactor and a reservoir. A wall has a finite area, may conduct or radiate heat between the two reactors on either side, and may move like a piston.
Walls are stateless objects in Cantera, meaning that no differential equation is integrated to determine any wall property. Since it is the wall (piston) velocity that enters the energy equation, this means that it is the velocity, not the acceleration or displacement, that is specified. The wall velocity is computed from
where \(K\) is a non-negative constant, and \(v_0(t)\) is a specified function of time. The velocity is positive if the wall is moving to the right.
The heat flux through the wall is computed from
where \(U\) is the overall heat transfer coefficient for conduction/convection, and \(\epsilon\) is the emissivity. The function \(q_0(t)\) is a specified function of time. The heat flux is positive when heat flows from the reactor on the left to the reactor on the right.
A heterogeneous reaction mechanism may be specified for one or both of the wall surfaces. The mechanism object (typically an instance of class Interface) must be constructed so that it is properly linked to the object representing the fluid in the reactor the surface in question faces. The surface temperature on each side is taken to be equal to the temperature of the reactor it faces.
Parameters: |
|
---|
The wall area (m^2).
Rate of heat flow through the wall. A positive value corresponds to heat flowing from the left-hand reactor to the right-hand one.
Return 1 if the wall instance is ready for use, 0 otherwise. Deprecated.
Set various wall parameters: A, U, K, Q, velocity. These have the same meanings as in the constructor.
Set the area (m^2). The wall area may be changed manually at any time during a simulation.
Set the emissivity.
Set the coefficient K that determines the expansion rate resulting from a unit pressure drop.
Specify the time-dependent heat flux function [W/m2]. qfunc must be a functor (an instance of Func1).
Set the overall heat transfer coefficient [W/m^2/K]
Specify surface reaction mechanisms for the left and right sides of the wall.
Deprecated.
Specify the velocity function [m/s]. vfunc must be a functor (an instance of Func1)
Rate of volume change [m^3]. A positive value corresponds to the left-hand reactor volume increasing, and the right-hand reactor volume decreasing.