Fixing compiler warnings, part 3
This commit is contained in:
parent
69bffa3800
commit
255f1f9b9f
146 changed files with 1135 additions and 1213 deletions
|
|
@ -213,7 +213,7 @@ namespace Cantera {
|
|||
/*!
|
||||
* A group of species is a subset of the species in a phase.
|
||||
*/
|
||||
typedef vector_int group_t;
|
||||
typedef std::vector<size_t> group_t;
|
||||
//! typedef for a vector of groups of species.
|
||||
/*!
|
||||
* A grouplist of species is a vector of groups.
|
||||
|
|
|
|||
|
|
@ -173,11 +173,11 @@ namespace ckr {
|
|||
removeWhiteSpace(s);
|
||||
// break string into substrings at the '+' characters separating
|
||||
// species symbols
|
||||
int i, nn;
|
||||
|
||||
bool inplus = true;
|
||||
vector<int> pluses;
|
||||
vector<string> sp;
|
||||
for (i = n-1; i >= 0; i--) {
|
||||
for (int i = n-1; i >= 0; i--) {
|
||||
if (!inplus && s[i] == '+') {
|
||||
pluses.push_back(i);
|
||||
inplus = true;
|
||||
|
|
@ -187,9 +187,9 @@ namespace ckr {
|
|||
}
|
||||
}
|
||||
pluses.push_back(-1);
|
||||
int np = pluses.size();
|
||||
int loc, nxt;
|
||||
for (nn = 0; nn < np; nn++) {
|
||||
size_t np = pluses.size();
|
||||
size_t loc, nxt;
|
||||
for (size_t nn = 0; nn < np; nn++) {
|
||||
loc = pluses.back();
|
||||
pluses.pop_back();
|
||||
if (nn == np-1) nxt = s.size();
|
||||
|
|
@ -197,11 +197,10 @@ namespace ckr {
|
|||
sp.push_back(s.substr(loc+1,nxt-loc-1));
|
||||
}
|
||||
|
||||
int ns = sp.size();
|
||||
string r, num;
|
||||
int sz, j, strt=0;
|
||||
size_t sz, j, strt=0;
|
||||
RxnSpecies ss;
|
||||
for (nn = 0; nn < ns; nn++) {
|
||||
for (size_t nn = 0; nn < sp.size(); nn++) {
|
||||
r = sp[nn];
|
||||
sz = r.size();
|
||||
for (j = 0; j < sz; j++) {
|
||||
|
|
@ -633,10 +632,10 @@ next:
|
|||
// t1 t2 t3 t4 date
|
||||
// when there are 3 temperature regions
|
||||
//
|
||||
int nreg = toks.size() - 2;
|
||||
size_t nreg = toks.size() - 2;
|
||||
if (nreg >= 1) {
|
||||
temp.resize(nreg+1);
|
||||
for (int i = 0; i <= nreg; i++) {
|
||||
for (size_t i = 0; i <= nreg; i++) {
|
||||
temp[i] = de_atof(toks[i]);
|
||||
}
|
||||
string defaultDate = toks[nreg+1];
|
||||
|
|
@ -984,7 +983,6 @@ next:
|
|||
|
||||
// rxn line
|
||||
//string::size_type eqloc;
|
||||
int eqloc;
|
||||
string sleft, sright;
|
||||
bool auxDataLine, metaDataLine;
|
||||
|
||||
|
|
@ -994,14 +992,14 @@ next:
|
|||
// increment the number of reactions, and start processing the
|
||||
// new reaction.
|
||||
|
||||
eqloc = s.find_first_of("=");
|
||||
size_t eqloc = s.find_first_of("=");
|
||||
metaDataLine = false;
|
||||
auxDataLine = false;
|
||||
|
||||
// look for a metadata line
|
||||
if (s[0] == '%') {
|
||||
metaDataLine = true;
|
||||
if (eqloc > 0 && eqloc < int(s.size())) {
|
||||
if (eqloc > 0 && eqloc < s.size()) {
|
||||
int ierr, ierp;
|
||||
vector<grouplist_t> rg, pg;
|
||||
s[eqloc] = ' ';
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ bool CKReader::writeReactions(std::ostream& log) {
|
|||
bool CKReader::validateSpecies(std::ostream& log) {
|
||||
int nel = static_cast<int>(elements.size());
|
||||
int nsp = static_cast<int>(species.size());
|
||||
double nm, tol;
|
||||
double tol;
|
||||
int j, k, m;
|
||||
|
||||
log << newTask("validating species");
|
||||
|
|
@ -382,7 +382,7 @@ bool CKReader::validateSpecies(std::ostream& log) {
|
|||
Species& s = species[k];
|
||||
|
||||
getMapKeys(s.comp, esyms);
|
||||
nm = esyms.size();
|
||||
size_t nm = esyms.size();
|
||||
|
||||
for (m = 0; m < nm; m++) {
|
||||
for (j = 0; j < nel; j++) {
|
||||
|
|
|
|||
|
|
@ -192,8 +192,7 @@ namespace ckr {
|
|||
string s;
|
||||
vector<string> toks;
|
||||
string defaultDate="";
|
||||
int nreg = 2;
|
||||
int i;
|
||||
size_t nreg = 2;
|
||||
|
||||
int nsp = static_cast<int>(names.size());
|
||||
|
||||
|
|
@ -210,10 +209,10 @@ namespace ckr {
|
|||
if (optionFlag == NoThermoDatabase || optionFlag == HasTempRange) {
|
||||
getCKLine(s, comment);
|
||||
getTokens(s, static_cast<int>(s.size()), toks);
|
||||
nreg = toks.size();
|
||||
size_t nreg = toks.size();
|
||||
if (nreg >= 1) {
|
||||
temp.resize(nreg+1);
|
||||
for (i = 0; i <= nreg; i++) {
|
||||
for (size_t i = 0; i <= nreg; i++) {
|
||||
temp[i] = de_atof(toks[i]);
|
||||
}
|
||||
defaultDate = toks[nreg+1];
|
||||
|
|
@ -224,7 +223,7 @@ namespace ckr {
|
|||
log.precision(2);
|
||||
log << endl << " Default # of temperature regions: " << nreg << endl;
|
||||
log << " ";
|
||||
for (i = 0; i <= nreg; i++) {
|
||||
for (size_t i = 0; i <= nreg; i++) {
|
||||
log << temp[i] << " ";
|
||||
}
|
||||
log << endl;
|
||||
|
|
@ -324,7 +323,7 @@ namespace ckr {
|
|||
// Name of the species
|
||||
string nameid;
|
||||
vector<string> toks;
|
||||
int nToks = 0;
|
||||
size_t nToks = 0;
|
||||
|
||||
// Loop forward until we get to the next nonempty line.
|
||||
do {
|
||||
|
|
@ -343,7 +342,7 @@ namespace ckr {
|
|||
|
||||
//------------- line 1 ---------------------------
|
||||
// Everything after the first 18 spaces is a comment.
|
||||
int nt = s.size();
|
||||
size_t nt = s.size();
|
||||
sp.m_commentsRef = s.substr(18, nt-18);
|
||||
|
||||
// Parse the species name
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ namespace ckr {
|
|||
}
|
||||
|
||||
void Species::delR() {
|
||||
int iReg = region_coeffs.size();
|
||||
for (int i = 0; i < iReg; i++) {
|
||||
for (size_t i = 0; i < region_coeffs.size(); i++) {
|
||||
if (region_coeffs[i]) {
|
||||
delete region_coeffs[i];
|
||||
region_coeffs[i] = 0;
|
||||
|
|
@ -68,8 +67,7 @@ namespace ckr {
|
|||
lowCoeffs = s.lowCoeffs;
|
||||
highCoeffs = s.highCoeffs;
|
||||
delR();
|
||||
int iReg = s.region_coeffs.size();
|
||||
for (int i = 0; i < iReg; i++) {
|
||||
for (size_t i = 0; i < s.region_coeffs.size(); i++) {
|
||||
region_coeffs.push_back(new vector_fp(*(s.region_coeffs[i])));
|
||||
}
|
||||
minTemps = s.minTemps;
|
||||
|
|
|
|||
|
|
@ -139,16 +139,16 @@ namespace pip {
|
|||
const std::vector<vector_fp *> ®ion_coeffs,
|
||||
const vector_fp &minTemps, const vector_fp &maxTemps)
|
||||
{
|
||||
int nReg = region_coeffs.size();
|
||||
if ((int) minTemps.size() != nReg) {
|
||||
size_t nReg = region_coeffs.size();
|
||||
if (minTemps.size() != nReg) {
|
||||
throw CanteraError("addNASA9", "incompat");
|
||||
}
|
||||
if ((int) maxTemps.size() != nReg) {
|
||||
if (maxTemps.size() != nReg) {
|
||||
throw CanteraError("addNASA9", "incompat");
|
||||
}
|
||||
|
||||
fprintf(f," thermo = (\n");
|
||||
for (int i = 0; i < nReg; i++) {
|
||||
for (size_t i = 0; i < nReg; i++) {
|
||||
double minT = minTemps[i];
|
||||
double maxT = maxTemps[i];
|
||||
const vector_fp &coeffs = *(region_coeffs[i]);
|
||||
|
|
@ -403,11 +403,10 @@ namespace pip {
|
|||
if (rxn.isDuplicate) {
|
||||
options.push_back("duplicate");
|
||||
}
|
||||
int nopt = options.size();
|
||||
size_t nopt = options.size();
|
||||
if (nopt > 0) {
|
||||
fprintf(f, ",\n options = [");
|
||||
int n;
|
||||
for (n = 0; n < nopt; n++) {
|
||||
for (size_t n = 0; n < nopt; n++) {
|
||||
fprintf(f, "\"%s\"", options[n].c_str());
|
||||
if (n < nopt-1) fprintf(f, ", ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,14 +83,12 @@ namespace ckr {
|
|||
|
||||
/// print the rate coefficient parameters
|
||||
bool writeRateCoeff(const RateCoeff& k, std::ostream& log) {
|
||||
|
||||
log.precision(10);
|
||||
log.width(0);
|
||||
log.flags(ios::uppercase);
|
||||
int n;
|
||||
|
||||
bool ok = true;
|
||||
int nb;
|
||||
size_t nb;
|
||||
|
||||
switch (k.type) {
|
||||
|
||||
|
|
@ -109,7 +107,7 @@ namespace ckr {
|
|||
log <<" A, n, E = (" << k.A << ", " << k.n
|
||||
<< ", " << k.E << ") *** JAN *** " << endl;
|
||||
nb = k.b.size();
|
||||
for (n = 0; n < nb; n++) {
|
||||
for (size_t n = 0; n < nb; n++) {
|
||||
log << " b" << n+1 << ": " << k.b[n] << endl;
|
||||
}
|
||||
if (nb != 9) log
|
||||
|
|
@ -121,7 +119,7 @@ namespace ckr {
|
|||
log <<" A, n, E = (" << k.A << ", " << k.n
|
||||
<< ", " << k.E << ") *** FIT1 *** " << endl;
|
||||
nb = k.b.size();
|
||||
for (n = 0; n < nb; n++) {
|
||||
for (size_t n = 0; n < nb; n++) {
|
||||
log << " b" << n+1 << ": " << k.b[n] << endl;
|
||||
}
|
||||
if (nb != 9) log
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ namespace Cantera {
|
|||
static void print_stringTrunc(const char *str, int space, int alignment);
|
||||
#endif
|
||||
|
||||
static int amax(double *x, int j, int n);
|
||||
static void switch_pos(vector_int &orderVector, int jr, int kspec);
|
||||
static int mlequ(double *c, int idem, int n, double *b, int m);
|
||||
static size_t amax(double *x, size_t j, size_t n);
|
||||
static void switch_pos(std::vector<size_t>& orderVector, size_t jr, size_t kspec);
|
||||
static int mlequ(double *c, size_t idem, size_t n, double *b, size_t m);
|
||||
|
||||
//@{
|
||||
#ifndef MIN
|
||||
|
|
@ -75,30 +75,30 @@ static int mlequ(double *c, int idem, int n, double *b, int m);
|
|||
*
|
||||
*
|
||||
*/
|
||||
int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
|
||||
MultiPhase *mphase, vector_int & orderVectorSpecies,
|
||||
vector_int & orderVectorElements,
|
||||
vector_fp & formRxnMatrix) {
|
||||
size_t Cantera::BasisOptimize(int* usedZeroedSpecies, bool doFormRxn,
|
||||
MultiPhase* mphase, std::vector<size_t>& orderVectorSpecies,
|
||||
std::vector<size_t>& orderVectorElements,
|
||||
vector_fp& formRxnMatrix) {
|
||||
|
||||
int j, jj, k=0, kk, l, i, jl, ml;
|
||||
size_t j, jj, k=0, kk, l, i, jl, ml;
|
||||
bool lindep;
|
||||
std::string ename;
|
||||
std::string sname;
|
||||
/*
|
||||
* Get the total number of elements defined in the multiphase object
|
||||
*/
|
||||
int ne = mphase->nElements();
|
||||
size_t ne = mphase->nElements();
|
||||
/*
|
||||
* Get the total number of species in the multiphase object
|
||||
*/
|
||||
int nspecies = mphase->nSpecies();
|
||||
size_t nspecies = mphase->nSpecies();
|
||||
doublereal tmp;
|
||||
doublereal const USEDBEFORE = -1;
|
||||
|
||||
/*
|
||||
* Perhaps, initialize the element ordering
|
||||
*/
|
||||
if ((int) orderVectorElements.size() < ne) {
|
||||
if (orderVectorElements.size() < ne) {
|
||||
orderVectorElements.resize(ne);
|
||||
for (j = 0; j < ne; j++) {
|
||||
orderVectorElements[j] = j;
|
||||
|
|
@ -108,7 +108,7 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
|
|||
/*
|
||||
* Perhaps, initialize the species ordering
|
||||
*/
|
||||
if ((int) orderVectorSpecies.size() != nspecies) {
|
||||
if (orderVectorSpecies.size() != nspecies) {
|
||||
orderVectorSpecies.resize(nspecies);
|
||||
for (k = 0; k < nspecies; k++) {
|
||||
orderVectorSpecies[k] = k;
|
||||
|
|
@ -158,8 +158,8 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
|
|||
* It's equal to the minimum of the number of elements and the
|
||||
* number of total species.
|
||||
*/
|
||||
int nComponents = MIN(ne, nspecies);
|
||||
int nNonComponents = nspecies - nComponents;
|
||||
size_t nComponents = MIN(ne, nspecies);
|
||||
size_t nNonComponents = nspecies - nComponents;
|
||||
/*
|
||||
* Set this return variable to false
|
||||
*/
|
||||
|
|
@ -177,7 +177,7 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
|
|||
vector_fp sm(ne*ne, 0.0);
|
||||
vector_fp ss(ne, 0.0);
|
||||
vector_fp sa(ne, 0.0);
|
||||
if ((int) formRxnMatrix.size() < nspecies*ne) {
|
||||
if (formRxnMatrix.size() < nspecies*ne) {
|
||||
formRxnMatrix.resize(nspecies*ne, 0.0);
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
|
|||
#endif
|
||||
|
||||
|
||||
int jr = -1;
|
||||
size_t jr = -1;
|
||||
/*
|
||||
* Top of a loop of some sort based on the index JR. JR is the
|
||||
* current number of component species found.
|
||||
|
|
@ -367,8 +367,8 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
|
|||
* Use Gauss-Jordon block elimination to calculate
|
||||
* the reaction matrix
|
||||
*/
|
||||
j = mlequ(DATA_PTR(sm), ne, nComponents, DATA_PTR(formRxnMatrix), nNonComponents);
|
||||
if (j == 1) {
|
||||
int ierr = mlequ(DATA_PTR(sm), ne, nComponents, DATA_PTR(formRxnMatrix), nNonComponents);
|
||||
if (ierr == 1) {
|
||||
writelog("ERROR: mlequ returned an error condition\n");
|
||||
throw CanteraError("basopt", "mlequ returned an error condition");
|
||||
}
|
||||
|
|
@ -467,16 +467,15 @@ static void print_stringTrunc(const char *str, int space, int alignment)
|
|||
* Finds the location of the maximum component in a double vector
|
||||
* INPUT
|
||||
* x(*) - Vector to search
|
||||
* j <= i < n : i is the range of indecises to search in X(*)
|
||||
* j <= i < n : i is the range of indices to search in X(*)
|
||||
*
|
||||
* RETURN
|
||||
* return index of the greatest value on X(*) searched
|
||||
*/
|
||||
static int amax(double *x, int j, int n) {
|
||||
int i;
|
||||
int largest = j;
|
||||
static size_t amax(double *x, size_t j, size_t n) {
|
||||
size_t largest = j;
|
||||
double big = x[j];
|
||||
for (i = j + 1; i < n; ++i) {
|
||||
for (size_t i = j + 1; i < n; ++i) {
|
||||
if (x[i] > big) {
|
||||
largest = i;
|
||||
big = x[i];
|
||||
|
|
@ -486,8 +485,8 @@ static int amax(double *x, int j, int n) {
|
|||
}
|
||||
|
||||
|
||||
static void switch_pos(vector_int &orderVector, int jr, int kspec) {
|
||||
int kcurr = orderVector[jr];
|
||||
static void switch_pos(std::vector<size_t>& orderVector, size_t jr, size_t kspec) {
|
||||
size_t kcurr = orderVector[jr];
|
||||
orderVector[jr] = orderVector[kspec];
|
||||
orderVector[kspec] = kcurr;
|
||||
}
|
||||
|
|
@ -520,8 +519,8 @@ static int amax(double *x, int j, int n) {
|
|||
*
|
||||
* The solution is returned in the matrix b.
|
||||
*/
|
||||
static int mlequ(double *c, int idem, int n, double *b, int m) {
|
||||
int i, j, k, l;
|
||||
static int mlequ(double *c, size_t idem, size_t n, double *b, size_t m) {
|
||||
size_t i, j, k, l;
|
||||
double R;
|
||||
|
||||
/*
|
||||
|
|
@ -603,20 +602,20 @@ static int amax(double *x, int j, int n) {
|
|||
* formular matrix. This guarrantees that BasisOptimize has a
|
||||
* nonsingular matrix to invert.
|
||||
*/
|
||||
int Cantera::ElemRearrange(int nComponents, const vector_fp & elementAbundances,
|
||||
MultiPhase *mphase,
|
||||
vector_int & orderVectorSpecies,
|
||||
vector_int & orderVectorElements) {
|
||||
|
||||
int j, k, l, i, jl, ml, jr, ielem, jj, kk=0;
|
||||
size_t Cantera::ElemRearrange(size_t nComponents, const vector_fp & elementAbundances,
|
||||
MultiPhase *mphase,
|
||||
std::vector<size_t>& orderVectorSpecies,
|
||||
std::vector<size_t>& orderVectorElements) {
|
||||
|
||||
size_t j, k, l, i, jl, ml, jr, ielem, jj, kk=0;
|
||||
|
||||
bool lindep = false;
|
||||
int nelements = mphase->nElements();
|
||||
size_t nelements = mphase->nElements();
|
||||
std::string ename;
|
||||
/*
|
||||
* Get the total number of species in the multiphase object
|
||||
*/
|
||||
int nspecies = mphase->nSpecies();
|
||||
size_t nspecies = mphase->nSpecies();
|
||||
|
||||
double test = -1.0E10;
|
||||
#ifdef DEBUG_MODE
|
||||
|
|
@ -631,7 +630,7 @@ int Cantera::ElemRearrange(int nComponents, const vector_fp & elementAbundances,
|
|||
/*
|
||||
* Perhaps, initialize the element ordering
|
||||
*/
|
||||
if ((int) orderVectorElements.size() < nelements) {
|
||||
if (orderVectorElements.size() < nelements) {
|
||||
orderVectorElements.resize(nelements);
|
||||
for (j = 0; j < nelements; j++) {
|
||||
orderVectorElements[j] = j;
|
||||
|
|
@ -643,7 +642,7 @@ int Cantera::ElemRearrange(int nComponents, const vector_fp & elementAbundances,
|
|||
* dangerous, as this ordering is assumed to yield the
|
||||
* component species for the problem
|
||||
*/
|
||||
if ((int) orderVectorSpecies.size() != nspecies) {
|
||||
if (orderVectorSpecies.size() != nspecies) {
|
||||
orderVectorSpecies.resize(nspecies);
|
||||
for (k = 0; k < nspecies; k++) {
|
||||
orderVectorSpecies[k] = k;
|
||||
|
|
@ -657,7 +656,7 @@ int Cantera::ElemRearrange(int nComponents, const vector_fp & elementAbundances,
|
|||
* end of the element ordering.
|
||||
*/
|
||||
vector_fp eAbund(nelements,0.0);
|
||||
if ((int) elementAbundances.size() != nelements) {
|
||||
if (elementAbundances.size() != nelements) {
|
||||
for (j = 0; j < nelements; j++) {
|
||||
eAbund[j] = 0.0;
|
||||
for (k = 0; k < nspecies; k++) {
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ namespace Cantera {
|
|||
m_orderVectorElements, formRxnMatrix);
|
||||
|
||||
for (size_t m = 0; m < m_nComponents; m++) {
|
||||
int k = m_orderVectorSpecies[m];
|
||||
size_t k = m_orderVectorSpecies[m];
|
||||
m_component[m] = k;
|
||||
if (xMF_est[k] < 1.0E-8) {
|
||||
xMF_est[k] = 1.0E-8;
|
||||
|
|
@ -359,8 +359,8 @@ namespace Cantera {
|
|||
s.setMoleFractions(DATA_PTR(xMF_est));
|
||||
s.getMoleFractions(DATA_PTR(xMF_est));
|
||||
|
||||
int nct = Cantera::ElemRearrange(m_nComponents, elMolesGoal, mp,
|
||||
m_orderVectorSpecies, m_orderVectorElements);
|
||||
size_t nct = Cantera::ElemRearrange(m_nComponents, elMolesGoal, mp,
|
||||
m_orderVectorSpecies, m_orderVectorElements);
|
||||
if (nct != m_nComponents) {
|
||||
throw CanteraError("ChemEquil::estimateElementPotentials",
|
||||
"confused");
|
||||
|
|
@ -494,7 +494,6 @@ namespace Cantera {
|
|||
{
|
||||
doublereal xval, yval, tmp;
|
||||
int fail = 0;
|
||||
int m, im;
|
||||
|
||||
if (m_p1) delete m_p1;
|
||||
if (m_p2) delete m_p2;
|
||||
|
|
@ -581,8 +580,8 @@ namespace Cantera {
|
|||
xval = m_p1->value(s);
|
||||
yval = m_p2->value(s);
|
||||
|
||||
int mm = m_mm;
|
||||
int nvar = mm + 1;
|
||||
size_t mm = m_mm;
|
||||
size_t nvar = mm + 1;
|
||||
DenseMatrix jac(nvar, nvar); // jacobian
|
||||
vector_fp x(nvar, -102.0); // solution vector
|
||||
vector_fp res_trial(nvar, 0.0); // residual
|
||||
|
|
@ -594,8 +593,9 @@ namespace Cantera {
|
|||
* We choose the equation of the element with the highest element
|
||||
* abundance.
|
||||
*/
|
||||
size_t m;
|
||||
tmp = -1.0;
|
||||
for (im = 0; im < m_nComponents; im++) {
|
||||
for (size_t im = 0; im < m_nComponents; im++) {
|
||||
m = m_orderVectorElements[im];
|
||||
if (elMolesGoal[m] > tmp ) {
|
||||
m_skip = m;
|
||||
|
|
@ -612,7 +612,7 @@ namespace Cantera {
|
|||
// changing the composition at this point only affects the
|
||||
// starting point, not the final solution.
|
||||
vector_fp xmm(m_kk, 0.0);
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
xmm[k] = s.moleFraction(k) + 1.0E-32;
|
||||
}
|
||||
s.setMoleFractions(DATA_PTR(xmm));
|
||||
|
|
@ -1115,15 +1115,14 @@ namespace Cantera {
|
|||
if (loglevel > 0) {
|
||||
beginLogGroup("ChemEquil::equilResidual");
|
||||
}
|
||||
int n, m;
|
||||
doublereal xx, yy;
|
||||
doublereal temp = exp(x[m_mm]);
|
||||
setToEquilState(s, x, temp);
|
||||
|
||||
// residuals are the total element moles
|
||||
vector_fp& elmFrac = m_elementmolefracs;
|
||||
for (n = 0; n < m_mm; n++) {
|
||||
m = m_orderVectorElements[n];
|
||||
for (size_t n = 0; n < m_mm; n++) {
|
||||
size_t m = m_orderVectorElements[n];
|
||||
// drive element potential for absent elements to -1000
|
||||
if (elmFracGoal[m] < m_elemFracCutoff && m != m_eloc) {
|
||||
resid[m] = x[m] + 1000.0;
|
||||
|
|
@ -1320,9 +1319,9 @@ namespace Cantera {
|
|||
s.saveState(state);
|
||||
double tmp, sum;
|
||||
bool modifiedMatrix = false;
|
||||
int neq = m_mm+1;
|
||||
size_t neq = m_mm+1;
|
||||
int retn = 1;
|
||||
int m, n, k, info, im;
|
||||
size_t m, n, k, im;
|
||||
DenseMatrix a1(neq, neq, 0.0);
|
||||
vector_fp b(neq, 0.0);
|
||||
vector_fp n_i(m_kk,0.0);
|
||||
|
|
@ -1484,7 +1483,7 @@ namespace Cantera {
|
|||
/*
|
||||
* Decide if we are to do a normal step or a modified step
|
||||
*/
|
||||
int iM = -1;
|
||||
size_t iM = -1;
|
||||
for (m = 0; m < m_mm; m++) {
|
||||
if (elMoles[m] > 0.001 * elMolesTotal) {
|
||||
if (eMolesCalc[m] > 1000. * elMoles[m]) {
|
||||
|
|
@ -1571,8 +1570,8 @@ namespace Cantera {
|
|||
}
|
||||
#endif
|
||||
for (m = 0; m < m_mm; m++) {
|
||||
int kMSp = -1;
|
||||
int kMSp2 = -1;
|
||||
size_t kMSp = -1;
|
||||
size_t kMSp2 = -1;
|
||||
int nSpeciesWithElem = 0;
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
if (n_i_calc[k] > nCutoff) {
|
||||
|
|
@ -1815,7 +1814,7 @@ namespace Cantera {
|
|||
#endif
|
||||
|
||||
try {
|
||||
info = solve(a1, DATA_PTR(resid));
|
||||
int info = solve(a1, DATA_PTR(resid));
|
||||
}
|
||||
catch (CanteraError) {
|
||||
addLogEntry("estimateEP_Brinkley:Jacobian is singular.");
|
||||
|
|
@ -1904,7 +1903,7 @@ namespace Cantera {
|
|||
*
|
||||
*/
|
||||
void ChemEquil::adjustEloc(thermo_t &s, vector_fp & elMolesGoal) {
|
||||
if (m_eloc < 0) return;
|
||||
if (m_eloc == -1) return;
|
||||
if (fabs(elMolesGoal[m_eloc]) > 1.0E-20) return;
|
||||
s.getMoleFractions(DATA_PTR(m_molefractions));
|
||||
int k;
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ namespace Cantera {
|
|||
* This is equal to the rank of the stoichiometric coefficient
|
||||
* matrix when it is computed. It's initialized to m_mm.
|
||||
*/
|
||||
int m_nComponents;
|
||||
size_t m_nComponents;
|
||||
|
||||
PropertyCalculator<thermo_t> *m_p1, *m_p2;
|
||||
|
||||
|
|
@ -237,8 +237,8 @@ namespace Cantera {
|
|||
bool m_doResPerturb;
|
||||
|
||||
|
||||
vector_int m_orderVectorElements;
|
||||
vector_int m_orderVectorSpecies;
|
||||
std::vector<size_t> m_orderVectorElements;
|
||||
std::vector<size_t> m_orderVectorSpecies;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ namespace Cantera {
|
|||
void MultiPhase::init() {
|
||||
if (m_init) return;
|
||||
index_t ip, kp, k = 0, nsp, m;
|
||||
int mlocal;
|
||||
size_t mlocal;
|
||||
string sym;
|
||||
|
||||
// allocate space for the atomic composition matrix
|
||||
|
|
@ -144,7 +144,7 @@ namespace Cantera {
|
|||
nsp = p->nSpecies();
|
||||
mlocal = p->elementIndex(sym);
|
||||
for (kp = 0; kp < nsp; kp++) {
|
||||
if (mlocal >= 0) {
|
||||
if (mlocal != -1) {
|
||||
m_atoms(m, k) = p->nAtoms(kp, mlocal);
|
||||
}
|
||||
if (m == 0) {
|
||||
|
|
@ -224,13 +224,13 @@ namespace Cantera {
|
|||
return sum;
|
||||
}
|
||||
|
||||
int MultiPhase::speciesIndex(std::string speciesName, std::string phaseName) {
|
||||
int p = phaseIndex(phaseName);
|
||||
if (p < 0) {
|
||||
size_t MultiPhase::speciesIndex(std::string speciesName, std::string phaseName) {
|
||||
size_t p = phaseIndex(phaseName);
|
||||
if (p == -1) {
|
||||
throw CanteraError("MultiPhase::speciesIndex", "phase not found: " + phaseName);
|
||||
}
|
||||
int k = m_phase[p]->speciesIndex(speciesName);
|
||||
if (k < 0) {
|
||||
size_t k = m_phase[p]->speciesIndex(speciesName);
|
||||
if (k == -1) {
|
||||
throw CanteraError("MultiPhase::speciesIndex", "species not found: " + speciesName);
|
||||
}
|
||||
return m_spstart[p] + k;
|
||||
|
|
@ -374,9 +374,8 @@ namespace Cantera {
|
|||
void MultiPhase::setPhaseMoleFractions(const index_t n, const doublereal* const x) {
|
||||
phase_t* p = m_phase[n];
|
||||
p->setState_TPX(m_temp, m_press, x);
|
||||
int nsp = p->nSpecies();
|
||||
int istart = m_spstart[n];
|
||||
for (int k = 0; k < nsp; k++) {
|
||||
size_t istart = m_spstart[n];
|
||||
for (int k = 0; k < p->nSpecies(); k++) {
|
||||
m_moleFractions[istart+k] = x[k];
|
||||
}
|
||||
}
|
||||
|
|
@ -385,7 +384,7 @@ namespace Cantera {
|
|||
// species name strings to mole numbers. Mole numbers that are
|
||||
// less than or equal to zero will be set to zero.
|
||||
void MultiPhase::setMolesByName(compositionMap& xMap) {
|
||||
int kk = nSpecies();
|
||||
size_t kk = nSpecies();
|
||||
doublereal x;
|
||||
vector_fp moles(kk, 0.0);
|
||||
for (int k = 0; k < kk; k++) {
|
||||
|
|
@ -403,8 +402,7 @@ namespace Cantera {
|
|||
// add an entry in the map for every species, with value -1.0.
|
||||
// Function parseCompString (stringUtils.cpp) uses the names
|
||||
// in the map to specify the allowed species.
|
||||
int kk = nSpecies();
|
||||
for (int k = 0; k < kk; k++) {
|
||||
for (int k = 0; k < nSpecies(); k++) {
|
||||
xx[speciesName(k)] = -1.0;
|
||||
}
|
||||
|
||||
|
|
@ -904,7 +902,7 @@ namespace Cantera {
|
|||
m_moles[n] = moles;
|
||||
}
|
||||
|
||||
int MultiPhase::speciesPhaseIndex(const index_t kGlob) const {
|
||||
size_t MultiPhase::speciesPhaseIndex(const index_t kGlob) const {
|
||||
return m_spphase[kGlob];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ namespace Cantera {
|
|||
* If the species or phase name is not recognized, this routine throws
|
||||
* a CanteraError.
|
||||
*/
|
||||
int speciesIndex(std::string speciesName, std::string phaseName);
|
||||
size_t speciesIndex(std::string speciesName, std::string phaseName);
|
||||
|
||||
/// Minimum temperature for which all solution phases have
|
||||
/// valid thermo data. Stoichiometric phases are not
|
||||
|
|
@ -426,7 +426,7 @@ namespace Cantera {
|
|||
* @return
|
||||
* Returns the index of the owning phase.
|
||||
*/
|
||||
int speciesPhaseIndex(const index_t kGlob) const;
|
||||
size_t speciesPhaseIndex(const index_t kGlob) const;
|
||||
|
||||
//! Returns the mole fraction of global species k
|
||||
/*!
|
||||
|
|
@ -758,10 +758,10 @@ namespace Cantera {
|
|||
*
|
||||
* @ingroup equilfunctions
|
||||
*/
|
||||
int BasisOptimize( int *usedZeroedSpecies, bool doFormRxn,
|
||||
MultiPhase *mphase, vector_int & orderVectorSpecies,
|
||||
vector_int & orderVectorElements,
|
||||
vector_fp & formRxnMatrix);
|
||||
size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn,
|
||||
MultiPhase* mphase, std::vector<size_t>& orderVectorSpecies,
|
||||
std::vector<size_t>& orderVectorElements,
|
||||
vector_fp& formRxnMatrix);
|
||||
|
||||
//! This subroutine handles the potential rearrangement of the constraint
|
||||
//! equations represented by the Formula Matrix.
|
||||
|
|
@ -813,10 +813,10 @@ namespace Cantera {
|
|||
*
|
||||
* @ingroup equilfunctions
|
||||
*/
|
||||
int ElemRearrange(int nComponents, const vector_fp & elementAbundances,
|
||||
MultiPhase *mphase,
|
||||
vector_int & orderVectorSpecies,
|
||||
vector_int & orderVectorElements);
|
||||
size_t ElemRearrange(size_t nComponents, const vector_fp& elementAbundances,
|
||||
MultiPhase* mphase,
|
||||
std::vector<size_t>& orderVectorSpecies,
|
||||
std::vector<size_t>& orderVectorElements);
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
//! External int that is used to turn on debug printing for the
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ namespace Cantera {
|
|||
// The left m_nel columns of A are now upper-diagonal. Now
|
||||
// reduce the m_nel columns to diagonal form by back-solving
|
||||
for (m = nRows-1; m > 0; m--) {
|
||||
for (int n = m-1; n>= 0; n--) {
|
||||
for (size_t n = m-1; n != -1; n--) {
|
||||
if (m_A(n,m) != 0.0) {
|
||||
fctr = m_A(n,m);
|
||||
for (k = m; k < m_nsp; k++) {
|
||||
|
|
@ -770,7 +770,7 @@ namespace Cantera {
|
|||
psum = 0.0;
|
||||
for (k = 0; k < m_nsp; k++) {
|
||||
kc = m_species[k];
|
||||
if (m_mix->speciesPhaseIndex(kc) == (int) ip) {
|
||||
if (m_mix->speciesPhaseIndex(kc) == ip) {
|
||||
// bug fixed 7/12/06 DGG
|
||||
stoich = nu[k]; // nu[kc];
|
||||
psum += stoich * stoich;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Cantera {
|
|||
|
||||
virtual ~MultiPhaseEquil() {}
|
||||
|
||||
int constituent(index_t m) {
|
||||
size_t constituent(index_t m) {
|
||||
if (m < m_nel) return m_order[m];
|
||||
else return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ DoubleStarStar::DoubleStarStar() :
|
|||
* Constructor. Create an \c m by \c n array, and initialize
|
||||
* all elements to \c v.
|
||||
*/
|
||||
DoubleStarStar::DoubleStarStar(int m, int n, double v) :
|
||||
DoubleStarStar::DoubleStarStar(size_t m, size_t n, double v) :
|
||||
m_nrows(n),
|
||||
m_ncols(m)
|
||||
{
|
||||
m_data.resize(n*m);
|
||||
std::fill(m_data.begin(), m_data.end(), v);
|
||||
m_colAddr.resize(m);
|
||||
for (int jcol = 0; jcol < m_ncols; jcol++) {
|
||||
for (size_t jcol = 0; jcol < m_ncols; jcol++) {
|
||||
m_colAddr[jcol] = &(m_data[jcol*m_nrows]);
|
||||
}
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ DoubleStarStar::DoubleStarStar(const DoubleStarStar& y) {
|
|||
m_data.resize(m_nrows*m_ncols);
|
||||
m_data = y.m_data;
|
||||
m_colAddr.resize(m_ncols);
|
||||
for (int jcol = 0; jcol < m_ncols; jcol++) {
|
||||
for (size_t jcol = 0; jcol < m_ncols; jcol++) {
|
||||
m_colAddr[jcol] = &(m_data[jcol*m_nrows]);
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ DoubleStarStar& DoubleStarStar::operator=(const DoubleStarStar& y) {
|
|||
m_data.resize(m_nrows*m_ncols);
|
||||
m_data = y.m_data;
|
||||
m_colAddr.resize(m_ncols);
|
||||
for (int jcol = 0; jcol < m_ncols; jcol++) {
|
||||
for (size_t jcol = 0; jcol < m_ncols; jcol++) {
|
||||
m_colAddr[jcol] = &(m_data[jcol*m_nrows]);
|
||||
}
|
||||
return *this;
|
||||
|
|
@ -65,7 +65,7 @@ DoubleStarStar& DoubleStarStar::operator=(const DoubleStarStar& y) {
|
|||
* @param m This is the number of columns in the new matrix
|
||||
* @param v Default fill value -> defaults to zero.
|
||||
*/
|
||||
void DoubleStarStar::resize(int m, int n, double v) {
|
||||
void DoubleStarStar::resize(size_t m, size_t n, double v) {
|
||||
std::vector<double> old_data;
|
||||
bool doCopy = false;
|
||||
if (m_nrows > 0 && m_ncols > 0) {
|
||||
|
|
@ -77,23 +77,23 @@ void DoubleStarStar::resize(int m, int n, double v) {
|
|||
m_data.resize(n*m, v);
|
||||
if (doCopy) {
|
||||
if (n >= m_nrows && m >= m_ncols) {
|
||||
for (int jcol = 0; jcol < m_ncols; jcol++) {
|
||||
for (int irow = 0; irow < m_nrows; irow++) {
|
||||
for (size_t jcol = 0; jcol < m_ncols; jcol++) {
|
||||
for (size_t irow = 0; irow < m_nrows; irow++) {
|
||||
m_data[jcol*n + irow] = old_data[jcol*m_nrows + irow];
|
||||
}
|
||||
for (int irow = m_nrows; irow < n; irow++) {
|
||||
for (size_t irow = m_nrows; irow < n; irow++) {
|
||||
m_data[jcol*n + irow] = v;
|
||||
}
|
||||
}
|
||||
for (int jcol = m_ncols; jcol < m; jcol++) {
|
||||
for (int irow = 0; irow < n; irow++) {
|
||||
for (size_t jcol = m_ncols; jcol < m; jcol++) {
|
||||
for (size_t irow = 0; irow < n; irow++) {
|
||||
m_data[jcol*n + irow] = v;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
std::fill(m_data.begin(), m_data.end(), v);
|
||||
for (int jcol = 0; jcol < m_ncols; jcol++) {
|
||||
for (int irow = 0; irow < m_nrows; irow++) {
|
||||
for (size_t jcol = 0; jcol < m_ncols; jcol++) {
|
||||
for (size_t irow = 0; irow < m_nrows; irow++) {
|
||||
m_data[jcol*n + irow] = old_data[jcol*m_nrows + irow];
|
||||
}
|
||||
}
|
||||
|
|
@ -102,16 +102,16 @@ void DoubleStarStar::resize(int m, int n, double v) {
|
|||
m_nrows = n;
|
||||
m_ncols = m;
|
||||
m_colAddr.resize(m_ncols);
|
||||
for (int jcol = 0; jcol < m_ncols; jcol++) {
|
||||
for (size_t jcol = 0; jcol < m_ncols; jcol++) {
|
||||
m_colAddr[jcol] = &(m_data[jcol*m_nrows]);
|
||||
}
|
||||
}
|
||||
|
||||
double * const DoubleStarStar::operator[](int jcol) {
|
||||
double * const DoubleStarStar::operator[](size_t jcol) {
|
||||
return m_colAddr[jcol];
|
||||
}
|
||||
|
||||
const double * const DoubleStarStar::operator[](int jcol) const {
|
||||
const double * const DoubleStarStar::operator[](size_t jcol) const {
|
||||
return (const double * const) m_colAddr[jcol];
|
||||
}
|
||||
|
||||
|
|
@ -124,12 +124,12 @@ double const * const * const DoubleStarStar::constBaseDataAddr() const {
|
|||
}
|
||||
|
||||
// Number of rows
|
||||
int DoubleStarStar::nRows() const {
|
||||
size_t DoubleStarStar::nRows() const {
|
||||
return m_nrows;
|
||||
}
|
||||
|
||||
// Number of columns
|
||||
int DoubleStarStar::nColumns() const {
|
||||
size_t DoubleStarStar::nColumns() const {
|
||||
return m_ncols;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public:
|
|||
* @param mcol Number of columns
|
||||
* @param nrow Number of rows
|
||||
*/
|
||||
DoubleStarStar(int mcol, int nrow, double v = 0.0);
|
||||
DoubleStarStar(size_t mcol, size_t nrow, double v = 0.0);
|
||||
|
||||
//! copy constructor
|
||||
/*!
|
||||
|
|
@ -61,7 +61,7 @@ public:
|
|||
* @param ncol This is the number of rows
|
||||
* @param v Default fill value -> defaults to zero.
|
||||
*/
|
||||
void resize(int mcol, int nrow, double v = 0.0);
|
||||
void resize(size_t mcol, size_t nrow, double v = 0.0);
|
||||
|
||||
//! Pointer to the top of the column
|
||||
/*!
|
||||
|
|
@ -69,7 +69,7 @@ public:
|
|||
*
|
||||
* @return returns the pointer to the top of the jth column
|
||||
*/
|
||||
double * const operator[](int jcol);
|
||||
double * const operator[](size_t jcol);
|
||||
|
||||
//! Returns a const Pointer to the top of the jth column
|
||||
/*!
|
||||
|
|
@ -77,7 +77,7 @@ public:
|
|||
*
|
||||
* @return returns the pointer to the top of the jth column
|
||||
*/
|
||||
const double * const operator[](int jcol) const;
|
||||
const double * const operator[](size_t jcol) const;
|
||||
|
||||
//! Returns a double ** pointer to the base address
|
||||
/*!
|
||||
|
|
@ -96,10 +96,10 @@ public:
|
|||
double const * const * const constBaseDataAddr() const;
|
||||
|
||||
//! Number of rows
|
||||
int nRows() const;
|
||||
size_t nRows() const;
|
||||
|
||||
//! Number of columns
|
||||
int nColumns() const;
|
||||
size_t nColumns() const;
|
||||
|
||||
private:
|
||||
//! Storage area
|
||||
|
|
@ -112,10 +112,10 @@ private:
|
|||
std::vector<double *> m_colAddr;
|
||||
|
||||
//! number of rows
|
||||
int m_nrows;
|
||||
size_t m_nrows;
|
||||
|
||||
//! number of columns
|
||||
int m_ncols;
|
||||
size_t m_ncols;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,17 +55,13 @@ namespace VCSnonideal {
|
|||
m_printLvl(printLvl),
|
||||
m_vsolvePtr(0)
|
||||
{
|
||||
// Debugging level
|
||||
|
||||
int nsp = mix->nSpecies();
|
||||
int nel = mix->nElements();
|
||||
int nph = mix->nPhases();
|
||||
|
||||
/*
|
||||
* Create a VCS_PROB object that describes the equilibrium problem.
|
||||
* The constructor just mallocs the necessary objects and sizes them.
|
||||
*/
|
||||
m_vprob = new VCS_PROB(nsp, nel, nph);
|
||||
m_vprob = new VCS_PROB(mix->nSpecies(),
|
||||
mix->nElements(),
|
||||
mix->nPhases());
|
||||
m_mix = mix;
|
||||
m_vprob->m_printLvl = m_printLvl;
|
||||
/*
|
||||
|
|
@ -574,11 +570,11 @@ namespace VCSnonideal {
|
|||
|
||||
int maxit = maxsteps;;
|
||||
clockWC tickTock;
|
||||
int nsp = m_mix->nSpecies();
|
||||
int nel = m_mix->nElements();
|
||||
int nph = m_mix->nPhases();
|
||||
|
||||
if (m_vprob == 0) {
|
||||
m_vprob = new VCS_PROB(nsp, nel, nph);
|
||||
m_vprob = new VCS_PROB(m_mix->nSpecies(),
|
||||
m_mix->nElements(),
|
||||
m_mix->nPhases());
|
||||
}
|
||||
m_printLvl = printLvl;
|
||||
m_vprob->m_printLvl = printLvl;
|
||||
|
|
@ -652,12 +648,11 @@ namespace VCSnonideal {
|
|||
* states.
|
||||
*/
|
||||
m_mix->uploadMoleFractionsFromPhases();
|
||||
int kGlob = 0;
|
||||
size_t kGlob = 0;
|
||||
for (int ip = 0; ip < m_vprob->NPhase; ip++) {
|
||||
double phaseMole = 0.0;
|
||||
Cantera::ThermoPhase &tref = m_mix->phase(ip);
|
||||
int nspPhase = tref.nSpecies();
|
||||
for (int k = 0; k < nspPhase; k++, kGlob++) {
|
||||
for (size_t k = 0; k < tref.nSpecies(); k++, kGlob++) {
|
||||
phaseMole += m_vprob->w[kGlob];
|
||||
}
|
||||
//phaseMole *= 1.0E-3;
|
||||
|
|
@ -913,8 +908,8 @@ namespace VCSnonideal {
|
|||
/*
|
||||
* Calculate the total number of species and phases in the problem
|
||||
*/
|
||||
int totNumPhases = mphase->nPhases();
|
||||
int totNumSpecies = mphase->nSpecies();
|
||||
size_t totNumPhases = mphase->nPhases();
|
||||
size_t totNumSpecies = mphase->nSpecies();
|
||||
|
||||
// Problem type has yet to be worked out.
|
||||
vprob->prob_type = 0;
|
||||
|
|
@ -947,7 +942,7 @@ namespace VCSnonideal {
|
|||
*/
|
||||
iSurPhase = -1;
|
||||
tPhase = &(mphase->phase(iphase));
|
||||
int nelem = tPhase->nElements();
|
||||
size_t nelem = tPhase->nElements();
|
||||
|
||||
/*
|
||||
* Query Cantera for the equation of state type of the
|
||||
|
|
@ -960,7 +955,7 @@ namespace VCSnonideal {
|
|||
/*
|
||||
* Find out the number of species in the phase
|
||||
*/
|
||||
int nSpPhase = tPhase->nSpecies();
|
||||
size_t nSpPhase = tPhase->nSpecies();
|
||||
/*
|
||||
* Find out the name of the phase
|
||||
*/
|
||||
|
|
@ -1299,8 +1294,8 @@ namespace VCSnonideal {
|
|||
*/
|
||||
int vcs_Cantera_update_vprob(Cantera::MultiPhase *mphase,
|
||||
VCSnonideal::VCS_PROB *vprob) {
|
||||
int totNumPhases = mphase->nPhases();
|
||||
int kT = 0;
|
||||
size_t totNumPhases = mphase->nPhases();
|
||||
size_t kT = 0;
|
||||
std::vector<double> tmpMoles;
|
||||
// Problem type has yet to be worked out.
|
||||
vprob->prob_type = 0;
|
||||
|
|
@ -1312,7 +1307,7 @@ namespace VCSnonideal {
|
|||
vprob->Vol = mphase->volume();
|
||||
Cantera::ThermoPhase *tPhase = 0;
|
||||
|
||||
for (int iphase = 0; iphase < totNumPhases; iphase++) {
|
||||
for (size_t iphase = 0; iphase < totNumPhases; iphase++) {
|
||||
tPhase = &(mphase->phase(iphase));
|
||||
vcs_VolPhase *volPhase = vprob->VPhaseList[iphase];
|
||||
/*
|
||||
|
|
@ -1327,10 +1322,10 @@ namespace VCSnonideal {
|
|||
/*
|
||||
* Loop through each species in the current phase
|
||||
*/
|
||||
int nSpPhase = tPhase->nSpecies();
|
||||
size_t nSpPhase = tPhase->nSpecies();
|
||||
// volPhase->TMoles = 0.0;
|
||||
tmpMoles.resize(nSpPhase);
|
||||
for (int k = 0; k < nSpPhase; k++) {
|
||||
for (size_t k = 0; k < nSpPhase; k++) {
|
||||
tmpMoles[k] = mphase->speciesMoles(kT);
|
||||
vprob->w[kT] = mphase->speciesMoles(kT);
|
||||
vprob->mf[kT] = mphase->moleFraction(kT);
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ namespace VCSnonideal {
|
|||
*
|
||||
* constructor():
|
||||
*/
|
||||
vcs_SpeciesProperties::vcs_SpeciesProperties(int indexPhase,
|
||||
int indexSpeciesPhase,
|
||||
vcs_SpeciesProperties::vcs_SpeciesProperties(size_t indexPhase,
|
||||
size_t indexSpeciesPhase,
|
||||
vcs_VolPhase *owning) :
|
||||
IndexPhase(indexPhase),
|
||||
IndexSpeciesPhase(indexSpeciesPhase),
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
/*
|
||||
* constructor and destructor
|
||||
*/
|
||||
vcs_SpeciesProperties(int indexPhase, int indexSpeciesPhase,
|
||||
vcs_SpeciesProperties(size_t indexPhase, size_t indexSpeciesPhase,
|
||||
vcs_VolPhase *owning);
|
||||
virtual ~vcs_SpeciesProperties();
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ namespace VCSnonideal {
|
|||
|
||||
|
||||
m_elementNames.resize(b.m_numElemConstraints);
|
||||
for (int e = 0; e < b.m_numElemConstraints; e++) {
|
||||
for (size_t e = 0; e < b.m_numElemConstraints; e++) {
|
||||
m_elementNames[e] = b.m_elementNames[e];
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ namespace VCSnonideal {
|
|||
m_elementType = b.m_elementType;
|
||||
|
||||
m_formulaMatrix.resize(m_numElemConstraints, m_numSpecies, 0.0);
|
||||
for (int e = 0; e < m_numElemConstraints; e++) {
|
||||
for (size_t e = 0; e < m_numElemConstraints; e++) {
|
||||
for (int k = 0; k < m_numSpecies; k++) {
|
||||
m_formulaMatrix[e][k] = b.m_formulaMatrix[e][k];
|
||||
}
|
||||
|
|
@ -241,8 +241,8 @@ namespace VCSnonideal {
|
|||
}
|
||||
/***************************************************************************/
|
||||
|
||||
void vcs_VolPhase::resize(const int phaseNum, const int nspecies,
|
||||
const int numElem, const char * const phaseName,
|
||||
void vcs_VolPhase::resize(const size_t phaseNum, const size_t nspecies,
|
||||
const size_t numElem, const char * const phaseName,
|
||||
const double molesInert) {
|
||||
#ifdef DEBUG_MODE
|
||||
if (nspecies <= 0) {
|
||||
|
|
@ -301,7 +301,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
}
|
||||
ListSpeciesPtr.resize(nspecies, 0);
|
||||
for (int i = 0; i < nspecies; i++) {
|
||||
for (size_t i = 0; i < nspecies; i++) {
|
||||
ListSpeciesPtr[i] = new vcs_SpeciesProperties(phaseNum, i, this);
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
/***************************************************************************/
|
||||
|
||||
void vcs_VolPhase::elemResize(const int numElemConstraints) {
|
||||
void vcs_VolPhase::elemResize(const size_t numElemConstraints) {
|
||||
|
||||
m_elementNames.resize(numElemConstraints);
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ namespace VCSnonideal {
|
|||
* return one activity coefficient. Have to recalculate them all to get
|
||||
* one.
|
||||
*/
|
||||
double vcs_VolPhase::AC_calc_one(int kspec) const {
|
||||
double vcs_VolPhase::AC_calc_one(size_t kspec) const {
|
||||
if (! m_UpToDate_AC) {
|
||||
_updateActCoeff();
|
||||
}
|
||||
|
|
@ -647,7 +647,7 @@ namespace VCSnonideal {
|
|||
* Update the electric potential if it is a solution variable
|
||||
* in the equation system
|
||||
*/
|
||||
if (m_phiVarIndex >= 0) {
|
||||
if (m_phiVarIndex != -1) {
|
||||
kglob = IndSpecies[m_phiVarIndex];
|
||||
if (m_numSpecies == 1) {
|
||||
Xmol[m_phiVarIndex] = 1.0;
|
||||
|
|
@ -1095,8 +1095,8 @@ namespace VCSnonideal {
|
|||
setState_TP(Temp, Pres);
|
||||
p_VCS_UnitsFormat = VCS_UNITS_MKS;
|
||||
m_phi = TP_ptr->electricPotential();
|
||||
int nsp = TP_ptr->nSpecies();
|
||||
int nelem = TP_ptr->nElements();
|
||||
size_t nsp = TP_ptr->nSpecies();
|
||||
size_t nelem = TP_ptr->nElements();
|
||||
if (nsp != m_numSpecies) {
|
||||
if (m_numSpecies != 0) {
|
||||
plogf("Warning Nsp != NVolSpeces: %d %d \n", nsp, m_numSpecies);
|
||||
|
|
@ -1279,13 +1279,13 @@ namespace VCSnonideal {
|
|||
}
|
||||
/***************************************************************************/
|
||||
|
||||
int vcs_VolPhase::phiVarIndex() const {
|
||||
size_t vcs_VolPhase::phiVarIndex() const {
|
||||
return m_phiVarIndex;
|
||||
}
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
void vcs_VolPhase::setPhiVarIndex(int phiVarIndex) {
|
||||
void vcs_VolPhase::setPhiVarIndex(size_t phiVarIndex) {
|
||||
m_phiVarIndex = phiVarIndex;
|
||||
m_speciesUnknownType[m_phiVarIndex] = VCS_SPECIES_TYPE_INTERFACIALVOLTAGE;
|
||||
if (m_singleSpecies) {
|
||||
|
|
@ -1302,7 +1302,7 @@ namespace VCSnonideal {
|
|||
*
|
||||
* @param kindex kth species index.
|
||||
*/
|
||||
vcs_SpeciesProperties * vcs_VolPhase::speciesProperty(const int kindex) {
|
||||
vcs_SpeciesProperties * vcs_VolPhase::speciesProperty(const size_t kindex) {
|
||||
return ListSpeciesPtr[kindex];
|
||||
}
|
||||
/***************************************************************************/
|
||||
|
|
@ -1362,7 +1362,7 @@ namespace VCSnonideal {
|
|||
* @return Returns the VCS_SOLVE species index of the that species
|
||||
* This changes as rearrangements are carried out.
|
||||
*/
|
||||
int vcs_VolPhase::spGlobalIndexVCS(const int spIndex) const {
|
||||
size_t vcs_VolPhase::spGlobalIndexVCS(const size_t spIndex) const {
|
||||
return IndSpecies[spIndex];
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
|
@ -1375,8 +1375,8 @@ namespace VCSnonideal {
|
|||
* @return Returns the VCS_SOLVE species index of the that species
|
||||
* This changes as rearrangements are carried out.
|
||||
*/
|
||||
void vcs_VolPhase::setSpGlobalIndexVCS(const int spIndex,
|
||||
const int spGlobalIndex) {
|
||||
void vcs_VolPhase::setSpGlobalIndexVCS(const size_t spIndex,
|
||||
const size_t spGlobalIndex) {
|
||||
IndSpecies[spIndex] = spGlobalIndex;
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
|
@ -1426,7 +1426,7 @@ namespace VCSnonideal {
|
|||
/**********************************************************************/
|
||||
|
||||
// Returns the global index of the local element index for the phase
|
||||
void vcs_VolPhase::setElemGlobalIndex(const int eLocal, const int eGlobal) {
|
||||
void vcs_VolPhase::setElemGlobalIndex(const size_t eLocal, const size_t eGlobal) {
|
||||
DebugAssertThrowVCS(eLocal >= 0, "vcs_VolPhase::setElemGlobalIndex");
|
||||
DebugAssertThrowVCS(eLocal < m_numElemConstraints,
|
||||
"vcs_VolPhase::setElemGlobalIndex");
|
||||
|
|
@ -1434,12 +1434,12 @@ namespace VCSnonideal {
|
|||
}
|
||||
/**********************************************************************/
|
||||
|
||||
int vcs_VolPhase::nElemConstraints() const {
|
||||
size_t vcs_VolPhase::nElemConstraints() const {
|
||||
return m_numElemConstraints;
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
std::string vcs_VolPhase::elementName(const int e) const {
|
||||
std::string vcs_VolPhase::elementName(const size_t e) const {
|
||||
return m_elementNames[e];
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
|
@ -1449,8 +1449,7 @@ namespace VCSnonideal {
|
|||
* or not.
|
||||
*/
|
||||
static bool hasChargedSpecies(const Cantera::ThermoPhase * const tPhase) {
|
||||
int nSpPhase = tPhase->nSpecies();
|
||||
for (int k = 0; k < nSpPhase; k++) {
|
||||
for (size_t k = 0; k < tPhase->nSpecies(); k++) {
|
||||
if (tPhase->charge(k) != 0.0) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1477,15 +1476,15 @@ namespace VCSnonideal {
|
|||
}
|
||||
|
||||
int vcs_VolPhase::transferElementsFM(const Cantera::ThermoPhase * const tPhase) {
|
||||
int e, k, eT;
|
||||
size_t e, k, eT;
|
||||
std::string ename;
|
||||
int eFound = -2;
|
||||
size_t eFound = -2;
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int nebase = tPhase->nElements();
|
||||
int ne = nebase;
|
||||
int ns = tPhase->nSpecies();
|
||||
size_t nebase = tPhase->nElements();
|
||||
size_t ne = nebase;
|
||||
size_t ns = tPhase->nSpecies();
|
||||
|
||||
/*
|
||||
* Decide whether we need an extra element constraint for charge
|
||||
|
|
@ -1503,7 +1502,7 @@ namespace VCSnonideal {
|
|||
elemResize(ne);
|
||||
|
||||
|
||||
if (ChargeNeutralityElement >= 0) {
|
||||
if (ChargeNeutralityElement != -1) {
|
||||
m_elementType[ChargeNeutralityElement] = VCS_ELEM_TYPE_CHARGENEUTRALITY;
|
||||
}
|
||||
|
||||
|
|
@ -1611,7 +1610,7 @@ namespace VCSnonideal {
|
|||
/*
|
||||
* @param e Element index.
|
||||
*/
|
||||
int vcs_VolPhase::elementType(const int e) const {
|
||||
int vcs_VolPhase::elementType(const size_t e) const {
|
||||
return m_elementType[e];
|
||||
}
|
||||
/***************************************************************************/
|
||||
|
|
@ -1621,7 +1620,7 @@ namespace VCSnonideal {
|
|||
* @param e Element index
|
||||
* @param eType type of the element.
|
||||
*/
|
||||
void vcs_VolPhase::setElementType(const int e, const int eType) {
|
||||
void vcs_VolPhase::setElementType(const size_t e, const int eType) {
|
||||
m_elementType[e] = eType;
|
||||
}
|
||||
/***************************************************************************/
|
||||
|
|
@ -1632,12 +1631,12 @@ namespace VCSnonideal {
|
|||
}
|
||||
/***************************************************************************/
|
||||
|
||||
int vcs_VolPhase::speciesUnknownType(const int k) const {
|
||||
int vcs_VolPhase::speciesUnknownType(const size_t k) const {
|
||||
return m_speciesUnknownType[k];
|
||||
}
|
||||
/***************************************************************************/
|
||||
|
||||
int vcs_VolPhase::elementActive(const int e) const {
|
||||
int vcs_VolPhase::elementActive(const size_t e) const {
|
||||
return m_elementActive[e];
|
||||
}
|
||||
/***************************************************************************/
|
||||
|
|
|
|||
|
|
@ -140,11 +140,11 @@ namespace VCSnonideal {
|
|||
* @param phaseName String name for the phase
|
||||
* @param molesInert kmoles of inert in the phase (defaults to zero)
|
||||
*/
|
||||
void resize(const int phaseNum, const int numSpecies,
|
||||
const int numElem, const char * const phaseName,
|
||||
void resize(const size_t phaseNum, const size_t numSpecies,
|
||||
const size_t numElem, const char * const phaseName,
|
||||
const double molesInert = 0.0);
|
||||
|
||||
void elemResize(const int numElemConstraints);
|
||||
void elemResize(const size_t numElemConstraints);
|
||||
|
||||
//! Evaluate activity coefficients and return the kspec coefficient
|
||||
/*!
|
||||
|
|
@ -153,7 +153,7 @@ namespace VCSnonideal {
|
|||
*
|
||||
* @param kspec species number
|
||||
*/
|
||||
double AC_calc_one(int kspec) const;
|
||||
double AC_calc_one(size_t kspec) const;
|
||||
|
||||
|
||||
//! Set the moles and/or mole fractions within the phase
|
||||
|
|
@ -434,9 +434,9 @@ namespace VCSnonideal {
|
|||
|
||||
//! Return the index of the species that represents the
|
||||
//! the voltage of the phase
|
||||
int phiVarIndex() const;
|
||||
size_t phiVarIndex() const;
|
||||
|
||||
void setPhiVarIndex(int phiVarIndex);
|
||||
void setPhiVarIndex(size_t phiVarIndex);
|
||||
|
||||
//! Retrieve the kth Species structure for the species belonging to this phase
|
||||
/*!
|
||||
|
|
@ -444,7 +444,7 @@ namespace VCSnonideal {
|
|||
*
|
||||
* @param kindex kth species index.
|
||||
*/
|
||||
vcs_SpeciesProperties * speciesProperty(const int kindex);
|
||||
vcs_SpeciesProperties * speciesProperty(const size_t kindex);
|
||||
|
||||
//! int indicating whether the phase exists or not
|
||||
/*!
|
||||
|
|
@ -485,7 +485,7 @@ namespace VCSnonideal {
|
|||
* @return Returns the VCS_SOLVE species index of the species.
|
||||
* This changes as rearrangements are carried out.
|
||||
*/
|
||||
int spGlobalIndexVCS(const int spIndex) const;
|
||||
size_t spGlobalIndexVCS(const size_t spIndex) const;
|
||||
|
||||
|
||||
//! set the Global VCS index of the kth species in the phase
|
||||
|
|
@ -496,7 +496,7 @@ namespace VCSnonideal {
|
|||
* @return Returns the VCS_SOLVE species index of the that species
|
||||
* This changes as rearrangements are carried out.
|
||||
*/
|
||||
void setSpGlobalIndexVCS(const int spIndex, const int spGlobalIndex);
|
||||
void setSpGlobalIndexVCS(const size_t spIndex, const size_t spGlobalIndex);
|
||||
|
||||
//! Sets the total moles of inert in the phase
|
||||
/*!
|
||||
|
|
@ -519,29 +519,29 @@ namespace VCSnonideal {
|
|||
* @param eLocal Local phase element index
|
||||
* @param eGlobal Global phase element index
|
||||
*/
|
||||
void setElemGlobalIndex(const int eLocal, const int eGlobal);
|
||||
void setElemGlobalIndex(const size_t eLocal, const size_t eGlobal);
|
||||
|
||||
//! Returns the number of element constraints
|
||||
int nElemConstraints() const;
|
||||
size_t nElemConstraints() const;
|
||||
|
||||
//! Name of the element constraint with index \c e.
|
||||
/*!
|
||||
* @param e Element index.
|
||||
*/
|
||||
std::string elementName(const int e) const;
|
||||
std::string elementName(const size_t e) const;
|
||||
|
||||
//! Type of the element constraint with index \c e.
|
||||
/*!
|
||||
* @param e Element index.
|
||||
*/
|
||||
int elementType(const int e) const;
|
||||
int elementType(const size_t e) const;
|
||||
|
||||
//! Set the element Type of the element constraint with index \c e.
|
||||
/*!
|
||||
* @param e Element index
|
||||
* @param eType type of the element.
|
||||
*/
|
||||
void setElementType(const int e, const int eType);
|
||||
void setElementType(const size_t e, const int eType);
|
||||
|
||||
//! Transfer all of the element information from the
|
||||
//! ThermoPhase object to the vcs_VolPhase object.
|
||||
|
|
@ -572,10 +572,10 @@ namespace VCSnonideal {
|
|||
* metal electron -> VCS_SPECIES_INTERFACIALVOLTAGE
|
||||
* ( unknown is the interfacial voltage (volts)
|
||||
*/
|
||||
int speciesUnknownType(const int k) const;
|
||||
int speciesUnknownType(const size_t k) const;
|
||||
|
||||
|
||||
int elementActive(const int e) const;
|
||||
int elementActive(const size_t e) const;
|
||||
|
||||
|
||||
//! Return the number of species in the phase
|
||||
|
|
@ -670,7 +670,7 @@ namespace VCSnonideal {
|
|||
* miscibility gap, these numbers will stay the
|
||||
* same after the split.
|
||||
*/
|
||||
int VP_ID;
|
||||
size_t VP_ID;
|
||||
|
||||
//! ID of the surface or volume domain in which the
|
||||
//! this phase exists
|
||||
|
|
@ -703,7 +703,7 @@ namespace VCSnonideal {
|
|||
* If it has one. If it does not have a charge neutrality
|
||||
* constraint, then this value is equal to -1
|
||||
*/
|
||||
int ChargeNeutralityElement;
|
||||
size_t ChargeNeutralityElement;
|
||||
|
||||
//! Units for the chemical potential data, pressure data, volume,
|
||||
//! and species amounts
|
||||
|
|
@ -745,7 +745,7 @@ namespace VCSnonideal {
|
|||
/*!
|
||||
* This is usually equal to the number of elements.
|
||||
*/
|
||||
int m_numElemConstraints;
|
||||
size_t m_numElemConstraints;
|
||||
|
||||
//! vector of strings containing the element constraint names
|
||||
/*!
|
||||
|
|
@ -791,10 +791,10 @@ namespace VCSnonideal {
|
|||
|
||||
//! Index of the element number in the global list of elements
|
||||
//! storred in VCS_PROB or VCS_SOLVE
|
||||
std::vector<int> m_elemGlobalIndex;
|
||||
std::vector<size_t> m_elemGlobalIndex;
|
||||
|
||||
//! Number of species in the phase
|
||||
int m_numSpecies;
|
||||
size_t m_numSpecies;
|
||||
|
||||
public:
|
||||
//! String name for the phase
|
||||
|
|
@ -843,7 +843,7 @@ namespace VCSnonideal {
|
|||
* Note, as part of the vcs algorithm, the order of the species
|
||||
* vector is changed during the algorithm
|
||||
*/
|
||||
std::vector<int> IndSpecies;
|
||||
std::vector<size_t> IndSpecies;
|
||||
|
||||
//! Vector of Species structures for the species belonging to this phase
|
||||
/*!
|
||||
|
|
@ -879,7 +879,7 @@ namespace VCSnonideal {
|
|||
|
||||
//! If the potential is a solution variable in VCS, it acts as a species.
|
||||
//! This is the species index in the phase for the potential
|
||||
int m_phiVarIndex;
|
||||
size_t m_phiVarIndex;
|
||||
|
||||
//! Total Volume of the phase
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ namespace VCSnonideal {
|
|||
*/
|
||||
for (int iph = 0; iph < m_numPhases; iph++) {
|
||||
volPhase = m_VolPhaseList[iph];
|
||||
for (int e = 0; e < volPhase->nElemConstraints(); e++) {
|
||||
for (size_t e = 0; e < volPhase->nElemConstraints(); e++) {
|
||||
if (volPhase->elemGlobalIndex(e) == ipos) {
|
||||
volPhase->setElemGlobalIndex(e, jpos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ namespace VCSnonideal {
|
|||
* - 1 right aligned
|
||||
* - 2 left aligned
|
||||
*/
|
||||
void vcs_print_stringTrunc(const char *str, int space, int alignment);
|
||||
void vcs_print_stringTrunc(const char *str, size_t space, int alignment);
|
||||
|
||||
//! Simple routine to check whether two doubles are equal up to
|
||||
//! roundoff error
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ namespace VCSnonideal {
|
|||
vcs_VolPhase *vPhase = m_VolPhaseList[pID];
|
||||
vcs_SpeciesProperties *spProp = vPhase->speciesProperty(spPhIndex);
|
||||
double sz = 0.0;
|
||||
int eSize = spProp->FormulaMatrixCol.size();
|
||||
for (int e = 0; e < eSize; e++) {
|
||||
size_t eSize = spProp->FormulaMatrixCol.size();
|
||||
for (size_t e = 0; e < eSize; e++) {
|
||||
sz += fabs(spProp->FormulaMatrixCol[e]);
|
||||
}
|
||||
if (sz > 0.0) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace VCSnonideal {
|
|||
* We initialize the arrays in the structure to the appropriate sizes.
|
||||
* And, we initialize all of the elements of the arrays to defaults.
|
||||
*/
|
||||
VCS_PROB::VCS_PROB(int nsp, int nel, int nph) :
|
||||
VCS_PROB::VCS_PROB(size_t nsp, size_t nel, size_t nph) :
|
||||
prob_type(VCS_PROBTYPE_TP),
|
||||
nspecies(nsp),
|
||||
NSPECIES0(0),
|
||||
|
|
@ -357,7 +357,7 @@ namespace VCSnonideal {
|
|||
void VCS_PROB::addPhaseElements(vcs_VolPhase *volPhase) {
|
||||
int e, eVP;
|
||||
int foundPos = -1;
|
||||
int neVP = volPhase->nElemConstraints();
|
||||
size_t neVP = volPhase->nElemConstraints();
|
||||
std::string en;
|
||||
std::string enVP;
|
||||
/*
|
||||
|
|
@ -430,7 +430,7 @@ namespace VCSnonideal {
|
|||
*
|
||||
*/
|
||||
int VCS_PROB::addOnePhaseSpecies(vcs_VolPhase *volPhase, int k, int kT) {
|
||||
int e, eVP;
|
||||
size_t e, eVP;
|
||||
if (kT > nspecies) {
|
||||
/*
|
||||
* Need to expand the number of species here
|
||||
|
|
|
|||
|
|
@ -45,23 +45,23 @@ namespace VCSnonideal {
|
|||
int prob_type;
|
||||
|
||||
//! Total number of species in the problems
|
||||
int nspecies;
|
||||
size_t nspecies;
|
||||
|
||||
//! Species number used to malloc data structures
|
||||
int NSPECIES0;
|
||||
size_t NSPECIES0;
|
||||
|
||||
//! Number of element contraints in the equilibrium problem
|
||||
int ne;
|
||||
size_t ne;
|
||||
|
||||
//! Number of element constraints used to malloc data structures
|
||||
//! involving elements
|
||||
int NE0;
|
||||
size_t NE0;
|
||||
|
||||
//! Number of phases in the problem
|
||||
int NPhase;
|
||||
size_t NPhase;
|
||||
|
||||
//! Number of phases used to malloc data structures
|
||||
int NPHASE0;
|
||||
size_t NPHASE0;
|
||||
|
||||
//! Vector of chemical potentials of the species
|
||||
/*!
|
||||
|
|
@ -185,7 +185,7 @@ namespace VCSnonideal {
|
|||
double tolmin;
|
||||
|
||||
//! Mapping between the species and the phases
|
||||
std::vector<int> PhaseID;
|
||||
std::vector<size_t> PhaseID;
|
||||
|
||||
//! Vector of strings containing the species names
|
||||
std::vector<std::string> SpName;
|
||||
|
|
@ -250,7 +250,7 @@ namespace VCSnonideal {
|
|||
* @param nel number of elements
|
||||
* @param nph number of phases
|
||||
*/
|
||||
VCS_PROB(int nsp, int nel, int nph);
|
||||
VCS_PROB(size_t nsp, size_t nel, size_t nph);
|
||||
|
||||
//! Destructor
|
||||
~VCS_PROB();
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ namespace VCSnonideal {
|
|||
#endif
|
||||
|
||||
double vcs_l2norm(const std::vector<double> vec) {
|
||||
int len = vec.size();
|
||||
size_t len = vec.size();
|
||||
if (len == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
|
|
@ -483,7 +483,7 @@ namespace VCSnonideal {
|
|||
|
||||
/************************************************************************ **/
|
||||
|
||||
void vcs_print_stringTrunc(const char *str, int space, int alignment)
|
||||
void vcs_print_stringTrunc(const char *str, size_t space, int alignment)
|
||||
|
||||
/***********************************************************************
|
||||
* vcs_print_stringTrunc():
|
||||
|
|
@ -499,8 +499,8 @@ namespace VCSnonideal {
|
|||
* 2 left aligned
|
||||
***********************************************************************/
|
||||
{
|
||||
int i, ls=0, rs=0;
|
||||
int len = strlen(str);
|
||||
size_t i, ls=0, rs=0;
|
||||
size_t len = strlen(str);
|
||||
if ((len) >= space) {
|
||||
for (i = 0; i < space; i++) {
|
||||
plogf("%c", str[i]);
|
||||
|
|
|
|||
|
|
@ -87,8 +87,7 @@ namespace Cantera {
|
|||
|
||||
thermo().getStandardChemPotentials(&m_grt[0]);
|
||||
fill(m_rkc.begin(), m_rkc.end(), 0.0);
|
||||
int nsp = thermo().nSpecies();
|
||||
for (int k = 0; k < nsp; k++) {
|
||||
for (size_t k = 0; k < thermo().nSpecies(); k++) {
|
||||
doublereal logStandConc_k = thermo().logStandardConc(k);
|
||||
m_grt[k] -= rt * logStandConc_k;
|
||||
}
|
||||
|
|
@ -120,8 +119,7 @@ namespace Cantera {
|
|||
thermo().getStandardChemPotentials(&m_grt[0]);
|
||||
fill(rkc.begin(), rkc.end(), 0.0);
|
||||
doublereal rt = GasConstant * m_kdata->m_temp;
|
||||
int nsp = thermo().nSpecies();
|
||||
for (int k = 0; k < nsp; k++) {
|
||||
for (size_t k = 0; k < thermo().nSpecies(); k++) {
|
||||
doublereal logStandConc_k = thermo().logStandardConc(k);
|
||||
m_grt[k] -= rt * logStandConc_k;
|
||||
}
|
||||
|
|
@ -445,18 +443,18 @@ namespace Cantera {
|
|||
m_kdata->m_ropf.push_back(0.0); // extend by one for new rxn
|
||||
m_kdata->m_ropr.push_back(0.0);
|
||||
m_kdata->m_ropnet.push_back(0.0);
|
||||
int n, ns, m;
|
||||
size_t n, ns, m;
|
||||
doublereal nsFlt;
|
||||
doublereal reactantGlobalOrder = 0.0;
|
||||
doublereal productGlobalOrder = 0.0;
|
||||
int rnum = reactionNumber();
|
||||
|
||||
vector_int rk;
|
||||
int nr = r.reactants.size();
|
||||
std::vector<size_t> rk;
|
||||
size_t nr = r.reactants.size();
|
||||
for (n = 0; n < nr; n++) {
|
||||
nsFlt = r.rstoich[n];
|
||||
reactantGlobalOrder += nsFlt;
|
||||
ns = (int) nsFlt;
|
||||
ns = (size_t) nsFlt;
|
||||
if ((doublereal) ns != nsFlt) {
|
||||
if (ns < 1) {
|
||||
ns = 1;
|
||||
|
|
@ -470,12 +468,12 @@ namespace Cantera {
|
|||
}
|
||||
m_reactants.push_back(rk);
|
||||
|
||||
vector_int pk;
|
||||
int np = r.products.size();
|
||||
std::vector<size_t> pk;
|
||||
size_t np = r.products.size();
|
||||
for (n = 0; n < np; n++) {
|
||||
nsFlt = r.pstoich[n];
|
||||
productGlobalOrder += nsFlt;
|
||||
ns = (int) nsFlt;
|
||||
ns = (size_t) nsFlt;
|
||||
if ((double) ns != nsFlt) {
|
||||
if (ns < 1) {
|
||||
ns = 1;
|
||||
|
|
@ -506,7 +504,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
void AqueousKinetics::installGroups(int irxn,
|
||||
void AqueousKinetics::installGroups(size_t irxn,
|
||||
const vector<grouplist_t>& r,
|
||||
const vector<grouplist_t>& p) {
|
||||
if (!r.empty()) {
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ namespace Cantera {
|
|||
|
||||
protected:
|
||||
|
||||
int m_kk, m_nfall;
|
||||
size_t m_kk, m_nfall;
|
||||
|
||||
Rate1<Arrhenius> m_rates;
|
||||
|
||||
|
|
@ -346,7 +346,7 @@ namespace Cantera {
|
|||
|
||||
ReactionStoichMgr* m_rxnstoich;
|
||||
|
||||
std::vector<int> m_fwdOrder;
|
||||
std::vector<size_t> m_fwdOrder;
|
||||
|
||||
int m_nirrev;
|
||||
int m_nrev;
|
||||
|
|
@ -378,7 +378,7 @@ namespace Cantera {
|
|||
|
||||
private:
|
||||
|
||||
int reactionNumber(){ return m_ii;}
|
||||
size_t reactionNumber(){ return m_ii;}
|
||||
std::vector<std::map<int, doublereal> > m_stoich;
|
||||
|
||||
void addElementaryReaction(const ReactionData& r);
|
||||
|
|
@ -386,7 +386,7 @@ namespace Cantera {
|
|||
|
||||
void installReagents(const ReactionData& r);
|
||||
|
||||
void installGroups(int irxn, const std::vector<grouplist_t>& r,
|
||||
void installGroups(size_t irxn, const std::vector<grouplist_t>& r,
|
||||
const std::vector<grouplist_t>& p);
|
||||
void updateKc();
|
||||
|
||||
|
|
|
|||
|
|
@ -477,10 +477,10 @@ namespace Cantera {
|
|||
|
||||
// install high and low rate coeff calculators
|
||||
|
||||
int iloc = m_falloff_high_rates.install(m_nfall,
|
||||
r.rateCoeffType,
|
||||
r.rateCoeffParameters.size(),
|
||||
&r.rateCoeffParameters[0] );
|
||||
size_t iloc = m_falloff_high_rates.install(m_nfall,
|
||||
r.rateCoeffType,
|
||||
r.rateCoeffParameters.size(),
|
||||
&r.rateCoeffParameters[0] );
|
||||
|
||||
m_falloff_low_rates.install( m_nfall,
|
||||
r.rateCoeffType, r.auxRateCoeffParameters.size(),
|
||||
|
|
@ -520,7 +520,7 @@ namespace Cantera {
|
|||
|
||||
void GasKinetics::
|
||||
addElementaryReaction(const ReactionData& r) {
|
||||
int iloc;
|
||||
size_t iloc;
|
||||
|
||||
// install rate coeff calculator
|
||||
iloc = m_rates.install( reactionNumber(),
|
||||
|
|
@ -538,8 +538,7 @@ namespace Cantera {
|
|||
|
||||
void GasKinetics::
|
||||
addThreeBodyReaction(const ReactionData& r) {
|
||||
|
||||
int iloc;
|
||||
size_t iloc;
|
||||
// install rate coeff calculator
|
||||
iloc = m_rates.install( reactionNumber(),
|
||||
r.rateCoeffType, r.rateCoeffParameters.size(),
|
||||
|
|
@ -562,18 +561,18 @@ namespace Cantera {
|
|||
m_kdata->m_ropf.push_back(0.0); // extend by one for new rxn
|
||||
m_kdata->m_ropr.push_back(0.0);
|
||||
m_kdata->m_ropnet.push_back(0.0);
|
||||
int n, ns, m;
|
||||
size_t n, ns, m;
|
||||
doublereal nsFlt;
|
||||
doublereal reactantGlobalOrder = 0.0;
|
||||
doublereal productGlobalOrder = 0.0;
|
||||
int rnum = reactionNumber();
|
||||
size_t rnum = reactionNumber();
|
||||
|
||||
vector_int rk;
|
||||
int nr = r.reactants.size();
|
||||
std::vector<size_t> rk;
|
||||
size_t nr = r.reactants.size();
|
||||
for (n = 0; n < nr; n++) {
|
||||
nsFlt = r.rstoich[n];
|
||||
reactantGlobalOrder += nsFlt;
|
||||
ns = (int) nsFlt;
|
||||
ns = (size_t) nsFlt;
|
||||
if ((doublereal) ns != nsFlt) {
|
||||
if (ns < 1) {
|
||||
ns = 1;
|
||||
|
|
@ -587,12 +586,12 @@ namespace Cantera {
|
|||
}
|
||||
m_reactants.push_back(rk);
|
||||
|
||||
vector_int pk;
|
||||
int np = r.products.size();
|
||||
std::vector<size_t> pk;
|
||||
size_t np = r.products.size();
|
||||
for (n = 0; n < np; n++) {
|
||||
nsFlt = r.pstoich[n];
|
||||
productGlobalOrder += nsFlt;
|
||||
ns = (int) nsFlt;
|
||||
ns = (size_t) nsFlt;
|
||||
if ((double) ns != nsFlt) {
|
||||
if (ns < 1) {
|
||||
ns = 1;
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ namespace Cantera {
|
|||
|
||||
protected:
|
||||
|
||||
int m_kk, m_nfall;
|
||||
size_t m_kk, m_nfall;
|
||||
|
||||
array_int m_fallindx;
|
||||
|
||||
|
|
@ -347,7 +347,7 @@ namespace Cantera {
|
|||
Rate1<Arrhenius> m_falloff_high_rates;
|
||||
Rate1<Arrhenius> m_rates;
|
||||
|
||||
mutable std::map<int, std::pair<int, int> > m_index;
|
||||
mutable std::map<size_t, std::pair<int, size_t> > m_index;
|
||||
|
||||
FalloffMgr m_falloffn;
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ namespace Cantera {
|
|||
|
||||
ReactionStoichMgr* m_rxnstoich;
|
||||
|
||||
std::vector<int> m_fwdOrder;
|
||||
std::vector<size_t> m_fwdOrder;
|
||||
|
||||
int m_nirrev;
|
||||
int m_nrev;
|
||||
|
|
@ -391,7 +391,7 @@ namespace Cantera {
|
|||
|
||||
private:
|
||||
|
||||
int reactionNumber(){ return m_ii;}
|
||||
size_t reactionNumber(){ return m_ii;}
|
||||
std::vector<std::map<int, doublereal> > m_stoich;
|
||||
|
||||
void addElementaryReaction(const ReactionData& r);
|
||||
|
|
@ -404,8 +404,8 @@ namespace Cantera {
|
|||
const std::vector<grouplist_t>& p);
|
||||
void updateKc();
|
||||
|
||||
void registerReaction(int rxnNumber, int type, int loc) {
|
||||
m_index[rxnNumber] = std::pair<int, int>(type, loc);
|
||||
void registerReaction(size_t rxnNumber, int type, size_t loc) {
|
||||
m_index[rxnNumber] = std::pair<int, size_t>(type, loc);
|
||||
}
|
||||
bool m_finalized;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ namespace Cantera {
|
|||
*/
|
||||
void Group::validate() {
|
||||
|
||||
int n = m_comp.size();
|
||||
size_t n = m_comp.size();
|
||||
|
||||
// if already checked and not valid, return
|
||||
if (m_sign == -999) return;
|
||||
|
||||
m_sign = 0;
|
||||
bool ok = true;
|
||||
for (int m = 0; m < n; m++)
|
||||
for (size_t m = 0; m < n; m++)
|
||||
{
|
||||
if (m_comp[m] != 0)
|
||||
{
|
||||
|
|
@ -50,8 +50,8 @@ namespace Cantera {
|
|||
s << "(";
|
||||
int nm;
|
||||
bool first = true;
|
||||
int n = m_comp.size();
|
||||
for (int m = 0; m < n; m++) {
|
||||
size_t n = m_comp.size();
|
||||
for (size_t m = 0; m < n; m++) {
|
||||
nm = m_comp[m];
|
||||
if (nm != 0) {
|
||||
if (!first) s << "-";
|
||||
|
|
|
|||
|
|
@ -19,11 +19,18 @@ namespace Cantera {
|
|||
class Group {
|
||||
public:
|
||||
Group() : m_sign(-999) { }
|
||||
Group(int n) : m_sign(0) { m_comp.resize(n,0);}
|
||||
Group(const vector_int& elnumbers) :
|
||||
Group(size_t n) : m_sign(0) { m_comp.resize(n,0);}
|
||||
Group(const std::vector<int>& elnumbers) :
|
||||
m_comp(elnumbers), m_sign(0) {
|
||||
validate();
|
||||
}
|
||||
Group(const std::vector<size_t>& elnumbers) :
|
||||
m_comp(elnumbers.size()), m_sign(0) {
|
||||
for (size_t i = 0; i < elnumbers.size(); i++) {
|
||||
m_comp[i] = int(elnumbers[i]);
|
||||
}
|
||||
validate();
|
||||
}
|
||||
Group(const Group& g) :
|
||||
m_comp(g.m_comp), m_sign(g.m_sign) { }
|
||||
Group& operator=(const Group& g) {
|
||||
|
|
@ -40,28 +47,24 @@ namespace Cantera {
|
|||
*/
|
||||
void operator-=(const Group& other) {
|
||||
verifyInputs(*this, other);
|
||||
int n = m_comp.size();
|
||||
for (int m = 0; m < n; m++)
|
||||
for (size_t m = 0; m < m_comp.size(); m++)
|
||||
m_comp[m] -= other.m_comp[m];
|
||||
validate();
|
||||
}
|
||||
void operator+=(const Group& other) {
|
||||
verifyInputs(*this, other);
|
||||
int n = m_comp.size();
|
||||
for (int m = 0; m < n; m++)
|
||||
for (size_t m = 0; m < m_comp.size(); m++)
|
||||
m_comp[m] += other.m_comp[m];
|
||||
validate();
|
||||
}
|
||||
void operator*=(int a) {
|
||||
int n = m_comp.size();
|
||||
for (int m = 0; m < n; m++)
|
||||
for (size_t m = 0; m < m_comp.size(); m++)
|
||||
m_comp[m] *= a;
|
||||
validate();
|
||||
}
|
||||
bool operator==(const Group& other) const {
|
||||
verifyInputs(*this, other);
|
||||
int n = m_comp.size();
|
||||
for (int m = 0; m < n; m++) {
|
||||
for (size_t m = 0; m < m_comp.size(); m++) {
|
||||
if (m_comp[m] != other.m_comp[m]) return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -96,17 +99,18 @@ namespace Cantera {
|
|||
bool valid() const { return (m_sign != -999); }
|
||||
bool operator!() const { return (m_sign == -999); }
|
||||
int sign() const { return m_sign; }
|
||||
int size() const { return m_comp.size(); }
|
||||
size_t size() const { return m_comp.size(); }
|
||||
|
||||
/// Number of atoms in the group (>= 0)
|
||||
int nAtoms() const {
|
||||
int n = m_comp.size();
|
||||
int sum = 0;
|
||||
for (int m = 0; m < n; m++) sum += std::abs(m_comp[m]);
|
||||
for (size_t m = 0; m < m_comp.size(); m++) {
|
||||
sum += std::abs(m_comp[m]);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
/// Number of atoms of element m (positive or negative)
|
||||
int nAtoms(int m) const {
|
||||
int nAtoms(size_t m) const {
|
||||
if (m_comp.empty()) return 0;
|
||||
return m_comp[m];
|
||||
}
|
||||
|
|
@ -117,7 +121,7 @@ namespace Cantera {
|
|||
const Group& g);
|
||||
|
||||
private:
|
||||
vector_int m_comp;
|
||||
std::vector<int> m_comp;
|
||||
int m_sign;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ namespace Cantera {
|
|||
m_commonTempPressForPhases(true),
|
||||
m_ioFlag(0)
|
||||
{
|
||||
m_nsurf = static_cast<int>(k.size());
|
||||
int ns, nsp;
|
||||
int nt, ntmax = 0;
|
||||
int kinSpIndex = 0;
|
||||
m_nsurf = k.size();
|
||||
size_t ns, nsp;
|
||||
size_t nt, ntmax = 0;
|
||||
size_t kinSpIndex = 0;
|
||||
// Loop over the number of surface kinetics objects
|
||||
for (int n = 0; n < m_nsurf; n++) {
|
||||
for (size_t n = 0; n < m_nsurf; n++) {
|
||||
InterfaceKinetics *kinPtr = k[n];
|
||||
m_vecKinPtrs.push_back(kinPtr);
|
||||
ns = k[n]->surfacePhaseIndex();
|
||||
|
|
@ -55,13 +55,13 @@ namespace Cantera {
|
|||
m_specStartIndex.push_back(kinSpIndex);
|
||||
kinSpIndex += nsp;
|
||||
|
||||
int nPhases = kinPtr->nPhases();
|
||||
size_t nPhases = kinPtr->nPhases();
|
||||
vector_int pLocTmp(nPhases);
|
||||
int imatch = -1;
|
||||
for (int ip = 0; ip < nPhases; ip++) {
|
||||
size_t imatch = -1;
|
||||
for (size_t ip = 0; ip < nPhases; ip++) {
|
||||
if (ip != ns) {
|
||||
ThermoPhase *thPtr = & kinPtr->thermo(ip);
|
||||
if ((imatch = checkMatch(m_bulkPhases, thPtr)) < 0) {
|
||||
if ((imatch = checkMatch(m_bulkPhases, thPtr)) == -1) {
|
||||
m_bulkPhases.push_back(thPtr);
|
||||
m_numBulkPhases++;
|
||||
nsp = thPtr->nSpecies();
|
||||
|
|
@ -122,8 +122,8 @@ namespace Cantera {
|
|||
void ImplicitSurfChem::getInitialConditions(doublereal t0, size_t lenc,
|
||||
doublereal * c)
|
||||
{
|
||||
int loc = 0;
|
||||
for (int n = 0; n < m_nsurf; n++) {
|
||||
size_t loc = 0;
|
||||
for (size_t n = 0; n < m_nsurf; n++) {
|
||||
m_surf[n]->getCoverages(c + loc);
|
||||
loc += m_nsp[n];
|
||||
}
|
||||
|
|
@ -168,8 +168,8 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void ImplicitSurfChem::updateState(doublereal* c) {
|
||||
int loc = 0;
|
||||
for (int n = 0; n < m_nsurf; n++) {
|
||||
size_t loc = 0;
|
||||
for (size_t n = 0; n < m_nsurf; n++) {
|
||||
m_surf[n]->setCoverages(c + loc);
|
||||
loc += m_nsp[n];
|
||||
}
|
||||
|
|
@ -181,17 +181,16 @@ namespace Cantera {
|
|||
void ImplicitSurfChem::eval(doublereal time, doublereal* y,
|
||||
doublereal* ydot, doublereal* p)
|
||||
{
|
||||
int n;
|
||||
updateState(y); // synchronize the surface state(s) with y
|
||||
doublereal rs0, sum;
|
||||
int loc, k, kstart;
|
||||
for (n = 0; n < m_nsurf; n++) {
|
||||
size_t loc, kstart;
|
||||
for (size_t n = 0; n < m_nsurf; n++) {
|
||||
rs0 = 1.0/m_surf[n]->siteDensity();
|
||||
m_vecKinPtrs[n]->getNetProductionRates(DATA_PTR(m_work));
|
||||
kstart = m_vecKinPtrs[n]->kineticsSpeciesIndex(0,m_surfindex[n]);
|
||||
sum = 0.0;
|
||||
loc = 0;
|
||||
for (k = 1; k < m_nsp[n]; k++) {
|
||||
for (size_t k = 1; k < m_nsp[n]; k++) {
|
||||
ydot[k + loc] = m_work[kstart + k] * rs0 * m_surf[n]->size(k);
|
||||
sum -= ydot[k];
|
||||
}
|
||||
|
|
@ -316,18 +315,17 @@ namespace Cantera {
|
|||
* m_concSpecies[]
|
||||
*/
|
||||
void ImplicitSurfChem::getConcSpecies(doublereal * const vecConcSpecies) const {
|
||||
int kstart;
|
||||
for (int ip = 0; ip < m_nsurf; ip++) {
|
||||
size_t kstart;
|
||||
for (size_t ip = 0; ip < m_nsurf; ip++) {
|
||||
ThermoPhase * TP_ptr = m_surf[ip];
|
||||
kstart = m_specStartIndex[ip];
|
||||
TP_ptr->getConcentrations(vecConcSpecies + kstart);
|
||||
}
|
||||
kstart = m_nv;
|
||||
for (int ip = 0; ip < m_numBulkPhases; ip++) {
|
||||
for (size_t ip = 0; ip < m_numBulkPhases; ip++) {
|
||||
ThermoPhase * TP_ptr = m_bulkPhases[ip];
|
||||
int nsp = TP_ptr->nSpecies();
|
||||
TP_ptr->getConcentrations(vecConcSpecies + kstart);
|
||||
kstart += nsp;
|
||||
kstart += TP_ptr->nSpecies();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -341,18 +339,17 @@ namespace Cantera {
|
|||
* m_concSpecies[]
|
||||
*/
|
||||
void ImplicitSurfChem::setConcSpecies(const doublereal * const vecConcSpecies) {
|
||||
int kstart;
|
||||
for (int ip = 0; ip < m_nsurf; ip++) {
|
||||
size_t kstart;
|
||||
for (size_t ip = 0; ip < m_nsurf; ip++) {
|
||||
ThermoPhase * TP_ptr = m_surf[ip];
|
||||
kstart = m_specStartIndex[ip];
|
||||
TP_ptr->setConcentrations(vecConcSpecies + kstart);
|
||||
}
|
||||
kstart = m_nv;
|
||||
for (int ip = 0; ip < m_numBulkPhases; ip++) {
|
||||
for (size_t ip = 0; ip < m_numBulkPhases; ip++) {
|
||||
ThermoPhase * TP_ptr = m_bulkPhases[ip];
|
||||
int nsp = TP_ptr->nSpecies();
|
||||
TP_ptr->setConcentrations(vecConcSpecies + kstart);
|
||||
kstart += nsp;
|
||||
kstart += TP_ptr->nSpecies();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -367,12 +364,11 @@ namespace Cantera {
|
|||
*/
|
||||
void ImplicitSurfChem::
|
||||
setCommonState_TP(doublereal TKelvin, doublereal PresPa) {
|
||||
int nphases = m_nsurf;
|
||||
for (int ip = 0; ip < nphases; ip++) {
|
||||
for (size_t ip = 0; ip < m_nsurf; ip++) {
|
||||
ThermoPhase *TP_ptr = m_surf[ip];
|
||||
TP_ptr->setState_TP(TKelvin, PresPa);
|
||||
}
|
||||
for (int ip = 0; ip < m_numBulkPhases; ip++) {
|
||||
for (size_t ip = 0; ip < m_numBulkPhases; ip++) {
|
||||
ThermoPhase *TP_ptr = m_bulkPhases[ip];
|
||||
TP_ptr->setState_TP(TKelvin, PresPa);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,10 +244,10 @@ namespace Cantera {
|
|||
std::vector<InterfaceKinetics*> m_vecKinPtrs;
|
||||
|
||||
//! Vector of number of species in each Surface Phase
|
||||
vector_int m_nsp;
|
||||
std::vector<size_t> m_nsp;
|
||||
|
||||
//! index of the surface phase in each InterfaceKinetics object
|
||||
vector_int m_surfindex;
|
||||
std::vector<size_t> m_surfindex;
|
||||
|
||||
|
||||
vector_int m_specStartIndex;
|
||||
|
|
@ -258,18 +258,18 @@ namespace Cantera {
|
|||
* as there is a 1-1 correspondence between InterfaceKinetics objects
|
||||
* and surface phases.
|
||||
*/
|
||||
int m_nsurf;
|
||||
size_t m_nsurf;
|
||||
|
||||
//! Total number of surface species in all surface phases
|
||||
/*!
|
||||
* This is the total number of unknowns in m_mode 0 problem
|
||||
*/
|
||||
int m_nv;
|
||||
size_t m_nv;
|
||||
|
||||
int m_numBulkPhases;
|
||||
size_t m_numBulkPhases;
|
||||
vector_int m_nspBulkPhases;
|
||||
int m_numTotalBulkSpecies;
|
||||
int m_numTotalSpecies;
|
||||
size_t m_numTotalBulkSpecies;
|
||||
size_t m_numTotalSpecies;
|
||||
|
||||
std::vector<vector_int> pLocVec;
|
||||
//! Pointer to the cvode integrator
|
||||
|
|
|
|||
|
|
@ -297,22 +297,20 @@ namespace Cantera {
|
|||
* equilibrium constant set to zero.
|
||||
*/
|
||||
void InterfaceKinetics::updateKc() {
|
||||
int i, irxn;
|
||||
|
||||
vector_fp& m_rkc = m_kdata->m_rkcn;
|
||||
fill(m_rkc.begin(), m_rkc.end(), 0.0);
|
||||
|
||||
//static vector_fp mu(nTotalSpecies());
|
||||
if (m_nrev > 0) {
|
||||
|
||||
int n, nsp, k, ik = 0;
|
||||
size_t nsp, ik = 0;
|
||||
doublereal rt = GasConstant*thermo(0).temperature();
|
||||
doublereal rrt = 1.0 / rt;
|
||||
int np = nPhases();
|
||||
for (n = 0; n < np; n++) {
|
||||
size_t np = nPhases();
|
||||
for (size_t n = 0; n < np; n++) {
|
||||
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
|
||||
nsp = thermo(n).nSpecies();
|
||||
for (k = 0; k < nsp; k++) {
|
||||
for (size_t k = 0; k < nsp; k++) {
|
||||
m_mu0[ik] -= rt * thermo(n).logStandardConc(k);
|
||||
m_mu0[ik] += Faraday * m_phi[n] * thermo(n).charge(k);
|
||||
ik++;
|
||||
|
|
@ -323,15 +321,15 @@ namespace Cantera {
|
|||
m_rxnstoich.getRevReactionDelta(m_ii, DATA_PTR(m_mu0),
|
||||
DATA_PTR(m_rkc));
|
||||
|
||||
for (i = 0; i < m_nrev; i++) {
|
||||
irxn = m_revindex[i];
|
||||
for (size_t i = 0; i < m_nrev; i++) {
|
||||
size_t irxn = m_revindex[i];
|
||||
if (irxn < 0 || irxn >= nReactions()) {
|
||||
throw CanteraError("InterfaceKinetics",
|
||||
"illegal value: irxn = "+int2str(irxn));
|
||||
"illegal value: irxn = "+int2str(int(irxn)));
|
||||
}
|
||||
m_rkc[irxn] = exp(m_rkc[irxn]*rrt);
|
||||
}
|
||||
for (i = 0; i != m_nirrev; ++i) {
|
||||
for (size_t i = 0; i != m_nirrev; ++i) {
|
||||
m_rkc[ m_irrev[i] ] = 0.0;
|
||||
}
|
||||
}
|
||||
|
|
@ -350,15 +348,14 @@ namespace Cantera {
|
|||
if (m_nrev > 0) {
|
||||
doublereal rt = GasConstant*thermo(0).temperature();
|
||||
cout << "T = " << thermo(0).temperature() << " " << rt << endl;
|
||||
int n, nsp, k, ik=0;
|
||||
size_t nsp, ik=0;
|
||||
//doublereal rt = GasConstant*thermo(0).temperature();
|
||||
// doublereal rrt = 1.0/rt;
|
||||
int np = nPhases();
|
||||
doublereal delta;
|
||||
for (n = 0; n < np; n++) {
|
||||
for (size_t n = 0; n < nPhases(); n++) {
|
||||
thermo(n).getChemPotentials(DATA_PTR(dmu) + m_start[n]);
|
||||
nsp = thermo(n).nSpecies();
|
||||
for (k = 0; k < nsp; k++) {
|
||||
for (size_t k = 0; k < nsp; k++) {
|
||||
delta = Faraday * m_phi[n] * thermo(n).charge(k);
|
||||
//cout << thermo(n).speciesName(k) << " " << (delta+dmu[ik])/rt << " " << dmu[ik]/rt << endl;
|
||||
dmu[ik] += delta;
|
||||
|
|
@ -388,16 +385,14 @@ namespace Cantera {
|
|||
* reversible or not.
|
||||
*/
|
||||
void InterfaceKinetics::getEquilibriumConstants(doublereal* kc) {
|
||||
int i;
|
||||
|
||||
int n, nsp, k, ik=0;
|
||||
size_t ik=0;
|
||||
doublereal rt = GasConstant*thermo(0).temperature();
|
||||
doublereal rrt = 1.0/rt;
|
||||
int np = nPhases();
|
||||
for (n = 0; n < np; n++) {
|
||||
for (size_t n = 0; n < np; n++) {
|
||||
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
|
||||
nsp = thermo(n).nSpecies();
|
||||
for (k = 0; k < nsp; k++) {
|
||||
size_t nsp = thermo(n).nSpecies();
|
||||
for (size_t k = 0; k < nsp; k++) {
|
||||
m_mu0[ik] -= rt*thermo(n).logStandardConc(k);
|
||||
m_mu0[ik] += Faraday * m_phi[n] * thermo(n).charge(k);
|
||||
ik++;
|
||||
|
|
@ -408,7 +403,7 @@ namespace Cantera {
|
|||
|
||||
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_mu0), kc);
|
||||
|
||||
for (i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
kc[i] = exp(-kc[i]*rrt);
|
||||
}
|
||||
}
|
||||
|
|
@ -420,22 +415,20 @@ namespace Cantera {
|
|||
* - m_mu0
|
||||
* - m_logStandardConc
|
||||
*/
|
||||
int ik = 0;
|
||||
int np = nPhases();
|
||||
size_t ik = 0;
|
||||
|
||||
for (int n = 0; n < np; n++) {
|
||||
for (size_t n = 0; n < nPhases(); n++) {
|
||||
thermo(n).getStandardChemPotentials(DATA_PTR(m_mu0) + m_start[n]);
|
||||
int nsp = thermo(n).nSpecies();
|
||||
for (int k = 0; k < nsp; k++) {
|
||||
size_t nsp = thermo(n).nSpecies();
|
||||
for (size_t k = 0; k < nsp; k++) {
|
||||
m_StandardConc[ik] = thermo(n).standardConcentration(k);
|
||||
ik++;
|
||||
}
|
||||
}
|
||||
|
||||
m_rxnstoich.getReactionDelta(m_ii, DATA_PTR(m_mu0), DATA_PTR(m_deltaG0));
|
||||
|
||||
|
||||
for (int i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
m_ProdStanConcReac[i] = 1.0;
|
||||
}
|
||||
|
||||
|
|
@ -501,17 +494,11 @@ namespace Cantera {
|
|||
* the correction applied
|
||||
*/
|
||||
void InterfaceKinetics::applyButlerVolmerCorrection(doublereal* const kf) {
|
||||
int i;
|
||||
|
||||
int n, nsp, k, ik=0;
|
||||
doublereal rt = GasConstant*thermo(0).temperature();
|
||||
doublereal rrt = 1.0/rt;
|
||||
int np = nPhases();
|
||||
|
||||
// compute the electrical potential energy of each species
|
||||
for (n = 0; n < np; n++) {
|
||||
nsp = thermo(n).nSpecies();
|
||||
for (k = 0; k < nsp; k++) {
|
||||
size_t ik = 0;
|
||||
for (size_t n = 0; n < nPhases(); n++) {
|
||||
size_t nsp = thermo(n).nSpecies();
|
||||
for (size_t k = 0; k < nsp; k++) {
|
||||
m_pot[ik] = Faraday*thermo(n).charge(k)*m_phi[n];
|
||||
ik++;
|
||||
}
|
||||
|
|
@ -538,7 +525,7 @@ namespace Cantera {
|
|||
#endif
|
||||
int nct = m_beta.size();
|
||||
int irxn;
|
||||
for (i = 0; i < nct; i++) {
|
||||
for (size_t i = 0; i < nct; i++) {
|
||||
irxn = m_ctrxn[i];
|
||||
eamod = m_beta[i]*m_rwork[irxn];
|
||||
// if (eamod != 0.0 && m_E[irxn] != 0.0) {
|
||||
|
|
@ -556,6 +543,8 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
doublereal rt = GasConstant*thermo(0).temperature();
|
||||
doublereal rrt = 1.0/rt;
|
||||
kf[irxn] *= exp(-eamod*rrt);
|
||||
}
|
||||
}
|
||||
|
|
@ -939,8 +928,8 @@ namespace Cantera {
|
|||
m_rxnPhaseIsReactant.resize(m_ii, 0);
|
||||
m_rxnPhaseIsProduct.resize(m_ii, 0);
|
||||
|
||||
int np = nPhases();
|
||||
int i = m_ii -1;
|
||||
size_t np = nPhases();
|
||||
size_t i = m_ii - 1;
|
||||
m_rxnPhaseIsReactant[i] = new bool[np];
|
||||
m_rxnPhaseIsProduct[i] = new bool[np];
|
||||
|
||||
|
|
@ -949,35 +938,31 @@ namespace Cantera {
|
|||
m_rxnPhaseIsProduct[i][p] = false;
|
||||
}
|
||||
|
||||
const vector_int& vr = reactants(i);
|
||||
for (int ik = 0; ik < (int) vr.size(); ik++) {
|
||||
int k = vr[ik];
|
||||
int p = speciesPhaseIndex(k);
|
||||
const std::vector<size_t>& vr = reactants(i);
|
||||
for (size_t ik = 0; ik < vr.size(); ik++) {
|
||||
size_t k = vr[ik];
|
||||
size_t p = speciesPhaseIndex(k);
|
||||
m_rxnPhaseIsReactant[i][p] = true;
|
||||
}
|
||||
const vector_int& vp = products(i);
|
||||
for (int ik = 0; ik < (int) vp.size(); ik++) {
|
||||
int k = vp[ik];
|
||||
int p = speciesPhaseIndex(k);
|
||||
const std::vector<size_t>& vp = products(i);
|
||||
for (size_t ik = 0; ik < vp.size(); ik++) {
|
||||
size_t k = vp[ik];
|
||||
size_t p = speciesPhaseIndex(k);
|
||||
m_rxnPhaseIsProduct[i][p] = true;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
void InterfaceKinetics::addElementaryReaction(const ReactionData& r) {
|
||||
int iloc;
|
||||
|
||||
// install rate coeff calculator
|
||||
|
||||
vector_fp rp = r.rateCoeffParameters;
|
||||
int ncov = r.cov.size();
|
||||
size_t ncov = r.cov.size();
|
||||
if (ncov > 3) {
|
||||
m_has_coverage_dependence = true;
|
||||
}
|
||||
for (int m = 0; m < ncov; m++) {
|
||||
for (size_t m = 0; m < ncov; m++) {
|
||||
rp.push_back(r.cov[m]);
|
||||
}
|
||||
// iloc = m_rates.install(reactionNumber(), r.rateCoeffType, rp.size(), DATA_PTR(rp));
|
||||
iloc = m_rates.install(reactionNumber(), ARRHENIUS_REACTION_RATECOEFF_TYPE, rp.size(), DATA_PTR(rp));
|
||||
size_t iloc = m_rates.install(reactionNumber(), ARRHENIUS_REACTION_RATECOEFF_TYPE, rp.size(), DATA_PTR(rp));
|
||||
// store activation energy
|
||||
m_E.push_back(r.rateCoeffParameters[2]);
|
||||
|
||||
|
|
@ -1036,7 +1021,7 @@ namespace Cantera {
|
|||
|
||||
void InterfaceKinetics::installReagents(const ReactionData& r) {
|
||||
|
||||
int n, ns, m;
|
||||
size_t n, ns, m;
|
||||
doublereal nsFlt;
|
||||
/*
|
||||
* extend temporary storage by one for this rxn.
|
||||
|
|
@ -1059,11 +1044,11 @@ namespace Cantera {
|
|||
// faster method 'multiply' can be used to compute the rate of
|
||||
// progress instead of 'power'.
|
||||
|
||||
vector_int rk;
|
||||
int nr = r.reactants.size();
|
||||
std::vector<size_t> rk;
|
||||
size_t nr = r.reactants.size();
|
||||
for (n = 0; n < nr; n++) {
|
||||
nsFlt = r.rstoich[n];
|
||||
ns = (int) nsFlt;
|
||||
ns = (size_t) nsFlt;
|
||||
if ((doublereal) ns != nsFlt) {
|
||||
if (ns < 1) ns = 1;
|
||||
}
|
||||
|
|
@ -1084,11 +1069,11 @@ namespace Cantera {
|
|||
* of reactants for the rnum'th reaction
|
||||
*/
|
||||
m_reactants.push_back(rk);
|
||||
vector_int pk;
|
||||
int np = r.products.size();
|
||||
std::vector<size_t> pk;
|
||||
size_t np = r.products.size();
|
||||
for (n = 0; n < np; n++) {
|
||||
nsFlt = r.pstoich[n];
|
||||
ns = (int) nsFlt;
|
||||
ns = (size_t) nsFlt;
|
||||
if ((doublereal) ns != nsFlt) {
|
||||
if (ns < 1) ns = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -563,7 +563,7 @@ namespace Cantera {
|
|||
* vector containing the reaction numbers of irreversible
|
||||
* reactions.
|
||||
*/
|
||||
std::vector<int> m_irrev;
|
||||
std::vector<size_t> m_irrev;
|
||||
|
||||
//! Stoichiometric manager for the reaction mechanism
|
||||
/*!
|
||||
|
|
@ -575,10 +575,10 @@ namespace Cantera {
|
|||
ReactionStoichMgr m_rxnstoich;
|
||||
|
||||
//! Number of irreversible reactions in the mechanism
|
||||
int m_nirrev;
|
||||
size_t m_nirrev;
|
||||
|
||||
//! Number of reversible reactions in the mechanism
|
||||
int m_nrev;
|
||||
size_t m_nrev;
|
||||
|
||||
|
||||
//! m_rrxn is a vector of maps, containing the reactant
|
||||
|
|
|
|||
|
|
@ -130,10 +130,9 @@ namespace Cantera {
|
|||
*/
|
||||
void Kinetics::selectPhase(const doublereal* data, const thermo_t* phase,
|
||||
doublereal* phase_data) {
|
||||
int n, nsp, np = nPhases();
|
||||
for (n = 0; n < np; n++) {
|
||||
for (size_t n = 0; n < nPhases(); n++) {
|
||||
if (phase == m_thermo[n]) {
|
||||
nsp = phase->nSpecies();
|
||||
size_t nsp = phase->nSpecies();
|
||||
copy(data + m_start[n],
|
||||
data + m_start[n] + nsp, phase_data);
|
||||
return;
|
||||
|
|
@ -153,9 +152,8 @@ namespace Cantera {
|
|||
* the kinetics manager. If k is out of bounds, the string
|
||||
* "<unknown>" is returned.
|
||||
*/
|
||||
string Kinetics::kineticsSpeciesName(int k) const {
|
||||
int np = m_start.size();
|
||||
for (int n = np-1; n >= 0; n--) {
|
||||
string Kinetics::kineticsSpeciesName(size_t k) const {
|
||||
for (size_t n = m_start.size()-1; n >= 0; n--) {
|
||||
if (k >= m_start[n]) {
|
||||
return thermo(n).speciesName(k - m_start[n]);
|
||||
}
|
||||
|
|
@ -179,15 +177,15 @@ namespace Cantera {
|
|||
* the value -1 is returned.
|
||||
* - If no match is found in any phase, the value -2 is returned.
|
||||
*/
|
||||
int Kinetics::kineticsSpeciesIndex(std::string nm, std::string ph) const {
|
||||
int np = static_cast<int>(m_thermo.size());
|
||||
int k;
|
||||
size_t Kinetics::kineticsSpeciesIndex(std::string nm, std::string ph) const {
|
||||
size_t np = m_thermo.size();
|
||||
size_t k;
|
||||
string id;
|
||||
for (int n = 0; n < np; n++) {
|
||||
for (size_t n = 0; n < np; n++) {
|
||||
id = thermo(n).id();
|
||||
if (ph == id) {
|
||||
k = thermo(n).speciesIndex(nm);
|
||||
if (k < 0) return -1;
|
||||
if (k == -1) return -1;
|
||||
return k + m_start[n];
|
||||
}
|
||||
else if (ph == "<any>") {
|
||||
|
|
@ -209,12 +207,12 @@ namespace Cantera {
|
|||
* Will throw an error if the species string doesn't match.
|
||||
*/
|
||||
thermo_t& Kinetics::speciesPhase(std::string nm) {
|
||||
int np = static_cast<int>(m_thermo.size());
|
||||
int k;
|
||||
size_t np = m_thermo.size();
|
||||
size_t k;
|
||||
string id;
|
||||
for (int n = 0; n < np; n++) {
|
||||
for (size_t n = 0; n < np; n++) {
|
||||
k = thermo(n).speciesIndex(nm);
|
||||
if (k >= 0) return thermo(n);
|
||||
if (k != -1) return thermo(n);
|
||||
}
|
||||
throw CanteraError("speciesPhase", "unknown species "+nm);
|
||||
return thermo(0);
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ namespace Cantera {
|
|||
virtual int type() const;
|
||||
|
||||
//! Number of reactions in the reaction mechanism.
|
||||
int nReactions() const {return m_ii;}
|
||||
size_t nReactions() const {return m_ii;}
|
||||
|
||||
//@}
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ namespace Cantera {
|
|||
* always return 1, but for a heterogeneous mechanism it will
|
||||
* return the total number of phases in the mechanism.
|
||||
*/
|
||||
int nPhases() const { return static_cast<int>(m_thermo.size()); }
|
||||
size_t nPhases() const { return m_thermo.size(); }
|
||||
|
||||
/**
|
||||
* Return the phase index of a phase in the list of phases
|
||||
|
|
@ -221,7 +221,7 @@ namespace Cantera {
|
|||
* If a -1 is returned, then the phase is not defined in
|
||||
* the Kinetics object.
|
||||
*/
|
||||
int phaseIndex(std::string ph) {
|
||||
size_t phaseIndex(std::string ph) {
|
||||
if (m_phaseindex.find(ph) == m_phaseindex.end()) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -261,8 +261,8 @@ namespace Cantera {
|
|||
*
|
||||
* @param n Index of the ThermoPhase being sought.
|
||||
*/
|
||||
thermo_t& thermo(int n=0) { return *m_thermo[n]; }
|
||||
const thermo_t& thermo(int n=0) const { return *m_thermo[n]; }
|
||||
thermo_t& thermo(size_t n=0) { return *m_thermo[n]; }
|
||||
const thermo_t& thermo(size_t n=0) const { return *m_thermo[n]; }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the nth ThermoPhase
|
||||
|
|
@ -272,7 +272,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param n Index of the ThermoPhase being sought.
|
||||
*/
|
||||
thermo_t& phase(int n=0) {
|
||||
thermo_t& phase(size_t n=0) {
|
||||
deprecatedMethod("Kinetics","phase","thermo");
|
||||
return *m_thermo[n];
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param n Index of the ThermoPhase being sought.
|
||||
*/
|
||||
const thermo_t& phase(int n=0) const {
|
||||
const thermo_t& phase(size_t n=0) const {
|
||||
deprecatedMethod("Kinetics","phase","thermo");
|
||||
return *m_thermo[n];
|
||||
}
|
||||
|
|
@ -295,10 +295,10 @@ namespace Cantera {
|
|||
* for use in calls to methods that return the species
|
||||
* production rates, for example.
|
||||
*/
|
||||
int nTotalSpecies() const {
|
||||
int n=0, np;
|
||||
size_t nTotalSpecies() const {
|
||||
size_t n=0, np;
|
||||
np = nPhases();
|
||||
for (int p = 0; p < np; p++) n += thermo(p).nSpecies();
|
||||
for (size_t p = 0; p < np; p++) n += thermo(p).nSpecies();
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
@ -309,7 +309,7 @@ namespace Cantera {
|
|||
* @param n Return the index of first species in the nth phase
|
||||
* associated with the reaction mechanism.
|
||||
*/
|
||||
int start(int n) {
|
||||
size_t start(size_t n) {
|
||||
deprecatedMethod("Kinetics","start","kineticsSpeciesIndex(0,n)");
|
||||
return m_start[n];
|
||||
}
|
||||
|
|
@ -337,7 +337,7 @@ namespace Cantera {
|
|||
* @param k species index
|
||||
* @param n phase index for the species
|
||||
*/
|
||||
int kineticsSpeciesIndex(int k, int n) const {
|
||||
size_t kineticsSpeciesIndex(size_t k, size_t n) const {
|
||||
return m_start[n] + k;
|
||||
}
|
||||
|
||||
|
|
@ -353,7 +353,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k species index
|
||||
*/
|
||||
std::string kineticsSpeciesName(int k) const;
|
||||
std::string kineticsSpeciesName(size_t k) const;
|
||||
|
||||
/**
|
||||
* This routine will look up a species number based on
|
||||
|
|
@ -372,7 +372,7 @@ namespace Cantera {
|
|||
* @param nm Input string name of the species
|
||||
* @param ph Input string name of the phase. Defaults to "<any>"
|
||||
*/
|
||||
int kineticsSpeciesIndex(std::string nm, std::string ph = "<any>") const;
|
||||
size_t kineticsSpeciesIndex(std::string nm, std::string ph = "<any>") const;
|
||||
|
||||
/**
|
||||
* This function looks up the std::string name of a species and
|
||||
|
|
@ -668,7 +668,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param i reaction index
|
||||
*/
|
||||
virtual const vector_int& reactants(int i) const {
|
||||
virtual const std::vector<size_t>& reactants(int i) const {
|
||||
return m_reactants[i];
|
||||
}
|
||||
|
||||
|
|
@ -678,7 +678,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param i reaction index
|
||||
*/
|
||||
virtual const vector_int& products(int i) const {
|
||||
virtual const std::vector<size_t>& products(int i) const {
|
||||
return m_products[i];
|
||||
}
|
||||
|
||||
|
|
@ -900,10 +900,10 @@ namespace Cantera {
|
|||
|
||||
|
||||
//! Number of reactions in the mechanism
|
||||
int m_ii;
|
||||
size_t m_ii;
|
||||
|
||||
//! Number of species in the species vector for this kinetics operator
|
||||
int m_nTotalSpecies;
|
||||
size_t m_nTotalSpecies;
|
||||
|
||||
/// Vector of perturbation factors for each reaction's rate of
|
||||
/// progress vector. It is initialized to one.
|
||||
|
|
@ -921,7 +921,7 @@ namespace Cantera {
|
|||
* NOTE: These vectors will be wrong if there are real
|
||||
* stoichiometric coefficients in the expression.
|
||||
*/
|
||||
std::vector<vector_int> m_reactants;
|
||||
std::vector<std::vector<size_t> > m_reactants;
|
||||
|
||||
/**
|
||||
* This is a vector of vectors containing the products for
|
||||
|
|
@ -934,7 +934,7 @@ namespace Cantera {
|
|||
* NOTE: These vectors will be wrong if there are real
|
||||
* stoichiometric coefficients in the expression.
|
||||
*/
|
||||
std::vector<vector_int> m_products;
|
||||
std::vector<std::vector<size_t> > m_products;
|
||||
|
||||
//! m_thermo is a vector of pointers to ThermoPhase
|
||||
//! objects.
|
||||
|
|
@ -959,7 +959,7 @@ namespace Cantera {
|
|||
* for the species vector for the n'th phase in the kinetics
|
||||
* class.
|
||||
*/
|
||||
vector_int m_start;
|
||||
std::vector<size_t> m_start;
|
||||
|
||||
/**
|
||||
* Mapping of the phase id, i.e., the id attribute in the xml
|
||||
|
|
@ -971,18 +971,18 @@ namespace Cantera {
|
|||
*/
|
||||
std::map<std::string, int> m_phaseindex;
|
||||
//! Index of the Kinetics Manager
|
||||
int m_index;
|
||||
size_t m_index;
|
||||
|
||||
/**
|
||||
* Index in the list of phases of the one surface phase.
|
||||
*/
|
||||
int m_surfphase;
|
||||
size_t m_surfphase;
|
||||
|
||||
/**
|
||||
* Index in the list of phases of the one phase where the reactions
|
||||
* occur.
|
||||
*/
|
||||
int m_rxnphase;
|
||||
size_t m_rxnphase;
|
||||
|
||||
/// number of spatial dimensions of lowest-dimensional phase.
|
||||
int m_mindim;
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ namespace Cantera {
|
|||
* @param m length of coefficient array
|
||||
* @param coefficients
|
||||
*/
|
||||
int install( int rxnNumber, int rateType, int m,
|
||||
const doublereal* c ) {
|
||||
size_t install(size_t rxnNumber, int rateType, size_t m,
|
||||
const doublereal* c) {
|
||||
/*
|
||||
* Check to see if the current reaction rate type
|
||||
* is the same as the type of this class. If not,
|
||||
|
|
@ -49,11 +49,11 @@ namespace Cantera {
|
|||
// if any coefficient other than the first is non-zero, or
|
||||
// if alwaysComputeRate() is true, install a rate
|
||||
// calculator and return the index of the calculator.
|
||||
for (int i = 1; i < m; i++) {
|
||||
for (size_t i = 1; i < m; i++) {
|
||||
if (c[i] != 0.0 || R::alwaysComputeRate() ) {
|
||||
m_rxn.push_back(rxnNumber);
|
||||
m_rates.push_back(R(m, c));
|
||||
return static_cast<int>(m_rates.size()) - 1;
|
||||
return m_rates.size() - 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
|
@ -111,7 +111,7 @@ namespace Cantera {
|
|||
|
||||
protected:
|
||||
std::vector<R> m_rates;
|
||||
std::vector<int> m_rxn;
|
||||
std::vector<size_t> m_rxn;
|
||||
array_fp m_const; // not used
|
||||
};
|
||||
|
||||
|
|
@ -128,8 +128,8 @@ namespace Cantera {
|
|||
Rate2(){}
|
||||
virtual ~Rate2(){}
|
||||
|
||||
int install( int rxnNumber, int rateType, int m,
|
||||
const doublereal* c) {
|
||||
int install(size_t rxnNumber, int rateType, size_t m,
|
||||
const doublereal* c) {
|
||||
if (rateType == R1::type())
|
||||
return m_r1.install(rxnNumber, rateType, m, c);
|
||||
else if (rateType == R2::type())
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ namespace Cantera {
|
|||
|
||||
int number;
|
||||
int rxn_number;
|
||||
vector_int reactants;
|
||||
vector_int products;
|
||||
std::vector<size_t> reactants;
|
||||
std::vector<size_t> products;
|
||||
vector_fp rorder;
|
||||
vector_fp porder;
|
||||
vector_fp rstoich;
|
||||
|
|
|
|||
|
|
@ -480,20 +480,19 @@ namespace Cantera {
|
|||
int ReactionPathBuilder::findGroups(ostream& logfile, Kinetics& s)
|
||||
{
|
||||
m_groups.resize(m_nr);
|
||||
map<int, int> net;
|
||||
|
||||
for (int i = 0; i < m_nr; i++) // loop over reactions
|
||||
for (size_t i = 0; i < m_nr; i++) // loop over reactions
|
||||
{
|
||||
logfile << endl << "Reaction " << i+1 << ": "
|
||||
<< s.reactionString(i);
|
||||
|
||||
int nrnet = m_reac[i].size();
|
||||
int npnet = m_prod[i].size();
|
||||
const vector_int& r = s.reactants(i);
|
||||
const vector_int& p = s.products(i);
|
||||
size_t nrnet = m_reac[i].size();
|
||||
size_t npnet = m_prod[i].size();
|
||||
const std::vector<size_t>& r = s.reactants(i);
|
||||
const std::vector<size_t>& p = s.products(i);
|
||||
|
||||
int nr = s.reactants(i).size();
|
||||
int np = s.products(i).size();
|
||||
size_t nr = s.reactants(i).size();
|
||||
size_t np = s.products(i).size();
|
||||
|
||||
Group b0, b1, bb;
|
||||
|
||||
|
|
@ -501,7 +500,6 @@ namespace Cantera {
|
|||
|
||||
const vector<grouplist_t>& rgroups = s.reactantGroups(i);
|
||||
const vector<grouplist_t>& pgroups = s.productGroups(i);
|
||||
|
||||
|
||||
if (m_determinate[i]) {
|
||||
logfile << " ... OK." << endl;
|
||||
|
|
@ -509,27 +507,27 @@ namespace Cantera {
|
|||
|
||||
else if (rgroups.size() > 0) {
|
||||
logfile << " ... specified groups." << endl;
|
||||
int nrg = static_cast<int>(rgroups.size());
|
||||
int npg = static_cast<int>(pgroups.size());
|
||||
int kr, kp, ngrpr, ngrpp;
|
||||
size_t nrg = rgroups.size();
|
||||
size_t npg = pgroups.size();
|
||||
size_t kr, kp, ngrpr, ngrpp;
|
||||
Group gr, gp;
|
||||
|
||||
if (nrg != nr || npg != np) return -1;
|
||||
|
||||
// loop over reactants
|
||||
for (int igr = 0; igr < nrg; igr++) {
|
||||
for (size_t igr = 0; igr < nrg; igr++) {
|
||||
kr = r[igr];
|
||||
ngrpr = static_cast<int>(rgroups[igr].size());
|
||||
|
||||
// loop over products
|
||||
for (int igp = 0; igp < npg; igp++) {
|
||||
for (size_t igp = 0; igp < npg; igp++) {
|
||||
kp = p[igp];
|
||||
ngrpp = static_cast<int>(pgroups[igp].size());
|
||||
|
||||
// loop over pairs of reactant and product groups
|
||||
for (int kgr = 0; kgr < ngrpr; kgr++) {
|
||||
for (size_t kgr = 0; kgr < ngrpr; kgr++) {
|
||||
gr = Group(rgroups[igr][kgr]);
|
||||
for (int kgp = 0; kgp < ngrpp; kgp++) {
|
||||
for (size_t kgp = 0; kgp < ngrpp; kgp++) {
|
||||
gp = Group(pgroups[igp][kgp]);
|
||||
if (gr == gp) {
|
||||
m_transfer[i][kr][kp] = gr;
|
||||
|
|
@ -543,12 +541,12 @@ namespace Cantera {
|
|||
else if (nrnet == 2 && npnet == 2)
|
||||
{
|
||||
// indices for the two reactants
|
||||
int kr0 = m_reac[i][0];
|
||||
int kr1 = m_reac[i][1];
|
||||
size_t kr0 = m_reac[i][0];
|
||||
size_t kr1 = m_reac[i][1];
|
||||
|
||||
// indices for the two products
|
||||
int kp0 = m_prod[i][0];
|
||||
int kp1 = m_prod[i][1];
|
||||
size_t kp0 = m_prod[i][0];
|
||||
size_t kp1 = m_prod[i][1];
|
||||
|
||||
// references to the Group objects representing the
|
||||
// reactants
|
||||
|
|
@ -652,14 +650,13 @@ namespace Cantera {
|
|||
string ename;
|
||||
m_enamemap.clear();
|
||||
m_nel = 0;
|
||||
int i, np = kin.nPhases();
|
||||
size_t np = kin.nPhases();
|
||||
ThermoPhase* p;
|
||||
map<string, int> enamemap;
|
||||
for (i = 0; i < np; i++) {
|
||||
for (size_t i = 0; i < np; i++) {
|
||||
p = &kin.thermo(i);
|
||||
// iterate over the elements in this phase
|
||||
int m, nel = p->nElements();
|
||||
for (m = 0; m < nel; m++) {
|
||||
size_t nel = p->nElements();
|
||||
for (size_t m = 0; m < nel; m++) {
|
||||
ename = p->elementName(m);
|
||||
|
||||
// if no entry is found for this element name, then
|
||||
|
|
@ -675,18 +672,17 @@ namespace Cantera {
|
|||
}
|
||||
m_atoms.resize(kin.nTotalSpecies(), m_nel, 0.0);
|
||||
string sym;
|
||||
int k, ip, nsp, mlocal, kp, m;
|
||||
// iterate over the elements
|
||||
for (m = 0; m < m_nel; m++) {
|
||||
for (size_t m = 0; m < m_nel; m++) {
|
||||
sym = m_elementSymbols[m];
|
||||
k = 0;
|
||||
size_t k = 0;
|
||||
// iterate over the phases
|
||||
for (ip = 0; ip < np; ip++) {
|
||||
for (size_t ip = 0; ip < np; ip++) {
|
||||
phase_t* p = &kin.thermo(ip);
|
||||
nsp = p->nSpecies();
|
||||
mlocal = p->elementIndex(sym);
|
||||
for (kp = 0; kp < nsp; kp++) {
|
||||
if (mlocal >= 0) {
|
||||
size_t nsp = p->nSpecies();
|
||||
size_t mlocal = p->elementIndex(sym);
|
||||
for (size_t kp = 0; kp < nsp; kp++) {
|
||||
if (mlocal != -1) {
|
||||
m_atoms(k, m) = p->nAtoms(kp, mlocal);
|
||||
}
|
||||
k++;
|
||||
|
|
@ -717,8 +713,8 @@ namespace Cantera {
|
|||
// all reactants / products, even ones appearing on both sides
|
||||
// of the reaction
|
||||
// mod 8/18/01 dgg
|
||||
vector<vector_int > allProducts;
|
||||
vector<vector_int > allReactants;
|
||||
vector<vector<size_t> > allProducts;
|
||||
vector<vector<size_t> > allReactants;
|
||||
for (i = 0; i < m_nr; i++) {
|
||||
allReactants.push_back(kin.reactants(i));
|
||||
allProducts.push_back(kin.products(i));
|
||||
|
|
@ -737,9 +733,9 @@ namespace Cantera {
|
|||
m_x.resize(m_ns); // not currently used ?
|
||||
m_elatoms.resize(m_nel, m_nr);
|
||||
|
||||
int nr, np, n, k;
|
||||
int nmol;
|
||||
map<int, int> net;
|
||||
size_t nr, np, n, k;
|
||||
size_t nmol;
|
||||
map<size_t, int> net;
|
||||
|
||||
for (i = 0; i < m_nr; i++) {
|
||||
|
||||
|
|
@ -751,21 +747,21 @@ namespace Cantera {
|
|||
net.clear();
|
||||
nr = allReactants[i].size();
|
||||
np = allProducts[i].size();
|
||||
for (int ir = 0; ir < nr; ir++) net[allReactants[i][ir]]--;
|
||||
for (int ip = 0; ip < np; ip++) net[allProducts[i][ip]]++;
|
||||
for (size_t ir = 0; ir < nr; ir++) net[allReactants[i][ir]]--;
|
||||
for (size_t ip = 0; ip < np; ip++) net[allProducts[i][ip]]++;
|
||||
|
||||
for (k = 0; k < m_ns; k++) {
|
||||
if (net[k] < 0) {
|
||||
nmol = -net[k];
|
||||
for (int jr = 0; jr < nmol; jr++) m_reac[i].push_back(k);
|
||||
for (size_t jr = 0; jr < nmol; jr++) m_reac[i].push_back(k);
|
||||
}
|
||||
else if (net[k] > 0) {
|
||||
nmol = net[k];
|
||||
for (int jp = 0; jp < nmol; jp++) m_prod[i].push_back(k);
|
||||
for (size_t jp = 0; jp < nmol; jp++) m_prod[i].push_back(k);
|
||||
}
|
||||
}
|
||||
|
||||
int nrnet = m_reac[i].size();
|
||||
size_t nrnet = m_reac[i].size();
|
||||
// int npnet = m_prod[i].size();
|
||||
|
||||
// compute number of atoms of each element in each reaction,
|
||||
|
|
@ -775,7 +771,7 @@ namespace Cantera {
|
|||
|
||||
for (n = 0; n < nrnet; n++) {
|
||||
k = m_reac[i][n];
|
||||
for (int m = 0; m < m_nel; m++) {
|
||||
for (size_t m = 0; m < m_nel; m++) {
|
||||
m_elatoms(m,i) += m_atoms(k,m); //ph.nAtoms(k,m);
|
||||
}
|
||||
}
|
||||
|
|
@ -784,8 +780,7 @@ namespace Cantera {
|
|||
// build species groups
|
||||
vector_int comp(m_nel);
|
||||
m_sgroup.resize(m_ns);
|
||||
int j;
|
||||
for (j = 0; j < m_ns; j++) {
|
||||
for (size_t j = 0; j < m_ns; j++) {
|
||||
for (int m = 0; m < m_nel; m++) comp[m] = int(m_atoms(j,m)); //ph.nAtoms(j,m));
|
||||
m_sgroup[j] = Group(comp);
|
||||
}
|
||||
|
|
@ -807,11 +802,11 @@ namespace Cantera {
|
|||
for (m = 0; m < m_nel; m++) {
|
||||
nar = 0;
|
||||
nap = 0;
|
||||
for (j = 0; j < nr; j++) {
|
||||
for (size_t j = 0; j < nr; j++) {
|
||||
// if (ph.nAtoms(m_reac[i][j],m) > 0) nar++;
|
||||
if (m_atoms(m_reac[i][j],m) > 0) nar++;
|
||||
}
|
||||
for (j = 0; j < np; j++) {
|
||||
for (size_t j = 0; j < np; j++) {
|
||||
if (m_atoms(m_prod[i][j],m) > 0) nap++;
|
||||
}
|
||||
if (nar > 1 && nap > 1) {
|
||||
|
|
@ -824,13 +819,12 @@ namespace Cantera {
|
|||
return 1;
|
||||
}
|
||||
|
||||
string reactionLabel(int i, int kr, int nr, const vector_int& slist,
|
||||
const Kinetics& s) {
|
||||
string reactionLabel(size_t i, size_t kr, size_t nr,
|
||||
const std::vector<size_t>& slist, const Kinetics& s) {
|
||||
|
||||
//int np = s.nPhases();
|
||||
string label = "";
|
||||
int l;
|
||||
for (l = 0; l < nr; l++) {
|
||||
for (size_t l = 0; l < nr; l++) {
|
||||
if (l != kr)
|
||||
label += " + "+ s.kineticsSpeciesName(slist[l]);
|
||||
}
|
||||
|
|
@ -845,7 +839,6 @@ namespace Cantera {
|
|||
int ReactionPathBuilder::build(Kinetics& s,
|
||||
string element, ostream& output, ReactionPathDiagram& r, bool quiet)
|
||||
{
|
||||
int i, nr, np, kr, kp, kkr, kkp;
|
||||
doublereal f, ropf, ropr, fwd, rev;
|
||||
string fwdlabel, revlabel;
|
||||
map<int, int> warn;
|
||||
|
|
@ -854,13 +847,10 @@ namespace Cantera {
|
|||
bool fwd_incl, rev_incl, force_incl;
|
||||
|
||||
// const Kinetics::thermo_t& ph = s.thermo();
|
||||
int m = m_enamemap[element]-1; //ph.elementIndex(element);
|
||||
size_t m = m_enamemap[element]-1; //ph.elementIndex(element);
|
||||
|
||||
r.element = element;
|
||||
if (m < 0) return -1;
|
||||
|
||||
//int k;
|
||||
int kk = s.nTotalSpecies();
|
||||
|
||||
s.getFwdRatesOfProgress(DATA_PTR(m_ropf));
|
||||
s.getRevRatesOfProgress(DATA_PTR(m_ropr));
|
||||
|
|
@ -876,17 +866,15 @@ namespace Cantera {
|
|||
// species explicitly included or excluded
|
||||
vector<string>& in_nodes = r.included();
|
||||
vector<string>& out_nodes = r.excluded();
|
||||
int nin = static_cast<int>(in_nodes.size());
|
||||
int nout = static_cast<int>(out_nodes.size());
|
||||
|
||||
vector_int status;
|
||||
status.resize(kk,0);
|
||||
for (int ni = 0; ni < nin; ni++)
|
||||
status.resize(s.nTotalSpecies(), 0);
|
||||
for (size_t ni = 0; ni < in_nodes.size(); ni++)
|
||||
status[s.kineticsSpeciesIndex(in_nodes[ni])] = 1;
|
||||
for (int ne = 0; ne < nout; ne++)
|
||||
for (size_t ne = 0; ne < out_nodes.size(); ne++)
|
||||
status[s.kineticsSpeciesIndex(out_nodes[ne])] = -1;
|
||||
|
||||
for (i = 0; i < m_nr; i++)
|
||||
for (size_t i = 0; i < m_nr; i++)
|
||||
{
|
||||
ropf = m_ropf[i];
|
||||
ropr = m_ropr[i];
|
||||
|
|
@ -894,21 +882,20 @@ namespace Cantera {
|
|||
// loop over reactions involving element m
|
||||
if (m_elatoms(m, i) > 0)
|
||||
{
|
||||
nr = m_reac[i].size();
|
||||
np = m_prod[i].size();
|
||||
size_t nr = m_reac[i].size();
|
||||
size_t np = m_prod[i].size();
|
||||
|
||||
for (kr = 0; kr < nr; kr++)
|
||||
for (size_t kr = 0; kr < nr; kr++)
|
||||
{
|
||||
kkr = m_reac[i][kr];
|
||||
int l;
|
||||
size_t kkr = m_reac[i][kr];
|
||||
|
||||
fwdlabel = reactionLabel(i, kr, nr, m_reac[i], s);
|
||||
|
||||
for (kp = 0; kp < np; kp++)
|
||||
for (size_t kp = 0; kp < np; kp++)
|
||||
{
|
||||
kkp = m_prod[i][kp];
|
||||
size_t kkp = m_prod[i][kp];
|
||||
revlabel = "";
|
||||
for (l = 0; l < np; l++) {
|
||||
for (size_t l = 0; l < np; l++) {
|
||||
if (l != kp)
|
||||
revlabel += " + "+ s.kineticsSpeciesName(m_prod[i][l]);
|
||||
}
|
||||
|
|
@ -938,7 +925,7 @@ namespace Cantera {
|
|||
if ( (m_atoms(kkp,m) < m_elatoms(m, i)) &&
|
||||
(m_atoms(kkr,m) < m_elatoms(m, i)) )
|
||||
{
|
||||
map<int, map<int, Group> >& g = m_transfer[i];
|
||||
map<size_t, map<size_t, Group> >& g = m_transfer[i];
|
||||
if (g.empty()) {
|
||||
if (!warn[i]) {
|
||||
if (!quiet) {
|
||||
|
|
|
|||
|
|
@ -250,23 +250,23 @@ namespace Cantera {
|
|||
protected:
|
||||
void findElements(Kinetics& kin);
|
||||
|
||||
int m_nr;
|
||||
int m_ns;
|
||||
int m_nel;
|
||||
size_t m_nr;
|
||||
size_t m_ns;
|
||||
size_t m_nel;
|
||||
vector_fp m_ropf;
|
||||
vector_fp m_ropr;
|
||||
array_fp m_x;
|
||||
std::vector<vector_int> m_reac;
|
||||
std::vector<vector_int> m_prod;
|
||||
std::vector<std::vector<size_t> > m_reac;
|
||||
std::vector<std::vector<size_t> > m_prod;
|
||||
DenseMatrix m_elatoms;
|
||||
std::vector<std::vector<int> > m_groups;
|
||||
std::vector<Group> m_sgroup;
|
||||
std::vector<std::string> m_elementSymbols;
|
||||
// std::map<int, int> m_warn;
|
||||
std::map<int, std::map<int, std::map<int, Group> > > m_transfer;
|
||||
std::map<size_t, std::map<size_t, std::map<size_t, Group> > > m_transfer;
|
||||
std::vector<bool> m_determinate;
|
||||
Array2D m_atoms;
|
||||
std::map<std::string,int> m_enamemap;
|
||||
std::map<std::string, size_t> m_enamemap;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ namespace Cantera {
|
|||
|
||||
|
||||
void ReactionStoichMgr::
|
||||
add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||
add(int rxn, const std::vector<size_t>& reactants,
|
||||
const std::vector<size_t>& products,
|
||||
bool reversible) {
|
||||
|
||||
m_reactants->add(rxn, reactants);
|
||||
|
|
@ -56,15 +57,14 @@ namespace Cantera {
|
|||
void ReactionStoichMgr::
|
||||
add(int rxn, const ReactionData& r) {
|
||||
|
||||
vector_int rk;
|
||||
std::vector<size_t> rk;
|
||||
doublereal frac;
|
||||
bool isfrac = false;
|
||||
int n, ns, m, nr = r.reactants.size();
|
||||
for (n = 0; n < nr; n++) {
|
||||
ns = int(r.rstoich[n]);
|
||||
for (size_t n = 0; n < r.reactants.size(); n++) {
|
||||
size_t ns = size_t(r.rstoich[n]);
|
||||
frac = r.rstoich[n] - 1.0*int(r.rstoich[n]);
|
||||
if (frac != 0.0) isfrac = true;
|
||||
for (m = 0; m < ns; m++) {
|
||||
for (size_t m = 0; m < ns; m++) {
|
||||
rk.push_back(r.reactants[n]);
|
||||
}
|
||||
}
|
||||
|
|
@ -84,14 +84,13 @@ namespace Cantera {
|
|||
#endif
|
||||
}
|
||||
|
||||
vector_int pk;
|
||||
std::vector<size_t> pk;
|
||||
isfrac = false;
|
||||
int np = r.products.size();
|
||||
for (n = 0; n < np; n++) {
|
||||
ns = int(r.pstoich[n]);
|
||||
for (size_t n = 0; n < r.products.size(); n++) {
|
||||
size_t ns = size_t(r.pstoich[n]);
|
||||
frac = r.pstoich[n] - 1.0*int(r.pstoich[n]);
|
||||
if (frac != 0.0) isfrac = true;
|
||||
for (m = 0; m < ns; m++) {
|
||||
for (size_t m = 0; m < ns; m++) {
|
||||
pk.push_back(r.products[n]);
|
||||
}
|
||||
}
|
||||
|
|
@ -118,7 +117,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void ReactionStoichMgr::
|
||||
getCreationRates(int nsp, const doublereal* ropf,
|
||||
getCreationRates(size_t nsp, const doublereal* ropf,
|
||||
const doublereal* ropr, doublereal* c) {
|
||||
// zero out the output array
|
||||
fill(c, c + nsp, 0.0);
|
||||
|
|
@ -132,7 +131,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void ReactionStoichMgr::
|
||||
getDestructionRates(int nsp, const doublereal* ropf,
|
||||
getDestructionRates(size_t nsp, const doublereal* ropf,
|
||||
const doublereal* ropr, doublereal* d) {
|
||||
fill(d, d + nsp, 0.0);
|
||||
// the reverse direction destroys products in reversible reactions
|
||||
|
|
@ -142,7 +141,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void ReactionStoichMgr::
|
||||
getNetProductionRates(int nsp, const doublereal* ropnet, doublereal* w) {
|
||||
getNetProductionRates(size_t nsp, const doublereal* ropnet, doublereal* w) {
|
||||
fill(w, w + nsp, 0.0);
|
||||
// products are created for positive net rate of progress
|
||||
m_revproducts->incrementSpecies(ropnet, w);
|
||||
|
|
@ -196,11 +195,11 @@ namespace Cantera {
|
|||
writeCreationRates(ostream& f) {
|
||||
f << " void getCreationRates(const doublereal* rf, const doublereal* rb," << endl;
|
||||
f << " doublereal* c) {" << endl;
|
||||
map<int, string> out;
|
||||
map<size_t, string> out;
|
||||
m_revproducts->writeIncrementSpecies("rf",out);
|
||||
m_irrevproducts->writeIncrementSpecies("rf",out);
|
||||
m_reactants->writeIncrementSpecies("rb",out);
|
||||
map<int, string>::iterator b;
|
||||
map<size_t, string>::iterator b;
|
||||
for (b = out.begin(); b != out.end(); ++b) {
|
||||
string rhs = wrapString(b->second);
|
||||
rhs[1] = '=';
|
||||
|
|
@ -213,10 +212,10 @@ namespace Cantera {
|
|||
writeDestructionRates(ostream& f) {
|
||||
f << " void getDestructionRates(const doublereal* rf, const doublereal* rb," << endl;
|
||||
f << " doublereal* d) {" << endl;
|
||||
map<int, string> out;
|
||||
map<size_t, string> out;
|
||||
m_revproducts->writeIncrementSpecies("rb",out);
|
||||
m_reactants->writeIncrementSpecies("rf",out);
|
||||
map<int, string>::iterator b;
|
||||
map<size_t, string>::iterator b;
|
||||
for (b = out.begin(); b != out.end(); ++b) {
|
||||
string rhs = wrapString(b->second);
|
||||
rhs[1] = '=';
|
||||
|
|
@ -228,11 +227,11 @@ namespace Cantera {
|
|||
void ReactionStoichMgr::
|
||||
writeNetProductionRates(ostream& f) {
|
||||
f << " void getNetProductionRates(const doublereal* r, doublereal* w) {" << endl;
|
||||
map<int, string> out;
|
||||
map<size_t, string> out;
|
||||
m_revproducts->writeIncrementSpecies("r",out);
|
||||
m_irrevproducts->writeIncrementSpecies("r",out);
|
||||
m_reactants->writeDecrementSpecies("r",out);
|
||||
map<int, string>::iterator b;
|
||||
map<size_t, string>::iterator b;
|
||||
for (b = out.begin(); b != out.end(); ++b) {
|
||||
string rhs = wrapString(b->second);
|
||||
rhs[1] = '=';
|
||||
|
|
@ -244,9 +243,9 @@ namespace Cantera {
|
|||
void ReactionStoichMgr::
|
||||
writeMultiplyReactants(ostream& f) {
|
||||
f << " void multiplyReactants(const doublereal* c, doublereal* r) {" << endl;
|
||||
map<int, string> out;
|
||||
map<size_t, string> out;
|
||||
m_reactants->writeMultiply("c",out);
|
||||
map<int, string>::iterator b;
|
||||
map<size_t, string>::iterator b;
|
||||
for (b = out.begin(); b != out.end(); ++b) {
|
||||
string rhs = b->second;
|
||||
f << " r[" << b->first << "] *= " << rhs << ";" << endl;
|
||||
|
|
@ -257,9 +256,9 @@ namespace Cantera {
|
|||
void ReactionStoichMgr::
|
||||
writeMultiplyRevProducts(ostream& f) {
|
||||
f << " void multiplyRevProducts(const doublereal* c, doublereal* r) {" << endl;
|
||||
map<int, string> out;
|
||||
map<size_t, string> out;
|
||||
m_revproducts->writeMultiply("c",out);
|
||||
map<int, string>::iterator b;
|
||||
map<size_t, string>::iterator b;
|
||||
for (b = out.begin(); b != out.end(); ++b) {
|
||||
string rhs = b->second;
|
||||
f << " r[" << b->first << "] *= " << rhs << ";" << endl;
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ namespace Cantera {
|
|||
* @param products vector of integer product indices
|
||||
* @param reversible true if the reaction is reversible, false otherwise
|
||||
*/
|
||||
virtual void add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||
bool reversible);
|
||||
virtual void add(int rxn, const std::vector<size_t>& reactants,
|
||||
const std::vector<size_t>& products, bool reversible);
|
||||
|
||||
/**
|
||||
* Add a reaction with specified, possibly non-integral, reaction orders.
|
||||
|
|
@ -120,7 +120,7 @@ namespace Cantera {
|
|||
* C = N_p Q_f + N_r Q_r.
|
||||
* \f]
|
||||
*/
|
||||
virtual void getCreationRates(int nSpecies,
|
||||
virtual void getCreationRates(size_t nSpecies,
|
||||
const doublereal* fwdRatesOfProgress,
|
||||
const doublereal* revRatesOfProgress,
|
||||
doublereal* creationRates);
|
||||
|
|
@ -137,7 +137,7 @@ namespace Cantera {
|
|||
* Note that the stoichiometric coefficient matrices are very sparse, integer
|
||||
* matrices.
|
||||
*/
|
||||
virtual void getDestructionRates(int nSpecies,
|
||||
virtual void getDestructionRates(size_t nSpecies,
|
||||
const doublereal* fwdRatesOfProgress,
|
||||
const doublereal* revRatesOfProgress,
|
||||
doublereal* destructionRates);
|
||||
|
|
@ -157,7 +157,7 @@ namespace Cantera {
|
|||
* W = (N_r - N_p) Q_{\rm net},
|
||||
* \f]
|
||||
*/
|
||||
virtual void getNetProductionRates(int nsp, const doublereal* ropnet, doublereal* w);
|
||||
virtual void getNetProductionRates(size_t nsp, const doublereal* ropnet, doublereal* w);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace Cantera {
|
|||
m_A(0.0) {}
|
||||
|
||||
/// Constructor with Arrhenius parameters specified with an array.
|
||||
Arrhenius(int csize, const doublereal* c) :
|
||||
Arrhenius(size_t csize, const doublereal* c) :
|
||||
m_b (c[1]),
|
||||
m_E (c[2]),
|
||||
m_A (c[0])
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ namespace Cantera {
|
|||
return 0.0;
|
||||
}
|
||||
|
||||
inline static std::string fmt(std::string r, int n) { return r + "[" + int2str(n) + "]"; }
|
||||
inline static std::string fmt(std::string r, size_t n) { return r + "[" + int2str(int(n)) + "]"; }
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -159,10 +159,10 @@ namespace Cantera {
|
|||
|
||||
public:
|
||||
|
||||
C1( int rxn = 0, int ic0 = 0)
|
||||
C1(size_t rxn = 0, size_t ic0 = 0)
|
||||
: m_rxn (rxn), m_ic0 (ic0) {}
|
||||
|
||||
int data(std::vector<int>& ic) {
|
||||
size_t data(std::vector<size_t>& ic) {
|
||||
ic.resize(1);
|
||||
ic[0] = m_ic0;
|
||||
return m_rxn;
|
||||
|
|
@ -188,31 +188,31 @@ namespace Cantera {
|
|||
R[m_rxn] -= S[m_ic0];
|
||||
}
|
||||
|
||||
int rxnNumber() const { return m_rxn; }
|
||||
int speciesIndex(int n) const { return m_ic0; }
|
||||
int nSpecies() { return 1;}
|
||||
size_t rxnNumber() const { return m_rxn; }
|
||||
size_t speciesIndex(size_t n) const { return m_ic0; }
|
||||
size_t nSpecies() { return 1;}
|
||||
|
||||
void writeMultiply(std::string r, std::map<int, std::string>& out) {
|
||||
void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_rxn] = fmt(r, m_ic0);
|
||||
}
|
||||
|
||||
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) {
|
||||
void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_rxn] += " + "+fmt(r, m_ic0);
|
||||
}
|
||||
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) {
|
||||
void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_rxn] += " - "+fmt(r, m_ic0);
|
||||
}
|
||||
|
||||
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) {
|
||||
void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_ic0] += " + "+fmt(r, m_rxn);
|
||||
}
|
||||
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) {
|
||||
void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_ic0] += " - "+fmt(r, m_rxn);
|
||||
}
|
||||
|
||||
private:
|
||||
int m_rxn;
|
||||
int m_ic0;
|
||||
size_t m_rxn;
|
||||
size_t m_ic0;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -223,10 +223,10 @@ namespace Cantera {
|
|||
*/
|
||||
class C2 {
|
||||
public:
|
||||
C2( int rxn = 0, int ic0 = 0, int ic1 = 0)
|
||||
C2(size_t rxn = 0, size_t ic0 = 0, size_t ic1 = 0)
|
||||
: m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1) {}
|
||||
|
||||
int data(std::vector<int>& ic) {
|
||||
int data(std::vector<size_t>& ic) {
|
||||
ic.resize(2);
|
||||
ic[0] = m_ic0;
|
||||
ic[1] = m_ic1;
|
||||
|
|
@ -255,26 +255,26 @@ namespace Cantera {
|
|||
R[m_rxn] -= (S[m_ic0] + S[m_ic1]);
|
||||
}
|
||||
|
||||
int rxnNumber() const { return m_rxn; }
|
||||
int speciesIndex(int n) const { return (n == 0 ? m_ic0 : m_ic1); }
|
||||
int nSpecies() { return 2;}
|
||||
size_t rxnNumber() const { return m_rxn; }
|
||||
size_t speciesIndex(size_t n) const { return (n == 0 ? m_ic0 : m_ic1); }
|
||||
size_t nSpecies() { return 2;}
|
||||
|
||||
void writeMultiply(std::string r, std::map<int, std::string>& out) {
|
||||
void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1);
|
||||
}
|
||||
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) {
|
||||
void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1);
|
||||
}
|
||||
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) {
|
||||
void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1);
|
||||
}
|
||||
|
||||
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) {
|
||||
void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
|
||||
std::string s = " + "+fmt(r, m_rxn);
|
||||
out[m_ic0] += s;
|
||||
out[m_ic1] += s;
|
||||
}
|
||||
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) {
|
||||
void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
|
||||
std::string s = " - "+fmt(r, m_rxn);
|
||||
out[m_ic0] += s;
|
||||
out[m_ic1] += s;
|
||||
|
|
@ -285,13 +285,13 @@ namespace Cantera {
|
|||
/**
|
||||
* Reaction index -> index into the ROP vector
|
||||
*/
|
||||
int m_rxn;
|
||||
size_t m_rxn;
|
||||
|
||||
/**
|
||||
* Species indecise -> index into the species vector for the
|
||||
* two species.
|
||||
*/
|
||||
int m_ic0, m_ic1;
|
||||
size_t m_ic0, m_ic1;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -301,10 +301,10 @@ namespace Cantera {
|
|||
*/
|
||||
class C3 {
|
||||
public:
|
||||
C3( int rxn = 0, int ic0 = 0, int ic1 = 0, int ic2 = 0)
|
||||
C3(size_t rxn = 0, size_t ic0 = 0, size_t ic1 = 0, size_t ic2 = 0)
|
||||
: m_rxn (rxn), m_ic0 (ic0), m_ic1 (ic1), m_ic2 (ic2) {}
|
||||
|
||||
int data(std::vector<int>& ic) {
|
||||
int data(std::vector<size_t>& ic) {
|
||||
ic.resize(3);
|
||||
ic[0] = m_ic0;
|
||||
ic[1] = m_ic1;
|
||||
|
|
@ -336,33 +336,33 @@ namespace Cantera {
|
|||
R[m_rxn] -= (S[m_ic0] + S[m_ic1] + S[m_ic2]);
|
||||
}
|
||||
|
||||
int rxnNumber() const { return m_rxn; }
|
||||
int speciesIndex(int n) const { return (n == 0 ? m_ic0 : (n == 1 ? m_ic1 : m_ic2)); }
|
||||
int nSpecies() { return 3;}
|
||||
size_t rxnNumber() const { return m_rxn; }
|
||||
size_t speciesIndex(size_t n) const { return (n == 0 ? m_ic0 : (n == 1 ? m_ic1 : m_ic2)); }
|
||||
size_t nSpecies() { return 3;}
|
||||
|
||||
void writeMultiply(std::string r, std::map<int, std::string>& out) {
|
||||
void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1) + " * " + fmt(r, m_ic2);
|
||||
}
|
||||
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) {
|
||||
void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1)+" + "+fmt(r, m_ic2);
|
||||
}
|
||||
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) {
|
||||
void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1)+" - "+fmt(r, m_ic2);
|
||||
}
|
||||
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) {
|
||||
void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
|
||||
std::string s = " + "+fmt(r, m_rxn);
|
||||
out[m_ic0] += s;
|
||||
out[m_ic1] += s;
|
||||
out[m_ic2] += s;
|
||||
}
|
||||
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) {
|
||||
void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
|
||||
std::string s = " - "+fmt(r, m_rxn);
|
||||
out[m_ic0] += s;
|
||||
out[m_ic1] += s;
|
||||
out[m_ic2] += s;
|
||||
}
|
||||
private:
|
||||
int m_rxn, m_ic0, m_ic1, m_ic2;
|
||||
size_t m_rxn, m_ic0, m_ic1, m_ic2;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -375,34 +375,33 @@ namespace Cantera {
|
|||
public:
|
||||
C_AnyN() : m_rxn (-1) {}
|
||||
|
||||
C_AnyN( int rxn, const vector_int& ic, const vector_fp& order,
|
||||
C_AnyN(size_t rxn, const std::vector<size_t>& 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++) {
|
||||
for (size_t n = 0; n < m_n; n++) {
|
||||
m_ic[n] = ic[n];
|
||||
m_order[n] = order[n];
|
||||
m_stoich[n] = stoich[n];
|
||||
}
|
||||
}
|
||||
|
||||
int data(std::vector<int>& ic) {
|
||||
size_t data(std::vector<size_t>& ic) {
|
||||
ic.resize(m_n);
|
||||
int n;
|
||||
for (n = 0; n < m_n; n++) ic[n] = m_ic[n];
|
||||
for (size_t n = 0; n < m_n; n++) ic[n] = m_ic[n];
|
||||
return m_rxn;
|
||||
}
|
||||
|
||||
doublereal order(int n) const {return m_order[n];}
|
||||
doublereal stoich(int n) const {return m_stoich[n];}
|
||||
int speciesIndex(int n) const {return m_ic[n];}
|
||||
doublereal order(size_t n) const {return m_order[n];}
|
||||
doublereal stoich(size_t n) const {return m_stoich[n];}
|
||||
size_t speciesIndex(size_t n) const {return m_ic[n];}
|
||||
|
||||
void multiply(const doublereal* input, doublereal* output) const {
|
||||
doublereal oo;
|
||||
for (int n = 0; n < m_n; n++) {
|
||||
for (size_t n = 0; n < m_n; n++) {
|
||||
oo = m_order[n];
|
||||
if (oo != 0.0) {
|
||||
output[m_rxn] *= ppow(input[m_ic[n]], oo);
|
||||
|
|
@ -413,31 +412,30 @@ namespace Cantera {
|
|||
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;
|
||||
for (size_t 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;
|
||||
for (size_t 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]
|
||||
for (size_t n = 0; n < m_n; n++) output[m_rxn]
|
||||
+= m_stoich[n]*input[m_ic[n]];
|
||||
}
|
||||
|
||||
void decrementReaction(const doublereal* input,
|
||||
doublereal* output) const {
|
||||
for (int n = 0; n < m_n; n++) output[m_rxn]
|
||||
for (size_t n = 0; n < m_n; n++) output[m_rxn]
|
||||
-= m_stoich[n]*input[m_ic[n]];
|
||||
}
|
||||
|
||||
void writeMultiply(std::string r, std::map<int, std::string>& out) {
|
||||
int n;
|
||||
void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
|
||||
out[m_rxn] = "";
|
||||
for (n = 0; n < m_n; n++) {
|
||||
for (size_t n = 0; n < m_n; n++) {
|
||||
if (m_order[n] == 1.0)
|
||||
out[m_rxn] += fmt(r, m_ic[n]);
|
||||
else
|
||||
|
|
@ -446,30 +444,26 @@ namespace Cantera {
|
|||
out[m_rxn] += " * ";
|
||||
}
|
||||
}
|
||||
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) {
|
||||
int n;
|
||||
for (n = 0; n < m_n; n++) {
|
||||
void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
|
||||
for (size_t n = 0; n < m_n; n++) {
|
||||
out[m_rxn] += " + "+fp2str(m_stoich[n]) + "*" + fmt(r, m_ic[n]);
|
||||
}
|
||||
}
|
||||
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) {
|
||||
int n;
|
||||
for (n = 0; n < m_n; n++) {
|
||||
void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
|
||||
for (size_t n = 0; n < m_n; n++) {
|
||||
out[m_rxn] += " - "+fp2str(m_stoich[n]) + "*" + fmt(r, m_ic[n]);
|
||||
}
|
||||
}
|
||||
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) {
|
||||
void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
|
||||
std::string s = fmt(r, m_rxn);
|
||||
int n;
|
||||
for (n = 0; n < m_n; n++) {
|
||||
for (size_t n = 0; n < m_n; n++) {
|
||||
out[m_ic[n]] += " + "+fp2str(m_stoich[n]) + "*" + s;
|
||||
}
|
||||
}
|
||||
|
||||
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) {
|
||||
void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
|
||||
std::string s = fmt(r, m_rxn);
|
||||
int n;
|
||||
for (n = 0; n < m_n; n++) {
|
||||
for (size_t n = 0; n < m_n; n++) {
|
||||
out[m_ic[n]] += " - "+fp2str(m_stoich[n]) + "*" + s;
|
||||
}
|
||||
}
|
||||
|
|
@ -481,13 +475,13 @@ namespace Cantera {
|
|||
* This is the number of species which have non-zero entries in either the
|
||||
* reaction order matrix or the stoichiometric order matrix for this reaction.
|
||||
*/
|
||||
int m_n;
|
||||
size_t m_n;
|
||||
|
||||
//! ID of the reaction corresponding to this stoichiometric manager
|
||||
/*!
|
||||
* This is used within the interface to select the
|
||||
*/
|
||||
int m_rxn;
|
||||
size_t m_rxn;
|
||||
|
||||
//! Vector of species which are involved with this stoichiometric manager calculations
|
||||
/*!
|
||||
|
|
@ -495,7 +489,7 @@ namespace Cantera {
|
|||
* reaction order matrix or the stoichiometric order matrix for this reaction, m_rxn.
|
||||
* It's used as the index into the arrays m_order[] and m_stoich[].
|
||||
*/
|
||||
vector_int m_ic;
|
||||
std::vector<size_t> m_ic;
|
||||
vector_fp m_order;
|
||||
vector_fp m_stoich;
|
||||
};
|
||||
|
|
@ -539,31 +533,31 @@ namespace Cantera {
|
|||
|
||||
template<class InputIter>
|
||||
inline static void _writeIncrementSpecies(InputIter begin, InputIter end, std::string r,
|
||||
std::map<int, std::string>& out) {
|
||||
std::map<size_t, std::string>& out) {
|
||||
for (; begin != end; ++begin) begin->writeIncrementSpecies(r, out);
|
||||
}
|
||||
|
||||
template<class InputIter>
|
||||
inline static void _writeDecrementSpecies(InputIter begin, InputIter end, std::string r,
|
||||
std::map<int, std::string>& out) {
|
||||
std::map<size_t, std::string>& out) {
|
||||
for (; begin != end; ++begin) begin->writeDecrementSpecies(r, out);
|
||||
}
|
||||
|
||||
template<class InputIter>
|
||||
inline static void _writeIncrementReaction(InputIter begin, InputIter end, std::string r,
|
||||
std::map<int, std::string>& out) {
|
||||
std::map<size_t, std::string>& out) {
|
||||
for (; begin != end; ++begin) begin->writeIncrementReaction(r, out);
|
||||
}
|
||||
|
||||
template<class InputIter>
|
||||
inline static void _writeDecrementReaction(InputIter begin, InputIter end, std::string r,
|
||||
std::map<int, std::string>& out) {
|
||||
std::map<size_t, std::string>& out) {
|
||||
for (; begin != end; ++begin) begin->writeDecrementReaction(r, out);
|
||||
}
|
||||
|
||||
template<class InputIter>
|
||||
inline static void _writeMultiply(InputIter begin, InputIter end, std::string r,
|
||||
std::map<int, std::string>& out) {
|
||||
std::map<size_t, std::string>& out) {
|
||||
for (; begin != end; ++begin) begin->writeMultiply(r, out);
|
||||
}
|
||||
|
||||
|
|
@ -632,13 +626,13 @@ namespace Cantera {
|
|||
* the order of each species in the power list expression is
|
||||
* set to one automatically.
|
||||
*/
|
||||
void add(int rxn, const vector_int& k) {
|
||||
void add(size_t rxn, const std::vector<size_t>& k) {
|
||||
vector_fp order(k.size(), 1.0);
|
||||
vector_fp stoich(k.size(), 1.0);
|
||||
add(rxn, k, order, stoich);
|
||||
}
|
||||
|
||||
void add(int rxn, const vector_int& k, const vector_fp& order) {
|
||||
void add(size_t rxn, const std::vector<size_t>& k, const vector_fp& order) {
|
||||
vector_fp stoich(k.size(), 1.0);
|
||||
add(rxn, k, order, stoich);
|
||||
}
|
||||
|
|
@ -661,35 +655,33 @@ namespace Cantera {
|
|||
* @param stoich This is used to handle fractional stoichiometric coefficients
|
||||
* on the product side of irreversible reactions.
|
||||
*/
|
||||
void add(int rxn, const vector_int& k, const vector_fp& order,
|
||||
void add(size_t rxn, const std::vector<size_t>& k, const vector_fp& order,
|
||||
const vector_fp& stoich) {
|
||||
m_n[rxn] = static_cast<int>(k.size());
|
||||
int ns = stoich.size();
|
||||
int n;
|
||||
m_n[rxn] = k.size();
|
||||
bool frac = false;
|
||||
for (n = 0; n < ns; n++) {
|
||||
for (size_t n = 0; n < stoich.size(); n++) {
|
||||
if (stoich[n] != 1.0) frac = true;
|
||||
}
|
||||
if (frac) {
|
||||
m_loc[rxn] = static_cast<int>(m_cn_list.size());
|
||||
m_loc[rxn] = m_cn_list.size();
|
||||
m_cn_list.push_back(C_AnyN(rxn, k, order, stoich));
|
||||
}
|
||||
else {
|
||||
switch (k.size()) {
|
||||
case 1:
|
||||
m_loc[rxn] = static_cast<int>(m_c1_list.size());
|
||||
m_loc[rxn] = m_c1_list.size();
|
||||
m_c1_list.push_back(C1(rxn, k[0]));
|
||||
break;
|
||||
case 2:
|
||||
m_loc[rxn] = static_cast<int>(m_c2_list.size());
|
||||
m_loc[rxn] = m_c2_list.size();
|
||||
m_c2_list.push_back(C2(rxn, k[0], k[1]));
|
||||
break;
|
||||
case 3:
|
||||
m_loc[rxn] = static_cast<int>(m_c3_list.size());
|
||||
m_loc[rxn] = m_c3_list.size();
|
||||
m_c3_list.push_back(C3(rxn, k[0], k[1], k[2]));
|
||||
break;
|
||||
default:
|
||||
m_loc[rxn] = static_cast<int>(m_cn_list.size());
|
||||
m_loc[rxn] = m_cn_list.size();
|
||||
m_cn_list.push_back(C_AnyN(rxn, k, order, stoich));
|
||||
}
|
||||
}
|
||||
|
|
@ -730,35 +722,35 @@ namespace Cantera {
|
|||
_decrementReactions(m_cn_list.begin(), m_cn_list.end(), input, output);
|
||||
}
|
||||
|
||||
void writeIncrementSpecies(std::string r, std::map<int, std::string>& out) {
|
||||
void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
|
||||
_writeIncrementSpecies(m_c1_list.begin(), m_c1_list.end(), r, out);
|
||||
_writeIncrementSpecies(m_c2_list.begin(), m_c2_list.end(), r, out);
|
||||
_writeIncrementSpecies(m_c3_list.begin(), m_c3_list.end(), r, out);
|
||||
_writeIncrementSpecies(m_cn_list.begin(), m_cn_list.end(), r, out);
|
||||
}
|
||||
|
||||
void writeDecrementSpecies(std::string r, std::map<int, std::string>& out) {
|
||||
void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
|
||||
_writeDecrementSpecies(m_c1_list.begin(), m_c1_list.end(), r, out);
|
||||
_writeDecrementSpecies(m_c2_list.begin(), m_c2_list.end(), r, out);
|
||||
_writeDecrementSpecies(m_c3_list.begin(), m_c3_list.end(), r, out);
|
||||
_writeDecrementSpecies(m_cn_list.begin(), m_cn_list.end(), r, out);
|
||||
}
|
||||
|
||||
void writeIncrementReaction(std::string r, std::map<int, std::string>& out) {
|
||||
void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
|
||||
_writeIncrementReaction(m_c1_list.begin(), m_c1_list.end(), r, out);
|
||||
_writeIncrementReaction(m_c2_list.begin(), m_c2_list.end(), r, out);
|
||||
_writeIncrementReaction(m_c3_list.begin(), m_c3_list.end(), r, out);
|
||||
_writeIncrementReaction(m_cn_list.begin(), m_cn_list.end(), r, out);
|
||||
}
|
||||
|
||||
void writeDecrementReaction(std::string r, std::map<int, std::string>& out) {
|
||||
void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
|
||||
_writeDecrementReaction(m_c1_list.begin(), m_c1_list.end(), r, out);
|
||||
_writeDecrementReaction(m_c2_list.begin(), m_c2_list.end(), r, out);
|
||||
_writeDecrementReaction(m_c3_list.begin(), m_c3_list.end(), r, out);
|
||||
_writeDecrementReaction(m_cn_list.begin(), m_cn_list.end(), r, out);
|
||||
}
|
||||
|
||||
void writeMultiply(std::string r, std::map<int, std::string>& out) {
|
||||
void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
|
||||
_writeMultiply(m_c1_list.begin(), m_c1_list.end(), r, out);
|
||||
_writeMultiply(m_c2_list.begin(), m_c2_list.end(), r, out);
|
||||
_writeMultiply(m_c3_list.begin(), m_c3_list.end(), r, out);
|
||||
|
|
@ -776,12 +768,12 @@ namespace Cantera {
|
|||
* Std::Mapping with the Reaction Number as key and the Number of species
|
||||
* as the value.
|
||||
*/
|
||||
std::map<int, int> m_n;
|
||||
std::map<size_t, size_t> m_n;
|
||||
/**
|
||||
* Std::Mapping with the Reaction Number as key and the placement in the
|
||||
* vector of reactions list( i.e., m_c1_list[]) as key
|
||||
*/
|
||||
std::map<int, int> m_loc;
|
||||
std::map<size_t, size_t> m_loc;
|
||||
};
|
||||
|
||||
#undef INCL_STOICH_WRITER
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ namespace Cantera {
|
|||
*/
|
||||
void checkRxnElementBalance(Kinetics& kin,
|
||||
const ReactionData &rdata, doublereal errorTolerance) {
|
||||
int index, klocal, n, kp, kr, m, nel;
|
||||
doublereal kstoich;
|
||||
|
||||
map<string, double> bal, balr, balp;
|
||||
|
|
@ -92,17 +91,16 @@ namespace Cantera {
|
|||
balp.clear();
|
||||
balr.clear();
|
||||
//cout << "checking " << rdata.equation << endl;
|
||||
int np = rdata.products.size();
|
||||
size_t np = rdata.products.size();
|
||||
|
||||
// iterate over the products
|
||||
for (index = 0; index < np; index++) {
|
||||
kp = rdata.products[index]; // index of the product in 'kin'
|
||||
n = kin.speciesPhaseIndex(kp); // phase this product belongs to
|
||||
klocal = kp - kin.kineticsSpeciesIndex(0,n); // index within this phase
|
||||
for (size_t index = 0; index < np; index++) {
|
||||
size_t kp = rdata.products[index]; // index of the product in 'kin'
|
||||
size_t n = kin.speciesPhaseIndex(kp); // phase this product belongs to
|
||||
size_t klocal = kp - kin.kineticsSpeciesIndex(0,n); // index within this phase
|
||||
kstoich = rdata.pstoich[index]; // product stoichiometric coeff
|
||||
const ThermoPhase& ph = kin.speciesPhase(kp);
|
||||
nel = ph.nElements();
|
||||
for (m = 0; m < nel; m++) {
|
||||
for (size_t m = 0; m < ph.nElements(); m++) {
|
||||
bal[ph.elementName(m)] += kstoich*ph.nAtoms(klocal,m);
|
||||
balp[ph.elementName(m)] += kstoich*ph.nAtoms(klocal,m);
|
||||
//cout << "product species " << ph.speciesName(klocal) << " has " << ph.nAtoms(klocal,m)
|
||||
|
|
@ -110,15 +108,14 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
int nr = rdata.reactants.size();
|
||||
for (index = 0; index < nr; index++) {
|
||||
kr = rdata.reactants[index];
|
||||
n = kin.speciesPhaseIndex(kr);
|
||||
for (size_t index = 0; index < nr; index++) {
|
||||
size_t kr = rdata.reactants[index];
|
||||
size_t n = kin.speciesPhaseIndex(kr);
|
||||
//klocal = kr - kin.start(n);
|
||||
klocal = kr - kin.kineticsSpeciesIndex(0,n);
|
||||
size_t klocal = kr - kin.kineticsSpeciesIndex(0,n);
|
||||
kstoich = rdata.rstoich[index];
|
||||
const ThermoPhase& ph = kin.speciesPhase(kr);
|
||||
nel = ph.nElements();
|
||||
for (m = 0; m < nel; m++) {
|
||||
for (size_t m = 0; m < ph.nElements(); m++) {
|
||||
bal[ph.elementName(m)] -= kstoich*ph.nAtoms(klocal,m);
|
||||
balr[ph.elementName(m)] += kstoich*ph.nAtoms(klocal,m);
|
||||
//cout << "reactant species " << ph.speciesName(klocal) << " has " << ph.nAtoms(klocal,m)
|
||||
|
|
@ -179,9 +176,8 @@ namespace Cantera {
|
|||
* and continue.
|
||||
*/
|
||||
bool getReagents(const XML_Node& rxn, kinetics_t& kin, int rp,
|
||||
std::string default_phase,
|
||||
vector_int& spnum, vector_fp& stoich, vector_fp& order,
|
||||
int rule) {
|
||||
std::string default_phase, std::vector<size_t>& spnum,
|
||||
vector_fp& stoich, vector_fp& order, int rule) {
|
||||
|
||||
string rptype;
|
||||
|
||||
|
|
@ -203,16 +199,13 @@ namespace Cantera {
|
|||
vector<string> key, val;
|
||||
getPairs(rg, key, val);
|
||||
|
||||
int ns = static_cast<int>(key.size());
|
||||
|
||||
/*
|
||||
* Loop over each of the pairs and process them
|
||||
*/
|
||||
int isp;
|
||||
doublereal ord, stch;
|
||||
string ph, sp;
|
||||
map<string, int> speciesMap;
|
||||
for (int n = 0; n < ns; n++) {
|
||||
map<string, size_t> speciesMap;
|
||||
for (size_t n = 0; n < key.size(); n++) {
|
||||
sp = key[n]; // sp is the string name for species
|
||||
ph = "";
|
||||
/*
|
||||
|
|
@ -220,8 +213,8 @@ namespace Cantera {
|
|||
* member function kineticsSpeciesIndex(). We will search
|
||||
* for the species in all phases defined in the kinetics operator.
|
||||
*/
|
||||
isp = kin.kineticsSpeciesIndex(sp,"<any>");
|
||||
if (isp < 0) {
|
||||
size_t isp = kin.kineticsSpeciesIndex(sp,"<any>");
|
||||
if (isp == -2) {
|
||||
if (rule == 1)
|
||||
return false;
|
||||
else {
|
||||
|
|
@ -257,13 +250,11 @@ namespace Cantera {
|
|||
if (rp == 1 && rxn.hasChild("order")) {
|
||||
vector<XML_Node*> ord;
|
||||
rxn.getChildren("order",ord);
|
||||
int norder = static_cast<int>(ord.size());
|
||||
int loc;
|
||||
doublereal forder;
|
||||
for (int nn = 0; nn < norder; nn++) {
|
||||
for (size_t nn = 0; nn < ord.size(); nn++) {
|
||||
const XML_Node& oo = *ord[nn];
|
||||
string sp = oo["species"];
|
||||
loc = speciesMap[sp];
|
||||
size_t loc = speciesMap[sp];
|
||||
if (loc == 0)
|
||||
throw CanteraError("getReagents",
|
||||
"reaction order specified for non-reactantt: "
|
||||
|
|
@ -322,9 +313,9 @@ namespace Cantera {
|
|||
*/
|
||||
static void getStick(const XML_Node& node, Kinetics& kin,
|
||||
ReactionData& r, doublereal& A, doublereal& b, doublereal& E) {
|
||||
int nr = r.reactants.size();
|
||||
int k, klocal, not_surf = 0;
|
||||
int np = 0;
|
||||
size_t nr = r.reactants.size();
|
||||
size_t k, klocal, not_surf = 0;
|
||||
size_t np = 0;
|
||||
doublereal f = 1.0;
|
||||
doublereal order;
|
||||
/*
|
||||
|
|
@ -336,9 +327,9 @@ namespace Cantera {
|
|||
*/
|
||||
string spname = node["species"];
|
||||
ThermoPhase& th = kin.speciesPhase(spname);
|
||||
int isp = th.speciesIndex(spname);
|
||||
int ispKinetics = kin.kineticsSpeciesIndex(spname);
|
||||
int ispPhaseIndex = kin.speciesPhaseIndex(ispKinetics);
|
||||
size_t isp = th.speciesIndex(spname);
|
||||
size_t ispKinetics = kin.kineticsSpeciesIndex(spname);
|
||||
size_t ispPhaseIndex = kin.speciesPhaseIndex(ispKinetics);
|
||||
|
||||
doublereal ispMW = th.molecularWeights()[isp];
|
||||
doublereal sc;
|
||||
|
|
@ -398,7 +389,7 @@ namespace Cantera {
|
|||
thermo_t& surfphase, ReactionData& rdata) {
|
||||
vector<XML_Node*> cov;
|
||||
node.getChildren("coverage", cov);
|
||||
int k, nc = static_cast<int>(cov.size());
|
||||
size_t k, nc = cov.size();
|
||||
doublereal e;
|
||||
string spname;
|
||||
if (nc > 0) {
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@ namespace Cantera {
|
|||
*/
|
||||
bool getReagents(const XML_Node& rxn, kinetics_t& kin, int rp,
|
||||
std::string default_phase,
|
||||
vector_int& spnum, vector_fp& stoich, vector_fp& order,
|
||||
int rule);
|
||||
std::vector<size_t>& spnum, vector_fp& stoich,
|
||||
vector_fp& order, int rule);
|
||||
|
||||
//! Read the rate coefficient data from the XML file.
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
m_maxTotSpecies = 0;
|
||||
for (int n = 0; n < m_numSurfPhases; n++) {
|
||||
int tsp = m_objects[n]->nTotalSpecies();
|
||||
for (size_t n = 0; n < m_numSurfPhases; n++) {
|
||||
size_t tsp = m_objects[n]->nTotalSpecies();
|
||||
m_maxTotSpecies = MAX(m_maxTotSpecies, tsp);
|
||||
}
|
||||
m_maxTotSpecies = MAX(m_maxTotSpecies, m_neq);
|
||||
|
|
|
|||
|
|
@ -591,7 +591,7 @@ namespace Cantera {
|
|||
|
||||
//! Maximum number of species in any single kinetics operator
|
||||
//! -> also maxed wrt the total # of solution species
|
||||
int m_maxTotSpecies;
|
||||
size_t m_maxTotSpecies;
|
||||
|
||||
//! Temporary vector with length equal to max m_maxTotSpecies
|
||||
vector_fp m_netProductionRatesSave;
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ namespace Cantera {
|
|||
// sort (x,y) pairs by x
|
||||
|
||||
void heapsort(vector_fp& x, std::vector<size_t>& y) {
|
||||
int n = x.size();
|
||||
size_t n = x.size();
|
||||
if (n < 2) return;
|
||||
doublereal rra;
|
||||
integer rrb;
|
||||
int ll = n/2;
|
||||
int iret = n-1;
|
||||
size_t rrb;
|
||||
size_t ll = n/2;
|
||||
size_t iret = n-1;
|
||||
|
||||
while (1 > 0) {
|
||||
if (ll > 0) {
|
||||
|
|
@ -35,8 +35,8 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
int i = ll;
|
||||
int j = ll + ll + 1;
|
||||
size_t i = ll;
|
||||
size_t j = ll + ll + 1;
|
||||
|
||||
while (j <= iret) {
|
||||
if (j < iret) {
|
||||
|
|
@ -59,12 +59,12 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void heapsort(vector_fp& x, vector_fp& y) {
|
||||
int n = x.size();
|
||||
size_t n = x.size();
|
||||
if (n < 2) return;
|
||||
doublereal rra;
|
||||
doublereal rrb;
|
||||
int ll = n/2;
|
||||
int iret = n-1;
|
||||
size_t ll = n/2;
|
||||
size_t iret = n-1;
|
||||
|
||||
while (1 > 0) {
|
||||
if (ll > 0) {
|
||||
|
|
@ -85,8 +85,8 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
int i = ll;
|
||||
int j = ll + ll + 1;
|
||||
size_t i = ll;
|
||||
size_t j = ll + ll + 1;
|
||||
|
||||
while (j <= iret) {
|
||||
if (j < iret) {
|
||||
|
|
|
|||
|
|
@ -743,8 +743,7 @@ namespace Cantera {
|
|||
_init(m_nsp+1);
|
||||
m_fixed_cov.resize(m_nsp, 0.0);
|
||||
m_fixed_cov[0] = 1.0;
|
||||
int nt = m_kin->nTotalSpecies();
|
||||
m_work.resize(nt, 0.0);
|
||||
m_work.resize(m_kin->nTotalSpecies(), 0.0);
|
||||
|
||||
// set bounds
|
||||
vector_fp lower(m_nv), upper(m_nv);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Cantera {
|
|||
m_index(0) {
|
||||
}
|
||||
|
||||
ConstCpPoly::ConstCpPoly(int n, doublereal tlow, doublereal thigh,
|
||||
ConstCpPoly::ConstCpPoly(size_t n, doublereal tlow, doublereal thigh,
|
||||
doublereal pref,
|
||||
const doublereal* coeffs) :
|
||||
m_lowT (tlow),
|
||||
|
|
@ -109,7 +109,7 @@ namespace Cantera {
|
|||
s_R[m_index] = m_s0_R + m_cp0_R * (logt - m_logt0);
|
||||
}
|
||||
|
||||
void ConstCpPoly::reportParameters(int &n, int &type,
|
||||
void ConstCpPoly::reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Cantera {
|
|||
* - c[3] = \f$ {Cp}_k^o(T_0, p_{ref}) \f$ (J(kmol K)
|
||||
*
|
||||
*/
|
||||
ConstCpPoly(int n, doublereal tlow, doublereal thigh,
|
||||
ConstCpPoly(size_t n, doublereal tlow, doublereal thigh,
|
||||
doublereal pref,
|
||||
const doublereal* coeffs);
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ namespace Cantera {
|
|||
virtual int reportType() const { return CONSTANT_CP; }
|
||||
|
||||
//! Returns an integer representing the species index
|
||||
virtual int speciesIndex() const { return m_index; }
|
||||
virtual size_t speciesIndex() const { return m_index; }
|
||||
|
||||
//! Update the properties for this species, given a temperature polynomial
|
||||
/*!
|
||||
|
|
@ -154,7 +154,7 @@ namespace Cantera {
|
|||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
void reportParameters(int &n, int &type,
|
||||
void reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const;
|
||||
|
|
@ -191,7 +191,7 @@ namespace Cantera {
|
|||
//! Reference pressure (Pa)
|
||||
doublereal m_Pref;
|
||||
//! Species Index
|
||||
int m_index;
|
||||
size_t m_index;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -100,11 +100,11 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
doublereal ConstDensityThermo::standardConcentration(int k) const {
|
||||
doublereal ConstDensityThermo::standardConcentration(size_t k) const {
|
||||
return molarDensity();
|
||||
}
|
||||
|
||||
doublereal ConstDensityThermo::logStandardConc(int k) const {
|
||||
doublereal ConstDensityThermo::logStandardConc(size_t k) const {
|
||||
return log(molarDensity());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -196,13 +196,13 @@ namespace Cantera {
|
|||
* @return
|
||||
* Returns the standard Concentration in units of m3 kmol-1.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the Gibbs functions for the standard
|
||||
//! state of the species at the current <I>T</I> and <I>P</I> of the solution
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ namespace Cantera {
|
|||
* based on the molality of species proportional to the
|
||||
* molality of the species.
|
||||
*/
|
||||
doublereal DebyeHuckel::standardConcentration(int k) const {
|
||||
doublereal DebyeHuckel::standardConcentration(size_t k) const {
|
||||
double mvSolvent = m_speciesSize[m_indexSolvent];
|
||||
return 1.0 / mvSolvent;
|
||||
}
|
||||
|
|
@ -513,7 +513,7 @@ namespace Cantera {
|
|||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*/
|
||||
doublereal DebyeHuckel::logStandardConc(int k) const {
|
||||
doublereal DebyeHuckel::logStandardConc(size_t k) const {
|
||||
double c_solvent = standardConcentration(k);
|
||||
return log(c_solvent);
|
||||
}
|
||||
|
|
@ -1566,7 +1566,7 @@ namespace Cantera {
|
|||
getMap(ESTNode, msEST);
|
||||
map<std::string,std::string>::const_iterator _b = msEST.begin();
|
||||
for (; _b != msEST.end(); ++_b) {
|
||||
int kk = speciesIndex(_b->first);
|
||||
size_t kk = speciesIndex(_b->first);
|
||||
std::string est = _b->second;
|
||||
if ((m_electrolyteSpeciesType[kk] = interp_est(est)) == -1) {
|
||||
throw CanteraError("DebyeHuckel:initThermoXML",
|
||||
|
|
|
|||
|
|
@ -924,13 +924,13 @@ namespace Cantera {
|
|||
* Returns the standard Concentration in units of
|
||||
* m<SUP>3</SUP> kmol<SUP>-1</SUP>.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Returns the units of the standard and generalized concentrations.
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ namespace Cantera {
|
|||
* the parameterization.
|
||||
*/
|
||||
void GeneralSpeciesThermo::install(std::string name,
|
||||
int index,
|
||||
size_t index,
|
||||
int type,
|
||||
const doublereal* c,
|
||||
doublereal minTemp,
|
||||
|
|
@ -187,13 +187,13 @@ namespace Cantera {
|
|||
throw CanteraError("GeneralSpeciesThermo::install_STIT",
|
||||
"zero pointer");
|
||||
}
|
||||
int index = stit_ptr->speciesIndex();
|
||||
size_t index = stit_ptr->speciesIndex();
|
||||
if (index > m_kk - 1) {
|
||||
m_sp.resize(index+1, 0);
|
||||
m_kk = index+1;
|
||||
}
|
||||
AssertThrow(m_sp[index] == 0,
|
||||
"Index position isn't null, duplication of assignment: " + int2str(index));
|
||||
"Index position isn't null, duplication of assignment: " + int2str(int(index)));
|
||||
/*
|
||||
* Now, simply assign the position
|
||||
*/
|
||||
|
|
@ -211,7 +211,7 @@ namespace Cantera {
|
|||
|
||||
|
||||
|
||||
void GeneralSpeciesThermo::installPDSShandler(int k, PDSS *PDSS_ptr,
|
||||
void GeneralSpeciesThermo::installPDSShandler(size_t k, PDSS *PDSS_ptr,
|
||||
VPSSMgr *vpssmgr_ptr) {
|
||||
STITbyPDSS *stit_ptr = new STITbyPDSS(k, vpssmgr_ptr, PDSS_ptr);
|
||||
install_STIT(stit_ptr);
|
||||
|
|
@ -221,7 +221,7 @@ namespace Cantera {
|
|||
* Update the properties for one species.
|
||||
*/
|
||||
void GeneralSpeciesThermo::
|
||||
update_one(int k, doublereal t, doublereal* cp_R,
|
||||
update_one(size_t k, doublereal t, doublereal* cp_R,
|
||||
doublereal* h_RT, doublereal* s_R) const {
|
||||
SpeciesThermoInterpType * sp_ptr = m_sp[k];
|
||||
if (sp_ptr) {
|
||||
|
|
@ -255,7 +255,7 @@ namespace Cantera {
|
|||
* This utility function reports the type of parameterization
|
||||
* used for the species, index.
|
||||
*/
|
||||
int GeneralSpeciesThermo::reportType(int index) const {
|
||||
int GeneralSpeciesThermo::reportType(size_t index) const {
|
||||
SpeciesThermoInterpType *sp = m_sp[index];
|
||||
if (sp) {
|
||||
return sp->reportType();
|
||||
|
|
@ -270,10 +270,10 @@ namespace Cantera {
|
|||
* For the NASA object, there are 15 coefficients.
|
||||
*/
|
||||
void GeneralSpeciesThermo::
|
||||
reportParams(int index, int &type, doublereal * const c,
|
||||
reportParams(size_t index, int &type, doublereal * const c,
|
||||
doublereal &minTemp, doublereal &maxTemp, doublereal &refPressure) const {
|
||||
SpeciesThermoInterpType *sp = m_sp[index];
|
||||
int n;
|
||||
size_t n;
|
||||
if (sp) {
|
||||
sp->reportParameters(n, type, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
|
|
@ -293,7 +293,7 @@ namespace Cantera {
|
|||
* parameters for the standard state.
|
||||
*/
|
||||
void GeneralSpeciesThermo::
|
||||
modifyParams(int index, doublereal *c) {
|
||||
modifyParams(size_t index, doublereal *c) {
|
||||
SpeciesThermoInterpType *sp = m_sp[index];
|
||||
if (sp) {
|
||||
sp->modifyParameters(c);
|
||||
|
|
@ -308,8 +308,8 @@ namespace Cantera {
|
|||
* are valid. Otherwise, if an integer argument is given, the
|
||||
* value applies only to the species with that index.
|
||||
*/
|
||||
doublereal GeneralSpeciesThermo::minTemp(int k) const {
|
||||
if (k < 0)
|
||||
doublereal GeneralSpeciesThermo::minTemp(size_t k) const {
|
||||
if (k == -1)
|
||||
return m_tlow_max;
|
||||
else {
|
||||
SpeciesThermoInterpType *sp = m_sp[k];
|
||||
|
|
@ -320,8 +320,8 @@ namespace Cantera {
|
|||
return m_tlow_max;
|
||||
}
|
||||
|
||||
doublereal GeneralSpeciesThermo::maxTemp(int k) const {
|
||||
if (k < 0) {
|
||||
doublereal GeneralSpeciesThermo::maxTemp(size_t k) const {
|
||||
if (k == -1) {
|
||||
return m_thigh_min;
|
||||
} else {
|
||||
SpeciesThermoInterpType *sp = m_sp[k];
|
||||
|
|
@ -332,8 +332,8 @@ namespace Cantera {
|
|||
return m_thigh_min;
|
||||
}
|
||||
|
||||
doublereal GeneralSpeciesThermo::refPressure(int k) const {
|
||||
if (k < 0) {
|
||||
doublereal GeneralSpeciesThermo::refPressure(size_t k) const {
|
||||
if (k == -1) {
|
||||
return m_p0;
|
||||
} else {
|
||||
SpeciesThermoInterpType *sp = m_sp[k];
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ namespace Cantera {
|
|||
* @todo Create a factory method for SpeciesThermoInterpType.
|
||||
* That's basically what we are doing here.
|
||||
*/
|
||||
virtual void install(std::string name, int index, int type,
|
||||
virtual void install(std::string name, size_t index, int type,
|
||||
const doublereal* c,
|
||||
doublereal minTemp, doublereal maxTemp,
|
||||
doublereal refPressure);
|
||||
|
|
@ -104,7 +104,7 @@ namespace Cantera {
|
|||
* @param vpssmgr_ptr Pointer to the variable pressure standard state
|
||||
* manager that handles the PDSS object.
|
||||
*/
|
||||
void installPDSShandler(int k, PDSS *PDSS_ptr, VPSSMgr *vpssmgr_ptr);
|
||||
void installPDSShandler(size_t k, PDSS *PDSS_ptr, VPSSMgr *vpssmgr_ptr);
|
||||
|
||||
//! Like update(), but only updates the single species k.
|
||||
/*!
|
||||
|
|
@ -117,7 +117,7 @@ namespace Cantera {
|
|||
* @param s_R Vector of Dimensionless entropies.
|
||||
* (length m_kk).
|
||||
*/
|
||||
virtual void update_one(int k, doublereal T, doublereal* cp_R,
|
||||
virtual void update_one(size_t k, doublereal T, doublereal* cp_R,
|
||||
doublereal* h_RT,
|
||||
doublereal* s_R) const;
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal minTemp(int k=-1) const;
|
||||
virtual doublereal minTemp(size_t k=-1) const;
|
||||
|
||||
//! Maximum temperature.
|
||||
/*!
|
||||
|
|
@ -161,7 +161,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species Index
|
||||
*/
|
||||
virtual doublereal maxTemp(int k=-1) const;
|
||||
virtual doublereal maxTemp(size_t k=-1) const;
|
||||
|
||||
//! The reference-state pressure for species k.
|
||||
/*!
|
||||
|
|
@ -176,7 +176,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species Index
|
||||
*/
|
||||
virtual doublereal refPressure(int k = -1) const;
|
||||
virtual doublereal refPressure(size_t k = -1) const;
|
||||
|
||||
//! This utility function reports the type of parameterization
|
||||
//! used for the species with index number index.
|
||||
|
|
@ -184,7 +184,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param index Species index
|
||||
*/
|
||||
virtual int reportType(int index) const;
|
||||
virtual int reportType(size_t index) const;
|
||||
|
||||
//! This utility function reports back the type of
|
||||
//! parameterization and all of the parameters for the species, index.
|
||||
|
|
@ -197,7 +197,7 @@ namespace Cantera {
|
|||
* @param maxTemp output - Maximum temperature
|
||||
* @param refPressure output - reference pressure (Pa).
|
||||
*/
|
||||
virtual void reportParams(int index, int &type,
|
||||
virtual void reportParams(size_t index, int &type,
|
||||
doublereal * const c,
|
||||
doublereal &minTemp,
|
||||
doublereal &maxTemp,
|
||||
|
|
@ -209,7 +209,7 @@ namespace Cantera {
|
|||
* @param c Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
virtual void modifyParams(int index, doublereal *c);
|
||||
virtual void modifyParams(size_t index, doublereal *c);
|
||||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ namespace Cantera {
|
|||
* Internal variable indicating the length of the
|
||||
* number of species in the phase.
|
||||
*/
|
||||
int m_kk;
|
||||
size_t m_kk;
|
||||
|
||||
|
||||
//! Make the class VPSSMgr a friend because we need to access
|
||||
|
|
|
|||
|
|
@ -191,12 +191,12 @@ namespace Cantera {
|
|||
*/
|
||||
|
||||
|
||||
doublereal GibbsExcessVPSSTP::standardConcentration(int k) const {
|
||||
doublereal GibbsExcessVPSSTP::standardConcentration(size_t k) const {
|
||||
err("standardConcentration");
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
doublereal GibbsExcessVPSSTP::logStandardConc(int k) const {
|
||||
doublereal GibbsExcessVPSSTP::logStandardConc(size_t k) const {
|
||||
err("logStandardConc");
|
||||
return -1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k species index. Defaults to zero.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
/**
|
||||
* Returns the natural logarithm of the standard
|
||||
|
|
@ -243,7 +243,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k species index
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
/**
|
||||
* Returns the units of the standard and generalized
|
||||
|
|
|
|||
|
|
@ -947,7 +947,7 @@ namespace Cantera {
|
|||
* all species concentrations have units of kmol/m3.
|
||||
*
|
||||
*/
|
||||
doublereal HMWSoln::standardConcentration(int k) const {
|
||||
doublereal HMWSoln::standardConcentration(size_t k) const {
|
||||
getStandardVolumes(DATA_PTR(m_tmpV));
|
||||
double mvSolvent = m_tmpV[m_indexSolvent];
|
||||
if (k > 0) {
|
||||
|
|
@ -960,7 +960,7 @@ namespace Cantera {
|
|||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*/
|
||||
doublereal HMWSoln::logStandardConc(int k) const {
|
||||
doublereal HMWSoln::logStandardConc(size_t k) const {
|
||||
double c_solvent = standardConcentration(k);
|
||||
return log(c_solvent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1704,7 +1704,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
|
||||
//! Returns the natural logarithm of the standard
|
||||
|
|
@ -1712,7 +1712,7 @@ namespace Cantera {
|
|||
/*!
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Returns the units of the standard and generalized concentrations.
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ namespace Cantera {
|
|||
* Returns the standard concentration \f$ C^0_k \f$, which is used to normalize
|
||||
* the generalized concentration.
|
||||
*/
|
||||
doublereal IdealGasPhase::standardConcentration(int k) const {
|
||||
doublereal IdealGasPhase::standardConcentration(size_t k) const {
|
||||
double p = pressure();
|
||||
return p/(GasConstant * temperature());
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ namespace Cantera {
|
|||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*/
|
||||
doublereal IdealGasPhase::logStandardConc(int k) const {
|
||||
doublereal IdealGasPhase::logStandardConc(size_t k) const {
|
||||
_updateThermo();
|
||||
double p = pressure();
|
||||
double lc = std::log (p / (GasConstant * temperature()));
|
||||
|
|
|
|||
|
|
@ -548,14 +548,14 @@ namespace Cantera {
|
|||
* @return
|
||||
* Returns the standard Concentration in units of m3 kmol-1.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Returns the natural logarithm of the standard
|
||||
//! concentration of the kth species
|
||||
/*!
|
||||
* @param k index of the species. (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of non-dimensional activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ namespace Cantera {
|
|||
* optional parameter indicating the species.
|
||||
*
|
||||
*/
|
||||
doublereal IdealMolalSoln::standardConcentration(int k) const {
|
||||
doublereal IdealMolalSoln::standardConcentration(size_t k) const {
|
||||
double c0 = 1.0, mvSolvent;
|
||||
switch (m_formGC) {
|
||||
case 0:
|
||||
|
|
@ -441,7 +441,7 @@ namespace Cantera {
|
|||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*/
|
||||
doublereal IdealMolalSoln::logStandardConc(int k) const {
|
||||
doublereal IdealMolalSoln::logStandardConc(size_t k) const {
|
||||
double c0 = standardConcentration(k);
|
||||
return log(c0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
/*!
|
||||
* Returns the natural logarithm of the standard
|
||||
|
|
@ -467,7 +467,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
/*!
|
||||
* Returns the units of the standard and generalized
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ namespace Cantera {
|
|||
* an optional parameter.
|
||||
*/
|
||||
doublereal IdealSolidSolnPhase::
|
||||
standardConcentration(int k) const {
|
||||
standardConcentration(size_t k) const {
|
||||
switch (m_formGC) {
|
||||
case 0:
|
||||
return 1.0;
|
||||
|
|
@ -522,7 +522,7 @@ namespace Cantera {
|
|||
* an optional parameter.
|
||||
*/
|
||||
doublereal IdealSolidSolnPhase::
|
||||
logStandardConc(int k) const {
|
||||
logStandardConc(size_t k) const {
|
||||
_updateThermo();
|
||||
double res;
|
||||
switch (m_formGC) {
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ namespace Cantera {
|
|||
* a change from the ThermoPhase base class, where it was
|
||||
* an optional parameter.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k) const;
|
||||
virtual doublereal standardConcentration(size_t k) const;
|
||||
|
||||
/**
|
||||
* The reference (ie standard) concentration \f$ C^0_k \f$ used to normalize
|
||||
|
|
@ -497,7 +497,7 @@ namespace Cantera {
|
|||
* a change from the ThermoPhase base class, where it was
|
||||
* an optional parameter.
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k) const;
|
||||
virtual doublereal logStandardConc(size_t k) const;
|
||||
|
||||
/**
|
||||
* Returns the units of the standard and general concentrations
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ namespace Cantera {
|
|||
* Returns the standard concentration \f$ C^0_k \f$, which is used to normalize
|
||||
* the generalized concentration.
|
||||
*/
|
||||
doublereal IdealSolnGasVPSS::standardConcentration(int k) const {
|
||||
doublereal IdealSolnGasVPSS::standardConcentration(size_t k) const {
|
||||
if (m_idealGas) {
|
||||
double p = pressure();
|
||||
return p/(GasConstant * temperature());
|
||||
|
|
@ -247,7 +247,7 @@ namespace Cantera {
|
|||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*/
|
||||
doublereal IdealSolnGasVPSS::logStandardConc(int k) const {
|
||||
doublereal IdealSolnGasVPSS::logStandardConc(size_t k) const {
|
||||
double c = standardConcentration(k);
|
||||
double lc = std::log(c);
|
||||
return lc;
|
||||
|
|
|
|||
|
|
@ -185,14 +185,14 @@ namespace Cantera {
|
|||
* @return
|
||||
* Returns the standard Concentration in units of m3 kmol-1.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Returns the natural logarithm of the standard
|
||||
//! concentration of the kth species
|
||||
/*!
|
||||
* @param k index of the species. (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Returns the units of the standard and generalized concentrations.
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ namespace Cantera {
|
|||
getActivities(c);
|
||||
}
|
||||
|
||||
void IonsFromNeutralVPSSTP::getDissociationCoeffs(vector_fp& coeffs,vector_fp& charges, std::vector<int>& neutMolIndex){
|
||||
void IonsFromNeutralVPSSTP::getDissociationCoeffs(vector_fp& coeffs,vector_fp& charges, std::vector<size_t>& neutMolIndex){
|
||||
coeffs = fm_neutralMolec_ions_;
|
||||
charges = m_speciesCharge;
|
||||
neutMolIndex = fm_invert_ionForNeutral;
|
||||
|
|
@ -356,7 +356,7 @@ namespace Cantera {
|
|||
* Returns the standard concentration. The units are by definition
|
||||
* dependent on the ThermoPhase and kinetics manager representation.
|
||||
*/
|
||||
doublereal IonsFromNeutralVPSSTP::standardConcentration(int k) const {
|
||||
doublereal IonsFromNeutralVPSSTP::standardConcentration(size_t k) const {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
|
@ -364,7 +364,7 @@ namespace Cantera {
|
|||
/*
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
doublereal IonsFromNeutralVPSSTP::logStandardConc(int k) const {
|
||||
doublereal IonsFromNeutralVPSSTP::logStandardConc(size_t k) const {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
|
@ -445,7 +445,7 @@ namespace Cantera {
|
|||
*/
|
||||
void
|
||||
IonsFromNeutralVPSSTP::getChemPotentials(doublereal* mu) const {
|
||||
int k, icat, jNeut;
|
||||
size_t icat, jNeut;
|
||||
doublereal xx, fact2;
|
||||
/*
|
||||
* Transfer the mole fractions to the slave neutral molecule
|
||||
|
|
@ -472,7 +472,7 @@ namespace Cantera {
|
|||
fact2 = 2.0 * RT_ * log(2.0);
|
||||
|
||||
// Do the cation list
|
||||
for (k = 0; k < (int) cationList_.size(); k++) {
|
||||
for (size_t k = 0; k < cationList_.size(); k++) {
|
||||
//! Get the id for the next cation
|
||||
icat = cationList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
|
|
@ -487,7 +487,7 @@ namespace Cantera {
|
|||
mu[icat] = RT_ * log(xx);
|
||||
|
||||
// Do the list of neutral molecules
|
||||
for (k = 0; k < numPassThroughSpecies_; k++) {
|
||||
for (size_t k = 0; k < numPassThroughSpecies_; k++) {
|
||||
icat = passThroughList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
xx = fmaxx(SmallNumber, moleFractions_[icat]);
|
||||
|
|
@ -735,14 +735,14 @@ namespace Cantera {
|
|||
* is dumped into the anion mole number to fix the imbalance.
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const {
|
||||
int k, icat, jNeut;
|
||||
size_t icat, jNeut;
|
||||
doublereal sumCat;
|
||||
doublereal sumAnion;
|
||||
doublereal fmij;
|
||||
doublereal sum = 0.0;
|
||||
|
||||
//! Zero the vector we are trying to find.
|
||||
for (k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
NeutralMolecMoleFractions_[k] = 0.0;
|
||||
}
|
||||
#ifdef DEBUG_MODE
|
||||
|
|
@ -762,7 +762,7 @@ namespace Cantera {
|
|||
|
||||
case cIonSolnType_PASSTHROUGH:
|
||||
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
NeutralMolecMoleFractions_[k] = moleFractions_[k];
|
||||
}
|
||||
break;
|
||||
|
|
@ -771,11 +771,11 @@ namespace Cantera {
|
|||
|
||||
sumCat = 0.0;
|
||||
sumAnion = 0.0;
|
||||
for (k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
NeutralMolecMoleFractions_[k] = 0.0;
|
||||
}
|
||||
|
||||
for (k = 0; k < (int) cationList_.size(); k++) {
|
||||
for (size_t k = 0; k < cationList_.size(); k++) {
|
||||
//! Get the id for the next cation
|
||||
icat = cationList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
|
|
@ -786,7 +786,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
for (k = 0; k < numPassThroughSpecies_; k++) {
|
||||
for (size_t k = 0; k < numPassThroughSpecies_; k++) {
|
||||
icat = passThroughList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
fmij = fm_neutralMolec_ions_[ icat + jNeut * m_kk];
|
||||
|
|
@ -794,16 +794,16 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
moleFractionsTmp_[k] = moleFractions_[k];
|
||||
}
|
||||
for (jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) {
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
fmij = fm_neutralMolec_ions_[k + jNeut * m_kk];
|
||||
moleFractionsTmp_[k] -= fmij * NeutralMolecMoleFractions_[jNeut];
|
||||
}
|
||||
}
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
if (fabs(moleFractionsTmp_[k]) > 1.0E-13) {
|
||||
//! Check to see if we have in fact found the inverse.
|
||||
if (anionList_[0] != k) {
|
||||
|
|
@ -820,10 +820,10 @@ namespace Cantera {
|
|||
|
||||
// Normalize the Neutral Molecule mole fractions
|
||||
sum = 0.0;
|
||||
for (k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
sum += NeutralMolecMoleFractions_[k];
|
||||
}
|
||||
for (k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
NeutralMolecMoleFractions_[k] /= sum;
|
||||
}
|
||||
|
||||
|
|
@ -863,7 +863,7 @@ namespace Cantera {
|
|||
* is dumped into the anion mole number to fix the imbalance.
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(const doublereal * const dx, doublereal *dy) const {
|
||||
int k, icat, jNeut;
|
||||
size_t icat, jNeut;
|
||||
doublereal sumCat;
|
||||
doublereal sumAnion;
|
||||
doublereal fmij;
|
||||
|
|
@ -874,7 +874,7 @@ namespace Cantera {
|
|||
//check sum dx = 0
|
||||
|
||||
//! Zero the vector we are trying to find.
|
||||
for (k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
dy[k] = 0.0;
|
||||
}
|
||||
|
||||
|
|
@ -885,7 +885,7 @@ namespace Cantera {
|
|||
|
||||
case cIonSolnType_PASSTHROUGH:
|
||||
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
dy[k] = dx[k];
|
||||
}
|
||||
break;
|
||||
|
|
@ -895,7 +895,7 @@ namespace Cantera {
|
|||
sumCat = 0.0;
|
||||
sumAnion = 0.0;
|
||||
|
||||
for (k = 0; k < (int) cationList_.size(); k++) {
|
||||
for (size_t k = 0; k < (int) cationList_.size(); k++) {
|
||||
//! Get the id for the next cation
|
||||
icat = cationList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
|
|
@ -907,7 +907,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
for (k = 0; k < numPassThroughSpecies_; k++) {
|
||||
for (size_t k = 0; k < numPassThroughSpecies_; k++) {
|
||||
icat = passThroughList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
fmij = fm_neutralMolec_ions_[ icat + jNeut * m_kk];
|
||||
|
|
@ -916,16 +916,16 @@ namespace Cantera {
|
|||
}
|
||||
#ifdef DEBUG_MODE_NOT
|
||||
//check dy sum to zero
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
moleFractionsTmp_[k] = dx[k];
|
||||
}
|
||||
for (jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) {
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
fmij = fm_neutralMolec_ions_[k + jNeut * m_kk];
|
||||
moleFractionsTmp_[k] -= fmij * dy[jNeut];
|
||||
}
|
||||
}
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
if (fabs(moleFractionsTmp_[k]) > 1.0E-13) {
|
||||
//! Check to see if we have in fact found the inverse.
|
||||
if (anionList_[0] != k) {
|
||||
|
|
@ -942,11 +942,11 @@ namespace Cantera {
|
|||
// Normalize the Neutral Molecule mole fractions
|
||||
sumy = 0.0;
|
||||
sumdy = 0.0;
|
||||
for (k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
sumy += y[k];
|
||||
sumdy += dy[k];
|
||||
}
|
||||
for (k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
for (size_t k = 0; k < numNeutralMoleculeSpecies_; k++) {
|
||||
dy[k] = dy[k]/sumy - y[k]*sumdy/sumy/sumy;
|
||||
}
|
||||
|
||||
|
|
@ -1193,17 +1193,17 @@ namespace Cantera {
|
|||
|
||||
static double factorOverlap(const std::vector<std::string>& elnamesVN ,
|
||||
const std::vector<double>& elemVectorN,
|
||||
const int nElementsN,
|
||||
const size_t nElementsN,
|
||||
const std::vector<std::string>& elnamesVI ,
|
||||
const std::vector<double>& elemVectorI,
|
||||
const int nElementsI)
|
||||
const size_t nElementsI)
|
||||
{
|
||||
double fMax = 1.0E100;
|
||||
for (int mi = 0; mi < nElementsI; mi++) {
|
||||
for (size_t mi = 0; mi < nElementsI; mi++) {
|
||||
if (elnamesVI[mi] != "E") {
|
||||
if (elemVectorI[mi] > 1.0E-13) {
|
||||
double eiNum = elemVectorI[mi];
|
||||
for (int mn = 0; mn < nElementsN; mn++) {
|
||||
for (size_t mn = 0; mn < nElementsN; mn++) {
|
||||
if (elnamesVI[mi] == elnamesVN[mn]) {
|
||||
if (elemVectorN[mn] <= 1.0E-13) {
|
||||
return 0.0;
|
||||
|
|
@ -1294,28 +1294,28 @@ namespace Cantera {
|
|||
std::vector<double> elemVectorI(nElementsI);
|
||||
|
||||
vector<doublereal> fm_tmp(m_kk);
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
fm_invert_ionForNeutral[k] = -1;
|
||||
}
|
||||
/* for (int jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) {
|
||||
fm_invert_ionForNeutral[jNeut] = -1;
|
||||
}*/
|
||||
for (int jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) {
|
||||
for (int m = 0; m < nElementsN; m++) {
|
||||
for (size_t jNeut = 0; jNeut < numNeutralMoleculeSpecies_; jNeut++) {
|
||||
for (size_t m = 0; m < nElementsN; m++) {
|
||||
elemVectorN[m] = neutralMoleculePhase_->nAtoms(jNeut, m);
|
||||
}
|
||||
elemVectorN_orig = elemVectorN;
|
||||
fvo_zero_dbl_1(fm_tmp, m_kk);
|
||||
|
||||
for (int m = 0; m < nElementsI; m++) {
|
||||
for (size_t m = 0; m < nElementsI; m++) {
|
||||
elemVectorI[m] = nAtoms(indexSpecialSpecies_, m);
|
||||
}
|
||||
double fac = factorOverlap(elnamesVN, elemVectorN, nElementsN,
|
||||
elnamesVI ,elemVectorI, nElementsI);
|
||||
if (fac > 0.0) {
|
||||
for (int m = 0; m < nElementsN; m++) {
|
||||
for (size_t m = 0; m < nElementsN; m++) {
|
||||
std::string mName = elnamesVN[m];
|
||||
for (int mi = 0; mi < nElementsI; mi++) {
|
||||
for (size_t mi = 0; mi < nElementsI; mi++) {
|
||||
std::string eName = elnamesVI[mi];
|
||||
if (mName == eName) {
|
||||
elemVectorN[m] -= fac * elemVectorI[mi];
|
||||
|
|
@ -1328,15 +1328,15 @@ namespace Cantera {
|
|||
|
||||
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
for (int m = 0; m < nElementsI; m++) {
|
||||
for (size_t m = 0; m < nElementsI; m++) {
|
||||
elemVectorI[m] = nAtoms(k, m);
|
||||
}
|
||||
double fac = factorOverlap(elnamesVN, elemVectorN, nElementsN,
|
||||
elnamesVI ,elemVectorI, nElementsI);
|
||||
if (fac > 0.0) {
|
||||
for (int m = 0; m < nElementsN; m++) {
|
||||
for (size_t m = 0; m < nElementsN; m++) {
|
||||
std::string mName = elnamesVN[m];
|
||||
for (int mi = 0; mi < nElementsI; mi++) {
|
||||
for (size_t mi = 0; mi < nElementsI; mi++) {
|
||||
std::string eName = elnamesVI[mi];
|
||||
if (mName == eName) {
|
||||
elemVectorN[m] -= fac * elemVectorI[mi];
|
||||
|
|
@ -1345,7 +1345,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
bool notTaken = true;
|
||||
for (int iNeut = 0; iNeut < jNeut; iNeut++) {
|
||||
for (size_t iNeut = 0; iNeut < jNeut; iNeut++) {
|
||||
if (fm_invert_ionForNeutral[k] == iNeut) {
|
||||
notTaken = false;
|
||||
}
|
||||
|
|
@ -1362,7 +1362,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
// Ok check the work
|
||||
for (int m = 0; m < nElementsN; m++) {
|
||||
for (size_t m = 0; m < nElementsN; m++) {
|
||||
if (fabs(elemVectorN[m]) > 1.0E-13) {
|
||||
throw CanteraError("IonsFromNeutralVPSSTP::initThermoXML",
|
||||
"Simple formula matrix generation failed");
|
||||
|
|
@ -1390,7 +1390,7 @@ namespace Cantera {
|
|||
* he = X_A X_B(B + C(X_A - X_B))
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::s_update_lnActCoeff() const {
|
||||
int k, icat, jNeut;
|
||||
size_t icat, jNeut;
|
||||
doublereal fmij;
|
||||
/*
|
||||
* Get the activity coefficiens of the neutral molecules
|
||||
|
|
@ -1403,7 +1403,7 @@ namespace Cantera {
|
|||
case cIonSolnType_SINGLEANION:
|
||||
|
||||
// Do the cation list
|
||||
for (k = 0; k < (int) cationList_.size(); k++) {
|
||||
for (size_t k = 0; k < cationList_.size(); k++) {
|
||||
//! Get the id for the next cation
|
||||
icat = cationList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
|
|
@ -1417,7 +1417,7 @@ namespace Cantera {
|
|||
lnActCoeff_Scaled_[icat]= 0.0;
|
||||
|
||||
// Do the list of neutral molecules
|
||||
for (k = 0; k < numPassThroughSpecies_; k++) {
|
||||
for (size_t k = 0; k < numPassThroughSpecies_; k++) {
|
||||
icat = passThroughList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
lnActCoeff_Scaled_[icat] = log(gammaNeutralMolecule_[jNeut]);
|
||||
|
|
@ -1442,14 +1442,14 @@ namespace Cantera {
|
|||
// get the gradient in the activity coefficients
|
||||
|
||||
void IonsFromNeutralVPSSTP::getdlnActCoeff(const doublereal dT, const doublereal * const dX, doublereal *dlnActCoeff) const {
|
||||
int k, icat, jNeut;
|
||||
size_t icat, jNeut;
|
||||
doublereal fmij;
|
||||
/*
|
||||
* Get the activity coefficients of the neutral molecules
|
||||
*/
|
||||
GibbsExcessVPSSTP *geThermo = dynamic_cast<GibbsExcessVPSSTP *>(neutralMoleculePhase_);
|
||||
if (!geThermo) {
|
||||
for ( k = 0; k < m_kk; k++ ){
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
dlnActCoeff[k] = dX[k]/moleFractions_[k];
|
||||
}
|
||||
return;
|
||||
|
|
@ -1472,7 +1472,7 @@ namespace Cantera {
|
|||
case cIonSolnType_SINGLEANION:
|
||||
|
||||
// Do the cation list
|
||||
for (k = 0; k < (int) cationList_.size(); k++) {
|
||||
for (size_t k = 0; k < cationList_.size(); k++) {
|
||||
//! Get the id for the next cation
|
||||
icat = cationList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
|
|
@ -1486,7 +1486,7 @@ namespace Cantera {
|
|||
dlnActCoeff[icat]= 0.0;
|
||||
|
||||
// Do the list of neutral molecules
|
||||
for (k = 0; k < numPassThroughSpecies_; k++) {
|
||||
for (size_t k = 0; k < numPassThroughSpecies_; k++) {
|
||||
icat = passThroughList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
dlnActCoeff[icat] = dlnActCoeff_NeutralMolecule[jNeut];
|
||||
|
|
@ -1512,7 +1512,7 @@ namespace Cantera {
|
|||
* temperature derivative of the natural logarithm of the activity coefficients
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT() const {
|
||||
int k, icat, jNeut;
|
||||
size_t icat, jNeut;
|
||||
doublereal fmij;
|
||||
/*
|
||||
* Get the activity coefficients of the neutral molecules
|
||||
|
|
@ -1531,7 +1531,7 @@ namespace Cantera {
|
|||
case cIonSolnType_SINGLEANION:
|
||||
|
||||
// Do the cation list
|
||||
for (k = 0; k < (int) cationList_.size(); k++) {
|
||||
for (size_t k = 0; k < cationList_.size(); k++) {
|
||||
//! Get the id for the next cation
|
||||
icat = cationList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
|
|
@ -1545,7 +1545,7 @@ namespace Cantera {
|
|||
dlnActCoeffdT_Scaled_[icat]= 0.0;
|
||||
|
||||
// Do the list of neutral molecules
|
||||
for (k = 0; k < numPassThroughSpecies_; k++) {
|
||||
for (size_t k = 0; k < numPassThroughSpecies_; k++) {
|
||||
icat = passThroughList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
dlnActCoeffdT_Scaled_[icat] = dlnActCoeffdT_NeutralMolecule_[jNeut];
|
||||
|
|
@ -1570,7 +1570,7 @@ namespace Cantera {
|
|||
* temperature derivative of the natural logarithm of the activity coefficients
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX() const {
|
||||
int k, icat, jNeut;
|
||||
size_t icat, jNeut;
|
||||
doublereal fmij;
|
||||
/*
|
||||
* Get the activity coefficients of the neutral molecules
|
||||
|
|
@ -1589,7 +1589,7 @@ namespace Cantera {
|
|||
case cIonSolnType_SINGLEANION:
|
||||
|
||||
// Do the cation list
|
||||
for (k = 0; k < (int) cationList_.size(); k++) {
|
||||
for (size_t k = 0; k < cationList_.size(); k++) {
|
||||
//! Get the id for the next cation
|
||||
icat = cationList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
|
|
@ -1603,7 +1603,7 @@ namespace Cantera {
|
|||
dlnActCoeffdlnX_Scaled_[icat]= 0.0;
|
||||
|
||||
// Do the list of neutral molecules
|
||||
for (k = 0; k < numPassThroughSpecies_; k++) {
|
||||
for (size_t k = 0; k < numPassThroughSpecies_; k++) {
|
||||
icat = passThroughList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
dlnActCoeffdlnX_Scaled_[icat] = dlnActCoeffdlnX_NeutralMolecule_[jNeut];
|
||||
|
|
@ -1628,7 +1628,7 @@ namespace Cantera {
|
|||
* temperature derivative of the natural logarithm of the activity coefficients
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const {
|
||||
int k, icat, jNeut;
|
||||
size_t icat, jNeut;
|
||||
doublereal fmij;
|
||||
/*
|
||||
* Get the activity coefficients of the neutral molecules
|
||||
|
|
@ -1647,7 +1647,7 @@ namespace Cantera {
|
|||
case cIonSolnType_SINGLEANION:
|
||||
|
||||
// Do the cation list
|
||||
for (k = 0; k < (int) cationList_.size(); k++) {
|
||||
for (size_t k = 0; k < cationList_.size(); k++) {
|
||||
//! Get the id for the next cation
|
||||
icat = cationList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
|
|
@ -1661,7 +1661,7 @@ namespace Cantera {
|
|||
dlnActCoeffdlnN_Scaled_[icat]= 0.0;
|
||||
|
||||
// Do the list of neutral molecules
|
||||
for (k = 0; k < numPassThroughSpecies_; k++) {
|
||||
for (size_t k = 0; k < numPassThroughSpecies_; k++) {
|
||||
icat = passThroughList_[k];
|
||||
jNeut = fm_invert_ionForNeutral[icat];
|
||||
dlnActCoeffdlnN_Scaled_[icat] = dlnActCoeffdlnN_NeutralMolecule_[jNeut];
|
||||
|
|
|
|||
|
|
@ -302,14 +302,14 @@ namespace Cantera {
|
|||
* Returns the standard concentration. The units are by definition
|
||||
* dependent on the ThermoPhase and kinetics manager representation.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Returns the units of the standard and generalized concentrations.
|
||||
/*!
|
||||
|
|
@ -459,7 +459,7 @@ namespace Cantera {
|
|||
|
||||
//! Get the Salt Dissociation Coefficients
|
||||
//! Returns the vector of dissociation coefficients and vector of charges
|
||||
virtual void getDissociationCoeffs(vector_fp& coeffs, vector_fp& charges, std::vector<int>& neutMolIndex);
|
||||
virtual void getDissociationCoeffs(vector_fp& coeffs, vector_fp& charges, std::vector<size_t>& neutMolIndex);
|
||||
|
||||
virtual void getNeutralMolecMoleFractions(vector_fp& fracs){fracs=NeutralMolecMoleFractions_;}
|
||||
|
||||
|
|
@ -479,8 +479,8 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void getNeutralMoleculeMoleGrads(const doublereal * const x, doublereal *y) const;
|
||||
|
||||
virtual void getCationList(std::vector<int>& cation){cation=cationList_;}
|
||||
virtual void getAnionList(std::vector<int>& anion){anion=anionList_;}
|
||||
virtual void getCationList(std::vector<size_t>& cation){cation=cationList_;}
|
||||
virtual void getAnionList(std::vector<size_t>& anion){anion=anionList_;}
|
||||
virtual void getSpeciesNames(std::vector<std::string>& names){names=m_speciesNames;}
|
||||
|
||||
|
||||
|
|
@ -827,20 +827,20 @@ namespace Cantera {
|
|||
* then we need to do a formal inversion which takes a great
|
||||
* deal of time and is not currently implemented.
|
||||
*/
|
||||
std::vector<int> fm_invert_ionForNeutral;
|
||||
std::vector<size_t> fm_invert_ionForNeutral;
|
||||
|
||||
//! Mole fractions using the Neutral Molecule Mole fraction basis
|
||||
mutable std::vector<doublereal> NeutralMolecMoleFractions_;
|
||||
|
||||
|
||||
//! List of the species in this ThermoPhase which are cation species
|
||||
std::vector<int> cationList_;
|
||||
std::vector<size_t> cationList_;
|
||||
|
||||
//! Number of cation species
|
||||
int numCationSpecies_;
|
||||
|
||||
//! List of the species in this ThermoPhase which are anion species
|
||||
std::vector<int> anionList_;
|
||||
std::vector<size_t> anionList_;
|
||||
|
||||
//! Number of anion species
|
||||
int numAnionSpecies_;
|
||||
|
|
@ -850,7 +850,7 @@ namespace Cantera {
|
|||
/*!
|
||||
* These have neutral charges.
|
||||
*/
|
||||
std::vector<int> passThroughList_;
|
||||
std::vector<size_t> passThroughList_;
|
||||
|
||||
//! Number of the species in this ThermoPhase which are passed
|
||||
//! through to the neutralMoleculePhase ThermoPhase
|
||||
|
|
|
|||
|
|
@ -125,11 +125,11 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
doublereal LatticePhase::standardConcentration(int k) const {
|
||||
doublereal LatticePhase::standardConcentration(size_t k) const {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
doublereal LatticePhase::logStandardConc(int k) const {
|
||||
doublereal LatticePhase::logStandardConc(size_t k) const {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -470,14 +470,14 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Returns the natural logarithm of the standard
|
||||
//! concentration of the kth species
|
||||
/*!
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of non-dimensional activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
|
|
|
|||
|
|
@ -137,11 +137,11 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
doublereal LatticeSolidPhase::standardConcentration(int k) const {
|
||||
doublereal LatticeSolidPhase::standardConcentration(size_t k) const {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
doublereal LatticeSolidPhase::logStandardConc(int k) const {
|
||||
doublereal LatticeSolidPhase::logStandardConc(size_t k) const {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,8 +112,8 @@ namespace Cantera {
|
|||
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
virtual void getStandardChemPotentials(doublereal* mu0) const;
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
virtual void initThermo();
|
||||
|
||||
|
|
@ -140,8 +140,8 @@ namespace Cantera {
|
|||
|
||||
protected:
|
||||
|
||||
int m_mm;
|
||||
int m_kk;
|
||||
size_t m_mm;
|
||||
size_t m_kk;
|
||||
mutable doublereal m_tlast;
|
||||
doublereal m_press;
|
||||
doublereal m_molar_density;
|
||||
|
|
|
|||
|
|
@ -335,12 +335,12 @@ namespace Cantera {
|
|||
*/
|
||||
|
||||
|
||||
doublereal MargulesVPSSTP::standardConcentration(int k) const {
|
||||
doublereal MargulesVPSSTP::standardConcentration(size_t k) const {
|
||||
err("standardConcentration");
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
doublereal MargulesVPSSTP::logStandardConc(int k) const {
|
||||
doublereal MargulesVPSSTP::logStandardConc(size_t k) const {
|
||||
err("logStandardConc");
|
||||
return -1.0;
|
||||
}
|
||||
|
|
@ -498,7 +498,7 @@ namespace Cantera {
|
|||
*/
|
||||
void MargulesVPSSTP::getPartialMolarVolumes(doublereal* vbar) const {
|
||||
|
||||
int iA, iB, iK, delAK, delBK;
|
||||
size_t iA, iB, iK, delAK, delBK;
|
||||
double XA, XB, XK, g0 , g1;
|
||||
double T = temperature();
|
||||
|
||||
|
|
@ -514,7 +514,7 @@ namespace Cantera {
|
|||
delAK = 0;
|
||||
delBK = 0;
|
||||
XK = moleFractions_[iK];
|
||||
for (int i = 0; i < numBinaryInteractions_; i++) {
|
||||
for (size_t i = 0; i < numBinaryInteractions_; i++) {
|
||||
|
||||
iA = m_pSpecies_A_ij[i];
|
||||
iB = m_pSpecies_B_ij[i];
|
||||
|
|
@ -651,7 +651,7 @@ namespace Cantera {
|
|||
* he = X_A X_B(B + C X_B)
|
||||
*/
|
||||
void MargulesVPSSTP::s_update_lnActCoeff() const {
|
||||
int iA, iB, iK, delAK, delBK;
|
||||
size_t iA, iB, iK, delAK, delBK;
|
||||
double XA, XB, XK, g0 , g1;
|
||||
double T = temperature();
|
||||
double RT = GasConstant*T;
|
||||
|
|
@ -662,7 +662,7 @@ namespace Cantera {
|
|||
|
||||
XK = moleFractions_[iK];
|
||||
|
||||
for (int i = 0; i < numBinaryInteractions_; i++) {
|
||||
for (size_t i = 0; i < numBinaryInteractions_; i++) {
|
||||
|
||||
iA = m_pSpecies_A_ij[i];
|
||||
iB = m_pSpecies_B_ij[i];
|
||||
|
|
@ -721,7 +721,7 @@ namespace Cantera {
|
|||
* he = X_A X_B(B + C X_B)
|
||||
*/
|
||||
void MargulesVPSSTP::s_update_dlnActCoeff_dT() const {
|
||||
int iA, iB, iK, delAK, delBK;
|
||||
size_t iA, iB, iK, delAK, delBK;
|
||||
double XA, XB, XK, g0 , g1;
|
||||
double T = temperature();
|
||||
double RTT = GasConstant*T*T;
|
||||
|
|
@ -732,7 +732,7 @@ namespace Cantera {
|
|||
|
||||
XK = moleFractions_[iK];
|
||||
|
||||
for (int i = 0; i < numBinaryInteractions_; i++) {
|
||||
for (size_t i = 0; i < numBinaryInteractions_; i++) {
|
||||
|
||||
iA = m_pSpecies_A_ij[i];
|
||||
iB = m_pSpecies_B_ij[i];
|
||||
|
|
@ -795,7 +795,7 @@ namespace Cantera {
|
|||
* he = X_A X_B(B + C X_B)
|
||||
*/
|
||||
void MargulesVPSSTP::getdlnActCoeff(const doublereal dT, const doublereal * const dX, doublereal* dlnActCoeff) const {
|
||||
int iA, iB, iK, delAK, delBK;
|
||||
size_t iA, iB, iK, delAK, delBK;
|
||||
double XA, XB, XK, g0 , g1, dXA, dXB;
|
||||
double T = temperature();
|
||||
double RT = GasConstant*T;
|
||||
|
|
@ -808,7 +808,7 @@ namespace Cantera {
|
|||
XK = moleFractions_[iK];
|
||||
dlnActCoeff[iK] = 0.0;
|
||||
|
||||
for (int i = 0; i < numBinaryInteractions_; i++) {
|
||||
for (size_t i = 0; i < numBinaryInteractions_; i++) {
|
||||
|
||||
iA = m_pSpecies_A_ij[i];
|
||||
iB = m_pSpecies_B_ij[i];
|
||||
|
|
@ -842,7 +842,7 @@ namespace Cantera {
|
|||
* he = X_A X_B(B + C X_B)
|
||||
*/
|
||||
void MargulesVPSSTP::s_update_dlnActCoeff_dlnN() const {
|
||||
int iA, iB, iK, delAK, delBK;
|
||||
size_t iA, iB, iK, delAK, delBK;
|
||||
double XA, XB, XK, g0 , g1;
|
||||
double T = temperature();
|
||||
double RT = GasConstant*T;
|
||||
|
|
@ -853,7 +853,7 @@ namespace Cantera {
|
|||
|
||||
XK = moleFractions_[iK];
|
||||
|
||||
for (int i = 0; i < numBinaryInteractions_; i++) {
|
||||
for (size_t i = 0; i < numBinaryInteractions_; i++) {
|
||||
|
||||
iA = m_pSpecies_A_ij[i];
|
||||
iB = m_pSpecies_B_ij[i];
|
||||
|
|
@ -877,18 +877,15 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void MargulesVPSSTP::s_update_dlnActCoeff_dlnX() const {
|
||||
|
||||
int iA, iB;
|
||||
size_t iA, iB;
|
||||
doublereal XA, XB, g0 , g1;
|
||||
doublereal T = temperature();
|
||||
|
||||
fvo_zero_dbl_1(dlnActCoeffdlnX_Scaled_, m_kk);
|
||||
|
||||
doublereal RT = GasConstant * T;
|
||||
|
||||
|
||||
for (int i = 0; i < numBinaryInteractions_; i++) {
|
||||
|
||||
|
||||
for (size_t i = 0; i < numBinaryInteractions_; i++) {
|
||||
iA = m_pSpecies_A_ij[i];
|
||||
iB = m_pSpecies_B_ij[i];
|
||||
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k species index. Defaults to zero.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
/**
|
||||
* Returns the natural logarithm of the standard
|
||||
|
|
@ -496,7 +496,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k species index
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of non-dimensional molar-based activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
|
|
|
|||
|
|
@ -60,35 +60,30 @@ namespace Cantera {
|
|||
virtual doublereal pressure() const { return m_press; }
|
||||
|
||||
virtual void getChemPotentials(doublereal* mu) const {
|
||||
int n, nsp = nSpecies();
|
||||
for (n = 0; n < nsp; n++) mu[n] = 0.0;
|
||||
for (size_t n = 0; n < nSpecies(); n++) mu[n] = 0.0;
|
||||
}
|
||||
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const {
|
||||
int n, nsp = nSpecies();
|
||||
for (n = 0; n < nsp; n++) hrt[n] = 0.0;
|
||||
for (size_t n = 0; n < nSpecies(); n++) hrt[n] = 0.0;
|
||||
}
|
||||
|
||||
virtual void getEntropy_R(doublereal* sr) const {
|
||||
int n, nsp = nSpecies();
|
||||
for (n = 0; n < nsp; n++) sr[n] = 0.0;
|
||||
for (size_t n = 0; n < nSpecies(); n++) sr[n] = 0.0;
|
||||
}
|
||||
|
||||
virtual void getStandardChemPotentials(doublereal* mu0) const {
|
||||
int n, nsp = nSpecies();
|
||||
for (n = 0; n < nsp; n++) mu0[n] = 0.0;
|
||||
for (size_t n = 0; n < nSpecies(); n++) mu0[n] = 0.0;
|
||||
}
|
||||
|
||||
virtual void getActivityConcentrations(doublereal* c) const {
|
||||
int n, nsp = nSpecies();
|
||||
for (n = 0; n < nsp; n++) c[n] = 1.0;
|
||||
for (size_t n = 0; n < nSpecies(); n++) c[n] = 1.0;
|
||||
}
|
||||
|
||||
virtual doublereal standardConcentration(int k=0) const {
|
||||
virtual doublereal standardConcentration(size_t k=0) const {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
virtual doublereal logStandardConc(int k=0) const {
|
||||
virtual doublereal logStandardConc(size_t k=0) const {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ namespace Cantera {
|
|||
* by which the generalized concentration is normalized to produce
|
||||
* the activity.
|
||||
*/
|
||||
doublereal MetalSHEelectrons::standardConcentration(int k) const {
|
||||
doublereal MetalSHEelectrons::standardConcentration(size_t k) const {
|
||||
return 1.0;
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
|
@ -249,7 +249,7 @@ namespace Cantera {
|
|||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*/
|
||||
doublereal MetalSHEelectrons::logStandardConc(int k) const {
|
||||
doublereal MetalSHEelectrons::logStandardConc(size_t k) const {
|
||||
return 0.0;
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
|
|
|||
|
|
@ -336,13 +336,13 @@ namespace Cantera {
|
|||
* @return
|
||||
* Returns The standard Concentration as 1.0
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ namespace Cantera {
|
|||
* by which the generalized concentration is normalized to produce
|
||||
* the activity.
|
||||
*/
|
||||
doublereal MineralEQ3::standardConcentration(int k) const {
|
||||
doublereal MineralEQ3::standardConcentration(size_t k) const {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ namespace Cantera {
|
|||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*/
|
||||
doublereal MineralEQ3::logStandardConc(int k) const {
|
||||
doublereal MineralEQ3::logStandardConc(size_t k) const {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -311,13 +311,13 @@ namespace Cantera {
|
|||
* @return
|
||||
* Returns The standard Concentration as 1.0
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ namespace Cantera {
|
|||
* preserved.
|
||||
*/
|
||||
void MolalityVPSSTP::setMolalitiesByName(compositionMap& mMap) {
|
||||
int kk = nSpecies();
|
||||
size_t kk = nSpecies();
|
||||
doublereal x;
|
||||
/*
|
||||
* Get a vector of mole fractions
|
||||
|
|
@ -428,12 +428,12 @@ namespace Cantera {
|
|||
err("getActivityConcentrations");
|
||||
}
|
||||
|
||||
doublereal MolalityVPSSTP::standardConcentration(int k) const {
|
||||
doublereal MolalityVPSSTP::standardConcentration(size_t k) const {
|
||||
err("standardConcentration");
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
doublereal MolalityVPSSTP::logStandardConc(int k) const {
|
||||
doublereal MolalityVPSSTP::logStandardConc(size_t k) const {
|
||||
err("logStandardConc");
|
||||
return -1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k species index. Defaults to zero.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
/**
|
||||
* Returns the natural logarithm of the standard
|
||||
|
|
@ -485,7 +485,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k species index
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
/**
|
||||
* Returns the units of the standard and generalized
|
||||
|
|
@ -873,7 +873,7 @@ namespace Cantera {
|
|||
* law. This is the indentity of the Cl- species for the PHSCALE_NBS
|
||||
* scaling
|
||||
*/
|
||||
int m_indexCLM;
|
||||
size_t m_indexCLM;
|
||||
|
||||
//! Molecular weight of the Solvent
|
||||
doublereal m_weightSolvent;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace Cantera {
|
|||
* 7 = mu3 (J/kmol)
|
||||
* ........
|
||||
*/
|
||||
Mu0Poly::Mu0Poly(int n, doublereal tlow, doublereal thigh,
|
||||
Mu0Poly::Mu0Poly(size_t n, doublereal tlow, doublereal thigh,
|
||||
doublereal pref,
|
||||
const doublereal* coeffs) :
|
||||
m_numIntervals(0),
|
||||
|
|
@ -153,7 +153,7 @@ namespace Cantera {
|
|||
*
|
||||
*
|
||||
*/
|
||||
void Mu0Poly::reportParameters(int &n, int &type,
|
||||
void Mu0Poly::reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const {
|
||||
|
|
@ -182,7 +182,7 @@ namespace Cantera {
|
|||
* getting the information from an XML database.
|
||||
*/
|
||||
void installMu0ThermoFromXML(std::string speciesName,
|
||||
SpeciesThermo& sp, int k,
|
||||
SpeciesThermo& sp, size_t k,
|
||||
const XML_Node* Mu0Node_ptr) {
|
||||
|
||||
doublereal tmin, tmax;
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ namespace Cantera {
|
|||
* - ........
|
||||
* .
|
||||
*/
|
||||
Mu0Poly(int n, doublereal tlow, doublereal thigh,
|
||||
Mu0Poly(size_t n, doublereal tlow, doublereal thigh,
|
||||
doublereal pref, const doublereal* coeffs);
|
||||
|
||||
//! Copy constructor
|
||||
|
|
@ -132,7 +132,7 @@ namespace Cantera {
|
|||
virtual int reportType() const { return MU0_INTERP; }
|
||||
|
||||
//! Returns an integer representing the species index
|
||||
virtual int speciesIndex() const { return m_index; }
|
||||
virtual size_t speciesIndex() const { return m_index; }
|
||||
|
||||
//! Update the properties for this species, given a temperature polynomial
|
||||
/*!
|
||||
|
|
@ -192,7 +192,7 @@ namespace Cantera {
|
|||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
virtual void reportParameters(int &n, int &type,
|
||||
virtual void reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const;
|
||||
|
|
@ -249,7 +249,7 @@ namespace Cantera {
|
|||
doublereal m_Pref;
|
||||
|
||||
//! Species index
|
||||
int m_index;
|
||||
size_t m_index;
|
||||
|
||||
private:
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ namespace Cantera {
|
|||
* @ingroup spthermo
|
||||
*/
|
||||
void installMu0ThermoFromXML(std::string speciesName,
|
||||
SpeciesThermo& sp, int k,
|
||||
SpeciesThermo& sp, size_t k,
|
||||
const XML_Node* Mu0Node_ptr);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ namespace Cantera {
|
|||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
Nasa9Poly1::Nasa9Poly1(int n, doublereal tlow, doublereal thigh,
|
||||
Nasa9Poly1::Nasa9Poly1(size_t n, doublereal tlow, doublereal thigh,
|
||||
doublereal pref,
|
||||
const doublereal* coeffs) :
|
||||
m_lowT (tlow),
|
||||
|
|
@ -148,7 +148,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
// Returns an integer representing the species index
|
||||
int Nasa9Poly1::speciesIndex() const {
|
||||
size_t Nasa9Poly1::speciesIndex() const {
|
||||
return m_index;
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ namespace Cantera {
|
|||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
void Nasa9Poly1::reportParameters(int &n, int &type,
|
||||
void Nasa9Poly1::reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Cantera {
|
|||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
Nasa9Poly1(int n, doublereal tlow, doublereal thigh, doublereal pref,
|
||||
Nasa9Poly1(size_t n, doublereal tlow, doublereal thigh, doublereal pref,
|
||||
const doublereal* coeffs);
|
||||
|
||||
//! copy constructor
|
||||
|
|
@ -121,7 +121,7 @@ namespace Cantera {
|
|||
virtual int reportType() const;
|
||||
|
||||
//! Returns an integer representing the species index
|
||||
virtual int speciesIndex() const;
|
||||
virtual size_t speciesIndex() const;
|
||||
|
||||
//! Update the properties for this species, given a temperature polynomial
|
||||
/*!
|
||||
|
|
@ -200,7 +200,7 @@ namespace Cantera {
|
|||
* coeffs[2] is max temperature
|
||||
* coeffs[3+i] from i =0,9 are the coefficients themselves
|
||||
*/
|
||||
virtual void reportParameters(int &n, int &type,
|
||||
virtual void reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const;
|
||||
|
|
@ -220,7 +220,7 @@ namespace Cantera {
|
|||
//! standard-state pressure
|
||||
doublereal m_Pref;
|
||||
//! species index
|
||||
int m_index;
|
||||
size_t m_index;
|
||||
//! array of polynomial coefficients
|
||||
array_fp m_coeff;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ namespace Cantera {
|
|||
|
||||
|
||||
// Returns an integer representing the species index
|
||||
int Nasa9PolyMultiTempRegion::speciesIndex() const {
|
||||
size_t Nasa9PolyMultiTempRegion::speciesIndex() const {
|
||||
return m_index;
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ namespace Cantera {
|
|||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
void Nasa9PolyMultiTempRegion::reportParameters(int &n, int &type,
|
||||
void Nasa9PolyMultiTempRegion::reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const {
|
||||
|
|
@ -344,7 +344,7 @@ namespace Cantera {
|
|||
double ctmp[12];
|
||||
coeffs[0] = double(m_numTempRegions);
|
||||
int index = 1;
|
||||
int n_tmp = 0;;
|
||||
size_t n_tmp = 0;;
|
||||
int type_tmp = 0;
|
||||
double pref_tmp = 0.0;
|
||||
for (size_t iReg = 0; iReg < m_numTempRegions; iReg++) {
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace Cantera {
|
|||
virtual int reportType() const;
|
||||
|
||||
//! Returns an integer representing the species index
|
||||
virtual int speciesIndex() const;
|
||||
virtual size_t speciesIndex() const;
|
||||
|
||||
//! Update the properties for this species, given a temperature polynomial
|
||||
/*!
|
||||
|
|
@ -202,7 +202,7 @@ namespace Cantera {
|
|||
* coeffs[index+1] = maxTempZone
|
||||
* coeffs[index+2+i] from i =0,9 are the coefficients themselves
|
||||
*/
|
||||
virtual void reportParameters(int &n, int &type,
|
||||
virtual void reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const;
|
||||
|
|
@ -222,7 +222,7 @@ namespace Cantera {
|
|||
//! standard-state pressure
|
||||
doublereal m_Pref;
|
||||
//! species index
|
||||
int m_index;
|
||||
size_t m_index;
|
||||
//! Number of temperature regions
|
||||
size_t m_numTempRegions;
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Cantera {
|
|||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
NasaPoly1(int n, doublereal tlow, doublereal thigh, doublereal pref,
|
||||
NasaPoly1(size_t n, doublereal tlow, doublereal thigh, doublereal pref,
|
||||
const doublereal* coeffs) :
|
||||
m_lowT (tlow),
|
||||
m_highT (thigh),
|
||||
|
|
@ -132,7 +132,7 @@ namespace Cantera {
|
|||
virtual int reportType() const { return NASA1; }
|
||||
|
||||
//! Returns an integer representing the species index
|
||||
virtual int speciesIndex() const { return m_index; }
|
||||
virtual size_t speciesIndex() const { return m_index; }
|
||||
|
||||
//! Update the properties for this species, given a temperature polynomial
|
||||
/*!
|
||||
|
|
@ -226,7 +226,7 @@ namespace Cantera {
|
|||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
virtual void reportParameters(int &n, int &type,
|
||||
virtual void reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const {
|
||||
|
|
@ -306,7 +306,7 @@ namespace Cantera {
|
|||
//! standard-state pressure
|
||||
doublereal m_Pref;
|
||||
//! species index
|
||||
int m_index;
|
||||
size_t m_index;
|
||||
//! array of polynomial coefficients
|
||||
array_fp m_coeff;
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ namespace Cantera {
|
|||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
NasaPoly2(int n, doublereal tlow, doublereal thigh, doublereal pref,
|
||||
NasaPoly2(size_t n, doublereal tlow, doublereal thigh, doublereal pref,
|
||||
const doublereal* coeffs) :
|
||||
m_lowT(tlow),
|
||||
m_highT(thigh),
|
||||
|
|
@ -165,7 +165,7 @@ namespace Cantera {
|
|||
virtual int reportType() const { return NASA2; }
|
||||
|
||||
//! Returns an integer representing the species index
|
||||
virtual int speciesIndex() const { return m_index; }
|
||||
virtual size_t speciesIndex() const { return m_index; }
|
||||
|
||||
|
||||
//! Update the properties for this species, given a temperature polynomial
|
||||
|
|
@ -243,7 +243,7 @@ namespace Cantera {
|
|||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
void reportParameters(int &n, int &type,
|
||||
void reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const {
|
||||
|
|
@ -301,7 +301,7 @@ namespace Cantera {
|
|||
//! pointer to the NasaPoly1 object for the high temperature region.
|
||||
NasaPoly1 *mnp_high;
|
||||
//! species index
|
||||
int m_index;
|
||||
size_t m_index;
|
||||
//! array of polynomial coefficients
|
||||
array_fp m_coeff;
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ namespace Cantera {
|
|||
* parameterization.
|
||||
* @see speciesThermoTypes.h
|
||||
*/
|
||||
virtual void install(string name, int index, int type,
|
||||
virtual void install(string name, size_t index, int type,
|
||||
const doublereal* c,
|
||||
doublereal minTemp, doublereal maxTemp,
|
||||
doublereal refPressure) {
|
||||
|
|
@ -235,7 +235,7 @@ namespace Cantera {
|
|||
* (length m_kk).
|
||||
*
|
||||
*/
|
||||
virtual void update_one(int k, doublereal t, doublereal* cp_R,
|
||||
virtual void update_one(size_t k, doublereal t, doublereal* cp_R,
|
||||
doublereal* h_RT, doublereal* s_R) const {
|
||||
|
||||
m_t[0] = t;
|
||||
|
|
@ -245,8 +245,8 @@ namespace Cantera {
|
|||
m_t[4] = 1.0/t;
|
||||
m_t[5] = log(t);
|
||||
|
||||
int grp = m_group_map[k];
|
||||
int pos = m_posInGroup_map[k];
|
||||
size_t grp = m_group_map[k];
|
||||
size_t pos = m_posInGroup_map[k];
|
||||
const vector<NasaPoly1> &mlg = m_low[grp-1];
|
||||
const NasaPoly1 *nlow = &(mlg[pos]);
|
||||
|
||||
|
|
@ -313,8 +313,8 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal minTemp(int k=-1) const {
|
||||
if (k < 0)
|
||||
virtual doublereal minTemp(size_t k=-1) const {
|
||||
if (k == -1)
|
||||
return m_tlow_max;
|
||||
else
|
||||
return m_tlow[k];
|
||||
|
|
@ -330,8 +330,8 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal maxTemp(int k=-1) const {
|
||||
if (k < 0)
|
||||
virtual doublereal maxTemp(size_t k=-1) const {
|
||||
if (k == -1)
|
||||
return m_thigh_min;
|
||||
else
|
||||
return m_thigh[k];
|
||||
|
|
@ -350,7 +350,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal refPressure(int k = -1) const {
|
||||
virtual doublereal refPressure(size_t k = -1) const {
|
||||
return m_p0;
|
||||
}
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param index Species index
|
||||
*/
|
||||
virtual int reportType(int index) const { return NASA; }
|
||||
virtual int reportType(size_t index) const { return NASA; }
|
||||
|
||||
/*!
|
||||
* This utility function reports back the type of
|
||||
|
|
@ -376,15 +376,15 @@ namespace Cantera {
|
|||
* @param maxTemp output - Maximum temperature
|
||||
* @param refPressure output - reference pressure (Pa).
|
||||
*/
|
||||
virtual void reportParams(int index, int &type,
|
||||
virtual void reportParams(size_t index, int &type,
|
||||
doublereal * const c,
|
||||
doublereal &minTemp,
|
||||
doublereal &maxTemp,
|
||||
doublereal &refPressure) const {
|
||||
type = reportType(index);
|
||||
if (type == NASA) {
|
||||
int grp = m_group_map[index];
|
||||
int pos = m_posInGroup_map[index];
|
||||
size_t grp = m_group_map[index];
|
||||
size_t pos = m_posInGroup_map[index];
|
||||
const vector<NasaPoly1> &mlg = m_low[grp-1];
|
||||
const vector<NasaPoly1> &mhg = m_high[grp-1];
|
||||
const NasaPoly1 *lowPoly = &(mlg[pos]);
|
||||
|
|
@ -392,7 +392,7 @@ namespace Cantera {
|
|||
int itype = NASA;
|
||||
doublereal tmid = lowPoly->maxTemp();
|
||||
c[0] = tmid;
|
||||
int n;
|
||||
size_t n;
|
||||
double ttemp;
|
||||
lowPoly->reportParameters(n, itype, minTemp, ttemp, refPressure,
|
||||
c + 1);
|
||||
|
|
@ -428,11 +428,11 @@ namespace Cantera {
|
|||
* @param c Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
virtual void modifyParams(int index, doublereal *c) {
|
||||
virtual void modifyParams(size_t index, doublereal *c) {
|
||||
int type = reportType(index);
|
||||
if (type == NASA) {
|
||||
int grp = m_group_map[index];
|
||||
int pos = m_posInGroup_map[index];
|
||||
size_t grp = m_group_map[index];
|
||||
size_t pos = m_posInGroup_map[index];
|
||||
vector<NasaPoly1> &mlg = m_low[grp-1];
|
||||
vector<NasaPoly1> &mhg = m_high[grp-1];
|
||||
NasaPoly1 *lowPoly = &(mlg[pos]);
|
||||
|
|
@ -561,17 +561,17 @@ namespace Cantera {
|
|||
* for that species are stored. group indecises start at 1,
|
||||
* so a decrement is always performed to access vectors.
|
||||
*/
|
||||
mutable map<int, int> m_group_map;
|
||||
mutable map<size_t, size_t> m_group_map;
|
||||
|
||||
/*!
|
||||
* This map takes as its index, the species index in the phase.
|
||||
* It returns the position index within the group, where the
|
||||
* temperature polynomials for that species are storred.
|
||||
*/
|
||||
mutable map<int, int> m_posInGroup_map;
|
||||
mutable map<size_t, size_t> m_posInGroup_map;
|
||||
|
||||
//! Species name as a function of the species index
|
||||
mutable map<int, string> m_name;
|
||||
mutable map<size_t, string> m_name;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Cantera {
|
|||
{
|
||||
}
|
||||
|
||||
PDSS::PDSS(VPStandardStateTP *tp, int spindex) :
|
||||
PDSS::PDSS(VPStandardStateTP *tp, size_t spindex) :
|
||||
m_pdssType(cPDSS_UNDEF),
|
||||
m_temp(-1.0),
|
||||
m_pres(-1.0),
|
||||
|
|
@ -485,7 +485,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
void PDSS::reportParams(int &kindex, int &type,
|
||||
void PDSS::reportParams(size_t &kindex, int &type,
|
||||
doublereal * const c,
|
||||
doublereal &minTemp,
|
||||
doublereal &maxTemp,
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ namespace Cantera {
|
|||
* @param tp Pointer to the ThermoPhase object pertaining to the phase
|
||||
* @param spindex Species index of the species in the phase
|
||||
*/
|
||||
PDSS(VPStandardStateTP *tp, int spindex);
|
||||
PDSS(VPStandardStateTP *tp, size_t spindex);
|
||||
|
||||
//! Copy Constructor
|
||||
/*!
|
||||
|
|
@ -620,7 +620,7 @@ namespace Cantera {
|
|||
* @param refPressure output - reference pressure (Pa).
|
||||
*
|
||||
*/
|
||||
virtual void reportParams(int &kindex, int &type, doublereal * const c,
|
||||
virtual void reportParams(size_t &kindex, int &type, doublereal * const c,
|
||||
doublereal &minTemp, doublereal &maxTemp,
|
||||
doublereal &refPressure) const;
|
||||
|
||||
|
|
@ -692,7 +692,7 @@ namespace Cantera {
|
|||
/**
|
||||
* Species index in the thermophase corresponding to this species.
|
||||
*/
|
||||
int m_spindex;
|
||||
size_t m_spindex;
|
||||
|
||||
//! Pointer to the species thermodynamic property manager.
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -23,21 +23,21 @@ namespace Cantera {
|
|||
* Basic list of constructors and duplicators
|
||||
*/
|
||||
|
||||
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, int spindex) :
|
||||
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, size_t spindex) :
|
||||
PDSS(tp, spindex)
|
||||
{
|
||||
m_pdssType = cPDSS_CONSTVOL;
|
||||
}
|
||||
|
||||
|
||||
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, int spindex, std::string inputFile, std::string id) :
|
||||
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, size_t spindex, std::string inputFile, std::string id) :
|
||||
PDSS(tp, spindex)
|
||||
{
|
||||
m_pdssType = cPDSS_CONSTVOL;
|
||||
constructPDSSFile(tp, spindex, inputFile, id);
|
||||
}
|
||||
|
||||
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, int spindex,
|
||||
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP *tp, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseRoot,
|
||||
bool spInstalled) :
|
||||
|
|
@ -93,7 +93,7 @@ namespace Cantera {
|
|||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
void PDSS_ConstVol::constructPDSSXML(VPStandardStateTP *tp, int spindex,
|
||||
void PDSS_ConstVol::constructPDSSXML(VPStandardStateTP *tp, size_t spindex,
|
||||
const XML_Node& speciesNode,
|
||||
const XML_Node& phaseNode, bool spInstalled) {
|
||||
PDSS::initThermo();
|
||||
|
|
@ -138,7 +138,7 @@ namespace Cantera {
|
|||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
*/
|
||||
void PDSS_ConstVol::constructPDSSFile(VPStandardStateTP *tp, int spindex,
|
||||
void PDSS_ConstVol::constructPDSSFile(VPStandardStateTP *tp, size_t spindex,
|
||||
std::string inputFile, std::string id) {
|
||||
|
||||
if (inputFile.size() == 0) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue