[Python] Add support for IdealGasReactor and IdealGasConstPressureReactor
This commit is contained in:
parent
9b6354b0c0
commit
03786fd07b
2 changed files with 36 additions and 12 deletions
|
|
@ -369,6 +369,23 @@ class Reactor(ReactorBase):
|
|||
verbose = verbose, type = 2)
|
||||
|
||||
|
||||
class IdealGasReactor(ReactorBase):
|
||||
"""
|
||||
Similar to :class:`.Reactor`, but with a set of governing equations
|
||||
optimized specifically for ideal gas mixtures.
|
||||
"""
|
||||
def __init__(self, contents = None, name = '',
|
||||
volume = 1.0, energy = 'on',
|
||||
verbose = 0):
|
||||
global _reactorcount
|
||||
if name == '':
|
||||
name = 'IdealGasReactor_'+`_reactorcount`
|
||||
_reactorcount += 1
|
||||
ReactorBase.__init__(self, contents = contents, name = name,
|
||||
volume = volume, energy = energy,
|
||||
verbose = verbose, type = 5)
|
||||
|
||||
|
||||
class FlowReactor(ReactorBase):
|
||||
def __init__(self, contents = None, name = '',
|
||||
volume = 1.0, energy = 'on',
|
||||
|
|
@ -438,6 +455,23 @@ class ConstPressureReactor(ReactorBase):
|
|||
verbose = verbose, type = 4)
|
||||
|
||||
|
||||
class IdealGasConstPressureReactor(ReactorBase):
|
||||
"""
|
||||
Similar to :class:`.ConstPressureReactor`, but with a set of governing
|
||||
equations optimized specifically for ideal gas mixtures.
|
||||
"""
|
||||
def __init__(self, contents = None, name = '',
|
||||
volume = 1.0, energy = 'on',
|
||||
verbose = 0):
|
||||
global _reactorcount
|
||||
if name == '':
|
||||
name = 'IdealGasConstPRessureReactor_'+`_reactorcount`
|
||||
_reactorcount += 1
|
||||
ReactorBase.__init__(self, contents = contents, name = name,
|
||||
volume = volume, energy = energy,
|
||||
verbose = verbose, type = 6)
|
||||
|
||||
|
||||
class Reservoir(ReactorBase):
|
||||
"""
|
||||
A reservoir is a reactor with a constant state. The temperature,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "cantera/zeroD/ConstPressureReactor.h"
|
||||
#include "cantera/zeroD/ReactorNet.h"
|
||||
#include "cantera/zeroD/Reservoir.h"
|
||||
#include "cantera/zeroD/ReactorFactory.h"
|
||||
#include "cantera/zeroD/Wall.h"
|
||||
#include "cantera/zeroD/flowControllers.h"
|
||||
#include "Cabinet.h"
|
||||
|
|
@ -37,18 +38,7 @@ extern "C" {
|
|||
int reactor_new(int type)
|
||||
{
|
||||
try {
|
||||
ReactorBase* r=0;
|
||||
if (type == ReactorType) {
|
||||
r = new Reactor();
|
||||
} else if (type == FlowReactorType) {
|
||||
r = new FlowReactor();
|
||||
} else if (type == ConstPressureReactorType) {
|
||||
r = new ConstPressureReactor();
|
||||
} else if (type == ReservoirType) {
|
||||
r = new Reservoir();
|
||||
} else {
|
||||
r = new ReactorBase();
|
||||
}
|
||||
ReactorBase* r = ReactorFactory::factory()->newReactor(type);
|
||||
return ReactorCabinet::add(r);
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue