Fixing compiler warnings, part 2
This commit is contained in:
parent
7a30bfc9fd
commit
69bffa3800
57 changed files with 468 additions and 529 deletions
|
|
@ -1127,10 +1127,8 @@ namespace ctml {
|
|||
string val;
|
||||
vector<string> v;
|
||||
getStringArray(node, v);
|
||||
int icol, irow;
|
||||
int n = static_cast<int>(v.size());
|
||||
string::size_type icolon;
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (size_t i = 0; i < v.size(); i++) {
|
||||
icolon = v[i].find(":");
|
||||
if (icolon == string::npos) {
|
||||
throw CanteraError("getMatrixValues","Missing two colons ("
|
||||
|
|
@ -1145,9 +1143,10 @@ namespace ctml {
|
|||
}
|
||||
key2 = rmm.substr(0,icolon);
|
||||
val = rmm.substr(icolon+1, rmm.size());
|
||||
icol = -1;
|
||||
irow = -1;
|
||||
for (int j = 0; j < szKey1; j++) {
|
||||
|
||||
size_t icol = -1;
|
||||
size_t irow = -1;
|
||||
for (size_t j = 0; j < szKey1; j++) {
|
||||
if (key1 == keyStringRow[j]) {
|
||||
irow = j;
|
||||
break;
|
||||
|
|
@ -1157,7 +1156,7 @@ namespace ctml {
|
|||
throw CanteraError("getMatrixValues","Row not matched by string: "
|
||||
+ key1);
|
||||
}
|
||||
for (int j = 0; j < szKey2; j++) {
|
||||
for (size_t j = 0; j < szKey2; j++) {
|
||||
if (key2 == keyStringCol[j]) {
|
||||
icol = j;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ namespace Cantera {
|
|||
* @param len Length of the copy
|
||||
*/
|
||||
inline void fbo_copy_dbl_1(doublereal * const copyTo, const doublereal * const copyFrom,
|
||||
const int len) {
|
||||
const size_t len) {
|
||||
if (len > 0) {
|
||||
(void) memcpy((void *)copyTo, (const void *)copyFrom, len * sizeof(doublereal));
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ namespace Cantera {
|
|||
* @param len Length of the copy
|
||||
*/
|
||||
inline void fvo_copy_dbl_1(std::vector<doublereal> ©To, const std::vector<doublereal> ©From,
|
||||
const int len) {
|
||||
const size_t len) {
|
||||
if (len > 0) {
|
||||
(void) memcpy((void *)(©To[0]), (const void *)(©From[0]), len * sizeof(doublereal));
|
||||
}
|
||||
|
|
@ -203,7 +203,7 @@ namespace Cantera {
|
|||
* @param v Vector to be zeroed
|
||||
* @param len Length of the copy
|
||||
*/
|
||||
inline void fbo_zero_dbl_1(doublereal * const v, const int len) {
|
||||
inline void fbo_zero_dbl_1(doublereal * const v, const size_t len) {
|
||||
if (len > 0) {
|
||||
(void) memset((void *)v, 0, len * sizeof(doublereal));
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ namespace Cantera {
|
|||
* @param v Vector to be zeroed
|
||||
* @param len Length of the copy
|
||||
*/
|
||||
inline void fvo_zero_dbl_1(std::vector<doublereal> &v, const int len) {
|
||||
inline void fvo_zero_dbl_1(std::vector<doublereal> &v, const size_t len) {
|
||||
if (len > 0) {
|
||||
(void) memset((void *)(&v[0]), 0, len * sizeof(doublereal));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,7 +317,6 @@ namespace Cantera {
|
|||
int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT,
|
||||
vector_fp& elMolesGoal, int loglevel)
|
||||
{
|
||||
int m, n;
|
||||
if (loglevel > 0)
|
||||
beginLogGroup("estimateElementPotentials");
|
||||
//for (k = 0; k < m_kk; k++) {
|
||||
|
|
@ -333,7 +332,7 @@ namespace Cantera {
|
|||
vector_fp xMF_est(m_kk, 0.0);
|
||||
|
||||
s.getMoleFractions(DATA_PTR(xMF_est));
|
||||
for (n = 0; n < s.nSpecies(); n++) {
|
||||
for (size_t n = 0; n < s.nSpecies(); n++) {
|
||||
if (xMF_est[n] < 1.0E-20) {
|
||||
xMF_est[n] = 1.0E-20;
|
||||
}
|
||||
|
|
@ -350,7 +349,7 @@ namespace Cantera {
|
|||
mp, m_orderVectorSpecies,
|
||||
m_orderVectorElements, formRxnMatrix);
|
||||
|
||||
for (m = 0; m < m_nComponents; m++) {
|
||||
for (size_t m = 0; m < m_nComponents; m++) {
|
||||
int k = m_orderVectorSpecies[m];
|
||||
m_component[m] = k;
|
||||
if (xMF_est[k] < 1.0E-8) {
|
||||
|
|
@ -377,7 +376,7 @@ namespace Cantera {
|
|||
#ifdef DEBUG_MODE
|
||||
if (ChemEquil_print_lvl > 0) {
|
||||
PrintCtrl pc(std::cout, -28, PrintCtrl::CT_OFF_GLOBALOBEY);
|
||||
for (m = 0; m < m_nComponents; m++) {
|
||||
for (size_t m = 0; m < m_nComponents; m++) {
|
||||
int isp = m_component[m];
|
||||
string nnn = s.speciesName(isp);
|
||||
writelogf("isp = %d, %s\n", isp, nnn.c_str());
|
||||
|
|
@ -387,7 +386,7 @@ namespace Cantera {
|
|||
writelogf("Pressure = %g\n", pres);
|
||||
writelogf("Temperature = %g\n", temp);
|
||||
writelog(" id Name MF mu/RT \n");
|
||||
for (n = 0; n < s.nSpecies(); n++) {
|
||||
for (size_t n = 0; n < s.nSpecies(); n++) {
|
||||
string nnn = s.speciesName(n);
|
||||
double mf = pc.cropAbs10(xMF_est[n], -28);
|
||||
writelogf("%10d %15s %10.5g %10.5g\n",
|
||||
|
|
@ -396,8 +395,8 @@ namespace Cantera {
|
|||
}
|
||||
#endif
|
||||
DenseMatrix aa(m_nComponents, m_nComponents, 0.0);
|
||||
for (m = 0; m < m_nComponents; m++) {
|
||||
for (n = 0; n < m_nComponents; n++) {
|
||||
for (size_t m = 0; m < m_nComponents; m++) {
|
||||
for (size_t n = 0; n < m_nComponents; n++) {
|
||||
aa(m,n) = nAtoms(m_component[m], m_orderVectorElements[n]);
|
||||
}
|
||||
b[m] = mu_RT[m_component[m]];
|
||||
|
|
@ -412,15 +411,15 @@ namespace Cantera {
|
|||
addLogEntry("failed to estimate initial element potentials.");
|
||||
info = -2;
|
||||
}
|
||||
for (m = 0; m < m_nComponents; m++) {
|
||||
for (size_t m = 0; m < m_nComponents; m++) {
|
||||
lambda_RT[m_orderVectorElements[m]] = b[m];
|
||||
}
|
||||
for (m = m_nComponents; m < m_mm; m++) {
|
||||
for (size_t m = m_nComponents; m < m_mm; m++) {
|
||||
lambda_RT[m_orderVectorElements[m]] = 0.0;
|
||||
}
|
||||
if (info == 0) {
|
||||
if (loglevel > 0) {
|
||||
for (m = 0; m < m_mm; m++) {
|
||||
for (size_t m = 0; m < m_mm; m++) {
|
||||
addLogEntry(s.elementName(m),lambda_RT[m]);
|
||||
}
|
||||
}
|
||||
|
|
@ -429,11 +428,11 @@ namespace Cantera {
|
|||
#ifdef DEBUG_MODE
|
||||
if (ChemEquil_print_lvl > 0) {
|
||||
writelog(" id CompSpecies ChemPot EstChemPot Diff\n");
|
||||
for (m = 0; m < m_nComponents; m++) {
|
||||
for (size_t m = 0; m < m_nComponents; m++) {
|
||||
int isp = m_component[m];
|
||||
double tmp = 0.0;
|
||||
string sname = s.speciesName(isp);
|
||||
for (n = 0; n < m_mm; n++) {
|
||||
for (size_t n = 0; n < m_mm; n++) {
|
||||
tmp += nAtoms(isp, n) * lambda_RT[n];
|
||||
}
|
||||
writelogf("%3d %16s %10.5g %10.5g %10.5g\n",
|
||||
|
|
@ -441,7 +440,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
writelog(" id ElName Lambda_RT\n");
|
||||
for (m = 0; m < m_mm; m++) {
|
||||
for (size_t m = 0; m < m_mm; m++) {
|
||||
string ename = s.elementName(m);
|
||||
writelogf(" %3d %6s %10.5g\n", m, ename.c_str(), lambda_RT[m]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,9 +168,9 @@ namespace Cantera {
|
|||
vector_fp& eMolesCalc, vector_fp& n_i_calc,
|
||||
double pressureConst);
|
||||
|
||||
int m_mm;
|
||||
int m_kk;
|
||||
int m_skip;
|
||||
size_t m_mm;
|
||||
size_t m_kk;
|
||||
size_t m_skip;
|
||||
|
||||
/**
|
||||
* This is equal to the rank of the stoichiometric coefficient
|
||||
|
|
@ -215,7 +215,7 @@ namespace Cantera {
|
|||
* Index of the element id corresponding to the electric charge of each
|
||||
* species. Equal to -1 if there is no such element id.
|
||||
*/
|
||||
int m_eloc;
|
||||
size_t m_eloc;
|
||||
|
||||
vector_fp m_startSoln;
|
||||
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ namespace Cantera {
|
|||
}
|
||||
for (index_t ip = 0; ip < m_np; ip++) {
|
||||
phase_t* p = m_phase[ip];
|
||||
int nspPhase = p->nSpecies();
|
||||
size_t nspPhase = p->nSpecies();
|
||||
doublereal phasemoles = m_moles[ip];
|
||||
for (ik = 0; ik < nspPhase; ik++) {
|
||||
kGlobal = loc + ik;
|
||||
|
|
|
|||
|
|
@ -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 (size_t n = m-1; n>= 0; n--) {
|
||||
for (int n = m-1; n>= 0; n--) {
|
||||
if (m_A(n,m) != 0.0) {
|
||||
fctr = m_A(n,m);
|
||||
for (k = m; k < m_nsp; k++) {
|
||||
|
|
|
|||
|
|
@ -700,8 +700,8 @@ static integer c__4 = 4;
|
|||
if (bl[j] > bu[j]) {
|
||||
nerr = 57;
|
||||
nchar = 58;
|
||||
rdum2 = bl[j];
|
||||
rdum = bu[j];
|
||||
rdum2 = (real) bl[j];
|
||||
rdum = (real) bu[j];
|
||||
xerrwv_("DBOCLS(). FOR J=(I1), BOUND BL(J)=(R1) IS .GT. "
|
||||
"BU(J)=(R2).", &nchar, &nerr, &level, &c__1, &j, &
|
||||
idum, &c__2, &rdum2, &rdum, (ftnlen)58);
|
||||
|
|
@ -905,7 +905,7 @@ L30:
|
|||
if (rw[j] <= zero) {
|
||||
nerr = 50;
|
||||
nchar = 84;
|
||||
rdum2 = rw[j];
|
||||
rdum2 = (real) rw[j];
|
||||
xerrwv_("DBOCLS(). EACH PROVIDED COL. SCALE FACTOR M"
|
||||
"UST BE POSITIVE. COMP. (I1) NOW = (R1).", &
|
||||
nchar, &nerr, &level, &c__1, &j, &idum, &c__1,
|
||||
|
|
|
|||
|
|
@ -549,8 +549,8 @@ static integer c__2 = 2;
|
|||
if (bl[j] > bu[j]) {
|
||||
nerr = 5;
|
||||
nchar = 57;
|
||||
rdum2 = bl[j];
|
||||
rdum = bu[j];
|
||||
rdum2 = (real) bl[j];
|
||||
rdum = (real) bu[j];
|
||||
xerrwv_("DBOLS(). FOR J=(I1), BOUND BL(J)=(R1) IS .GT. B"
|
||||
"U(J)=(R2).", &nchar, &nerr, &level, &c__1, &j, &
|
||||
idum, &c__2, &rdum2, &rdum, (ftnlen)57);
|
||||
|
|
@ -691,7 +691,7 @@ L30:
|
|||
if (rw[j] <= zero) {
|
||||
nerr = 9;
|
||||
nchar = 85;
|
||||
rdum2 = rw[j];
|
||||
rdum2 = (real) rw[j];
|
||||
xerrwv_("DBOLS(). EACH PROVIDED COL. SCALE FACTOR MU"
|
||||
"ST BE POSITIVE. COMPONENT (I1) NOW = (R1).", &
|
||||
nchar, &nerr, &level, &c__1, &j, &idum, &c__1,
|
||||
|
|
|
|||
|
|
@ -662,8 +662,8 @@ static integer c__4 = 4;
|
|||
if (bu[j] < bl[j]) {
|
||||
nerr = 35;
|
||||
nchar = 71;
|
||||
rdum2 = bl[j];
|
||||
rdum = bu[j];
|
||||
rdum2 = (real) bl[j];
|
||||
rdum = (real) bu[j];
|
||||
xerrwv_("DBOLSM(). FOR J=(I1) THE LOWER BOUND=(R1) IS .GT. T"
|
||||
"HE UPPER BOUND=(R2).", &nchar, &nerr, &level, &c__1, &
|
||||
j, &idum, &c__2, &rdum2, &rdum, (ftnlen)71);
|
||||
|
|
@ -1431,8 +1431,8 @@ L590:
|
|||
nerr = 25;
|
||||
nlevel = 0;
|
||||
nchar = 88;
|
||||
rdum2 = tolind;
|
||||
rdum = d1mach_(&c__4);
|
||||
rdum2 = (real) tolind;
|
||||
rdum = (real) d1mach_(&c__4);
|
||||
xerrwv_("DBOLSM(). THE TOLERANCE FOR RANK DETERMINATION=(R1)"
|
||||
" IS LESS THAN MACHINE PRECISION=(R2).", &nchar, &nerr,
|
||||
&nlevel, &c__0, &idum, &idum, &c__2, &rdum2, &rdum, (
|
||||
|
|
@ -1460,7 +1460,7 @@ L590:
|
|||
tolsze = x[*ncols + ioff];
|
||||
if (tolsze <= zero) {
|
||||
nerr = 27;
|
||||
rdum2 = tolsze;
|
||||
rdum2 = (real) tolsze;
|
||||
xerrwv_("DBOLSM(). THE RECIPROCAL OF THE BLOW-UP FACTOR FOR "
|
||||
"REJECTING VARIABLES MUST BE POSITIVE. NOW=(R1).", &
|
||||
nchar, &nerr, &level, &c__0, &idum, &idum, &c__1, &
|
||||
|
|
@ -1508,7 +1508,7 @@ L590:
|
|||
nerr = 30;
|
||||
nlevel = 0;
|
||||
nchar = 104;
|
||||
rdum2 = fac;
|
||||
rdum2 = (real) fac;
|
||||
xerrwv_("DBOLSM(). THE FACTOR (NCOLS/MROWS) WHERE PRE-TRIANG"
|
||||
"ULARIZING IS PERFORMED MUST BE NONNEGATIVE. NOW=(R1)."
|
||||
, &nchar, &nerr, &nlevel, &c__0, &idum, &idum, &c__1,
|
||||
|
|
@ -1534,7 +1534,7 @@ L590:
|
|||
nerr = 38;
|
||||
nlevel = 0;
|
||||
nchar = 116;
|
||||
rdum2 = wt;
|
||||
rdum2 = (real) wt;
|
||||
xerrwv_("DBOLSM(). THE ROW SEPARATOR TO APPLY WEIGHTING (I1) MUS"
|
||||
"T LIE BETWEEN 0 AND MROWS (I2). WEIGHT (R1) MUST BE POSI"
|
||||
"TIVE.", &nchar, &nerr, &nlevel, &c__2, &mval, minput, &
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace VCSnonideal {
|
|||
int kspec = Vphase->spGlobalIndexVCS(k);
|
||||
int irxn = kspec - m_numComponents;
|
||||
if (irxn >= 0) {
|
||||
int iPopPossible = true;
|
||||
bool iPopPossible = true;
|
||||
for (int j = 0; j < m_numComponents; ++j) {
|
||||
if (m_elType[j] == VCS_ELEM_TYPE_ABSPOS) {
|
||||
double stoicC = m_stoichCoeffRxnMatrix[irxn][j];
|
||||
|
|
@ -62,7 +62,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (iPopPossible == true) {
|
||||
if (iPopPossible) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,14 +134,13 @@ namespace Cantera {
|
|||
if (tmax > 0.0) m_tmax = tmax;
|
||||
m_p0 = refPressure();
|
||||
|
||||
int leng = m_kk;
|
||||
m_h0_RT.resize(leng);
|
||||
m_g0_RT.resize(leng);
|
||||
m_expg0_RT.resize(leng);
|
||||
m_cp0_R.resize(leng);
|
||||
m_s0_R.resize(leng);
|
||||
m_pe.resize(leng, 0.0);
|
||||
m_pp.resize(leng);
|
||||
m_h0_RT.resize(m_kk);
|
||||
m_g0_RT.resize(m_kk);
|
||||
m_expg0_RT.resize(m_kk);
|
||||
m_cp0_R.resize(m_kk);
|
||||
m_s0_R.resize(m_kk);
|
||||
m_pe.resize(m_kk, 0.0);
|
||||
m_pp.resize(m_kk);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ namespace Cantera {
|
|||
protected:
|
||||
|
||||
//! number of elements
|
||||
int m_mm;
|
||||
size_t m_mm;
|
||||
|
||||
|
||||
//! Minimum temperature for valid species standard state thermo props
|
||||
|
|
|
|||
|
|
@ -74,19 +74,17 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
int Constituents::nElements() const { return m_Elements->nElements(); }
|
||||
|
||||
size_t Constituents::nElements() const { return m_Elements->nElements(); }
|
||||
|
||||
/*
|
||||
* Return the Atomic weight of element m.
|
||||
* units = Kg / Kmol
|
||||
*/
|
||||
doublereal Constituents::atomicWeight(int m) const {
|
||||
doublereal Constituents::atomicWeight(size_t m) const {
|
||||
return m_Elements->atomicWeight(m);
|
||||
}
|
||||
|
||||
|
||||
doublereal Constituents::entropyElement298(int m) const {
|
||||
doublereal Constituents::entropyElement298(size_t m) const {
|
||||
return m_Elements->entropyElement298(m);
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +97,6 @@ namespace Cantera {
|
|||
return m_Elements->atomicWeights();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return the atomic number of element m.
|
||||
*/
|
||||
|
|
@ -107,7 +104,6 @@ namespace Cantera {
|
|||
return m_Elements->atomicNumber(m);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add an element to the set.
|
||||
* @param symbol symbol string
|
||||
|
|
@ -183,7 +179,7 @@ namespace Cantera {
|
|||
*
|
||||
* -> Passthrough to the Element class.
|
||||
*/
|
||||
int Constituents::elementIndex(std::string name) const {
|
||||
size_t Constituents::elementIndex(std::string name) const {
|
||||
return (m_Elements->elementIndex(name));
|
||||
}
|
||||
|
||||
|
|
@ -226,8 +222,8 @@ namespace Cantera {
|
|||
*
|
||||
* units = kg / kmol.
|
||||
*/
|
||||
doublereal Constituents::molecularWeight(int k) const {
|
||||
if (k < 0 || k >= nSpecies()) {
|
||||
doublereal Constituents::molecularWeight(size_t k) const {
|
||||
if (k >= nSpecies()) {
|
||||
throw SpeciesRangeError("Constituents::molecularWeight",
|
||||
k, nSpecies());
|
||||
}
|
||||
|
|
@ -280,17 +276,17 @@ namespace Cantera {
|
|||
m_speciesNames.push_back(name);
|
||||
m_speciesCharge.push_back(charge);
|
||||
m_speciesSize.push_back(size);
|
||||
int m_mm = m_Elements->nElements();
|
||||
size_t m_mm = m_Elements->nElements();
|
||||
// Create a changeable copy of the element composition. We now change the charge potentially
|
||||
vector_fp compNew(m_mm);
|
||||
for (int m = 0; m < m_mm; m++) {
|
||||
for (size_t m = 0; m < m_mm; m++) {
|
||||
compNew[m] = comp[m];
|
||||
}
|
||||
double wt = 0.0;
|
||||
const vector_fp &aw = m_Elements->atomicWeights();
|
||||
if (charge != 0.0) {
|
||||
int eindex = m_Elements->elementIndex("E");
|
||||
if (eindex >= 0) {
|
||||
size_t eindex = m_Elements->elementIndex("E");
|
||||
if (eindex != -1) {
|
||||
doublereal ecomp = compNew[eindex];
|
||||
if (fabs (charge + ecomp) > 0.001) {
|
||||
if (ecomp != 0.0) {
|
||||
|
|
@ -309,8 +305,8 @@ namespace Cantera {
|
|||
if (m_kk > 0) {
|
||||
vector_fp old(m_speciesComp);
|
||||
m_speciesComp.resize(m_kk*m_mm, 0.0);
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
int m_old = m_mm - 1;
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
size_t m_old = m_mm - 1;
|
||||
for (int m = 0; m < m_old; m++) {
|
||||
m_speciesComp[k * m_mm + m] = old[k * (m_old) + m];
|
||||
}
|
||||
|
|
@ -325,7 +321,7 @@ namespace Cantera {
|
|||
// "Element List doesn't include E, yet this species has charge:" + name);
|
||||
}
|
||||
}
|
||||
for (int m = 0; m < m_mm; m++) {
|
||||
for (size_t m = 0; m < m_mm; m++) {
|
||||
m_speciesComp.push_back(compNew[m]);
|
||||
wt += compNew[m] * aw[m];
|
||||
}
|
||||
|
|
@ -346,15 +342,15 @@ namespace Cantera {
|
|||
addUniqueSpecies(const std::string& name, const doublereal* comp,
|
||||
doublereal charge, doublereal size) {
|
||||
vector<string>::const_iterator it = m_speciesNames.begin();
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
if (*it == name) {
|
||||
/*
|
||||
* We have found a match. At this point we could do some
|
||||
* compatibility checks. However, let's just return for the
|
||||
* moment without specifying any error.
|
||||
*/
|
||||
int m_mm = m_Elements->nElements();
|
||||
for (int i = 0; i < m_mm; i++) {
|
||||
size_t m_mm = m_Elements->nElements();
|
||||
for (size_t i = 0; i < m_mm; i++) {
|
||||
if (comp[i] != m_speciesComp[m_kk * m_mm + i]) {
|
||||
throw CanteraError("addUniqueSpecies",
|
||||
"Duplicate species have different "
|
||||
|
|
@ -400,9 +396,9 @@ namespace Cantera {
|
|||
*
|
||||
* If name isn't in the list, then a -1 is returned.
|
||||
*/
|
||||
int Constituents::speciesIndex(std::string name) const {
|
||||
size_t Constituents::speciesIndex(std::string name) const {
|
||||
vector<string>::const_iterator it = m_speciesNames.begin();
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
if (*it == name) {
|
||||
/*
|
||||
* We have found a match.
|
||||
|
|
@ -449,13 +445,13 @@ namespace Cantera {
|
|||
/*
|
||||
* Returns the number of atoms of element \c m in species \c k.
|
||||
*/
|
||||
doublereal Constituents::nAtoms(int k, int m) const
|
||||
doublereal Constituents::nAtoms(size_t k, size_t m) const
|
||||
{
|
||||
const int m_mm = m_Elements->nElements();
|
||||
if (m < 0 || m >=m_mm)
|
||||
throw ElementRangeError("Constituents::nAtoms",m,nElements());
|
||||
if (k < 0 || k >= nSpecies())
|
||||
throw SpeciesRangeError("Constituents::nAtoms",k,nSpecies());
|
||||
const size_t m_mm = m_Elements->nElements();
|
||||
if (m >= m_mm)
|
||||
throw ElementRangeError("Constituents::nAtoms", m, nElements());
|
||||
if (k >= nSpecies())
|
||||
throw SpeciesRangeError("Constituents::nAtoms", k, nSpecies());
|
||||
return m_speciesComp[m_mm * k + m];
|
||||
}
|
||||
|
||||
|
|
@ -466,10 +462,10 @@ namespace Cantera {
|
|||
* Get a vector containing the atomic composition
|
||||
* of species k
|
||||
*/
|
||||
void Constituents::getAtoms(int k, double *atomArray) const
|
||||
void Constituents::getAtoms(size_t k, double *atomArray) const
|
||||
{
|
||||
const int m_mm = m_Elements->nElements();
|
||||
for (int m = 0; m < m_mm; m++) {
|
||||
const size_t m_mm = m_Elements->nElements();
|
||||
for (size_t m = 0; m < m_mm; m++) {
|
||||
atomArray[m] = (double) m_speciesComp[m_mm * k + m];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ namespace Cantera {
|
|||
* minimum permissible species index value is assumed to be 0
|
||||
*
|
||||
*/
|
||||
SpeciesRangeError(std::string func, int k, int kmax) :
|
||||
CanteraError(func, "Species index " + int2str(k) +
|
||||
" outside valid range of 0 to " + int2str(kmax-1)) {}
|
||||
SpeciesRangeError(std::string func, size_t k, size_t kmax) :
|
||||
CanteraError(func, "Species index " + int2str(int(k)) +
|
||||
" outside valid range of 0 to " + int2str(int(kmax)-1)) {}
|
||||
};
|
||||
|
||||
/******************************************************************/
|
||||
|
|
@ -114,20 +114,20 @@ namespace Cantera {
|
|||
/// If 'name' is not
|
||||
/// the name of an element in the set, then the value -1 is
|
||||
/// returned.
|
||||
int elementIndex(std::string name) const;
|
||||
size_t elementIndex(std::string name) const;
|
||||
|
||||
|
||||
/// Atomic weight of element m.
|
||||
/*!
|
||||
* @param m Element index
|
||||
*/
|
||||
doublereal atomicWeight(int m) const;
|
||||
doublereal atomicWeight(size_t m) const;
|
||||
|
||||
/// Entropy of the element in its standard state at 298 K and 1 bar
|
||||
/*!
|
||||
* @param m Element index
|
||||
*/
|
||||
doublereal entropyElement298(int m) const;
|
||||
doublereal entropyElement298(size_t m) const;
|
||||
|
||||
/// Atomic number of element m.
|
||||
/*!
|
||||
|
|
@ -142,7 +142,7 @@ namespace Cantera {
|
|||
const vector_fp& atomicWeights() const;
|
||||
|
||||
/// Number of elements.
|
||||
int nElements() const;
|
||||
size_t nElements() const;
|
||||
|
||||
// @}
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ namespace Cantera {
|
|||
* @return
|
||||
* Returns the molecular weight of species \c k.
|
||||
*/
|
||||
doublereal molecularWeight(int k) const;
|
||||
doublereal molecularWeight(size_t k) const;
|
||||
|
||||
//! Return the Molar mass of species \c k
|
||||
/*!
|
||||
|
|
@ -231,7 +231,7 @@ namespace Cantera {
|
|||
* @return
|
||||
* Return the molar mass of species k kg/kmol.
|
||||
*/
|
||||
doublereal molarMass(int k) const {
|
||||
doublereal molarMass(size_t k) const {
|
||||
return molecularWeight(k);
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ namespace Cantera {
|
|||
* @return Returns the index of the species. If the name is not found
|
||||
* the value of -1 is returned.
|
||||
*/
|
||||
int speciesIndex(std::string name) const;
|
||||
size_t speciesIndex(std::string name) const;
|
||||
|
||||
//! Name of the species with index k
|
||||
/*!
|
||||
|
|
@ -299,7 +299,7 @@ namespace Cantera {
|
|||
* @return
|
||||
* Returns the size of the species. Units are meters.
|
||||
*/
|
||||
doublereal size(int k) const { return m_speciesSize[k]; }
|
||||
doublereal size(size_t k) const { return m_speciesSize[k]; }
|
||||
|
||||
/**
|
||||
* Prohibit addition of more species, and prepare for
|
||||
|
|
@ -323,7 +323,7 @@ namespace Cantera {
|
|||
* @param k species index
|
||||
* @param m element index
|
||||
*/
|
||||
doublereal nAtoms(int k, int m) const;
|
||||
doublereal nAtoms(size_t k, size_t m) const;
|
||||
|
||||
//! Get a vector containing the atomic composition of species k
|
||||
/*!
|
||||
|
|
@ -331,7 +331,7 @@ namespace Cantera {
|
|||
* @param atomArray vector containing the atomic number in the species.
|
||||
* Length: m_mm
|
||||
*/
|
||||
void getAtoms(int k, double *atomArray) const;
|
||||
void getAtoms(size_t k, double *atomArray) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@ namespace Cantera {
|
|||
void DebyeHuckel::getUnitsStandardConc(double *uA, int k, int sizeUA) const {
|
||||
for (int i = 0; i < sizeUA; i++) {
|
||||
if (i == 0) uA[0] = 1.0;
|
||||
if (i == 1) uA[1] = -nDim();
|
||||
if (i == 1) uA[1] = -int(nDim());
|
||||
if (i == 2) uA[2] = 0.0;
|
||||
if (i == 3) uA[3] = 0.0;
|
||||
if (i == 4) uA[4] = 0.0;
|
||||
|
|
@ -1432,15 +1432,9 @@ namespace Cantera {
|
|||
*/
|
||||
map<std::string,std::string>::const_iterator _b = m.begin();
|
||||
for (; _b != m.end(); ++_b) {
|
||||
int kk = speciesIndex(_b->first);
|
||||
if (kk < 0) {
|
||||
//throw CanteraError(
|
||||
// "DebyeHuckel::initThermoXML error",
|
||||
// "no species match was found"
|
||||
// );
|
||||
} else {
|
||||
m_Aionic[kk] = fpValue(_b->second) * Afactor;
|
||||
}
|
||||
size_t kk = speciesIndex(_b->first);
|
||||
m_Aionic[kk] = fpValue(_b->second) * Afactor;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1482,9 +1476,9 @@ namespace Cantera {
|
|||
std::string kname, jname;
|
||||
size_t jj = xspecies.size();
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
int jmap = -1;
|
||||
size_t jmap = -1;
|
||||
kname = speciesName(k);
|
||||
for (int j = 0; j < jj; j++) {
|
||||
for (size_t j = 0; j < jj; j++) {
|
||||
const XML_Node& sp = *xspecies[j];
|
||||
jname = sp["name"];
|
||||
if (jname == kname) {
|
||||
|
|
@ -1492,7 +1486,7 @@ namespace Cantera {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (jmap > -1) {
|
||||
if (jmap != -1) {
|
||||
const XML_Node& sp = *xspecies[jmap];
|
||||
if (sp.hasChild("stoichIsMods")) {
|
||||
double val = getFloat(sp, "stoichIsMods");
|
||||
|
|
@ -1512,16 +1506,9 @@ namespace Cantera {
|
|||
getMap(sIsNode, msIs);
|
||||
map<std::string,std::string>::const_iterator _b = msIs.begin();
|
||||
for (; _b != msIs.end(); ++_b) {
|
||||
int kk = speciesIndex(_b->first);
|
||||
if (kk < 0) {
|
||||
//throw CanteraError(
|
||||
// "DebyeHuckel::initThermoXML error",
|
||||
// "no species match was found"
|
||||
// );
|
||||
} else {
|
||||
double val = fpValue(_b->second);
|
||||
m_speciesCharge_Stoich[kk] = val;
|
||||
}
|
||||
size_t kk = speciesIndex(_b->first);
|
||||
double val = fpValue(_b->second);
|
||||
m_speciesCharge_Stoich[kk] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1580,13 +1567,10 @@ namespace Cantera {
|
|||
map<std::string,std::string>::const_iterator _b = msEST.begin();
|
||||
for (; _b != msEST.end(); ++_b) {
|
||||
int kk = speciesIndex(_b->first);
|
||||
if (kk < 0) {
|
||||
} else {
|
||||
std::string est = _b->second;
|
||||
if ((m_electrolyteSpeciesType[kk] = interp_est(est)) == -1) {
|
||||
throw CanteraError("DebyeHuckel:initThermoXML",
|
||||
"Bad electrolyte type: " + est);
|
||||
}
|
||||
std::string est = _b->second;
|
||||
if ((m_electrolyteSpeciesType[kk] = interp_est(est)) == -1) {
|
||||
throw CanteraError("DebyeHuckel:initThermoXML",
|
||||
"Bad electrolyte type: " + est);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1822,22 +1806,21 @@ namespace Cantera {
|
|||
* Obtain the limits of the temperature from the species
|
||||
* thermo handler's limits.
|
||||
*/
|
||||
int leng = m_kk;
|
||||
m_electrolyteSpeciesType.resize(m_kk, cEST_polarNeutral);
|
||||
m_speciesSize.resize(leng);
|
||||
m_Aionic.resize(leng, 0.0);
|
||||
m_lnActCoeffMolal.resize(leng, 0.0);
|
||||
m_dlnActCoeffMolaldT.resize(leng, 0.0);
|
||||
m_d2lnActCoeffMolaldT2.resize(leng, 0.0);
|
||||
m_dlnActCoeffMolaldP.resize(leng, 0.0);
|
||||
m_B_Dot.resize(leng, 0.0);
|
||||
m_expg0_RT.resize(leng, 0.0);
|
||||
m_pe.resize(leng, 0.0);
|
||||
m_pp.resize(leng, 0.0);
|
||||
m_tmpV.resize(leng, 0.0);
|
||||
m_speciesSize.resize(m_kk);
|
||||
m_Aionic.resize(m_kk, 0.0);
|
||||
m_lnActCoeffMolal.resize(m_kk, 0.0);
|
||||
m_dlnActCoeffMolaldT.resize(m_kk, 0.0);
|
||||
m_d2lnActCoeffMolaldT2.resize(m_kk, 0.0);
|
||||
m_dlnActCoeffMolaldP.resize(m_kk, 0.0);
|
||||
m_B_Dot.resize(m_kk, 0.0);
|
||||
m_expg0_RT.resize(m_kk, 0.0);
|
||||
m_pe.resize(m_kk, 0.0);
|
||||
m_pp.resize(m_kk, 0.0);
|
||||
m_tmpV.resize(m_kk, 0.0);
|
||||
if (m_formDH == DHFORM_BETAIJ ||
|
||||
m_formDH == DHFORM_PITZER_BETAIJ) {
|
||||
m_Beta_ij.resize(leng, leng, 0.0);
|
||||
m_Beta_ij.resize(m_kk, m_kk, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ namespace Cantera {
|
|||
*
|
||||
*/
|
||||
#ifdef USE_DGG_CODE
|
||||
int Elements::elementIndex(std::string name) const{
|
||||
size_t Elements::elementIndex(std::string name) const{
|
||||
map<string, int>::const_iterator it;
|
||||
it = m_definedElements.find(name);
|
||||
if (it != m_definedElements.end()) {
|
||||
|
|
@ -293,8 +293,8 @@ namespace Cantera {
|
|||
return -1;
|
||||
}
|
||||
#else
|
||||
int Elements::elementIndex(std::string name) const {
|
||||
for (int i = 0; i < m_mm; i++) {
|
||||
size_t Elements::elementIndex(std::string name) const {
|
||||
for (size_t i = 0; i < m_mm; i++) {
|
||||
if (m_elementNames[i] == name) return i;
|
||||
}
|
||||
return -1;
|
||||
|
|
@ -307,14 +307,14 @@ namespace Cantera {
|
|||
* index. If m < 0 or m >= nElements() an exception is thrown.
|
||||
*/
|
||||
string Elements::elementName(size_t m) const {
|
||||
if (m < 0 || m >= nElements()) {
|
||||
if (m >= nElements()) {
|
||||
throw ElementRangeError("Elements::elementName", m, nElements());
|
||||
}
|
||||
return m_elementNames[m];
|
||||
}
|
||||
|
||||
|
||||
doublereal Elements::entropyElement298(int m) const {
|
||||
doublereal Elements::entropyElement298(size_t m) const {
|
||||
AssertThrowMsg(m_entropy298[m] != ENTROPY298_UNKNOWN,
|
||||
"Elements::entropy298",
|
||||
"Entropy at 298 K of element is unknown");
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace Cantera {
|
|||
/*!
|
||||
* @param m element index
|
||||
*/
|
||||
doublereal atomicWeight(int m) const { return m_atomicWeights[m]; }
|
||||
doublereal atomicWeight(size_t m) const { return m_atomicWeights[m]; }
|
||||
|
||||
/// Atomic number of element m.
|
||||
/*!
|
||||
|
|
@ -112,7 +112,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param m Element index
|
||||
*/
|
||||
doublereal entropyElement298(int m) const;
|
||||
doublereal entropyElement298(size_t m) const;
|
||||
|
||||
/// vector of element atomic weights
|
||||
const vector_fp& atomicWeights() const { return m_atomicWeights; }
|
||||
|
|
@ -123,7 +123,7 @@ namespace Cantera {
|
|||
* @return
|
||||
* \c int: The number of elements in the object.
|
||||
*/
|
||||
int nElements() const { return m_mm; }
|
||||
size_t nElements() const { return m_mm; }
|
||||
|
||||
//! Function that returns the index of an element.
|
||||
/*!
|
||||
|
|
@ -135,7 +135,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param name String containing the index.
|
||||
*/
|
||||
int elementIndex(std::string name) const;
|
||||
size_t elementIndex(std::string name) const;
|
||||
|
||||
//! Name of the element with index \c m.
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ namespace Cantera {
|
|||
void GibbsExcessVPSSTP::getUnitsStandardConc(double *uA, int k, int sizeUA) const {
|
||||
for (int i = 0; i < sizeUA; i++) {
|
||||
if (i == 0) uA[0] = 1.0;
|
||||
if (i == 1) uA[1] = -nDim();
|
||||
if (i == 1) uA[1] = -int(nDim());
|
||||
if (i == 2) uA[2] = 0.0;
|
||||
if (i == 3) uA[3] = 0.0;
|
||||
if (i == 4) uA[4] = 0.0;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace Cantera {
|
|||
CROP_ln_gamma_k_max(15.0),
|
||||
m_debugCalc(0)
|
||||
{
|
||||
for (int i = 0; i < 17; i++) {
|
||||
for (size_t i = 0; i < 17; i++) {
|
||||
elambda[i] = 0.0;
|
||||
elambda1[i] = 0.0;
|
||||
}
|
||||
|
|
@ -485,10 +485,10 @@ namespace Cantera {
|
|||
|
||||
constructPhaseFile("HMW_NaCl.xml", "");
|
||||
|
||||
int i = speciesIndex("Cl-");
|
||||
int j = speciesIndex("H+");
|
||||
int n = i * m_kk + j;
|
||||
int ct = m_CounterIJ[n];
|
||||
size_t i = speciesIndex("Cl-");
|
||||
size_t j = speciesIndex("H+");
|
||||
size_t n = i * m_kk + j;
|
||||
size_t ct = m_CounterIJ[n];
|
||||
m_Beta0MX_ij[ct] = 0.1775;
|
||||
m_Beta1MX_ij[ct] = 0.2945;
|
||||
m_CphiMX_ij[ct] = 0.0008;
|
||||
|
|
@ -528,7 +528,7 @@ namespace Cantera {
|
|||
|
||||
i = speciesIndex("Cl-");
|
||||
j = speciesIndex("H+");
|
||||
int k = speciesIndex("Na+");
|
||||
size_t k = speciesIndex("Na+");
|
||||
double param = -0.004;
|
||||
n = i * m_kk *m_kk + j * m_kk + k ;
|
||||
m_Psi_ijk[n] = param;
|
||||
|
|
@ -990,7 +990,7 @@ namespace Cantera {
|
|||
void HMWSoln::getUnitsStandardConc(double *uA, int k, int sizeUA) const {
|
||||
for (int i = 0; i < sizeUA; i++) {
|
||||
if (i == 0) uA[0] = 1.0;
|
||||
if (i == 1) uA[1] = -nDim();
|
||||
if (i == 1) uA[1] = -int(nDim());
|
||||
if (i == 2) uA[2] = 0.0;
|
||||
if (i == 3) uA[3] = 0.0;
|
||||
if (i == 4) uA[4] = 0.0;
|
||||
|
|
@ -1656,19 +1656,18 @@ namespace Cantera {
|
|||
* Resize lengths equal to the number of species in
|
||||
* the phase.
|
||||
*/
|
||||
int leng = m_kk;
|
||||
m_electrolyteSpeciesType.resize(m_kk, cEST_polarNeutral);
|
||||
m_speciesSize.resize(leng);
|
||||
m_speciesCharge_Stoich.resize(leng, 0.0);
|
||||
m_Aionic.resize(leng, 0.0);
|
||||
m_speciesSize.resize(m_kk);
|
||||
m_speciesCharge_Stoich.resize(m_kk, 0.0);
|
||||
m_Aionic.resize(m_kk, 0.0);
|
||||
|
||||
m_expg0_RT.resize(leng, 0.0);
|
||||
m_pe.resize(leng, 0.0);
|
||||
m_pp.resize(leng, 0.0);
|
||||
m_tmpV.resize(leng, 0.0);
|
||||
m_molalitiesCropped.resize(leng, 0.0);
|
||||
m_expg0_RT.resize(m_kk, 0.0);
|
||||
m_pe.resize(m_kk, 0.0);
|
||||
m_pp.resize(m_kk, 0.0);
|
||||
m_tmpV.resize(m_kk, 0.0);
|
||||
m_molalitiesCropped.resize(m_kk, 0.0);
|
||||
|
||||
int maxCounterIJlen = 1 + (leng-1) * (leng-2) / 2;
|
||||
size_t maxCounterIJlen = 1 + (m_kk-1) * (m_kk-2) / 2;
|
||||
|
||||
/*
|
||||
* Figure out the size of the temperature coefficient
|
||||
|
|
@ -1713,34 +1712,34 @@ namespace Cantera {
|
|||
m_Theta_ij_P.resize(maxCounterIJlen, 0.0);
|
||||
m_Theta_ij_coeff.resize(TCoeffLength, maxCounterIJlen, 0.0);
|
||||
|
||||
int n = m_kk*m_kk*m_kk;
|
||||
m_Psi_ijk.resize(m_kk*m_kk*m_kk, 0.0);
|
||||
m_Psi_ijk_L.resize(m_kk*m_kk*m_kk, 0.0);
|
||||
m_Psi_ijk_LL.resize(m_kk*m_kk*m_kk, 0.0);
|
||||
m_Psi_ijk_P.resize(m_kk*m_kk*m_kk, 0.0);
|
||||
size_t n = m_kk*m_kk*m_kk;
|
||||
m_Psi_ijk.resize(n, 0.0);
|
||||
m_Psi_ijk_L.resize(n, 0.0);
|
||||
m_Psi_ijk_LL.resize(n, 0.0);
|
||||
m_Psi_ijk_P.resize(n, 0.0);
|
||||
m_Psi_ijk_coeff.resize(TCoeffLength, n, 0.0);
|
||||
|
||||
m_Lambda_nj.resize(leng, leng, 0.0);
|
||||
m_Lambda_nj_L.resize(leng, leng, 0.0);
|
||||
m_Lambda_nj_LL.resize(leng, leng, 0.0);
|
||||
m_Lambda_nj_P.resize(leng, leng, 0.0);
|
||||
m_Lambda_nj_coeff.resize(TCoeffLength, leng * leng, 0.0);
|
||||
m_Lambda_nj.resize(m_kk, m_kk, 0.0);
|
||||
m_Lambda_nj_L.resize(m_kk, m_kk, 0.0);
|
||||
m_Lambda_nj_LL.resize(m_kk, m_kk, 0.0);
|
||||
m_Lambda_nj_P.resize(m_kk, m_kk, 0.0);
|
||||
m_Lambda_nj_coeff.resize(TCoeffLength, m_kk * m_kk, 0.0);
|
||||
|
||||
m_Mu_nnn.resize(leng, 0.0);
|
||||
m_Mu_nnn_L.resize(leng, 0.0);
|
||||
m_Mu_nnn_LL.resize(leng, 0.0);
|
||||
m_Mu_nnn_P.resize(leng, 0.0);
|
||||
m_Mu_nnn_coeff.resize(TCoeffLength, leng, 0.0);
|
||||
m_Mu_nnn.resize(m_kk, 0.0);
|
||||
m_Mu_nnn_L.resize(m_kk, 0.0);
|
||||
m_Mu_nnn_LL.resize(m_kk, 0.0);
|
||||
m_Mu_nnn_P.resize(m_kk, 0.0);
|
||||
m_Mu_nnn_coeff.resize(TCoeffLength, m_kk, 0.0);
|
||||
|
||||
m_lnActCoeffMolal_Scaled.resize(leng, 0.0);
|
||||
m_dlnActCoeffMolaldT_Scaled.resize(leng, 0.0);
|
||||
m_d2lnActCoeffMolaldT2_Scaled.resize(leng, 0.0);
|
||||
m_dlnActCoeffMolaldP_Scaled.resize(leng, 0.0);
|
||||
m_lnActCoeffMolal_Scaled.resize(m_kk, 0.0);
|
||||
m_dlnActCoeffMolaldT_Scaled.resize(m_kk, 0.0);
|
||||
m_d2lnActCoeffMolaldT2_Scaled.resize(m_kk, 0.0);
|
||||
m_dlnActCoeffMolaldP_Scaled.resize(m_kk, 0.0);
|
||||
|
||||
m_lnActCoeffMolal_Unscaled.resize(leng, 0.0);
|
||||
m_dlnActCoeffMolaldT_Unscaled.resize(leng, 0.0);
|
||||
m_d2lnActCoeffMolaldT2_Unscaled.resize(leng, 0.0);
|
||||
m_dlnActCoeffMolaldP_Unscaled.resize(leng, 0.0);
|
||||
m_lnActCoeffMolal_Unscaled.resize(m_kk, 0.0);
|
||||
m_dlnActCoeffMolaldT_Unscaled.resize(m_kk, 0.0);
|
||||
m_d2lnActCoeffMolaldT2_Unscaled.resize(m_kk, 0.0);
|
||||
m_dlnActCoeffMolaldP_Unscaled.resize(m_kk, 0.0);
|
||||
|
||||
m_CounterIJ.resize(m_kk*m_kk, 0);
|
||||
|
||||
|
|
@ -1774,7 +1773,7 @@ namespace Cantera {
|
|||
m_CMX_IJ_LL.resize(maxCounterIJlen, 0.0);
|
||||
m_CMX_IJ_P.resize(maxCounterIJlen, 0.0);
|
||||
|
||||
m_gamma_tmp.resize(leng, 0.0);
|
||||
m_gamma_tmp.resize(m_kk, 0.0);
|
||||
|
||||
IMS_lnActCoeffMolal_.resize(m_kk, 0.0);
|
||||
CROP_speciesCropped_.resize(m_kk, 0);
|
||||
|
|
@ -2051,7 +2050,7 @@ namespace Cantera {
|
|||
* m_Counter[n] = counter
|
||||
*/
|
||||
void HMWSoln::counterIJ_setup(void) const {
|
||||
int n, nc, i, j;
|
||||
size_t n, nc, i, j;
|
||||
m_CounterIJ.resize(m_kk * m_kk);
|
||||
int counter = 0;
|
||||
for (i = 0; i < m_kk; i++) {
|
||||
|
|
@ -2088,7 +2087,7 @@ namespace Cantera {
|
|||
*/
|
||||
void HMWSoln::s_updatePitzer_CoeffWRTemp(int doDerivs) const {
|
||||
|
||||
int i, j, n, counterIJ;
|
||||
size_t i, j, n, counterIJ;
|
||||
const double *beta0MX_coeff;
|
||||
const double *beta1MX_coeff;
|
||||
const double *beta2MX_coeff;
|
||||
|
|
@ -2447,7 +2446,7 @@ namespace Cantera {
|
|||
double sum_m_phi_minus_1, osmotic_coef, lnwateract;
|
||||
|
||||
int z1, z2;
|
||||
int n, i, j, k, m, counterIJ, counterIJ2;
|
||||
size_t n, i, j, k, m, counterIJ, counterIJ2;
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
if (m_debugCalc) {
|
||||
|
|
@ -2942,10 +2941,10 @@ namespace Cantera {
|
|||
/*
|
||||
* Zeta interaction term
|
||||
*/
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
if (charge[k] < 0.0) {
|
||||
int izeta = j;
|
||||
int jzeta = i;
|
||||
size_t izeta = j;
|
||||
size_t jzeta = i;
|
||||
n = izeta * m_kk * m_kk + jzeta * m_kk + k;
|
||||
double zeta = psi_ijk[n];
|
||||
if (zeta != 0.0) {
|
||||
|
|
@ -3114,11 +3113,11 @@ namespace Cantera {
|
|||
/*
|
||||
* Zeta interaction term
|
||||
*/
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
if (charge[k] > 0.0) {
|
||||
int izeta = j;
|
||||
int jzeta = k;
|
||||
int kzeta = i;
|
||||
size_t izeta = j;
|
||||
size_t jzeta = k;
|
||||
size_t kzeta = i;
|
||||
n = izeta * m_kk * m_kk + jzeta * m_kk + kzeta;
|
||||
double zeta = psi_ijk[n];
|
||||
if (zeta != 0.0) {
|
||||
|
|
@ -3333,10 +3332,10 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
if (charge[k] < 0.0) {
|
||||
int izeta = j;
|
||||
size_t izeta = j;
|
||||
for (m = 1; m < m_kk; m++) {
|
||||
if (charge[m] > 0.0) {
|
||||
int jzeta = m;
|
||||
size_t jzeta = m;
|
||||
n = k + jzeta * m_kk + izeta * m_kk * m_kk;
|
||||
double zeta = psi_ijk[n];
|
||||
if (zeta != 0.0) {
|
||||
|
|
@ -3524,7 +3523,7 @@ namespace Cantera {
|
|||
double sum_m_phi_minus_1, d_osmotic_coef_dT, d_lnwateract_dT;
|
||||
|
||||
int z1, z2;
|
||||
int n, i, j, k, m, counterIJ, counterIJ2;
|
||||
size_t n, i, j, k, m, counterIJ, counterIJ2;
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
if (m_debugCalc) {
|
||||
|
|
@ -3938,10 +3937,10 @@ namespace Cantera {
|
|||
/*
|
||||
* Zeta interaction term
|
||||
*/
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
if (charge[k] < 0.0) {
|
||||
int izeta = j;
|
||||
int jzeta = i;
|
||||
size_t izeta = j;
|
||||
size_t jzeta = i;
|
||||
n = izeta * m_kk * m_kk + jzeta * m_kk + k;
|
||||
double zeta_L = psi_ijk_L[n];
|
||||
if (zeta_L != 0.0) {
|
||||
|
|
@ -4034,11 +4033,11 @@ namespace Cantera {
|
|||
*/
|
||||
if (charge[j] == 0.0) {
|
||||
sum5 = sum5 + molality[j]*2.0*m_Lambda_nj_L(j,i);
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
if (charge[k] > 0.0) {
|
||||
int izeta = j;
|
||||
int jzeta = k;
|
||||
int kzeta = i;
|
||||
size_t izeta = j;
|
||||
size_t jzeta = k;
|
||||
size_t kzeta = i;
|
||||
n = izeta * m_kk * m_kk + jzeta * m_kk + kzeta;
|
||||
double zeta_L = psi_ijk_L[n];
|
||||
if (zeta_L != 0.0) {
|
||||
|
|
@ -4215,10 +4214,10 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
if (charge[k] < 0.0) {
|
||||
int izeta = j;
|
||||
size_t izeta = j;
|
||||
for (m = 1; m < m_kk; m++) {
|
||||
if (charge[m] > 0.0) {
|
||||
int jzeta = m;
|
||||
size_t jzeta = m;
|
||||
n = k + jzeta * m_kk + izeta * m_kk * m_kk;
|
||||
double zeta_L = psi_ijk_L[n];
|
||||
if (zeta_L != 0.0) {
|
||||
|
|
@ -4397,7 +4396,7 @@ namespace Cantera {
|
|||
double sum_m_phi_minus_1, d2_osmotic_coef_dT2, d2_lnwateract_dT2;
|
||||
|
||||
int z1, z2;
|
||||
int n, i, j, k, m, counterIJ, counterIJ2;
|
||||
size_t n, i, j, k, m, counterIJ, counterIJ2;
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
if (m_debugCalc) {
|
||||
|
|
@ -4818,10 +4817,10 @@ namespace Cantera {
|
|||
/*
|
||||
* Zeta interaction term
|
||||
*/
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
if (charge[k] < 0.0) {
|
||||
int izeta = j;
|
||||
int jzeta = i;
|
||||
size_t izeta = j;
|
||||
size_t jzeta = i;
|
||||
n = izeta * m_kk * m_kk + jzeta * m_kk + k;
|
||||
double zeta_LL = psi_ijk_LL[n];
|
||||
if (zeta_LL != 0.0) {
|
||||
|
|
@ -4918,11 +4917,11 @@ namespace Cantera {
|
|||
/*
|
||||
* Zeta interaction term
|
||||
*/
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
if (charge[k] > 0.0) {
|
||||
int izeta = j;
|
||||
int jzeta = k;
|
||||
int kzeta = i;
|
||||
size_t izeta = j;
|
||||
size_t jzeta = k;
|
||||
size_t kzeta = i;
|
||||
n = izeta * m_kk * m_kk + jzeta * m_kk + kzeta;
|
||||
double zeta_LL = psi_ijk_LL[n];
|
||||
if (zeta_LL != 0.0) {
|
||||
|
|
@ -5098,10 +5097,10 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
if (charge[k] < 0.0) {
|
||||
int izeta = j;
|
||||
size_t izeta = j;
|
||||
for (m = 1; m < m_kk; m++) {
|
||||
if (charge[m] > 0.0) {
|
||||
int jzeta = m;
|
||||
size_t jzeta = m;
|
||||
n = k + jzeta * m_kk + izeta * m_kk * m_kk;
|
||||
double zeta_LL = psi_ijk_LL[n];
|
||||
if (zeta_LL != 0.0) {
|
||||
|
|
@ -5181,7 +5180,7 @@ namespace Cantera {
|
|||
s_updatePitzer_dlnMolalityActCoeff_dP();
|
||||
|
||||
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
if (CROP_speciesCropped_[k] == 2) {
|
||||
m_dlnActCoeffMolaldP_Unscaled[k] = 0.0;
|
||||
}
|
||||
|
|
@ -5278,7 +5277,7 @@ namespace Cantera {
|
|||
double sum_m_phi_minus_1, d_osmotic_coef_dP, d_lnwateract_dP;
|
||||
|
||||
int z1, z2;
|
||||
int n, i, j, k, m, counterIJ, counterIJ2;
|
||||
size_t n, i, j, k, m, counterIJ, counterIJ2;
|
||||
|
||||
double currTemp = temperature();
|
||||
double currPres = pressure();
|
||||
|
|
@ -5696,10 +5695,10 @@ namespace Cantera {
|
|||
/*
|
||||
* Zeta interaction term
|
||||
*/
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
if (charge[k] < 0.0) {
|
||||
int izeta = j;
|
||||
int jzeta = i;
|
||||
size_t izeta = j;
|
||||
size_t jzeta = i;
|
||||
n = izeta * m_kk * m_kk + jzeta * m_kk + k;
|
||||
double zeta_P = psi_ijk_P[n];
|
||||
if (zeta_P != 0.0) {
|
||||
|
|
@ -5798,11 +5797,11 @@ namespace Cantera {
|
|||
/*
|
||||
* Zeta interaction term
|
||||
*/
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
if (charge[k] > 0.0) {
|
||||
int izeta = j;
|
||||
int jzeta = k;
|
||||
int kzeta = i;
|
||||
size_t izeta = j;
|
||||
size_t jzeta = k;
|
||||
size_t kzeta = i;
|
||||
n = izeta * m_kk * m_kk + jzeta * m_kk + kzeta;
|
||||
double zeta_P = psi_ijk_P[n];
|
||||
if (zeta_P != 0.0) {
|
||||
|
|
@ -5978,10 +5977,10 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
if (charge[k] < 0.0) {
|
||||
int izeta = j;
|
||||
size_t izeta = j;
|
||||
for (m = 1; m < m_kk; m++) {
|
||||
if (charge[m] > 0.0) {
|
||||
int jzeta = m;
|
||||
size_t jzeta = m;
|
||||
n = k + jzeta * m_kk + izeta * m_kk * m_kk;
|
||||
double zeta_P = psi_ijk_P[n];
|
||||
if (zeta_P != 0.0) {
|
||||
|
|
@ -6291,7 +6290,7 @@ namespace Cantera {
|
|||
* current mechanism
|
||||
*/
|
||||
void HMWSoln::printCoeffs() const {
|
||||
int i, j, k;
|
||||
size_t i, j, k;
|
||||
std::string sni, snj;
|
||||
calcMolalities();
|
||||
const double *charge = DATA_PTR(m_speciesCharge);
|
||||
|
|
@ -6317,8 +6316,8 @@ namespace Cantera {
|
|||
sni = speciesName(i);
|
||||
for (j = i+1; j < m_kk; j++) {
|
||||
snj = speciesName(j);
|
||||
int n = i * m_kk + j;
|
||||
int ct = m_CounterIJ[n];
|
||||
size_t n = i * m_kk + j;
|
||||
size_t ct = m_CounterIJ[n];
|
||||
printf(" %-16s %-16s %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f \n",
|
||||
sni.c_str(), snj.c_str(),
|
||||
m_Beta0MX_ij[ct], m_Beta1MX_ij[ct],
|
||||
|
|
@ -6337,7 +6336,7 @@ namespace Cantera {
|
|||
snj = speciesName(j);
|
||||
for (k = 1; k < m_kk; k++) {
|
||||
std::string snk = speciesName(k);
|
||||
int n = k + j * m_kk + i * m_kk * m_kk;
|
||||
size_t n = k + j * m_kk + i * m_kk * m_kk;
|
||||
if (m_Psi_ijk[n] != 0.0) {
|
||||
printf(" %-16s %-16s %-16s %9.5f \n",
|
||||
sni.c_str(), snj.c_str(),
|
||||
|
|
@ -6363,7 +6362,7 @@ namespace Cantera {
|
|||
doublereal lnGammaClMs2 = s_NBS_CLM_lnMolalityActCoeff();
|
||||
doublereal lnGammaCLMs1 = m_lnActCoeffMolal_Unscaled[m_indexCLM];
|
||||
doublereal afac = -1.0 *(lnGammaClMs2 - lnGammaCLMs1);
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
acMolality[k] *= exp(m_speciesCharge[k] * afac);
|
||||
}
|
||||
}
|
||||
|
|
@ -6384,7 +6383,7 @@ namespace Cantera {
|
|||
doublereal lnGammaClMs2 = s_NBS_CLM_lnMolalityActCoeff();
|
||||
doublereal lnGammaCLMs1 = m_lnActCoeffMolal_Unscaled[m_indexCLM];
|
||||
doublereal afac = -1.0 *(lnGammaClMs2 - lnGammaCLMs1);
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
m_lnActCoeffMolal_Scaled[k] = m_lnActCoeffMolal_Unscaled[k] + m_speciesCharge[k] * afac;
|
||||
}
|
||||
}
|
||||
|
|
@ -6404,7 +6403,7 @@ namespace Cantera {
|
|||
doublereal dlnGammaClM_dT_s2 = s_NBS_CLM_dlnMolalityActCoeff_dT();
|
||||
doublereal dlnGammaCLM_dT_s1 = m_dlnActCoeffMolaldT_Unscaled[m_indexCLM];
|
||||
doublereal afac = -1.0 *(dlnGammaClM_dT_s2 - dlnGammaCLM_dT_s1);
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
m_dlnActCoeffMolaldT_Scaled[k] = m_dlnActCoeffMolaldT_Unscaled[k] + m_speciesCharge[k] * afac;
|
||||
}
|
||||
}
|
||||
|
|
@ -6443,7 +6442,7 @@ namespace Cantera {
|
|||
doublereal dlnGammaClM_dP_s2 = s_NBS_CLM_dlnMolalityActCoeff_dP();
|
||||
doublereal dlnGammaCLM_dP_s1 = m_dlnActCoeffMolaldP_Unscaled[m_indexCLM];
|
||||
doublereal afac = -1.0 *(dlnGammaClM_dP_s2 - dlnGammaCLM_dP_s1);
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
m_dlnActCoeffMolaldP_Scaled[k] = m_dlnActCoeffMolaldP_Unscaled[k] + m_speciesCharge[k] * afac;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,16 +82,16 @@ namespace Cantera {
|
|||
* Find the index of the species in the current phase. It's not
|
||||
* an error to not find the species
|
||||
*/
|
||||
int iSpecies = speciesIndex(iName);
|
||||
if (iSpecies < 0) {
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
string ispName = speciesName(iSpecies);
|
||||
if (charge[iSpecies] <= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLBinarySalt", "cation charge problem");
|
||||
}
|
||||
int jSpecies = speciesIndex(jName);
|
||||
if (jSpecies < 0) {
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
string jspName = speciesName(jSpecies);
|
||||
|
|
@ -99,7 +99,7 @@ namespace Cantera {
|
|||
throw CanteraError("HMWSoln::readXMLBinarySalt", "anion charge problem");
|
||||
}
|
||||
|
||||
int n = iSpecies * m_kk + jSpecies;
|
||||
size_t n = iSpecies * m_kk + jSpecies;
|
||||
int counter = m_CounterIJ[n];
|
||||
int num = BinSalt.nChildren();
|
||||
for (int iChild = 0; iChild < num; iChild++) {
|
||||
|
|
@ -288,22 +288,22 @@ namespace Cantera {
|
|||
* Find the index of the species in the current phase. It's not
|
||||
* an error to not find the species
|
||||
*/
|
||||
int iSpecies = speciesIndex(ispName);
|
||||
if (iSpecies < 0) {
|
||||
size_t iSpecies = speciesIndex(ispName);
|
||||
if (iSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] >= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLThetaAnion", "anion1 charge problem");
|
||||
}
|
||||
int jSpecies = speciesIndex(jspName);
|
||||
if (jSpecies < 0) {
|
||||
size_t jSpecies = speciesIndex(jspName);
|
||||
if (jSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[jSpecies] >= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLThetaAnion", "anion2 charge problem");
|
||||
}
|
||||
|
||||
int n = iSpecies * m_kk + jSpecies;
|
||||
size_t n = iSpecies * m_kk + jSpecies;
|
||||
int counter = m_CounterIJ[n];
|
||||
int num = BinSalt.nChildren();
|
||||
for (int i = 0; i < num; i++) {
|
||||
|
|
@ -375,22 +375,22 @@ namespace Cantera {
|
|||
* Find the index of the species in the current phase. It's not
|
||||
* an error to not find the species
|
||||
*/
|
||||
int iSpecies = speciesIndex(ispName);
|
||||
if (iSpecies < 0) {
|
||||
size_t iSpecies = speciesIndex(ispName);
|
||||
if (iSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] <= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLThetaCation", "cation1 charge problem");
|
||||
}
|
||||
int jSpecies = speciesIndex(jspName);
|
||||
if (jSpecies < 0) {
|
||||
size_t jSpecies = speciesIndex(jspName);
|
||||
if (jSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[jSpecies] <= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLThetaCation", "cation2 charge problem");
|
||||
}
|
||||
|
||||
int n = iSpecies * m_kk + jSpecies;
|
||||
size_t n = iSpecies * m_kk + jSpecies;
|
||||
int counter = m_CounterIJ[n];
|
||||
int num = BinSalt.nChildren();
|
||||
for (int i = 0; i < num; i++) {
|
||||
|
|
@ -466,24 +466,24 @@ namespace Cantera {
|
|||
* Find the index of the species in the current phase. It's not
|
||||
* an error to not find the species
|
||||
*/
|
||||
int kSpecies = speciesIndex(kName);
|
||||
if (kSpecies < 0) {
|
||||
size_t kSpecies = speciesIndex(kName);
|
||||
if (kSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[kSpecies] <= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLPsiCommonCation",
|
||||
"cation charge problem");
|
||||
}
|
||||
int iSpecies = speciesIndex(iName);
|
||||
if (iSpecies < 0) {
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] >= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLPsiCommonCation",
|
||||
"anion1 charge problem");
|
||||
}
|
||||
int jSpecies = speciesIndex(jName);
|
||||
if (jSpecies < 0) {
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[jSpecies] >= 0) {
|
||||
|
|
@ -491,7 +491,7 @@ namespace Cantera {
|
|||
"anion2 charge problem");
|
||||
}
|
||||
|
||||
int n = iSpecies * m_kk + jSpecies;
|
||||
size_t n = iSpecies * m_kk + jSpecies;
|
||||
int counter = m_CounterIJ[n];
|
||||
int num = BinSalt.nChildren();
|
||||
for (int i = 0; i < num; i++) {
|
||||
|
|
@ -612,23 +612,23 @@ namespace Cantera {
|
|||
* Find the index of the species in the current phase. It's not
|
||||
* an error to not find the species
|
||||
*/
|
||||
int kSpecies = speciesIndex(kName);
|
||||
if (kSpecies < 0) {
|
||||
size_t kSpecies = speciesIndex(kName);
|
||||
if (kSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[kSpecies] >= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLPsiCommonAnion", "anion charge problem");
|
||||
}
|
||||
int iSpecies = speciesIndex(iName);
|
||||
if (iSpecies < 0) {
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] <= 0) {
|
||||
throw CanteraError("HMWSoln::readXMLPsiCommonAnion",
|
||||
"cation1 charge problem");
|
||||
}
|
||||
int jSpecies = speciesIndex(jName);
|
||||
if (jSpecies < 0) {
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[jSpecies] <= 0) {
|
||||
|
|
@ -636,7 +636,7 @@ namespace Cantera {
|
|||
"cation2 charge problem");
|
||||
}
|
||||
|
||||
int n = iSpecies * m_kk + jSpecies;
|
||||
size_t n = iSpecies * m_kk + jSpecies;
|
||||
int counter = m_CounterIJ[n];
|
||||
int num = BinSalt.nChildren();
|
||||
for (int i = 0; i < num; i++) {
|
||||
|
|
@ -758,16 +758,16 @@ namespace Cantera {
|
|||
* Find the index of the species in the current phase. It's not
|
||||
* an error to not find the species
|
||||
*/
|
||||
int iSpecies = speciesIndex(iName);
|
||||
if (iSpecies < 0) {
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] != 0) {
|
||||
throw CanteraError("HMWSoln::readXMLLambdaNeutral",
|
||||
"neutral charge problem");
|
||||
}
|
||||
int jSpecies = speciesIndex(jName);
|
||||
if (jSpecies < 0) {
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -777,7 +777,7 @@ namespace Cantera {
|
|||
stemp = xmlChild.name();
|
||||
string nodeName = lowercase(stemp);
|
||||
if (nodeName == "lambda") {
|
||||
int nCount = iSpecies*m_kk + jSpecies;
|
||||
size_t nCount = iSpecies*m_kk + jSpecies;
|
||||
getFloatArray(xmlChild, vParams, false, "", stemp);
|
||||
nParamsFound = vParams.size();
|
||||
if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
|
||||
|
|
@ -841,8 +841,8 @@ namespace Cantera {
|
|||
* Find the index of the species in the current phase. It's not
|
||||
* an error to not find the species
|
||||
*/
|
||||
int iSpecies = speciesIndex(iName);
|
||||
if (iSpecies < 0) {
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] != 0) {
|
||||
|
|
@ -927,24 +927,24 @@ namespace Cantera {
|
|||
* Find the index of the species in the current phase. It's not
|
||||
* an error to not find the species
|
||||
*/
|
||||
int iSpecies = speciesIndex(iName);
|
||||
if (iSpecies < 0) {
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[iSpecies] != 0.0) {
|
||||
throw CanteraError("HMWSoln::readXMLZetaCation", "neutral charge problem");
|
||||
}
|
||||
|
||||
int jSpecies = speciesIndex(jName);
|
||||
if (jSpecies < 0) {
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[jSpecies] <= 0.0) {
|
||||
throw CanteraError("HMWSoln::readXLZetaCation", "cation1 charge problem");
|
||||
}
|
||||
|
||||
int kSpecies = speciesIndex(kName);
|
||||
if (kSpecies < 0) {
|
||||
size_t kSpecies = speciesIndex(kName);
|
||||
if (kSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
if (charge[kSpecies] >= 0.0) {
|
||||
|
|
@ -959,7 +959,7 @@ namespace Cantera {
|
|||
if (nodeName == "zeta") {
|
||||
getFloatArray(xmlChild, vParams, false, "", "zeta");
|
||||
nParamsFound = vParams.size();
|
||||
int n = iSpecies * m_kk *m_kk + jSpecies * m_kk + kSpecies ;
|
||||
size_t n = iSpecies * m_kk *m_kk + jSpecies * m_kk + kSpecies ;
|
||||
|
||||
if (m_formPitzerTemp == PITZER_TEMP_CONSTANT) {
|
||||
if (nParamsFound != 1) {
|
||||
|
|
@ -1494,9 +1494,9 @@ namespace Cantera {
|
|||
string kname, jname;
|
||||
size_t jj = xspecies.size();
|
||||
for (k = 0; k < m_kk; k++) {
|
||||
int jmap = -1;
|
||||
size_t jmap = -1;
|
||||
kname = speciesName(k);
|
||||
for (int j = 0; j < jj; j++) {
|
||||
for (size_t j = 0; j < jj; j++) {
|
||||
const XML_Node& sp = *xspecies[j];
|
||||
jname = sp["name"];
|
||||
if (jname == kname) {
|
||||
|
|
@ -1504,7 +1504,7 @@ namespace Cantera {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (jmap > -1) {
|
||||
if (jmap != -1) {
|
||||
const XML_Node& sp = *xspecies[jmap];
|
||||
getOptionalFloat(sp, "stoichIsMods", m_speciesCharge_Stoich[k]);
|
||||
// if (sp.hasChild("stoichIsMods")) {
|
||||
|
|
@ -1525,13 +1525,8 @@ namespace Cantera {
|
|||
getMap(sIsNode, msIs);
|
||||
map<string,string>::const_iterator _b = msIs.begin();
|
||||
for (; _b != msIs.end(); ++_b) {
|
||||
int kk = speciesIndex(_b->first);
|
||||
if (kk < 0) {
|
||||
//throw CanteraError(
|
||||
// "HMWSoln::initThermo error",
|
||||
// "no species match was found"
|
||||
// );
|
||||
} else {
|
||||
size_t kk = speciesIndex(_b->first);
|
||||
if (kk != -1) {
|
||||
double val = fpValue(_b->second);
|
||||
m_speciesCharge_Stoich[kk] = val;
|
||||
}
|
||||
|
|
@ -1630,9 +1625,8 @@ namespace Cantera {
|
|||
getMap(ESTNode, msEST);
|
||||
map<string,string>::const_iterator _b = msEST.begin();
|
||||
for (; _b != msEST.end(); ++_b) {
|
||||
int kk = speciesIndex(_b->first);
|
||||
if (kk < 0) {
|
||||
} else {
|
||||
size_t kk = speciesIndex(_b->first);
|
||||
if (kk != -1) {
|
||||
string est = _b->second;
|
||||
if ((m_electrolyteSpeciesType[kk] = interp_est(est)) == -1) {
|
||||
throw CanteraError("HMWSoln::initThermoXML",
|
||||
|
|
|
|||
|
|
@ -440,14 +440,13 @@ namespace Cantera {
|
|||
if (tmax > 0.0) m_tmax = tmax;
|
||||
m_p0 = refPressure();
|
||||
|
||||
int leng = m_kk;
|
||||
m_h0_RT.resize(leng);
|
||||
m_g0_RT.resize(leng);
|
||||
m_expg0_RT.resize(leng);
|
||||
m_cp0_R.resize(leng);
|
||||
m_s0_R.resize(leng);
|
||||
m_pe.resize(leng, 0.0);
|
||||
m_pp.resize(leng);
|
||||
m_h0_RT.resize(m_kk);
|
||||
m_g0_RT.resize(m_kk);
|
||||
m_expg0_RT.resize(m_kk);
|
||||
m_cp0_R.resize(m_kk);
|
||||
m_s0_R.resize(m_kk);
|
||||
m_pe.resize(m_kk, 0.0);
|
||||
m_pp.resize(m_kk);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -877,7 +877,7 @@ namespace Cantera {
|
|||
/*!
|
||||
* This member is defined here, from a call to the Elements ojbect, for speed.
|
||||
*/
|
||||
int m_mm;
|
||||
size_t m_mm;
|
||||
|
||||
//! Minimum temperature for valid species standard state thermo props
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ namespace Cantera {
|
|||
} else {
|
||||
for (int i = 0; i < sizeUA; i++) {
|
||||
if (i == 0) uA[0] = 1.0;
|
||||
if (i == 1) uA[1] = -nDim();
|
||||
if (i == 1) uA[1] = -int(nDim());
|
||||
if (i == 2) uA[2] = 0.0;
|
||||
if (i == 3) uA[3] = 0.0;
|
||||
if (i == 4) uA[4] = 0.0;
|
||||
|
|
@ -1254,13 +1254,12 @@ namespace Cantera {
|
|||
* Obtain the limits of the temperature from the species
|
||||
* thermo handler's limits.
|
||||
*/
|
||||
int leng = m_kk;
|
||||
m_expg0_RT.resize(leng);
|
||||
m_pe.resize(leng, 0.0);
|
||||
m_pp.resize(leng);
|
||||
m_speciesMolarVolume.resize(leng);
|
||||
m_tmpV.resize(leng);
|
||||
IMS_lnActCoeffMolal_.resize(leng);
|
||||
m_expg0_RT.resize(m_kk);
|
||||
m_pe.resize(m_kk, 0.0);
|
||||
m_pp.resize(m_kk);
|
||||
m_speciesMolarVolume.resize(m_kk);
|
||||
m_tmpV.resize(m_kk);
|
||||
IMS_lnActCoeffMolal_.resize(m_kk);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -578,7 +578,7 @@ namespace Cantera {
|
|||
} else {
|
||||
for (int i = 0; i < sizeUA; i++) {
|
||||
if (i == 0) uA[0] = 1.0;
|
||||
if (i == 1) uA[1] = -nDim();
|
||||
if (i == 1) uA[1] = -int(nDim());
|
||||
if (i == 2) uA[2] = 0.0;
|
||||
if (i == 3) uA[3] = 0.0;
|
||||
if (i == 4) uA[4] = 0.0;
|
||||
|
|
@ -1279,15 +1279,14 @@ namespace Cantera {
|
|||
*/
|
||||
m_Pref = refPressure();
|
||||
|
||||
int leng = m_kk;
|
||||
m_h0_RT.resize(leng);
|
||||
m_g0_RT.resize(leng);
|
||||
m_expg0_RT.resize(leng);
|
||||
m_cp0_R.resize(leng);
|
||||
m_s0_R.resize(leng);
|
||||
m_pe.resize(leng, 0.0);
|
||||
m_pp.resize(leng);
|
||||
m_speciesMolarVolume.resize(leng);
|
||||
m_h0_RT.resize(m_kk);
|
||||
m_g0_RT.resize(m_kk);
|
||||
m_expg0_RT.resize(m_kk);
|
||||
m_cp0_R.resize(m_kk);
|
||||
m_s0_R.resize(m_kk);
|
||||
m_pe.resize(m_kk, 0.0);
|
||||
m_pp.resize(m_kk);
|
||||
m_speciesMolarVolume.resize(m_kk);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1021,7 +1021,7 @@ namespace Cantera {
|
|||
* m_mm = Number of distinct elements defined in species in this
|
||||
* phase
|
||||
*/
|
||||
int m_mm;
|
||||
size_t m_mm;
|
||||
|
||||
/**
|
||||
* Maximum temperature that this phase can accurately describe
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ namespace Cantera {
|
|||
} else {
|
||||
for (int i = 0; i < sizeUA; i++) {
|
||||
if (i == 0) uA[0] = 1.0;
|
||||
if (i == 1) uA[1] = -nDim();
|
||||
if (i == 1) uA[1] = -int(nDim());
|
||||
if (i == 2) uA[2] = 0.0;
|
||||
if (i == 3) uA[3] = 0.0;
|
||||
if (i == 4) uA[4] = 0.0;
|
||||
|
|
|
|||
|
|
@ -1175,7 +1175,7 @@ namespace Cantera {
|
|||
// been identified.
|
||||
void IonsFromNeutralVPSSTP::initLengths() {
|
||||
m_kk = nSpecies();
|
||||
numNeutralMoleculeSpecies_ = neutralMoleculePhase_->nSpecies();
|
||||
numNeutralMoleculeSpecies_ = neutralMoleculePhase_->nSpecies();
|
||||
moleFractions_.resize(m_kk);
|
||||
fm_neutralMolec_ions_.resize(numNeutralMoleculeSpecies_ * m_kk);
|
||||
fm_invert_ionForNeutral.resize(m_kk);
|
||||
|
|
@ -1233,7 +1233,7 @@ namespace Cantera {
|
|||
* with the correct id.
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id) {
|
||||
int k;
|
||||
size_t k;
|
||||
/*
|
||||
* variables that need to be populated
|
||||
*
|
||||
|
|
@ -1284,12 +1284,12 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
int nElementsN = neutralMoleculePhase_->nElements();
|
||||
size_t nElementsN = neutralMoleculePhase_->nElements();
|
||||
const std::vector<std::string>& elnamesVN = neutralMoleculePhase_->elementNames();
|
||||
std::vector<double> elemVectorN(nElementsN);
|
||||
std::vector<double> elemVectorN_orig(nElementsN);
|
||||
|
||||
int nElementsI = nElements();
|
||||
size_t nElementsI = nElements();
|
||||
const std::vector<std::string>& elnamesVI = elementNames();
|
||||
std::vector<double> elemVectorI(nElementsI);
|
||||
|
||||
|
|
@ -1444,7 +1444,6 @@ namespace Cantera {
|
|||
void IonsFromNeutralVPSSTP::getdlnActCoeff(const doublereal dT, const doublereal * const dX, doublereal *dlnActCoeff) const {
|
||||
int k, icat, jNeut;
|
||||
doublereal fmij;
|
||||
int numNeutMolSpec;
|
||||
/*
|
||||
* Get the activity coefficients of the neutral molecules
|
||||
*/
|
||||
|
|
@ -1456,7 +1455,7 @@ namespace Cantera {
|
|||
return;
|
||||
}
|
||||
|
||||
numNeutMolSpec = geThermo->nSpecies();
|
||||
size_t numNeutMolSpec = geThermo->nSpecies();
|
||||
vector_fp dlnActCoeff_NeutralMolecule(numNeutMolSpec);
|
||||
vector_fp dX_NeutralMolecule(numNeutMolSpec);
|
||||
|
||||
|
|
|
|||
|
|
@ -782,13 +782,13 @@ namespace Cantera {
|
|||
* This is equal to the number of species in the
|
||||
* neutralMoleculePhase_ ThermoPhase.
|
||||
*/
|
||||
int numNeutralMoleculeSpecies_;
|
||||
size_t numNeutralMoleculeSpecies_;
|
||||
|
||||
//! Index of special species
|
||||
int indexSpecialSpecies_;
|
||||
size_t indexSpecialSpecies_;
|
||||
|
||||
//! Index of special species
|
||||
int indexSecondSpecialSpecies_;
|
||||
size_t indexSecondSpecialSpecies_;
|
||||
|
||||
//! Formula Matrix for composition of neutral molecules
|
||||
//! in terms of the molecules in this ThermoPhase
|
||||
|
|
|
|||
|
|
@ -199,11 +199,10 @@ namespace Cantera {
|
|||
if (tmax > 0.0) m_tmax = tmax;
|
||||
m_p0 = refPressure();
|
||||
|
||||
int leng = m_kk;
|
||||
m_h0_RT.resize(leng);
|
||||
m_g0_RT.resize(leng);
|
||||
m_cp0_R.resize(leng);
|
||||
m_s0_R.resize(leng);
|
||||
m_h0_RT.resize(m_kk);
|
||||
m_g0_RT.resize(m_kk);
|
||||
m_cp0_R.resize(m_kk);
|
||||
m_s0_R.resize(m_kk);
|
||||
setMolarDensity(m_molar_density);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -762,7 +762,7 @@ namespace Cantera {
|
|||
protected:
|
||||
|
||||
//! Number of elements
|
||||
int m_mm;
|
||||
size_t m_mm;
|
||||
|
||||
//! Minimum temperature for valid species standard state thermo props
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -75,8 +75,7 @@ namespace Cantera {
|
|||
enthalpy_mole() const {
|
||||
_updateThermo();
|
||||
doublereal ndens, sum = 0.0;
|
||||
int n;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
ndens = m_lattice[n]->molarDensity();
|
||||
sum += ndens * m_lattice[n]->enthalpy_mole();
|
||||
}
|
||||
|
|
@ -86,8 +85,7 @@ namespace Cantera {
|
|||
doublereal LatticeSolidPhase::intEnergy_mole() const {
|
||||
_updateThermo();
|
||||
doublereal ndens, sum = 0.0;
|
||||
int n;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
ndens = m_lattice[n]->molarDensity();
|
||||
sum += ndens * m_lattice[n]->intEnergy_mole();
|
||||
}
|
||||
|
|
@ -97,8 +95,7 @@ namespace Cantera {
|
|||
doublereal LatticeSolidPhase::entropy_mole() const {
|
||||
_updateThermo();
|
||||
doublereal ndens, sum = 0.0;
|
||||
int n;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
ndens = m_lattice[n]->molarDensity();
|
||||
sum += ndens * m_lattice[n]->entropy_mole();
|
||||
}
|
||||
|
|
@ -108,8 +105,7 @@ namespace Cantera {
|
|||
doublereal LatticeSolidPhase::gibbs_mole() const {
|
||||
_updateThermo();
|
||||
doublereal ndens, sum = 0.0;
|
||||
int n;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
ndens = m_lattice[n]->molarDensity();
|
||||
sum += ndens * m_lattice[n]->gibbs_mole();
|
||||
}
|
||||
|
|
@ -119,8 +115,7 @@ namespace Cantera {
|
|||
doublereal LatticeSolidPhase::cp_mole() const {
|
||||
_updateThermo();
|
||||
doublereal ndens, sum = 0.0;
|
||||
int n;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
ndens = m_lattice[n]->molarDensity();
|
||||
sum += ndens * m_lattice[n]->cp_mole();
|
||||
}
|
||||
|
|
@ -129,16 +124,15 @@ namespace Cantera {
|
|||
|
||||
void LatticeSolidPhase::getActivityConcentrations(doublereal* c) const {
|
||||
_updateThermo();
|
||||
int n;
|
||||
int strt = 0;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
size_t strt = 0;
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
m_lattice[n]->getMoleFractions(c+strt);
|
||||
strt += m_lattice[n]->nSpecies();
|
||||
}
|
||||
}
|
||||
|
||||
void LatticeSolidPhase::getActivityCoefficients(doublereal* ac) const {
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
ac[k] = 1.0;
|
||||
}
|
||||
}
|
||||
|
|
@ -153,10 +147,9 @@ namespace Cantera {
|
|||
|
||||
void LatticeSolidPhase::getChemPotentials(doublereal* mu) const {
|
||||
_updateThermo();
|
||||
int n;
|
||||
int strt = 0;
|
||||
size_t strt = 0;
|
||||
double dratio;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
dratio = m_lattice[n]->molarDensity()/molarDensity();
|
||||
m_lattice[n]->getChemPotentials(mu+strt);
|
||||
scale(mu + strt, mu + strt + m_lattice[n]->nSpecies(), mu + strt, dratio);
|
||||
|
|
@ -166,10 +159,9 @@ namespace Cantera {
|
|||
|
||||
void LatticeSolidPhase::getStandardChemPotentials(doublereal* mu0) const {
|
||||
_updateThermo();
|
||||
int n;
|
||||
int strt = 0;
|
||||
size_t strt = 0;
|
||||
double dratio;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
dratio = m_lattice[n]->molarDensity()/molarDensity();
|
||||
m_lattice[n]->getStandardChemPotentials(mu0+strt);
|
||||
scale(mu0 + strt, mu0 + strt + m_lattice[n]->nSpecies(), mu0 + strt, dratio);
|
||||
|
|
@ -181,13 +173,13 @@ namespace Cantera {
|
|||
m_kk = nSpecies();
|
||||
m_mm = nElements();
|
||||
m_x.resize(m_kk);
|
||||
int n, nsp, k, loc = 0;
|
||||
size_t nsp, loc = 0;
|
||||
doublereal ndens;
|
||||
m_molar_density = 0.0;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
nsp = m_lattice[n]->nSpecies();
|
||||
ndens = m_lattice[n]->molarDensity();
|
||||
for (k = 0; k < nsp; k++) {
|
||||
for (size_t k = 0; k < nsp; k++) {
|
||||
m_x[loc] = ndens * m_lattice[n]->moleFraction(k);
|
||||
loc++;
|
||||
}
|
||||
|
|
@ -234,10 +226,9 @@ namespace Cantera {
|
|||
// +fp2str(m_molar_density)+" to "+fp2str(molarDensity()));
|
||||
//}
|
||||
if (m_tlast != tnow) {
|
||||
int n;
|
||||
getMoleFractions(DATA_PTR(m_x));
|
||||
int strt = 0;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
size_t strt = 0;
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
m_lattice[n]->setTemperature(tnow);
|
||||
m_lattice[n]->setMoleFractions(DATA_PTR(m_x) + strt);
|
||||
m_lattice[n]->setPressure(m_press);
|
||||
|
|
@ -247,15 +238,14 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
void LatticeSolidPhase::setLatticeMoleFractions(int nn,
|
||||
string x) {
|
||||
void LatticeSolidPhase::setLatticeMoleFractions(int nn, string x) {
|
||||
m_lattice[nn]->setMoleFractionsByName(x);
|
||||
int n, k, loc=0, nsp;
|
||||
size_t loc=0, nsp;
|
||||
doublereal ndens;
|
||||
for (n = 0; n < m_nlattice; n++) {
|
||||
for (size_t n = 0; n < m_nlattice; n++) {
|
||||
nsp = m_lattice[n]->nSpecies();
|
||||
ndens = m_lattice[n]->molarDensity();
|
||||
for (k = 0; k < nsp; k++) {
|
||||
for (size_t k = 0; k < nsp; k++) {
|
||||
m_x[loc] = ndens * m_lattice[n]->moleFraction(k);
|
||||
loc++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,16 +177,16 @@ namespace Cantera {
|
|||
m_SE_d_ij[0] = 0.0;
|
||||
|
||||
|
||||
int iLiCl = speciesIndex("LiCl(L)");
|
||||
if (iLiCl < 0) {
|
||||
size_t iLiCl = speciesIndex("LiCl(L)");
|
||||
if (iLiCl == -1) {
|
||||
throw CanteraError("MargulesVPSSTP test1 constructor",
|
||||
"Unable to find LiCl(L)");
|
||||
}
|
||||
m_pSpecies_B_ij[0] = iLiCl;
|
||||
|
||||
|
||||
int iKCl = speciesIndex("KCl(L)");
|
||||
if (iKCl < 0) {
|
||||
size_t iKCl = speciesIndex("KCl(L)");
|
||||
if (iKCl == -1) {
|
||||
throw CanteraError("MargulesVPSSTP test1 constructor",
|
||||
"Unable to find KCl(L)");
|
||||
}
|
||||
|
|
@ -987,16 +987,16 @@ namespace Cantera {
|
|||
* Find the index of the species in the current phase. It's not
|
||||
* an error to not find the species
|
||||
*/
|
||||
int iSpecies = speciesIndex(iName);
|
||||
if (iSpecies < 0) {
|
||||
size_t iSpecies = speciesIndex(iName);
|
||||
if (iSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
string ispName = speciesName(iSpecies);
|
||||
if (charge[iSpecies] != 0) {
|
||||
throw CanteraError("MargulesVPSSTP::readXMLBinarySpecies", "speciesA charge problem");
|
||||
}
|
||||
int jSpecies = speciesIndex(jName);
|
||||
if (jSpecies < 0) {
|
||||
size_t jSpecies = speciesIndex(jName);
|
||||
if (jSpecies == -1) {
|
||||
return;
|
||||
}
|
||||
string jspName = speciesName(jSpecies);
|
||||
|
|
|
|||
|
|
@ -856,14 +856,14 @@ namespace Cantera {
|
|||
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
||||
* This vector identifies species A.
|
||||
*/
|
||||
vector_int m_pSpecies_A_ij;
|
||||
std::vector<size_t> m_pSpecies_A_ij;
|
||||
|
||||
//! vector of species indices representing species B in the interaction
|
||||
/*!
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
||||
* This vector identifies species B.
|
||||
*/
|
||||
vector_int m_pSpecies_B_ij;
|
||||
std::vector<size_t> m_pSpecies_B_ij;
|
||||
|
||||
//! form of the Margules interaction expression
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -539,8 +539,8 @@ namespace Cantera {
|
|||
throw CanteraError("LookupGe", "element " + s + " not found");
|
||||
return -1.0;
|
||||
#else
|
||||
int iE = elementIndex(elemName);
|
||||
if (iE < 0) {
|
||||
size_t iE = elementIndex(elemName);
|
||||
if (iE == -1) {
|
||||
throw CanteraError("PDSS_HKFT::LookupGe", "element " + elemName + " not found");
|
||||
}
|
||||
doublereal geValue = entropyElement298(iE);
|
||||
|
|
@ -557,13 +557,12 @@ namespace Cantera {
|
|||
/*
|
||||
* Ok let's get the element compositions and conversion factors.
|
||||
*/
|
||||
int ne = nElements();
|
||||
doublereal na;
|
||||
doublereal ge;
|
||||
string ename;
|
||||
|
||||
doublereal totalSum = 0.0;
|
||||
for (int m = 0; m < ne; m++) {
|
||||
for (size_t m = 0; m < nElements(); m++) {
|
||||
na = nAtoms(0, m);
|
||||
if (na > 0.0) {
|
||||
ename = elementName(m);
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ namespace Cantera {
|
|||
double xmolS = mf[m_indexSolvent];
|
||||
double xmolSmin = max(xmolS, m_xmolSolventMIN);
|
||||
compositionMap::iterator p;
|
||||
for (int k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
p = mMap.find(speciesName(k));
|
||||
if (p != mMap.end()) {
|
||||
x = mMap[speciesName(k)];
|
||||
|
|
@ -319,12 +319,12 @@ namespace Cantera {
|
|||
/*
|
||||
* check charge neutrality
|
||||
*/
|
||||
int largePos = -1;
|
||||
size_t largePos = -1;
|
||||
double cPos = 0.0;
|
||||
int largeNeg = -1;
|
||||
size_t largeNeg = -1;
|
||||
double cNeg = 0.0;
|
||||
double sum = 0.0;
|
||||
for (int k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
double ch = charge(k);
|
||||
if (mf[k] > 0.0) {
|
||||
if (ch > 0.0) {
|
||||
|
|
@ -361,11 +361,11 @@ namespace Cantera {
|
|||
|
||||
}
|
||||
sum = 0.0;
|
||||
for (int k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
sum += mf[k];
|
||||
}
|
||||
sum = 1.0/sum;
|
||||
for (int k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
mf[k] *= sum;
|
||||
}
|
||||
setMoleFractions(DATA_PTR(mf));
|
||||
|
|
@ -384,8 +384,7 @@ namespace Cantera {
|
|||
*/
|
||||
void MolalityVPSSTP::setMolalitiesByName(const std::string& x) {
|
||||
compositionMap xx;
|
||||
int kk = nSpecies();
|
||||
for (int k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < nSpecies(); k++) {
|
||||
xx[speciesName(k)] = -1.0;
|
||||
}
|
||||
parseCompString(x, xx);
|
||||
|
|
@ -565,7 +564,7 @@ namespace Cantera {
|
|||
void MolalityVPSSTP::getUnitsStandardConc(double *uA, int k, int sizeUA) const {
|
||||
for (int i = 0; i < sizeUA; i++) {
|
||||
if (i == 0) uA[0] = 1.0;
|
||||
if (i == 1) uA[1] = -nDim();
|
||||
if (i == 1) uA[1] = -int(nDim());
|
||||
if (i == 2) uA[2] = 0.0;
|
||||
if (i == 3) uA[3] = 0.0;
|
||||
if (i == 4) uA[4] = 0.0;
|
||||
|
|
@ -687,13 +686,13 @@ namespace Cantera {
|
|||
* must be named "Cl-". It must consist of exactly one Cl and one E
|
||||
* atom.
|
||||
*/
|
||||
int MolalityVPSSTP::findCLMIndex() const {
|
||||
int indexCLM = -1;
|
||||
int eCl = -1;
|
||||
int eE = -1;
|
||||
int ne= nElements();
|
||||
size_t MolalityVPSSTP::findCLMIndex() const {
|
||||
size_t indexCLM = -1;
|
||||
size_t eCl = -1;
|
||||
size_t eE = -1;
|
||||
size_t ne = nElements();
|
||||
string sn;
|
||||
for (int e = 0; e < ne; e++) {
|
||||
for (size_t e = 0; e < ne; e++) {
|
||||
sn = elementName(e);
|
||||
if (sn == "Cl" || sn == "CL") {
|
||||
eCl = e;
|
||||
|
|
@ -704,7 +703,7 @@ namespace Cantera {
|
|||
if (eCl == -1) {
|
||||
return -1;
|
||||
}
|
||||
for (int e = 0; e < ne; e++) {
|
||||
for (size_t e = 0; e < ne; e++) {
|
||||
sn = elementName(e);
|
||||
if (sn == "E" || sn == "e") {
|
||||
eE = e;
|
||||
|
|
@ -715,7 +714,7 @@ namespace Cantera {
|
|||
if (eE == -1) {
|
||||
return -1;
|
||||
}
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
doublereal nCl = nAtoms(k, eCl);
|
||||
if (nCl != 1.0) {
|
||||
continue;
|
||||
|
|
@ -724,7 +723,7 @@ namespace Cantera {
|
|||
if (nE != 1.0) {
|
||||
continue;
|
||||
}
|
||||
for (int e = 0; e < ne; e++) {
|
||||
for (size_t e = 0; e < ne; e++) {
|
||||
if (e != eE && e != eCl) {
|
||||
doublereal nA = nAtoms(k, e);
|
||||
if (nA != 0.0) {
|
||||
|
|
@ -802,7 +801,7 @@ namespace Cantera {
|
|||
sprintf(p, " potential %12.6g V\n", phi);
|
||||
s += p;
|
||||
|
||||
int kk = nSpecies();
|
||||
size_t kk = nSpecies();
|
||||
array_fp x(kk);
|
||||
array_fp molal(kk);
|
||||
array_fp mu(kk);
|
||||
|
|
@ -816,8 +815,8 @@ namespace Cantera {
|
|||
getMolalityActivityCoefficients(&acMolal[0]);
|
||||
getActivities(&actMolal[0]);
|
||||
|
||||
int iHp = speciesIndex("H+");
|
||||
if (iHp >= 0) {
|
||||
size_t iHp = speciesIndex("H+");
|
||||
if (iHp != -1) {
|
||||
double pH = -log(actMolal[iHp]) / log(10.0);
|
||||
sprintf(p, " pH %12.4g \n", pH);
|
||||
s += p;
|
||||
|
|
@ -855,11 +854,6 @@ namespace Cantera {
|
|||
s += p;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//doublereal rt = GasConstant * temperature();
|
||||
int k;
|
||||
|
||||
|
||||
sprintf(p, " \n");
|
||||
s += p;
|
||||
|
|
@ -873,7 +867,7 @@ namespace Cantera {
|
|||
sprintf(p, " ------------- "
|
||||
" ------------ ------------ ------------ ------------\n");
|
||||
s += p;
|
||||
for (k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
if (x[k] > SmallNumber) {
|
||||
sprintf(p, "%18s %12.6g %12.6g %12.6g %12.6g %12.6g\n",
|
||||
speciesName(k).c_str(), x[k], molal[k], mu[k], muss[k], acMolal[k]);
|
||||
|
|
@ -892,7 +886,7 @@ namespace Cantera {
|
|||
sprintf(p, " -------------"
|
||||
" ------------\n");
|
||||
s += p;
|
||||
for (k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
sprintf(p, "%18s %12.6g %12.6g\n",
|
||||
speciesName(k).c_str(), x[k], molal[k]);
|
||||
s += p;
|
||||
|
|
@ -969,8 +963,8 @@ namespace Cantera {
|
|||
getActivities(&temp[0]);
|
||||
pNames.push_back("Molal Activity");
|
||||
data.push_back(temp);
|
||||
int iHp = speciesIndex("H+");
|
||||
if (iHp >= 0) {
|
||||
size_t iHp = speciesIndex("H+");
|
||||
if (iHp != -1) {
|
||||
double pH = -log(temp[iHp]) / log(10.0);
|
||||
csvFile << setw(tabL) << "pH = " << setw(tabS) << pH << endl;
|
||||
}
|
||||
|
|
@ -1008,7 +1002,7 @@ namespace Cantera {
|
|||
catch (CanteraError) {;}
|
||||
|
||||
csvFile << endl << setw(tabS) << "Species,";
|
||||
for ( int i = 0; i < (int)pNames.size(); i++ ){
|
||||
for (size_t i = 0; i < pNames.size(); i++) {
|
||||
csvFile << setw(tabM) << pNames[i] << ",";
|
||||
}
|
||||
csvFile << endl;
|
||||
|
|
@ -1017,16 +1011,16 @@ namespace Cantera {
|
|||
csvFile << setw(tabS+(tabM+1)*pNames.size()) << "-\n";
|
||||
csvFile.fill(' ');
|
||||
*/
|
||||
for (int k = 0; k < nSpecies(); k++) {
|
||||
for (size_t k = 0; k < nSpecies(); k++) {
|
||||
csvFile << setw(tabS) << speciesName(k) + ",";
|
||||
if (data[0][k] > SmallNumber) {
|
||||
for ( int i = 0; i < (int)pNames.size(); i++ ){
|
||||
for (size_t i = 0; i < pNames.size(); i++) {
|
||||
csvFile << setw(tabM) << data[i][k] << ",";
|
||||
}
|
||||
csvFile << endl;
|
||||
}
|
||||
else{
|
||||
for ( int i = 0; i < (int)pNames.size(); i++ ){
|
||||
for (size_t i = 0; i < pNames.size(); i++) {
|
||||
csvFile << setw(tabM) << 0 << ",";
|
||||
}
|
||||
csvFile << endl;
|
||||
|
|
|
|||
|
|
@ -843,7 +843,7 @@ namespace Cantera {
|
|||
* must be named "Cl-". It must consist of exactly one Cl and one E
|
||||
* atom.
|
||||
*/
|
||||
virtual int findCLMIndex() const;
|
||||
virtual size_t findCLMIndex() const;
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace Cantera {
|
|||
m_highT = m_regionPts[m_numTempRegions-1]->maxTemp();
|
||||
m_Pref = m_regionPts[0]->refPressure();
|
||||
m_index = m_regionPts[0]->speciesIndex();
|
||||
for (int i = 0; i < m_numTempRegions; i++) {
|
||||
for (size_t i = 0; i < m_numTempRegions; i++) {
|
||||
m_lowerTempBounds[i] = m_regionPts[i]->minTemp();
|
||||
if (m_regionPts[i]->speciesIndex() != m_index) {
|
||||
throw CanteraError("Nasa9PolyMultiTempRegion::Nasa9PolyMultiTempRegion",
|
||||
|
|
@ -145,7 +145,7 @@ namespace Cantera {
|
|||
m_currRegion(b.m_currRegion)
|
||||
{
|
||||
m_regionPts.resize(m_numTempRegions);
|
||||
for (int i = 0; i < m_numTempRegions; i++) {
|
||||
for (size_t i = 0; i < m_numTempRegions; i++) {
|
||||
Nasa9Poly1 * dptr = b.m_regionPts[i];
|
||||
m_regionPts[i] = new Nasa9Poly1(*dptr);
|
||||
}
|
||||
|
|
@ -158,7 +158,7 @@ namespace Cantera {
|
|||
Nasa9PolyMultiTempRegion&
|
||||
Nasa9PolyMultiTempRegion::operator=(const Nasa9PolyMultiTempRegion& b) {
|
||||
if (&b != this) {
|
||||
for (int i = 0; i < m_numTempRegions; i++) {
|
||||
for (size_t i = 0; i < m_numTempRegions; i++) {
|
||||
delete m_regionPts[i];
|
||||
m_regionPts[i] = 0;
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ namespace Cantera {
|
|||
m_lowerTempBounds = b.m_lowerTempBounds;
|
||||
m_currRegion = b.m_currRegion;
|
||||
m_regionPts.resize(m_numTempRegions);
|
||||
for (int i = 0; i < m_numTempRegions; i++) {
|
||||
for (size_t i = 0; i < m_numTempRegions; i++) {
|
||||
m_regionPts[i] = new Nasa9Poly1(*(b.m_regionPts[i]));
|
||||
}
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ namespace Cantera {
|
|||
|
||||
// Destructor
|
||||
Nasa9PolyMultiTempRegion::~Nasa9PolyMultiTempRegion() {
|
||||
for (int i = 0; i < m_numTempRegions; i++) {
|
||||
for (size_t i = 0; i < m_numTempRegions; i++) {
|
||||
delete m_regionPts[i];
|
||||
m_regionPts[i] = 0;
|
||||
}
|
||||
|
|
@ -308,7 +308,7 @@ namespace Cantera {
|
|||
tPoly[6] = std::log(temp);
|
||||
// Now find the region
|
||||
m_currRegion = 0;
|
||||
for (int i = 1; i < m_numTempRegions; i++) {
|
||||
for (size_t i = 1; i < m_numTempRegions; i++) {
|
||||
if (temp < m_lowerTempBounds[i]) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -347,7 +347,7 @@ namespace Cantera {
|
|||
int n_tmp = 0;;
|
||||
int type_tmp = 0;
|
||||
double pref_tmp = 0.0;
|
||||
for (int iReg = 0; iReg < m_numTempRegions; iReg++) {
|
||||
for (size_t iReg = 0; iReg < m_numTempRegions; iReg++) {
|
||||
m_regionPts[iReg]->reportParameters(n_tmp, type_tmp,
|
||||
coeffs[index], coeffs[index+1],
|
||||
pref_tmp, ctmp);
|
||||
|
|
@ -366,12 +366,10 @@ namespace Cantera {
|
|||
*/
|
||||
void Nasa9PolyMultiTempRegion::modifyParameters(doublereal* coeffs) {
|
||||
int index = 3;
|
||||
for (int iReg = 0; iReg < m_numTempRegions; iReg++) {
|
||||
for (size_t iReg = 0; iReg < m_numTempRegions; iReg++) {
|
||||
m_regionPts[iReg]->modifyParameters(coeffs + index);
|
||||
index += 11;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1214,8 +1214,8 @@ namespace Cantera {
|
|||
throw CanteraError("LookupGe", "element " + s + " not found");
|
||||
return -1.0;
|
||||
#else
|
||||
int iE = m_tp->elementIndex(elemName);
|
||||
if (iE < 0) {
|
||||
size_t iE = m_tp->elementIndex(elemName);
|
||||
if (iE == -1) {
|
||||
throw CanteraError("PDSS_HKFT::LookupGe", "element " + elemName + " not found");
|
||||
}
|
||||
doublereal geValue = m_tp->entropyElement298(iE);
|
||||
|
|
@ -1232,13 +1232,13 @@ namespace Cantera {
|
|||
/*
|
||||
* Ok let's get the element compositions and conversion factors.
|
||||
*/
|
||||
int ne = m_tp->nElements();
|
||||
size_t ne = m_tp->nElements();
|
||||
doublereal na;
|
||||
doublereal ge;
|
||||
string ename;
|
||||
|
||||
doublereal totalSum = 0.0;
|
||||
for (int m = 0; m < ne; m++) {
|
||||
for (size_t m = 0; m < ne; m++) {
|
||||
na = m_tp->nAtoms(m_spindex, m);
|
||||
if (na > 0.0) {
|
||||
ename = m_tp->elementName(m);
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ namespace Cantera {
|
|||
factorVec.resize(numMult_);
|
||||
tmpNM.resize(neutralMoleculePhase_->nSpecies());
|
||||
|
||||
for (int i = 0; i < numMult_; i++) {
|
||||
for (size_t i = 0; i < numMult_; i++) {
|
||||
idNeutralMoleculeVec[i] = neutralMoleculePhase_->speciesIndex(key[i]);
|
||||
factorVec[i] = fpValueCheck(val[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -457,9 +457,9 @@ namespace Cantera {
|
|||
ThermoPhase *neutralMoleculePhase_;
|
||||
|
||||
public:
|
||||
int numMult_;
|
||||
size_t numMult_;
|
||||
|
||||
std::vector<int> idNeutralMoleculeVec;
|
||||
std::vector<size_t> idNeutralMoleculeVec;
|
||||
|
||||
std::vector<double> factorVec;
|
||||
|
||||
|
|
|
|||
|
|
@ -124,11 +124,11 @@ namespace Cantera {
|
|||
m_name = nm;
|
||||
}
|
||||
|
||||
int Phase::index() const {
|
||||
size_t Phase::index() const {
|
||||
return m_index;
|
||||
}
|
||||
|
||||
void Phase::setIndex(int m) {
|
||||
void Phase::setIndex(size_t m) {
|
||||
m_index = m;
|
||||
}
|
||||
|
||||
|
|
@ -159,10 +159,10 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void Phase::setMoleFractionsByName(compositionMap& xMap) {
|
||||
int kk = nSpecies();
|
||||
size_t kk = nSpecies();
|
||||
doublereal x;
|
||||
vector_fp mf(kk, 0.0);
|
||||
for (int k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
x = xMap[speciesName(k)];
|
||||
if (x > 0.0) mf[k] = x;
|
||||
}
|
||||
|
|
@ -170,9 +170,9 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void Phase::setMoleFractionsByName(const std::string& x) {
|
||||
size_t kk = nSpecies();
|
||||
compositionMap xx;
|
||||
int kk = nSpecies();
|
||||
for (int k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
xx[speciesName(k)] = -1.0;
|
||||
}
|
||||
parseCompString(x, xx);
|
||||
|
|
@ -186,10 +186,10 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void Phase::setMassFractionsByName(compositionMap& yMap) {
|
||||
int kk = nSpecies();
|
||||
size_t kk = nSpecies();
|
||||
doublereal y;
|
||||
vector_fp mf(kk, 0.0);
|
||||
for (int k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
y = yMap[speciesName(k)];
|
||||
if (y > 0.0) mf[k] = y;
|
||||
}
|
||||
|
|
@ -197,9 +197,9 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void Phase::setMassFractionsByName(const std::string& y) {
|
||||
size_t kk = nSpecies();
|
||||
compositionMap yy;
|
||||
int kk = nSpecies();
|
||||
for (int k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
yy[speciesName(k)] = -1.0;
|
||||
}
|
||||
parseCompString(y, yy);
|
||||
|
|
@ -300,37 +300,36 @@ namespace Cantera {
|
|||
*/
|
||||
void Phase::getMoleFractionsByName(compositionMap& x) const {
|
||||
x.clear();
|
||||
int kk = nSpecies();
|
||||
size_t kk = nSpecies();
|
||||
for (int k = 0; k < kk; k++) {
|
||||
x[speciesName(k)] = State::moleFraction(k);
|
||||
}
|
||||
}
|
||||
|
||||
doublereal Phase::moleFraction(int k) const {
|
||||
doublereal Phase::moleFraction(size_t k) const {
|
||||
return State::moleFraction(k);
|
||||
}
|
||||
|
||||
doublereal Phase::moleFraction(std::string name) const {
|
||||
int iloc = speciesIndex(name);
|
||||
if (iloc >= 0) return State::moleFraction(iloc);
|
||||
size_t iloc = speciesIndex(name);
|
||||
if (iloc != -1) return State::moleFraction(iloc);
|
||||
else return 0.0;
|
||||
}
|
||||
|
||||
doublereal Phase::massFraction(int k) const {
|
||||
doublereal Phase::massFraction(size_t k) const {
|
||||
return State::massFraction(k);
|
||||
}
|
||||
|
||||
doublereal Phase::massFraction(std::string name) const {
|
||||
int iloc = speciesIndex(name);
|
||||
if (iloc >= 0) return massFractions()[iloc];
|
||||
size_t iloc = speciesIndex(name);
|
||||
if (iloc != -1) return massFractions()[iloc];
|
||||
else return 0.0;
|
||||
}
|
||||
|
||||
doublereal Phase::chargeDensity() const {
|
||||
int k;
|
||||
int nsp = nSpecies();
|
||||
size_t kk = nSpecies();
|
||||
doublereal cdens = 0.0;
|
||||
for (k = 0; k < nsp; k++)
|
||||
for (size_t k = 0; k < kk; k++)
|
||||
cdens += charge(k)*State::moleFraction(k);
|
||||
cdens *= Faraday;
|
||||
return cdens;
|
||||
|
|
@ -343,15 +342,13 @@ namespace Cantera {
|
|||
void Phase::freezeSpecies() {
|
||||
Constituents::freezeSpecies();
|
||||
init(Constituents::molecularWeights());
|
||||
int kk = nSpecies();
|
||||
int nv = kk + 2;
|
||||
size_t kk = nSpecies();
|
||||
size_t nv = kk + 2;
|
||||
m_data.resize(nv,0.0);
|
||||
m_data[0] = 300.0;
|
||||
m_data[1] = 0.001;
|
||||
m_data[2] = 1.0;
|
||||
|
||||
//setState_TRY(300.0, density(), &m_data[2]);
|
||||
|
||||
m_kk = nSpecies();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ namespace Cantera {
|
|||
* The index is used in the Python and matlab interfaces to
|
||||
* index into a list of ThermoPhase objects
|
||||
*/
|
||||
int index() const;
|
||||
size_t index() const;
|
||||
|
||||
//! Sets the index of the phase
|
||||
/*!
|
||||
|
|
@ -229,7 +229,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param m Integer index of the phase
|
||||
*/
|
||||
void setIndex(int m);
|
||||
void setIndex(size_t m);
|
||||
|
||||
//! Save the current internal state of the phase
|
||||
/*!
|
||||
|
|
@ -434,7 +434,7 @@ namespace Cantera {
|
|||
*
|
||||
* @return Mole fraction of the species
|
||||
*/
|
||||
doublereal moleFraction(int k) const;
|
||||
doublereal moleFraction(size_t k) const;
|
||||
|
||||
//! Return the mole fraction of a single species
|
||||
/*!
|
||||
|
|
@ -450,7 +450,7 @@ namespace Cantera {
|
|||
*
|
||||
* @return Mass Fraction of the species
|
||||
*/
|
||||
doublereal massFraction(int k) const;
|
||||
doublereal massFraction(size_t k) const;
|
||||
|
||||
//! Return the mass fraction of a single species
|
||||
/*!
|
||||
|
|
@ -466,7 +466,7 @@ namespace Cantera {
|
|||
doublereal chargeDensity() const;
|
||||
|
||||
/// Returns the number of spatial dimensions (1, 2, or 3)
|
||||
int nDim() const {return m_ndim;}
|
||||
size_t nDim() const {return m_ndim;}
|
||||
|
||||
//! Set the number of spatial dimensions (1, 2, or 3)
|
||||
/*!
|
||||
|
|
@ -475,7 +475,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param ndim Input number of dimensions.
|
||||
*/
|
||||
void setNDim(int ndim) {m_ndim = ndim;}
|
||||
void setNDim(size_t ndim) {m_ndim = ndim;}
|
||||
|
||||
/**
|
||||
* Finished adding species, prepare to use them for calculation
|
||||
|
|
@ -495,19 +495,19 @@ namespace Cantera {
|
|||
* to restate it in here, so that the declarations in the two
|
||||
* base classes become hidden.
|
||||
*/
|
||||
int m_kk;
|
||||
size_t m_kk;
|
||||
|
||||
/**
|
||||
* m_ndim is the dimensionality of the phase. Volumetric
|
||||
* phases have dimensionality 3 and surface phases have
|
||||
* dimensionality 2.
|
||||
*/
|
||||
int m_ndim;
|
||||
size_t m_ndim;
|
||||
/**
|
||||
* m_index is the index of the phase
|
||||
*
|
||||
*/
|
||||
int m_index;
|
||||
size_t m_index;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ namespace Cantera {
|
|||
sprintf(p, " potential %12.6g V\n", phi);
|
||||
s += p;
|
||||
|
||||
int kk = nSpecies();
|
||||
size_t kk = nSpecies();
|
||||
array_fp x(kk);
|
||||
array_fp molal(kk);
|
||||
array_fp mu(kk);
|
||||
|
|
|
|||
|
|
@ -343,22 +343,22 @@ namespace Cantera {
|
|||
int PBType_;
|
||||
|
||||
//! Number of pseudo binary species
|
||||
int numPBSpecies_;
|
||||
size_t numPBSpecies_;
|
||||
|
||||
//! index of special species
|
||||
int indexSpecialSpecies_;
|
||||
size_t indexSpecialSpecies_;
|
||||
|
||||
mutable std::vector<doublereal> PBMoleFractions_;
|
||||
|
||||
std::vector<int> cationList_;
|
||||
int numCationSpecies_;
|
||||
size_t numCationSpecies_;
|
||||
|
||||
std::vector<int>anionList_;
|
||||
int numAnionSpecies_;
|
||||
size_t numAnionSpecies_;
|
||||
|
||||
std::vector<int> passThroughList_;
|
||||
int numPassThroughSpecies_;
|
||||
int neutralPBindexStart;
|
||||
size_t numPassThroughSpecies_;
|
||||
size_t neutralPBindexStart;
|
||||
|
||||
ThermoPhase *cationPhase_;
|
||||
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
int kk = nSpecies();
|
||||
size_t kk = nSpecies();
|
||||
array_fp x(kk);
|
||||
array_fp y(kk);
|
||||
array_fp mu(kk);
|
||||
|
|
@ -383,7 +383,6 @@ namespace Cantera {
|
|||
getMassFractions(&y[0]);
|
||||
getChemPotentials(&mu[0]);
|
||||
doublereal rt = GasConstant * temperature();
|
||||
int k;
|
||||
//if (th.nSpecies() > 1) {
|
||||
|
||||
if (show_thermo) {
|
||||
|
|
@ -393,7 +392,7 @@ namespace Cantera {
|
|||
sprintf(p, " ------------- "
|
||||
"------------ ------------\n");
|
||||
s += p;
|
||||
for (k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
if (x[k] > SmallNumber) {
|
||||
sprintf(p, "%18s %12.6g %12.6g %12.6g\n",
|
||||
speciesName(k).c_str(), x[k], y[k], mu[k]/rt);
|
||||
|
|
@ -412,7 +411,7 @@ namespace Cantera {
|
|||
sprintf(p, " -------------"
|
||||
" ------------\n");
|
||||
s += p;
|
||||
for (k = 0; k < kk; k++) {
|
||||
for (size_t k = 0; k < kk; k++) {
|
||||
sprintf(p, "%18s %12.6g %12.6g\n",
|
||||
speciesName(k).c_str(), x[k], y[k]);
|
||||
s += p;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ namespace Cantera {
|
|||
|
||||
// private
|
||||
void SemiconductorPhase::initLengths() {
|
||||
int ns = nSpecies();
|
||||
m_work.resize(ns);
|
||||
m_work.resize(nSpecies());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -444,8 +444,8 @@ namespace Cantera {
|
|||
throw CanteraError("LookupGe", "element " + s + " not found");
|
||||
return -1.0;
|
||||
#else
|
||||
int iE = th_ptr->elementIndex(elemName);
|
||||
if (iE < 0) {
|
||||
size_t iE = th_ptr->elementIndex(elemName);
|
||||
if (iE == -1) {
|
||||
throw CanteraError("PDSS_HKFT::LookupGe", "element " + elemName + " not found");
|
||||
}
|
||||
doublereal geValue = th_ptr->entropyElement298(iE);
|
||||
|
|
@ -462,13 +462,13 @@ namespace Cantera {
|
|||
/*
|
||||
* Ok let's get the element compositions and conversion factors.
|
||||
*/
|
||||
int ne = th_ptr->nElements();
|
||||
size_t ne = th_ptr->nElements();
|
||||
doublereal na;
|
||||
doublereal ge;
|
||||
string ename;
|
||||
|
||||
doublereal totalSum = 0.0;
|
||||
for (int m = 0; m < ne; m++) {
|
||||
for (size_t m = 0; m < ne; m++) {
|
||||
na = th_ptr->nAtoms(k, m);
|
||||
if (na > 0.0) {
|
||||
ename = th_ptr->elementName(m);
|
||||
|
|
@ -651,7 +651,7 @@ namespace Cantera {
|
|||
std::vector<Nasa9Poly1 *> regionPtrs;
|
||||
doublereal tmin, tmax, pref = OneAtm;
|
||||
// Loop over all of the possible temperature regions
|
||||
for (int i = 0; i < tp.size(); i++) {
|
||||
for (size_t i = 0; i < tp.size(); i++) {
|
||||
fptr = tp[i];
|
||||
if (fptr) {
|
||||
if (fptr->name() == "NASA9") {
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ namespace Cantera {
|
|||
return *this;
|
||||
}
|
||||
|
||||
doublereal State::moleFraction(const int k) const {
|
||||
if (k >= 0 && k < m_kk) {
|
||||
doublereal State::moleFraction(const size_t k) const {
|
||||
if (k < m_kk) {
|
||||
return m_ym[k] * m_mmw;
|
||||
}
|
||||
else {
|
||||
|
|
@ -118,16 +118,16 @@ namespace Cantera {
|
|||
stateMFChangeCalc();
|
||||
}
|
||||
|
||||
doublereal State::massFraction(const int k) const {
|
||||
if (k >= 0 && k < m_kk) {
|
||||
doublereal State::massFraction(const size_t k) const {
|
||||
if (k < m_kk) {
|
||||
return m_y[k];
|
||||
}
|
||||
throw CanteraError("State:massFraction", "illegal species index number");
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
doublereal State::concentration(const int k) const {
|
||||
if (k >= 0 && k < m_kk) {
|
||||
doublereal State::concentration(const size_t k) const {
|
||||
if (k < m_kk) {
|
||||
return m_y[k] * m_dens * m_rmolwts[k] ;
|
||||
}
|
||||
throw CanteraError("State:massFraction", "illegal species index number");
|
||||
|
|
@ -246,7 +246,7 @@ namespace Cantera {
|
|||
m_y.resize(m_kk, 0.0);
|
||||
m_ym.resize(m_kk, 0.0);
|
||||
copy(mw.begin(), mw.end(), m_molwts.begin());
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
if (m_molwts[k] < 0.0) {
|
||||
throw CanteraError("State::init",
|
||||
"negative molecular weight for species number "+int2str(k));
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ namespace Cantera {
|
|||
* mole fractions of all species are desired.
|
||||
* @param k species index
|
||||
*/
|
||||
doublereal moleFraction(const int k) const;
|
||||
doublereal moleFraction(const size_t k) const;
|
||||
|
||||
|
||||
//! Set the mole fractions to the specified values, and then
|
||||
|
|
@ -162,7 +162,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k species index
|
||||
*/
|
||||
doublereal massFraction(const int k) const;
|
||||
doublereal massFraction(const size_t k) const;
|
||||
|
||||
/**
|
||||
* Set the mass fractions to the specified values, and then
|
||||
|
|
@ -205,7 +205,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Index of species
|
||||
*/
|
||||
doublereal concentration(const int k) const;
|
||||
doublereal concentration(const size_t k) const;
|
||||
|
||||
//! Set the concentrations to the specified values within the
|
||||
//! phase.
|
||||
|
|
|
|||
|
|
@ -125,10 +125,9 @@ namespace Cantera {
|
|||
if (tmax > 0.0) m_tmax = tmax;
|
||||
m_p0 = refPressure();
|
||||
|
||||
int leng = m_kk;
|
||||
m_h0_RT.resize(leng);
|
||||
m_cp0_R.resize(leng);
|
||||
m_s0_R.resize(leng);
|
||||
m_h0_RT.resize(m_kk);
|
||||
m_cp0_R.resize(m_kk);
|
||||
m_s0_R.resize(m_kk);
|
||||
|
||||
// Put the object on a valid temperature point.
|
||||
double tnow = 300.;
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ namespace Cantera {
|
|||
|
||||
protected:
|
||||
|
||||
int m_kk;
|
||||
size_t m_kk;
|
||||
doublereal m_tmin, m_tmax, m_press, m_p0;
|
||||
|
||||
mutable doublereal m_tlast;
|
||||
|
|
|
|||
|
|
@ -291,10 +291,10 @@ namespace Cantera {
|
|||
// used to check that each species is declared only once
|
||||
std::map<std::string, bool> declared;
|
||||
|
||||
int nSpecies = 0;
|
||||
size_t nSpecies = 0;
|
||||
bool skip;
|
||||
|
||||
for (int jsp = 0; jsp < spArray_dbases.size(); jsp++) {
|
||||
for (size_t jsp = 0; jsp < spArray_dbases.size(); jsp++) {
|
||||
const XML_Node& speciesArray = *spArray_names[jsp];
|
||||
|
||||
// Get the top XML for the database
|
||||
|
|
@ -303,7 +303,7 @@ namespace Cantera {
|
|||
// Get the array of species name strings and the count them
|
||||
std::vector<std::string> spnames;
|
||||
getStringArray(speciesArray, spnames);
|
||||
int nsp = static_cast<int>(spnames.size());
|
||||
size_t nsp = spnames.size();
|
||||
|
||||
// if 'all' is specified as the one and only species in the
|
||||
// spArray_names field, then add all species
|
||||
|
|
@ -311,9 +311,9 @@ namespace Cantera {
|
|||
if (nsp == 1 && spnames[0] == "all") {
|
||||
std::vector<XML_Node *> allsp;
|
||||
db->getChildren("species", allsp);
|
||||
nsp = static_cast<int>(allsp.size());
|
||||
nsp = allsp.size();
|
||||
spnames.resize(nsp);
|
||||
for (int nn = 0; nn < nsp; nn++) {
|
||||
for (size_t nn = 0; nn < nsp; nn++) {
|
||||
string stemp = (*allsp[nn])["name"];
|
||||
bool skip = false;
|
||||
if (declared[stemp]) {
|
||||
|
|
@ -339,9 +339,9 @@ namespace Cantera {
|
|||
else if (nsp == 1 && spnames[0] == "unique") {
|
||||
std::vector<XML_Node *> allsp;
|
||||
db->getChildren("species", allsp);
|
||||
nsp = static_cast<int>(allsp.size());
|
||||
nsp = allsp.size();
|
||||
spnames.resize(nsp);
|
||||
for (int nn = 0; nn < nsp; nn++) {
|
||||
for (size_t nn = 0; nn < nsp; nn++) {
|
||||
string stemp = (*allsp[nn])["name"];
|
||||
bool skip = false;
|
||||
if (declared[stemp]) {
|
||||
|
|
@ -359,7 +359,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
for (int k = 0; k < nsp; k++) {
|
||||
for (size_t k = 0; k < nsp; k++) {
|
||||
string stemp = spnames[k];
|
||||
skip = false;
|
||||
if (declared[stemp]) {
|
||||
|
|
@ -592,8 +592,8 @@ namespace Cantera {
|
|||
th->setSpeciesThermo(spth);
|
||||
}
|
||||
|
||||
int k = 0;
|
||||
for (int i = 0; i < spDataNodeList.size(); i++) {
|
||||
size_t k = 0;
|
||||
for (size_t i = 0; i < spDataNodeList.size(); i++) {
|
||||
XML_Node *s = spDataNodeList[i];
|
||||
AssertTrace(s != 0);
|
||||
bool ok = installSpecies(k, *s, *th, spth, spRuleList[i],
|
||||
|
|
@ -756,7 +756,7 @@ namespace Cantera {
|
|||
}
|
||||
vector<XML_Node*> xspecies;
|
||||
phaseSpeciesData->getChildren("species", xspecies);
|
||||
for (int j = 0; j < xspecies.size(); j++) {
|
||||
for (size_t j = 0; j < xspecies.size(); j++) {
|
||||
const XML_Node& sp = *xspecies[j];
|
||||
jname = sp["name"];
|
||||
if (jname == kname) {
|
||||
|
|
|
|||
|
|
@ -406,9 +406,9 @@ namespace Cantera {
|
|||
|
||||
|
||||
void
|
||||
VPStandardStateTP::createInstallPDSS(int k, const XML_Node& s,
|
||||
VPStandardStateTP::createInstallPDSS(size_t k, const XML_Node& s,
|
||||
const XML_Node * phaseNode_ptr) {
|
||||
if ((int) m_PDSS_storage.size() < k+1) {
|
||||
if (m_PDSS_storage.size() < k+1) {
|
||||
m_PDSS_storage.resize(k+1,0);
|
||||
}
|
||||
if (m_PDSS_storage[k] != 0) {
|
||||
|
|
@ -418,12 +418,12 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
PDSS *
|
||||
VPStandardStateTP::providePDSS(int k) {
|
||||
VPStandardStateTP::providePDSS(size_t k) {
|
||||
return m_PDSS_storage[k];
|
||||
}
|
||||
|
||||
const PDSS *
|
||||
VPStandardStateTP::providePDSS(int k) const {
|
||||
VPStandardStateTP::providePDSS(size_t k) const {
|
||||
return m_PDSS_storage[k];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -602,10 +602,10 @@ protected:
|
|||
*/
|
||||
VPSSMgr *provideVPSSMgr();
|
||||
|
||||
void createInstallPDSS(int k, const XML_Node& s, const XML_Node * phaseNode_ptr);
|
||||
void createInstallPDSS(size_t k, const XML_Node& s, const XML_Node * phaseNode_ptr);
|
||||
|
||||
PDSS* providePDSS(int k);
|
||||
const PDSS* providePDSS(int k) const;
|
||||
PDSS* providePDSS(size_t k);
|
||||
const PDSS* providePDSS(size_t k) const;
|
||||
|
||||
private:
|
||||
//! @internal Initialize the internal lengths in this object.
|
||||
|
|
|
|||
|
|
@ -587,10 +587,10 @@ namespace Cantera {
|
|||
* This function returns a Transport data object for a given species.
|
||||
*
|
||||
*/
|
||||
struct LiquidTransportData AqueousTransport::
|
||||
LiquidTransportData AqueousTransport::
|
||||
getLiquidTransportData(int kSpecies)
|
||||
{
|
||||
struct LiquidTransportData td;
|
||||
LiquidTransportData td;
|
||||
td.speciesName = m_thermo->speciesName(kSpecies);
|
||||
|
||||
/* NEEDS WORK
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ namespace Cantera {
|
|||
*
|
||||
* Controlling update boolean = m_viscwt_ok
|
||||
*/
|
||||
virtual void getSpeciesViscosities(doublereal* visc)
|
||||
virtual void getSpeciesViscosities(doublereal* const visc)
|
||||
{ updateViscosity_T(); copy(m_visc.begin(), m_visc.end(), visc); }
|
||||
|
||||
virtual void getThermalDiffCoeffs(doublereal* const dt);
|
||||
|
|
@ -314,7 +314,7 @@ namespace Cantera {
|
|||
*
|
||||
* @param k Species number to obtain the properties about.
|
||||
*/
|
||||
struct LiquidTransportData getLiquidTransportData(int k);
|
||||
class LiquidTransportData getLiquidTransportData(int k);
|
||||
|
||||
|
||||
//! Solve the stefan_maxell equations for the diffusive fluxes.
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace Cantera {
|
|||
*/
|
||||
virtual doublereal viscosity();
|
||||
|
||||
virtual void getSpeciesViscosities(doublereal* visc)
|
||||
virtual void getSpeciesViscosities(doublereal* const visc)
|
||||
{ update_T(); updateViscosity_T(); copy(m_visc.begin(), m_visc.end(), visc); }
|
||||
|
||||
//! Return the thermal diffusion coefficients
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue