Fixed a number of "shadowed variable" compiler warnings

This commit is contained in:
Ray Speth 2013-04-18 22:08:36 +00:00
parent ea8eca5bde
commit ee74c80afc
19 changed files with 146 additions and 152 deletions

View file

@ -70,7 +70,7 @@ public:
eosdata._require("model","Semiconductor");
doublereal rho = ctml::getFloat(eosdata, "density", "-");
setDensity(rho);
doublereal bandgap = ctml::getFloat(eosdata, "bandgap", "-");
m_bandgap = ctml::getFloat(eosdata, "bandgap", "-");
doublereal e_mass = ctml::getFloat(eosdata, "electron_mass", "-");
doublereal h_mass = ctml::getFloat(eosdata, "hole_mass", "-");
doublereal e_donor = ctml::getFloat(eosdata, "donor_energy", "-");
@ -80,7 +80,6 @@ public:
setEffectiveMasses(e_mass, h_mass);
setDonorDoping(n_donor, e_donor);
setAcceptorDoping(n_acceptor, e_acceptor);
m_bandgap = bandgap;
}
void setEffectiveMasses(doublereal e_mass, doublereal h_mass) {

View file

@ -250,7 +250,7 @@ doublereal fpValueCheck(const std::string& val)
if (ch == '+' || ch == '-') {
istart = 1;
}
for (int i = istart; i < str.size(); i++) {
for (size_t i = istart; i < str.size(); i++) {
ch = str[i];
if (isdigit(ch)) {
} else if (ch == '.') {

View file

@ -976,7 +976,7 @@ void HMWSoln::initThermo()
initLengths();
}
void HMWSoln::constructPhaseFile(std::string inputFile, std::string id)
void HMWSoln::constructPhaseFile(std::string inputFile, std::string id_)
{
if (inputFile.size() == 0) {
@ -996,23 +996,23 @@ void HMWSoln::constructPhaseFile(std::string inputFile, std::string id)
XML_Node& phaseNode_XML = xml();
XML_Node* fxml = new XML_Node();
fxml->build(fin);
XML_Node* fxml_phase = findXMLPhase(fxml, id);
XML_Node* fxml_phase = findXMLPhase(fxml, id_);
if (!fxml_phase) {
throw CanteraError("HMWSoln:constructPhaseFile",
"ERROR: Can not find phase named " +
id + " in file named " + inputFile);
id_ + " in file named " + inputFile);
}
fxml_phase->copy(&phaseNode_XML);
constructPhaseXML(*fxml_phase, id);
constructPhaseXML(*fxml_phase, id_);
delete fxml;
}
void HMWSoln::constructPhaseXML(XML_Node& phaseNode, std::string id)
void HMWSoln::constructPhaseXML(XML_Node& phaseNode, std::string id_)
{
string stemp;
if (id.size() > 0) {
if (id_.size() > 0) {
string idp = phaseNode.id();
if (idp != id) {
if (idp != id_) {
throw CanteraError("HMWSoln::constructPhaseXML",
"phasenode and Id are incompatible");
}

View file

@ -22,20 +22,20 @@ IdealGasPhase::IdealGasPhase() :
{
}
IdealGasPhase::IdealGasPhase(const std::string& inputFile, const std::string& id) :
IdealGasPhase::IdealGasPhase(const std::string& inputFile, const std::string& id_) :
m_p0(-1.0),
m_tlast(0.0),
m_logc0(0.0)
{
initThermoFile(inputFile, id);
initThermoFile(inputFile, id_);
}
IdealGasPhase::IdealGasPhase(XML_Node& phaseRef, const std::string& id) :
IdealGasPhase::IdealGasPhase(XML_Node& phaseRef, const std::string& id_) :
m_p0(-1.0),
m_tlast(0.0),
m_logc0(0.0)
{
initThermoXML(phaseRef, id);
initThermoXML(phaseRef, id_);
}
IdealGasPhase::~IdealGasPhase()

View file

@ -89,7 +89,7 @@ operator=(const IdealMolalSoln& b)
}
IdealMolalSoln::IdealMolalSoln(const std::string& inputFile,
const std::string& id) :
const std::string& id_) :
MolalityVPSSTP(),
m_formGC(2),
IMS_typeCutoff_(0),
@ -108,7 +108,7 @@ IdealMolalSoln::IdealMolalSoln(const std::string& inputFile,
IMS_agCut_(0.0),
IMS_bgCut_(0.0)
{
initThermoFile(inputFile, id);
initThermoFile(inputFile, id_);
}
IdealMolalSoln::IdealMolalSoln(XML_Node& root, const std::string& id_) :

View file

@ -426,8 +426,8 @@ void MixedSolventElectrolyte::initThermoXML(XML_Node& phaseNode, const std::stri
if (thermoNode.hasChild("activityCoefficients")) {
XML_Node& acNode = thermoNode.child("activityCoefficients");
acNodePtr = &acNode;
string mStringa = acNode.attrib("model");
string mString = lowercase(mStringa);
mStringa = acNode.attrib("model");
mString = lowercase(mStringa);
if (mString != "margules") {
throw CanteraError(subname.c_str(),
"Unknown activity coefficient model: " + mStringa);

View file

@ -490,14 +490,14 @@ void MixtureFugacityTP::setState_TPX(doublereal t, doublereal p, const doublerea
setState_TP(t,p);
}
void MixtureFugacityTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
void MixtureFugacityTP::initThermoXML(XML_Node& phaseNode, const std::string& id_)
{
MixtureFugacityTP::initLengths();
//m_VPSS_ptr->initThermo();
// m_VPSS_ptr->initThermoXML(phaseNode, id);
ThermoPhase::initThermoXML(phaseNode, id);
ThermoPhase::initThermoXML(phaseNode, id_);
}
doublereal MixtureFugacityTP::z() const
@ -868,7 +868,6 @@ doublereal MixtureFugacityTP::calculatePsat(doublereal TKelvin, doublereal& mola
pres = psatEst(TKelvin);
// trial value = Psat from correlation
int i;
doublereal volLiquid = liquidVolEst(TKelvin, pres);
RhoLiquidGood = mw / volLiquid;
RhoGasGood = pres * mw / (GasConstant * TKelvin);
@ -934,8 +933,7 @@ doublereal MixtureFugacityTP::calculatePsat(doublereal TKelvin, doublereal& mola
bool goodLiq;
bool goodGas;
for (int i = 0; i < 50; i++) {
doublereal densLiquid = densityCalc(TKelvin, pres, FLUID_LIQUID_0, RhoLiquidGood);
densLiquid = densityCalc(TKelvin, pres, FLUID_LIQUID_0, RhoLiquidGood);
if (densLiquid <= 0.0) {
goodLiq = false;
} else {
@ -943,7 +941,7 @@ doublereal MixtureFugacityTP::calculatePsat(doublereal TKelvin, doublereal& mola
RhoLiquidGood = densLiquid;
presLiquid = pres;
}
doublereal densGas = densityCalc(TKelvin, pres, FLUID_GAS, RhoGasGood);
densGas = densityCalc(TKelvin, pres, FLUID_GAS, RhoGasGood);
if (densGas <= 0.0) {
goodGas = false;
} else {
@ -982,7 +980,7 @@ doublereal MixtureFugacityTP::calculatePsat(doublereal TKelvin, doublereal& mola
* Now that we have found a good pressure we can proceed with the algorithm.
*/
for (i = 0; i < 20; i++) {
for (int i = 0; i < 20; i++) {
stab = corr0(TKelvin, pres, RhoLiquid, RhoGas, liqGRT, gasGRT);
if (stab == 0) {

View file

@ -524,7 +524,7 @@ void MolalityVPSSTP::initLengths()
m_molalities.resize(m_kk);
}
void MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
void MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id_)
{
initLengths();
@ -533,7 +533,7 @@ void MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
*/
setSolvent(0);
VPStandardStateTP::initThermoXML(phaseNode, id);
VPStandardStateTP::initThermoXML(phaseNode, id_);
}
/**
@ -608,8 +608,8 @@ std::string MolalityVPSSTP::report(bool show_thermo) const
sprintf(p, " heat capacity c_v %12.6g %12.4g J/K\n",
cv_mass(), cv_mole());
s += p;
} catch (CanteraError& err) {
err.save();
} catch (CanteraError& e) {
e.save();
sprintf(p, " heat capacity c_v <not implemented> \n");
s += p;
}

View file

@ -41,7 +41,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP() :
}
MolarityIonicVPSSTP::MolarityIonicVPSSTP(const std::string& inputFile,
const std::string& id) :
const std::string& id_) :
GibbsExcessVPSSTP(),
PBType_(PBTYPE_PASSTHROUGH),
numPBSpecies_(m_kk),
@ -51,11 +51,11 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(const std::string& inputFile,
numPassThroughSpecies_(0),
neutralPBindexStart(0)
{
initThermoFile(inputFile, id);
initThermoFile(inputFile, id_);
}
MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot,
const std::string& id) :
const std::string& id_) :
GibbsExcessVPSSTP(),
PBType_(PBTYPE_PASSTHROUGH),
numPBSpecies_(m_kk),
@ -65,7 +65,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot,
numPassThroughSpecies_(0),
neutralPBindexStart(0)
{
importPhase(*findXMLPhase(&phaseRoot, id), this);
importPhase(*findXMLPhase(&phaseRoot, id_), this);
}
MolarityIonicVPSSTP::MolarityIonicVPSSTP(const MolarityIonicVPSSTP& b) :
@ -454,8 +454,8 @@ void MolarityIonicVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string&
if (thermoNode.hasChild("activityCoefficients")) {
XML_Node& acNode = thermoNode.child("activityCoefficients");
acNodePtr = &acNode;
std::string mStringa = acNode.attrib("model");
std::string mString = lowercase(mStringa);
mStringa = acNode.attrib("model");
mString = lowercase(mStringa);
// if (mString != "redlich-kister") {
// throw CanteraError(subname.c_str(),
// "Unknown activity coefficient model: " + mStringa);
@ -549,15 +549,15 @@ std::string MolarityIonicVPSSTP::report(bool show_thermo) const
sprintf(p, " heat capacity c_v %12.6g %12.4g J/K\n",
cv_mass(), cv_mole());
s += p;
} catch (CanteraError& err) {
err.save();
} catch (CanteraError& e) {
e.save();
sprintf(p, " heat capacity c_v <not implemented> \n");
s += p;
}
}
} catch (CanteraError& err) {
err.save();
} catch (CanteraError& e) {
e.save();
}
return s;
}

View file

@ -128,17 +128,17 @@ public:
* - c[0] midpoint temperature
* - c[1] - c[7] coefficients for low T range
* - c[8] - c[14] coefficients for high T range
* @param minTemp minimum temperature for which this parameterization
* @param min_temp minimum temperature for which this parameterization
* is valid.
* @param maxTemp maximum temperature for which this parameterization
* @param max_temp maximum temperature for which this parameterization
* is valid.
* @param refPressure standard-state pressure for this parameterization.
* @param ref_pressure standard-state pressure for this parameterization.
* @see speciesThermoTypes.h
*/
virtual void install(const std::string& name, size_t index, int type,
const doublereal* c,
doublereal minTemp, doublereal maxTemp,
doublereal refPressure) {
doublereal min_temp, doublereal max_temp,
doublereal ref_pressure) {
m_name[index] = name;
int imid = int(c[0]); // midpoint temp converted to integer
@ -155,9 +155,9 @@ public:
m_group_map[index] = igrp;
m_posInGroup_map[index] = (int) m_low[igrp-1].size();
doublereal tlow = minTemp;
doublereal tlow = min_temp;
doublereal tmid = c[0];
doublereal thigh = maxTemp;
doublereal thigh = max_temp;
vector_fp chigh(c+8, c+15);
vector_fp clow(c+1, c+8);
@ -165,9 +165,9 @@ public:
ensureContinuity(name, tmid, &clow[0], &chigh[0]);
m_high[igrp-1].push_back(NasaPoly1(index, tmid, thigh,
refPressure, &chigh[0]));
ref_pressure, &chigh[0]));
m_low[igrp-1].push_back(NasaPoly1(index, tlow, tmid,
refPressure, &clow[0]));
ref_pressure, &clow[0]));
if (tlow > m_tlow_max) {
m_tlow_max = tlow;
@ -182,16 +182,16 @@ public:
m_tlow[index] = tlow;
m_thigh[index] = thigh;
if (m_p0 < 0.0) {
m_p0 = refPressure;
} else if (fabs(m_p0 - refPressure) > 0.1) {
m_p0 = ref_pressure;
} else if (fabs(m_p0 - ref_pressure) > 0.1) {
std::string logmsg = " ERROR NasaThermo: New Species, " + name + ", has a different reference pressure, "
+ fp2str(refPressure) + ", than existing reference pressure, " + fp2str(m_p0) + "\n";
+ fp2str(ref_pressure) + ", than existing reference pressure, " + fp2str(m_p0) + "\n";
writelog(logmsg);
logmsg = " This is now a fatal error\n";
writelog(logmsg);
throw CanteraError("install()", "species have different reference pressures");
}
m_p0 = refPressure;
m_p0 = ref_pressure;
}
virtual void install_STIT(SpeciesThermoInterpType* stit_ptr) {

View file

@ -121,9 +121,9 @@ std::string Phase::id() const
return m_id;
}
void Phase::setID(const std::string& id)
void Phase::setID(const std::string& id_)
{
m_id = id;
m_id = id_;
}
std::string Phase::name() const
@ -161,10 +161,10 @@ string Phase::elementName(size_t m) const
return m_elementNames[m];
}
size_t Phase::elementIndex(const std::string& name) const
size_t Phase::elementIndex(const std::string& elementName) const
{
for (size_t i = 0; i < m_mm; i++) {
if (m_elementNames[i] == name) {
if (m_elementNames[i] == elementName) {
return i;
}
}
@ -599,9 +599,9 @@ doublereal Phase::molarDensity() const
return density()/meanMolecularWeight();
}
void Phase::setMolarDensity(const doublereal molarDensity)
void Phase::setMolarDensity(const doublereal molar_density)
{
m_dens = molarDensity*meanMolecularWeight();
m_dens = molar_density*meanMolecularWeight();
}
doublereal Phase::molarVolume() const
@ -671,7 +671,7 @@ void Phase::addElement(const XML_Node& e)
}
void Phase::addUniqueElement(const std::string& symbol, doublereal weight,
int atomicNumber, doublereal entropy298,
int atomic_number, doublereal entropy298,
int elem_type)
{
if (weight == -12345.0) {
@ -701,7 +701,7 @@ void Phase::addUniqueElement(const std::string& symbol, doublereal weight,
}
m_atomicWeights.push_back(weight);
m_elementNames.push_back(symbol);
m_atomicNumbers.push_back(atomicNumber);
m_atomicNumbers.push_back(atomic_number);
m_entropy298.push_back(entropy298);
if (symbol == "E") {
m_elem_type.push_back(CT_ELEM_TYPE_ELECTRONCHARGE);
@ -833,13 +833,13 @@ size_t Phase::addUniqueElementAfterFreeze(const std::string& symbol,
return ii;
}
void Phase::addSpecies(const std::string& name, const doublereal* comp,
doublereal charge_, doublereal size)
void Phase::addSpecies(const std::string& name_, const doublereal* comp,
doublereal charge_, doublereal size_)
{
freezeElements();
m_speciesNames.push_back(name);
m_speciesNames.push_back(name_);
m_speciesCharge.push_back(charge_);
m_speciesSize.push_back(size);
m_speciesSize.push_back(size_);
size_t ne = nElements();
// Create a changeable copy of the element composition. We now change
// the charge potentially
@ -857,7 +857,7 @@ void Phase::addSpecies(const std::string& name, const doublereal* comp,
if (ecomp != 0.0) {
throw CanteraError("Phase::addSpecies",
"Input charge and element E compositions differ "
"for species " + name);
"for species " + name_);
} else {
// Just fix up the element E composition based on the input
// species charge
@ -881,33 +881,33 @@ void Phase::addSpecies(const std::string& name, const doublereal* comp,
m_kk++;
}
void Phase::addUniqueSpecies(const std::string& name, const doublereal* comp,
doublereal charge_, doublereal size)
void Phase::addUniqueSpecies(const std::string& name_, const doublereal* comp,
doublereal charge_, doublereal size_)
{
for (size_t k = 0; k < m_kk; k++) {
if (m_speciesNames[k] == name) {
if (m_speciesNames[k] == name_) {
// We have found a match. Do some compatibility checks.
for (size_t i = 0; i < m_mm; i++) {
if (comp[i] != m_speciesComp[k * m_mm + i]) {
throw CanteraError("addUniqueSpecies",
"Duplicate species have different "
"compositions: " + name);
"compositions: " + name_);
}
}
if (charge_ != m_speciesCharge[k]) {
throw CanteraError("addUniqueSpecies",
"Duplicate species have different "
"charges: " + name);
"charges: " + name_);
}
if (size != m_speciesSize[k]) {
if (size_ != m_speciesSize[k]) {
throw CanteraError("addUniqueSpecies",
"Duplicate species have different "
"sizes: " + name);
"sizes: " + name_);
}
return;
}
}
addSpecies(name, comp, charge_, size);
addSpecies(name_, comp, charge_, size_);
}
void Phase::freezeSpecies()

View file

@ -27,23 +27,23 @@ PhaseCombo_Interaction::PhaseCombo_Interaction() :
}
PhaseCombo_Interaction::PhaseCombo_Interaction(const std::string& inputFile,
const std::string& id) :
const std::string& id_) :
GibbsExcessVPSSTP(),
numBinaryInteractions_(0),
formMargules_(0),
formTempModel_(0)
{
initThermoFile(inputFile, id);
initThermoFile(inputFile, id_);
}
PhaseCombo_Interaction::PhaseCombo_Interaction(XML_Node& phaseRoot,
const std::string& id) :
const std::string& id_) :
GibbsExcessVPSSTP(),
numBinaryInteractions_(0),
formMargules_(0),
formTempModel_(0)
{
importPhase(*findXMLPhase(&phaseRoot, id), this);
importPhase(*findXMLPhase(&phaseRoot, id_), this);
}
PhaseCombo_Interaction::PhaseCombo_Interaction(const PhaseCombo_Interaction& b) :
@ -793,7 +793,6 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
throw CanteraError("PhaseCombo_Interaction::readXMLBinarySpecies",
"Incorrect name for processing this routine: " + xname);
}
double* charge = DATA_PTR(m_speciesCharge);
string stemp;
size_t nParamsFound;
vector_fp vParams;
@ -814,7 +813,7 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
return;
}
string ispName = speciesName(iSpecies);
if (charge[iSpecies] != 0) {
if (charge(iSpecies) != 0) {
throw CanteraError("PhaseCombo_Interaction::readXMLBinarySpecies", "speciesA charge problem");
}
size_t jSpecies = speciesIndex(jName);
@ -822,7 +821,7 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
return;
}
string jspName = speciesName(jSpecies);
if (charge[jSpecies] != 0) {
if (charge(jSpecies) != 0) {
throw CanteraError("PhaseCombo_Interaction::readXMLBinarySpecies", "speciesB charge problem");
}

View file

@ -195,9 +195,9 @@ void PseudoBinaryVPSSTP::initLengths()
moleFractions_.resize(m_kk);
}
void PseudoBinaryVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
void PseudoBinaryVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id_)
{
GibbsExcessVPSSTP::initThermoXML(phaseNode, id);
GibbsExcessVPSSTP::initThermoXML(phaseNode, id_);
}
std::string PseudoBinaryVPSSTP::report(bool show_thermo) const
@ -262,15 +262,15 @@ std::string PseudoBinaryVPSSTP::report(bool show_thermo) const
sprintf(p, " heat capacity c_v %12.6g %12.4g J/K\n",
cv_mass(), cv_mole());
s += p;
} catch (CanteraError& err) {
err.save();
} catch (CanteraError& e) {
e.save();
sprintf(p, " heat capacity c_v <not implemented> \n");
s += p;
}
}
} catch (CanteraError& err) {
err.save();
} catch (CanteraError& e) {
e.save();
}
return s;
}

View file

@ -425,8 +425,8 @@ std::string PureFluidPhase::report(bool show_thermo) const
sprintf(p, " heat capacity c_v %12.6g %12.4g J/K\n",
cv_mass(), cv_mole());
s += p;
} catch (CanteraError& err) {
err.save();
} catch (CanteraError& e) {
e.save();
sprintf(p, " heat capacity c_v <not implemented> \n");
s += p;
}

View file

@ -38,7 +38,7 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP() :
}
RedlichKisterVPSSTP::RedlichKisterVPSSTP(const std::string& inputFile,
const std::string& id) :
const std::string& id_) :
GibbsExcessVPSSTP(),
numBinaryInteractions_(0),
m_pSpecies_A_ij(0),
@ -50,11 +50,11 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(const std::string& inputFile,
formTempModel_(0),
dlnActCoeff_dX_()
{
initThermoFile(inputFile, id);
initThermoFile(inputFile, id_);
}
RedlichKisterVPSSTP::RedlichKisterVPSSTP(XML_Node& phaseRoot,
const std::string& id) :
const std::string& id_) :
GibbsExcessVPSSTP(),
numBinaryInteractions_(0),
m_pSpecies_A_ij(0),
@ -66,7 +66,7 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(XML_Node& phaseRoot,
formTempModel_(0),
dlnActCoeff_dX_()
{
importPhase(*findXMLPhase(&phaseRoot, id), this);
importPhase(*findXMLPhase(&phaseRoot, id_), this);
}
RedlichKisterVPSSTP::RedlichKisterVPSSTP(int testProb) :
@ -374,13 +374,13 @@ void RedlichKisterVPSSTP::initLengths()
dlnActCoeffdlnN_.resize(m_kk, m_kk);
}
void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id_)
{
std::string subname = "RedlichKisterVPSSTP::initThermoXML";
std::string stemp;
if ((int) id.size() > 0) {
if ((int) id_.size() > 0) {
string idp = phaseNode.id();
if (idp != id) {
if (idp != id_) {
throw CanteraError(subname,
"phasenode and Id are incompatible");
}
@ -409,8 +409,8 @@ void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string&
if (thermoNode.hasChild("activityCoefficients")) {
XML_Node& acNode = thermoNode.child("activityCoefficients");
acNodePtr = &acNode;
std::string mStringa = acNode.attrib("model");
std::string mString = lowercase(mStringa);
mStringa = acNode.attrib("model");
mString = lowercase(mStringa);
if (mString != "redlich-kister") {
throw CanteraError(subname.c_str(),
"Unknown activity coefficient model: " + mStringa);
@ -433,7 +433,7 @@ void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string&
/*
* Go down the chain
*/
GibbsExcessVPSSTP::initThermoXML(phaseNode, id);
GibbsExcessVPSSTP::initThermoXML(phaseNode, id_);
}
void RedlichKisterVPSSTP::s_update_lnActCoeff() const

View file

@ -53,7 +53,7 @@ RedlichKwongMFTP::RedlichKwongMFTP() :
Vroot_[2] = 0.0;
}
RedlichKwongMFTP::RedlichKwongMFTP(const std::string& infile, std::string id) :
RedlichKwongMFTP::RedlichKwongMFTP(const std::string& infile, std::string id_) :
MixtureFugacityTP(),
m_standardMixingRules(0),
m_formTempParam(0),
@ -77,18 +77,18 @@ RedlichKwongMFTP::RedlichKwongMFTP(const std::string& infile, std::string id) :
Vroot_[1] = 0.0;
Vroot_[2] = 0.0;
XML_Node* root = get_XML_File(infile);
if (id == "-") {
id = "";
if (id_ == "-") {
id_ = "";
}
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, root);
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id_, root);
if (!xphase) {
throw CanteraError("newPhase",
"Couldn't find phase named \"" + id + "\" in file, " + infile);
"Couldn't find phase named \"" + id_ + "\" in file, " + infile);
}
importPhase(*xphase, this);
}
RedlichKwongMFTP::RedlichKwongMFTP(XML_Node& phaseRefRoot, const std::string& id) :
RedlichKwongMFTP::RedlichKwongMFTP(XML_Node& phaseRefRoot, const std::string& id_) :
MixtureFugacityTP(),
m_standardMixingRules(0),
m_formTempParam(0),
@ -111,9 +111,9 @@ RedlichKwongMFTP::RedlichKwongMFTP(XML_Node& phaseRefRoot, const std::string& id
Vroot_[0] = 0.0;
Vroot_[1] = 0.0;
Vroot_[2] = 0.0;
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, &phaseRefRoot);
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id_, &phaseRefRoot);
if (!xphase) {
throw CanteraError("RedlichKwongMFTP::RedlichKwongMFTP()","Couldn't find phase named \"" + id + "\" in XML node");
throw CanteraError("RedlichKwongMFTP::RedlichKwongMFTP()","Couldn't find phase named \"" + id_ + "\" in XML node");
}
importPhase(*xphase, this);
}
@ -139,20 +139,20 @@ RedlichKwongMFTP::RedlichKwongMFTP(int testProb) :
dpdni_(0)
{
std::string infile = "co2_redlichkwong.xml";
std::string id;
std::string id_;
if (testProb == 1) {
infile = "co2_redlichkwong.xml";
id = "carbondioxide";
id_ = "carbondioxide";
} else {
throw CanteraError("", "test prob = 1 only");
}
XML_Node* root = get_XML_File(infile);
if (id == "-") {
id = "";
if (id_ == "-") {
id_ = "";
}
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, root);
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id_, root);
if (!xphase) {
throw CanteraError("newPhase", "Couldn't find phase named \"" + id + "\" in file, " + infile);
throw CanteraError("newPhase", "Couldn't find phase named \"" + id_ + "\" in file, " + infile);
}
importPhase(*xphase, this);
}
@ -1410,16 +1410,16 @@ int RedlichKwongMFTP::NicholsSolve(double TKelvin, double pres, doublereal a, do
//printf("NicholsSolve(): Alternative solution (p = %g T = %g)\n", pres, TKelvin);
doublereal ratio3 = a / (GasConstant * sqt) * pres / (GasConstant * TKelvin);
if (fabs(ratio2) < 1.0E-5 && fabs(ratio3) < 1.0E-5) {
doublereal z = 1.0;
doublereal zz = 1.0;
for (int i = 0; i < 10; i++) {
doublereal znew = z / (z - ratio2) - ratio3 / (z + ratio1);
doublereal deltaz = znew - z;
z = znew;
doublereal znew = zz / (zz - ratio2) - ratio3 / (zz + ratio1);
doublereal deltaz = znew - zz;
zz = znew;
if (fabs(deltaz) < 1.0E-14) {
break;
}
}
doublereal v = z * GasConstant * TKelvin / pres;
doublereal v = zz * GasConstant * TKelvin / pres;
Vroot[0] = v;
return 1;
}
@ -1523,7 +1523,7 @@ int RedlichKwongMFTP::NicholsSolve(double TKelvin, double pres, doublereal a, do
Vroot[1] = 0.0;
Vroot[2] = 0.0;
double tmp = an * Vroot[0] * Vroot[0] * Vroot[0] + bn * Vroot[0] * Vroot[0] + cn * Vroot[0] + dn;
tmp = an * Vroot[0] * Vroot[0] * Vroot[0] + bn * Vroot[0] * Vroot[0] + cn * Vroot[0] + dn;
if (fabs(tmp) > 1.0E-4) {
lotsOfNumError = true;
}
@ -1547,7 +1547,7 @@ int RedlichKwongMFTP::NicholsSolve(double TKelvin, double pres, doublereal a, do
Vroot[2] = alpha;
for (int i = 0; i < 3; i++) {
double tmp = an * Vroot[i] * Vroot[i] * Vroot[i] + bn * Vroot[i] * Vroot[i] + cn * Vroot[i] + dn;
tmp = an * Vroot[i] * Vroot[i] * Vroot[i] + bn * Vroot[i] * Vroot[i] + cn * Vroot[i] + dn;
if (fabs(tmp) > 1.0E-4) {
lotsOfNumError = true;
for (int j = 0; j < 3; j++) {
@ -1570,14 +1570,14 @@ int RedlichKwongMFTP::NicholsSolve(double TKelvin, double pres, doublereal a, do
} else {
// need to figure out whether delta is pos or neg
if (yN > 0.0) {
double tmp = pow(yN/(2*an), 1./3.);
tmp = pow(yN/(2*an), 1./3.);
if (fabs(tmp - delta) > 1.0E-9) {
throw CanteraError("RedlichKwongMFTP::NicholsSolve()", "unexpected");
}
Vroot[1] = xN + delta;
Vroot[0] = xN - 2.0*delta; // liquid phase root
} else {
double tmp = pow(yN/(2*an), 1./3.);
tmp = pow(yN/(2*an), 1./3.);
if (fabs(tmp - delta) > 1.0E-9) {
throw CanteraError("RedlichKwongMFTP::NicholsSolve()", "unexpected");
}
@ -1587,7 +1587,7 @@ int RedlichKwongMFTP::NicholsSolve(double TKelvin, double pres, doublereal a, do
}
}
for (int i = 0; i < 2; i++) {
double tmp = an * Vroot[i] * Vroot[i] * Vroot[i] + bn * Vroot[i] * Vroot[i] + cn * Vroot[i] + dn;
tmp = an * Vroot[i] * Vroot[i] * Vroot[i] + bn * Vroot[i] * Vroot[i] + cn * Vroot[i] + dn;
if (fabs(tmp) > 1.0E-4) {
lotsOfNumError = true;
}

View file

@ -16,7 +16,7 @@ static doublereal JoyceDixon(doublereal r)
SemiconductorPhase::SemiconductorPhase(std::string infile,
std::string id) {}
std::string id_) {}
// doublereal SemiconductorPhase::ionizedDonorConcentration() {

View file

@ -32,17 +32,17 @@ StoichSubstanceSSTP::StoichSubstanceSSTP():
{
}
StoichSubstanceSSTP::StoichSubstanceSSTP(const std::string& infile, std::string id) :
StoichSubstanceSSTP::StoichSubstanceSSTP(const std::string& infile, std::string id_) :
SingleSpeciesTP()
{
XML_Node* root = get_XML_File(infile);
if (id == "-") {
id = "";
if (id_ == "-") {
id_ = "";
}
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, root);
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id_, root);
if (!xphase) {
throw CanteraError("StoichSubstanceSSTP::StoichSubstanceSSTP",
"Couldn't find phase name in file:" + id);
"Couldn't find phase name in file:" + id_);
}
// Check the model name to ensure we have compatibility
const XML_Node& th = xphase->child("thermo");
@ -54,12 +54,12 @@ StoichSubstanceSSTP::StoichSubstanceSSTP(const std::string& infile, std::string
importPhase(*xphase, this);
}
StoichSubstanceSSTP::StoichSubstanceSSTP(XML_Node& xmlphase, const std::string& id) :
StoichSubstanceSSTP::StoichSubstanceSSTP(XML_Node& xmlphase, const std::string& id_) :
SingleSpeciesTP()
{
if (id != "") {
if (id_ != "") {
std::string idxml = xmlphase["id"];
if (id != idxml) {
if (id_ != idxml) {
throw CanteraError("StoichSubstanceSSTP::StoichSubstanceSSTP",
"id's don't match");
}
@ -198,8 +198,7 @@ void StoichSubstanceSSTP::getIntEnergy_RT(doublereal* urt) const
{
_updateThermo();
doublereal RT = GasConstant * temperature();
doublereal PV = m_p0 / molarDensity();
urt[0] = m_h0_RT[0] - PV / RT;
urt[0] = m_h0_RT[0] - m_p0 / molarDensity() / RT;
}
/*
@ -210,8 +209,7 @@ void StoichSubstanceSSTP::getIntEnergy_RT_ref(doublereal* urt) const
{
_updateThermo();
doublereal RT = GasConstant * temperature();
doublereal PV = m_p0 / molarDensity();
urt[0] = m_h0_RT[0] - PV / RT;
urt[0] = m_h0_RT[0] - m_p0 / molarDensity() / RT;
}
/*
@ -246,7 +244,7 @@ void StoichSubstanceSSTP::initThermo()
SingleSpeciesTP::initThermo();
}
void StoichSubstanceSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
void StoichSubstanceSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id_)
{
/*
* Find the Thermo XML node
@ -258,7 +256,7 @@ void StoichSubstanceSSTP::initThermoXML(XML_Node& phaseNode, const std::string&
XML_Node& tnode = phaseNode.child("thermo");
double dens = ctml::getFloatDefaultUnits(tnode, "density", "kg/m3");
setDensity(dens);
SingleSpeciesTP::initThermoXML(phaseNode, id);
SingleSpeciesTP::initThermoXML(phaseNode, id_);
}
void StoichSubstanceSSTP::setParameters(int n, doublereal* const c)
@ -292,17 +290,17 @@ electrodeElectron::electrodeElectron():
{
}
electrodeElectron::electrodeElectron(const std::string& infile, std::string id) :
electrodeElectron::electrodeElectron(const std::string& infile, std::string id_) :
StoichSubstanceSSTP()
{
XML_Node* root = get_XML_File(infile);
if (id == "-") {
id = "";
if (id_ == "-") {
id_ = "";
}
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, root);
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id_, root);
if (!xphase) {
throw CanteraError("electrodeElectron::electrodeElectron",
"Couldn't find phase name in file:" + id);
"Couldn't find phase name in file:" + id_);
}
// Check the model name to ensure we have compatibility
const XML_Node& th = xphase->child("thermo");
@ -314,12 +312,12 @@ electrodeElectron::electrodeElectron(const std::string& infile, std::string id)
importPhase(*xphase, this);
}
electrodeElectron::electrodeElectron(XML_Node& xmlphase, const std::string& id) :
electrodeElectron::electrodeElectron(XML_Node& xmlphase, const std::string& id_) :
StoichSubstanceSSTP()
{
if (id != "") {
if (id_ != "") {
std::string idxml = xmlphase["id"];
if (id != idxml) {
if (id_ != idxml) {
throw CanteraError("electrodeElectron::electrodeElectron",
"id's don't match");
}
@ -361,11 +359,11 @@ void electrodeElectron::setParametersFromXML(const XML_Node& eosdata)
}
}
void electrodeElectron::initThermoXML(XML_Node& phaseNode, const std::string& id)
void electrodeElectron::initThermoXML(XML_Node& phaseNode, const std::string& id_)
{
doublereal rho = 10.0;
setDensity(rho);
SingleSpeciesTP::initThermoXML(phaseNode, id);
SingleSpeciesTP::initThermoXML(phaseNode, id_);
}
void electrodeElectron::setParameters(int n, doublereal* const c)

View file

@ -30,7 +30,7 @@ SurfPhase::SurfPhase(doublereal n0):
setNDim(2);
}
SurfPhase::SurfPhase(const std::string& infile, std::string id) :
SurfPhase::SurfPhase(const std::string& infile, std::string id_) :
ThermoPhase(),
m_n0(0.0),
m_logn0(0.0),
@ -38,13 +38,13 @@ SurfPhase::SurfPhase(const std::string& infile, std::string id) :
m_tlast(0.0)
{
XML_Node* root = get_XML_File(infile);
if (id == "-") {
id = "";
if (id_ == "-") {
id_ = "";
}
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, root);
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id_, root);
if (!xphase) {
throw CanteraError("SurfPhase::SurfPhase",
"Couldn't find phase name in file:" + id);
"Couldn't find phase name in file:" + id_);
}
// Check the model name to ensure we have compatibility
const XML_Node& th = xphase->child("thermo");