diff --git a/Cantera/matlab/setup_matlab.py b/Cantera/matlab/setup_matlab.py index 5901c5783..ba9116c3d 100644 --- a/Cantera/matlab/setup_matlab.py +++ b/Cantera/matlab/setup_matlab.py @@ -1,10 +1,10 @@ import sys -bindir = '/home/goodwin/bin' -libdir = '/home/goodwin/dv/sf/cantera/build/lib/i686-pc-linux-gnu' -incdir = '/home/goodwin/dv/sf/cantera/build/include' -libs = ' -loneD -lzeroD -ltransport -lcantera -lrecipes -lcvode -lctlapack -lctmath -lctblas -ltpx -L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -L/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../.. -lg2c -lm' +bindir = '/usr/local/bin' +libdir = '/Users/dgg/dv/sf/cantera/build/lib/powerpc-apple-darwin7.0.0' +incdir = '/Users/dgg/dv/sf/cantera/build/include' +libs = ' -loneD -lzeroD -ltransport -lcantera -lrecipes -lcvode -lctlapack -lctmath -lctblas -ltpx -lg2c -lgcc' f = open('setup.m','w') f.write('cd cantera\nbuildux\nexit\n') diff --git a/Cantera/src/config.h b/Cantera/src/config.h index b6caa522c..656ac8921 100755 --- a/Cantera/src/config.h +++ b/Cantera/src/config.h @@ -50,7 +50,7 @@ typedef int ftnlen; // Fortran hidden string length type // The configure script defines this if the operatiing system is Mac // OS X, This used to add some Mac-specific directories to the default // data file search path. -#define DARWIN 0 +#define DARWIN 1 //--------- Fonts for reaction path diagrams ---------------------- @@ -60,13 +60,13 @@ typedef int ftnlen; // Fortran hidden string length type //--------------------- Python ------------------------------------ // used to run Python to process .cti files -#define PYTHON_EXE "/home/goodwin/bin/python" +#define PYTHON_EXE "/usr/bin/python" //--------------------- Cantera ----------------------------------- // used to find data files -#define CANTERA_ROOT "/home/goodwin/cantera" +#define CANTERA_ROOT "/usr/local/cantera" diff --git a/config.h b/config.h index b6caa522c..656ac8921 100755 --- a/config.h +++ b/config.h @@ -50,7 +50,7 @@ typedef int ftnlen; // Fortran hidden string length type // The configure script defines this if the operatiing system is Mac // OS X, This used to add some Mac-specific directories to the default // data file search path. -#define DARWIN 0 +#define DARWIN 1 //--------- Fonts for reaction path diagrams ---------------------- @@ -60,13 +60,13 @@ typedef int ftnlen; // Fortran hidden string length type //--------------------- Python ------------------------------------ // used to run Python to process .cti files -#define PYTHON_EXE "/home/goodwin/bin/python" +#define PYTHON_EXE "/usr/bin/python" //--------------------- Cantera ----------------------------------- // used to find data files -#define CANTERA_ROOT "/home/goodwin/cantera" +#define CANTERA_ROOT "/usr/local/cantera" diff --git a/tools/Makefile.in b/tools/Makefile.in index 251758883..41ca77d5d 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -14,6 +14,7 @@ apps: apps-install: @INSTALL@ -d @ct_bindir@ @INSTALL@ ../bin/ck2cti @ct_bindir@ + @INSTALL@ ../bin/cti2ctml @ct_bindir@ man-install: @INSTALL@ -d @ct_mandir@/man1 diff --git a/tools/src/finish_install.py.in b/tools/src/finish_install.py.in index 4b7127e35..92015985e 100644 --- a/tools/src/finish_install.py.in +++ b/tools/src/finish_install.py.in @@ -64,7 +64,7 @@ f.close() # write the script to copy files to build a new app f = open(bindir+'/ctnew','w') f.write("""#!/bin/sh -if test $1 = '-f77'; then +if test "x$1" = "x-f77"; then cp """+templdir+"""/f77/*.* . else cp """+templdir+"""/cxx/*.* . diff --git a/tools/templates/cxx/demo.cpp b/tools/templates/cxx/demo.cpp index 1928ef11c..d0ccadda2 100644 --- a/tools/templates/cxx/demo.cpp +++ b/tools/templates/cxx/demo.cpp @@ -1,24 +1,43 @@ +/////////////////////////////////////////////////////////////////////// // -// Replace this sample main program with your program -// +// This demonstration program builds an object representing a +// reacting gas mixture, and uses it to compute thermodynamic +// properties, chemical equilibrium, and transport properties. // +/////////////////////////////////////////////////////////////////////// + + +// Include cantera header files. They should be included in the form +// , and Cantera.h should always be included first. +// These headers are designed for use in C++ programs and provide a +// simplified interface to the Cantera kernel header files. If you +// need to include kernel headers directly, use the format +// . #include -#include -#include -#include +#include // defines class IdealGasMix +#include // chemical equilibrium +#include // transport properties + +// All Cantera names are in namespace Cantera. You can either +// reference everything as Cantera::, or include the following +// 'using namespace' line. using namespace Cantera; + +// The program is put into a function so that error handling code can +// be conveniently put around the whole thing. See main() below. + void demoprog() { + printf("\n\n**** C++ Test Program ****\n\n"); + IdealGasMix gas("h2o2.cti","ohmech"); double temp = 1200.0; double pres = OneAtm; gas.setState_TPX(temp, pres, "H2:2, O2:1, OH:0.01, H:0.01, O:0.01"); - printf("\n\n**** C++ Test Program ****\n\n"); - // Thermodynamic properties @@ -48,28 +67,36 @@ void demoprog() { gas.temperature(), gas.pressure(), gas.density(), gas.enthalpy_mole(), gas.entropy_mole(), gas.cp_mole()); + // Reaction information int irxns = gas.nReactions(); double* qf = new double[irxns]; double* qr = new double[irxns]; - double* q = new double[irxns]; + double* q = new double[irxns]; // since the gas has been set to an equilibrium state, the forward - // and reverse rates of progress should be equal, and the net - // rates should be zero. + // and reverse rates of progress should be equal for all + // reversible reactions, and the net rates should be zero. gas.getFwdRatesOfProgress(qf); gas.getRevRatesOfProgress(qr); gas.getNetRatesOfProgress(q); + printf("\n\n"); for (int i = 0; i < irxns; i++) { printf("%30s %14.5g %14.5g %14.5g kmol/m3/s\n", gas.reactionString(i).c_str(), qf[i], qr[i], q[i]); } + // transport properties + // create a transport manager for the gas that computes + // mixture-averaged properties Transport* tr = newTransportMgr("Mix", &gas, 1); + + // print the viscosity, thermal conductivity, and diffusion + // coefficients printf("\n\nViscosity: %14.5g Pa-s\n", tr->viscosity()); printf("Thermal conductivity: %14.5g W/m/K\n", tr->thermalConductivity()); @@ -82,8 +109,16 @@ void demoprog() { printf("%20s %14.5g m2/s \n", gas.speciesName(k).c_str(), diff[k]); } + // clean up + delete qf; + delete qr; + delete q; + delete diff; + delete tr; } - + + + int main() { try {