Removed unnecessary temporaries used for storing return values

This commit is contained in:
Ray Speth 2013-02-14 01:04:07 +00:00
parent e04e59cdd3
commit 934010136d
50 changed files with 183 additions and 368 deletions

View file

@ -271,8 +271,7 @@ typedef double(*VCS_FUNC_PTR)(double xval, double Vtarget,
double tmp1 = theta1 + sin(theta1) * cos(theta1) - 2.0 * h_2 / rad_cyl * sin(theta1); double tmp1 = theta1 + sin(theta1) * cos(theta1) - 2.0 * h_2 / rad_cyl * sin(theta1);
double f_buoy = tmp * (Pi * rho_gas + (rho_liq - rho_gas) * tmp1); double f_buoy = tmp * (Pi * rho_gas + (rho_liq - rho_gas) * tmp1);
double f_sten = 2 * sigma * sin(theta1 + alpha1 - Pi); double f_sten = 2 * sigma * sin(theta1 + alpha1 - Pi);
double f_net = f_grav + f_buoy + f_sten; return f_grav + f_buoy + f_sten;
return f_net;
} }
double calc_h2_farfield(double theta1) { double calc_h2_farfield(double theta1) {
double rhs = sigma * (1.0 + cos(alpha1 + theta1)); double rhs = sigma * (1.0 + cos(alpha1 + theta1));
@ -281,14 +280,12 @@ typedef double(*VCS_FUNC_PTR)(double xval, double Vtarget,
double sign = -1.0; double sign = -1.0;
if (alpha1 + theta1 < Pi) sign = 1.0; if (alpha1 + theta1 < Pi) sign = 1.0;
double res = sign * sqrt(rhs); double res = sign * sqrt(rhs);
double h2 = res + rad_cyl * cos(theta1); return res + rad_cyl * cos(theta1);
return h2;
} }
double funcZero(double xval, double Vtarget, int varID, void *fptrPassthrough, int *err) { double funcZero(double xval, double Vtarget, int varID, void *fptrPassthrough, int *err) {
double theta = xval; double theta = xval;
double h2 = calc_h2_farfield(theta); double h2 = calc_h2_farfield(theta);
double fv = func_vert(theta, h2, rho_cyl); return func_vert(theta, h2, rho_cyl);
return fv;
} }
int main () { int main () {
double thetamax = Pi; double thetamax = Pi;

View file

@ -81,8 +81,7 @@ inline Kinetics* newKineticsMgr(XML_Node& phase,
if (f == 0) { if (f == 0) {
f = KineticsFactory::factory(); f = KineticsFactory::factory();
} }
Kinetics* kin = f->newKinetics(phase, th); return f->newKinetics(phase, th);
return kin;
} }
/** /**
@ -93,8 +92,7 @@ inline Kinetics* newKineticsMgr(const std::string& model, KineticsFactory* f=0)
if (f == 0) { if (f == 0) {
f = KineticsFactory::factory(); f = KineticsFactory::factory();
} }
Kinetics* kin = f->newKinetics(model); return f->newKinetics(model);
return kin;
} }
} }

View file

@ -380,15 +380,13 @@ public:
virtual Func1& duplicate() const { virtual Func1& duplicate() const {
Func1& f1d = m_f1->duplicate(); Func1& f1d = m_f1->duplicate();
Func1& f2d = m_f2->duplicate(); Func1& f2d = m_f2->duplicate();
Func1& dup = newSumFunction(f1d, f2d); return newSumFunction(f1d, f2d);
return dup;
} }
virtual Func1& derivative() const { virtual Func1& derivative() const {
Func1& d1 = m_f1->derivative(); Func1& d1 = m_f1->derivative();
Func1& d2 = m_f2->derivative(); Func1& d2 = m_f2->derivative();
Func1& d = newSumFunction(d1, d2); return newSumFunction(d1, d2);
return d;
} }
virtual int order() const { virtual int order() const {
return 0; return 0;
@ -445,12 +443,10 @@ public:
virtual Func1& duplicate() const { virtual Func1& duplicate() const {
Func1& f1d = m_f1->duplicate(); Func1& f1d = m_f1->duplicate();
Func1& f2d = m_f2->duplicate(); Func1& f2d = m_f2->duplicate();
Func1& dup = newDiffFunction(f1d, f2d); return newDiffFunction(f1d, f2d);
return dup;
} }
virtual Func1& derivative() const { virtual Func1& derivative() const {
Func1& d = newDiffFunction(m_f1->derivative(), m_f2->derivative()); return newDiffFunction(m_f1->derivative(), m_f2->derivative());
return d;
} }
virtual int order() const { virtual int order() const {
return 0; return 0;
@ -505,8 +501,7 @@ public:
virtual Func1& duplicate() const { virtual Func1& duplicate() const {
Func1& f1d = m_f1->duplicate(); Func1& f1d = m_f1->duplicate();
Func1& f2d = m_f2->duplicate(); Func1& f2d = m_f2->duplicate();
Func1& dup = newProdFunction(f1d, f2d); return newProdFunction(f1d, f2d);
return dup;
} }
virtual std::string write(const std::string& arg) const; virtual std::string write(const std::string& arg) const;
@ -518,8 +513,7 @@ public:
virtual Func1& derivative() const { virtual Func1& derivative() const {
Func1& a1 = newProdFunction(m_f1->duplicate(), m_f2->derivative()); Func1& a1 = newProdFunction(m_f1->duplicate(), m_f2->derivative());
Func1& a2 = newProdFunction(m_f2->duplicate(), m_f1->derivative()); Func1& a2 = newProdFunction(m_f2->duplicate(), m_f1->derivative());
Func1& s = newSumFunction(a1, a2); return newSumFunction(a1, a2);
return s;
} }
virtual int order() const { virtual int order() const {
return 1; return 1;
@ -651,8 +645,7 @@ public:
return m_f1->eval(t) + m_c; return m_f1->eval(t) + m_c;
} }
virtual Func1& derivative() const { virtual Func1& derivative() const {
Func1& f1d = m_f1->derivative(); return m_f1->derivative();
return f1d;
} }
virtual std::string write(const std::string& arg) const; virtual std::string write(const std::string& arg) const;
@ -712,8 +705,7 @@ public:
virtual Func1& duplicate() const { virtual Func1& duplicate() const {
Func1& f1d = m_f1->duplicate(); Func1& f1d = m_f1->duplicate();
Func1& f2d = m_f2->duplicate(); Func1& f2d = m_f2->duplicate();
Func1& dup = newRatioFunction(f1d, f2d); return newRatioFunction(f1d, f2d);
return dup;
} }
virtual Func1& derivative() const { virtual Func1& derivative() const {
@ -721,8 +713,7 @@ public:
Func1& a2 = newProdFunction(m_f1->duplicate(), m_f2->derivative()); Func1& a2 = newProdFunction(m_f1->duplicate(), m_f2->derivative());
Func1& s = newDiffFunction(a1, a2); Func1& s = newDiffFunction(a1, a2);
Func1& p = newProdFunction(m_f2->duplicate(), m_f2->duplicate()); Func1& p = newProdFunction(m_f2->duplicate(), m_f2->duplicate());
Func1& r = newRatioFunction(s, p); return newRatioFunction(s, p);
return r;
} }
virtual std::string write(const std::string& arg) const; virtual std::string write(const std::string& arg) const;
@ -782,8 +773,7 @@ public:
virtual Func1& duplicate() const { virtual Func1& duplicate() const {
Func1& f1d = m_f1->duplicate(); Func1& f1d = m_f1->duplicate();
Func1& f2d = m_f2->duplicate(); Func1& f2d = m_f2->duplicate();
Func1& dup = newCompositeFunction(f1d, f2d); return newCompositeFunction(f1d, f2d);
return dup;
} }
virtual Func1& derivative() const { virtual Func1& derivative() const {

View file

@ -294,8 +294,7 @@ public:
protected: protected:
doublereal component(const doublereal* x, size_t i, size_t j) const { doublereal component(const doublereal* x, size_t i, size_t j) const {
doublereal xx = x[index(i,j)]; return x[index(i,j)];
return xx;
} }
doublereal conc(const doublereal* x, size_t k,size_t j) const { doublereal conc(const doublereal* x, size_t k,size_t j) const {

View file

@ -172,8 +172,7 @@ double PrintCtrl::cropAbs10(const double d, int Ndec) const
N10 += 1; N10 += 1;
} }
int nsig = N10 - Ndec; int nsig = N10 - Ndec;
double retn = cropSigDigits(d, nsig); return cropSigDigits(d, nsig);
return retn;
} }
// Crop a double at a certain number of significant digits // Crop a double at a certain number of significant digits

View file

@ -1236,8 +1236,7 @@ std::string string16_EOSType(int EOSType)
break; break;
} }
st[16] = '\0'; st[16] = '\0';
std::string sss=st; return st;
return sss;
} }
/***************************************************************************/ /***************************************************************************/
@ -1620,8 +1619,7 @@ void vcs_VolPhase::setElementType(const size_t e, const int eType)
double const* const* vcs_VolPhase::getFormulaMatrix() const double const* const* vcs_VolPhase::getFormulaMatrix() const
{ {
double const* const* fm = m_formulaMatrix.constBaseDataAddr(); return m_formulaMatrix.constBaseDataAddr();
return fm;
} }
/***************************************************************************/ /***************************************************************************/

View file

@ -2063,8 +2063,7 @@ double VCS_SOLVE::vcs_minor_alt_calc(size_t kspec, size_t irxn, bool* do_delete
if (w_kspec < VCS_DELETE_MINORSPECIES_CUTOFF) { if (w_kspec < VCS_DELETE_MINORSPECIES_CUTOFF) {
goto L_ZERO_SPECIES; goto L_ZERO_SPECIES;
} }
dx = molNum_kspec_new - w_kspec; return molNum_kspec_new - w_kspec;
return dx;
} else { } else {
if (fabs(dg_irxn) <= m_tolmin2) { if (fabs(dg_irxn) <= m_tolmin2) {
molNum_kspec_new = w_kspec; molNum_kspec_new = w_kspec;
@ -2129,8 +2128,7 @@ double VCS_SOLVE::vcs_minor_alt_calc(size_t kspec, size_t irxn, bool* do_delete
if ((molNum_kspec_new) < VCS_DELETE_MINORSPECIES_CUTOFF) { if ((molNum_kspec_new) < VCS_DELETE_MINORSPECIES_CUTOFF) {
goto L_ZERO_SPECIES; goto L_ZERO_SPECIES;
} }
dx = molNum_kspec_new - w_kspec; return molNum_kspec_new - w_kspec;
return dx;
/* /*
* *
* Alternate return based for cases where we need to delete the species * Alternate return based for cases where we need to delete the species
@ -2140,8 +2138,7 @@ double VCS_SOLVE::vcs_minor_alt_calc(size_t kspec, size_t irxn, bool* do_delete
L_ZERO_SPECIES: L_ZERO_SPECIES:
; ;
*do_delete = true; *do_delete = true;
dx = - w_kspec; return - w_kspec;
return dx;
} else { } else {
/* /*
* Voltage calculation * Voltage calculation
@ -4733,8 +4730,6 @@ void VCS_SOLVE::vcs_updateVP(const int vcsState)
*/ */
bool VCS_SOLVE::vcs_evaluate_speciesType() bool VCS_SOLVE::vcs_evaluate_speciesType()
{ {
bool allMinorZeroedSpecies;
m_numRxnMinorZeroed = 0; m_numRxnMinorZeroed = 0;
#ifdef DEBUG_MODE #ifdef DEBUG_MODE
if (m_debug_print_lvl >= 2) { if (m_debug_print_lvl >= 2) {
@ -4811,9 +4806,7 @@ bool VCS_SOLVE::vcs_evaluate_speciesType()
} }
#endif #endif
allMinorZeroedSpecies = (m_numRxnMinorZeroed >= m_numRxnRdc); return (m_numRxnMinorZeroed >= m_numRxnRdc);
return allMinorZeroedSpecies;
} }
/*****************************************************************************/ /*****************************************************************************/

View file

@ -267,12 +267,10 @@ double VCS_SPECIES_THERMO::G0_R_calc(size_t kglob, double TKelvin)
#endif #endif
double fe, H, S; double fe, H, S;
if (SS0_Model == VCS_SS0_CONSTANT) { if (SS0_Model == VCS_SS0_CONSTANT) {
fe = SS0_feSave; return SS0_feSave;
return fe;
} }
if (TKelvin == SS0_TSave) { if (TKelvin == SS0_TSave) {
fe = SS0_feSave; return SS0_feSave;
return fe;
} }
if (UseCanteraCalls) { if (UseCanteraCalls) {
if (m_VCS_UnitsFormat != VCS_UNITS_MKS) { if (m_VCS_UnitsFormat != VCS_UNITS_MKS) {

View file

@ -660,8 +660,7 @@ extern "C" {
} }
Kinetics* kin = newKineticsMgr(*x, phases); Kinetics* kin = newKineticsMgr(*x, phases);
if (kin) { if (kin) {
int k = KineticsCabinet::add(kin); return KineticsCabinet::add(kin);
return k;
} else { } else {
return 0; return 0;
} }

View file

@ -52,8 +52,7 @@ extern "C" {
{ {
try { try {
XML_Node* x = Cantera::get_XML_File(f2string(file, filelen)); XML_Node* x = Cantera::get_XML_File(f2string(file, filelen));
int ix = XmlCabinet::add(x); return XmlCabinet::add(x);
return ix;
} catch (...) { } catch (...) {
return handleAllExceptions(-1, ERR); return handleAllExceptions(-1, ERR);
} }

View file

@ -381,8 +381,7 @@ public:
virtual doublereal F(doublereal pr, const doublereal* work) const { virtual doublereal F(doublereal pr, const doublereal* work) const {
doublereal lpr = log10(std::max(pr,SmallNumber)); doublereal lpr = log10(std::max(pr,SmallNumber));
doublereal xx = 1.0/(1.0 + lpr*lpr); doublereal xx = 1.0/(1.0 + lpr*lpr);
doublereal ff = pow(*work , xx); return pow(*work , xx);
return ff;
} }
//! Utility function that returns the size of the workspace //! Utility function that returns the size of the workspace

View file

@ -890,9 +890,7 @@ calc_t(doublereal netProdRateSolnSP[], doublereal XMolSolnSP[],
*label_old = *label; *label_old = *label;
*label_factor = 1.0; *label_factor = 1.0;
} }
inv_timeScale = inv_timeScale / *label_factor; return inv_timeScale / *label_factor;
return inv_timeScale;
} /* calc_t */ } /* calc_t */
/* /*

View file

@ -973,8 +973,7 @@ double BEulerInt::time_error_norm()
error = (m_y_n[i] - m_y_pred_n[i]) / m_ewt[i]; error = (m_y_n[i] - m_y_pred_n[i]) / m_ewt[i];
rel_norm += (error * error); rel_norm += (error * error);
} }
rel_norm = sqrt(rel_norm / m_neq); return sqrt(rel_norm / m_neq);
return rel_norm;
} }
/************************************************************************* /*************************************************************************

View file

@ -248,9 +248,7 @@ string Pow1::write(const std::string& arg) const
string Const1::write(const std::string& arg) const string Const1::write(const std::string& arg) const
{ {
//cout << "Const1" << endl; //cout << "Const1" << endl;
string c = ""; return fp2str(m_c);
c = fp2str(m_c);
return c;
} }
string Ratio1::write(const std::string& arg) const string Ratio1::write(const std::string& arg) const

View file

@ -1798,8 +1798,7 @@ doublereal NonlinearSolver::expectedResidLeg(int leg, doublereal alpha) const
+ alpha * alpha * Nuu_ * Nuu_ * res0_2 + alpha * alpha * Nuu_ * Nuu_ * res0_2
- 2 * alpha * Nuu_ * (1.0 - alpha) * RdotJS; - 2 * alpha * Nuu_ * (1.0 - alpha) * RdotJS;
resNorm = sqrt(res2 / neq_); return sqrt(res2 / neq_);
return resNorm;
} else { } else {
doublereal beta = Nuu_ + alpha * (1.0 - Nuu_); doublereal beta = Nuu_ + alpha * (1.0 - Nuu_);
@ -2299,8 +2298,7 @@ doublereal NonlinearSolver::calcTrustDistance(std::vector<doublereal> const& de
tmp = deltaX[i] / deltaX_trust_[i]; tmp = deltaX[i] / deltaX_trust_[i];
sum += tmp * tmp; sum += tmp * tmp;
} }
sum = sqrt(sum / neq_) / trustDelta_; return sqrt(sum / neq_) / trustDelta_;
return sum;
} }
//==================================================================================================================== //====================================================================================================================
// Given a trust distance, this routine calculates the intersection of the this distance with the // Given a trust distance, this routine calculates the intersection of the this distance with the
@ -2380,7 +2378,7 @@ int NonlinearSolver::calcTrustIntersection(doublereal trustDelta, doublereal& la
doublereal NonlinearSolver::boundStep(const doublereal* const y, const doublereal* const step0) doublereal NonlinearSolver::boundStep(const doublereal* const y, const doublereal* const step0)
{ {
size_t i_lower = npos; size_t i_lower = npos;
doublereal fbound = 1.0, f_bounds = 1.0; doublereal f_bounds = 1.0;
doublereal ff, y_new; doublereal ff, y_new;
for (size_t i = 0; i < neq_; i++) { for (size_t i = 0; i < neq_; i++) {
@ -2424,9 +2422,7 @@ doublereal NonlinearSolver::boundStep(const doublereal* const y, const doublerea
} }
doublereal f_delta_bounds = deltaBoundStep(y, step0); doublereal f_delta_bounds = deltaBoundStep(y, step0);
fbound = std::min(f_bounds, f_delta_bounds); return std::min(f_bounds, f_delta_bounds);
return fbound;
} }
//=================================================================================================================== //===================================================================================================================
// Find a damping coefficient through a look-ahead mechanism // Find a damping coefficient through a look-ahead mechanism
@ -4061,8 +4057,7 @@ calc_ydot(const int order, const doublereal* const y_curr, doublereal* const ydo
doublereal NonlinearSolver::filterNewStep(const doublereal timeCurrent, doublereal NonlinearSolver::filterNewStep(const doublereal timeCurrent,
const doublereal* const ybase, doublereal* const step0) const doublereal* const ybase, doublereal* const step0)
{ {
doublereal tmp = m_func->filterNewStep(timeCurrent, ybase, step0); return m_func->filterNewStep(timeCurrent, ybase, step0);
return tmp;
} }
//==================================================================================================================== //====================================================================================================================
// Apply a filtering process to the new solution // Apply a filtering process to the new solution
@ -4076,8 +4071,7 @@ doublereal NonlinearSolver::filterNewStep(const doublereal timeCurrent,
doublereal NonlinearSolver::filterNewSolution(const doublereal timeCurrent, doublereal NonlinearSolver::filterNewSolution(const doublereal timeCurrent,
doublereal* const y_current, doublereal* const ydot_current) doublereal* const y_current, doublereal* const ydot_current)
{ {
doublereal tmp = m_func->filterSolnPrediction(timeCurrent, y_current); return m_func->filterSolnPrediction(timeCurrent, y_current);
return tmp;
} }
//==================================================================================================================== //====================================================================================================================
// Compute the Residual Weights // Compute the Residual Weights

View file

@ -317,8 +317,7 @@ int ResidJacEval::eval(const doublereal t, const doublereal* const y, const doub
doublereal* const r) doublereal* const r)
{ {
double deltaT = -1.0; double deltaT = -1.0;
int flag = evalResidNJ(t, deltaT, y, ydot, r); return evalResidNJ(t, deltaT, y, ydot, r);
return flag;
} }
//==================================================================================================================== //====================================================================================================================
// Calculate an analytical jacobian and the residual at the current time and values. // Calculate an analytical jacobian and the residual at the current time and values.

View file

@ -240,8 +240,7 @@ int OneDim::solve(doublereal* x, doublereal* xnew, int loglevel)
m_jac->updateTransient(m_rdt, DATA_PTR(m_mask)); m_jac->updateTransient(m_rdt, DATA_PTR(m_mask));
m_jac_ok = true; m_jac_ok = true;
} }
int m = m_newt->solve(x, xnew, *this, *m_jac, loglevel); return m_newt->solve(x, xnew, *this, *m_jac, loglevel);
return m;
} }
void OneDim::evalSSJacobian(doublereal* x, doublereal* xnew) void OneDim::evalSSJacobian(doublereal* x, doublereal* xnew)

View file

@ -29,8 +29,7 @@ ct_refcnt(PyObject* self, PyObject* args)
if (!PyArg_ParseTuple(args, "O", &o)) { if (!PyArg_ParseTuple(args, "O", &o)) {
return NULL; return NULL;
} }
PyObject* cnt = Py_BuildValue("i",o->ob_refcnt); return Py_BuildValue("i",o->ob_refcnt);
return cnt;
} }
// static PyObject * // static PyObject *

View file

@ -7,8 +7,7 @@ py_xml_new(PyObject* self, PyObject* args)
return NULL; return NULL;
} }
int n = xml_new(nm); int n = xml_new(nm);
PyObject* pn = Py_BuildValue("i",n); return Py_BuildValue("i",n);
return pn;
} }
static PyObject* static PyObject*
@ -23,8 +22,7 @@ py_xml_get_XML_File(PyObject* self, PyObject* args)
if (n < 0) { if (n < 0) {
return reportError(n); return reportError(n);
} }
PyObject* pn = Py_BuildValue("i",n); return Py_BuildValue("i",n);
return pn;
} }

View file

@ -212,8 +212,7 @@ doublereal DebyeHuckel::intEnergy_mole() const
double hh = enthalpy_mole(); double hh = enthalpy_mole();
double pres = pressure(); double pres = pressure();
double molarV = 1.0/molarDensity(); double molarV = 1.0/molarDensity();
double uu = hh - pres * molarV; return hh - pres * molarV;
return uu;
} }
doublereal DebyeHuckel::entropy_mole() const doublereal DebyeHuckel::entropy_mole() const
@ -231,8 +230,7 @@ doublereal DebyeHuckel::gibbs_mole() const
doublereal DebyeHuckel::cp_mole() const doublereal DebyeHuckel::cp_mole() const
{ {
getPartialMolarCp(DATA_PTR(m_tmpV)); getPartialMolarCp(DATA_PTR(m_tmpV));
double val = mean_X(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV));
return val;
} }
doublereal DebyeHuckel::cv_mole() const doublereal DebyeHuckel::cv_mole() const
@ -1331,8 +1329,7 @@ double DebyeHuckel::_lnactivityWaterHelgesonFixedForm() const
if (sum > 2.0 * m_maxIionicStrength) { if (sum > 2.0 * m_maxIionicStrength) {
sum = 2.0 * m_maxIionicStrength; sum = 2.0 * m_maxIionicStrength;
}; };
double lac = - m_Mnaught * sum * oc; return - m_Mnaught * sum * oc;
return lac;
} }
void DebyeHuckel::s_update_lnMolalityActCoeff() const void DebyeHuckel::s_update_lnMolalityActCoeff() const

View file

@ -575,8 +575,7 @@ doublereal HMWSoln::enthalpy_mole() const
{ {
getPartialMolarEnthalpies(DATA_PTR(m_tmpV)); getPartialMolarEnthalpies(DATA_PTR(m_tmpV));
getMoleFractions(DATA_PTR(m_pp)); getMoleFractions(DATA_PTR(m_pp));
double val = mean_X(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV));
return val;
} }
doublereal HMWSoln::relative_enthalpy() const doublereal HMWSoln::relative_enthalpy() const
@ -629,8 +628,7 @@ doublereal HMWSoln::relative_molal_enthalpy() const
} }
} }
xuse = xuse / factor; xuse = xuse / factor;
L = L / xuse; return L / xuse;
return L;
} }
doublereal HMWSoln::intEnergy_mole() const doublereal HMWSoln::intEnergy_mole() const
@ -638,8 +636,7 @@ doublereal HMWSoln::intEnergy_mole() const
double hh = enthalpy_mole(); double hh = enthalpy_mole();
double pres = pressure(); double pres = pressure();
double molarV = 1.0/molarDensity(); double molarV = 1.0/molarDensity();
double uu = hh - pres * molarV; return hh - pres * molarV;
return uu;
} }
doublereal HMWSoln::entropy_mole() const doublereal HMWSoln::entropy_mole() const
@ -657,8 +654,7 @@ doublereal HMWSoln::gibbs_mole() const
doublereal HMWSoln::cp_mole() const doublereal HMWSoln::cp_mole() const
{ {
getPartialMolarCp(DATA_PTR(m_tmpV)); getPartialMolarCp(DATA_PTR(m_tmpV));
double val = mean_X(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV));
return val;
} }
doublereal HMWSoln::cv_mole() const doublereal HMWSoln::cv_mole() const
@ -668,8 +664,7 @@ doublereal HMWSoln::cv_mole() const
double cp = cp_mole(); double cp = cp_mole();
double tt = temperature(); double tt = temperature();
double molarV = molarVolume(); double molarV = molarVolume();
double cv = cp - beta * beta * tt * molarV / kappa_t; return cp - beta * beta * tt * molarV / kappa_t;
return cv;
} }
// //
@ -1124,8 +1119,7 @@ double HMWSoln::ADebye_L(double tempArg, double presArg) const
if (tempArg != -1.0) { if (tempArg != -1.0) {
T = tempArg; T = tempArg;
} }
double retn = dAphidT * (4.0 * GasConstant * T * T); return dAphidT * (4.0 * GasConstant * T * T);
return retn;
} }
double HMWSoln::ADebye_V(double tempArg, double presArg) const double HMWSoln::ADebye_V(double tempArg, double presArg) const
@ -1136,8 +1130,7 @@ double HMWSoln::ADebye_V(double tempArg, double presArg) const
if (tempArg != -1.0) { if (tempArg != -1.0) {
T = tempArg; T = tempArg;
} }
double retn = - dAphidP * (4.0 * GasConstant * T); return - dAphidP * (4.0 * GasConstant * T);
return retn;
} }
double HMWSoln::ADebye_J(double tempArg, double presArg) const double HMWSoln::ADebye_J(double tempArg, double presArg) const
@ -1149,8 +1142,7 @@ double HMWSoln::ADebye_J(double tempArg, double presArg) const
double A_L = ADebye_L(T, presArg); double A_L = ADebye_L(T, presArg);
double d2 = d2A_DebyedT2_TP(T, presArg); double d2 = d2A_DebyedT2_TP(T, presArg);
double d2Aphi = d2 / 3.0; double d2Aphi = d2 / 3.0;
double retn = 2.0 * A_L / T + 4.0 * GasConstant * T * T *d2Aphi; return 2.0 * A_L / T + 4.0 * GasConstant * T * T *d2Aphi;
return retn;
} }
double HMWSoln::d2A_DebyedT2_TP(double tempArg, double presArg) const double HMWSoln::d2A_DebyedT2_TP(double tempArg, double presArg) const
@ -5804,24 +5796,21 @@ doublereal HMWSoln::s_NBS_CLM_dlnMolalityActCoeff_dT() const
{ {
doublereal sqrtIs = sqrt(m_IionicMolality); doublereal sqrtIs = sqrt(m_IionicMolality);
doublereal dAdT = dA_DebyedT_TP(); doublereal dAdT = dA_DebyedT_TP();
doublereal d_lnGammaClM_dT = - dAdT * sqrtIs /(1.0 + 1.5 * sqrtIs); return - dAdT * sqrtIs /(1.0 + 1.5 * sqrtIs);
return d_lnGammaClM_dT;
} }
doublereal HMWSoln::s_NBS_CLM_d2lnMolalityActCoeff_dT2() const doublereal HMWSoln::s_NBS_CLM_d2lnMolalityActCoeff_dT2() const
{ {
doublereal sqrtIs = sqrt(m_IionicMolality); doublereal sqrtIs = sqrt(m_IionicMolality);
doublereal d2AdT2 = d2A_DebyedT2_TP(); doublereal d2AdT2 = d2A_DebyedT2_TP();
doublereal d_lnGammaClM_dT2 = - d2AdT2 * sqrtIs /(1.0 + 1.5 * sqrtIs); return - d2AdT2 * sqrtIs /(1.0 + 1.5 * sqrtIs);
return d_lnGammaClM_dT2;
} }
doublereal HMWSoln::s_NBS_CLM_dlnMolalityActCoeff_dP() const doublereal HMWSoln::s_NBS_CLM_dlnMolalityActCoeff_dP() const
{ {
doublereal sqrtIs = sqrt(m_IionicMolality); doublereal sqrtIs = sqrt(m_IionicMolality);
doublereal dAdP = dA_DebyedP_TP(); doublereal dAdP = dA_DebyedP_TP();
doublereal d_lnGammaClM_dP = - dAdP * sqrtIs /(1.0 + 1.5 * sqrtIs); return - dAdP * sqrtIs /(1.0 + 1.5 * sqrtIs);
return d_lnGammaClM_dP;
} }
int HMWSoln::debugPrinting() int HMWSoln::debugPrinting()

View file

@ -169,8 +169,7 @@ doublereal IdealGasPhase::logStandardConc(size_t k) const
{ {
_updateThermo(); _updateThermo();
double p = pressure(); double p = pressure();
double lc = std::log(p / (GasConstant * temperature())); return std::log(p / (GasConstant * temperature()));
return lc;
} }
void IdealGasPhase::getActivityCoefficients(doublereal* ac) const void IdealGasPhase::getActivityCoefficients(doublereal* ac) const

View file

@ -146,8 +146,7 @@ doublereal IdealMolalSoln::enthalpy_mole() const
{ {
getPartialMolarEnthalpies(DATA_PTR(m_tmpV)); getPartialMolarEnthalpies(DATA_PTR(m_tmpV));
getMoleFractions(DATA_PTR(m_pp)); getMoleFractions(DATA_PTR(m_pp));
double val = mean_X(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV));
return val;
} }
doublereal IdealMolalSoln::intEnergy_mole() const doublereal IdealMolalSoln::intEnergy_mole() const
@ -171,8 +170,7 @@ doublereal IdealMolalSoln::gibbs_mole() const
doublereal IdealMolalSoln::cp_mole() const doublereal IdealMolalSoln::cp_mole() const
{ {
getPartialMolarCp(DATA_PTR(m_tmpV)); getPartialMolarCp(DATA_PTR(m_tmpV));
double val = mean_X(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV));
return val;
} }
doublereal IdealMolalSoln::cv_mole() const doublereal IdealMolalSoln::cv_mole() const

View file

@ -224,8 +224,7 @@ doublereal IdealSolnGasVPSS::standardConcentration(size_t k) const
doublereal IdealSolnGasVPSS::logStandardConc(size_t k) const doublereal IdealSolnGasVPSS::logStandardConc(size_t k) const
{ {
double c = standardConcentration(k); double c = standardConcentration(k);
double lc = std::log(c); return std::log(c);
return lc;
} }
void IdealSolnGasVPSS::getUnitsStandardConc(double* uA, int, int sizeUA) const void IdealSolnGasVPSS::getUnitsStandardConc(double* uA, int, int sizeUA) const

View file

@ -322,8 +322,7 @@ doublereal IonsFromNeutralVPSSTP::intEnergy_mole() const
double hh = enthalpy_mole(); double hh = enthalpy_mole();
double pres = pressure(); double pres = pressure();
double molarV = 1.0/molarDensity(); double molarV = 1.0/molarDensity();
double uu = hh - pres * molarV; return hh - pres * molarV;
return uu;
} }
doublereal IonsFromNeutralVPSSTP::entropy_mole() const doublereal IonsFromNeutralVPSSTP::entropy_mole() const
@ -341,8 +340,7 @@ doublereal IonsFromNeutralVPSSTP::gibbs_mole() const
doublereal IonsFromNeutralVPSSTP::cp_mole() const doublereal IonsFromNeutralVPSSTP::cp_mole() const
{ {
getPartialMolarCp(DATA_PTR(m_pp)); getPartialMolarCp(DATA_PTR(m_pp));
double val = mean_X(DATA_PTR(m_pp)); return mean_X(DATA_PTR(m_pp));
return val;
} }
doublereal IonsFromNeutralVPSSTP::cv_mole() const doublereal IonsFromNeutralVPSSTP::cv_mole() const

View file

@ -82,8 +82,7 @@ doublereal LatticeSolidPhase::minTemp(size_t k) const
if (k != npos) { if (k != npos) {
for (size_t n = 0; n < m_nlattice; n++) { for (size_t n = 0; n < m_nlattice; n++) {
if (lkstart_[n+1] < k) { if (lkstart_[n+1] < k) {
double ml = (m_lattice[n])->minTemp(k-lkstart_[n]); return (m_lattice[n])->minTemp(k-lkstart_[n]);
return ml;
} }
} }
} }
@ -100,8 +99,7 @@ doublereal LatticeSolidPhase::maxTemp(size_t k) const
if (k != npos) { if (k != npos) {
for (size_t n = 0; n < m_nlattice; n++) { for (size_t n = 0; n < m_nlattice; n++) {
if (lkstart_[n+1] < k) { if (lkstart_[n+1] < k) {
double ml = (m_lattice[n])->maxTemp(k - lkstart_[n]); return (m_lattice[n])->maxTemp(k - lkstart_[n]);
return ml;
} }
} }
} }

View file

@ -507,8 +507,7 @@ doublereal MixtureFugacityTP::z() const
doublereal mmw = meanMolecularWeight(); doublereal mmw = meanMolecularWeight();
doublereal molarV = mmw / rho; doublereal molarV = mmw / rho;
doublereal rt = _RT(); doublereal rt = _RT();
doublereal zz = p * molarV / rt; return p * molarV / rt;
return zz;
} }
doublereal MixtureFugacityTP::sresid() const doublereal MixtureFugacityTP::sresid() const
@ -789,8 +788,7 @@ int MixtureFugacityTP::phaseState(bool checkState) const
double tcrit = critTemperature(); double tcrit = critTemperature();
double rhocrit = critDensity(); double rhocrit = critDensity();
if (t >= tcrit) { if (t >= tcrit) {
state = FLUID_SUPERCRIT; return FLUID_SUPERCRIT;
return state;
} }
double tmid = tcrit - 100.; double tmid = tcrit - 100.;
if (tmid < 0.0) { if (tmid < 0.0) {

View file

@ -215,8 +215,7 @@ PDSS_ConstVol::enthalpy_mole() const
doublereal doublereal
PDSS_ConstVol::enthalpy_RT() const PDSS_ConstVol::enthalpy_RT() const
{ {
doublereal val = m_hss_RT_ptr[m_spindex]; return m_hss_RT_ptr[m_spindex];
return val;
} }
@ -240,8 +239,7 @@ PDSS_ConstVol::entropy_mole() const
doublereal doublereal
PDSS_ConstVol::entropy_R() const PDSS_ConstVol::entropy_R() const
{ {
doublereal val = m_sss_R_ptr[m_spindex]; return m_sss_R_ptr[m_spindex];
return val;
} }
/* /*
@ -259,8 +257,7 @@ PDSS_ConstVol::gibbs_mole() const
doublereal doublereal
PDSS_ConstVol::gibbs_RT() const PDSS_ConstVol::gibbs_RT() const
{ {
doublereal val = m_gss_RT_ptr[m_spindex]; return m_gss_RT_ptr[m_spindex];
return val;
} }
doublereal doublereal
@ -273,22 +270,19 @@ PDSS_ConstVol::cp_mole() const
doublereal doublereal
PDSS_ConstVol::cp_R() const PDSS_ConstVol::cp_R() const
{ {
doublereal val = m_cpss_R_ptr[m_spindex]; return m_cpss_R_ptr[m_spindex];
return val;
} }
doublereal doublereal
PDSS_ConstVol::cv_mole() const PDSS_ConstVol::cv_mole() const
{ {
doublereal val = (cp_mole() - m_V0_ptr[m_spindex]); return (cp_mole() - m_V0_ptr[m_spindex]);
return val;
} }
doublereal doublereal
PDSS_ConstVol::molarVolume() const PDSS_ConstVol::molarVolume() const
{ {
doublereal val = m_Vss_ptr[m_spindex]; return m_Vss_ptr[m_spindex];
return val;
} }
doublereal doublereal
@ -301,20 +295,17 @@ PDSS_ConstVol::density() const
doublereal doublereal
PDSS_ConstVol::gibbs_RT_ref() const PDSS_ConstVol::gibbs_RT_ref() const
{ {
doublereal val = m_g0_RT_ptr[m_spindex]; return m_g0_RT_ptr[m_spindex];
return val;
} }
doublereal PDSS_ConstVol::enthalpy_RT_ref() const doublereal PDSS_ConstVol::enthalpy_RT_ref() const
{ {
doublereal val = m_h0_RT_ptr[m_spindex]; return m_h0_RT_ptr[m_spindex];
return val;
} }
doublereal PDSS_ConstVol::entropy_R_ref() const doublereal PDSS_ConstVol::entropy_R_ref() const
{ {
doublereal val = m_s0_R_ptr[m_spindex]; return m_s0_R_ptr[m_spindex];
return val;
} }
doublereal PDSS_ConstVol::cp_R_ref() const doublereal PDSS_ConstVol::cp_R_ref() const
@ -325,8 +316,7 @@ doublereal PDSS_ConstVol::cp_R_ref() const
doublereal PDSS_ConstVol::molarVolume_ref() const doublereal PDSS_ConstVol::molarVolume_ref() const
{ {
doublereal val = m_V0_ptr[m_spindex]; return m_V0_ptr[m_spindex];
return val;
} }

View file

@ -247,8 +247,7 @@ doublereal PDSS_HKFT::enthalpy_mole2() const
{ {
doublereal delH = deltaH(); doublereal delH = deltaH();
double enthTRPR = m_Mu0_tr_pr + 298.15 * m_Entrop_tr_pr * 1.0E3 * 4.184; double enthTRPR = m_Mu0_tr_pr + 298.15 * m_Entrop_tr_pr * 1.0E3 * 4.184;
double res = delH + enthTRPR; return delH + enthTRPR;
return res;
} }
#endif #endif
@ -446,8 +445,7 @@ doublereal PDSS_HKFT::molarVolume() const
doublereal molVol_calgmolPascal = a1term + a2term + a3term + a4term + wterm + qterm; doublereal molVol_calgmolPascal = a1term + a2term + a3term + a4term + wterm + qterm;
// Convert to m**3 / kmol from (cal/gmol/Pa) // Convert to m**3 / kmol from (cal/gmol/Pa)
doublereal molVol = molVol_calgmolPascal * 4.184 * 1.0E3; return molVol_calgmolPascal * 4.184 * 1.0E3;
return molVol;
} }
doublereal doublereal
@ -903,8 +901,7 @@ doublereal PDSS_HKFT::deltaH() const
+ yterm + yrterm + wterm + wrterm + otterm + otrterm; + yterm + yrterm + wterm + wrterm + otterm + otrterm;
// Convert to Joules / kmol // Convert to Joules / kmol
doublereal deltaH = deltaH_calgmol * 1.0E3 * 4.184; return deltaH_calgmol * 1.0E3 * 4.184;
return deltaH;
} }
#endif #endif
@ -952,8 +949,7 @@ doublereal PDSS_HKFT::deltaG() const
doublereal deltaG_calgmol = sterm + c1term + a1term + a2term + c2term + a3term + a4term + wterm + wrterm + yterm; doublereal deltaG_calgmol = sterm + c1term + a1term + a2term + c2term + a3term + a4term + wterm + wrterm + yterm;
// Convert to Joules / kmol // Convert to Joules / kmol
doublereal deltaG = deltaG_calgmol * 1.0E3 * 4.184; return deltaG_calgmol * 1.0E3 * 4.184;
return deltaG;
} }
@ -1012,8 +1008,7 @@ doublereal PDSS_HKFT::deltaS() const
doublereal deltaS_calgmol = c1term + c2term + a3term + a4term + wterm + wrterm + otterm + otrterm; doublereal deltaS_calgmol = c1term + c2term + a3term + a4term + wterm + wrterm + otterm + otrterm;
// Convert to Joules / kmol // Convert to Joules / kmol
doublereal deltaS = deltaS_calgmol * 1.0E3 * 4.184; return deltaS_calgmol * 1.0E3 * 4.184;
return deltaS;
} }
@ -1026,8 +1021,7 @@ doublereal PDSS_HKFT::ag(const doublereal temp, const int ifunc) const
static doublereal ag_coeff[3] = { -2.037662, 5.747000E-3, -6.557892E-6}; static doublereal ag_coeff[3] = { -2.037662, 5.747000E-3, -6.557892E-6};
if (ifunc == 0) { if (ifunc == 0) {
doublereal t2 = temp * temp; doublereal t2 = temp * temp;
doublereal val = ag_coeff[0] + ag_coeff[1] * temp + ag_coeff[2] * t2; return ag_coeff[0] + ag_coeff[1] * temp + ag_coeff[2] * t2;
return val;
} else if (ifunc == 1) { } else if (ifunc == 1) {
return ag_coeff[1] + ag_coeff[2] * 2.0 * temp; return ag_coeff[1] + ag_coeff[2] * 2.0 * temp;
} }
@ -1047,8 +1041,7 @@ doublereal PDSS_HKFT::bg(const doublereal temp, const int ifunc) const
static doublereal bg_coeff[3] = { 6.107361, -1.074377E-2, 1.268348E-5}; static doublereal bg_coeff[3] = { 6.107361, -1.074377E-2, 1.268348E-5};
if (ifunc == 0) { if (ifunc == 0) {
doublereal t2 = temp * temp; doublereal t2 = temp * temp;
doublereal val = bg_coeff[0] + bg_coeff[1] * temp + bg_coeff[2] * t2; return bg_coeff[0] + bg_coeff[1] * temp + bg_coeff[2] * t2;
return val;
} else if (ifunc == 1) { } else if (ifunc == 1) {
return bg_coeff[1] + bg_coeff[2] * 2.0 * temp; return bg_coeff[1] + bg_coeff[2] * 2.0 * temp;
} }
@ -1157,9 +1150,7 @@ doublereal PDSS_HKFT::g(const doublereal temp, const doublereal pres, const int
} else if (ifunc == 3) { } else if (ifunc == 3) {
doublereal beta = m_waterSS->isothermalCompressibility(); doublereal beta = m_waterSS->isothermalCompressibility();
doublereal dgdp = - bfunc * gval * dens * beta / (1.0 - dens); return - bfunc * gval * dens * beta / (1.0 - dens);
return dgdp;
} else { } else {
throw CanteraError("HKFT_PDSS::g", "unimplemented"); throw CanteraError("HKFT_PDSS::g", "unimplemented");
} }

View file

@ -175,8 +175,7 @@ PDSS_IdealGas::enthalpy_mole() const
doublereal doublereal
PDSS_IdealGas::enthalpy_RT() const PDSS_IdealGas::enthalpy_RT() const
{ {
doublereal val = m_h0_RT_ptr[m_spindex]; return m_h0_RT_ptr[m_spindex];
return val;
} }
@ -206,8 +205,7 @@ PDSS_IdealGas::entropy_mole() const
doublereal doublereal
PDSS_IdealGas::entropy_R() const PDSS_IdealGas::entropy_R() const
{ {
doublereal val = m_s0_R_ptr[m_spindex] - log(m_pres/m_p0); return m_s0_R_ptr[m_spindex] - log(m_pres/m_p0);
return val;
} }
/* /*
@ -225,8 +223,7 @@ PDSS_IdealGas::gibbs_mole() const
doublereal doublereal
PDSS_IdealGas::gibbs_RT() const PDSS_IdealGas::gibbs_RT() const
{ {
doublereal val = m_g0_RT_ptr[m_spindex] + log(m_pres/m_p0); return m_g0_RT_ptr[m_spindex] + log(m_pres/m_p0);
return val;
} }
/* /*
@ -243,8 +240,7 @@ PDSS_IdealGas::cp_mole() const
doublereal doublereal
PDSS_IdealGas::cp_R() const PDSS_IdealGas::cp_R() const
{ {
doublereal val = m_cp0_R_ptr[m_spindex]; return m_cp0_R_ptr[m_spindex];
return val;
} }
doublereal doublereal
@ -274,20 +270,17 @@ PDSS_IdealGas::cv_mole() const
doublereal doublereal
PDSS_IdealGas::gibbs_RT_ref() const PDSS_IdealGas::gibbs_RT_ref() const
{ {
doublereal val = m_g0_RT_ptr[m_spindex]; return m_g0_RT_ptr[m_spindex];
return val;
} }
doublereal PDSS_IdealGas::enthalpy_RT_ref() const doublereal PDSS_IdealGas::enthalpy_RT_ref() const
{ {
doublereal val = m_h0_RT_ptr[m_spindex]; return m_h0_RT_ptr[m_spindex];
return val;
} }
doublereal PDSS_IdealGas::entropy_R_ref() const doublereal PDSS_IdealGas::entropy_R_ref() const
{ {
doublereal val = m_s0_R_ptr[m_spindex]; return m_s0_R_ptr[m_spindex];
return val;
} }
doublereal PDSS_IdealGas::cp_R_ref() const doublereal PDSS_IdealGas::cp_R_ref() const

View file

@ -242,8 +242,7 @@ PDSS_SSVol::enthalpy_mole() const
doublereal doublereal
PDSS_SSVol::enthalpy_RT() const PDSS_SSVol::enthalpy_RT() const
{ {
doublereal val = m_hss_RT_ptr[m_spindex]; return m_hss_RT_ptr[m_spindex];
return val;
} }
doublereal doublereal
@ -266,8 +265,7 @@ PDSS_SSVol::entropy_mole() const
doublereal doublereal
PDSS_SSVol::entropy_R() const PDSS_SSVol::entropy_R() const
{ {
doublereal val = m_sss_R_ptr[m_spindex]; return m_sss_R_ptr[m_spindex];
return val;
} }
/** /**
@ -285,8 +283,7 @@ PDSS_SSVol::gibbs_mole() const
doublereal doublereal
PDSS_SSVol::gibbs_RT() const PDSS_SSVol::gibbs_RT() const
{ {
doublereal val = m_gss_RT_ptr[m_spindex]; return m_gss_RT_ptr[m_spindex];
return val;
} }
doublereal doublereal
@ -299,22 +296,19 @@ PDSS_SSVol::cp_mole() const
doublereal doublereal
PDSS_SSVol::cp_R() const PDSS_SSVol::cp_R() const
{ {
doublereal val = m_cpss_R_ptr[m_spindex]; return m_cpss_R_ptr[m_spindex];
return val;
} }
doublereal doublereal
PDSS_SSVol::cv_mole() const PDSS_SSVol::cv_mole() const
{ {
doublereal val = (cp_mole() - m_V0_ptr[m_spindex]); return (cp_mole() - m_V0_ptr[m_spindex]);
return val;
} }
doublereal doublereal
PDSS_SSVol::molarVolume() const PDSS_SSVol::molarVolume() const
{ {
doublereal val = m_Vss_ptr[m_spindex]; return m_Vss_ptr[m_spindex];
return val;
} }
doublereal doublereal
@ -327,32 +321,27 @@ PDSS_SSVol::density() const
doublereal doublereal
PDSS_SSVol::gibbs_RT_ref() const PDSS_SSVol::gibbs_RT_ref() const
{ {
doublereal val = m_g0_RT_ptr[m_spindex]; return m_g0_RT_ptr[m_spindex];
return val;
} }
doublereal PDSS_SSVol::enthalpy_RT_ref() const doublereal PDSS_SSVol::enthalpy_RT_ref() const
{ {
doublereal val = m_h0_RT_ptr[m_spindex]; return m_h0_RT_ptr[m_spindex];
return val;
} }
doublereal PDSS_SSVol::entropy_R_ref() const doublereal PDSS_SSVol::entropy_R_ref() const
{ {
doublereal val = m_s0_R_ptr[m_spindex]; return m_s0_R_ptr[m_spindex];
return val;
} }
doublereal PDSS_SSVol::cp_R_ref() const doublereal PDSS_SSVol::cp_R_ref() const
{ {
doublereal val = m_cp0_R_ptr[m_spindex]; return m_cp0_R_ptr[m_spindex];
return val;
} }
doublereal PDSS_SSVol::molarVolume_ref() const doublereal PDSS_SSVol::molarVolume_ref() const
{ {
doublereal val = m_V0_ptr[m_spindex]; return m_V0_ptr[m_spindex];
return val;
} }
void PDSS_SSVol::calcMolarVolume() const void PDSS_SSVol::calcMolarVolume() const

View file

@ -337,20 +337,17 @@ doublereal PDSS_Water::gibbs_mole() const
doublereal PDSS_Water::cp_mole() const doublereal PDSS_Water::cp_mole() const
{ {
doublereal cp = m_sub->cp(); return m_sub->cp();
return cp;
} }
doublereal PDSS_Water::cv_mole() const doublereal PDSS_Water::cv_mole() const
{ {
doublereal cv = m_sub->cv(); return m_sub->cv();
return cv;
} }
doublereal PDSS_Water::molarVolume() const doublereal PDSS_Water::molarVolume() const
{ {
doublereal mv = m_sub->molarVolume(); return m_sub->molarVolume();
return mv;
} }
doublereal PDSS_Water::gibbs_RT_ref() const doublereal PDSS_Water::gibbs_RT_ref() const
@ -457,8 +454,7 @@ void PDSS_Water::setPressure(doublereal p)
*/ */
doublereal PDSS_Water::thermalExpansionCoeff() const doublereal PDSS_Water::thermalExpansionCoeff() const
{ {
doublereal val = m_sub->coeffThermExp(); return m_sub->coeffThermExp();
return val;
} }
doublereal PDSS_Water::dthermalExpansionCoeffdT() const doublereal PDSS_Water::dthermalExpansionCoeffdT() const
@ -474,14 +470,12 @@ doublereal PDSS_Water::dthermalExpansionCoeffdT() const
doublereal vald = m_sub->coeffThermExp(); doublereal vald = m_sub->coeffThermExp();
m_sub->setState_TR(m_temp, dens_save); m_sub->setState_TR(m_temp, dens_save);
doublereal val2 = m_sub->coeffThermExp(); doublereal val2 = m_sub->coeffThermExp();
doublereal val = (val2 - vald) / 0.04; return (val2 - vald) / 0.04;
return val;
} }
doublereal PDSS_Water::isothermalCompressibility() const doublereal PDSS_Water::isothermalCompressibility() const
{ {
doublereal val = m_sub->isothermalCompressibility(); return m_sub->isothermalCompressibility();
return val;
} }
/// critical temperature /// critical temperature

View file

@ -315,8 +315,7 @@ doublereal PureFluidPhase::critDensity() const
doublereal PureFluidPhase::satTemperature(doublereal p) const doublereal PureFluidPhase::satTemperature(doublereal p) const
{ {
doublereal ts = m_sub->Tsat(p); return m_sub->Tsat(p);
return ts;
} }
void PureFluidPhase::setState_HP(doublereal h, doublereal p, void PureFluidPhase::setState_HP(doublereal h, doublereal p,
@ -351,8 +350,7 @@ doublereal PureFluidPhase::satPressure(doublereal t) const
{ {
doublereal vsv = m_sub->v(); doublereal vsv = m_sub->v();
Set(tpx::PropertyPair::TV,t,vsv); Set(tpx::PropertyPair::TV,t,vsv);
doublereal ps = m_sub->Ps(); return m_sub->Ps();
return ps;
} }
doublereal PureFluidPhase::vaporFraction() const doublereal PureFluidPhase::vaporFraction() const

View file

@ -278,8 +278,7 @@ doublereal RedlichKwongMFTP::cp_mole() const
doublereal fac = TKelvin * dadt - 3.0 * m_a_current / 2.0; doublereal fac = TKelvin * dadt - 3.0 * m_a_current / 2.0;
doublereal dHdT_V = (cpref + mv * dpdT_ - GasConstant - 1.0 / (2.0 * m_b_current * TKelvin * sqt) * log(vpb/mv) * fac doublereal dHdT_V = (cpref + mv * dpdT_ - GasConstant - 1.0 / (2.0 * m_b_current * TKelvin * sqt) * log(vpb/mv) * fac
+1.0/(m_b_current * sqt) * log(vpb/mv) * (-0.5 * dadt)); +1.0/(m_b_current * sqt) * log(vpb/mv) * (-0.5 * dadt));
double cp = dHdT_V - (mv + TKelvin * dpdT_ / dpdV_) * dpdT_; return dHdT_V - (mv + TKelvin * dpdT_ / dpdV_) * dpdT_;
return cp;
} }
doublereal RedlichKwongMFTP::cv_mole() const doublereal RedlichKwongMFTP::cv_mole() const
@ -386,8 +385,7 @@ doublereal RedlichKwongMFTP::standardConcentration(size_t k) const
doublereal RedlichKwongMFTP::logStandardConc(size_t k) const doublereal RedlichKwongMFTP::logStandardConc(size_t k) const
{ {
double c = standardConcentration(k); double c = standardConcentration(k);
double lc = std::log(c); return std::log(c);
return lc;
} }
void RedlichKwongMFTP::getUnitsStandardConc(double* uA, int, int sizeUA) const void RedlichKwongMFTP::getUnitsStandardConc(double* uA, int, int sizeUA) const
@ -1040,8 +1038,7 @@ doublereal RedlichKwongMFTP::sresid() const
doublereal sqT = sqrt(T); doublereal sqT = sqrt(T);
doublereal fac = dadt - m_a_current / (2.0 * T); doublereal fac = dadt - m_a_current / (2.0 * T);
double sresid_mol_R = log(zz*(1.0 - hh)) + log(1.0 + hh) * fac / (sqT * GasConstant * m_b_current); double sresid_mol_R = log(zz*(1.0 - hh)) + log(1.0 + hh) * fac / (sqT * GasConstant * m_b_current);
double sp = GasConstant * sresid_mol_R; return GasConstant * sresid_mol_R;
return sp;
} }
doublereal RedlichKwongMFTP::hresid() const doublereal RedlichKwongMFTP::hresid() const
@ -1056,8 +1053,7 @@ doublereal RedlichKwongMFTP::hresid() const
doublereal T = temperature(); doublereal T = temperature();
doublereal sqT = sqrt(T); doublereal sqT = sqrt(T);
doublereal fac = T * dadt - 3.0 *m_a_current / (2.0); doublereal fac = T * dadt - 3.0 *m_a_current / (2.0);
double hresid_mol = GasConstant * T * (zz - 1.0) + fac * log(1.0 + hh) / (sqT * m_b_current); return GasConstant * T * (zz - 1.0) + fac * log(1.0 + hh) / (sqT * m_b_current);
return hresid_mol;
} }
doublereal RedlichKwongMFTP::liquidVolEst(doublereal TKelvin, doublereal& presGuess) const doublereal RedlichKwongMFTP::liquidVolEst(doublereal TKelvin, doublereal& presGuess) const
@ -1114,7 +1110,6 @@ doublereal RedlichKwongMFTP::densityCalc(doublereal TKelvin, doublereal presPa,
setTemperature(TKelvin); setTemperature(TKelvin);
double tcrit = critTemperature(); double tcrit = critTemperature();
doublereal mmw = meanMolecularWeight(); doublereal mmw = meanMolecularWeight();
double densBase = 0.0;
if (rhoguess == -1.0) { if (rhoguess == -1.0) {
if (phaseRequested != FLUID_GAS) { if (phaseRequested != FLUID_GAS) {
if (TKelvin > tcrit) { if (TKelvin > tcrit) {
@ -1177,15 +1172,13 @@ doublereal RedlichKwongMFTP::densityCalc(doublereal TKelvin, doublereal presPa,
//printf("DensityCalc(): Possible problem encountered\n"); //printf("DensityCalc(): Possible problem encountered\n");
return -1.0; return -1.0;
} }
densBase = mmw / molarVolLast; return mmw / molarVolLast;
return densBase;
} }
doublereal RedlichKwongMFTP::densSpinodalLiquid() const doublereal RedlichKwongMFTP::densSpinodalLiquid() const
{ {
if (NSolns_ != 3) { if (NSolns_ != 3) {
double dens = critDensity(); return critDensity();
return dens;
} }
double vmax = Vroot_[1]; double vmax = Vroot_[1];
double vmin = Vroot_[0]; double vmin = Vroot_[0];
@ -1202,15 +1195,13 @@ doublereal RedlichKwongMFTP::densSpinodalLiquid() const
throw CanteraError(" RedlichKwongMFTP::densSpinodalLiquid() ", "didn't converge"); throw CanteraError(" RedlichKwongMFTP::densSpinodalLiquid() ", "didn't converge");
} }
doublereal mmw = meanMolecularWeight(); doublereal mmw = meanMolecularWeight();
doublereal rho = mmw / vbest; return mmw / vbest;
return rho;
} }
doublereal RedlichKwongMFTP::densSpinodalGas() const doublereal RedlichKwongMFTP::densSpinodalGas() const
{ {
if (NSolns_ != 3) { if (NSolns_ != 3) {
double dens = critDensity(); return critDensity();
return dens;
} }
double vmax = Vroot_[2]; double vmax = Vroot_[2];
double vmin = Vroot_[1]; double vmin = Vroot_[1];
@ -1227,8 +1218,7 @@ doublereal RedlichKwongMFTP::densSpinodalGas() const
throw CanteraError(" RedlichKwongMFTP::densSpinodalGas() ", "didn't converge"); throw CanteraError(" RedlichKwongMFTP::densSpinodalGas() ", "didn't converge");
} }
doublereal mmw = meanMolecularWeight(); doublereal mmw = meanMolecularWeight();
doublereal rho = mmw / vbest; return mmw / vbest;
return rho;
} }
doublereal RedlichKwongMFTP::pressureCalc(doublereal TKelvin, doublereal molarVol) const doublereal RedlichKwongMFTP::pressureCalc(doublereal TKelvin, doublereal molarVol) const

View file

@ -891,8 +891,7 @@ SpeciesThermo* newSpeciesThermoMgr(int type, SpeciesThermoFactory* f)
if (f == 0) { if (f == 0) {
f = SpeciesThermoFactory::factory(); f = SpeciesThermoFactory::factory();
} }
SpeciesThermo* sptherm = f->newSpeciesThermo(type); return f->newSpeciesThermo(type);
return sptherm;
} }
// Create a new species thermo manager instance, by specifying // Create a new species thermo manager instance, by specifying
@ -915,8 +914,7 @@ SpeciesThermo* newSpeciesThermoMgr(std::string& stype,
if (f == 0) { if (f == 0) {
f = SpeciesThermoFactory::factory(); f = SpeciesThermoFactory::factory();
} }
SpeciesThermo* sptherm = f->newSpeciesThermoManager(stype); return f->newSpeciesThermoManager(stype);
return sptherm;
} }
// Function to return SpeciesThermo manager // Function to return SpeciesThermo manager

View file

@ -54,8 +54,7 @@ StoichSubstance::~StoichSubstance()
doublereal StoichSubstance::enthalpy_mole() const doublereal StoichSubstance::enthalpy_mole() const
{ {
double hh = intEnergy_mole() + m_press / molarDensity(); return intEnergy_mole() + m_press / molarDensity();
return hh;
} }
doublereal StoichSubstance::intEnergy_mole() const doublereal StoichSubstance::intEnergy_mole() const

View file

@ -239,7 +239,6 @@ VPSSMgrFactory::newVPSSMgr(VPStandardStateTP* vp_ptr,
std::string ssManager=""; std::string ssManager="";
std::string vpssManager=""; std::string vpssManager="";
VPSSMgr* vpss = 0;
// First look for any explicit instructions within the XML Database // First look for any explicit instructions within the XML Database
// for the standard state manager and the variable pressure // for the standard state manager and the variable pressure
@ -272,17 +271,14 @@ VPSSMgrFactory::newVPSSMgr(VPStandardStateTP* vp_ptr,
// and return immediately // and return immediately
if (vpssManager != "") { if (vpssManager != "") {
VPSSMgr_enumType type = VPSSMgr_StringConversion(vpssManager); VPSSMgr_enumType type = VPSSMgr_StringConversion(vpssManager);
vpss = newVPSSMgr(type, vp_ptr); return newVPSSMgr(type, vp_ptr);
return vpss;
} }
// Handle special cases based on the VPStandardState types // Handle special cases based on the VPStandardState types
if (vp_ptr->eosType() == cVPSS_IdealGas) { if (vp_ptr->eosType() == cVPSS_IdealGas) {
vpss = new VPSSMgr_IdealGas(vp_ptr, spth); return new VPSSMgr_IdealGas(vp_ptr, spth);
return vpss;
} else if (vp_ptr->eosType() == cVPSS_ConstVol) { } else if (vp_ptr->eosType() == cVPSS_ConstVol) {
vpss = new VPSSMgr_ConstVol(vp_ptr, spth); return new VPSSMgr_ConstVol(vp_ptr, spth);
return vpss;
} }
@ -304,29 +300,25 @@ VPSSMgrFactory::newVPSSMgr(VPStandardStateTP* vp_ptr,
if (inasaIG || ishomateIG || isimpleIG) { if (inasaIG || ishomateIG || isimpleIG) {
throw CanteraError("newVPSSMgr", "Ideal gas with liquid water"); throw CanteraError("newVPSSMgr", "Ideal gas with liquid water");
} else { } else {
vpss = new VPSSMgr_Water_ConstVol(vp_ptr, spth); return new VPSSMgr_Water_ConstVol(vp_ptr, spth);
} }
} else { } else {
if (inasaIG || ishomateIG || isimpleIG) { if (inasaIG || ishomateIG || isimpleIG) {
throw CanteraError("newVPSSMgr", "Ideal gas with liquid water"); throw CanteraError("newVPSSMgr", "Ideal gas with liquid water");
} else if (inasaCV || ishomateCV || isimpleCV) { } else if (inasaCV || ishomateCV || isimpleCV) {
vpss = new VPSSMgr_General(vp_ptr, spth); return new VPSSMgr_General(vp_ptr, spth);
} else { } else {
vpss = new VPSSMgr_Water_HKFT(vp_ptr, spth); return new VPSSMgr_Water_HKFT(vp_ptr, spth);
} }
} }
} }
if (vpss == 0) { if (inasaCV || ishomateCV || isimpleCV) {
if (inasaCV || ishomateCV || isimpleCV) { if (!inasaIG && !ishomateIG && !isimpleIG && !itpx && !ihptx && !iother) {
if (!inasaIG && !ishomateIG && !isimpleIG && !itpx && !ihptx && !iother) { return new VPSSMgr_ConstVol(vp_ptr, spth);
vpss = new VPSSMgr_ConstVol(vp_ptr, spth);
}
} }
} }
if (vpss == 0) {
vpss = new VPSSMgr_General(vp_ptr, spth); return new VPSSMgr_General(vp_ptr, spth);
}
return vpss;
} }
@ -365,8 +357,7 @@ VPSSMgr* newVPSSMgr(VPSSMgr_enumType type, VPStandardStateTP* vp_ptr,
if (f == 0) { if (f == 0) {
f = VPSSMgrFactory::factory(); f = VPSSMgrFactory::factory();
} }
VPSSMgr* vpsssptherm = f->newVPSSMgr(type, vp_ptr); return f->newVPSSMgr(type, vp_ptr);
return vpsssptherm;
} }
@ -378,8 +369,7 @@ VPSSMgr* newVPSSMgr(VPStandardStateTP* tp_ptr,
if (f == 0) { if (f == 0) {
f = VPSSMgrFactory::factory(); f = VPSSMgrFactory::factory();
} }
VPSSMgr* vpsssptherm = f->newVPSSMgr(tp_ptr, phaseNode_ptr, spDataNodeList); return f->newVPSSMgr(tp_ptr, phaseNode_ptr, spDataNodeList);
return vpsssptherm;
} }

View file

@ -150,14 +150,11 @@ doublereal WaterProps::density_T(doublereal T, doublereal P, int ifunc)
if (rho < rhomin) { if (rho < rhomin) {
rho = rhomin; rho = rhomin;
if (ifunc == 1) { if (ifunc == 1) {
doublereal drhodT = - rhomin / T; return - rhomin / T;
return drhodT;
} else if (ifunc == 3) { } else if (ifunc == 3) {
doublereal drhodP = rhomin / P; return rhomin / P;
return drhodP;
} else if (ifunc == 2) { } else if (ifunc == 2) {
doublereal d2rhodT2 = 2.0 * rhomin / (T * T); return 2.0 * rhomin / (T * T);
return d2rhodT2;
} }
} }
@ -247,8 +244,7 @@ doublereal WaterProps::relEpsilon(doublereal T, doublereal P_pascal,
doublereal dltmpdT = (dBdT/tmpBpar - dBdT/tmpB1000); doublereal dltmpdT = (dBdT/tmpBpar - dBdT/tmpB1000);
if (ifunc == 1) { if (ifunc == 1) {
doublereal depsReldT = deps1000dT + dCdT * ltmp + C * dltmpdT; return deps1000dT + dCdT * ltmp + C * dltmpdT;
return depsReldT;
} }
doublereal T3 = T2 * T; doublereal T3 = T2 * T;
doublereal d2CdT2 = - 2.0 * dCdT / tmpC; doublereal d2CdT2 = - 2.0 * dCdT / tmpC;
@ -267,8 +263,7 @@ doublereal WaterProps::relEpsilon(doublereal T, doublereal P_pascal,
} }
if (ifunc == 3) { if (ifunc == 3) {
doublereal dltmpdP = 1.0E-5 / tmpBpar; doublereal dltmpdP = 1.0E-5 / tmpBpar;
doublereal depsReldP = C * dltmpdP; return C * dltmpdP;
return depsReldP;
} }
return epsRel; return epsRel;
@ -399,8 +394,7 @@ doublereal WaterProps::ADebye(doublereal T, doublereal P_input, int ifunc)
doublereal WaterProps::satPressure(doublereal T) doublereal WaterProps::satPressure(doublereal T)
{ {
doublereal pres = m_waterIAPWS->psat(T); return m_waterIAPWS->psat(T);
return pres;
} }
// Returns the density of water // Returns the density of water
@ -413,8 +407,7 @@ doublereal WaterProps::satPressure(doublereal T)
*/ */
doublereal WaterProps::density_IAPWS(doublereal temp, doublereal press) doublereal WaterProps::density_IAPWS(doublereal temp, doublereal press)
{ {
doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID); return m_waterIAPWS->density(temp, press, WATER_LIQUID);
return dens;
} }
// Returns the density of water // Returns the density of water
@ -424,8 +417,7 @@ doublereal WaterProps::density_IAPWS(doublereal temp, doublereal press)
*/ */
doublereal WaterProps::density_IAPWS() const doublereal WaterProps::density_IAPWS() const
{ {
doublereal dens = m_waterIAPWS->density(); return m_waterIAPWS->density();
return dens;
} }
doublereal WaterProps::coeffThermalExp_IAPWS(doublereal temp, doublereal press) doublereal WaterProps::coeffThermalExp_IAPWS(doublereal temp, doublereal press)
@ -435,8 +427,7 @@ doublereal WaterProps::coeffThermalExp_IAPWS(doublereal temp, doublereal press)
throw CanteraError("WaterProps::coeffThermalExp_IAPWS", throw CanteraError("WaterProps::coeffThermalExp_IAPWS",
"Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press)); "Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press));
} }
doublereal cte = m_waterIAPWS->coeffThermExp(); return m_waterIAPWS->coeffThermExp();
return cte;
} }
doublereal WaterProps::isothermalCompressibility_IAPWS(doublereal temp, doublereal press) doublereal WaterProps::isothermalCompressibility_IAPWS(doublereal temp, doublereal press)
@ -446,8 +437,7 @@ doublereal WaterProps::isothermalCompressibility_IAPWS(doublereal temp, doublere
throw CanteraError("WaterProps::isothermalCompressibility_IAPWS", throw CanteraError("WaterProps::isothermalCompressibility_IAPWS",
"Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press)); "Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press));
} }
doublereal kappa = m_waterIAPWS->isothermalCompressibility(); return m_waterIAPWS->isothermalCompressibility();
return kappa;
} }
@ -665,8 +655,7 @@ doublereal WaterProps::thermalConductivityWater() const
doublereal lambda2bar = 0.0013848 / (mu0bar * mu1bar) * t2r2 * dpdT_const_rho * dpdT_const_rho * doublereal lambda2bar = 0.0013848 / (mu0bar * mu1bar) * t2r2 * dpdT_const_rho * dpdT_const_rho *
xsipow * sqrt(rhobar) * exp(-18.66*temp2 - rho4); xsipow * sqrt(rhobar) * exp(-18.66*temp2 - rho4);
doublereal lambda = (lambda0bar * lambda1bar + lambda2bar) * lambdastar; return (lambda0bar * lambda1bar + lambda2bar) * lambdastar;
return lambda;
} }

View file

@ -389,8 +389,7 @@ doublereal WaterPropsIAPWS::dpdrho() const
{ {
doublereal retn = m_phi->dimdpdrho(tau, delta); doublereal retn = m_phi->dimdpdrho(tau, delta);
doublereal temperature = T_c/tau; doublereal temperature = T_c/tau;
doublereal val = retn * Rgas * temperature / M_water; return retn * Rgas * temperature / M_water;
return val;
} }
// Returns the isochoric pressure derivative wrt temperature // Returns the isochoric pressure derivative wrt temperature
@ -404,8 +403,7 @@ doublereal WaterPropsIAPWS::dpdrho() const
*/ */
doublereal WaterPropsIAPWS:: coeffPresExp() const doublereal WaterPropsIAPWS:: coeffPresExp() const
{ {
doublereal retn = m_phi->dimdpdT(tau, delta); return m_phi->dimdpdT(tau, delta);
return retn;
} }
// Returns the coefficient of thermal expansion. // Returns the coefficient of thermal expansion.

View file

@ -541,8 +541,7 @@ doublereal WaterPropsIAPWSphi::phi(doublereal tau, doublereal delta)
tdpolycalc(tau, delta); tdpolycalc(tau, delta);
doublereal nau = phi0(); doublereal nau = phi0();
doublereal res = phiR(); doublereal res = phiR();
doublereal retn = nau + res; return nau + res;
return retn;
} }
@ -646,8 +645,7 @@ doublereal WaterPropsIAPWSphi::phi_d(doublereal tau, doublereal delta)
tdpolycalc(tau, delta); tdpolycalc(tau, delta);
doublereal nau = phi0_d(); doublereal nau = phi0_d();
doublereal res = phiR_d(); doublereal res = phiR_d();
doublereal retn = nau + res; return nau + res;
return retn;
} }
/* /*
@ -661,8 +659,7 @@ doublereal WaterPropsIAPWSphi::pressureM_rhoRT(doublereal tau, doublereal del
{ {
tdpolycalc(tau, delta); tdpolycalc(tau, delta);
doublereal res = phiR_d(); doublereal res = phiR_d();
doublereal retn = 1.0 + delta * res; return 1.0 + delta * res;
return retn;
} }
/* /*
@ -795,8 +792,7 @@ doublereal WaterPropsIAPWSphi::phi_dd(doublereal tau, doublereal delta)
tdpolycalc(tau, delta); tdpolycalc(tau, delta);
doublereal nau = phi0_dd(); doublereal nau = phi0_dd();
doublereal res = phiR_dd(); doublereal res = phiR_dd();
doublereal retn = nau + res; return nau + res;
return retn;
} }
doublereal WaterPropsIAPWSphi::dimdpdrho(doublereal tau, doublereal delta) doublereal WaterPropsIAPWSphi::dimdpdrho(doublereal tau, doublereal delta)
@ -804,8 +800,7 @@ doublereal WaterPropsIAPWSphi::dimdpdrho(doublereal tau, doublereal delta)
tdpolycalc(tau, delta); tdpolycalc(tau, delta);
doublereal res1 = phiR_d(); doublereal res1 = phiR_d();
doublereal res2 = phiR_dd(); doublereal res2 = phiR_dd();
doublereal retn = 1.0 + delta * (2.0*res1 + delta*res2); return 1.0 + delta * (2.0*res1 + delta*res2);
return retn;
} }
doublereal WaterPropsIAPWSphi::dimdpdT(doublereal tau, doublereal delta) doublereal WaterPropsIAPWSphi::dimdpdT(doublereal tau, doublereal delta)
@ -813,8 +808,7 @@ doublereal WaterPropsIAPWSphi::dimdpdT(doublereal tau, doublereal delta)
tdpolycalc(tau, delta); tdpolycalc(tau, delta);
doublereal res1 = phiR_d(); doublereal res1 = phiR_d();
doublereal res2 = phiR_dt(); doublereal res2 = phiR_dt();
doublereal retn = (1.0 + delta * res1) - tau * delta * (res2); return (1.0 + delta * res1) - tau * delta * (res2);
return retn;
} }
/* /*
@ -914,8 +908,7 @@ doublereal WaterPropsIAPWSphi::phi_t(doublereal tau, doublereal delta)
tdpolycalc(tau, delta); tdpolycalc(tau, delta);
doublereal nau = phi0_t(); doublereal nau = phi0_t();
doublereal res = phiR_t(); doublereal res = phiR_t();
doublereal retn = nau + res; return nau + res;
return retn;
} }
/* /*
@ -1027,8 +1020,7 @@ doublereal WaterPropsIAPWSphi::phi_tt(doublereal tau, doublereal delta)
tdpolycalc(tau, delta); tdpolycalc(tau, delta);
doublereal nau = phi0_tt(); doublereal nau = phi0_tt();
doublereal res = phiR_tt(); doublereal res = phiR_tt();
doublereal retn = nau + res; return nau + res;
return retn;
} }
/** /**
@ -1237,8 +1229,7 @@ doublereal WaterPropsIAPWSphi::gibbs_RT() const
{ {
doublereal delta = DELTAsave; doublereal delta = DELTAsave;
doublereal rd = phiR_d(); doublereal rd = phiR_d();
doublereal g = 1.0 + phi0() + phiR() + delta * rd; return 1.0 + phi0() + phiR() + delta * rd;
return g;
} }
/** /**
@ -1251,8 +1242,7 @@ doublereal WaterPropsIAPWSphi::enthalpy_RT() const
doublereal rd = phiR_d(); doublereal rd = phiR_d();
doublereal nt = phi0_t(); doublereal nt = phi0_t();
doublereal rt = phiR_t(); doublereal rt = phiR_t();
doublereal hRT = 1.0 + tau * (nt + rt) + delta * rd; return 1.0 + tau * (nt + rt) + delta * rd;
return hRT;
} }
/* /*
@ -1265,8 +1255,7 @@ doublereal WaterPropsIAPWSphi::entropy_R() const
doublereal rt = phiR_t(); doublereal rt = phiR_t();
doublereal p0 = phi0(); doublereal p0 = phi0();
doublereal pR = phiR(); doublereal pR = phiR();
doublereal sR = tau * (nt + rt) - p0 - pR; return tau * (nt + rt) - p0 - pR;
return sR;
} }
/* /*
@ -1277,8 +1266,7 @@ doublereal WaterPropsIAPWSphi::intEnergy_RT() const
doublereal tau = TAUsave; doublereal tau = TAUsave;
doublereal nt = phi0_t(); doublereal nt = phi0_t();
doublereal rt = phiR_t(); doublereal rt = phiR_t();
doublereal uR = tau * (nt + rt); return tau * (nt + rt);
return uR;
} }
/* /*
@ -1289,8 +1277,7 @@ doublereal WaterPropsIAPWSphi::cv_R() const
doublereal tau = TAUsave; doublereal tau = TAUsave;
doublereal ntt = phi0_tt(); doublereal ntt = phi0_tt();
doublereal rtt = phiR_tt(); doublereal rtt = phiR_tt();
doublereal cvR = - tau * tau * (ntt + rtt); return - tau * tau * (ntt + rtt);
return cvR;
} }
/* /*

View file

@ -263,8 +263,7 @@ void WaterSSTP::getCp_R(doublereal* cpr) const
doublereal WaterSSTP::cv_mole() const doublereal WaterSSTP::cv_mole() const
{ {
doublereal cv = m_sub->cv(); return m_sub->cv();
return cv;
} }
void WaterSSTP::getEnthalpy_RT_ref(doublereal* hrt) const void WaterSSTP::getEnthalpy_RT_ref(doublereal* hrt) const
@ -379,8 +378,7 @@ void WaterSSTP::getStandardVolumes_ref(doublereal* vol) const
doublereal WaterSSTP::pressure() const doublereal WaterSSTP::pressure() const
{ {
doublereal p = m_sub->pressure(); return m_sub->pressure();
return p;
} }
void WaterSSTP:: void WaterSSTP::
@ -402,14 +400,12 @@ setPressure(doublereal p)
doublereal WaterSSTP::isothermalCompressibility() const doublereal WaterSSTP::isothermalCompressibility() const
{ {
doublereal val = m_sub->isothermalCompressibility(); return m_sub->isothermalCompressibility();
return val;
} }
doublereal WaterSSTP::thermalExpansionCoeff() const doublereal WaterSSTP::thermalExpansionCoeff() const
{ {
doublereal val = m_sub->coeffThermExp(); return m_sub->coeffThermExp();
return val;
} }
doublereal WaterSSTP::dthermalExpansionCoeffdT() const doublereal WaterSSTP::dthermalExpansionCoeffdT() const
@ -426,8 +422,7 @@ doublereal WaterSSTP::dthermalExpansionCoeffdT() const
doublereal vald = m_sub->coeffThermExp(); doublereal vald = m_sub->coeffThermExp();
m_sub->setState_TR(T, dens_save); m_sub->setState_TR(T, dens_save);
doublereal val2 = m_sub->coeffThermExp(); doublereal val2 = m_sub->coeffThermExp();
doublereal val = (val2 - vald) / 0.04; return (val2 - vald) / 0.04;
return val;
} }
doublereal WaterSSTP::critTemperature() const doublereal WaterSSTP::critTemperature() const

View file

@ -278,7 +278,7 @@ double Heptane::Pp()
*/ */
double Heptane::Psat() double Heptane::Psat()
{ {
double log, sum=0,P; double log, sum=0;
if ((T < Tmn) || (T > Tc)) { if ((T < Tmn) || (T > Tc)) {
throw TPX_Error("Heptane::Psat", throw TPX_Error("Heptane::Psat",
"Temperature out of range. T = " + fp2str(T)); "Temperature out of range. T = " + fp2str(T));
@ -288,9 +288,7 @@ double Heptane::Psat()
} }
log = ((Tc/T)-1)*sum; log = ((Tc/T)-1)*sum;
P=exp(log)*Pc; return exp(log)*Pc;
return P;
} }

View file

@ -228,13 +228,12 @@ double hydrogen::ldens()
"Temperature out of range. T = " + fp2str(T)); "Temperature out of range. T = " + fp2str(T));
} }
double x=1-T/Tc; double x=1-T/Tc;
double sum, term; double sum;
int i; int i;
for (i=1, sum=0; i<=6; i++) { for (i=1, sum=0; i<=6; i++) {
sum+=Dhydro[i]*pow(x, 1+double(i-1)/3.0); sum+=Dhydro[i]*pow(x, 1+double(i-1)/3.0);
} }
term = sum+Roc+Dhydro[0]*pow(x,alpha1); return sum+Roc+Dhydro[0]*pow(x,alpha1);
return term;
} }

View file

@ -11,8 +11,7 @@ namespace tpx
double RedlichKwong::up() double RedlichKwong::up()
{ {
double u = -Pp()/Rho + hresid() + m_energy_offset; return -Pp()/Rho + hresid() + m_energy_offset;
return u;
} }
double RedlichKwong::hresid() double RedlichKwong::hresid()
@ -28,8 +27,7 @@ double RedlichKwong::sresid()
double hh = m_b * (Rho/m_mw); double hh = m_b * (Rho/m_mw);
double sresid_mol_R = log(z()*(1.0 - hh)) double sresid_mol_R = log(z()*(1.0 - hh))
- (0.5*m_a/(m_b*8314.3*T*sqrt(T)))*log(1.0 + hh); - (0.5*m_a/(m_b*8314.3*T*sqrt(T)))*log(1.0 + hh);
double sp = 8314.3*sresid_mol_R/m_mw; return 8314.3*sresid_mol_R/m_mw;
return sp;
} }
double RedlichKwong::sp() double RedlichKwong::sp()
@ -39,8 +37,7 @@ double RedlichKwong::sp()
//double ss = rgas*(log(Pref/(Rho*rgas*T))); //double ss = rgas*(log(Pref/(Rho*rgas*T)));
double sr = sresid(); double sr = sresid();
double p = Pp(); double p = Pp();
double s = rgas*(log(Pref/p)) + sr + m_entropy_offset; return rgas*(log(Pref/p)) + sr + m_entropy_offset;
return s;
} }
double RedlichKwong::z() double RedlichKwong::z()
@ -53,8 +50,7 @@ double RedlichKwong::Pp()
{ {
double R = 8314.3; double R = 8314.3;
double V = m_mw/Rho; double V = m_mw/Rho;
double pp = R*T/(V - m_b) - m_a/(sqrt(T)*V*(V+m_b)); return R*T/(V - m_b) - m_a/(sqrt(T)*V*(V+m_b));
return pp;
} }
double RedlichKwong::Psat() double RedlichKwong::Psat()

View file

@ -160,7 +160,7 @@ double water::Pp()
double water::Psat() double water::Psat()
{ {
double log, sum=0,P; double log, sum=0;
if ((T < Tmn) || (T > Tc)) { if ((T < Tmn) || (T > Tc)) {
throw TPX_Error("water::Psat", throw TPX_Error("water::Psat",
"Temperature out of range. T = " + fp2str(T)); "Temperature out of range. T = " + fp2str(T));
@ -169,8 +169,7 @@ double water::Psat()
sum += F[i-1]*pow(aww*(T-Tp),double(i-1)); // DGG mod sum += F[i-1]*pow(aww*(T-Tp),double(i-1)); // DGG mod
} }
log = (Tc/T-1)*sum; log = (Tc/T-1)*sum;
P=exp(log)*Pc; return exp(log)*Pc;
return P;
} }
/* /*
@ -199,8 +198,7 @@ double water::ldens()
for (i=0; i<8; i++) { for (i=0; i<8; i++) {
sum+=D[i]*pow(1.0 - T/Tc, double(i+1)/3.0); sum+=D[i]*pow(1.0 - T/Tc, double(i+1)/3.0);
} }
double density = Roc*(1+sum); return Roc*(1+sum);
return density;
} }
double water::Tcrit() double water::Tcrit()

View file

@ -494,8 +494,7 @@ doublereal LTI_Log_MoleFracs::getMixTransProp(doublereal* speciesValues, doubler
} }
} }
value = exp(value); return exp(value);
return value;
} }

View file

@ -92,8 +92,7 @@ doublereal TortuosityMaxwell::tortuosityFactor(doublereal porosity)
*/ */
doublereal TortuosityMaxwell::McMillanFactor(doublereal porosity) doublereal TortuosityMaxwell::McMillanFactor(doublereal porosity)
{ {
doublereal tmp = 1 + 3 * (1.0 - porosity) * (relativeConductivities_ - 1.0) / (relativeConductivities_ + 2); return 1 + 3 * (1.0 - porosity) * (relativeConductivities_ - 1.0) / (relativeConductivities_ + 2);
return tmp;
} }
//==================================================================================================================== //====================================================================================================================
} }

View file

@ -126,8 +126,7 @@ void WaterTransport::initTP()
*/ */
doublereal WaterTransport::viscosity() doublereal WaterTransport::viscosity()
{ {
doublereal visc = m_waterProps->viscosityWater(); return m_waterProps->viscosityWater();
return visc;
} }
// Returns the thermal conductivity of water at the current conditions // Returns the thermal conductivity of water at the current conditions
@ -147,8 +146,7 @@ doublereal WaterTransport::viscosity()
*/ */
doublereal WaterTransport::thermalConductivity() doublereal WaterTransport::thermalConductivity()
{ {
doublereal lambda = m_waterProps->thermalConductivityWater(); return m_waterProps->thermalConductivityWater();
return lambda;
} }
} }

View file

@ -16,8 +16,7 @@ double numdpdt(WaterPropsIAPWS* water, double T, double pres)
double Td = T + 0.001; double Td = T + 0.001;
water->setState_TR(Td, rho); water->setState_TR(Td, rho);
double presd = water->pressure(); double presd = water->pressure();
double dpdt = (presd - presB) / 0.001; return (presd - presB) / 0.001;
return dpdt;
} }
int main() int main()

View file

@ -22,8 +22,7 @@ typedef int (*exfun)(int n);
int run_example(int n, exfun f, int job = 2) int run_example(int n, exfun f, int job = 2)
{ {
cout << "\n\n\n\n>>>>> example " << n+1 << "\n\nDescription: " << endl; cout << "\n\n\n\n>>>>> example " << n+1 << "\n\nDescription: " << endl;
int i = f(job); return f(job);
return i;
} }
// array of example functions // array of example functions