minor cleanup
This commit is contained in:
parent
1a333dcc7c
commit
d77534a8ef
18 changed files with 139 additions and 288 deletions
|
|
@ -57,7 +57,7 @@ static bool checkElement(int i, int m) {
|
|||
|
||||
static bool checkPhase(int i, int n) {
|
||||
try {
|
||||
if (n < 0 || n >= _mix(i)->nPhases())
|
||||
if (n < 0 || n >= int(_mix(i)->nPhases()))
|
||||
throw CanteraError("checkPhase",
|
||||
"illegal phase index ("+int2str(n)+") ");
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
The classes in this package implement one-dimensional reacting flow problems.
|
||||
"""
|
||||
from onedim import *
|
||||
from BurnerFlame import BurnerFlame
|
||||
from BurnerDiffFlame import BurnerDiffFlame
|
||||
from CounterFlame import CounterFlame
|
||||
from StagnationFlow import StagnationFlow
|
||||
#from BurnerFlame import BurnerFlame
|
||||
#from BurnerDiffFlame import BurnerDiffFlame
|
||||
#from CounterFlame import CounterFlame
|
||||
#from StagnationFlow import StagnationFlow
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
"""
|
||||
|
||||
import types
|
||||
#ok = 0
|
||||
from constants import *
|
||||
from exceptions import *
|
||||
from gases import *
|
||||
|
|
@ -12,15 +11,21 @@ from set import set
|
|||
from importFromFile import *
|
||||
|
||||
from mixture import Mixture
|
||||
from num import *
|
||||
|
||||
def writeCSV(f, list):
|
||||
"""Write list items to file 'f' in comma-separated-value format."""
|
||||
"""
|
||||
Write list items to file 'f' in
|
||||
comma-separated-value format. Strings will be written as-is, and
|
||||
other types of objects will be converted to strings and then
|
||||
written. Each call to writeCSV writes one line of the file.
|
||||
"""
|
||||
for item in list:
|
||||
if type(item) == types.StringType:
|
||||
f.write(item+', ')
|
||||
else:
|
||||
f.write(`item`+', ')
|
||||
f.write('\n')
|
||||
f.write('\n')
|
||||
|
||||
|
||||
def table(keys, values):
|
||||
|
|
@ -43,8 +48,8 @@ def refCount(a):
|
|||
return _cantera.ct_refcnt(a)
|
||||
|
||||
def addDirectory(dir):
|
||||
"""Add a directory to search for Cantera data files."""
|
||||
import _cantera
|
||||
return _cantera.ct_addDirectory(dir)
|
||||
|
||||
#if ctdata:
|
||||
# addDirectory(ctdata)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,17 @@
|
|||
#
|
||||
# Solve a steady-state problem by combined damped Newton
|
||||
# iteration and time integration.
|
||||
#
|
||||
""" Solve a steady-state problem by combined damped Newton iteration
|
||||
and time integration. Function solve is no longer used, now that the
|
||||
functional equivalent has been added to the Cantera C++ kernel. """
|
||||
|
||||
from Cantera import CanteraError
|
||||
from Cantera.num import array
|
||||
import math, types
|
||||
|
||||
print
|
||||
"""
|
||||
module solve is deprecated, and may be removed in a future release. If you
|
||||
use it and do not want it removed, send an e-mail to cantera-help@caltech.edu.
|
||||
"""
|
||||
|
||||
def solve(sim, loglevel = 0, refine_grid = 1, plotfile = '', savefile = ''):
|
||||
"""
|
||||
Solve a steady-state problem by combined damped Newton iteration
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
"""Conversion factors to SI (m, kg, kmol, s)"""
|
||||
|
||||
from constants import Avogadro, GasConstant
|
||||
|
||||
kmol = 1.0
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#
|
||||
from Cantera import *
|
||||
from Cantera.OneD import *
|
||||
from Cantera.OneD.BurnerFlame import BurnerFlame
|
||||
|
||||
################################################################
|
||||
#
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#
|
||||
from Cantera import *
|
||||
from Cantera.OneD import *
|
||||
from Cantera.OneD.BurnerFlame import BurnerFlame
|
||||
|
||||
################################################################
|
||||
#
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
#
|
||||
from Cantera import *
|
||||
from Cantera.OneD import *
|
||||
from Cantera.OneD.CounterFlame import CounterFlame
|
||||
from Cantera.num import array
|
||||
|
||||
##################################################################
|
||||
# parameter values
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
from Cantera import *
|
||||
from Cantera.OneD import *
|
||||
from Cantera.OneD.StagnationFlow import StagnationFlow
|
||||
|
||||
################################################################
|
||||
#
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
#include "ThermoPhase.h"
|
||||
#include "DenseMatrix.h"
|
||||
|
||||
#include "MultiPhaseEquil.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
int _equilflag(const char* xy);
|
||||
|
|
@ -152,9 +154,18 @@ namespace Cantera {
|
|||
* calculation.
|
||||
*/
|
||||
inline void equilibrate(thermo_t& s, int XY) {
|
||||
ChemEquil e;
|
||||
e.equilibrate(s,XY);
|
||||
s.setElementPotentials(e.elementPotentials());
|
||||
if (XY == TP) {
|
||||
MultiPhase mix;
|
||||
mix.addPhase(&s, 1.0);
|
||||
mix.setTemperature(s.temperature());
|
||||
mix.setPressure(s.pressure());
|
||||
equilibrate(mix, XY);
|
||||
}
|
||||
else {
|
||||
ChemEquil e;
|
||||
e.equilibrate(s,XY);
|
||||
s.setElementPotentials(e.elementPotentials());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ BASE = State.o Elements.o Constituents.o stringUtils.o misc.o importCTML.o
|
|||
xml.o Phase.o DenseMatrix.o ctml.o funcs.o ctvector.o phasereport.o ct2ctml.o
|
||||
|
||||
# thermodynamic properties
|
||||
THERMO = $(BASE) ThermoPhase.o IdealGasPhase.o ConstDensityThermo.o StoichSubstance.o PureFluidPhase.o SpeciesThermoFactory.o ThermoFactory.o
|
||||
THERMO = $(BASE) ThermoPhase.o IdealGasPhase.o ConstDensityThermo.o StoichSubstance.o PureFluidPhase.o SpeciesThermoFactory.o ThermoFactory.o MultiPhase.o
|
||||
|
||||
# homogeneous kinetics
|
||||
KINETICS = GRI_30_Kinetics.o KineticsFactory.o GasKinetics.o FalloffFactory.o \
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
#ifndef CT_MULTIPHASE_H
|
||||
#define CT_MULTIPHASE_H
|
||||
|
||||
#include "ThermoPhase.h"
|
||||
#include "ct_defs.h"
|
||||
#include "DenseMatrix.h"
|
||||
#include "stringUtils.h"
|
||||
#include <iostream>
|
||||
|
||||
#include "ThermoPhase.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
|
|
@ -39,51 +37,7 @@ namespace Cantera {
|
|||
/// Add a phase to the mixture.
|
||||
/// @param p pointer to the phase object
|
||||
/// @param moles total number of moles of all species in this phase
|
||||
void addPhase(phase_t* p, doublereal moles) {
|
||||
|
||||
if (m_init) {
|
||||
throw CanteraError("addPhase",
|
||||
"phases cannot be added after init() has been called.");
|
||||
}
|
||||
|
||||
// save the pointer to the phase object
|
||||
m_phase.push_back(p);
|
||||
|
||||
// store its number of moles
|
||||
m_moles.push_back(moles);
|
||||
|
||||
// update the number of phases and the total number of
|
||||
// species
|
||||
m_np = m_phase.size();
|
||||
m_nsp += p->nSpecies();
|
||||
|
||||
// determine if this phase has new elements
|
||||
// for each new element, add an entry in the map
|
||||
// from names to index number + 1:
|
||||
|
||||
string ename;
|
||||
// iterate over the elements in this phase
|
||||
index_t m, nel = p->nElements();
|
||||
for (m = 0; m < nel; m++) {
|
||||
ename = p->elementName(m);
|
||||
|
||||
// if no entry is found for this element name, then
|
||||
// it is a new element. In this case, add the name
|
||||
// to the list of names, increment the element count,
|
||||
// and add an entry to the name->(index+1) map.
|
||||
if (m_enamemap[ename] == 0) {
|
||||
m_enamemap[ename] = m_nel + 1;
|
||||
m_enames.push_back(ename);
|
||||
m_nel++;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_temp == 0.0 && p->temperature() > 0.0) {
|
||||
m_temp = p->temperature();
|
||||
m_press = p->pressure();
|
||||
}
|
||||
//init();
|
||||
}
|
||||
void addPhase(phase_t* p, doublereal moles);
|
||||
|
||||
int nElements() { return int(m_nel); }
|
||||
string elementName(int m) { return m_enames[m]; }
|
||||
|
|
@ -103,49 +57,9 @@ namespace Cantera {
|
|||
copy(m_moleFractions.begin(), m_moleFractions.end(), x);
|
||||
}
|
||||
|
||||
|
||||
/// Process phases and build atomic composition array. After
|
||||
/// init() has been called, no more phases may be added.
|
||||
void init() {
|
||||
if (m_init) return;
|
||||
index_t ip, kp, k = 0, nsp, m;
|
||||
int mlocal;
|
||||
string sym;
|
||||
|
||||
// allocate space for the atomic composition matrix
|
||||
m_atoms.resize(m_nel, m_nsp, 0.0);
|
||||
m_moleFractions.resize(m_nsp, 0.0);
|
||||
|
||||
// iterate over the elements
|
||||
for (m = 0; m < m_nel; m++) {
|
||||
sym = m_enames[m];
|
||||
k = 0;
|
||||
// iterate over the phases
|
||||
for (ip = 0; ip < m_np; ip++) {
|
||||
phase_t* p = m_phase[ip];
|
||||
nsp = p->nSpecies();
|
||||
mlocal = p->elementIndex(sym);
|
||||
for (kp = 0; kp < nsp; kp++) {
|
||||
if (mlocal >= 0) {
|
||||
m_atoms(m, k) = p->nAtoms(kp, mlocal);
|
||||
}
|
||||
if (m == 0) {
|
||||
m_snames.push_back(p->speciesName(kp));
|
||||
if (kp == 0) {
|
||||
m_spstart.push_back(m_spphase.size());
|
||||
}
|
||||
m_spphase.push_back(ip);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// set the initial composition within each phase to the
|
||||
/// mole fractions stored in the phase objects
|
||||
m_init = true;
|
||||
updateMoleFractions();
|
||||
}
|
||||
void init();
|
||||
|
||||
/// Moles of phase n.
|
||||
doublereal phaseMoles(index_t n) {
|
||||
|
|
@ -160,27 +74,10 @@ namespace Cantera {
|
|||
/// Return a reference to phase n. The state of phase n is
|
||||
/// also updated to match the state stored locally in the
|
||||
/// mixture object.
|
||||
phase_t& phase(index_t n) {
|
||||
if (!m_init) init();
|
||||
m_phase[n]->setState_TPX(m_temp, m_press,
|
||||
m_moleFractions.begin() + m_spstart[n]);
|
||||
return *m_phase[n];
|
||||
}
|
||||
|
||||
/// Return a const reference to phase n.
|
||||
//const phase_t& phase(index_t n) const {
|
||||
// if (!m_init) init();
|
||||
// m_phase[n]->setState_TPX(m_temp,
|
||||
// m_press, m_moleFractions.begin() + m_spstart[n]);
|
||||
// return *m_phase[n];
|
||||
//}
|
||||
phase_t& phase(index_t n);
|
||||
|
||||
/// Moles of species \c k.
|
||||
doublereal speciesMoles(index_t k) {
|
||||
if (!m_init) init();
|
||||
index_t ip = m_spphase[k];
|
||||
return m_moles[ip]*m_moleFractions[k];
|
||||
}
|
||||
doublereal speciesMoles(index_t k);
|
||||
|
||||
/// Index of the species belonging to phase number \c p
|
||||
/// with index \c k within the phase.
|
||||
|
|
@ -190,42 +87,15 @@ namespace Cantera {
|
|||
|
||||
/// Total moles of element m, summed over all
|
||||
/// phases
|
||||
doublereal elementMoles(index_t m) {
|
||||
doublereal sum = 0.0, phasesum;
|
||||
index_t i, k = 0, ik, nsp;
|
||||
for (i = 0; i < m_np; i++) {
|
||||
phasesum = 0.0;
|
||||
nsp = m_phase[i]->nSpecies();
|
||||
for (ik = 0; ik < nsp; ik++) {
|
||||
k = speciesIndex(ik, i);
|
||||
phasesum += m_atoms(m,k)*m_moleFractions[k];
|
||||
}
|
||||
sum += phasesum * m_moles[i];
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
doublereal elementMoles(index_t m);
|
||||
|
||||
/// Chemical potentials. Write into array \c mu the chemical
|
||||
/// potentials of all species [J/kmol].
|
||||
void getChemPotentials(doublereal* mu) {
|
||||
index_t i, loc = 0;
|
||||
updatePhases();
|
||||
for (i = 0; i < m_np; i++) {
|
||||
m_phase[i]->getChemPotentials(mu + loc);
|
||||
loc += m_phase[i]->nSpecies();
|
||||
}
|
||||
}
|
||||
void getChemPotentials(doublereal* mu);
|
||||
|
||||
/// Chemical potentials. Write into array \c mu the chemical
|
||||
/// potentials of all species [J/kmol].
|
||||
void getStandardChemPotentials(doublereal* mu) {
|
||||
index_t i, loc = 0;
|
||||
updatePhases();
|
||||
for (i = 0; i < m_np; i++) {
|
||||
m_phase[i]->getStandardChemPotentials(mu + loc);
|
||||
loc += m_phase[i]->nSpecies();
|
||||
}
|
||||
}
|
||||
void getStandardChemPotentials(doublereal* mu);
|
||||
|
||||
/// Temperature [K].
|
||||
doublereal temperature() {
|
||||
|
|
@ -247,25 +117,13 @@ namespace Cantera {
|
|||
updatePhases();
|
||||
}
|
||||
|
||||
doublereal gibbs() {
|
||||
index_t i;
|
||||
doublereal sum = 0.0;
|
||||
updatePhases();
|
||||
for (i = 0; i < m_np; i++)
|
||||
sum += m_phase[i]->gibbs_mole() * m_moles[i];
|
||||
return sum;
|
||||
}
|
||||
doublereal gibbs();
|
||||
|
||||
index_t nPhases() {
|
||||
return m_np;
|
||||
}
|
||||
|
||||
bool solutionSpecies(index_t k) {
|
||||
if (m_phase[m_spphase[k]]->nSpecies() > 1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
bool solutionSpecies(index_t k);
|
||||
|
||||
index_t speciesPhaseIndex(index_t k) {
|
||||
return m_spphase[k];
|
||||
|
|
@ -275,83 +133,22 @@ namespace Cantera {
|
|||
return m_moleFractions[k];
|
||||
}
|
||||
|
||||
void updateMoleFractions() {
|
||||
if (!m_init) init();
|
||||
// save the current mole fractions for each phase
|
||||
index_t ip, loc = 0;
|
||||
for (ip = 0; ip < m_np; ip++) {
|
||||
phase_t* p = m_phase[ip];
|
||||
p->getMoleFractions(m_moleFractions.begin() + loc);
|
||||
loc += p->nSpecies();
|
||||
}
|
||||
}
|
||||
void updateMoleFractions();
|
||||
|
||||
void setPhaseMoleFractions(index_t n, doublereal* x) {
|
||||
phase_t* p = m_phase[n];
|
||||
p->setState_TPX(m_temp, m_press, x);
|
||||
}
|
||||
void setPhaseMoleFractions(index_t n, doublereal* x);
|
||||
|
||||
void setMolesByName(compositionMap& xMap) {
|
||||
int kk = nSpecies();
|
||||
doublereal x;
|
||||
vector_fp mf(kk, 0.0);
|
||||
for (int k = 0; k < kk; k++) {
|
||||
x = xMap[speciesName(k)];
|
||||
if (x > 0.0) mf[k] = x;
|
||||
}
|
||||
setMoles(mf.begin());
|
||||
}
|
||||
void setMolesByName(compositionMap& xMap);
|
||||
|
||||
void setMolesByName(const string& x) {
|
||||
compositionMap xx;
|
||||
int kk = nSpecies();
|
||||
for (int k = 0; k < kk; k++) {
|
||||
xx[speciesName(k)] = -1.0;
|
||||
}
|
||||
parseCompString(x, xx);
|
||||
setMolesByName(xx);
|
||||
}
|
||||
void setMolesByName(const string& x);
|
||||
|
||||
void setMoles(doublereal* n) {
|
||||
if (!m_init) init();
|
||||
index_t ip, loc = 0;
|
||||
index_t ik, k = 0, nsp;
|
||||
doublereal phasemoles;
|
||||
for (ip = 0; ip < m_np; ip++) {
|
||||
phase_t* p = m_phase[ip];
|
||||
nsp = p->nSpecies();
|
||||
phasemoles = 0.0;
|
||||
for (ik = 0; ik < nsp; ik++) {
|
||||
phasemoles += n[k];
|
||||
k++;
|
||||
}
|
||||
m_moles[ip] = phasemoles;
|
||||
if (nsp > 1) {
|
||||
p->setState_TPX(m_temp, m_press, n + loc);
|
||||
p->getMoleFractions(m_moleFractions.begin() + loc);
|
||||
}
|
||||
else {
|
||||
m_moleFractions[loc] = 1.0;
|
||||
}
|
||||
loc += p->nSpecies();
|
||||
}
|
||||
}
|
||||
void setMoles(doublereal* n);
|
||||
|
||||
protected:
|
||||
|
||||
/// Set the states of the phase objects to the locally-stored
|
||||
/// state. Note that if individual phases have T and P different
|
||||
/// than that stored locally, the phase T and P will be modified.
|
||||
void updatePhases() {
|
||||
if (!m_init) init();
|
||||
index_t p, nsp, loc = 0;
|
||||
for (p = 0; p < m_np; p++) {
|
||||
nsp = m_phase[p]->nSpecies();
|
||||
doublereal* x = m_moleFractions.begin() + loc;
|
||||
loc += nsp;
|
||||
m_phase[p]->setState_TPX(m_temp, m_press, x);
|
||||
}
|
||||
}
|
||||
void updatePhases();
|
||||
|
||||
vector_fp m_moles;
|
||||
vector<phase_t*> m_phase;
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ namespace Cantera {
|
|||
if (m_A(m,m) == 0.0) {
|
||||
for (k = m+1; k < nColumns; k++) {
|
||||
if (m_A(m,k) != 0.0) {
|
||||
for (n = 0; n < nRows; n++) {
|
||||
for (n = 0; n < int(nRows); n++) {
|
||||
tmp = m_A(n,m);
|
||||
m_A(n, m) = m_A(n, k);
|
||||
m_A(n, k) = tmp;
|
||||
|
|
@ -290,7 +290,7 @@ namespace Cantera {
|
|||
|
||||
// subtract A(n,m)/A(m,m) * (row m) from row n, so that
|
||||
// A(n,m) = 0.
|
||||
for (n = m+1; n < m_nel; n++) {
|
||||
for (n = int(m+1); n < int(m_nel); n++) {
|
||||
fctr = m_A(n,m)/m_A(m,m);
|
||||
for (k = 0; k < m_nsp; k++) {
|
||||
m_A(n,k) -= m_A(m,k)*fctr;
|
||||
|
|
@ -330,8 +330,8 @@ namespace Cantera {
|
|||
#endif
|
||||
|
||||
// create stoichometric coefficient matrix.
|
||||
for (n = 0; n < m_nsp; n++) {
|
||||
if (n < m_nel)
|
||||
for (n = 0; n < int(m_nsp); n++) {
|
||||
if (n < int(m_nel))
|
||||
for (k = 0; k < m_nsp - m_nel; k++)
|
||||
m_N(n, k) = -m_A(n, k + m_nel);
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,14 @@
|
|||
#define CT_CONFIG_H
|
||||
|
||||
|
||||
//------------------------ Development flags ------------------//
|
||||
//
|
||||
// These flags turn on or off features that are still in
|
||||
// development and are not yet stable.
|
||||
|
||||
#define DEV_EQUIL
|
||||
|
||||
|
||||
//------------------------ Fortran settings -------------------//
|
||||
|
||||
|
||||
|
|
@ -13,9 +21,9 @@
|
|||
// corresponding Fortran data types on your system. The defaults
|
||||
// are OK for most systems
|
||||
|
||||
typedef double doublereal; // Fortran double precision
|
||||
typedef int integer; // Fortran integer
|
||||
typedef int ftnlen; // Fortran hidden string length type
|
||||
typedef double doublereal; // Fortran double precision
|
||||
typedef int integer; // Fortran integer
|
||||
typedef int ftnlen; // Fortran hidden string length type
|
||||
|
||||
|
||||
|
||||
|
|
@ -51,8 +59,8 @@ 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 HAS_SSTREAM
|
||||
#define DARWIN 1
|
||||
#define HAS_SSTREAM 1
|
||||
|
||||
// Identify whether the operating system is cygwin's overlay of
|
||||
// windows, with gcc being used as the compiler.
|
||||
|
|
@ -60,7 +68,7 @@ typedef int ftnlen; // Fortran hidden string length type
|
|||
|
||||
// Identify whether the operating system is windows based, with
|
||||
// microsoft vc++ being used as the compiler
|
||||
#define WINMSVC 1
|
||||
/* #undef WINMSVC */
|
||||
|
||||
//--------- Fonts for reaction path diagrams ----------------------
|
||||
#define RXNPATH_FONT "Helvetica"
|
||||
|
|
@ -68,8 +76,13 @@ typedef int ftnlen; // Fortran hidden string length type
|
|||
//--------------------- Python ------------------------------------
|
||||
// This path to the python executable is created during
|
||||
// Cantera's setup. It identifies the python executable
|
||||
// used to run Python to process .cti files.
|
||||
#define PYTHON_EXE "c:/python24/python.exe"
|
||||
// used to run Python to process .cti files. Note that this is only
|
||||
// used if environment variable PYTHON_CMD is not set.
|
||||
#define PYTHON_EXE "python"
|
||||
|
||||
// If this is defined, the Cantera Python interface will use the
|
||||
// Numeric package; otherwise, it will use numarray.
|
||||
#define HAS_NUMERIC 1
|
||||
|
||||
//--------------------- Cantera -----------------------------------
|
||||
|
||||
|
|
@ -77,11 +90,11 @@ typedef int ftnlen; // Fortran hidden string length type
|
|||
// This data pathway is used to locate a directory where datafiles
|
||||
// are to be found. Note, the local directory is always searched
|
||||
// as well.
|
||||
#define CANTERA_DATA "c:/cantera/data"
|
||||
#define CANTERA_DATA "/Applications/Cantera/data"
|
||||
|
||||
#define INCL_PURE_FLUIDS 1
|
||||
|
||||
//--------------------- compile options ----------------------------
|
||||
/* #undef USE_PCH */
|
||||
#define USE_PCH 1
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace ctml {
|
|||
return s;
|
||||
}
|
||||
|
||||
#ifdef NOT_USED
|
||||
#ifdef INCL_CHECKPYTHON
|
||||
static bool checkPython() {
|
||||
time_t aclock;
|
||||
time( &aclock );
|
||||
|
|
|
|||
46
README.txt
46
README.txt
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
release 1.5
|
||||
|
||||
7/30/2004
|
||||
12/14/2004
|
||||
|
||||
Copyright (c) 2001-2004 California Institute of Technology
|
||||
|
||||
|
|
@ -19,11 +19,24 @@ All trademarks referenced herein are property of their respective
|
|||
holders.
|
||||
|
||||
|
||||
Web sites
|
||||
==========
|
||||
|
||||
The main Cantera web site is http://www.cantera.org. This primarily serves
|
||||
as a gateway to the other two web sites:
|
||||
|
||||
1. The Cantera User's Group. http://groups.yahoo.com/groups/cantera.
|
||||
This site has a message board, and some miscellaneous files and utilities.
|
||||
|
||||
2. The Cantera Sourceforge site. Distribution of the Cantera source code is
|
||||
done using Sourceforge. The site is http://sourceforge.net/projects/cantera.
|
||||
|
||||
|
||||
Installing a Binary Version of Cantera
|
||||
======================================
|
||||
|
||||
Binary installers are available for the Windows and Mac platforms. If
|
||||
you wish to install from one of these, download the appropriate
|
||||
you want to install from one of these, download the appropriate
|
||||
installer from the Cantera Sourceforge site and run it. This is the
|
||||
simplest option if you want a standard installation, and plan to
|
||||
primarily use Cantera from Python or MATLAB.
|
||||
|
|
@ -89,26 +102,13 @@ use g++ 2.95.
|
|||
2) Windows Build Procedure
|
||||
--------------------------
|
||||
|
||||
Cantera can be built under Windows using Visual C++ 6.0 and Compaq
|
||||
Visual Fortran 6.0. You need to have cygwin installed, however, so
|
||||
that you can use 'make' ot set up the directory structure in the
|
||||
install directory.
|
||||
|
||||
The first step is to run 'configure' from a cygwin shell window. Once
|
||||
this finishes, start Visual C++, and go to the 'win32' directory and
|
||||
open workspace 'cantera.dsw'. Set the active project to 'all', and the
|
||||
active configuration to 'Win32 - Release'. Build the project.
|
||||
|
||||
When this completes, return to the cygwin shell, and type 'make win'
|
||||
to complete the process. At the end, you should have a working
|
||||
installation in C:\Cantera (or wherever you specified to 'configure').
|
||||
|
||||
The Windows build procedure is described in more detail in the
|
||||
document **.
|
||||
Cantera can be built under Windows using Visual C++ .NET. See the
|
||||
document "cantera-vc7" at the Sourceforge site under "Cantera
|
||||
Documentation / Building and Installing" for more details.
|
||||
|
||||
|
||||
Configuring Matlab
|
||||
---------------------
|
||||
--------------------
|
||||
|
||||
The Matlab toolbox uses one compiled MEX program written in C++.
|
||||
Before you can build it, Matlab needs to be configured
|
||||
|
|
@ -128,10 +128,10 @@ containing the toolbox and type 'buildux' on unix/linux/Mac OS X, or
|
|||
Configuring Python
|
||||
---------------------
|
||||
|
||||
Before you can build the Python interface from the source, you need to
|
||||
have Python 2.0 or greater, and the 'Numeric' package must be
|
||||
installed. Python is available at www.python.org, and Numeric is
|
||||
available through SourceForge.
|
||||
Before you can build the Python interface, you need to have Python 2.0
|
||||
or greater, and the 'numarray' or 'Numeric' package must be
|
||||
installed. Python is available at www.python.org, and numarray and
|
||||
Numeric are available through SourceForge (project 'NumPy')
|
||||
|
||||
|
||||
Customizing
|
||||
|
|
|
|||
33
config.h
33
config.h
|
|
@ -6,6 +6,14 @@
|
|||
#define CT_CONFIG_H
|
||||
|
||||
|
||||
//------------------------ Development flags ------------------//
|
||||
//
|
||||
// These flags turn on or off features that are still in
|
||||
// development and are not yet stable.
|
||||
|
||||
#define DEV_EQUIL
|
||||
|
||||
|
||||
//------------------------ Fortran settings -------------------//
|
||||
|
||||
|
||||
|
|
@ -13,9 +21,9 @@
|
|||
// corresponding Fortran data types on your system. The defaults
|
||||
// are OK for most systems
|
||||
|
||||
typedef double doublereal; // Fortran double precision
|
||||
typedef int integer; // Fortran integer
|
||||
typedef int ftnlen; // Fortran hidden string length type
|
||||
typedef double doublereal; // Fortran double precision
|
||||
typedef int integer; // Fortran integer
|
||||
typedef int ftnlen; // Fortran hidden string length type
|
||||
|
||||
|
||||
|
||||
|
|
@ -51,8 +59,8 @@ 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 HAS_SSTREAM
|
||||
#define DARWIN 1
|
||||
#define HAS_SSTREAM 1
|
||||
|
||||
// Identify whether the operating system is cygwin's overlay of
|
||||
// windows, with gcc being used as the compiler.
|
||||
|
|
@ -60,7 +68,7 @@ typedef int ftnlen; // Fortran hidden string length type
|
|||
|
||||
// Identify whether the operating system is windows based, with
|
||||
// microsoft vc++ being used as the compiler
|
||||
#define WINMSVC 1
|
||||
/* #undef WINMSVC */
|
||||
|
||||
//--------- Fonts for reaction path diagrams ----------------------
|
||||
#define RXNPATH_FONT "Helvetica"
|
||||
|
|
@ -68,8 +76,13 @@ typedef int ftnlen; // Fortran hidden string length type
|
|||
//--------------------- Python ------------------------------------
|
||||
// This path to the python executable is created during
|
||||
// Cantera's setup. It identifies the python executable
|
||||
// used to run Python to process .cti files.
|
||||
#define PYTHON_EXE "c:/python24/python.exe"
|
||||
// used to run Python to process .cti files. Note that this is only
|
||||
// used if environment variable PYTHON_CMD is not set.
|
||||
#define PYTHON_EXE "python"
|
||||
|
||||
// If this is defined, the Cantera Python interface will use the
|
||||
// Numeric package; otherwise, it will use numarray.
|
||||
#define HAS_NUMERIC 1
|
||||
|
||||
//--------------------- Cantera -----------------------------------
|
||||
|
||||
|
|
@ -77,11 +90,11 @@ typedef int ftnlen; // Fortran hidden string length type
|
|||
// This data pathway is used to locate a directory where datafiles
|
||||
// are to be found. Note, the local directory is always searched
|
||||
// as well.
|
||||
#define CANTERA_DATA "c:/cantera/data"
|
||||
#define CANTERA_DATA "/Applications/Cantera/data"
|
||||
|
||||
#define INCL_PURE_FLUIDS 1
|
||||
|
||||
//--------------------- compile options ----------------------------
|
||||
/* #undef USE_PCH */
|
||||
#define USE_PCH 1
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -63,12 +63,12 @@ int transport_example1(int job) {
|
|||
IdealGasMix gas("gri30.cti", "gri30");
|
||||
doublereal temp = 500.0;
|
||||
doublereal pres = 2.0*OneAtm;
|
||||
gas.setState_TPX(temp, pres, "H2:1.0, CH4:0.1");
|
||||
gas.setState_TPX(temp, pres, "H2:1.0, O2:0.5, CH4:0.1, N2:0.2");
|
||||
|
||||
// create a transport manager that implements
|
||||
// mixture-averaged transport properties
|
||||
|
||||
Transport* tr = newTransportMgr("Mix", &gas);
|
||||
Transport* tr = newTransportMgr("Multi", &gas);
|
||||
|
||||
int nsp = gas.nSpecies();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue