-
This commit is contained in:
parent
383fae1a8d
commit
45ba3f2dae
6 changed files with 58 additions and 22 deletions
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
6
config.h
6
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"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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/*.* .
|
||||
|
|
|
|||
|
|
@ -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
|
||||
// <cantera/*.h>, 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
|
||||
// <cantera/kernel/*.h>.
|
||||
|
||||
#include <cantera/Cantera.h>
|
||||
#include <cantera/IdealGasMix.h>
|
||||
#include <cantera/equilibrium.h>
|
||||
#include <cantera/transport.h>
|
||||
#include <cantera/IdealGasMix.h> // defines class IdealGasMix
|
||||
#include <cantera/equilibrium.h> // chemical equilibrium
|
||||
#include <cantera/transport.h> // transport properties
|
||||
|
||||
|
||||
// All Cantera names are in namespace Cantera. You can either
|
||||
// reference everything as Cantera::<name>, 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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue