*** empty log message ***

This commit is contained in:
Dave Goodwin 2005-07-25 03:55:32 +00:00
parent f4889d7bf2
commit 95dc86cd2c
18 changed files with 236 additions and 164 deletions

View file

@ -2,7 +2,7 @@
import sys import sys
bindir = '@ct_bindir@' bindir = '@ct_bindir@'
libdir = '-L@buildlib@ @LOCAL_LIB_DIRS@' libdir = '-L@buildlib@ @LOCAL_LIB_DIRS@'
incdir = '@buildinc@' incdir = '@buildinc@'
libs = '-lclib @LOCAL_LIBS@ @LIBS@ @FLIBS@' libs = '-lclib @LOCAL_LIBS@ @LIBS@ @FLIBS@'

View file

@ -358,8 +358,8 @@ def getReactionSpecies(s):
# try to convert the token to a number. # try to convert the token to a number.
try: try:
n = float(t) n = float(t)
if n <= 0.0: if n < 0.0:
raise CTI_Error("zero or negative stoichiometric coefficient:" raise CTI_Error("negative stoichiometric coefficient:"
+s) +s)
#if t > '0' and t < '9': #if t > '0' and t < '9':

View file

@ -66,7 +66,12 @@ namespace Cantera {
class PropertyCalculator; class PropertyCalculator;
/** /**
* Class ChemEquil implements a chemical equilibrium solver for * @defgroup equil Chemical Equilibrium
*
*/
/**
* Class ChemEquil implements a chemical equilibrium solver for
* single-phase solutions. It is a "non-stoichiometric" solver in * single-phase solutions. It is a "non-stoichiometric" solver in
* the terminology of Smith and Missen, meaning that every * the terminology of Smith and Missen, meaning that every
* intermediate state is a valid chemical equilibrium state, but * intermediate state is a valid chemical equilibrium state, but
@ -86,6 +91,7 @@ namespace Cantera {
* compositions (e.g. 2 H2 + O2). In general, if speed is * compositions (e.g. 2 H2 + O2). In general, if speed is
* important, this solver should be tried first, and if it fails * important, this solver should be tried first, and if it fails
* then use MultiPhaseEquil. * then use MultiPhaseEquil.
* @ingroup equil
*/ */
class ChemEquil { class ChemEquil {

View file

@ -309,7 +309,7 @@ namespace Cantera {
m_revProductStoich.multiply(m_conc.begin(), ropr.begin()); m_revProductStoich.multiply(m_conc.begin(), ropr.begin());
// do global reactions // do global reactions
m_globalReactantStoich.power(m_conc.begin(), ropf.begin()); //m_globalReactantStoich.power(m_conc.begin(), ropf.begin());
for (int j = 0; j != m_ii; ++j) { for (int j = 0; j != m_ii; ++j) {
ropnet[j] = ropf[j] - ropr[j]; ropnet[j] = ropf[j] - ropr[j];

View file

@ -556,7 +556,8 @@ namespace Cantera {
int nr = r.reactants.size(); int nr = r.reactants.size();
for (n = 0; n < nr; n++) { for (n = 0; n < nr; n++) {
ns = r.rstoich[n]; ns = r.rstoich[n];
if (ns != 0) m_rrxn[r.reactants[n]][rnum] += ns; if (r.rstoich[n] != 0.0)
m_rrxn[r.reactants[n]][rnum] += r.rstoich[n];
for (m = 0; m < ns; m++) { for (m = 0; m < ns; m++) {
rk.push_back(r.reactants[n]); rk.push_back(r.reactants[n]);
} }
@ -567,7 +568,8 @@ namespace Cantera {
int np = r.products.size(); int np = r.products.size();
for (n = 0; n < np; n++) { for (n = 0; n < np; n++) {
ns = r.pstoich[n]; ns = r.pstoich[n];
if (r.pstoich[n] != 0.0) m_prxn[r.products[n]][rnum] += r.pstoich[n]; if (r.pstoich[n] != 0.0)
m_prxn[r.products[n]][rnum] += r.pstoich[n];
for (m = 0; m < ns; m++) { for (m = 0; m < ns; m++) {
pk.push_back(r.products[n]); pk.push_back(r.products[n]);
} }

View file

@ -519,7 +519,6 @@ namespace Cantera {
err("reactantStoichCoeff"); err("reactantStoichCoeff");
return -1.0; return -1.0;
} }
/** /**
* Stoichiometric coefficient of species k as a product in * Stoichiometric coefficient of species k as a product in
* reaction i. * reaction i.
@ -529,6 +528,11 @@ namespace Cantera {
return -1.0; return -1.0;
} }
virtual doublereal reactantOrder(int k, int i) const {
err("reactantOrder");
return -1.0;
}
/** /**
* Returns a read-only reference to the vector of reactant * Returns a read-only reference to the vector of reactant
* index numbers for reaction i. * index numbers for reaction i.

View file

@ -6,6 +6,28 @@
namespace Cantera { namespace Cantera {
/**
* Multiphase chemical equilibrium solver. Class MultiPhaseEquil
* is designed to be used to set a mixture containing one or more
* phases to a state of chemical equilibrium. It implements the
* VCS algorithm, described in Smith and Missen, "Chemical
* Reaction Equilibrium."
*
* This class only handles chemical equilibrium at a specified
* temperature and pressure. To compute equilibrium holding other
* properties fixed, it is necessary to iterate on T and P in an
* "outer" loop, until the specified properties have the desired
* values. This is done, for example, in method equilibrate of
* class MultiPhase.
*
* This class is primarily meant to be used internally by the
* equilibrate method of class MultiPhase, although there is no
* reason it cannot be used directly in application programs if
* desired.
*
* @ingroup equil
*/
class MultiPhaseEquil { class MultiPhaseEquil {
public: public:

View file

@ -224,7 +224,8 @@ namespace Cantera {
StoichManagerN* m_reactants; StoichManagerN* m_reactants;
StoichManagerN* m_revproducts; StoichManagerN* m_revproducts;
StoichManagerN* m_irrevproducts; StoichManagerN* m_irrevproducts;
StoichManagerN* m_global; // StoichManagerN* m_global;
vector_fp m_dummy;
}; };
} }

View file

@ -114,8 +114,8 @@ namespace Cantera {
public: public:
C1( int rxn = 0, int ic0 = 0, doublereal order = 1.0 ) C1( int rxn = 0, int ic0 = 0)
: m_rxn (rxn), m_ic0 (ic0), m_order(order) {} : m_rxn (rxn), m_ic0 (ic0) {}
int data(vector<int>& ic) { int data(vector<int>& ic) {
ic.resize(3); ic.resize(3);
@ -126,9 +126,6 @@ namespace Cantera {
void multiply(const doublereal* input, doublereal* output) const { void multiply(const doublereal* input, doublereal* output) const {
*(output + m_rxn) *= *(input + m_ic0); *(output + m_rxn) *= *(input + m_ic0);
} }
void power(const doublereal* input, doublereal* output) const {
output[m_rxn] *= ppow(input[m_ic0], m_order);
}
/** /**
* Add the sum of N specified elements of array 'input' * Add the sum of N specified elements of array 'input'
@ -154,7 +151,6 @@ namespace Cantera {
} }
private: private:
int m_rxn, m_ic0; int m_rxn, m_ic0;
doublereal m_order;
}; };
@ -165,10 +161,8 @@ namespace Cantera {
*/ */
class C2 { class C2 {
public: public:
C2( int rxn = 0, int ic0 = 0, int ic1 = 0, C2( int rxn = 0, int ic0 = 0, int ic1 = 0)
doublereal order0 = 1.0, doublereal order1 = 1.0 ) : m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1) {}
: m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1),
m_order0(order0), m_order1(order1) {}
int data(vector<int>& ic) { int data(vector<int>& ic) {
ic.resize(2); ic.resize(2);
@ -181,11 +175,6 @@ namespace Cantera {
output[m_rxn] *= input[m_ic0] * input[m_ic1]; output[m_rxn] *= input[m_ic0] * input[m_ic1];
} }
void power(const doublereal* input, doublereal* output) const {
output[m_rxn] *= ppow(input[m_ic0],m_order0) *
ppow(input[m_ic1],m_order1);
}
void incrementSpecies(const doublereal* input, void incrementSpecies(const doublereal* input,
doublereal* output) const { doublereal* output) const {
doublereal x = input[m_rxn]; doublereal x = input[m_rxn];
@ -222,7 +211,6 @@ namespace Cantera {
* two species. * two species.
*/ */
int m_ic0, m_ic1; int m_ic0, m_ic1;
doublereal m_order0, m_order1;
}; };
@ -250,11 +238,13 @@ namespace Cantera {
*(output + m_rxn) *= (*(input + m_ic0)) * (*(input + m_ic1)) *(output + m_rxn) *= (*(input + m_ic0)) * (*(input + m_ic1))
* (*(input + m_ic2)); * (*(input + m_ic2));
} }
void power(const doublereal* input, doublereal* output) const {
output[m_rxn] *= ppow(input[m_ic0],m_order0) * //void power(const doublereal* input, doublereal* output) const {
ppow(input[m_ic1],m_order1) * //output[m_rxn] *= ppow(input[m_ic0],m_order0) *
ppow(input[m_ic2],m_order2); // ppow(input[m_ic1],m_order1) *
} // ppow(input[m_ic2],m_order2);
//}
void incrementSpecies(const doublereal* input, void incrementSpecies(const doublereal* input,
doublereal* output) const { doublereal* output) const {
doublereal x = *(input + m_rxn); doublereal x = *(input + m_rxn);
@ -286,115 +276,124 @@ namespace Cantera {
/** /**
* Handles any number of species in a reaction. * Handles any number of species in a reaction, including fractional
* stoichiometric coefficients, and arbitrary reaction orders.
* @ingroup Stoichiometry * @ingroup Stoichiometry
*/ */
class C_AnyN { class C_AnyN {
public: public:
C_AnyN() : m_rxn (-1) {} C_AnyN() : m_rxn (-1) {}
C_AnyN( int rxn, const vector_int& ic, const vector_fp& order, C_AnyN( int rxn, const vector_int& ic, const vector_fp& order,
const vector_fp& stoich) const vector_fp& stoich)
: m_rxn (rxn) { : m_rxn (rxn) {
m_n = ic.size(); m_n = ic.size();
m_ic.resize(m_n); m_ic.resize(m_n);
m_order.resize(m_n); m_order.resize(m_n);
m_stoich.resize(m_n); m_stoich.resize(m_n);
for (int n = 0; n < m_n; n++) { for (int n = 0; n < m_n; n++) {
m_ic[n] = ic[n]; m_ic[n] = ic[n];
m_order[n] = order[n]; m_order[n] = order[n];
m_stoich[n] = stoich[n]; m_stoich[n] = stoich[n];
} }
} }
int data(vector<int>& ic) { int data(vector<int>& ic) {
ic.resize(m_n); ic.resize(m_n);
int n; int n;
for (n = 0; n < m_n; n++) ic[n] = m_ic[n]; for (n = 0; n < m_n; n++) ic[n] = m_ic[n];
return m_rxn; return m_rxn;
} }
//void power(const doublereal* input, doublereal* output) const {
// for (int n = 0; n < m_n; n++) output[m_rxn]
// *= ppow(input[m_ic[n]],m_order[n]);
//}
void power(const doublereal* input, doublereal* output) const { void multiply(const doublereal* input, doublereal* output) const {
for (int n = 0; n < m_n; n++) output[m_rxn] for (int n = 0; n < m_n; n++) output[m_rxn] *=
*= ppow(input[m_ic[n]],m_order[n]); ppow(input[m_ic[n]],m_order[n]); //input[m_ic[n]];
} }
void multiply(const doublereal* input, doublereal* output) const { void incrementSpecies(const doublereal* input,
for (int n = 0; n < m_n; n++) output[m_rxn] *= input[m_ic[n]]; doublereal* output) const {
} doublereal x = input[m_rxn];
for (int n = 0; n < m_n; n++) output[m_ic[n]] += m_stoich[n]*x;
}
void incrementSpecies(const doublereal* input, void decrementSpecies(const doublereal* input,
doublereal* output) const { doublereal* output) const {
doublereal x = input[m_rxn]; doublereal x = input[m_rxn];
for (int n = 0; n < m_n; n++) output[m_ic[n]] += m_stoich[n]*x; for (int n = 0; n < m_n; n++) output[m_ic[n]] -= m_stoich[n]*x;
} }
void decrementSpecies(const doublereal* input, /**
doublereal* output) const { * Increment R[I] by the sum of N specified elements of array S.
doublereal x = input[m_rxn]; */
for (int n = 0; n < m_n; n++) output[m_ic[n]] -= m_stoich[n]*x; void incrementReaction(const doublereal* input,
} doublereal* output) const {
for (int n = 0; n < m_n; n++) output[m_rxn]
+= m_stoich[n]*input[m_ic[n]];
}
/** /**
* Increment R[I] by the sum of N specified elements of array S. * Decrement R[I] by the sum of N specified elements of array S.
*/ */
void incrementReaction(const doublereal* input, void decrementReaction(const doublereal* input,
doublereal* output) const { doublereal* output) const {
for (int n = 0; n < m_n; n++) output[m_rxn] += m_stoich[n]*input[m_ic[n]]; for (int n = 0; n < m_n; n++) output[m_rxn]
} -= m_stoich[n]*input[m_ic[n]];
}
/** private:
* Decrement R[I] by the sum of N specified elements of array S. int m_n, m_rxn;
*/ vector_int m_ic;
void decrementReaction(const doublereal* input, vector_fp m_order;
doublereal* output) const { vector_fp m_stoich;
for (int n = 0; n < m_n; n++) output[m_rxn] -= m_stoich[n]*input[m_ic[n]]; };
}
private: template<class _InputIter, class Vec1, class Vec2>
int m_n, m_rxn;
vector_int m_ic;
vector_fp m_order;
vector_fp m_stoich;
};
template<class _InputIter, class Vec1, class Vec2>
inline static void _multiply(_InputIter __begin, _InputIter __end, inline static void _multiply(_InputIter __begin, _InputIter __end,
const Vec1& input, Vec2& output) { const Vec1& input, Vec2& output) {
for (; __begin != __end; ++__begin) for (; __begin != __end; ++__begin)
__begin->multiply(input, output); __begin->multiply(input, output);
} }
template<class _InputIter, class Vec1, class Vec2>
inline static void _power(_InputIter __begin, _InputIter __end, //template<class _InputIter, class Vec1, class Vec2>
const Vec1& input, Vec2& output) { //inline static void _power(_InputIter __begin, _InputIter __end,
for (; __begin != __end; ++__begin) // const Vec1& input, Vec2& output) {
__begin->power(input, output); //for (; __begin != __end; ++__begin)
} // __begin->power(input, output);
template<class _InputIter, class Vec1, class Vec2> //}
template<class _InputIter, class Vec1, class Vec2>
inline static void _incrementSpecies(_InputIter __begin, inline static void _incrementSpecies(_InputIter __begin,
_InputIter __end, const Vec1& input, Vec2& output) { _InputIter __end, const Vec1& input, Vec2& output) {
for (; __begin != __end; ++__begin) for (; __begin != __end; ++__begin)
__begin->incrementSpecies(input, output); __begin->incrementSpecies(input, output);
} }
template<class _InputIter, class Vec1, class Vec2>
template<class _InputIter, class Vec1, class Vec2>
inline static void _decrementSpecies(_InputIter __begin, inline static void _decrementSpecies(_InputIter __begin,
_InputIter __end, const Vec1& input, Vec2& output) { _InputIter __end, const Vec1& input, Vec2& output) {
for (; __begin != __end; ++__begin) for (; __begin != __end; ++__begin)
__begin->decrementSpecies(input, output); __begin->decrementSpecies(input, output);
} }
template<class _InputIter, class Vec1, class Vec2>
template<class _InputIter, class Vec1, class Vec2>
inline static void _incrementReactions(_InputIter __begin, inline static void _incrementReactions(_InputIter __begin,
_InputIter __end, const Vec1& input, Vec2& output) { _InputIter __end, const Vec1& input, Vec2& output) {
for (; __begin != __end; ++__begin) for (; __begin != __end; ++__begin)
__begin->incrementReaction(input, output); __begin->incrementReaction(input, output);
} }
template<class _InputIter, class Vec1, class Vec2>
template<class _InputIter, class Vec1, class Vec2>
inline static void _decrementReactions(_InputIter __begin, inline static void _decrementReactions(_InputIter __begin,
_InputIter __end, const Vec1& input, Vec2& output) { _InputIter __end, const Vec1& input, Vec2& output) {
for (; __begin != __end; ++__begin) for (; __begin != __end; ++__begin)
__begin->decrementReaction(input, output); __begin->decrementReaction(input, output);
} }
/* /*
@ -508,11 +507,11 @@ namespace Cantera {
switch (k.size()) { switch (k.size()) {
case 1: case 1:
m_loc[rxn] = static_cast<int>(m_c1_list.size()); m_loc[rxn] = static_cast<int>(m_c1_list.size());
m_c1_list.push_back(C1(rxn, k[0], order[0])); m_c1_list.push_back(C1(rxn, k[0]));
break; break;
case 2: case 2:
m_loc[rxn] = static_cast<int>(m_c2_list.size()); m_loc[rxn] = static_cast<int>(m_c2_list.size());
m_c2_list.push_back(C2(rxn, k[0], k[1], order[0], order[1])); m_c2_list.push_back(C2(rxn, k[0], k[1]));
break; break;
case 3: case 3:
m_loc[rxn] = static_cast<int>(m_c3_list.size()); m_loc[rxn] = static_cast<int>(m_c3_list.size());
@ -533,12 +532,12 @@ namespace Cantera {
_multiply(m_cn_list.begin(), m_cn_list.end(), input, output); _multiply(m_cn_list.begin(), m_cn_list.end(), input, output);
} }
void power(const doublereal* input, doublereal* output) const { //void power(const doublereal* input, doublereal* output) const {
_power(m_c1_list.begin(), m_c1_list.end(), input, output); //_power(m_c1_list.begin(), m_c1_list.end(), input, output);
_power(m_c2_list.begin(), m_c2_list.end(), input, output); //_power(m_c2_list.begin(), m_c2_list.end(), input, output);
_power(m_c3_list.begin(), m_c3_list.end(), input, output); //_power(m_c3_list.begin(), m_c3_list.end(), input, output);
_power(m_cn_list.begin(), m_cn_list.end(), input, output); //_power(m_cn_list.begin(), m_cn_list.end(), input, output);
} //}
void incrementSpecies(const doublereal* input, doublereal* output) const { void incrementSpecies(const doublereal* input, doublereal* output) const {
_incrementSpecies(m_c1_list.begin(), m_c1_list.end(), input, output); _incrementSpecies(m_c1_list.begin(), m_c1_list.end(), input, output);

View file

@ -12,10 +12,14 @@
namespace Cantera { namespace Cantera {
/** /**
* Set a mixture to a state of chemical equilibrium. The flag 'XY' * Set a multiphase mixture to a state of chemical equilibrium.
* determines the two properties that will be held fixed in the * This is the top-level driver for multiphase equilibrium. It
* calculation. * doesn't do much more than call the equilibrate method of class
* MultiPhase, except that it adds some messages to the logfile,
* if loglevel is set > 0.
*
* @ingroup equil
*/ */
doublereal equilibrate(MultiPhase& s, const char* XY, doublereal equilibrate(MultiPhase& s, const char* XY,
doublereal tol, int maxsteps, int maxiter, doublereal tol, int maxsteps, int maxiter,
@ -54,24 +58,36 @@ namespace Cantera {
} }
} }
/// Set a single-phase chemical solution to chemical equilibrium. /// Set a single-phase chemical solution to chemical equilibrium.
/// This is a convenience function that uses one or the other of /// This is a convenience function that uses one or the other of
/// the two chemical equilibrium solvers. @param The object to /// the two chemical equilibrium solvers.
/// set to an equilibrium state @param XY An integer specifying ///
/// the two properties to be held constant. @param solver The /// @param s The object to set to an equilibrium state
/// equilibrium solver to use. If solver = 0, the ChemEquil solver ///
/// will be used, and if solver = 1, the MultiPhaseEquil solver /// @param XY An integer specifying the two properties to be held
/// will be used (slower than ChemEquil, but more stable). If /// constant.
/// solver < 0 (default, then ChemEquil will be tried first, and ///
/// if it fails MultiPhaseEquil will be tried. @param maxsteps /// @param solver The equilibrium solver to use. If solver = 0,
/// The maximum number of steps to take to find the solution. /// the ChemEquil solver will be used, and if solver = 1, the
/// MultiPhaseEquil solver will be used (slower than ChemEquil,
/// but more stable). If solver < 0 (default, then ChemEquil will
/// be tried first, and if it fails MultiPhaseEquil will be tried.
///
/// @param maxsteps The maximum number of steps to take to find
/// the solution.
///
/// @param maxiter For the MultiPhaseEquil solver only, this is /// @param maxiter For the MultiPhaseEquil solver only, this is
/// the maximum number of outer temperature or pressure iterations /// the maximum number of outer temperature or pressure iterations
/// to take when T and/or P is not held fixed. @param loglevel /// to take when T and/or P is not held fixed.
/// Controls amount of diagnostic output. loglevel = 0 suppresses ///
/// diagnostics, and increasingly-verbose messages are written as /// @param loglevel Controls amount of diagnostic output. loglevel
/// loglevel increases. The messages are written to a file in HTML /// = 0 suppresses diagnostics, and increasingly-verbose messages
/// format for viewing in a web browser. /// are written as loglevel increases. The messages are written to
/// a file in HTML format for viewing in a web browser.
/// @see HTML_logs
///
/// @ingroup equil
void equilibrate(thermo_t& s, const char* XY, int solver, void equilibrate(thermo_t& s, const char* XY, int solver,
doublereal rtol, int maxsteps, int maxiter, int loglevel) { doublereal rtol, int maxsteps, int maxiter, int loglevel) {

View file

@ -53,7 +53,7 @@ namespace Cantera {
* elements balance. * elements balance.
*/ */
void checkRxnElementBalance(Kinetics& kin, void checkRxnElementBalance(Kinetics& kin,
const ReactionData &rdata, doublereal errorTolerance = 1.0e-6); const ReactionData &rdata, doublereal errorTolerance = 1.0e-3);
/** /**
* Extract the rate coefficient for a reaction from the xml node, kf. * Extract the rate coefficient for a reaction from the xml node, kf.
* kf should point to a XML element named "rateCoeff". * kf should point to a XML element named "rateCoeff".

View file

@ -225,10 +225,12 @@ else
endif endif
example_codes: example_codes:
(cd examples/cxx; @MAKE@) (cd examples/cxx; @MAKE@ clean; @MAKE@)
(cd Cantera/cxx/demos; @MAKE@ clean)
(cd Cantera/cxx; @MAKE@) (cd Cantera/cxx; @MAKE@)
test: example_codes datafiles test: example_codes datafiles
cd test_problems; @MAKE@ clean
cd test_problems; @MAKE@ all cd test_problems; @MAKE@ all
cd test_problems; @MAKE@ test cd test_problems; @MAKE@ test

6
configure vendored
View file

@ -76,13 +76,13 @@ USE_NUMERIC=${USE_NUMERIC:="default"}
# If numarray was installed using the --home option, set this to the # If numarray was installed using the --home option, set this to the
# home directory for numarray. # home directory for numarray.
NUMARRAY_HOME=${NUMARRAY_HOME:="$HOME/python_modules"} #NUMARRAY_HOME=${NUMARRAY_HOME:="$HOME/python_modules"}
# If you want to install the Cantera Python package somewhere other # If you want to install the Cantera Python package somewhere other
# than the default 'site-packages' directory within the Python library # than the default 'site-packages' directory within the Python library
# directory, then set this to the desired directory. This is useful when # directory, then set this to the desired directory. This is useful when
# you do not have write access to the Python library directory. # you do not have write access to the Python library directory.
CANTERA_PYTHON_HOME=${CANTERA_PYTHON_HOME:="$HOME/python_modules"} #CANTERA_PYTHON_HOME=${CANTERA_PYTHON_HOME:="$HOME/python_modules"}
# Set this to 'y' when site packages must be put in system directories # Set this to 'y' when site packages must be put in system directories
# but Cantera tutorials must be put in user space. An alternative to # but Cantera tutorials must be put in user space. An alternative to
@ -229,7 +229,7 @@ ENABLE_TPX='y'
# (The settings shown here are appropriate if you are using the ATLAS # (The settings shown here are appropriate if you are using the ATLAS
# libraries.) # libraries.)
# #
BLAS_LAPACK_LIBS='-llapack -lblas' #BLAS_LAPACK_LIBS='-llapack -lblas'
#'-llapack -lf77blas -lcblas -latlas' #'-llapack -lf77blas -lcblas -latlas'
#BLAS_LAPACK_DIR='/usr/lib' #BLAS_LAPACK_DIR='/usr/lib'
# #

View file

@ -1,2 +1,4 @@
#define IEEE_8087 #define IEEE_MC68k
#define Arith_Kind_ASL 1 #define Arith_Kind_ASL 2
#define Double_Align
#define NANCHECK

View file

@ -1,3 +1,5 @@
! modified to add a few 'D' and 'd' exponents. DGG 7/23/05
!
! GRI-Mech Version 3.0 3/12/99 CHEMKIN-II format ! GRI-Mech Version 3.0 3/12/99 CHEMKIN-II format
! See README30 file at anonymous FTP site unix.sri.com, directory gri; ! See README30 file at anonymous FTP site unix.sri.com, directory gri;
! WorldWideWeb home page http://www.me.berkeley.edu/gri_mech/ or ! WorldWideWeb home page http://www.me.berkeley.edu/gri_mech/ or
@ -23,18 +25,18 @@ O L 1/90O 1 00 00 00G 200.000 3500.000 1000.000 1
-6.12806624E-09 2.11265971E-12 2.91222592E+04 2.05193346E+00 4 -6.12806624E-09 2.11265971E-12 2.91222592E+04 2.05193346E+00 4
O2 TPIS89O 2 00 00 00G 200.000 3500.000 1000.000 1 O2 TPIS89O 2 00 00 00G 200.000 3500.000 1000.000 1
3.28253784E+00 1.48308754E-03-7.57966669E-07 2.09470555E-10-2.16717794E-14 2 3.28253784E+00 1.48308754E-03-7.57966669E-07 2.09470555E-10-2.16717794E-14 2
-1.08845772E+03 5.45323129E+00 3.78245636E+00-2.99673416E-03 9.84730201E-06 3 -1.08845772D+03 5.45323129E+00 3.78245636E+00-2.99673416E-03 9.84730201d-06 3
-9.68129509E-09 3.24372837E-12-1.06394356E+03 3.65767573E+00 4 -9.68129509E-09 3.24372837E-12-1.06394356E+03 3.65767573E+00 4
H L 7/88H 1 00 00 00G 200.000 3500.000 1000.000 1 H L 7/88H 1 00 00 00G 200.000 3500.000 1000.000 1
2.50000001E+00-2.30842973E-11 1.61561948E-14-4.73515235E-18 4.98197357E-22 2 2.50000001E+00-2.30842973E-11 1.61561948E-14-4.73515235E-18 4.98197357E-22 2
2.54736599E+04-4.46682914E-01 2.50000000E+00 7.05332819E-13-1.99591964E-15 3 2.54736599d+04-4.46682914E-01 2.50000000E+00 7.05332819E-13-1.99591964E-15 3
2.30081632E-18-9.27732332E-22 2.54736599E+04-4.46682853E-01 4 2.30081632E-18-9.27732332E-22 2.54736599E+04-4.46682853E-01 4
H2 TPIS78H 2 00 00 00G 200.000 3500.000 1000.000 1 H2 TPIS78H 2 00 00 00G 200.000 3500.000 1000.000 1
3.33727920E+00-4.94024731E-05 4.99456778E-07-1.79566394E-10 2.00255376E-14 2 3.33727920E+00-4.94024731E-05 4.99456778E-07-1.79566394E-10 2.00255376E-14 2
-9.50158922E+02-3.20502331E+00 2.34433112E+00 7.98052075E-03-1.94781510E-05 3 -9.50158922E+02-3.20502331E+00 2.34433112E+00 7.98052075E-03-1.94781510E-05 3
2.01572094E-08-7.37611761E-12-9.17935173E+02 6.83010238E-01 4 2.01572094E-08-7.37611761E-12-9.17935173E+02 6.83010238E-01 4
OH RUS 78O 1H 1 00 00G 200.000 3500.000 1000.000 1 OH RUS 78O 1H 1 00 00G 200.000 3500.000 1000.000 1
3.09288767E+00 5.48429716E-04 1.26505228E-07-8.79461556E-11 1.17412376E-14 2 3.09288767E+00 5.48429716E-04 1.26505228E-07-8.79461556E-11 1.17412376D-14 2
3.85865700E+03 4.47669610E+00 3.99201543E+00-2.40131752E-03 4.61793841E-06 3 3.85865700E+03 4.47669610E+00 3.99201543E+00-2.40131752E-03 4.61793841E-06 3
-3.88113333E-09 1.36411470E-12 3.61508056E+03-1.03925458E-01 4 -3.88113333E-09 1.36411470E-12 3.61508056E+03-1.03925458E-01 4
H2O L 8/89H 2O 1 00 00G 200.000 3500.000 1000.000 1 H2O L 8/89H 2O 1 00 00G 200.000 3500.000 1000.000 1

View file

@ -100,7 +100,7 @@ reaction( "H2O => 1.4 H + 0.6 OH + 0.2 O2", [1.0e13, 0.0, 0.0])
#reaction( "H2O <=> 1.3 H + 0.7 OH + 0.15 O2", [1.0e13, 0.0, 0.0]) #reaction( "H2O <=> 1.3 H + 0.7 OH + 0.15 O2", [1.0e13, 0.0, 0.0])
# A reaction with fractional reactant stoichiometric # A reaction with fractional reactant stoichiometric
# coefficients. This is not allowed, and uncommenting this line will # coefficients.
# result in an error. reaction( "1.4 H + 0.6 OH + 0.2 O2 => H2O", [1.0e13, 0.0, 0.0],
#reaction( "1.4 H + 0.6 OH + 0.2 O2 => H2O", [1.0e13, 0.0, 0.0]) order = "H:0.8 OH:2 O2:1")

View file

@ -3,7 +3,7 @@
from Cantera import * from Cantera import *
gas = importPhase('frac.cti') gas = importPhase('frac.cti')
gas.set(T = 2000, P = OneAtm, X = 'H2O:1.0, OH:0.1') gas.set(T = 2000, P = OneAtm, X = 'H2O:1.0, OH:0.1, H:0.2, O2:0.3')
fwd_rop = gas.fwdRatesOfProgress() fwd_rop = gas.fwdRatesOfProgress()
cdot = gas.creationRates() cdot = gas.creationRates()
@ -22,6 +22,23 @@ for k in range(nsp):
cdot[k], cdot[k]/fwd_rop[0]) cdot[k], cdot[k]/fwd_rop[0])
# print the arrays of reactant and product stoichiometric coefficients # print the arrays of reactant and product stoichiometric coefficients
x = gas.moleFractions()
c = gas.molarDensity() * x
ih2, ih, io, io2, ioh, ih2o = gas.speciesIndex(['H2','H','O','O2','OH','H2O'])
#rxn 2 orders
order_H = 0.8
order_OH = 2.0
order_O2 = 1.0
kf = gas.fwdRateConstants()
cproduct = pow(c[ih],order_H) * pow(c[ioh], order_OH) * pow(c[io2], order_O2)
print fwd_rop[1], cproduct*kf[1]
print gas.reactantStoichCoeffs() print gas.reactantStoichCoeffs()
print gas.productStoichCoeffs() print gas.productStoichCoeffs()

View file

@ -1,4 +1,3 @@
adding fractional reaction
H2O => 1.3999999999999999 H + 0.20000000000000001 O2 + 0.59999999999999998 OH H2O => 1.3999999999999999 H + 0.20000000000000001 O2 + 0.59999999999999998 OH
H2 0.0000e+00 0.0000e+00 H2 0.0000e+00 0.0000e+00
H 7.7551e+10 1.4000e+00 H 7.7551e+10 1.4000e+00