*** empty log message ***
This commit is contained in:
parent
4350fc9bb7
commit
120dca66c7
19 changed files with 913 additions and 785 deletions
|
|
@ -781,6 +781,9 @@ class phase(writer):
|
|||
self._sp = []
|
||||
self._rx = []
|
||||
self._options = options
|
||||
self.debug = 0
|
||||
if 'debug' in options:
|
||||
self.debug = 1
|
||||
|
||||
#--------------------------------
|
||||
# process species
|
||||
|
|
@ -943,12 +946,15 @@ class ideal_gas(phase):
|
|||
transport = 'None',
|
||||
initial_state = None,
|
||||
options = []):
|
||||
|
||||
|
||||
print 'ig options = ',options
|
||||
phase.__init__(self, name, 3, elements, species, reactions,
|
||||
initial_state, options)
|
||||
self._pure = 0
|
||||
self._kin = kinetics
|
||||
self._tr = transport
|
||||
if self.debug:
|
||||
print 'Read ideal_gas entry '+self._name
|
||||
|
||||
|
||||
def build(self, p):
|
||||
|
|
@ -1198,7 +1204,10 @@ if __name__ == "__main__":
|
|||
# $Revision$
|
||||
# $Date$
|
||||
# $Log$
|
||||
# Revision 1.22 2003-11-01 04:48:20 dggoodwin
|
||||
# Revision 1.23 2003-11-12 18:58:15 dggoodwin
|
||||
# *** empty log message ***
|
||||
#
|
||||
# Revision 1.22 2003/11/01 04:48:20 dggoodwin
|
||||
# added capability to have species names with embedded commas
|
||||
#
|
||||
# Revision 1.21 2003/10/14 06:48:07 dggoodwin
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ tburner = 373.0 # burner temperature
|
|||
mdot = 0.06 # kg/m^2/s
|
||||
|
||||
rxnmech = 'h2o2.cti' # reaction mechanism file
|
||||
mix = 'ohmech' # gas mixture model
|
||||
comp = 'H2:1.8, O2:1, AR:7' # premixed gas composition
|
||||
|
||||
# The solution domain is chosen to be 50 cm, and a point very near the
|
||||
|
|
@ -40,7 +41,7 @@ refine_grid = 1 # 1 to enable refinement, 0 to
|
|||
# This object will be used to evaluate all thermodynamic, kinetic,
|
||||
# and transport properties
|
||||
#
|
||||
gas = IdealGasMix(rxnmech)
|
||||
gas = IdealGasMix(rxnmech, mix)
|
||||
|
||||
# set its state to that of the unburned gas at the burner
|
||||
gas.setState_TPX(tburner, p, comp)
|
||||
|
|
|
|||
|
|
@ -15,10 +15,6 @@
|
|||
#ifndef CT_ARRAYVIEWER_H
|
||||
#define CT_ARRAYVIEWER_H
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#include "ct_defs.h"
|
||||
#include "ctexceptions.h"
|
||||
#include "stringUtils.h"
|
||||
|
|
|
|||
|
|
@ -14,10 +14,6 @@
|
|||
#ifndef CT_BANDMATRIX_H
|
||||
#define CT_BANDMATRIX_H
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#include "ct_defs.h"
|
||||
#include "ctlapack.h"
|
||||
#include "utilities.h"
|
||||
|
|
|
|||
|
|
@ -16,12 +16,6 @@
|
|||
#define CT_CHEM_EQUIL_H
|
||||
|
||||
|
||||
// STL includes
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
|
||||
// Cantera includes
|
||||
#include "ct_defs.h"
|
||||
#include "vec_functions.h"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "Constituents.h"
|
||||
#include "Elements.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
namespace Cantera {
|
||||
|
|
|
|||
|
|
@ -1,21 +1,22 @@
|
|||
/**
|
||||
* @file Constituents.h
|
||||
* Header file for class Constituents
|
||||
*
|
||||
* $Author$
|
||||
|
||||
/// @file Constituents.h
|
||||
/// Header file for class Constituents
|
||||
|
||||
|
||||
/* $Author$
|
||||
* $Date$
|
||||
* $Revision$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.4 2003-09-03 18:15:50 hkmoffa
|
||||
* Revision 1.5 2003-11-12 18:58:17 dggoodwin
|
||||
* *** empty log message ***
|
||||
*
|
||||
* Revision 1.4 2003/09/03 18:15:50 hkmoffa
|
||||
* Added a vector get for the atoms in a species.
|
||||
*
|
||||
* Revision 1.3 2003/07/21 16:02:53 hkmoffa
|
||||
* Took out a double nested @name that gave a warning to doxygen
|
||||
*
|
||||
* Revision 1.2 2003/06/27 14:19:16 dggoodwin
|
||||
* *** empty log message ***
|
||||
*
|
||||
* Revision 1.1.1.1 2003/04/14 17:57:51 dggoodwin
|
||||
* Initial import.
|
||||
*
|
||||
|
|
@ -35,7 +36,6 @@
|
|||
#include "ct_defs.h"
|
||||
using namespace std;
|
||||
|
||||
//#include "Elements.h"
|
||||
#include "SpeciesThermo.h"
|
||||
#include "ctexceptions.h"
|
||||
#include "stringUtils.h"
|
||||
|
|
@ -45,24 +45,6 @@ namespace Cantera {
|
|||
|
||||
class Elements;
|
||||
|
||||
#ifdef INCL_DEPRECATED_METHODS
|
||||
|
||||
/**
|
||||
* Structure returned by method species()
|
||||
* @param name species name
|
||||
* @param atoms vector of element atom numbers
|
||||
* @param phase flag specifying phase
|
||||
* @param charge electric charge
|
||||
* @param molecularWeight molecular weight
|
||||
*/
|
||||
struct SpeciesData {
|
||||
string name;
|
||||
vector_fp atoms;
|
||||
int phase;
|
||||
doublereal charge;
|
||||
doublereal molecularWeight;
|
||||
};
|
||||
#endif
|
||||
|
||||
/************** DEFINITIONS OF ERRORS *****************************/
|
||||
|
||||
|
|
@ -73,86 +55,116 @@ namespace Cantera {
|
|||
" outside valid range of 0 to " + int2str(kmax-1)) {}
|
||||
};
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
|
||||
/// Class Constituents manages a set of elements and
|
||||
/// species. Class Constituents is designed to provide information
|
||||
/// about the elements and species in a phase - names, index
|
||||
/// numbers (location in arrays), atomic or molecular weights,
|
||||
/// etc. No computations are performed by the methods of this
|
||||
/// class. The set of elements must include all those that compose
|
||||
/// the species, but may include additional elements. The species
|
||||
/// all must belong to the same phase.
|
||||
|
||||
/**
|
||||
* Class Constituents manages a set of elements and species. The
|
||||
* set of elements must include all those that compose the
|
||||
* species, but may include additional elements. The species all
|
||||
* must belong to the same phase.
|
||||
*/
|
||||
class Constituents {
|
||||
|
||||
public:
|
||||
|
||||
Constituents(Elements* ptr_Elements = 0);
|
||||
~Constituents();
|
||||
/// Constructor.
|
||||
Constituents(Elements* ptr_Elements = 0);
|
||||
|
||||
/// Atomic weight of element m.
|
||||
doublereal atomicWeight(int m) const;
|
||||
/// vector of atomic weights
|
||||
const array_fp& atomicWeights() const;
|
||||
/// Number of elements.
|
||||
int nElements() const;
|
||||
/// Destructor.
|
||||
~Constituents();
|
||||
|
||||
#ifdef INCL_DEPRECATED_METHODS
|
||||
/**
|
||||
* Returns an ElementData struct that contains the
|
||||
* parameters for element number m.
|
||||
*/
|
||||
ElementData element(int m) const {
|
||||
return m_Elements->element(m);
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* @name Adding Elements and Species
|
||||
* These methods are used to add new elements or species.
|
||||
* They are not usually called by user programs.
|
||||
*/
|
||||
void addElement(const string& symbol, doublereal weight);
|
||||
void addElement(const XML_Node& e);
|
||||
void addUniqueElement(const string& symbol, doublereal weight);
|
||||
void addUniqueElement(const XML_Node& e);
|
||||
/**
|
||||
* Prohibit addition of more elements, and prepare to add
|
||||
* species.
|
||||
*/
|
||||
void freezeElements();
|
||||
/// True if freezeElements has been called.
|
||||
bool elementsFrozen();
|
||||
/**
|
||||
* Index of element named 'name'. The index is an integer
|
||||
* assigned to each element in the order it was added,
|
||||
* beginning with 0 for the first element. If 'name' is not
|
||||
* the name of an element in the set, then the value -1 is
|
||||
* returned.
|
||||
*/
|
||||
int elementIndex(string name) const;
|
||||
/**
|
||||
* Name of the element with index m. @param m Element
|
||||
* index. If m < 0 or m >= nElements() an exception is thrown.
|
||||
*/
|
||||
string elementName(int m) const;
|
||||
/**
|
||||
* Returns a read-only reference to the vector of element names.
|
||||
*/
|
||||
const vector<string>& elementNames() const;
|
||||
/// @name Element Information
|
||||
//@{
|
||||
|
||||
/// Name of the element with index m. @param m Element
|
||||
/// index. If m < 0 or m >= nElements() an exception is thrown.
|
||||
string elementName(int m) const;
|
||||
|
||||
/**
|
||||
* Returns the Number of species in the phase
|
||||
*/
|
||||
|
||||
/// Index of element named 'name'. The index is an integer
|
||||
/// assigned to each element in the order it was added,
|
||||
/// beginning with 0 for the first element. If 'name' is not
|
||||
/// the name of an element in the set, then the value -1 is
|
||||
/// returned.
|
||||
int elementIndex(string name) const;
|
||||
|
||||
|
||||
/// Atomic weight of element m.
|
||||
doublereal atomicWeight(int m) const;
|
||||
|
||||
|
||||
/// Return a read-only reference to the vector of element names.
|
||||
const vector<string>& elementNames() const;
|
||||
|
||||
|
||||
/// Return a read-only reference to the vector of atomic weights.
|
||||
const array_fp& atomicWeights() const;
|
||||
|
||||
|
||||
/// Number of elements.
|
||||
int nElements() const;
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
/// @name Adding Elements and Species
|
||||
/// These methods are used to add new elements or species.
|
||||
/// These are not usually called by user programs.
|
||||
///
|
||||
/// Since species are checked to insure that they are only
|
||||
/// composed of declared elements, it is necessary to first
|
||||
/// add all elements before adding any species.
|
||||
|
||||
//@{
|
||||
|
||||
/// Add an element.
|
||||
/// @param symbol Atomic symbol string.
|
||||
/// @param weight Atomic mass in amu.
|
||||
void addElement(const string& symbol, doublereal weight);
|
||||
|
||||
/// Add an element from an XML specification.
|
||||
void addElement(const XML_Node& e);
|
||||
|
||||
void addUniqueElement(const string& symbol, doublereal weight);
|
||||
|
||||
void addUniqueElement(const XML_Node& e);
|
||||
|
||||
|
||||
/// Prohibit addition of more elements, and prepare to add
|
||||
/// species.
|
||||
void freezeElements();
|
||||
|
||||
/// True if freezeElements has been called.
|
||||
bool elementsFrozen();
|
||||
|
||||
//@}
|
||||
|
||||
/// Returns the number of species in the phase
|
||||
int nSpecies() const { return m_kk; }
|
||||
|
||||
/// Molecular weight of species k.
|
||||
doublereal molecularWeight(int k) const;
|
||||
|
||||
/// Molar mass. Preferred name for molecular weight.
|
||||
doublereal molarMass(int k) const {
|
||||
return molecularWeight(k);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a const reference to the vector of molecular weights
|
||||
* of the species
|
||||
*/
|
||||
const array_fp& molecularWeights() const;
|
||||
|
||||
/**
|
||||
* Electrical charge of one species k molecule, divided by
|
||||
* \f$ e = 1.602 \times 10^{-19}\f$ Coulombs.
|
||||
*/
|
||||
|
||||
/// Electrical charge of one species k molecule, divided by
|
||||
/// the magnitude of the electron charge ( \f$ e = 1.602
|
||||
/// \times 10^{-19}\f$ Coulombs). Dimensionless.
|
||||
doublereal charge(int k) const;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@
|
|||
#ifndef CT_RXNPATH_GROUP
|
||||
#define CT_RXNPATH_GROUP
|
||||
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#include "ct_defs.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
|
|
|||
|
|
@ -150,10 +150,19 @@ namespace Cantera {
|
|||
|
||||
/**
|
||||
* Copy the vector of molecular weights into array weights.
|
||||
* @deprecated
|
||||
*/
|
||||
void Phase::getMolecularWeights(int iwt, doublereal* weights) {
|
||||
const array_fp& mw = Constituents::molecularWeights();
|
||||
copy(mw.begin(), mw.end(), weights);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the vector of molecular weights into array weights.
|
||||
*/
|
||||
void Phase::getMolecularWeights(doublereal* weights) {
|
||||
const array_fp& mw = Constituents::molecularWeights();
|
||||
copy(mw.begin(), mw.end(), weights);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ namespace Cantera {
|
|||
* These classes are used to represent phases of matter.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Base class for phases of matter. Class Phase derives from both
|
||||
* Constituents and State. In addition to the methods of those two
|
||||
|
|
@ -130,6 +131,11 @@ namespace Cantera {
|
|||
*/
|
||||
void getMolecularWeights(int iwt, doublereal* weights);
|
||||
|
||||
/**
|
||||
* Copy the vector of molecular weights into array weights.
|
||||
*/
|
||||
void getMolecularWeights(doublereal* weights);
|
||||
|
||||
/**
|
||||
* Return a const reference to the internal vector of
|
||||
* molecular weights.
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@
|
|||
#pragma warning(disable:4503)
|
||||
#endif
|
||||
|
||||
// STL includes
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
#include "ReactionPath.h"
|
||||
#include "Kinetics.h"
|
||||
#include "reaction_defs.h"
|
||||
|
|
|
|||
|
|
@ -14,13 +14,6 @@
|
|||
#ifndef CT_RXNPATH_H
|
||||
#define CT_RXNPATH_H
|
||||
|
||||
// STL includes
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
// Cantera includes
|
||||
#include "ct_defs.h"
|
||||
#include "DenseMatrix.h"
|
||||
|
|
|
|||
|
|
@ -10,43 +10,57 @@
|
|||
|
||||
namespace Cantera {
|
||||
|
||||
ReactionStoichMgr::
|
||||
ReactionStoichMgr() {
|
||||
m_reactants = new StoichManagerN;
|
||||
m_revproducts = new StoichManagerN;
|
||||
m_irrevproducts = new StoichManagerN;
|
||||
}
|
||||
// create stoichiometry managers for the reactants of all reactions,
|
||||
// for the products of the reversible reactions, and for the
|
||||
// products of the irreversible reactions.
|
||||
ReactionStoichMgr::
|
||||
ReactionStoichMgr() {
|
||||
m_reactants = new StoichManagerN;
|
||||
m_revproducts = new StoichManagerN;
|
||||
m_irrevproducts = new StoichManagerN;
|
||||
}
|
||||
|
||||
ReactionStoichMgr::~ReactionStoichMgr() {
|
||||
delete m_reactants;
|
||||
delete m_revproducts;
|
||||
delete m_irrevproducts;
|
||||
}
|
||||
// delete the three stoichiometry managers
|
||||
ReactionStoichMgr::~ReactionStoichMgr() {
|
||||
delete m_reactants;
|
||||
delete m_revproducts;
|
||||
delete m_irrevproducts;
|
||||
}
|
||||
|
||||
void ReactionStoichMgr::
|
||||
add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||
bool reversible) {
|
||||
vector_fp forder(reactants.size(), 1.0);
|
||||
add(rxn, reactants, products, reversible, forder);
|
||||
}
|
||||
|
||||
void ReactionStoichMgr::
|
||||
add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||
bool reversible, const vector_fp& fwdOrder) {
|
||||
m_reactants->add(rxn, reactants, fwdOrder);
|
||||
if (reversible)
|
||||
m_revproducts->add(rxn, products);
|
||||
else
|
||||
m_irrevproducts->add(rxn, products);
|
||||
}
|
||||
void ReactionStoichMgr::
|
||||
add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||
bool reversible) {
|
||||
vector_fp forder(reactants.size(), 1.0);
|
||||
add(rxn, reactants, products, reversible, forder);
|
||||
}
|
||||
|
||||
void ReactionStoichMgr::
|
||||
getCreationRates(int nsp, const doublereal* ropf, const doublereal* ropr, doublereal* c) {
|
||||
fill(c, c + nsp, 0.0);
|
||||
m_revproducts->incrementSpecies(ropf, c);
|
||||
m_irrevproducts->incrementSpecies(ropf, c);
|
||||
m_reactants->incrementSpecies(ropr, c);
|
||||
}
|
||||
|
||||
void ReactionStoichMgr::
|
||||
add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||
bool reversible, const vector_fp& fwdOrder) {
|
||||
|
||||
// add the reactants with the specified forward order
|
||||
m_reactants->add(rxn, reactants, fwdOrder);
|
||||
|
||||
// depending on whether the reversible flag is set or not, add the
|
||||
// products either to the reversible or irreversible product
|
||||
// stoichiometry manager.
|
||||
if (reversible)
|
||||
m_revproducts->add(rxn, products);
|
||||
else
|
||||
m_irrevproducts->add(rxn, products);
|
||||
}
|
||||
|
||||
|
||||
void ReactionStoichMgr::
|
||||
getCreationRates(int nsp, const doublereal* ropf, const doublereal* ropr, doublereal* c) {
|
||||
// zero out the target array
|
||||
fill(c, c + nsp, 0.0);
|
||||
m_revproducts->incrementSpecies(ropf, c);
|
||||
m_irrevproducts->incrementSpecies(ropf, c);
|
||||
m_reactants->incrementSpecies(ropr, c);
|
||||
}
|
||||
|
||||
void ReactionStoichMgr::
|
||||
getDestructionRates(int nsp, const doublereal* ropf, const doublereal* ropr, doublereal* d) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
/**
|
||||
* @file ReactionStoichMgr.h
|
||||
*
|
||||
* Header file declaring class ReactionStoichMgr.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
|
|
@ -9,113 +13,217 @@
|
|||
#ifndef CT_RXN_STOICH
|
||||
#define CT_RXN_STOICH
|
||||
|
||||
|
||||
#include "ct_defs.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
class StoichManagerN;
|
||||
class StoichManagerN;
|
||||
|
||||
/**
|
||||
* Reaction mechanism stoichiometry manager. This is an internal class used
|
||||
* by kinetics manager classes, and is not meant for direct use in
|
||||
* user programs.
|
||||
*
|
||||
* Class ReactionStoichMgr handles the calculation of quantities involving
|
||||
* the stoichiometry of a set of reactions. The reactions must have integer
|
||||
* stoichiometric coefficients. Specifically, its methods compute
|
||||
* - species creation rates
|
||||
* - species destruction rates
|
||||
* - species net production rates
|
||||
* - the change in molar species properties in the reactions
|
||||
* - concentration products
|
||||
*
|
||||
* To use this class, method 'add' is first used to add each reaction.
|
||||
* Once all reactions have been added, the methods that compute various
|
||||
* quantities may be called.
|
||||
*
|
||||
* The nomenclature used below to document the methods is as follows.
|
||||
* - \f$ N_r \f$
|
||||
* - Integer reactant stoichiometric coefficient matrix. The (k,i)
|
||||
* element of this matrix is the stoichiometric coefficient of
|
||||
* species \i k as a reactant in reaction \i i.
|
||||
* - \f$ N_p \f$
|
||||
* - Integer product stoichiometric coefficient matrix. The (k,i)
|
||||
* element of this matrix is the stoichiometric coefficient of
|
||||
* species \i k as a product in reaction \i i.
|
||||
* - \f$ Q_{\rm fwd} \f$
|
||||
* - Vector of length I of forward rates of progress.
|
||||
* - \f$ Q_{\rm rev} \f$
|
||||
* - Vector of length I of reverse rates of progress.
|
||||
* - \f$ C \f$
|
||||
* - Vector of K species creation rates.
|
||||
* - \f$ D \f$
|
||||
* - Vector of K species destruction rates.
|
||||
* - \f$ W = C - D \f$
|
||||
* - Vector of K species net production rates.
|
||||
*
|
||||
*/
|
||||
class ReactionStoichMgr {
|
||||
|
||||
public:
|
||||
|
||||
/// Constructor.
|
||||
ReactionStoichMgr();
|
||||
|
||||
/// Destructor.
|
||||
virtual ~ReactionStoichMgr();
|
||||
|
||||
/**
|
||||
* This class handles calculations involving reaction stoichiometry.
|
||||
* Add a reaction with mass-action kinetics. Vectors
|
||||
* 'reactants' and 'products' contain the integer species
|
||||
* indices of the reactants and products, respectively. Note
|
||||
* that if more than one molecule of a given species is
|
||||
* involved in the reaction, then its index is repeated.
|
||||
*
|
||||
* For example, suppose a reaction mechanism involves the
|
||||
* species N2, O2, O, N, NO. N2 is assigned index number 0, O2
|
||||
* number 1, and so on through NO with number 4. Then the
|
||||
* representation of the following reactions is as shown here.
|
||||
*
|
||||
* - N + O = NO
|
||||
* - reactants: (3, 2)
|
||||
* - products: (4)
|
||||
*
|
||||
* - O + O = O2
|
||||
* - reactants: (2, 2) [ note repeated index ]
|
||||
* - products: (1)
|
||||
*
|
||||
* @param rxn Reaction number. This number will be used as the index into the
|
||||
* rate of progess vector in the methods below.
|
||||
* @param reactants vector of integer reactant indices
|
||||
* @param products vector of integer product indices
|
||||
* @param reversible true if the reaction is reversible, false otherwise
|
||||
*/
|
||||
class ReactionStoichMgr {
|
||||
void add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||
bool reversible);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Add a reaction with specified, possibly non-integral, reaction orders.
|
||||
* @param rxn Reaction number
|
||||
* @param reactants vector of integer reactant indices
|
||||
* @param products vector of integer product indices
|
||||
* @param reversible true if the reaction is reversible, false otherwise.
|
||||
* If the reaction is reversible, its reverse rate will be computed from
|
||||
* the reaction stoichiometry.
|
||||
* @param fwdOrder reaction orders for the reactants. This vector must
|
||||
* be the same length as 'reactants,' and the reaction orders are for the
|
||||
* species with index in the corresponding location in 'reactants.'
|
||||
*
|
||||
*/
|
||||
void add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||
bool reversible, const vector_fp& fwdOrder);
|
||||
|
||||
ReactionStoichMgr();
|
||||
virtual ~ReactionStoichMgr();
|
||||
|
||||
/**
|
||||
* Add a reaction with specified, possibly non-integral, reaction orders.
|
||||
* @param rxn Reaction number
|
||||
* @param reactants vector of integer reactant indices
|
||||
* @param reactants vector of integer product indices
|
||||
* @param reversible true if the reaction is reversible, false otherwise
|
||||
* @param fwdOrder reaction orders for the reactants. This vector must
|
||||
* be the same length as 'reactants,' and the reaction orders are for the
|
||||
* species with index in the corresponding location in 'reactants.'
|
||||
*/
|
||||
void add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||
bool reversible, const vector_fp& fwdOrder);
|
||||
|
||||
/**
|
||||
* Add a reaction with mass-action kinetics.
|
||||
* @param rxn Reaction number
|
||||
* @param reactants vector of integer reactant indices
|
||||
* @param reactants vector of integer product indices
|
||||
* @param reversible true if the reaction is reversible, false otherwise
|
||||
*/
|
||||
void add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||
bool reversible);
|
||||
|
||||
/**
|
||||
* Given the arrays of the forward and reverse rates of progress for all reactions,
|
||||
* compute the species creation rates and return them in array c.
|
||||
*/
|
||||
void getCreationRates(int nsp, const doublereal* ropf, const doublereal* ropr, doublereal* c);
|
||||
/**
|
||||
* Species creation rates.
|
||||
* Given the arrays of the forward and reverse rates of
|
||||
* progress for all reactions, compute the species creation
|
||||
* rates, given by
|
||||
* \f[
|
||||
* C = N_p Q_f + N_r Q_r.
|
||||
* \f]
|
||||
*/
|
||||
void getCreationRates(int nSpecies,
|
||||
const doublereal* fwdRatesOfProgress,
|
||||
const doublereal* revRatesOfProgress,
|
||||
doublereal* creationRates);
|
||||
|
||||
/**
|
||||
* Given the arrays of the forward and reverse rates of progress for all reactions,
|
||||
* compute the species destruction rates and return them in array d.
|
||||
*/
|
||||
void getDestructionRates(int nsp, const doublereal* ropf, const doublereal* ropr, doublereal* d);
|
||||
|
||||
/**
|
||||
* Given the array of the net rates of progress for all reactions,
|
||||
* compute the species net production rates and return them in array w.
|
||||
*/
|
||||
void getNetProductionRates(int nsp, const doublereal* ropnet, doublereal* w);
|
||||
/**
|
||||
* Species destruction rates.
|
||||
* Given the arrays of the forward and reverse rates of
|
||||
* progress for all reactions, compute the species destruction
|
||||
* rates, given by
|
||||
* \f[
|
||||
* D = N_r Q_f + N_p Q_r,
|
||||
* \f]
|
||||
* Note that the stoichiometric coefficient matrices are very sparse, integer
|
||||
* matrices.
|
||||
*/
|
||||
void getDestructionRates(int nSpecies,
|
||||
const doublereal* fwdRatesOfProgress,
|
||||
const doublereal* revRatesOfProgress,
|
||||
doublereal* destructionRates);
|
||||
|
||||
/**
|
||||
* Given an array of species properties 'g', return in array 'dg' the change in this quantity
|
||||
* in the reactions. Array 'g' must have a length at least as great
|
||||
* as the number of species, and array 'dg' must have a length
|
||||
* as great as the total number of reactions.
|
||||
*/
|
||||
void getReactionDelta(int nr, const doublereal* g, doublereal* dg);
|
||||
|
||||
/**
|
||||
* Given an array of species properties 'g', return in array
|
||||
* 'dg' the change in this quantity in the reversible
|
||||
* reactions. Array 'g' must have a length at least as great
|
||||
* as the number of species, and array 'dg' must have a length
|
||||
* as great as the total number of reactions. This method
|
||||
* only computes 'dg' for the reversible reactions, and the
|
||||
* entries of 'dg' for the irreversible reactions are
|
||||
* unaltered. This is primarily designed for use in
|
||||
* calculating reveerse rate coefficients from thermochemistry
|
||||
* for reversible reactions.
|
||||
*/
|
||||
void getRevReactionDelta(int nr, const doublereal* g, doublereal* dg);
|
||||
/**
|
||||
* Given the array of the net rates of progress for all
|
||||
* reactions, compute the species net production rates and
|
||||
* return them in array w.
|
||||
*/
|
||||
/**
|
||||
* Species net production rates.
|
||||
* Given the array of the net rates of
|
||||
* progress for all reactions, compute the species net production
|
||||
* rates, given by
|
||||
* \f[
|
||||
* W = (N_r - N_p) Q_{\rm net},
|
||||
* \f]
|
||||
*/
|
||||
void getNetProductionRates(int nsp, const doublereal* ropnet, doublereal* w);
|
||||
|
||||
/**
|
||||
* Given an array of concentrations C, multiply the entries in array R by
|
||||
* the concentration products for the reactants:
|
||||
* \f[
|
||||
* R_i = R_i * \prod_k C_k^{o_{k,i}}
|
||||
* \f]
|
||||
* Here \f$ o_{k,i} \f$ is the reaction order of species k in reaction i.
|
||||
*/
|
||||
void multiplyReactants(const doublereal* C, doublereal* R);
|
||||
|
||||
/**
|
||||
* Given an array of concentrations C, multiply the entries in array R by
|
||||
* the concentration products for the products:
|
||||
* \f[
|
||||
* R_i = R_i * \prod_k C_k^{\nu^{(p)}_{k,i}}
|
||||
* \f]
|
||||
* Here \f$ \nu^{(p)}_{k,i} \f$ is the product stoichiometric coefficient
|
||||
* of species k in reaction i.
|
||||
*/
|
||||
void multiplyRevProducts(const doublereal* c, doublereal* r);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Change of a molar species property in a reaction. Given an
|
||||
* array of species properties 'g', return in array 'dg' the
|
||||
* change in this quantity in the reactions. Array 'g' must
|
||||
* have a length at least as great as the number of species,
|
||||
* and array 'dg' must have a length as great as the total
|
||||
* number of reactions.
|
||||
*/
|
||||
void getReactionDelta(int nReactions,
|
||||
const doublereal* g,
|
||||
doublereal* dg);
|
||||
|
||||
StoichManagerN* m_reactants;
|
||||
StoichManagerN* m_revproducts;
|
||||
StoichManagerN* m_irrevproducts;
|
||||
};
|
||||
|
||||
/**
|
||||
* Given an array of species properties 'g', return in array
|
||||
* 'dg' the change in this quantity in the reversible
|
||||
* reactions. Array 'g' must have a length at least as great
|
||||
* as the number of species, and array 'dg' must have a length
|
||||
* as great as the total number of reactions. This method
|
||||
* only computes 'dg' for the reversible reactions, and the
|
||||
* entries of 'dg' for the irreversible reactions are
|
||||
* unaltered. This is primarily designed for use in
|
||||
* calculating reveerse rate coefficients from thermochemistry
|
||||
* for reversible reactions.
|
||||
*/
|
||||
void getRevReactionDelta(int nr, const doublereal* g, doublereal* dg);
|
||||
|
||||
|
||||
/**
|
||||
* Given an array of concentrations C, multiply the entries in array R by
|
||||
* the concentration products for the reactants:
|
||||
* \f[
|
||||
* R_i = R_i * \prod_k C_k^{o_{k,i}}
|
||||
* \f]
|
||||
* Here \f$ o_{k,i} \f$ is the reaction order of species k in reaction i.
|
||||
*/
|
||||
void multiplyReactants(const doublereal* C, doublereal* R);
|
||||
|
||||
|
||||
/**
|
||||
* Given an array of concentrations C, multiply the entries in array R by
|
||||
* the concentration products for the products:
|
||||
* \f[
|
||||
* R_i = R_i * \prod_k C_k^{\nu^{(p)}_{k,i}}
|
||||
* \f]
|
||||
* Here \f$ \nu^{(p)}_{k,i} \f$ is the product stoichiometric coefficient
|
||||
* of species k in reaction i.
|
||||
*/
|
||||
void multiplyRevProducts(const doublereal* c, doublereal* r);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
StoichManagerN* m_reactants;
|
||||
StoichManagerN* m_revproducts;
|
||||
StoichManagerN* m_irrevproducts;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,59 +1,3 @@
|
|||
/* ../config.h. Generated automatically by configure. */
|
||||
//
|
||||
// Run the 'configure' script to generate 'config.h' from this input file.
|
||||
//
|
||||
#ifndef CT_CONFIG_H
|
||||
#define CT_CONFIG_H
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
//------------------------ Fortran settings -------------------//
|
||||
|
||||
|
||||
// define types doublereal, integer, and ftnlen to match the
|
||||
// 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
|
||||
|
||||
|
||||
// Fortran compilers pass character strings in argument lists by
|
||||
// adding a hidden argement with the length of the string. Some
|
||||
// compilers add the hidden length argument immediately after the
|
||||
// CHARACTER variable being passed, while others put all of the hidden
|
||||
// length arguments at the end of the argument list. Define this if
|
||||
// the lengths are at the end of the argument list. This is usually the
|
||||
// case for most unix Fortran compilers, but is (by default) false for
|
||||
// Visual Fortran under Windows.
|
||||
#define STRING_LEN_AT_END
|
||||
|
||||
|
||||
// Define this if Fortran adds a trailing underscore to names in object files.
|
||||
// For linux and most unix systems, this is the case.
|
||||
#define FTN_TRAILING_UNDERSCORE
|
||||
|
||||
|
||||
//-------- LAPACK / BLAS ---------
|
||||
|
||||
// Define if you are using LAPACK and BLAS from the Intel Math Kernel
|
||||
// Library
|
||||
/* #undef HAVE_INTEL_MKL */
|
||||
|
||||
#define LAPACK_FTN_STRING_LEN_AT_END 1
|
||||
#define LAPACK_NAMES_LOWERCASE 1
|
||||
#define LAPACK_FTN_TRAILING_UNDERSCORE 1
|
||||
|
||||
|
||||
//--------- Cantera --------------
|
||||
|
||||
|
||||
//--------- CKReader -------------
|
||||
|
||||
|
||||
|
||||
//--------- CtLib ----------------
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include "config.h"
|
||||
|
||||
// STL includes
|
||||
//#include <iostream>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
|
|
|||
|
|
@ -238,21 +238,7 @@ namespace Cantera {
|
|||
|
||||
|
||||
/**
|
||||
* Set the default directories for input files. Four directories are
|
||||
* added to the search path used by findInputFile. These are
|
||||
* 'data', 'data/inputs', 'data/thermo', and
|
||||
* 'data/transport'. These names are for convenience only -
|
||||
* findInputFile searches all of them, independent of the type of
|
||||
* file. The location of the 'data' directory depends on how
|
||||
* environment variables are set. If CANTERA_DATA_DIR is set, then
|
||||
* this will be used instead of 'data'. In addition, if
|
||||
* WIN_CANTERA_ROOT or CANTERA_ROOT are set, then 'data' is
|
||||
* assumed to be a top-level subdirectory. WIN_CANTERA_ROOT should
|
||||
* only be set on PCs, and should be in 'DOS' format, for example
|
||||
* 'C:\CANTERA'. CANTERA_ROOT, on the other hand, should be in
|
||||
* unix-like format ('/home/usr/cantera'). This allows Cantera to
|
||||
* be built on PCs using a unix-like environment (Cygwin) and
|
||||
* compiler (g++), as well as using Win32 compilers.
|
||||
* Set the default directories for input data files.
|
||||
*/
|
||||
void setDefaultDirectories() {
|
||||
appinit();
|
||||
|
|
@ -261,15 +247,16 @@ namespace Cantera {
|
|||
// always look in the local directory first
|
||||
dirs.push_back(".");
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* Under Windows, the Cantera setup utility puts data files in
|
||||
* a directory 'Cantera\data' below the one the environment
|
||||
* variable COMMONPROGRAMFILES points to. (This is usually
|
||||
* C:\Program Files\Common Files.) If this environment
|
||||
* variable is defined, then this directory is assumed to
|
||||
* exist and is added to the search path.
|
||||
*/
|
||||
//
|
||||
// Under Windows, the Cantera setup utility puts data files in
|
||||
// a directory 'Cantera\data' below the one the environment
|
||||
// variable COMMONPROGRAMFILES points to. (This is usually
|
||||
// C:\Program Files\Common Files.) If this environment
|
||||
// variable is defined, then this directory is assumed to
|
||||
// exist and is added to the search path.
|
||||
//
|
||||
const char* comfiles = getenv("COMMONPROGRAMFILES");
|
||||
if (comfiles != 0) {
|
||||
string cfiles = string(comfiles);
|
||||
|
|
@ -285,6 +272,18 @@ namespace Cantera {
|
|||
dirs.push_back(tmpldir);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DARWIN
|
||||
//
|
||||
// add a default data location for Mac OS X
|
||||
//
|
||||
dirs.push_back("/Applications/Cantera/Data");
|
||||
#endif
|
||||
|
||||
//
|
||||
// if environment variable CANTERA_DATA is defined, then add
|
||||
// it to the search path
|
||||
//
|
||||
if (getenv("CANTERA_DATA") != 0) {
|
||||
string datadir = string(getenv("CANTERA_DATA"));
|
||||
dirs.push_back(datadir);
|
||||
|
|
@ -299,6 +298,7 @@ namespace Cantera {
|
|||
string datadir = string(CANTERA_ROOT) + "/data";
|
||||
dirs.push_back(datadir);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#define CT_UNITS_H
|
||||
|
||||
#include "ct_defs.h"
|
||||
#include "ctexceptions.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue