From cbb2eb6bebf9dce4db5cf8e5895c89d997f733ee Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Mon, 8 May 2006 15:43:20 +0000 Subject: [PATCH] *** empty log message *** --- Cantera/matlab/cantera/@Reactor/setEnergy.m | 30 ++++++++++----- .../matlab/cantera/@Reactor/setInitialTime.m | 2 +- .../matlab/cantera/@Reactor/setKineticsMgr.m | 4 +- Cantera/matlab/cantera/examples/reactor1.m | 5 ++- Cantera/python/Cantera/Reactor.py | 1 - Cantera/python/examples/reactors/piston.py | 37 ++++++++++--------- Cantera/python/src/writelog.cpp | 3 +- Cantera/src/State.cpp | 6 +-- Cantera/src/zeroD/ConstPressureReactor.cpp | 1 - Cantera/src/zeroD/ConstPressureReactor.h | 2 +- Cantera/src/zeroD/Makefile.in | 6 ++- configure | 11 +++--- configure.in | 8 +++- examples/cxx/Makefile.in | 1 + examples/cxx/examples.cpp | 5 ++- preconfig | 8 ++-- tools/src/finish_install.py.in | 2 +- 17 files changed, 79 insertions(+), 53 deletions(-) diff --git a/Cantera/matlab/cantera/@Reactor/setEnergy.m b/Cantera/matlab/cantera/@Reactor/setEnergy.m index 9f29568a3..d8714e479 100644 --- a/Cantera/matlab/cantera/@Reactor/setEnergy.m +++ b/Cantera/matlab/cantera/@Reactor/setEnergy.m @@ -1,12 +1,24 @@ 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. +% +% By default, Reactor objects are created with the energy equation +% enabled, so usually this method is only needed to disable the +% energy equation for isothermal simulations. +% +% >>> setEnergy(r, 'on'); +% >>> setEnergy(r, 'off'); % -iflag = 0 -try - if strcmp(flag,{'on'}) - iflag = 1 - end -catch - 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 -reactormethods(9, f.index, iflag) diff --git a/Cantera/matlab/cantera/@Reactor/setInitialTime.m b/Cantera/matlab/cantera/@Reactor/setInitialTime.m index abe5a7b82..7ff0c934e 100644 --- a/Cantera/matlab/cantera/@Reactor/setInitialTime.m +++ b/Cantera/matlab/cantera/@Reactor/setInitialTime.m @@ -1,5 +1,5 @@ function setInitialTime(r, t0) -% SETINITIALTIME - +% SETINITIALTIME - set the initial time. Deprecated. % reactormethods(5, reactor_hndl(r), t0); diff --git a/Cantera/matlab/cantera/@Reactor/setKineticsMgr.m b/Cantera/matlab/cantera/@Reactor/setKineticsMgr.m index 32e72bac1..15c85ff63 100644 --- a/Cantera/matlab/cantera/@Reactor/setKineticsMgr.m +++ b/Cantera/matlab/cantera/@Reactor/setKineticsMgr.m @@ -1,5 +1,7 @@ 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') error('wrong object type'); diff --git a/Cantera/matlab/cantera/examples/reactor1.m b/Cantera/matlab/cantera/examples/reactor1.m index 2d583a091..9a9e989a1 100644 --- a/Cantera/matlab/cantera/examples/reactor1.m +++ b/Cantera/matlab/cantera/examples/reactor1.m @@ -1,6 +1,9 @@ function reactor1(g) % 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 % zero-dimensional kinetics simulations. Here the parameters are % set so that the reactor is adiabatic and very close to constant diff --git a/Cantera/python/Cantera/Reactor.py b/Cantera/python/Cantera/Reactor.py index 8317e3038..50bc4b11c 100644 --- a/Cantera/python/Cantera/Reactor.py +++ b/Cantera/python/Cantera/Reactor.py @@ -422,7 +422,6 @@ class ConstPressureReactor(ReactorBase): """ def __init__(self, contents = None, name = '', volume = 1.0, energy = 'on', - mdot = -1.0, verbose = 0): """ contents - Reactor contents. If not specified, the reactor is diff --git a/Cantera/python/examples/reactors/piston.py b/Cantera/python/examples/reactors/piston.py index de3343e1b..1430e5e5f 100644 --- a/Cantera/python/examples/reactors/piston.py +++ b/Cantera/python/examples/reactors/piston.py @@ -1,21 +1,22 @@ -# -# Gas 1: a stoichiometric H2/O2/Ar mixture -# Gas 2: a wet CO/O2 mixture -# -# ------------------------------------- -# | || | -# | || | -# | gas 1 || gas 2 | -# | || | -# | || | -# ------------------------------------- -# -# The two volumes are connected by an adiabatic free piston. -# The piston speed is proportional to the pressure difference -# between the two chambers. -# -# Note that each side uses a *different* reaction mechanism -# +""" + Gas 1: a stoichiometric H2/O2/Ar mixture + Gas 2: a wet CO/O2 mixture + + ------------------------------------- + | || | + | || | + | gas 1 || gas 2 | + | || | + | || | + ------------------------------------- + + The two volumes are connected by an adiabatic free piston. + The piston speed is proportional to the pressure difference + between the two chambers. + + Note that each side uses a *different* reaction mechanism + +""" from Cantera import * from Cantera.Reactor import * import sys diff --git a/Cantera/python/src/writelog.cpp b/Cantera/python/src/writelog.cpp index 5b9f648be..745d7d973 100644 --- a/Cantera/python/src/writelog.cpp +++ b/Cantera/python/src/writelog.cpp @@ -10,10 +10,11 @@ namespace Cantera { class Py_Logger : public Logger { public: - Py_Logger() {} + Py_Logger() { cout << "created Py_Logger" << endl;} virtual ~Py_Logger() {} virtual void write(const string& s) { + cout << "write..." << endl; char ch = s[0]; int n = 0; while (ch != '\0') { diff --git a/Cantera/src/State.cpp b/Cantera/src/State.cpp index 06d952650..4218ae735 100644 --- a/Cantera/src/State.cpp +++ b/Cantera/src/State.cpp @@ -20,9 +20,9 @@ #include "stringUtils.h" #include "State.h" -#ifdef DARWIN -#include -#endif +//#ifdef DARWIN +//#include +//#endif namespace Cantera { diff --git a/Cantera/src/zeroD/ConstPressureReactor.cpp b/Cantera/src/zeroD/ConstPressureReactor.cpp index 077bed44e..439369269 100644 --- a/Cantera/src/zeroD/ConstPressureReactor.cpp +++ b/Cantera/src/zeroD/ConstPressureReactor.cpp @@ -96,7 +96,6 @@ namespace CanteraZeroD { // The components of y are the total enthalpy, // the total volume, and the mass of each species. - doublereal h = y[0]; doublereal* mss = y + 2; doublereal mass = accumulate(y+2, y+2+m_nsp, 0.0); diff --git a/Cantera/src/zeroD/ConstPressureReactor.h b/Cantera/src/zeroD/ConstPressureReactor.h index 74624bf47..ed46e54a9 100644 --- a/Cantera/src/zeroD/ConstPressureReactor.h +++ b/Cantera/src/zeroD/ConstPressureReactor.h @@ -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, doublereal* y); diff --git a/Cantera/src/zeroD/Makefile.in b/Cantera/src/zeroD/Makefile.in index d7be4a4e4..c0d7322b4 100644 --- a/Cantera/src/zeroD/Makefile.in +++ b/Cantera/src/zeroD/Makefile.in @@ -18,9 +18,11 @@ do_ranlib = @DO_RANLIB@ CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT) # 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 \ - 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.. ZEROD_LIB = @buildlib@/libzeroD.a diff --git a/configure b/configure index fceee77d6..c355e88d9 100755 --- a/configure +++ b/configure @@ -1367,7 +1367,7 @@ mex_ext=mexglx case $ac_sys_system in Darwin*) OS_IS_DARWIN=1; 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;; CYGWIN*) OS_IS_CYGWIN=1; mex_ext=dll;; Linux* ) case $BITHARDWARE in @@ -2618,7 +2618,8 @@ _ACEOF echo "using CVODES from SUNDIALS... Sensitivity analysis enabled." 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 if test ${use_sundials} = 0; then @@ -7765,7 +7766,7 @@ fi # Provide some information about the compiler. -echo "$as_me:7768:" \ +echo "$as_me:7769:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -7942,7 +7943,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS 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:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS @@ -8022,7 +8023,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS 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:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS diff --git a/configure.in b/configure.in index d167f87ba..b2f56c68f 100755 --- a/configure.in +++ b/configure.in @@ -81,7 +81,7 @@ mex_ext=mexglx case $ac_sys_system in Darwin*) OS_IS_DARWIN=1; 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;; CYGWIN*) OS_IS_CYGWIN=1; mex_ext=dll;; Linux* ) case $BITHARDWARE in @@ -302,7 +302,8 @@ if test ${use_sundials} = 1; then AC_DEFINE(HAS_SUNDIALS) echo "using CVODES from SUNDIALS... Sensitivity analysis enabled." 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 if test ${use_sundials} = 0; then @@ -394,11 +395,14 @@ if test "$ENABLE_EQUIL" = "y" ; then # NEED_RECIPES=1 fi +WITH_REACTORS=0 if test "$ENABLE_REACTORS" = "y" ; then KERNEL=$KERNEL' 'reactor NEED_CVODE=1 NEED_ZEROD=1 + WITH_REACTORS=1 fi +AC_SUBST(WITH_REACTORS) if test "$ENABLE_SOLVERS" = "y" ; then KERNEL=$KERNEL' 'solvers diff --git a/examples/cxx/Makefile.in b/examples/cxx/Makefile.in index 7aadc0d96..2ee94b3dd 100755 --- a/examples/cxx/Makefile.in +++ b/examples/cxx/Makefile.in @@ -13,6 +13,7 @@ PROG_NAME = cxx_examples # the object files to be linked together. List those generated from Fortran # and from C/C++ separately OBJS = examples.o kinetics_example1.o kinetics_example2.o \ + kinetics_example3.o \ equil_example1.o \ transport_example1.o transport_example2.o \ rxnpath_example1.o diff --git a/examples/cxx/examples.cpp b/examples/cxx/examples.cpp index 9c6291c1a..1ba40199c 100755 --- a/examples/cxx/examples.cpp +++ b/examples/cxx/examples.cpp @@ -8,10 +8,11 @@ #pragma warning(disable:4503) #endif -#define NUM_EXAMPLES 5 +#define NUM_EXAMPLES 6 int kinetics_example1(int job); int kinetics_example2(int job); +int kinetics_example3(int job); int transport_example1(int job); int transport_example2(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 -exfun fex[] = {kinetics_example1, kinetics_example2, +exfun fex[] = {kinetics_example1, kinetics_example2, kinetics_example3, equil_example1, transport_example1, transport_example2, rxnpath_example1}; diff --git a/preconfig b/preconfig index 79649ce64..908deba24 100755 --- a/preconfig +++ b/preconfig @@ -64,7 +64,7 @@ CANTERA_CONFIG_PREFIX=${CANTERA_CONFIG_PREFIX:=""} # default try to do a full installation, but fall back to a minimal # 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 # 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 # specify them here. Otherwise, add any required compiler-specific # flags here. -F90FLAGS=${F90FLAGS:='-O0'} +F90FLAGS=${F90FLAGS:='-O3'} #---------------------------------------------------------------------- # Customizations / Extensions @@ -244,7 +244,7 @@ ENABLE_TPX='y' # See: http://www.llnl.gov/CASC/sundials # USE_SUNDIALS=${USE_SUNDIALS:='y'} -SUNDIALS_HOME=${SUNDIALS_HOME:='/usr/local/sundials'} +SUNDIALS_HOME=${SUNDIALS_HOME:=/usr/local/sundials} #----------------------------------------------------------------- # BLAS and LAPACK @@ -292,7 +292,7 @@ CXX=${CXX:=g++} CC=${CC:=gcc} # C++ compiler flags -CXXFLAGS=${CXXFLAGS:="-O0 -Wall"} +CXXFLAGS=${CXXFLAGS:="-O3 -Wall"} # the C++ flags required for linking. Uncomment if additional flags # need to be passed to the linker. diff --git a/tools/src/finish_install.py.in b/tools/src/finish_install.py.in index cdb0aae79..a5056952d 100644 --- a/tools/src/finish_install.py.in +++ b/tools/src/finish_install.py.in @@ -130,7 +130,7 @@ if ctpath <> "-": Python package """+ctpath if warn <> '': print warn -else if build_python == 2: +elif build_python == 2: print """ ###################################################################### Warning: the Cantera Python package is not installed. If you