Cantera.Reactor
index
/usr/local/lib/python2.6/dist-packages/Cantera/Reactor.py

Zero-dimensional reactors.

 
Modules
       
Cantera._cantera
types

 
Classes
       
FlowDevice
MassFlowController
PressureController
Valve
ReactorBase
ConstPressureReactor
FlowReactor
Reactor
Reservoir
ReactorNet
Wall

 
class ConstPressureReactor(ReactorBase)
     Methods defined here:
__init__(self, contents=None, name='', volume=1.0, energy='on', verbose=0)
contents - Reactor contents. If not specified, the reactor is
initially empty. In this case, call method 'insert' to specify
the contents.
 
name - Used only to identify this reactor in output. If not
specified, defaults to 'Reactor_n', where n is an integer
assigned in the order Reactor objects are created.
 
volume - Initial reactor volume. Defaults to 1 m^3.
 
energy - Set to 'on' or 'off'. If set to 'off', the energy
equation is not solved, and the temperature is held at its
initial value. The default in 'on'.
 
verbose - if set to a non-zero value, additional diagnostic
information will be printed.

Methods inherited from ReactorBase:
__del__(self)
Delete the reactor instance.
__repr__(self)
__str__(self)
addSensitivityReaction(self, reactions=[])
advance(self, time)
Deprecated.
Advance the state of the reactor in time from the current
time to time 'time'. Note: this method is deprecated. See
class ReactorNet.
contents(self)
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 class 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 method '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()
density(self)
The density of the fluid in the reactor [kg/m^3].
enthalpy_mass(self)
The specific enthalpy of the fluid in the reactor [J/kg].
inlets(self)
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()
See: MassFlowControllerValvePressureController.
insert(self, contents)
Insert 'contents' into the reactor. Sets the objects used to compute
thermodynamic properties and kinetic rates.
intEnergy_mass(self)
The specific internal energy of the fluid in the reactor [J/kg].
mass(self)
The total mass of fluid in the reactor [kg].
massFraction(self, s)
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
massFractions(self)
Return an array of the species mass fractions.
moleFraction(self, s)
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
moleFractions(self)
Return an array of the species mole fractions.
nSensParams(self)
Number of sensitivity parameters for this reactor.
name(self)
The name of the reactor.
outlets(self)
Return the list of flow devices installed on outlets
on this reactor.
>>> for o in r.outlets():
...    print o.name(), o.massFlowRate()
See: MassFlowControllerValvePressureController.
pressure(self)
The pressure in the reactor [Pa].
reactor_id(self)
The integer index used to access the kernel reactor
object. For internal use.
sensParamName(self, n=-1)
setInitialTime(self, T0)
Deprecated.
Set the initial time. Restarts integration from this time
using the current state as the initial condition. Default: 0.0 s
step(self, time)
Deprecated.
Take one internal time step from the current time toward
time 'time'. Note: this method is deprecated. See class
ReactorNet.
syncContents(self)
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'.
temperature(self)
The temperature in the reactor [K].
time(self)
Deprecated. The current time [s].
volume(self)
The total reactor volume [m^3]. The volume may change with time
if non-rigid walls are installed on the reactor.
walls(self)
Return the list of walls installed on this reactor.
>>> for w in r.walls():
...    print w.name()
See: Wall.

 
class FlowDevice
    Base class for devices that regulate the flow rate in a fluid line.
 
  Methods defined here:
__del__(self)
Delete the instance.
__init__(self, type, name, verbose)
Create a new instance of type 'type'
flowdev_id(self)
install(self, upstream, downstream)
Install the device between the upstream and downstream
reactors or reservoirs.  
>>> f.install(upstream = reactor1, downstream = reservoir2)
massFlowRate(self, time=-999.0)
Mass flow rate (kg/s).
name(self)
The name specified when initially constructed.
ready(self)
Deprecated. Returns true if the device is ready to use.
setFunction(self, f)

 
class FlowReactor(ReactorBase)
     Methods defined here:
__init__(self, contents=None, name='', volume=1.0, energy='on', mdot=-1.0, verbose=0)
contents - Reactor contents. If not specified, the reactor is
initially empty. In this case, call method 'insert' to specify
the contents.
 
name - Used only to identify this reactor in output. If not
specified, defaults to 'Reactor_n', where n is an integer
assigned in the order Reactor objects are created.
 
volume - Initial reactor volume. Defaults to 1 m^3.
 
energy - Set to 'on' or 'off'. If set to 'off', the energy
equation is not solved, and the temperature is held at its
initial value. The default in 'on'.
 
verbose - if set to a non-zero value, additional diagnostic
information will be printed.
setMassFlowRate(self, mdot)

Methods inherited from ReactorBase:
__del__(self)
Delete the reactor instance.
__repr__(self)
__str__(self)
addSensitivityReaction(self, reactions=[])
advance(self, time)
Deprecated.
Advance the state of the reactor in time from the current
time to time 'time'. Note: this method is deprecated. See
class ReactorNet.
contents(self)
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 class 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 method '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()
density(self)
The density of the fluid in the reactor [kg/m^3].
enthalpy_mass(self)
The specific enthalpy of the fluid in the reactor [J/kg].
inlets(self)
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()
See: MassFlowControllerValvePressureController.
insert(self, contents)
Insert 'contents' into the reactor. Sets the objects used to compute
thermodynamic properties and kinetic rates.
intEnergy_mass(self)
The specific internal energy of the fluid in the reactor [J/kg].
mass(self)
The total mass of fluid in the reactor [kg].
massFraction(self, s)
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
massFractions(self)
Return an array of the species mass fractions.
moleFraction(self, s)
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
moleFractions(self)
Return an array of the species mole fractions.
nSensParams(self)
Number of sensitivity parameters for this reactor.
name(self)
The name of the reactor.
outlets(self)
Return the list of flow devices installed on outlets
on this reactor.
>>> for o in r.outlets():
...    print o.name(), o.massFlowRate()
See: MassFlowControllerValvePressureController.
pressure(self)
The pressure in the reactor [Pa].
reactor_id(self)
The integer index used to access the kernel reactor
object. For internal use.
sensParamName(self, n=-1)
setInitialTime(self, T0)
Deprecated.
Set the initial time. Restarts integration from this time
using the current state as the initial condition. Default: 0.0 s
step(self, time)
Deprecated.
Take one internal time step from the current time toward
time 'time'. Note: this method is deprecated. See class
ReactorNet.
syncContents(self)
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'.
temperature(self)
The temperature in the reactor [K].
time(self)
Deprecated. The current time [s].
volume(self)
The total reactor volume [m^3]. The volume may change with time
if non-rigid walls are installed on the reactor.
walls(self)
Return the list of walls installed on this reactor.
>>> for w in r.walls():
...    print w.name()
See: Wall.

 
class MassFlowController(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
[
\dot m = \max(\dot m_0, 0.0),
] 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)
 
  Methods defined here:
__init__(self, upstream=None, downstream=None, name='', verbose=0, mdot=0.0)
upstream - upstream reactor or reservoir.
 
downstream - downstream reactor or reservoir.
 
name - name used to identify the mass flow controller in output.
If no name is specified, it defaults to 'MFC_n', where n is an
integer assigned in the order the MassFlowController object
was created.
 
mdot - Mass flow rate [kg/s]. This mass flow rate, which may
be a constant of a function of time, will be maintained,
independent of unstream and downstream conditions, unless
reset by calling method 'set'.
 
verbose - if set to a positive integer, additional diagnostic
information will be printed.
set(self, mdot=0.0)
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)

Methods inherited from FlowDevice:
__del__(self)
Delete the instance.
flowdev_id(self)
install(self, upstream, downstream)
Install the device between the upstream and downstream
reactors or reservoirs.  
>>> f.install(upstream = reactor1, downstream = reservoir2)
massFlowRate(self, time=-999.0)
Mass flow rate (kg/s).
name(self)
The name specified when initially constructed.
ready(self)
Deprecated. Returns true if the device is ready to use.
setFunction(self, f)

 
class PressureController(FlowDevice)
    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:
[
\dot m = \dot m_{ m master} + K_v(P_1 - P_2).
]
 
  Methods defined here:
__init__(self, upstream=None, downstream=None, name='', master=None, Kv=0.0, verbose=0)
upstream - upstream reactor or reservoir.
 
downstream - downstream reactor or reservoir.
 
name - name used to identify the pressure controller in
output.  If no name is specified, it defaults to
'PressureController_n', where n is an integer assigned in the
order the PressureController object was created.
 
Kv - the constant in the mass flow rate equation.
 
verbose - if set to a positive integer, additional diagnostic
information will be printed.
set(self, Kv=-1.0, master=None)
setMaster(self, master)
Set the master flow controller.
setPressureCoeff(self, Kv)
Set or reset the pressure coefficient  $ K_v  $.

Methods inherited from FlowDevice:
__del__(self)
Delete the instance.
flowdev_id(self)
install(self, upstream, downstream)
Install the device between the upstream and downstream
reactors or reservoirs.  
>>> f.install(upstream = reactor1, downstream = reservoir2)
massFlowRate(self, time=-999.0)
Mass flow rate (kg/s).
name(self)
The name specified when initially constructed.
ready(self)
Deprecated. Returns true if the device is ready to use.
setFunction(self, f)

 
class 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-intert
walls. These properties may all be changed by adding appropriate
components.
See classes 'Wall', 'MassFlowController', and 'Valve'.
 
  Methods defined here:
__init__(self, contents=None, name='', volume=1.0, energy='on', verbose=0)
contents - Reactor contents. If not specified, the reactor is
initially empty. In this case, call method 'insert' to specify
the contents.
 
name - Used only to identify this reactor in output. If not
specified, defaults to 'Reactor_n', where n is an integer
assigned in the order Reactor objects are created.
 
volume - Initial reactor volume. Defaults to 1 m^3.
 
energy - Set to 'on' or 'off'. If set to 'off', the energy
equation is not solved, and the temperature is held at its
initial value. The default in 'on'.
 
verbose - if set to a non-zero value, additional diagnostic
information will be printed.
 
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())]

Methods inherited from ReactorBase:
__del__(self)
Delete the reactor instance.
__repr__(self)
__str__(self)
addSensitivityReaction(self, reactions=[])
advance(self, time)
Deprecated.
Advance the state of the reactor in time from the current
time to time 'time'. Note: this method is deprecated. See
class ReactorNet.
contents(self)
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 class 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 method '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()
density(self)
The density of the fluid in the reactor [kg/m^3].
enthalpy_mass(self)
The specific enthalpy of the fluid in the reactor [J/kg].
inlets(self)
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()
See: MassFlowControllerValvePressureController.
insert(self, contents)
Insert 'contents' into the reactor. Sets the objects used to compute
thermodynamic properties and kinetic rates.
intEnergy_mass(self)
The specific internal energy of the fluid in the reactor [J/kg].
mass(self)
The total mass of fluid in the reactor [kg].
massFraction(self, s)
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
massFractions(self)
Return an array of the species mass fractions.
moleFraction(self, s)
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
moleFractions(self)
Return an array of the species mole fractions.
nSensParams(self)
Number of sensitivity parameters for this reactor.
name(self)
The name of the reactor.
outlets(self)
Return the list of flow devices installed on outlets
on this reactor.
>>> for o in r.outlets():
...    print o.name(), o.massFlowRate()
See: MassFlowControllerValvePressureController.
pressure(self)
The pressure in the reactor [Pa].
reactor_id(self)
The integer index used to access the kernel reactor
object. For internal use.
sensParamName(self, n=-1)
setInitialTime(self, T0)
Deprecated.
Set the initial time. Restarts integration from this time
using the current state as the initial condition. Default: 0.0 s
step(self, time)
Deprecated.
Take one internal time step from the current time toward
time 'time'. Note: this method is deprecated. See class
ReactorNet.
syncContents(self)
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'.
temperature(self)
The temperature in the reactor [K].
time(self)
Deprecated. The current time [s].
volume(self)
The total reactor volume [m^3]. The volume may change with time
if non-rigid walls are installed on the reactor.
walls(self)
Return the list of walls installed on this reactor.
>>> for w in r.walls():
...    print w.name()
See: Wall.

 
class ReactorBase
    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.)
 
  Methods defined here:
__del__(self)
Delete the reactor instance.
__init__(self, name='', contents=None, volume=1.0, energy='on', type=-1, verbose=0)
See class 'Reactor' for a description of the constructor parameters.
The 'type' parameter specifies whether a Reactor (type = 2) or
Reservoir (type = 1) will be created.
__repr__(self)
__str__(self)
addSensitivityReaction(self, reactions=[])
advance(self, time)
Deprecated.
Advance the state of the reactor in time from the current
time to time 'time'. Note: this method is deprecated. See
class ReactorNet.
contents(self)
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 class 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 method '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()
density(self)
The density of the fluid in the reactor [kg/m^3].
enthalpy_mass(self)
The specific enthalpy of the fluid in the reactor [J/kg].
inlets(self)
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()
See: MassFlowControllerValvePressureController.
insert(self, contents)
Insert 'contents' into the reactor. Sets the objects used to compute
thermodynamic properties and kinetic rates.
intEnergy_mass(self)
The specific internal energy of the fluid in the reactor [J/kg].
mass(self)
The total mass of fluid in the reactor [kg].
massFraction(self, s)
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
massFractions(self)
Return an array of the species mass fractions.
moleFraction(self, s)
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
moleFractions(self)
Return an array of the species mole fractions.
nSensParams(self)
Number of sensitivity parameters for this reactor.
name(self)
The name of the reactor.
outlets(self)
Return the list of flow devices installed on outlets
on this reactor.
>>> for o in r.outlets():
...    print o.name(), o.massFlowRate()
See: MassFlowControllerValvePressureController.
pressure(self)
The pressure in the reactor [Pa].
reactor_id(self)
The integer index used to access the kernel reactor
object. For internal use.
sensParamName(self, n=-1)
setInitialTime(self, T0)
Deprecated.
Set the initial time. Restarts integration from this time
using the current state as the initial condition. Default: 0.0 s
step(self, time)
Deprecated.
Take one internal time step from the current time toward
time 'time'. Note: this method is deprecated. See class
ReactorNet.
syncContents(self)
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'.
temperature(self)
The temperature in the reactor [K].
time(self)
Deprecated. The current time [s].
volume(self)
The total reactor volume [m^3]. The volume may change with time
if non-rigid walls are installed on the reactor.
walls(self)
Return the list of walls installed on this reactor.
>>> for w in r.walls():
...    print w.name()
See: Wall.

 
class ReactorNet
    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)
 
  Methods defined here:
__del__(self)
Delete the reactor network instance. The reactors in the
network are not deleted.
__init__(self, reactorlist=None)
Create a new ReactorNet instance. If a list of reactors is supplied,
these will be added to the network.
add(self, reactor)
Add a reactor to the network.
advance(self, time)
Advance the state of the reactor network in time from the current
time to time 'time'.
nSensParams(self)
Number of sensitivity parameters.
reactornet_id(self)
The integer index used to access the
kernel reactornet object. For internal use.
reactors(self)
Return the list of reactors in the network.
sensitivity(self, component='', parameter=-1, reactor='')
Sensitivity of solution component 'component' with respect
to one or more parameters.
 
component -- name of the species or other variable for which
sensitivity information is desired.
 
parameter -- single integer or sequence of integers specifying
the parameters. The parameters are numbered from zero,
beginning with the parameters for the first reactor and
continuing through those for the last reactor in the
network. If omitted, the sensitivity with respect to all
parameters will be returned.
 
reactor -- reactor containing the desired component.
setInitialTime(self, t0)
Set the initial time. Restarts integration from this time
using the current state as the initial condition. Default: 0.0 s
setTolerances(self, rtol=1.0000000000000001e-09, atol=9.9999999999999995e-21, rtolsens=-1.0, atolsens=-1.0)
Set the relative and absolute error tolerances used in
integrating the reactor equations.
step(self, time)
Take a single internal time step toward time 'time'.
The time after taking the step is returned.
time(self)
The current time [s].

 
class Reservoir(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.
 
  Methods defined here:
__init__(self, contents=None, name='', verbose=0)
contents - Reservoir contents. If not specified, the reservoir is
initially empty. In this case, call method insert to specify
the contents.
 
name - Used only to identify this reservoir in output. If not
specified, defaults to 'Reservoir_n', where n is an integer
assigned in the order Reservoir objects are created.
 
verbose - if set to a non-zero value, additional diagnostic
information will be printed.
 
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')
advance(self, time)
Deprecated. Do nothing.

Methods inherited from ReactorBase:
__del__(self)
Delete the reactor instance.
__repr__(self)
__str__(self)
addSensitivityReaction(self, reactions=[])
contents(self)
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 class 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 method '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()
density(self)
The density of the fluid in the reactor [kg/m^3].
enthalpy_mass(self)
The specific enthalpy of the fluid in the reactor [J/kg].
inlets(self)
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()
See: MassFlowControllerValvePressureController.
insert(self, contents)
Insert 'contents' into the reactor. Sets the objects used to compute
thermodynamic properties and kinetic rates.
intEnergy_mass(self)
The specific internal energy of the fluid in the reactor [J/kg].
mass(self)
The total mass of fluid in the reactor [kg].
massFraction(self, s)
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
massFractions(self)
Return an array of the species mass fractions.
moleFraction(self, s)
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
moleFractions(self)
Return an array of the species mole fractions.
nSensParams(self)
Number of sensitivity parameters for this reactor.
name(self)
The name of the reactor.
outlets(self)
Return the list of flow devices installed on outlets
on this reactor.
>>> for o in r.outlets():
...    print o.name(), o.massFlowRate()
See: MassFlowControllerValvePressureController.
pressure(self)
The pressure in the reactor [Pa].
reactor_id(self)
The integer index used to access the kernel reactor
object. For internal use.
sensParamName(self, n=-1)
setInitialTime(self, T0)
Deprecated.
Set the initial time. Restarts integration from this time
using the current state as the initial condition. Default: 0.0 s
step(self, time)
Deprecated.
Take one internal time step from the current time toward
time 'time'. Note: this method is deprecated. See class
ReactorNet.
syncContents(self)
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'.
temperature(self)
The temperature in the reactor [K].
time(self)
Deprecated. The current time [s].
volume(self)
The total reactor volume [m^3]. The volume may change with time
if non-rigid walls are installed on the reactor.
walls(self)
Return the list of walls installed on this reactor.
>>> for w in r.walls():
...    print w.name()
See: Wall.

 
class Valve(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:
[ \dot m = K_v (P_1 - P_2)  ]
if  $ P_1 > P_2.  $
Otherwise,
$ \dot m = 0  $.
However, an arbitrary function  $ F $ can also be specified, such that
[
\dot m = F(P_1 - P_2).
]
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.
 
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.
 
  Methods defined here:
__init__(self, upstream=None, downstream=None, name='', Kv=0.0, mdot0=0.0, verbose=0)
upstream - upstream reactor or reservoir.
 
downstream - downstream reactor or reservoir.
 
name - name used to identify the valve in output.
If no name is specified, it defaults to 'Valve_n', where n is an
integer assigned in the order the Valve object
was created.
 
Kv - the constant in the mass flow rate equation.
 
verbose - if set to a positive integer, additional diagnostic
information will be printed.
set(self, Kv=-1.0, F=None)
Set or reset valve properties. All keywords are optional.
 
Kv - constant in linear mass flow rate equation.
 
F - function of  $\Delta P $.
setValveCoeff(self, Kv=-1.0)
Set or reset the valve coefficient  $ K_v  $.

Methods inherited from FlowDevice:
__del__(self)
Delete the instance.
flowdev_id(self)
install(self, upstream, downstream)
Install the device between the upstream and downstream
reactors or reservoirs.  
>>> f.install(upstream = reactor1, downstream = reservoir2)
massFlowRate(self, time=-999.0)
Mass flow rate (kg/s).
name(self)
The name specified when initially constructed.
ready(self)
Deprecated. Returns true if the device is ready to use.
setFunction(self, f)

 
class Wall
    Reactor walls.
 
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
[
v = K(P_{\rm left} - P_{\rm right}) + v_0(t),
]
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
[
q = U(T_{\rm left} - T_{\rm right}) + \epsilon\sigma (T_{\rm left}^4
- T_{\rm right}^4) + q_0(t),
]
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.
 
  Methods defined here:
__del__(self)
Delete the Wall instance. This method is called
automatically when no Python object stores a reference to this
Wall. Since reactors and reserviors store references to all
Walls installed on them, this method will only be called after
the reactors/reservoirs have been deleted.
__init__(self, left, right, name='', A=1.0, K=0.0, U=0.0, Q=None, velocity=None, kinetics=[None, None])
Constructor arguments:
 
left - Reactor or reservoir on the left. Required.
 
right - Reactor or reservoir on the right. Required.
 
name - Name string.
If omitted, the name is 'Wall_n', where 'n' is an integer
assigned in the order walls are created.
 
A - Wall area [m^2]. Defaults to 1.0 m^2.
 
K - Wall expansion rate parameter [m/s/Pa]. Defaults to 0.0.
 
U - Overall heat transfer coefficient [W/m^2]. Defaults to 0.0
(adiabbatic wall).
 
Q - Heat flux function  $ q_0(t)  $ [W/m^2]. Optional. Default:
$ q_0(t) = 0.0  $.
 
velocity - Wall velocity function  $ v_0(t)  $ [m/s].
Default:  $ v_0(t) = 0.0  $.
 
kinetics - Surface reaction mechanisms for the left-facing and
right-facing surface, respectively. These must be instances of
class Kinetics, or of a class derived from Kinetics, such as
Interface. If chemistry occurs on only one side, enter 'None'
for the non-reactive side.
addSensitivityReaction(self, side='unknown', reactions=[])
area(self)
The wall area (m^2).
heatFlowRate(self)
Rate of heat flow through the wall. A positive value
corresponds to heat flowing from the left-hand reactor to the
right-hand one.
heatFlux(self)
install(self, left, right)
kinetics(self, side='left')
ready(self)
Return 1 if the wall instance is ready for use, 0 otherwise. Deprecated.
set(self, **p)
Set various wall parameters: 'A', 'U', 'K', 'Q'. 'velocity'.
These have the same meanings as in the constructor.
setArea(self, a)
Set the area (m^2). The wall area may be changed manually at any time during a simulation.
setEmissivity(self, epsilon)
Set the emissivity.
setExpansionRateCoeff(self, k)
Set the coefficient K that determines the expansion rate
resulting from a unit pressure drop.
setHeatFlux(self, qfunc)
Specify the time-dependent heat flux function [W/m2].
'qfunc' must be a functor (an instance of a subclass of Cantera.Func1).
See: Func1.
setHeatTransferCoeff(self, u)
Set the overall heat transfer coefficient [W/m^2/K]
setKinetics(self, left, right)
Specify surface reaction mechanisms for the left and right sides of the wall.
setThermalResistance(self, rth)
Deprecated.
setVelocity(self, vfunc)
Specify the velocity function [m/s]. 'vfunc' must
be a functor (an instance of a subclass of Cantera.Func1)
See: Func1.
vdot(self)
Rate of volume change [m^3]. A positive value corresponds
to the left-hand reactor volume increasing, and the right-hand
reactor volume decreasing.
velocity(self)

 
Functions
       
array(...)
array(object, dtype=None, copy=True, order=None, subok=False, ndmin=True)
 
Create an array.
 
Parameters
----------
object : array_like
    An array, any object exposing the array interface, an
    object whose __array__ method returns an array, or any
    (nested) sequence.
dtype : data-type, optional
    The desired data-type for the array.  If not given, then
    the type will be determined as the minimum type required
    to hold the objects in the sequence.  This argument can only
    be used to 'upcast' the array.  For downcasting, use the
    .astype(t) method.
copy : bool, optional
    If true (default), then the object is copied.  Otherwise, a copy
    will only be made if __array__ returns a copy, if obj is a
    nested sequence, or if a copy is needed to satisfy any of the other
    requirements (`dtype`, `order`, etc.).
order : {'C', 'F', 'A'}, optional
    Specify the order of the array.  If order is 'C' (default), then the
    array will be in C-contiguous order (last-index varies the
    fastest).  If order is 'F', then the returned array
    will be in Fortran-contiguous order (first-index varies the
    fastest).  If order is 'A', then the returned array may
    be in any order (either C-, Fortran-contiguous, or even
    discontiguous).
subok : bool, optional
    If True, then sub-classes will be passed-through, otherwise
    the returned array will be forced to be a base-class array (default).
ndmin : int, optional
    Specifies the minimum number of dimensions that the resulting
    array should have.  Ones will be pre-pended to the shape as
    needed to meet this requirement.
 
Examples
--------
>>> np.array([1, 2, 3])
array([1, 2, 3])
 
Upcasting:
 
>>> np.array([1, 2, 3.0])
array([ 1.,  2.,  3.])
 
More than one dimension:
 
>>> np.array([[1, 2], [3, 4]])
array([[1, 2],
       [3, 4]])
 
Minimum dimensions 2:
 
>>> np.array([1, 2, 3], ndmin=2)
array([[1, 2, 3]])
 
Type provided:
 
>>> np.array([1, 2, 3], dtype=complex)
array([ 1.+0.j,  2.+0.j,  3.+0.j])
 
Data-type consisting of more than one element:
 
>>> x = np.array([(1,2),(3,4)],dtype=[('a','<i4'),('b','<i4')])
>>> x['a']
array([1, 3])
 
Creating an array from sub-classes:
 
>>> np.array(np.mat('1 2; 3 4'))
array([[1, 2],
       [3, 4]])
 
>>> np.array(np.mat('1 2; 3 4'), subok=True)
matrix([[1, 2],
        [3, 4]])
zeros(...)
zeros(shape, dtype=float, order='C')
 
Return a new array of given shape and type, filled with zeros.
 
Parameters
----------
shape : {tuple of ints, int}
    Shape of the new array, e.g., ``(2, 3)`` or ``2``.
dtype : data-type, optional
    The desired data-type for the array, e.g., `numpy.int8`.  Default is
    `numpy.float64`.
order : {'C', 'F'}, optional
    Whether to store multidimensional data in C- or Fortran-contiguous
    (row- or column-wise) order in memory.
 
Returns
-------
out : ndarray
    Array of zeros with the given shape, dtype, and order.
 
See Also
--------
numpy.zeros_like : Return an array of zeros with shape and type of input.
numpy.ones_like : Return an array of ones with shape and type of input.
numpy.empty_like : Return an empty array with shape and type of input.
numpy.ones : Return a new array setting values to one.
numpy.empty : Return a new uninitialized array.
 
Examples
--------
>>> np.zeros(5)
array([ 0.,  0.,  0.,  0.,  0.])
 
>>> np.zeros((5,), dtype=numpy.int)
array([0, 0, 0, 0, 0])
 
>>> np.zeros((2, 1))
array([[ 0.],
       [ 0.]])
 
>>> s = (2,2)
>>> np.zeros(s)
array([[ 0.,  0.],
       [ 0.,  0.]])
 
>>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')])
array([(0, 0), (0, 0)],
      dtype=[('x', '<i4'), ('y', '<i4')])