Fixing signed/unsigned comparison wartings in Kinetics
This commit is contained in:
parent
55684b6591
commit
905117a3e4
9 changed files with 51 additions and 60 deletions
|
|
@ -111,7 +111,6 @@ namespace Cantera {
|
|||
* reversible or not.
|
||||
*/
|
||||
void AqueousKinetics::getEquilibriumConstants(doublereal* kc) {
|
||||
int i;
|
||||
_update_rates_T();
|
||||
vector_fp& rkc = m_kdata->m_rkcn;
|
||||
|
||||
|
|
@ -127,7 +126,7 @@ namespace Cantera {
|
|||
m_rxnstoich->getReactionDelta(m_ii, &m_grt[0], &rkc[0]);
|
||||
|
||||
doublereal rrt = 1.0/(GasConstant * thermo().temperature());
|
||||
for (i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
kc[i] = exp(-rkc[i]*rrt);
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +253,7 @@ namespace Cantera {
|
|||
*/
|
||||
thermo().getEnthalpy_RT(&m_grt[0]);
|
||||
doublereal RT = thermo().temperature() * GasConstant;
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
m_grt[k] *= RT;
|
||||
}
|
||||
/*
|
||||
|
|
@ -283,7 +282,7 @@ namespace Cantera {
|
|||
*/
|
||||
thermo().getEntropy_R(&m_grt[0]);
|
||||
doublereal R = GasConstant;
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
m_grt[k] *= R;
|
||||
}
|
||||
/*
|
||||
|
|
@ -362,7 +361,7 @@ namespace Cantera {
|
|||
// multiply by perturbation factor
|
||||
multiply_each(ropf.begin(), ropf.end(), m_perturb.begin());
|
||||
|
||||
for (int i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
kfwd[i] = ropf[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -390,7 +389,7 @@ namespace Cantera {
|
|||
if (doIrreversible) {
|
||||
doublereal *tmpKc = &m_kdata->m_ropnet[0];
|
||||
getEquilibriumConstants(tmpKc);
|
||||
for (int i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
krev[i] /= tmpKc[i];
|
||||
}
|
||||
} else {
|
||||
|
|
@ -398,7 +397,7 @@ namespace Cantera {
|
|||
* m_rkc[] is zero for irreversibly reactions
|
||||
*/
|
||||
const vector_fp& m_rkc = m_kdata->m_rkcn;
|
||||
for (int i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
krev[i] *= m_rkc[i];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,8 +348,8 @@ namespace Cantera {
|
|||
|
||||
std::vector<size_t> m_fwdOrder;
|
||||
|
||||
int m_nirrev;
|
||||
int m_nrev;
|
||||
size_t m_nirrev;
|
||||
size_t m_nrev;
|
||||
|
||||
std::map<size_t, std::vector<grouplist_t> > m_rgroups;
|
||||
std::map<size_t, std::vector<grouplist_t> > m_pgroups;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ namespace Cantera {
|
|||
* reversible or not.
|
||||
*/
|
||||
void GasKinetics::getEquilibriumConstants(doublereal* kc) {
|
||||
int i;
|
||||
_update_rates_T();
|
||||
vector_fp& rkc = m_kdata->m_rkcn;
|
||||
//thermo().getGibbs_RT(m_grt.begin());
|
||||
|
|
@ -133,7 +132,7 @@ namespace Cantera {
|
|||
|
||||
doublereal logStandConc = m_kdata->m_logStandConc;
|
||||
doublereal rrt = 1.0/(GasConstant * thermo().temperature());
|
||||
for (i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
kc[i] = exp(-rkc[i]*rrt + m_dn[i]*logStandConc);
|
||||
}
|
||||
|
||||
|
|
@ -260,7 +259,7 @@ namespace Cantera {
|
|||
*/
|
||||
thermo().getEnthalpy_RT(&m_grt[0]);
|
||||
doublereal RT = thermo().temperature() * GasConstant;
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
m_grt[k] *= RT;
|
||||
}
|
||||
/*
|
||||
|
|
@ -289,7 +288,7 @@ namespace Cantera {
|
|||
*/
|
||||
thermo().getEntropy_R(&m_grt[0]);
|
||||
doublereal R = GasConstant;
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
m_grt[k] *= R;
|
||||
}
|
||||
/*
|
||||
|
|
@ -300,8 +299,6 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
void GasKinetics::processFalloffReactions() {
|
||||
|
||||
int i;
|
||||
const vector_fp& fc = m_kdata->concm_falloff_values;
|
||||
const array_fp& m_rf_low = m_kdata->m_rfn_low;
|
||||
const array_fp& m_rf_high = m_kdata->m_rfn_high;
|
||||
|
|
@ -311,7 +308,7 @@ namespace Cantera {
|
|||
|
||||
array_fp& ropf = m_kdata->m_ropf;
|
||||
|
||||
for (i = 0; i < m_nfall; i++) {
|
||||
for (size_t i = 0; i < m_nfall; i++) {
|
||||
pr[i] = fc[i] * m_rf_low[i] / m_rf_high[i];
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +316,7 @@ namespace Cantera {
|
|||
(m_kdata->falloff_work.empty()) ? 0 : &m_kdata->falloff_work[0];
|
||||
m_falloffn.pr_to_falloff(&pr[0], falloff_work);
|
||||
|
||||
for (i = 0; i < m_nfall; i++) {
|
||||
for (size_t i = 0; i < m_nfall; i++) {
|
||||
pr[i] *= m_rf_high[i];
|
||||
}
|
||||
|
||||
|
|
@ -414,7 +411,7 @@ namespace Cantera {
|
|||
// multiply by perturbation factor
|
||||
multiply_each(ropf.begin(), ropf.end(), m_perturb.begin());
|
||||
|
||||
for (int i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
kfwd[i] = ropf[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -442,7 +439,7 @@ namespace Cantera {
|
|||
if (doIrreversible) {
|
||||
doublereal *tmpKc = &m_kdata->m_ropnet[0];
|
||||
getEquilibriumConstants(tmpKc);
|
||||
for (int i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
krev[i] /= tmpKc[i];
|
||||
}
|
||||
} else {
|
||||
|
|
@ -450,7 +447,7 @@ namespace Cantera {
|
|||
* m_rkc[] is zero for irreversibly reactions
|
||||
*/
|
||||
const vector_fp& m_rkc = m_kdata->m_rkcn;
|
||||
for (int i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
krev[i] *= m_rkc[i];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,8 +360,8 @@ namespace Cantera {
|
|||
|
||||
std::vector<size_t> m_fwdOrder;
|
||||
|
||||
int m_nirrev;
|
||||
int m_nrev;
|
||||
size_t m_nirrev;
|
||||
size_t m_nrev;
|
||||
|
||||
std::map<size_t, std::vector<grouplist_t> > m_rgroups;
|
||||
std::map<size_t, std::vector<grouplist_t> > m_pgroups;
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ namespace Cantera {
|
|||
* are below zero.
|
||||
*/
|
||||
bool rset = false;
|
||||
for (int k = 0; k < m_nv; k++) {
|
||||
for (size_t k = 0; k < m_nv; k++) {
|
||||
if (m_concSpecies[k] < 0.0) {
|
||||
rset = true;
|
||||
m_concSpecies[k] = 0.0;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace Cantera {
|
|||
if (m_integrator) {
|
||||
delete m_integrator;
|
||||
}
|
||||
for (int i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
delete m_rxnPhaseIsReactant[i];
|
||||
delete m_rxnPhaseIsProduct[i];
|
||||
}
|
||||
|
|
@ -116,13 +116,12 @@ namespace Cantera {
|
|||
*/
|
||||
InterfaceKinetics& InterfaceKinetics::
|
||||
operator=(const InterfaceKinetics &right) {
|
||||
int i;
|
||||
/*
|
||||
* Check for self assignment.
|
||||
*/
|
||||
if (this == &right) return *this;
|
||||
|
||||
for (i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
delete (m_rxnPhaseIsReactant[i]);
|
||||
delete (m_rxnPhaseIsProduct[i]);
|
||||
}
|
||||
|
|
@ -168,10 +167,10 @@ namespace Cantera {
|
|||
m_rxnPhaseIsReactant.resize(m_ii, 0);
|
||||
m_rxnPhaseIsProduct.resize(m_ii, 0);
|
||||
size_t np = nPhases();
|
||||
for (i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
m_rxnPhaseIsReactant[i] = new bool[np];
|
||||
m_rxnPhaseIsProduct[i] = new bool[np];
|
||||
for (int p = 0; p < np; p++) {
|
||||
for (size_t p = 0; p < np; p++) {
|
||||
m_rxnPhaseIsReactant[i][p] = right.m_rxnPhaseIsReactant[i][p];
|
||||
m_rxnPhaseIsProduct[i][p] = right.m_rxnPhaseIsProduct[i][p];
|
||||
}
|
||||
|
|
@ -588,7 +587,7 @@ namespace Cantera {
|
|||
if (doIrreversible) {
|
||||
doublereal *tmpKc = DATA_PTR(m_kdata->m_ropnet);
|
||||
getEquilibriumConstants(tmpKc);
|
||||
for (int i = 0; i < m_ii; i++) {
|
||||
for (size_t i = 0; i < m_ii; i++) {
|
||||
krev[i] /= tmpKc[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -647,7 +646,7 @@ namespace Cantera {
|
|||
// do global reactions
|
||||
//m_globalReactantStoich.power(m_conc.begin(), ropf.begin());
|
||||
|
||||
for (int j = 0; j != m_ii; ++j) {
|
||||
for (size_t j = 0; j != m_ii; ++j) {
|
||||
ropnet[j] = ropf[j] - ropr[j];
|
||||
}
|
||||
|
||||
|
|
@ -658,15 +657,15 @@ namespace Cantera {
|
|||
* phases that are stoichiometric phases containing one species with a unity activity
|
||||
*/
|
||||
if (m_phaseExistsCheck) {
|
||||
for (int j = 0; j != m_ii; ++j) {
|
||||
for (size_t j = 0; j != m_ii; ++j) {
|
||||
if ((ropr[j] > ropf[j]) && (ropr[j] > 0.0)) {
|
||||
for (int p = 0; p < nPhases(); p++) {
|
||||
for (size_t p = 0; p < nPhases(); p++) {
|
||||
if (m_rxnPhaseIsProduct[j][p]) {
|
||||
if (! m_phaseExists[p]) {
|
||||
ropnet[j] = 0.0;
|
||||
ropr[j] = ropf[j];
|
||||
if (ropf[j] > 0.0) {
|
||||
for (int rp = 0; rp < nPhases(); rp++) {
|
||||
for (size_t rp = 0; rp < nPhases(); rp++) {
|
||||
if (m_rxnPhaseIsReactant[j][rp]) {
|
||||
if (! m_phaseExists[rp]) {
|
||||
ropnet[j] = 0.0;
|
||||
|
|
@ -679,13 +678,13 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
} else if ((ropf[j] > ropr[j]) && (ropf[j] > 0.0)) {
|
||||
for (int p = 0; p < nPhases(); p++) {
|
||||
for (size_t p = 0; p < nPhases(); p++) {
|
||||
if (m_rxnPhaseIsReactant[j][p]) {
|
||||
if (! m_phaseExists[p]) {
|
||||
ropnet[j] = 0.0;
|
||||
ropf[j] = ropr[j];
|
||||
if (ropf[j] > 0.0) {
|
||||
for (int rp = 0; rp < nPhases(); rp++) {
|
||||
for (size_t rp = 0; rp < nPhases(); rp++) {
|
||||
if (m_rxnPhaseIsProduct[j][rp]) {
|
||||
if (! m_phaseExists[rp]) {
|
||||
ropnet[j] = 0.0;
|
||||
|
|
@ -912,7 +911,7 @@ namespace Cantera {
|
|||
m_rxnPhaseIsReactant[i] = new bool[np];
|
||||
m_rxnPhaseIsProduct[i] = new bool[np];
|
||||
|
||||
for (int p = 0; p < np; p++) {
|
||||
for (size_t p = 0; p < np; p++) {
|
||||
m_rxnPhaseIsReactant[i][p] = false;
|
||||
m_rxnPhaseIsProduct[i][p] = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -701,7 +701,6 @@ namespace Cantera {
|
|||
m_ns = kin.nTotalSpecies(); //ph.nSpecies();
|
||||
m_nr = kin.nReactions();
|
||||
|
||||
int m, i;
|
||||
//for (m = 0; m < m_nel; m++) {
|
||||
// m_elementSymbols.push_back(ph.elementName(m));
|
||||
//}
|
||||
|
|
@ -711,7 +710,7 @@ namespace Cantera {
|
|||
// mod 8/18/01 dgg
|
||||
vector<vector<size_t> > allProducts;
|
||||
vector<vector<size_t> > allReactants;
|
||||
for (i = 0; i < m_nr; i++) {
|
||||
for (size_t i = 0; i < m_nr; i++) {
|
||||
allReactants.push_back(kin.reactants(i));
|
||||
allProducts.push_back(kin.products(i));
|
||||
}
|
||||
|
|
@ -733,7 +732,7 @@ namespace Cantera {
|
|||
size_t nmol;
|
||||
map<size_t, int> net;
|
||||
|
||||
for (i = 0; i < m_nr; i++) {
|
||||
for (size_t i = 0; i < m_nr; i++) {
|
||||
|
||||
// construct the lists of reactant and product indices, not
|
||||
// including molecules that appear on both sides.
|
||||
|
|
@ -791,11 +790,11 @@ namespace Cantera {
|
|||
// that element among the products.
|
||||
|
||||
int nar, nap;
|
||||
for (i = 0; i < m_nr; i++) {
|
||||
for (size_t i = 0; i < m_nr; i++) {
|
||||
nr = m_reac[i].size();
|
||||
np = m_prod[i].size();
|
||||
m_determinate[i] = true;
|
||||
for (m = 0; m < m_nel; m++) {
|
||||
for (size_t m = 0; m < m_nel; m++) {
|
||||
nar = 0;
|
||||
nap = 0;
|
||||
for (size_t j = 0; j < nr; j++) {
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ namespace Cantera {
|
|||
doublereal sc;
|
||||
|
||||
// loop over the reactants
|
||||
for (int n = 0; n < nr; n++) {
|
||||
for (size_t n = 0; n < nr; n++) {
|
||||
k = r.reactants[n];
|
||||
order = r.rorder[n]; // stoich coeff
|
||||
|
||||
|
|
@ -392,7 +392,7 @@ namespace Cantera {
|
|||
doublereal e;
|
||||
string spname;
|
||||
if (nc > 0) {
|
||||
for (int n = 0; n < nc; n++) {
|
||||
for (size_t n = 0; n < nc; n++) {
|
||||
const XML_Node& cnode = *cov[n];
|
||||
spname = cnode["species"];
|
||||
k = surfphase.speciesIndex(spname);
|
||||
|
|
@ -690,9 +690,7 @@ namespace Cantera {
|
|||
if (r.hasChild("equation")) {
|
||||
eqn = r("equation");
|
||||
}
|
||||
int eqlen = static_cast<int>(eqn.size());
|
||||
int nn;
|
||||
for (nn = 0; nn < eqlen; nn++) {
|
||||
for (size_t nn = 0; nn < eqn.size(); nn++) {
|
||||
if (eqn[nn] == '[') eqn[nn] = '<';
|
||||
if (eqn[nn] == ']') eqn[nn] = '>';
|
||||
}
|
||||
|
|
@ -832,13 +830,13 @@ namespace Cantera {
|
|||
|
||||
map<int, doublereal> rxnstoich;
|
||||
rxnstoich.clear();
|
||||
for (nn = 0; nn < rdata.reactants.size(); nn++) {
|
||||
for (size_t nn = 0; nn < rdata.reactants.size(); nn++) {
|
||||
rxnstoich[-1 - int(rdata.reactants[nn])] -= rdata.rstoich[nn];
|
||||
}
|
||||
for (nn = 0; nn < rdata.products.size(); nn++) {
|
||||
for (size_t nn = 0; nn < rdata.products.size(); nn++) {
|
||||
rxnstoich[int(rdata.products[nn])+1] += rdata.pstoich[nn];
|
||||
}
|
||||
for (nn = 0; nn < m_rdata.size(); nn++) {
|
||||
for (size_t nn = 0; nn < m_rdata.size(); nn++) {
|
||||
if ((rdata.reactants.size() == m_nr[nn])
|
||||
&& (rdata.reactionType == m_typ[nn])) {
|
||||
c = isDuplicateReaction(rxnstoich, m_rdata[nn]);
|
||||
|
|
|
|||
|
|
@ -212,8 +212,7 @@ namespace Cantera {
|
|||
if (ifunc == SFLUX_JACOBIAN) {
|
||||
EXTRA_ACCURACY *= 0.001;
|
||||
}
|
||||
int k, irow;
|
||||
int jcol, info = 0;
|
||||
int info = 0;
|
||||
int label_t=-1; /* Species IDs for time control */
|
||||
int label_d; /* Species IDs for damping control */
|
||||
int label_t_old=-1;
|
||||
|
|
@ -263,7 +262,7 @@ namespace Cantera {
|
|||
SurfPhase *sf_ptr = m_ptrsSurfPhase[n];
|
||||
sf_ptr->getConcentrations(DATA_PTR(m_numEqn1));
|
||||
size_t nsp = m_nSpeciesSurfPhase[n];
|
||||
for (k = 0; k <nsp; k++) {
|
||||
for (size_t k = 0; k <nsp; k++) {
|
||||
m_CSolnSP[loc] = m_numEqn1[k];
|
||||
loc++;
|
||||
}
|
||||
|
|
@ -409,7 +408,7 @@ namespace Cantera {
|
|||
printf("solveSurfSS: Zero pivot, assuming converged: %g (%d)\n",
|
||||
resid_norm, info);
|
||||
}
|
||||
for (jcol = 0; jcol < m_neq; jcol++) m_resid[jcol] = 0.0;
|
||||
for (size_t jcol = 0; jcol < m_neq; jcol++) m_resid[jcol] = 0.0;
|
||||
|
||||
/* print out some helpful info */
|
||||
if (m_ioflag > 1) {
|
||||
|
|
@ -418,7 +417,7 @@ namespace Cantera {
|
|||
iter,t_real, 1.0/inv_t);
|
||||
printf("solveSurfProb: init guess, current concentration,"
|
||||
"and prod rate:\n");
|
||||
for (jcol = 0; jcol < m_neq; jcol++) {
|
||||
for (size_t jcol = 0; jcol < m_neq; jcol++) {
|
||||
printf("\t%d %g %g %g\n", jcol, m_CSolnSPInit[jcol], m_CSolnSP[jcol],
|
||||
m_netProductionRatesSave[m_kinSpecIndex[jcol]]);
|
||||
}
|
||||
|
|
@ -453,8 +452,8 @@ namespace Cantera {
|
|||
* Update the solution vector and real time
|
||||
* Crop the concentrations to zero.
|
||||
*/
|
||||
for (irow = 0; irow < m_neq; irow++) m_CSolnSP[irow] -= damp * m_resid[irow];
|
||||
for (irow = 0; irow < m_neq; irow++) {
|
||||
for (size_t irow = 0; irow < m_neq; irow++) m_CSolnSP[irow] -= damp * m_resid[irow];
|
||||
for (size_t irow = 0; irow < m_neq; irow++) {
|
||||
m_CSolnSP[irow] = MAX(0.0, m_CSolnSP[irow]);
|
||||
}
|
||||
updateState( DATA_PTR(m_CSolnSP));
|
||||
|
|
@ -1135,7 +1134,7 @@ namespace Cantera {
|
|||
printf("\n================================ INITIAL GUESS "
|
||||
"========================================\n");
|
||||
int kindexSP = 0;
|
||||
for (int isp = 0; isp < m_numSurfPhases; isp++) {
|
||||
for (size_t isp = 0; isp < m_numSurfPhases; isp++) {
|
||||
InterfaceKinetics *m_kin = m_objects[isp];
|
||||
int surfIndex = m_kin->surfacePhaseIndex();
|
||||
int nPhases = m_kin->nPhases();
|
||||
|
|
@ -1243,7 +1242,7 @@ namespace Cantera {
|
|||
printf("\t---------------------------------------------------------"
|
||||
"-----------------------------\n");
|
||||
int kindexSP = 0;
|
||||
for (int isp = 0; isp < m_numSurfPhases; isp++) {
|
||||
for (size_t isp = 0; isp < m_numSurfPhases; isp++) {
|
||||
int nsp = m_nSpeciesSurfPhase[isp];
|
||||
InterfaceKinetics *m_kin = m_objects[isp];
|
||||
//int surfPhaseIndex = m_kinObjPhaseIDSurfPhase[isp];
|
||||
|
|
@ -1332,7 +1331,7 @@ namespace Cantera {
|
|||
printf("---------------------------------------------------------------"
|
||||
"---------------------------------------------\n");
|
||||
int kindexSP = 0;
|
||||
for (int isp = 0; isp < m_numSurfPhases; isp++) {
|
||||
for (size_t isp = 0; isp < m_numSurfPhases; isp++) {
|
||||
int nsp = m_nSpeciesSurfPhase[isp];
|
||||
InterfaceKinetics *m_kin = m_objects[isp];
|
||||
//int surfPhaseIndex = m_kinObjPhaseIDSurfPhase[isp];
|
||||
|
|
@ -1361,7 +1360,7 @@ namespace Cantera {
|
|||
"---------------------------------------------\n");
|
||||
doublereal *XMolKinSpecies = DATA_PTR(m_numEqn2);
|
||||
kindexSP = 0;
|
||||
for (int isp = 0; isp < m_numSurfPhases; isp++) {
|
||||
for (size_t isp = 0; isp < m_numSurfPhases; isp++) {
|
||||
InterfaceKinetics *m_kin = m_objects[isp];
|
||||
int surfIndex = m_kin->surfacePhaseIndex();
|
||||
int nPhases = m_kin->nPhases();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue