*** empty log message ***
This commit is contained in:
parent
cfb576c774
commit
cbb2eb6beb
17 changed files with 79 additions and 53 deletions
|
|
@ -1,12 +1,24 @@
|
||||||
function setEnergy(f, flag)
|
function setEnergy(f, flag)
|
||||||
% SETENERGY -
|
% SETENERGY - enable or disable solving the energy equation. If the
|
||||||
|
% energy equation is disabled, then the reactor temperature is
|
||||||
|
% constant. The parameter should be the string 'on' to enable the
|
||||||
|
% energy equation, or 'off' to disable it.
|
||||||
%
|
%
|
||||||
iflag = 0
|
% By default, Reactor objects are created with the energy equation
|
||||||
try
|
% enabled, so usually this method is only needed to disable the
|
||||||
if strcmp(flag,{'on'})
|
% energy equation for isothermal simulations.
|
||||||
iflag = 1
|
%
|
||||||
end
|
% >>> setEnergy(r, 'on');
|
||||||
catch
|
% >>> setEnergy(r, 'off');
|
||||||
iflag = 0
|
%
|
||||||
|
iflag = -1
|
||||||
|
if strcmp(flag,{'on'})
|
||||||
|
iflag = 1;
|
||||||
|
elseif strcmp(flag,{'off'})
|
||||||
|
iflag = 0;
|
||||||
|
end
|
||||||
|
if iflag >= 0
|
||||||
|
reactormethods(9, f.index, iflag)
|
||||||
|
else
|
||||||
|
error('input to setEnergy not understood');
|
||||||
end
|
end
|
||||||
reactormethods(9, f.index, iflag)
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
function setInitialTime(r, t0)
|
function setInitialTime(r, t0)
|
||||||
% SETINITIALTIME -
|
% SETINITIALTIME - set the initial time. Deprecated.
|
||||||
%
|
%
|
||||||
reactormethods(5, reactor_hndl(r), t0);
|
reactormethods(5, reactor_hndl(r), t0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
function setKineticsMgr(r, k)
|
function setKineticsMgr(r, k)
|
||||||
% SETKINETICSMGR - set the kinetics manager
|
% SETKINETICSMGR - set the kinetics manager. This method is used
|
||||||
|
% internally during Reactor initialization, but is usually not
|
||||||
|
% called by users.
|
||||||
%
|
%
|
||||||
if ~isa(k,'Kinetics')
|
if ~isa(k,'Kinetics')
|
||||||
error('wrong object type');
|
error('wrong object type');
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
function reactor1(g)
|
function reactor1(g)
|
||||||
% REACTOR1 Zero-dimensional kinetics: adiabatic, constant pressure.
|
% REACTOR1 Zero-dimensional kinetics: adiabatic, constant pressure.
|
||||||
%
|
%
|
||||||
|
% >>>> For a simpler way to carry out a constant-pressure simulation,
|
||||||
|
% see example reactor3.m <<<<<
|
||||||
|
%
|
||||||
% This example illustrates how to use class 'Reactor' for
|
% This example illustrates how to use class 'Reactor' for
|
||||||
% zero-dimensional kinetics simulations. Here the parameters are
|
% zero-dimensional kinetics simulations. Here the parameters are
|
||||||
% set so that the reactor is adiabatic and very close to constant
|
% set so that the reactor is adiabatic and very close to constant
|
||||||
|
|
|
||||||
|
|
@ -422,7 +422,6 @@ class ConstPressureReactor(ReactorBase):
|
||||||
"""
|
"""
|
||||||
def __init__(self, contents = None, name = '',
|
def __init__(self, contents = None, name = '',
|
||||||
volume = 1.0, energy = 'on',
|
volume = 1.0, energy = 'on',
|
||||||
mdot = -1.0,
|
|
||||||
verbose = 0):
|
verbose = 0):
|
||||||
"""
|
"""
|
||||||
contents - Reactor contents. If not specified, the reactor is
|
contents - Reactor contents. If not specified, the reactor is
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,22 @@
|
||||||
#
|
"""
|
||||||
# Gas 1: a stoichiometric H2/O2/Ar mixture
|
Gas 1: a stoichiometric H2/O2/Ar mixture
|
||||||
# Gas 2: a wet CO/O2 mixture
|
Gas 2: a wet CO/O2 mixture
|
||||||
#
|
|
||||||
# -------------------------------------
|
-------------------------------------
|
||||||
# | || |
|
| || |
|
||||||
# | || |
|
| || |
|
||||||
# | gas 1 || gas 2 |
|
| gas 1 || gas 2 |
|
||||||
# | || |
|
| || |
|
||||||
# | || |
|
| || |
|
||||||
# -------------------------------------
|
-------------------------------------
|
||||||
#
|
|
||||||
# The two volumes are connected by an adiabatic free piston.
|
The two volumes are connected by an adiabatic free piston.
|
||||||
# The piston speed is proportional to the pressure difference
|
The piston speed is proportional to the pressure difference
|
||||||
# between the two chambers.
|
between the two chambers.
|
||||||
#
|
|
||||||
# Note that each side uses a *different* reaction mechanism
|
Note that each side uses a *different* reaction mechanism
|
||||||
#
|
|
||||||
|
"""
|
||||||
from Cantera import *
|
from Cantera import *
|
||||||
from Cantera.Reactor import *
|
from Cantera.Reactor import *
|
||||||
import sys
|
import sys
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,11 @@ namespace Cantera {
|
||||||
|
|
||||||
class Py_Logger : public Logger {
|
class Py_Logger : public Logger {
|
||||||
public:
|
public:
|
||||||
Py_Logger() {}
|
Py_Logger() { cout << "created Py_Logger" << endl;}
|
||||||
virtual ~Py_Logger() {}
|
virtual ~Py_Logger() {}
|
||||||
|
|
||||||
virtual void write(const string& s) {
|
virtual void write(const string& s) {
|
||||||
|
cout << "write..." << endl;
|
||||||
char ch = s[0];
|
char ch = s[0];
|
||||||
int n = 0;
|
int n = 0;
|
||||||
while (ch != '\0') {
|
while (ch != '\0') {
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@
|
||||||
#include "stringUtils.h"
|
#include "stringUtils.h"
|
||||||
#include "State.h"
|
#include "State.h"
|
||||||
|
|
||||||
#ifdef DARWIN
|
//#ifdef DARWIN
|
||||||
#include <Accelerate.h>
|
//#include <Accelerate.h>
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
namespace Cantera {
|
namespace Cantera {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@ namespace CanteraZeroD {
|
||||||
|
|
||||||
// The components of y are the total enthalpy,
|
// The components of y are the total enthalpy,
|
||||||
// the total volume, and the mass of each species.
|
// the total volume, and the mass of each species.
|
||||||
|
|
||||||
doublereal h = y[0];
|
doublereal h = y[0];
|
||||||
doublereal* mss = y + 2;
|
doublereal* mss = y + 2;
|
||||||
doublereal mass = accumulate(y+2, y+2+m_nsp, 0.0);
|
doublereal mass = accumulate(y+2, y+2+m_nsp, 0.0);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ namespace CanteraZeroD {
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
virtual int neq() { return m_nv; }
|
//virtual int neq() { return m_nv; }
|
||||||
|
|
||||||
virtual void getInitialConditions(doublereal t0, size_t leny,
|
virtual void getInitialConditions(doublereal t0, size_t leny,
|
||||||
doublereal* y);
|
doublereal* y);
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,11 @@ do_ranlib = @DO_RANLIB@
|
||||||
CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT)
|
CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT)
|
||||||
|
|
||||||
# stirred reactors
|
# stirred reactors
|
||||||
OBJS = Reactor.o ReactorBase.o FlowDevice.o Wall.o ReactorNet.o FlowReactor.o
|
OBJS = Reactor.o ReactorBase.o FlowDevice.o Wall.o ReactorNet.o \
|
||||||
|
FlowReactor.o ConstPressureReactor.o ReactorFactory.o
|
||||||
ZEROD_H = Reactor.h ReactorBase.h FlowDevice.h Wall.h ReactorNet.h \
|
ZEROD_H = Reactor.h ReactorBase.h FlowDevice.h Wall.h ReactorNet.h \
|
||||||
flowControllers.h PID_Controller.h Reservoir.h FlowReactor.h
|
flowControllers.h PID_Controller.h Reservoir.h FlowReactor.h \
|
||||||
|
ConstPressureReactor.h ReactorFactory.h
|
||||||
|
|
||||||
CXX_INCLUDES = -I..
|
CXX_INCLUDES = -I..
|
||||||
ZEROD_LIB = @buildlib@/libzeroD.a
|
ZEROD_LIB = @buildlib@/libzeroD.a
|
||||||
|
|
|
||||||
11
configure
vendored
11
configure
vendored
|
|
@ -1367,7 +1367,7 @@ mex_ext=mexglx
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
Darwin*) OS_IS_DARWIN=1;
|
Darwin*) OS_IS_DARWIN=1;
|
||||||
EXTRA_LINK="-framework Accelerate $EXTRA_LINK";
|
EXTRA_LINK="-framework Accelerate $EXTRA_LINK";
|
||||||
CXX_INCLUDES="$CXX_INCLUDES -I/System/Library/Frameworks/Accelerate.framework/Headers"
|
# CXX_INCLUDES="$CXX_INCLUDES -I/System/Library/Frameworks/Accelerate.framework/Headers"
|
||||||
mex_ext=mexmac;;
|
mex_ext=mexmac;;
|
||||||
CYGWIN*) OS_IS_CYGWIN=1; mex_ext=dll;;
|
CYGWIN*) OS_IS_CYGWIN=1; mex_ext=dll;;
|
||||||
Linux* ) case $BITHARDWARE in
|
Linux* ) case $BITHARDWARE in
|
||||||
|
|
@ -2618,7 +2618,8 @@ _ACEOF
|
||||||
|
|
||||||
echo "using CVODES from SUNDIALS... Sensitivity analysis enabled."
|
echo "using CVODES from SUNDIALS... Sensitivity analysis enabled."
|
||||||
CVODE_LIBS='-lsundials_cvodes -lsundials_shared -lsundials_nvecserial'
|
CVODE_LIBS='-lsundials_cvodes -lsundials_shared -lsundials_nvecserial'
|
||||||
sundials_include='-I'${SUNDIALS_HOME}/include
|
sundials_include='-I'${SUNDIALS_HOME}'/include -I'${SUNDIALS_HOME}'/include/sundials -I'${SUNDIALS_HOME}'/include/cvodes'
|
||||||
|
echo "sundials include directory: " ${sundials_include}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test ${use_sundials} = 0; then
|
if test ${use_sundials} = 0; then
|
||||||
|
|
@ -7765,7 +7766,7 @@ fi
|
||||||
|
|
||||||
|
|
||||||
# Provide some information about the compiler.
|
# Provide some information about the compiler.
|
||||||
echo "$as_me:7768:" \
|
echo "$as_me:7769:" \
|
||||||
"checking for Fortran 77 compiler version" >&5
|
"checking for Fortran 77 compiler version" >&5
|
||||||
ac_compiler=`set X $ac_compile; echo $2`
|
ac_compiler=`set X $ac_compile; echo $2`
|
||||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
||||||
|
|
@ -7942,7 +7943,7 @@ _ACEOF
|
||||||
# flags.
|
# flags.
|
||||||
ac_save_FFLAGS=$FFLAGS
|
ac_save_FFLAGS=$FFLAGS
|
||||||
FFLAGS="$FFLAGS $ac_verb"
|
FFLAGS="$FFLAGS $ac_verb"
|
||||||
(eval echo $as_me:7945: \"$ac_link\") >&5
|
(eval echo $as_me:7946: \"$ac_link\") >&5
|
||||||
ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
|
ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
|
||||||
echo "$ac_f77_v_output" >&5
|
echo "$ac_f77_v_output" >&5
|
||||||
FFLAGS=$ac_save_FFLAGS
|
FFLAGS=$ac_save_FFLAGS
|
||||||
|
|
@ -8022,7 +8023,7 @@ _ACEOF
|
||||||
# flags.
|
# flags.
|
||||||
ac_save_FFLAGS=$FFLAGS
|
ac_save_FFLAGS=$FFLAGS
|
||||||
FFLAGS="$FFLAGS $ac_cv_prog_f77_v"
|
FFLAGS="$FFLAGS $ac_cv_prog_f77_v"
|
||||||
(eval echo $as_me:8025: \"$ac_link\") >&5
|
(eval echo $as_me:8026: \"$ac_link\") >&5
|
||||||
ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
|
ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
|
||||||
echo "$ac_f77_v_output" >&5
|
echo "$ac_f77_v_output" >&5
|
||||||
FFLAGS=$ac_save_FFLAGS
|
FFLAGS=$ac_save_FFLAGS
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ mex_ext=mexglx
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
Darwin*) OS_IS_DARWIN=1;
|
Darwin*) OS_IS_DARWIN=1;
|
||||||
EXTRA_LINK="-framework Accelerate $EXTRA_LINK";
|
EXTRA_LINK="-framework Accelerate $EXTRA_LINK";
|
||||||
CXX_INCLUDES="$CXX_INCLUDES -I/System/Library/Frameworks/Accelerate.framework/Headers"
|
# CXX_INCLUDES="$CXX_INCLUDES -I/System/Library/Frameworks/Accelerate.framework/Headers"
|
||||||
mex_ext=mexmac;;
|
mex_ext=mexmac;;
|
||||||
CYGWIN*) OS_IS_CYGWIN=1; mex_ext=dll;;
|
CYGWIN*) OS_IS_CYGWIN=1; mex_ext=dll;;
|
||||||
Linux* ) case $BITHARDWARE in
|
Linux* ) case $BITHARDWARE in
|
||||||
|
|
@ -302,7 +302,8 @@ if test ${use_sundials} = 1; then
|
||||||
AC_DEFINE(HAS_SUNDIALS)
|
AC_DEFINE(HAS_SUNDIALS)
|
||||||
echo "using CVODES from SUNDIALS... Sensitivity analysis enabled."
|
echo "using CVODES from SUNDIALS... Sensitivity analysis enabled."
|
||||||
CVODE_LIBS='-lsundials_cvodes -lsundials_shared -lsundials_nvecserial'
|
CVODE_LIBS='-lsundials_cvodes -lsundials_shared -lsundials_nvecserial'
|
||||||
sundials_include='-I'${SUNDIALS_HOME}/include
|
sundials_include='-I'${SUNDIALS_HOME}'/include -I'${SUNDIALS_HOME}'/include/sundials -I'${SUNDIALS_HOME}'/include/cvodes'
|
||||||
|
echo "sundials include directory: " ${sundials_include}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test ${use_sundials} = 0; then
|
if test ${use_sundials} = 0; then
|
||||||
|
|
@ -394,11 +395,14 @@ if test "$ENABLE_EQUIL" = "y" ; then
|
||||||
# NEED_RECIPES=1
|
# NEED_RECIPES=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
WITH_REACTORS=0
|
||||||
if test "$ENABLE_REACTORS" = "y" ; then
|
if test "$ENABLE_REACTORS" = "y" ; then
|
||||||
KERNEL=$KERNEL' 'reactor
|
KERNEL=$KERNEL' 'reactor
|
||||||
NEED_CVODE=1
|
NEED_CVODE=1
|
||||||
NEED_ZEROD=1
|
NEED_ZEROD=1
|
||||||
|
WITH_REACTORS=1
|
||||||
fi
|
fi
|
||||||
|
AC_SUBST(WITH_REACTORS)
|
||||||
|
|
||||||
if test "$ENABLE_SOLVERS" = "y" ; then
|
if test "$ENABLE_SOLVERS" = "y" ; then
|
||||||
KERNEL=$KERNEL' 'solvers
|
KERNEL=$KERNEL' 'solvers
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ PROG_NAME = cxx_examples
|
||||||
# the object files to be linked together. List those generated from Fortran
|
# the object files to be linked together. List those generated from Fortran
|
||||||
# and from C/C++ separately
|
# and from C/C++ separately
|
||||||
OBJS = examples.o kinetics_example1.o kinetics_example2.o \
|
OBJS = examples.o kinetics_example1.o kinetics_example2.o \
|
||||||
|
kinetics_example3.o \
|
||||||
equil_example1.o \
|
equil_example1.o \
|
||||||
transport_example1.o transport_example2.o \
|
transport_example1.o transport_example2.o \
|
||||||
rxnpath_example1.o
|
rxnpath_example1.o
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,11 @@
|
||||||
#pragma warning(disable:4503)
|
#pragma warning(disable:4503)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NUM_EXAMPLES 5
|
#define NUM_EXAMPLES 6
|
||||||
|
|
||||||
int kinetics_example1(int job);
|
int kinetics_example1(int job);
|
||||||
int kinetics_example2(int job);
|
int kinetics_example2(int job);
|
||||||
|
int kinetics_example3(int job);
|
||||||
int transport_example1(int job);
|
int transport_example1(int job);
|
||||||
int transport_example2(int job);
|
int transport_example2(int job);
|
||||||
int equil_example1(int job);
|
int equil_example1(int job);
|
||||||
|
|
@ -26,7 +27,7 @@ int run_example(int n, exfun f, int job = 2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// array of example functions
|
// array of example functions
|
||||||
exfun fex[] = {kinetics_example1, kinetics_example2,
|
exfun fex[] = {kinetics_example1, kinetics_example2, kinetics_example3,
|
||||||
equil_example1,
|
equil_example1,
|
||||||
transport_example1, transport_example2, rxnpath_example1};
|
transport_example1, transport_example2, rxnpath_example1};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ CANTERA_CONFIG_PREFIX=${CANTERA_CONFIG_PREFIX:=""}
|
||||||
# default try to do a full installation, but fall back to a minimal
|
# default try to do a full installation, but fall back to a minimal
|
||||||
# one in case of errors
|
# one in case of errors
|
||||||
|
|
||||||
PYTHON_PACKAGE=${PYTHON_PACKAGE:="none"}
|
PYTHON_PACKAGE=${PYTHON_PACKAGE:="default"}
|
||||||
|
|
||||||
# Cantera needs to know where to find the Python interpreter. If
|
# Cantera needs to know where to find the Python interpreter. If
|
||||||
# PYTHON_CMD is set to "default", then the configuration process will
|
# PYTHON_CMD is set to "default", then the configuration process will
|
||||||
|
|
@ -142,7 +142,7 @@ F90=${F90:="default"}
|
||||||
# these compilers will be added automatically, and you do not need to
|
# these compilers will be added automatically, and you do not need to
|
||||||
# specify them here. Otherwise, add any required compiler-specific
|
# specify them here. Otherwise, add any required compiler-specific
|
||||||
# flags here.
|
# flags here.
|
||||||
F90FLAGS=${F90FLAGS:='-O0'}
|
F90FLAGS=${F90FLAGS:='-O3'}
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Customizations / Extensions
|
# Customizations / Extensions
|
||||||
|
|
@ -244,7 +244,7 @@ ENABLE_TPX='y'
|
||||||
# See: http://www.llnl.gov/CASC/sundials
|
# See: http://www.llnl.gov/CASC/sundials
|
||||||
#
|
#
|
||||||
USE_SUNDIALS=${USE_SUNDIALS:='y'}
|
USE_SUNDIALS=${USE_SUNDIALS:='y'}
|
||||||
SUNDIALS_HOME=${SUNDIALS_HOME:='/usr/local/sundials'}
|
SUNDIALS_HOME=${SUNDIALS_HOME:=/usr/local/sundials}
|
||||||
|
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# BLAS and LAPACK
|
# BLAS and LAPACK
|
||||||
|
|
@ -292,7 +292,7 @@ CXX=${CXX:=g++}
|
||||||
CC=${CC:=gcc}
|
CC=${CC:=gcc}
|
||||||
|
|
||||||
# C++ compiler flags
|
# C++ compiler flags
|
||||||
CXXFLAGS=${CXXFLAGS:="-O0 -Wall"}
|
CXXFLAGS=${CXXFLAGS:="-O3 -Wall"}
|
||||||
|
|
||||||
# the C++ flags required for linking. Uncomment if additional flags
|
# the C++ flags required for linking. Uncomment if additional flags
|
||||||
# need to be passed to the linker.
|
# need to be passed to the linker.
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ if ctpath <> "-":
|
||||||
Python package """+ctpath
|
Python package """+ctpath
|
||||||
if warn <> '':
|
if warn <> '':
|
||||||
print warn
|
print warn
|
||||||
else if build_python == 2:
|
elif build_python == 2:
|
||||||
print """
|
print """
|
||||||
######################################################################
|
######################################################################
|
||||||
Warning: the Cantera Python package is not installed. If you
|
Warning: the Cantera Python package is not installed. If you
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue