diff --git a/Cantera/matlab/setup_matlab.py.in b/Cantera/matlab/setup_matlab.py.in index d00cc50e3..2b04c4117 100644 --- a/Cantera/matlab/setup_matlab.py.in +++ b/Cantera/matlab/setup_matlab.py.in @@ -2,7 +2,7 @@ import sys bindir = '@ct_bindir@' - libdir = '-L@buildlib@ @LOCAL_LIB_DIRS@' +libdir = '-L@buildlib@ @LOCAL_LIB_DIRS@' incdir = '@buildinc@' libs = '-lclib @LOCAL_LIBS@ @LIBS@ @FLIBS@' diff --git a/Cantera/python/ctml_writer.py b/Cantera/python/ctml_writer.py index 69c1c4ea2..a3f29dcc5 100644 --- a/Cantera/python/ctml_writer.py +++ b/Cantera/python/ctml_writer.py @@ -358,8 +358,8 @@ def getReactionSpecies(s): # try to convert the token to a number. try: n = float(t) - if n <= 0.0: - raise CTI_Error("zero or negative stoichiometric coefficient:" + if n < 0.0: + raise CTI_Error("negative stoichiometric coefficient:" +s) #if t > '0' and t < '9': diff --git a/Cantera/src/ChemEquil.h b/Cantera/src/ChemEquil.h index b59a5809c..b7c47e9a1 100755 --- a/Cantera/src/ChemEquil.h +++ b/Cantera/src/ChemEquil.h @@ -66,7 +66,12 @@ namespace Cantera { 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 * the terminology of Smith and Missen, meaning that every * 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 * important, this solver should be tried first, and if it fails * then use MultiPhaseEquil. + * @ingroup equil */ class ChemEquil { diff --git a/Cantera/src/EdgeKinetics.cpp b/Cantera/src/EdgeKinetics.cpp index 01c1e9118..146c48299 100644 --- a/Cantera/src/EdgeKinetics.cpp +++ b/Cantera/src/EdgeKinetics.cpp @@ -309,7 +309,7 @@ namespace Cantera { m_revProductStoich.multiply(m_conc.begin(), ropr.begin()); // 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) { ropnet[j] = ropf[j] - ropr[j]; diff --git a/Cantera/src/GasKinetics.cpp b/Cantera/src/GasKinetics.cpp index dc9cc34f5..7c813a869 100755 --- a/Cantera/src/GasKinetics.cpp +++ b/Cantera/src/GasKinetics.cpp @@ -556,7 +556,8 @@ namespace Cantera { int nr = r.reactants.size(); for (n = 0; n < nr; 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++) { rk.push_back(r.reactants[n]); } @@ -567,7 +568,8 @@ namespace Cantera { int np = r.products.size(); for (n = 0; n < np; 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++) { pk.push_back(r.products[n]); } diff --git a/Cantera/src/Kinetics.h b/Cantera/src/Kinetics.h index deec33c95..dfb174741 100755 --- a/Cantera/src/Kinetics.h +++ b/Cantera/src/Kinetics.h @@ -519,7 +519,6 @@ namespace Cantera { err("reactantStoichCoeff"); return -1.0; } - /** * Stoichiometric coefficient of species k as a product in * reaction i. @@ -529,6 +528,11 @@ namespace Cantera { 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 * index numbers for reaction i. diff --git a/Cantera/src/MultiPhaseEquil.h b/Cantera/src/MultiPhaseEquil.h index 5335c600d..5023cfee9 100644 --- a/Cantera/src/MultiPhaseEquil.h +++ b/Cantera/src/MultiPhaseEquil.h @@ -6,6 +6,28 @@ 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 { public: diff --git a/Cantera/src/ReactionStoichMgr.h b/Cantera/src/ReactionStoichMgr.h index 8c4a86d9a..12e27af0b 100644 --- a/Cantera/src/ReactionStoichMgr.h +++ b/Cantera/src/ReactionStoichMgr.h @@ -224,7 +224,8 @@ namespace Cantera { StoichManagerN* m_reactants; StoichManagerN* m_revproducts; StoichManagerN* m_irrevproducts; - StoichManagerN* m_global; + // StoichManagerN* m_global; + vector_fp m_dummy; }; } diff --git a/Cantera/src/StoichManager.h b/Cantera/src/StoichManager.h index 50c5fc4d2..18ac28a63 100755 --- a/Cantera/src/StoichManager.h +++ b/Cantera/src/StoichManager.h @@ -114,8 +114,8 @@ namespace Cantera { public: - C1( int rxn = 0, int ic0 = 0, doublereal order = 1.0 ) - : m_rxn (rxn), m_ic0 (ic0), m_order(order) {} + C1( int rxn = 0, int ic0 = 0) + : m_rxn (rxn), m_ic0 (ic0) {} int data(vector& ic) { ic.resize(3); @@ -126,9 +126,6 @@ namespace Cantera { void multiply(const doublereal* input, doublereal* output) const { *(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' @@ -154,7 +151,6 @@ namespace Cantera { } private: int m_rxn, m_ic0; - doublereal m_order; }; @@ -165,10 +161,8 @@ namespace Cantera { */ class C2 { public: - 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_order0(order0), m_order1(order1) {} + C2( int rxn = 0, int ic0 = 0, int ic1 = 0) + : m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1) {} int data(vector& ic) { ic.resize(2); @@ -181,11 +175,6 @@ namespace Cantera { 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, doublereal* output) const { doublereal x = input[m_rxn]; @@ -222,7 +211,6 @@ namespace Cantera { * two species. */ 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)) * (*(input + m_ic2)); } - void power(const doublereal* input, doublereal* output) const { - output[m_rxn] *= ppow(input[m_ic0],m_order0) * - ppow(input[m_ic1],m_order1) * - ppow(input[m_ic2],m_order2); - } + + //void power(const doublereal* input, doublereal* output) const { + //output[m_rxn] *= ppow(input[m_ic0],m_order0) * + // ppow(input[m_ic1],m_order1) * + // ppow(input[m_ic2],m_order2); + //} + void incrementSpecies(const doublereal* input, doublereal* output) const { 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 */ - class C_AnyN { - public: - C_AnyN() : m_rxn (-1) {} + class C_AnyN { + public: + C_AnyN() : m_rxn (-1) {} - C_AnyN( int rxn, const vector_int& ic, const vector_fp& order, - const vector_fp& stoich) - : m_rxn (rxn) { - m_n = ic.size(); - m_ic.resize(m_n); - m_order.resize(m_n); - m_stoich.resize(m_n); - for (int n = 0; n < m_n; n++) { - m_ic[n] = ic[n]; - m_order[n] = order[n]; - m_stoich[n] = stoich[n]; - } - } + C_AnyN( int rxn, const vector_int& ic, const vector_fp& order, + const vector_fp& stoich) + : m_rxn (rxn) { + m_n = ic.size(); + m_ic.resize(m_n); + m_order.resize(m_n); + m_stoich.resize(m_n); + for (int n = 0; n < m_n; n++) { + m_ic[n] = ic[n]; + m_order[n] = order[n]; + m_stoich[n] = stoich[n]; + } + } - int data(vector& ic) { - ic.resize(m_n); - int n; - for (n = 0; n < m_n; n++) ic[n] = m_ic[n]; - return m_rxn; - } + int data(vector& ic) { + ic.resize(m_n); + int n; + for (n = 0; n < m_n; n++) ic[n] = m_ic[n]; + 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 { - for (int n = 0; n < m_n; n++) output[m_rxn] - *= ppow(input[m_ic[n]],m_order[n]); - } + void multiply(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]); //input[m_ic[n]]; + } - void multiply(const doublereal* input, doublereal* output) const { - for (int n = 0; n < m_n; n++) output[m_rxn] *= input[m_ic[n]]; - } + void incrementSpecies(const doublereal* input, + 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, - 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 decrementSpecies(const doublereal* input, + 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 decrementSpecies(const doublereal* input, - doublereal* output) const { - doublereal x = input[m_rxn]; - for (int n = 0; n < m_n; n++) output[m_ic[n]] -= m_stoich[n]*x; - } + /** + * Increment R[I] by the sum of N specified elements of array S. + */ + 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. - */ - 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]]; - } + /** + * Decrement R[I] by the sum of N specified elements of array S. + */ + void decrementReaction(const doublereal* input, + doublereal* output) const { + for (int n = 0; n < m_n; n++) output[m_rxn] + -= m_stoich[n]*input[m_ic[n]]; + } - /** - * Decrement R[I] by the sum of N specified elements of array S. - */ - void decrementReaction(const doublereal* input, - doublereal* output) const { - for (int n = 0; n < m_n; n++) output[m_rxn] -= m_stoich[n]*input[m_ic[n]]; - } + private: + int m_n, m_rxn; + vector_int m_ic; + vector_fp m_order; + vector_fp m_stoich; + }; + - private: - int m_n, m_rxn; - vector_int m_ic; - vector_fp m_order; - vector_fp m_stoich; - }; - - - template + template inline static void _multiply(_InputIter __begin, _InputIter __end, - const Vec1& input, Vec2& output) { - for (; __begin != __end; ++__begin) - __begin->multiply(input, output); - } - template - inline static void _power(_InputIter __begin, _InputIter __end, - const Vec1& input, Vec2& output) { - for (; __begin != __end; ++__begin) - __begin->power(input, output); - } - template + const Vec1& input, Vec2& output) { + for (; __begin != __end; ++__begin) + __begin->multiply(input, output); + } + + //template + //inline static void _power(_InputIter __begin, _InputIter __end, + // const Vec1& input, Vec2& output) { + //for (; __begin != __end; ++__begin) + // __begin->power(input, output); + //} + + template inline static void _incrementSpecies(_InputIter __begin, - _InputIter __end, const Vec1& input, Vec2& output) { - for (; __begin != __end; ++__begin) - __begin->incrementSpecies(input, output); - } - template + _InputIter __end, const Vec1& input, Vec2& output) { + for (; __begin != __end; ++__begin) + __begin->incrementSpecies(input, output); + } + + template inline static void _decrementSpecies(_InputIter __begin, - _InputIter __end, const Vec1& input, Vec2& output) { - for (; __begin != __end; ++__begin) - __begin->decrementSpecies(input, output); - } - template + _InputIter __end, const Vec1& input, Vec2& output) { + for (; __begin != __end; ++__begin) + __begin->decrementSpecies(input, output); + } + + template inline static void _incrementReactions(_InputIter __begin, - _InputIter __end, const Vec1& input, Vec2& output) { - for (; __begin != __end; ++__begin) - __begin->incrementReaction(input, output); - } - template + _InputIter __end, const Vec1& input, Vec2& output) { + for (; __begin != __end; ++__begin) + __begin->incrementReaction(input, output); + } + + template inline static void _decrementReactions(_InputIter __begin, - _InputIter __end, const Vec1& input, Vec2& output) { - for (; __begin != __end; ++__begin) - __begin->decrementReaction(input, output); - } + _InputIter __end, const Vec1& input, Vec2& output) { + for (; __begin != __end; ++__begin) + __begin->decrementReaction(input, output); + } /* @@ -508,11 +507,11 @@ namespace Cantera { switch (k.size()) { case 1: m_loc[rxn] = static_cast(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; case 2: m_loc[rxn] = static_cast(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; case 3: m_loc[rxn] = static_cast(m_c3_list.size()); @@ -533,12 +532,12 @@ namespace Cantera { _multiply(m_cn_list.begin(), m_cn_list.end(), input, output); } - void power(const doublereal* input, doublereal* output) const { - _power(m_c1_list.begin(), m_c1_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_cn_list.begin(), m_cn_list.end(), input, output); - } + //void power(const doublereal* input, doublereal* output) const { + //_power(m_c1_list.begin(), m_c1_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_cn_list.begin(), m_cn_list.end(), input, output); + //} void incrementSpecies(const doublereal* input, doublereal* output) const { _incrementSpecies(m_c1_list.begin(), m_c1_list.end(), input, output); diff --git a/Cantera/src/equilibrate.cpp b/Cantera/src/equilibrate.cpp index 9165de063..2eb2362de 100644 --- a/Cantera/src/equilibrate.cpp +++ b/Cantera/src/equilibrate.cpp @@ -12,10 +12,14 @@ namespace Cantera { - /** - * Set a mixture to a state of chemical equilibrium. The flag 'XY' - * determines the two properties that will be held fixed in the - * calculation. + /** + * Set a multiphase mixture to a state of chemical equilibrium. + * This is the top-level driver for multiphase equilibrium. It + * 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 tol, int maxsteps, int maxiter, @@ -54,24 +58,36 @@ namespace Cantera { } } + /// Set a single-phase chemical solution to chemical equilibrium. /// This is a convenience function that uses one or the other of - /// the two chemical equilibrium solvers. @param The object to - /// set to an equilibrium state @param XY An integer specifying - /// the two properties to be held constant. @param solver The - /// equilibrium solver to use. If solver = 0, 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. + /// the two chemical equilibrium solvers. + /// + /// @param s The object to set to an equilibrium state + /// + /// @param XY An integer specifying the two properties to be held + /// constant. + /// + /// @param solver The equilibrium solver to use. If solver = 0, + /// 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 /// the maximum number of outer temperature or pressure iterations - /// to take when T and/or P is not held fixed. @param loglevel - /// Controls amount of diagnostic output. loglevel = 0 suppresses - /// diagnostics, and increasingly-verbose messages are written as - /// loglevel increases. The messages are written to a file in HTML - /// format for viewing in a web browser. + /// to take when T and/or P is not held fixed. + /// + /// @param loglevel Controls amount of diagnostic output. loglevel + /// = 0 suppresses diagnostics, and increasingly-verbose messages + /// 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, doublereal rtol, int maxsteps, int maxiter, int loglevel) { diff --git a/Cantera/src/importCTML.h b/Cantera/src/importCTML.h index 15acf03c4..e5dd00547 100755 --- a/Cantera/src/importCTML.h +++ b/Cantera/src/importCTML.h @@ -53,7 +53,7 @@ namespace Cantera { * elements balance. */ 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. * kf should point to a XML element named "rateCoeff". diff --git a/Makefile.in b/Makefile.in index 4e7cb7383..3035774c9 100755 --- a/Makefile.in +++ b/Makefile.in @@ -225,10 +225,12 @@ else endif example_codes: - (cd examples/cxx; @MAKE@) + (cd examples/cxx; @MAKE@ clean; @MAKE@) + (cd Cantera/cxx/demos; @MAKE@ clean) (cd Cantera/cxx; @MAKE@) test: example_codes datafiles + cd test_problems; @MAKE@ clean cd test_problems; @MAKE@ all cd test_problems; @MAKE@ test diff --git a/configure b/configure index 22f22aa1d..e96b57e18 100755 --- a/configure +++ b/configure @@ -76,13 +76,13 @@ USE_NUMERIC=${USE_NUMERIC:="default"} # If numarray was installed using the --home option, set this to the # 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 # than the default 'site-packages' directory within the Python library # directory, then set this to the desired directory. This is useful when # 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 # 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 # libraries.) # -BLAS_LAPACK_LIBS='-llapack -lblas' +#BLAS_LAPACK_LIBS='-llapack -lblas' #'-llapack -lf77blas -lcblas -latlas' #BLAS_LAPACK_DIR='/usr/lib' # diff --git a/ext/f2c_libs/arith.h b/ext/f2c_libs/arith.h index 76539f82b..508eb414f 100644 --- a/ext/f2c_libs/arith.h +++ b/ext/f2c_libs/arith.h @@ -1,2 +1,4 @@ -#define IEEE_8087 -#define Arith_Kind_ASL 1 +#define IEEE_MC68k +#define Arith_Kind_ASL 2 +#define Double_Align +#define NANCHECK diff --git a/test_problems/ck2cti_test/gri30.inp b/test_problems/ck2cti_test/gri30.inp index 11f4ab71b..b88612d07 100644 --- a/test_problems/ck2cti_test/gri30.inp +++ b/test_problems/ck2cti_test/gri30.inp @@ -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 ! See README30 file at anonymous FTP site unix.sri.com, directory gri; ! 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 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 --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 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.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 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 -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 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.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 diff --git a/test_problems/python/frac.cti b/test_problems/python/frac.cti index 321a820fa..19cfd8d56 100644 --- a/test_problems/python/frac.cti +++ b/test_problems/python/frac.cti @@ -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]) # A reaction with fractional reactant stoichiometric -# coefficients. This is not allowed, and uncommenting this line will -# result in an error. -#reaction( "1.4 H + 0.6 OH + 0.2 O2 => H2O", [1.0e13, 0.0, 0.0]) +# coefficients. +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") diff --git a/test_problems/python/frac.py b/test_problems/python/frac.py index 0038ff7f1..83367b436 100644 --- a/test_problems/python/frac.py +++ b/test_problems/python/frac.py @@ -3,7 +3,7 @@ from Cantera import * 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() cdot = gas.creationRates() @@ -22,6 +22,23 @@ for k in range(nsp): cdot[k], cdot[k]/fwd_rop[0]) # 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.productStoichCoeffs() diff --git a/test_problems/python/frac_blessed.out b/test_problems/python/frac_blessed.out index c1d0f145f..b03b15bf4 100644 --- a/test_problems/python/frac_blessed.out +++ b/test_problems/python/frac_blessed.out @@ -1,4 +1,3 @@ -adding fractional reaction H2O => 1.3999999999999999 H + 0.20000000000000001 O2 + 0.59999999999999998 OH H2 0.0000e+00 0.0000e+00 H 7.7551e+10 1.4000e+00