diff --git a/include/cantera/equil/vcs_internal.h b/include/cantera/equil/vcs_internal.h index 4d0c83f4e..c4a74afbb 100644 --- a/include/cantera/equil/vcs_internal.h +++ b/include/cantera/equil/vcs_internal.h @@ -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 f_buoy = tmp * (Pi * rho_gas + (rho_liq - rho_gas) * tmp1); double f_sten = 2 * sigma * sin(theta1 + alpha1 - Pi); - double f_net = f_grav + f_buoy + f_sten; - return f_net; + return f_grav + f_buoy + f_sten; } double calc_h2_farfield(double 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; if (alpha1 + theta1 < Pi) sign = 1.0; double res = sign * sqrt(rhs); - double h2 = res + rad_cyl * cos(theta1); - return h2; + return res + rad_cyl * cos(theta1); } double funcZero(double xval, double Vtarget, int varID, void *fptrPassthrough, int *err) { double theta = xval; double h2 = calc_h2_farfield(theta); - double fv = func_vert(theta, h2, rho_cyl); - return fv; + return func_vert(theta, h2, rho_cyl); } int main () { double thetamax = Pi; diff --git a/include/cantera/kinetics/KineticsFactory.h b/include/cantera/kinetics/KineticsFactory.h index 895641d33..b2cde1b89 100644 --- a/include/cantera/kinetics/KineticsFactory.h +++ b/include/cantera/kinetics/KineticsFactory.h @@ -81,8 +81,7 @@ inline Kinetics* newKineticsMgr(XML_Node& phase, if (f == 0) { f = KineticsFactory::factory(); } - Kinetics* kin = f->newKinetics(phase, th); - return kin; + return f->newKinetics(phase, th); } /** @@ -93,8 +92,7 @@ inline Kinetics* newKineticsMgr(const std::string& model, KineticsFactory* f=0) if (f == 0) { f = KineticsFactory::factory(); } - Kinetics* kin = f->newKinetics(model); - return kin; + return f->newKinetics(model); } } diff --git a/include/cantera/numerics/Func1.h b/include/cantera/numerics/Func1.h index 595d6b0ae..b20f96947 100644 --- a/include/cantera/numerics/Func1.h +++ b/include/cantera/numerics/Func1.h @@ -380,15 +380,13 @@ public: virtual Func1& duplicate() const { Func1& f1d = m_f1->duplicate(); Func1& f2d = m_f2->duplicate(); - Func1& dup = newSumFunction(f1d, f2d); - return dup; + return newSumFunction(f1d, f2d); } virtual Func1& derivative() const { Func1& d1 = m_f1->derivative(); Func1& d2 = m_f2->derivative(); - Func1& d = newSumFunction(d1, d2); - return d; + return newSumFunction(d1, d2); } virtual int order() const { return 0; @@ -445,12 +443,10 @@ public: virtual Func1& duplicate() const { Func1& f1d = m_f1->duplicate(); Func1& f2d = m_f2->duplicate(); - Func1& dup = newDiffFunction(f1d, f2d); - return dup; + return newDiffFunction(f1d, f2d); } virtual Func1& derivative() const { - Func1& d = newDiffFunction(m_f1->derivative(), m_f2->derivative()); - return d; + return newDiffFunction(m_f1->derivative(), m_f2->derivative()); } virtual int order() const { return 0; @@ -505,8 +501,7 @@ public: virtual Func1& duplicate() const { Func1& f1d = m_f1->duplicate(); Func1& f2d = m_f2->duplicate(); - Func1& dup = newProdFunction(f1d, f2d); - return dup; + return newProdFunction(f1d, f2d); } virtual std::string write(const std::string& arg) const; @@ -518,8 +513,7 @@ public: virtual Func1& derivative() const { Func1& a1 = newProdFunction(m_f1->duplicate(), m_f2->derivative()); Func1& a2 = newProdFunction(m_f2->duplicate(), m_f1->derivative()); - Func1& s = newSumFunction(a1, a2); - return s; + return newSumFunction(a1, a2); } virtual int order() const { return 1; @@ -651,8 +645,7 @@ public: return m_f1->eval(t) + m_c; } virtual Func1& derivative() const { - Func1& f1d = m_f1->derivative(); - return f1d; + return m_f1->derivative(); } virtual std::string write(const std::string& arg) const; @@ -712,8 +705,7 @@ public: virtual Func1& duplicate() const { Func1& f1d = m_f1->duplicate(); Func1& f2d = m_f2->duplicate(); - Func1& dup = newRatioFunction(f1d, f2d); - return dup; + return newRatioFunction(f1d, f2d); } virtual Func1& derivative() const { @@ -721,8 +713,7 @@ public: Func1& a2 = newProdFunction(m_f1->duplicate(), m_f2->derivative()); Func1& s = newDiffFunction(a1, a2); Func1& p = newProdFunction(m_f2->duplicate(), m_f2->duplicate()); - Func1& r = newRatioFunction(s, p); - return r; + return newRatioFunction(s, p); } virtual std::string write(const std::string& arg) const; @@ -782,8 +773,7 @@ public: virtual Func1& duplicate() const { Func1& f1d = m_f1->duplicate(); Func1& f2d = m_f2->duplicate(); - Func1& dup = newCompositeFunction(f1d, f2d); - return dup; + return newCompositeFunction(f1d, f2d); } virtual Func1& derivative() const { diff --git a/include/cantera/oneD/StFlow.h b/include/cantera/oneD/StFlow.h index 264f4b143..c4bf49f03 100644 --- a/include/cantera/oneD/StFlow.h +++ b/include/cantera/oneD/StFlow.h @@ -294,8 +294,7 @@ public: protected: doublereal component(const doublereal* x, size_t i, size_t j) const { - doublereal xx = x[index(i,j)]; - return xx; + return x[index(i,j)]; } doublereal conc(const doublereal* x, size_t k,size_t j) const { diff --git a/src/base/PrintCtrl.cpp b/src/base/PrintCtrl.cpp index b2da92cd5..7c0b97c0f 100644 --- a/src/base/PrintCtrl.cpp +++ b/src/base/PrintCtrl.cpp @@ -172,8 +172,7 @@ double PrintCtrl::cropAbs10(const double d, int Ndec) const N10 += 1; } int nsig = N10 - Ndec; - double retn = cropSigDigits(d, nsig); - return retn; + return cropSigDigits(d, nsig); } // Crop a double at a certain number of significant digits diff --git a/src/equil/vcs_VolPhase.cpp b/src/equil/vcs_VolPhase.cpp index 9a0fd2e7c..59c0d427e 100644 --- a/src/equil/vcs_VolPhase.cpp +++ b/src/equil/vcs_VolPhase.cpp @@ -1236,8 +1236,7 @@ std::string string16_EOSType(int EOSType) break; } st[16] = '\0'; - std::string sss=st; - return sss; + return st; } /***************************************************************************/ @@ -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* fm = m_formulaMatrix.constBaseDataAddr(); - return fm; + return m_formulaMatrix.constBaseDataAddr(); } /***************************************************************************/ diff --git a/src/equil/vcs_solve_TP.cpp b/src/equil/vcs_solve_TP.cpp index 8df611af1..35aae6872 100644 --- a/src/equil/vcs_solve_TP.cpp +++ b/src/equil/vcs_solve_TP.cpp @@ -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) { goto L_ZERO_SPECIES; } - dx = molNum_kspec_new - w_kspec; - return dx; + return molNum_kspec_new - w_kspec; } else { if (fabs(dg_irxn) <= m_tolmin2) { 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) { goto L_ZERO_SPECIES; } - dx = molNum_kspec_new - w_kspec; - return dx; + return molNum_kspec_new - w_kspec; /* * * 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: ; *do_delete = true; - dx = - w_kspec; - return dx; + return - w_kspec; } else { /* * Voltage calculation @@ -4733,8 +4730,6 @@ void VCS_SOLVE::vcs_updateVP(const int vcsState) */ bool VCS_SOLVE::vcs_evaluate_speciesType() { - bool allMinorZeroedSpecies; - m_numRxnMinorZeroed = 0; #ifdef DEBUG_MODE if (m_debug_print_lvl >= 2) { @@ -4811,9 +4806,7 @@ bool VCS_SOLVE::vcs_evaluate_speciesType() } #endif - allMinorZeroedSpecies = (m_numRxnMinorZeroed >= m_numRxnRdc); - - return allMinorZeroedSpecies; + return (m_numRxnMinorZeroed >= m_numRxnRdc); } /*****************************************************************************/ diff --git a/src/equil/vcs_species_thermo.cpp b/src/equil/vcs_species_thermo.cpp index aaca0f416..f42f9012f 100644 --- a/src/equil/vcs_species_thermo.cpp +++ b/src/equil/vcs_species_thermo.cpp @@ -267,12 +267,10 @@ double VCS_SPECIES_THERMO::G0_R_calc(size_t kglob, double TKelvin) #endif double fe, H, S; if (SS0_Model == VCS_SS0_CONSTANT) { - fe = SS0_feSave; - return fe; + return SS0_feSave; } if (TKelvin == SS0_TSave) { - fe = SS0_feSave; - return fe; + return SS0_feSave; } if (UseCanteraCalls) { if (m_VCS_UnitsFormat != VCS_UNITS_MKS) { diff --git a/src/fortran/fct.cpp b/src/fortran/fct.cpp index b4a52e766..1061d11c7 100644 --- a/src/fortran/fct.cpp +++ b/src/fortran/fct.cpp @@ -660,8 +660,7 @@ extern "C" { } Kinetics* kin = newKineticsMgr(*x, phases); if (kin) { - int k = KineticsCabinet::add(kin); - return k; + return KineticsCabinet::add(kin); } else { return 0; } diff --git a/src/fortran/fctxml.cpp b/src/fortran/fctxml.cpp index 6cdd598f6..230cf71a3 100644 --- a/src/fortran/fctxml.cpp +++ b/src/fortran/fctxml.cpp @@ -52,8 +52,7 @@ extern "C" { { try { XML_Node* x = Cantera::get_XML_File(f2string(file, filelen)); - int ix = XmlCabinet::add(x); - return ix; + return XmlCabinet::add(x); } catch (...) { return handleAllExceptions(-1, ERR); } diff --git a/src/kinetics/FalloffFactory.cpp b/src/kinetics/FalloffFactory.cpp index c05c54092..79205d430 100644 --- a/src/kinetics/FalloffFactory.cpp +++ b/src/kinetics/FalloffFactory.cpp @@ -381,8 +381,7 @@ public: virtual doublereal F(doublereal pr, const doublereal* work) const { doublereal lpr = log10(std::max(pr,SmallNumber)); doublereal xx = 1.0/(1.0 + lpr*lpr); - doublereal ff = pow(*work , xx); - return ff; + return pow(*work , xx); } //! Utility function that returns the size of the workspace diff --git a/src/kinetics/solveSP.cpp b/src/kinetics/solveSP.cpp index 72007b6ae..861ffb0fd 100644 --- a/src/kinetics/solveSP.cpp +++ b/src/kinetics/solveSP.cpp @@ -890,9 +890,7 @@ calc_t(doublereal netProdRateSolnSP[], doublereal XMolSolnSP[], *label_old = *label; *label_factor = 1.0; } - inv_timeScale = inv_timeScale / *label_factor; - return inv_timeScale; - + return inv_timeScale / *label_factor; } /* calc_t */ /* diff --git a/src/numerics/BEulerInt.cpp b/src/numerics/BEulerInt.cpp index 80cb1aa75..618a93256 100644 --- a/src/numerics/BEulerInt.cpp +++ b/src/numerics/BEulerInt.cpp @@ -973,8 +973,7 @@ double BEulerInt::time_error_norm() error = (m_y_n[i] - m_y_pred_n[i]) / m_ewt[i]; rel_norm += (error * error); } - rel_norm = sqrt(rel_norm / m_neq); - return rel_norm; + return sqrt(rel_norm / m_neq); } /************************************************************************* diff --git a/src/numerics/Func1.cpp b/src/numerics/Func1.cpp index a135f6263..71f2ce62f 100644 --- a/src/numerics/Func1.cpp +++ b/src/numerics/Func1.cpp @@ -248,9 +248,7 @@ string Pow1::write(const std::string& arg) const string Const1::write(const std::string& arg) const { //cout << "Const1" << endl; - string c = ""; - c = fp2str(m_c); - return c; + return fp2str(m_c); } string Ratio1::write(const std::string& arg) const diff --git a/src/numerics/NonlinearSolver.cpp b/src/numerics/NonlinearSolver.cpp index e8100849a..1322aa674 100644 --- a/src/numerics/NonlinearSolver.cpp +++ b/src/numerics/NonlinearSolver.cpp @@ -1798,8 +1798,7 @@ doublereal NonlinearSolver::expectedResidLeg(int leg, doublereal alpha) const + alpha * alpha * Nuu_ * Nuu_ * res0_2 - 2 * alpha * Nuu_ * (1.0 - alpha) * RdotJS; - resNorm = sqrt(res2 / neq_); - return resNorm; + return sqrt(res2 / neq_); } else { doublereal beta = Nuu_ + alpha * (1.0 - Nuu_); @@ -2299,8 +2298,7 @@ doublereal NonlinearSolver::calcTrustDistance(std::vector const& de tmp = deltaX[i] / deltaX_trust_[i]; sum += tmp * tmp; } - sum = sqrt(sum / neq_) / trustDelta_; - return sum; + return sqrt(sum / neq_) / trustDelta_; } //==================================================================================================================== // 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) { size_t i_lower = npos; - doublereal fbound = 1.0, f_bounds = 1.0; + doublereal f_bounds = 1.0; doublereal ff, y_new; 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); - fbound = std::min(f_bounds, f_delta_bounds); - - return fbound; + return std::min(f_bounds, f_delta_bounds); } //=================================================================================================================== // 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, const doublereal* const ybase, doublereal* const step0) { - doublereal tmp = m_func->filterNewStep(timeCurrent, ybase, step0); - return tmp; + return m_func->filterNewStep(timeCurrent, ybase, step0); } //==================================================================================================================== // 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* const y_current, doublereal* const ydot_current) { - doublereal tmp = m_func->filterSolnPrediction(timeCurrent, y_current); - return tmp; + return m_func->filterSolnPrediction(timeCurrent, y_current); } //==================================================================================================================== // Compute the Residual Weights diff --git a/src/numerics/ResidJacEval.cpp b/src/numerics/ResidJacEval.cpp index 17675fdd5..d5ea7e687 100644 --- a/src/numerics/ResidJacEval.cpp +++ b/src/numerics/ResidJacEval.cpp @@ -317,8 +317,7 @@ int ResidJacEval::eval(const doublereal t, const doublereal* const y, const doub doublereal* const r) { double deltaT = -1.0; - int flag = evalResidNJ(t, deltaT, y, ydot, r); - return flag; + return evalResidNJ(t, deltaT, y, ydot, r); } //==================================================================================================================== // Calculate an analytical jacobian and the residual at the current time and values. diff --git a/src/oneD/OneDim.cpp b/src/oneD/OneDim.cpp index a640b1cfb..ababf4a0a 100644 --- a/src/oneD/OneDim.cpp +++ b/src/oneD/OneDim.cpp @@ -240,8 +240,7 @@ int OneDim::solve(doublereal* x, doublereal* xnew, int loglevel) m_jac->updateTransient(m_rdt, DATA_PTR(m_mask)); m_jac_ok = true; } - int m = m_newt->solve(x, xnew, *this, *m_jac, loglevel); - return m; + return m_newt->solve(x, xnew, *this, *m_jac, loglevel); } void OneDim::evalSSJacobian(doublereal* x, doublereal* xnew) diff --git a/src/python/ctfuncs.cpp b/src/python/ctfuncs.cpp index 2d217771c..2d2916c74 100644 --- a/src/python/ctfuncs.cpp +++ b/src/python/ctfuncs.cpp @@ -29,8 +29,7 @@ ct_refcnt(PyObject* self, PyObject* args) if (!PyArg_ParseTuple(args, "O", &o)) { return NULL; } - PyObject* cnt = Py_BuildValue("i",o->ob_refcnt); - return cnt; + return Py_BuildValue("i",o->ob_refcnt); } // static PyObject * diff --git a/src/python/ctxml_methods.cpp b/src/python/ctxml_methods.cpp index e3f3bc787..ee132e152 100644 --- a/src/python/ctxml_methods.cpp +++ b/src/python/ctxml_methods.cpp @@ -7,8 +7,7 @@ py_xml_new(PyObject* self, PyObject* args) return NULL; } int n = xml_new(nm); - PyObject* pn = Py_BuildValue("i",n); - return pn; + return Py_BuildValue("i",n); } static PyObject* @@ -23,8 +22,7 @@ py_xml_get_XML_File(PyObject* self, PyObject* args) if (n < 0) { return reportError(n); } - PyObject* pn = Py_BuildValue("i",n); - return pn; + return Py_BuildValue("i",n); } diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index 470062f4a..26398d049 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -212,8 +212,7 @@ doublereal DebyeHuckel::intEnergy_mole() const double hh = enthalpy_mole(); double pres = pressure(); double molarV = 1.0/molarDensity(); - double uu = hh - pres * molarV; - return uu; + return hh - pres * molarV; } doublereal DebyeHuckel::entropy_mole() const @@ -231,8 +230,7 @@ doublereal DebyeHuckel::gibbs_mole() const doublereal DebyeHuckel::cp_mole() const { getPartialMolarCp(DATA_PTR(m_tmpV)); - double val = mean_X(DATA_PTR(m_tmpV)); - return val; + return mean_X(DATA_PTR(m_tmpV)); } doublereal DebyeHuckel::cv_mole() const @@ -1331,8 +1329,7 @@ double DebyeHuckel::_lnactivityWaterHelgesonFixedForm() const if (sum > 2.0 * m_maxIionicStrength) { sum = 2.0 * m_maxIionicStrength; }; - double lac = - m_Mnaught * sum * oc; - return lac; + return - m_Mnaught * sum * oc; } void DebyeHuckel::s_update_lnMolalityActCoeff() const diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index af9334c2a..a03d88ddc 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -575,8 +575,7 @@ doublereal HMWSoln::enthalpy_mole() const { getPartialMolarEnthalpies(DATA_PTR(m_tmpV)); getMoleFractions(DATA_PTR(m_pp)); - double val = mean_X(DATA_PTR(m_tmpV)); - return val; + return mean_X(DATA_PTR(m_tmpV)); } doublereal HMWSoln::relative_enthalpy() const @@ -629,8 +628,7 @@ doublereal HMWSoln::relative_molal_enthalpy() const } } xuse = xuse / factor; - L = L / xuse; - return L; + return L / xuse; } doublereal HMWSoln::intEnergy_mole() const @@ -638,8 +636,7 @@ doublereal HMWSoln::intEnergy_mole() const double hh = enthalpy_mole(); double pres = pressure(); double molarV = 1.0/molarDensity(); - double uu = hh - pres * molarV; - return uu; + return hh - pres * molarV; } doublereal HMWSoln::entropy_mole() const @@ -657,8 +654,7 @@ doublereal HMWSoln::gibbs_mole() const doublereal HMWSoln::cp_mole() const { getPartialMolarCp(DATA_PTR(m_tmpV)); - double val = mean_X(DATA_PTR(m_tmpV)); - return val; + return mean_X(DATA_PTR(m_tmpV)); } doublereal HMWSoln::cv_mole() const @@ -668,8 +664,7 @@ doublereal HMWSoln::cv_mole() const double cp = cp_mole(); double tt = temperature(); double molarV = molarVolume(); - double cv = cp - beta * beta * tt * molarV / kappa_t; - return cv; + return cp - beta * beta * tt * molarV / kappa_t; } // @@ -1124,8 +1119,7 @@ double HMWSoln::ADebye_L(double tempArg, double presArg) const if (tempArg != -1.0) { T = tempArg; } - double retn = dAphidT * (4.0 * GasConstant * T * T); - return retn; + return dAphidT * (4.0 * GasConstant * T * T); } 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) { T = tempArg; } - double retn = - dAphidP * (4.0 * GasConstant * T); - return retn; + return - dAphidP * (4.0 * GasConstant * T); } 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 d2 = d2A_DebyedT2_TP(T, presArg); double d2Aphi = d2 / 3.0; - double retn = 2.0 * A_L / T + 4.0 * GasConstant * T * T *d2Aphi; - return retn; + return 2.0 * A_L / T + 4.0 * GasConstant * T * T *d2Aphi; } 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 dAdT = dA_DebyedT_TP(); - doublereal d_lnGammaClM_dT = - dAdT * sqrtIs /(1.0 + 1.5 * sqrtIs); - return d_lnGammaClM_dT; + return - dAdT * sqrtIs /(1.0 + 1.5 * sqrtIs); } doublereal HMWSoln::s_NBS_CLM_d2lnMolalityActCoeff_dT2() const { doublereal sqrtIs = sqrt(m_IionicMolality); doublereal d2AdT2 = d2A_DebyedT2_TP(); - doublereal d_lnGammaClM_dT2 = - d2AdT2 * sqrtIs /(1.0 + 1.5 * sqrtIs); - return d_lnGammaClM_dT2; + return - d2AdT2 * sqrtIs /(1.0 + 1.5 * sqrtIs); } doublereal HMWSoln::s_NBS_CLM_dlnMolalityActCoeff_dP() const { doublereal sqrtIs = sqrt(m_IionicMolality); doublereal dAdP = dA_DebyedP_TP(); - doublereal d_lnGammaClM_dP = - dAdP * sqrtIs /(1.0 + 1.5 * sqrtIs); - return d_lnGammaClM_dP; + return - dAdP * sqrtIs /(1.0 + 1.5 * sqrtIs); } int HMWSoln::debugPrinting() diff --git a/src/thermo/IdealGasPhase.cpp b/src/thermo/IdealGasPhase.cpp index 6087a42ff..ea8ed5e0b 100644 --- a/src/thermo/IdealGasPhase.cpp +++ b/src/thermo/IdealGasPhase.cpp @@ -169,8 +169,7 @@ doublereal IdealGasPhase::logStandardConc(size_t k) const { _updateThermo(); double p = pressure(); - double lc = std::log(p / (GasConstant * temperature())); - return lc; + return std::log(p / (GasConstant * temperature())); } void IdealGasPhase::getActivityCoefficients(doublereal* ac) const diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index d93b9a562..f0dfbf74c 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -146,8 +146,7 @@ doublereal IdealMolalSoln::enthalpy_mole() const { getPartialMolarEnthalpies(DATA_PTR(m_tmpV)); getMoleFractions(DATA_PTR(m_pp)); - double val = mean_X(DATA_PTR(m_tmpV)); - return val; + return mean_X(DATA_PTR(m_tmpV)); } doublereal IdealMolalSoln::intEnergy_mole() const @@ -171,8 +170,7 @@ doublereal IdealMolalSoln::gibbs_mole() const doublereal IdealMolalSoln::cp_mole() const { getPartialMolarCp(DATA_PTR(m_tmpV)); - double val = mean_X(DATA_PTR(m_tmpV)); - return val; + return mean_X(DATA_PTR(m_tmpV)); } doublereal IdealMolalSoln::cv_mole() const diff --git a/src/thermo/IdealSolnGasVPSS.cpp b/src/thermo/IdealSolnGasVPSS.cpp index 5ce390b16..36a13d0d7 100644 --- a/src/thermo/IdealSolnGasVPSS.cpp +++ b/src/thermo/IdealSolnGasVPSS.cpp @@ -224,8 +224,7 @@ doublereal IdealSolnGasVPSS::standardConcentration(size_t k) const doublereal IdealSolnGasVPSS::logStandardConc(size_t k) const { double c = standardConcentration(k); - double lc = std::log(c); - return lc; + return std::log(c); } void IdealSolnGasVPSS::getUnitsStandardConc(double* uA, int, int sizeUA) const diff --git a/src/thermo/IonsFromNeutralVPSSTP.cpp b/src/thermo/IonsFromNeutralVPSSTP.cpp index 4660401f1..677e2a02a 100644 --- a/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -322,8 +322,7 @@ doublereal IonsFromNeutralVPSSTP::intEnergy_mole() const double hh = enthalpy_mole(); double pres = pressure(); double molarV = 1.0/molarDensity(); - double uu = hh - pres * molarV; - return uu; + return hh - pres * molarV; } doublereal IonsFromNeutralVPSSTP::entropy_mole() const @@ -341,8 +340,7 @@ doublereal IonsFromNeutralVPSSTP::gibbs_mole() const doublereal IonsFromNeutralVPSSTP::cp_mole() const { getPartialMolarCp(DATA_PTR(m_pp)); - double val = mean_X(DATA_PTR(m_pp)); - return val; + return mean_X(DATA_PTR(m_pp)); } doublereal IonsFromNeutralVPSSTP::cv_mole() const diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index d2de017a6..dddc8c915 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -82,8 +82,7 @@ doublereal LatticeSolidPhase::minTemp(size_t k) const if (k != npos) { for (size_t n = 0; n < m_nlattice; n++) { if (lkstart_[n+1] < k) { - double ml = (m_lattice[n])->minTemp(k-lkstart_[n]); - return ml; + return (m_lattice[n])->minTemp(k-lkstart_[n]); } } } @@ -100,8 +99,7 @@ doublereal LatticeSolidPhase::maxTemp(size_t k) const if (k != npos) { for (size_t n = 0; n < m_nlattice; n++) { if (lkstart_[n+1] < k) { - double ml = (m_lattice[n])->maxTemp(k - lkstart_[n]); - return ml; + return (m_lattice[n])->maxTemp(k - lkstart_[n]); } } } diff --git a/src/thermo/MixtureFugacityTP.cpp b/src/thermo/MixtureFugacityTP.cpp index 0c48ecb35..959d21bc5 100644 --- a/src/thermo/MixtureFugacityTP.cpp +++ b/src/thermo/MixtureFugacityTP.cpp @@ -507,8 +507,7 @@ doublereal MixtureFugacityTP::z() const doublereal mmw = meanMolecularWeight(); doublereal molarV = mmw / rho; doublereal rt = _RT(); - doublereal zz = p * molarV / rt; - return zz; + return p * molarV / rt; } doublereal MixtureFugacityTP::sresid() const @@ -789,8 +788,7 @@ int MixtureFugacityTP::phaseState(bool checkState) const double tcrit = critTemperature(); double rhocrit = critDensity(); if (t >= tcrit) { - state = FLUID_SUPERCRIT; - return state; + return FLUID_SUPERCRIT; } double tmid = tcrit - 100.; if (tmid < 0.0) { diff --git a/src/thermo/PDSS_ConstVol.cpp b/src/thermo/PDSS_ConstVol.cpp index 29d0c8253..f9307898c 100644 --- a/src/thermo/PDSS_ConstVol.cpp +++ b/src/thermo/PDSS_ConstVol.cpp @@ -215,8 +215,7 @@ PDSS_ConstVol::enthalpy_mole() const doublereal PDSS_ConstVol::enthalpy_RT() const { - doublereal val = m_hss_RT_ptr[m_spindex]; - return val; + return m_hss_RT_ptr[m_spindex]; } @@ -240,8 +239,7 @@ PDSS_ConstVol::entropy_mole() const doublereal PDSS_ConstVol::entropy_R() const { - doublereal val = m_sss_R_ptr[m_spindex]; - return val; + return m_sss_R_ptr[m_spindex]; } /* @@ -259,8 +257,7 @@ PDSS_ConstVol::gibbs_mole() const doublereal PDSS_ConstVol::gibbs_RT() const { - doublereal val = m_gss_RT_ptr[m_spindex]; - return val; + return m_gss_RT_ptr[m_spindex]; } doublereal @@ -273,22 +270,19 @@ PDSS_ConstVol::cp_mole() const doublereal PDSS_ConstVol::cp_R() const { - doublereal val = m_cpss_R_ptr[m_spindex]; - return val; + return m_cpss_R_ptr[m_spindex]; } doublereal PDSS_ConstVol::cv_mole() const { - doublereal val = (cp_mole() - m_V0_ptr[m_spindex]); - return val; + return (cp_mole() - m_V0_ptr[m_spindex]); } doublereal PDSS_ConstVol::molarVolume() const { - doublereal val = m_Vss_ptr[m_spindex]; - return val; + return m_Vss_ptr[m_spindex]; } doublereal @@ -301,20 +295,17 @@ PDSS_ConstVol::density() const doublereal PDSS_ConstVol::gibbs_RT_ref() const { - doublereal val = m_g0_RT_ptr[m_spindex]; - return val; + return m_g0_RT_ptr[m_spindex]; } doublereal PDSS_ConstVol::enthalpy_RT_ref() const { - doublereal val = m_h0_RT_ptr[m_spindex]; - return val; + return m_h0_RT_ptr[m_spindex]; } doublereal PDSS_ConstVol::entropy_R_ref() const { - doublereal val = m_s0_R_ptr[m_spindex]; - return val; + return m_s0_R_ptr[m_spindex]; } 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 val = m_V0_ptr[m_spindex]; - return val; + return m_V0_ptr[m_spindex]; } diff --git a/src/thermo/PDSS_HKFT.cpp b/src/thermo/PDSS_HKFT.cpp index c40c834a0..2f6cd66ab 100644 --- a/src/thermo/PDSS_HKFT.cpp +++ b/src/thermo/PDSS_HKFT.cpp @@ -247,8 +247,7 @@ doublereal PDSS_HKFT::enthalpy_mole2() const { doublereal delH = deltaH(); double enthTRPR = m_Mu0_tr_pr + 298.15 * m_Entrop_tr_pr * 1.0E3 * 4.184; - double res = delH + enthTRPR; - return res; + return delH + enthTRPR; } #endif @@ -446,8 +445,7 @@ doublereal PDSS_HKFT::molarVolume() const doublereal molVol_calgmolPascal = a1term + a2term + a3term + a4term + wterm + qterm; // Convert to m**3 / kmol from (cal/gmol/Pa) - doublereal molVol = molVol_calgmolPascal * 4.184 * 1.0E3; - return molVol; + return molVol_calgmolPascal * 4.184 * 1.0E3; } doublereal @@ -903,8 +901,7 @@ doublereal PDSS_HKFT::deltaH() const + yterm + yrterm + wterm + wrterm + otterm + otrterm; // Convert to Joules / kmol - doublereal deltaH = deltaH_calgmol * 1.0E3 * 4.184; - return deltaH; + return deltaH_calgmol * 1.0E3 * 4.184; } #endif @@ -952,8 +949,7 @@ doublereal PDSS_HKFT::deltaG() const doublereal deltaG_calgmol = sterm + c1term + a1term + a2term + c2term + a3term + a4term + wterm + wrterm + yterm; // Convert to Joules / kmol - doublereal deltaG = deltaG_calgmol * 1.0E3 * 4.184; - return deltaG; + return deltaG_calgmol * 1.0E3 * 4.184; } @@ -1012,8 +1008,7 @@ doublereal PDSS_HKFT::deltaS() const doublereal deltaS_calgmol = c1term + c2term + a3term + a4term + wterm + wrterm + otterm + otrterm; // Convert to Joules / kmol - doublereal deltaS = deltaS_calgmol * 1.0E3 * 4.184; - return deltaS; + return deltaS_calgmol * 1.0E3 * 4.184; } @@ -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}; if (ifunc == 0) { doublereal t2 = temp * temp; - doublereal val = ag_coeff[0] + ag_coeff[1] * temp + ag_coeff[2] * t2; - return val; + return ag_coeff[0] + ag_coeff[1] * temp + ag_coeff[2] * t2; } else if (ifunc == 1) { 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}; if (ifunc == 0) { doublereal t2 = temp * temp; - doublereal val = bg_coeff[0] + bg_coeff[1] * temp + bg_coeff[2] * t2; - return val; + return bg_coeff[0] + bg_coeff[1] * temp + bg_coeff[2] * t2; } else if (ifunc == 1) { 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) { doublereal beta = m_waterSS->isothermalCompressibility(); - doublereal dgdp = - bfunc * gval * dens * beta / (1.0 - dens); - - return dgdp; + return - bfunc * gval * dens * beta / (1.0 - dens); } else { throw CanteraError("HKFT_PDSS::g", "unimplemented"); } diff --git a/src/thermo/PDSS_IdealGas.cpp b/src/thermo/PDSS_IdealGas.cpp index 2056dd57b..549028129 100644 --- a/src/thermo/PDSS_IdealGas.cpp +++ b/src/thermo/PDSS_IdealGas.cpp @@ -175,8 +175,7 @@ PDSS_IdealGas::enthalpy_mole() const doublereal PDSS_IdealGas::enthalpy_RT() const { - doublereal val = m_h0_RT_ptr[m_spindex]; - return val; + return m_h0_RT_ptr[m_spindex]; } @@ -206,8 +205,7 @@ PDSS_IdealGas::entropy_mole() const doublereal PDSS_IdealGas::entropy_R() const { - doublereal val = m_s0_R_ptr[m_spindex] - log(m_pres/m_p0); - return val; + return m_s0_R_ptr[m_spindex] - log(m_pres/m_p0); } /* @@ -225,8 +223,7 @@ PDSS_IdealGas::gibbs_mole() const doublereal PDSS_IdealGas::gibbs_RT() const { - doublereal val = m_g0_RT_ptr[m_spindex] + log(m_pres/m_p0); - return val; + return m_g0_RT_ptr[m_spindex] + log(m_pres/m_p0); } /* @@ -243,8 +240,7 @@ PDSS_IdealGas::cp_mole() const doublereal PDSS_IdealGas::cp_R() const { - doublereal val = m_cp0_R_ptr[m_spindex]; - return val; + return m_cp0_R_ptr[m_spindex]; } doublereal @@ -274,20 +270,17 @@ PDSS_IdealGas::cv_mole() const doublereal PDSS_IdealGas::gibbs_RT_ref() const { - doublereal val = m_g0_RT_ptr[m_spindex]; - return val; + return m_g0_RT_ptr[m_spindex]; } doublereal PDSS_IdealGas::enthalpy_RT_ref() const { - doublereal val = m_h0_RT_ptr[m_spindex]; - return val; + return m_h0_RT_ptr[m_spindex]; } doublereal PDSS_IdealGas::entropy_R_ref() const { - doublereal val = m_s0_R_ptr[m_spindex]; - return val; + return m_s0_R_ptr[m_spindex]; } doublereal PDSS_IdealGas::cp_R_ref() const diff --git a/src/thermo/PDSS_SSVol.cpp b/src/thermo/PDSS_SSVol.cpp index 78d8adeca..6180e98eb 100644 --- a/src/thermo/PDSS_SSVol.cpp +++ b/src/thermo/PDSS_SSVol.cpp @@ -242,8 +242,7 @@ PDSS_SSVol::enthalpy_mole() const doublereal PDSS_SSVol::enthalpy_RT() const { - doublereal val = m_hss_RT_ptr[m_spindex]; - return val; + return m_hss_RT_ptr[m_spindex]; } doublereal @@ -266,8 +265,7 @@ PDSS_SSVol::entropy_mole() const doublereal PDSS_SSVol::entropy_R() const { - doublereal val = m_sss_R_ptr[m_spindex]; - return val; + return m_sss_R_ptr[m_spindex]; } /** @@ -285,8 +283,7 @@ PDSS_SSVol::gibbs_mole() const doublereal PDSS_SSVol::gibbs_RT() const { - doublereal val = m_gss_RT_ptr[m_spindex]; - return val; + return m_gss_RT_ptr[m_spindex]; } doublereal @@ -299,22 +296,19 @@ PDSS_SSVol::cp_mole() const doublereal PDSS_SSVol::cp_R() const { - doublereal val = m_cpss_R_ptr[m_spindex]; - return val; + return m_cpss_R_ptr[m_spindex]; } doublereal PDSS_SSVol::cv_mole() const { - doublereal val = (cp_mole() - m_V0_ptr[m_spindex]); - return val; + return (cp_mole() - m_V0_ptr[m_spindex]); } doublereal PDSS_SSVol::molarVolume() const { - doublereal val = m_Vss_ptr[m_spindex]; - return val; + return m_Vss_ptr[m_spindex]; } doublereal @@ -327,32 +321,27 @@ PDSS_SSVol::density() const doublereal PDSS_SSVol::gibbs_RT_ref() const { - doublereal val = m_g0_RT_ptr[m_spindex]; - return val; + return m_g0_RT_ptr[m_spindex]; } doublereal PDSS_SSVol::enthalpy_RT_ref() const { - doublereal val = m_h0_RT_ptr[m_spindex]; - return val; + return m_h0_RT_ptr[m_spindex]; } doublereal PDSS_SSVol::entropy_R_ref() const { - doublereal val = m_s0_R_ptr[m_spindex]; - return val; + return m_s0_R_ptr[m_spindex]; } doublereal PDSS_SSVol::cp_R_ref() const { - doublereal val = m_cp0_R_ptr[m_spindex]; - return val; + return m_cp0_R_ptr[m_spindex]; } doublereal PDSS_SSVol::molarVolume_ref() const { - doublereal val = m_V0_ptr[m_spindex]; - return val; + return m_V0_ptr[m_spindex]; } void PDSS_SSVol::calcMolarVolume() const diff --git a/src/thermo/PDSS_Water.cpp b/src/thermo/PDSS_Water.cpp index 6939b3f9b..60db63ae9 100644 --- a/src/thermo/PDSS_Water.cpp +++ b/src/thermo/PDSS_Water.cpp @@ -337,20 +337,17 @@ doublereal PDSS_Water::gibbs_mole() const doublereal PDSS_Water::cp_mole() const { - doublereal cp = m_sub->cp(); - return cp; + return m_sub->cp(); } doublereal PDSS_Water::cv_mole() const { - doublereal cv = m_sub->cv(); - return cv; + return m_sub->cv(); } doublereal PDSS_Water::molarVolume() const { - doublereal mv = m_sub->molarVolume(); - return mv; + return m_sub->molarVolume(); } doublereal PDSS_Water::gibbs_RT_ref() const @@ -457,8 +454,7 @@ void PDSS_Water::setPressure(doublereal p) */ doublereal PDSS_Water::thermalExpansionCoeff() const { - doublereal val = m_sub->coeffThermExp(); - return val; + return m_sub->coeffThermExp(); } doublereal PDSS_Water::dthermalExpansionCoeffdT() const @@ -474,14 +470,12 @@ doublereal PDSS_Water::dthermalExpansionCoeffdT() const doublereal vald = m_sub->coeffThermExp(); m_sub->setState_TR(m_temp, dens_save); doublereal val2 = m_sub->coeffThermExp(); - doublereal val = (val2 - vald) / 0.04; - return val; + return (val2 - vald) / 0.04; } doublereal PDSS_Water::isothermalCompressibility() const { - doublereal val = m_sub->isothermalCompressibility(); - return val; + return m_sub->isothermalCompressibility(); } /// critical temperature diff --git a/src/thermo/PureFluidPhase.cpp b/src/thermo/PureFluidPhase.cpp index 8f79c8e68..d13d5868b 100644 --- a/src/thermo/PureFluidPhase.cpp +++ b/src/thermo/PureFluidPhase.cpp @@ -315,8 +315,7 @@ doublereal PureFluidPhase::critDensity() const doublereal PureFluidPhase::satTemperature(doublereal p) const { - doublereal ts = m_sub->Tsat(p); - return ts; + return m_sub->Tsat(p); } void PureFluidPhase::setState_HP(doublereal h, doublereal p, @@ -351,8 +350,7 @@ doublereal PureFluidPhase::satPressure(doublereal t) const { doublereal vsv = m_sub->v(); Set(tpx::PropertyPair::TV,t,vsv); - doublereal ps = m_sub->Ps(); - return ps; + return m_sub->Ps(); } doublereal PureFluidPhase::vaporFraction() const diff --git a/src/thermo/RedlichKwongMFTP.cpp b/src/thermo/RedlichKwongMFTP.cpp index c8ac7d132..e6d556fba 100644 --- a/src/thermo/RedlichKwongMFTP.cpp +++ b/src/thermo/RedlichKwongMFTP.cpp @@ -278,8 +278,7 @@ doublereal RedlichKwongMFTP::cp_mole() const 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 +1.0/(m_b_current * sqt) * log(vpb/mv) * (-0.5 * dadt)); - double cp = dHdT_V - (mv + TKelvin * dpdT_ / dpdV_) * dpdT_; - return cp; + return dHdT_V - (mv + TKelvin * dpdT_ / dpdV_) * dpdT_; } doublereal RedlichKwongMFTP::cv_mole() const @@ -386,8 +385,7 @@ doublereal RedlichKwongMFTP::standardConcentration(size_t k) const doublereal RedlichKwongMFTP::logStandardConc(size_t k) const { double c = standardConcentration(k); - double lc = std::log(c); - return lc; + return std::log(c); } void RedlichKwongMFTP::getUnitsStandardConc(double* uA, int, int sizeUA) const @@ -1040,8 +1038,7 @@ doublereal RedlichKwongMFTP::sresid() const doublereal sqT = sqrt(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 sp = GasConstant * sresid_mol_R; - return sp; + return GasConstant * sresid_mol_R; } doublereal RedlichKwongMFTP::hresid() const @@ -1056,8 +1053,7 @@ doublereal RedlichKwongMFTP::hresid() const doublereal T = temperature(); doublereal sqT = sqrt(T); 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 hresid_mol; + return GasConstant * T * (zz - 1.0) + fac * log(1.0 + hh) / (sqT * m_b_current); } doublereal RedlichKwongMFTP::liquidVolEst(doublereal TKelvin, doublereal& presGuess) const @@ -1114,7 +1110,6 @@ doublereal RedlichKwongMFTP::densityCalc(doublereal TKelvin, doublereal presPa, setTemperature(TKelvin); double tcrit = critTemperature(); doublereal mmw = meanMolecularWeight(); - double densBase = 0.0; if (rhoguess == -1.0) { if (phaseRequested != FLUID_GAS) { if (TKelvin > tcrit) { @@ -1177,15 +1172,13 @@ doublereal RedlichKwongMFTP::densityCalc(doublereal TKelvin, doublereal presPa, //printf("DensityCalc(): Possible problem encountered\n"); return -1.0; } - densBase = mmw / molarVolLast; - return densBase; + return mmw / molarVolLast; } doublereal RedlichKwongMFTP::densSpinodalLiquid() const { if (NSolns_ != 3) { - double dens = critDensity(); - return dens; + return critDensity(); } double vmax = Vroot_[1]; double vmin = Vroot_[0]; @@ -1202,15 +1195,13 @@ doublereal RedlichKwongMFTP::densSpinodalLiquid() const throw CanteraError(" RedlichKwongMFTP::densSpinodalLiquid() ", "didn't converge"); } doublereal mmw = meanMolecularWeight(); - doublereal rho = mmw / vbest; - return rho; + return mmw / vbest; } doublereal RedlichKwongMFTP::densSpinodalGas() const { if (NSolns_ != 3) { - double dens = critDensity(); - return dens; + return critDensity(); } double vmax = Vroot_[2]; double vmin = Vroot_[1]; @@ -1227,8 +1218,7 @@ doublereal RedlichKwongMFTP::densSpinodalGas() const throw CanteraError(" RedlichKwongMFTP::densSpinodalGas() ", "didn't converge"); } doublereal mmw = meanMolecularWeight(); - doublereal rho = mmw / vbest; - return rho; + return mmw / vbest; } doublereal RedlichKwongMFTP::pressureCalc(doublereal TKelvin, doublereal molarVol) const diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index 6447c3317..d764937d1 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -891,8 +891,7 @@ SpeciesThermo* newSpeciesThermoMgr(int type, SpeciesThermoFactory* f) if (f == 0) { f = SpeciesThermoFactory::factory(); } - SpeciesThermo* sptherm = f->newSpeciesThermo(type); - return sptherm; + return f->newSpeciesThermo(type); } // Create a new species thermo manager instance, by specifying @@ -915,8 +914,7 @@ SpeciesThermo* newSpeciesThermoMgr(std::string& stype, if (f == 0) { f = SpeciesThermoFactory::factory(); } - SpeciesThermo* sptherm = f->newSpeciesThermoManager(stype); - return sptherm; + return f->newSpeciesThermoManager(stype); } // Function to return SpeciesThermo manager diff --git a/src/thermo/StoichSubstance.cpp b/src/thermo/StoichSubstance.cpp index a6d33e5b8..8c60cedaa 100644 --- a/src/thermo/StoichSubstance.cpp +++ b/src/thermo/StoichSubstance.cpp @@ -54,8 +54,7 @@ StoichSubstance::~StoichSubstance() doublereal StoichSubstance::enthalpy_mole() const { - double hh = intEnergy_mole() + m_press / molarDensity(); - return hh; + return intEnergy_mole() + m_press / molarDensity(); } doublereal StoichSubstance::intEnergy_mole() const diff --git a/src/thermo/VPSSMgrFactory.cpp b/src/thermo/VPSSMgrFactory.cpp index 0c4dfb01b..d8235919b 100644 --- a/src/thermo/VPSSMgrFactory.cpp +++ b/src/thermo/VPSSMgrFactory.cpp @@ -239,7 +239,6 @@ VPSSMgrFactory::newVPSSMgr(VPStandardStateTP* vp_ptr, std::string ssManager=""; std::string vpssManager=""; - VPSSMgr* vpss = 0; // First look for any explicit instructions within the XML Database // for the standard state manager and the variable pressure @@ -272,17 +271,14 @@ VPSSMgrFactory::newVPSSMgr(VPStandardStateTP* vp_ptr, // and return immediately if (vpssManager != "") { VPSSMgr_enumType type = VPSSMgr_StringConversion(vpssManager); - vpss = newVPSSMgr(type, vp_ptr); - return vpss; + return newVPSSMgr(type, vp_ptr); } // Handle special cases based on the VPStandardState types if (vp_ptr->eosType() == cVPSS_IdealGas) { - vpss = new VPSSMgr_IdealGas(vp_ptr, spth); - return vpss; + return new VPSSMgr_IdealGas(vp_ptr, spth); } else if (vp_ptr->eosType() == cVPSS_ConstVol) { - vpss = new VPSSMgr_ConstVol(vp_ptr, spth); - return vpss; + return new VPSSMgr_ConstVol(vp_ptr, spth); } @@ -304,29 +300,25 @@ VPSSMgrFactory::newVPSSMgr(VPStandardStateTP* vp_ptr, if (inasaIG || ishomateIG || isimpleIG) { throw CanteraError("newVPSSMgr", "Ideal gas with liquid water"); } else { - vpss = new VPSSMgr_Water_ConstVol(vp_ptr, spth); + return new VPSSMgr_Water_ConstVol(vp_ptr, spth); } } else { if (inasaIG || ishomateIG || isimpleIG) { throw CanteraError("newVPSSMgr", "Ideal gas with liquid water"); } else if (inasaCV || ishomateCV || isimpleCV) { - vpss = new VPSSMgr_General(vp_ptr, spth); + return new VPSSMgr_General(vp_ptr, spth); } 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 (!inasaIG && !ishomateIG && !isimpleIG && !itpx && !ihptx && !iother) { - vpss = new VPSSMgr_ConstVol(vp_ptr, spth); - } + if (inasaCV || ishomateCV || isimpleCV) { + if (!inasaIG && !ishomateIG && !isimpleIG && !itpx && !ihptx && !iother) { + return new VPSSMgr_ConstVol(vp_ptr, spth); } } - if (vpss == 0) { - vpss = new VPSSMgr_General(vp_ptr, spth); - } - return vpss; + + return new VPSSMgr_General(vp_ptr, spth); } @@ -365,8 +357,7 @@ VPSSMgr* newVPSSMgr(VPSSMgr_enumType type, VPStandardStateTP* vp_ptr, if (f == 0) { f = VPSSMgrFactory::factory(); } - VPSSMgr* vpsssptherm = f->newVPSSMgr(type, vp_ptr); - return vpsssptherm; + return f->newVPSSMgr(type, vp_ptr); } @@ -378,8 +369,7 @@ VPSSMgr* newVPSSMgr(VPStandardStateTP* tp_ptr, if (f == 0) { f = VPSSMgrFactory::factory(); } - VPSSMgr* vpsssptherm = f->newVPSSMgr(tp_ptr, phaseNode_ptr, spDataNodeList); - return vpsssptherm; + return f->newVPSSMgr(tp_ptr, phaseNode_ptr, spDataNodeList); } diff --git a/src/thermo/WaterProps.cpp b/src/thermo/WaterProps.cpp index 207147b2c..e4a571aaa 100644 --- a/src/thermo/WaterProps.cpp +++ b/src/thermo/WaterProps.cpp @@ -150,14 +150,11 @@ doublereal WaterProps::density_T(doublereal T, doublereal P, int ifunc) if (rho < rhomin) { rho = rhomin; if (ifunc == 1) { - doublereal drhodT = - rhomin / T; - return drhodT; + return - rhomin / T; } else if (ifunc == 3) { - doublereal drhodP = rhomin / P; - return drhodP; + return rhomin / P; } else if (ifunc == 2) { - doublereal d2rhodT2 = 2.0 * rhomin / (T * T); - return d2rhodT2; + return 2.0 * rhomin / (T * T); } } @@ -247,8 +244,7 @@ doublereal WaterProps::relEpsilon(doublereal T, doublereal P_pascal, doublereal dltmpdT = (dBdT/tmpBpar - dBdT/tmpB1000); if (ifunc == 1) { - doublereal depsReldT = deps1000dT + dCdT * ltmp + C * dltmpdT; - return depsReldT; + return deps1000dT + dCdT * ltmp + C * dltmpdT; } doublereal T3 = T2 * T; doublereal d2CdT2 = - 2.0 * dCdT / tmpC; @@ -267,8 +263,7 @@ doublereal WaterProps::relEpsilon(doublereal T, doublereal P_pascal, } if (ifunc == 3) { doublereal dltmpdP = 1.0E-5 / tmpBpar; - doublereal depsReldP = C * dltmpdP; - return depsReldP; + return C * dltmpdP; } return epsRel; @@ -399,8 +394,7 @@ doublereal WaterProps::ADebye(doublereal T, doublereal P_input, int ifunc) doublereal WaterProps::satPressure(doublereal T) { - doublereal pres = m_waterIAPWS->psat(T); - return pres; + return m_waterIAPWS->psat(T); } // Returns the density of water @@ -413,8 +407,7 @@ doublereal WaterProps::satPressure(doublereal T) */ doublereal WaterProps::density_IAPWS(doublereal temp, doublereal press) { - doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID); - return dens; + return m_waterIAPWS->density(temp, press, WATER_LIQUID); } // Returns the density of water @@ -424,8 +417,7 @@ doublereal WaterProps::density_IAPWS(doublereal temp, doublereal press) */ doublereal WaterProps::density_IAPWS() const { - doublereal dens = m_waterIAPWS->density(); - return dens; + return m_waterIAPWS->density(); } 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", "Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press)); } - doublereal cte = m_waterIAPWS->coeffThermExp(); - return cte; + return m_waterIAPWS->coeffThermExp(); } doublereal WaterProps::isothermalCompressibility_IAPWS(doublereal temp, doublereal press) @@ -446,8 +437,7 @@ doublereal WaterProps::isothermalCompressibility_IAPWS(doublereal temp, doublere throw CanteraError("WaterProps::isothermalCompressibility_IAPWS", "Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press)); } - doublereal kappa = m_waterIAPWS->isothermalCompressibility(); - return kappa; + return m_waterIAPWS->isothermalCompressibility(); } @@ -665,8 +655,7 @@ doublereal WaterProps::thermalConductivityWater() const doublereal lambda2bar = 0.0013848 / (mu0bar * mu1bar) * t2r2 * dpdT_const_rho * dpdT_const_rho * xsipow * sqrt(rhobar) * exp(-18.66*temp2 - rho4); - doublereal lambda = (lambda0bar * lambda1bar + lambda2bar) * lambdastar; - return lambda; + return (lambda0bar * lambda1bar + lambda2bar) * lambdastar; } diff --git a/src/thermo/WaterPropsIAPWS.cpp b/src/thermo/WaterPropsIAPWS.cpp index 37cae13e7..c022bcaaf 100644 --- a/src/thermo/WaterPropsIAPWS.cpp +++ b/src/thermo/WaterPropsIAPWS.cpp @@ -389,8 +389,7 @@ doublereal WaterPropsIAPWS::dpdrho() const { doublereal retn = m_phi->dimdpdrho(tau, delta); doublereal temperature = T_c/tau; - doublereal val = retn * Rgas * temperature / M_water; - return val; + return retn * Rgas * temperature / M_water; } // Returns the isochoric pressure derivative wrt temperature @@ -404,8 +403,7 @@ doublereal WaterPropsIAPWS::dpdrho() const */ doublereal WaterPropsIAPWS:: coeffPresExp() const { - doublereal retn = m_phi->dimdpdT(tau, delta); - return retn; + return m_phi->dimdpdT(tau, delta); } // Returns the coefficient of thermal expansion. diff --git a/src/thermo/WaterPropsIAPWSphi.cpp b/src/thermo/WaterPropsIAPWSphi.cpp index 3355e28b3..1a8cbc051 100644 --- a/src/thermo/WaterPropsIAPWSphi.cpp +++ b/src/thermo/WaterPropsIAPWSphi.cpp @@ -541,8 +541,7 @@ doublereal WaterPropsIAPWSphi::phi(doublereal tau, doublereal delta) tdpolycalc(tau, delta); doublereal nau = phi0(); doublereal res = phiR(); - doublereal retn = nau + res; - return retn; + return nau + res; } @@ -646,8 +645,7 @@ doublereal WaterPropsIAPWSphi::phi_d(doublereal tau, doublereal delta) tdpolycalc(tau, delta); doublereal nau = phi0_d(); doublereal res = phiR_d(); - doublereal retn = nau + res; - return retn; + return nau + res; } /* @@ -661,8 +659,7 @@ doublereal WaterPropsIAPWSphi::pressureM_rhoRT(doublereal tau, doublereal del { tdpolycalc(tau, delta); doublereal res = phiR_d(); - doublereal retn = 1.0 + delta * res; - return retn; + return 1.0 + delta * res; } /* @@ -795,8 +792,7 @@ doublereal WaterPropsIAPWSphi::phi_dd(doublereal tau, doublereal delta) tdpolycalc(tau, delta); doublereal nau = phi0_dd(); doublereal res = phiR_dd(); - doublereal retn = nau + res; - return retn; + return nau + res; } doublereal WaterPropsIAPWSphi::dimdpdrho(doublereal tau, doublereal delta) @@ -804,8 +800,7 @@ doublereal WaterPropsIAPWSphi::dimdpdrho(doublereal tau, doublereal delta) tdpolycalc(tau, delta); doublereal res1 = phiR_d(); doublereal res2 = phiR_dd(); - doublereal retn = 1.0 + delta * (2.0*res1 + delta*res2); - return retn; + return 1.0 + delta * (2.0*res1 + delta*res2); } doublereal WaterPropsIAPWSphi::dimdpdT(doublereal tau, doublereal delta) @@ -813,8 +808,7 @@ doublereal WaterPropsIAPWSphi::dimdpdT(doublereal tau, doublereal delta) tdpolycalc(tau, delta); doublereal res1 = phiR_d(); doublereal res2 = phiR_dt(); - doublereal retn = (1.0 + delta * res1) - tau * delta * (res2); - return retn; + return (1.0 + delta * res1) - tau * delta * (res2); } /* @@ -914,8 +908,7 @@ doublereal WaterPropsIAPWSphi::phi_t(doublereal tau, doublereal delta) tdpolycalc(tau, delta); doublereal nau = phi0_t(); doublereal res = phiR_t(); - doublereal retn = nau + res; - return retn; + return nau + res; } /* @@ -1027,8 +1020,7 @@ doublereal WaterPropsIAPWSphi::phi_tt(doublereal tau, doublereal delta) tdpolycalc(tau, delta); doublereal nau = phi0_tt(); doublereal res = phiR_tt(); - doublereal retn = nau + res; - return retn; + return nau + res; } /** @@ -1237,8 +1229,7 @@ doublereal WaterPropsIAPWSphi::gibbs_RT() const { doublereal delta = DELTAsave; doublereal rd = phiR_d(); - doublereal g = 1.0 + phi0() + phiR() + delta * rd; - return g; + return 1.0 + phi0() + phiR() + delta * rd; } /** @@ -1251,8 +1242,7 @@ doublereal WaterPropsIAPWSphi::enthalpy_RT() const doublereal rd = phiR_d(); doublereal nt = phi0_t(); doublereal rt = phiR_t(); - doublereal hRT = 1.0 + tau * (nt + rt) + delta * rd; - return hRT; + return 1.0 + tau * (nt + rt) + delta * rd; } /* @@ -1265,8 +1255,7 @@ doublereal WaterPropsIAPWSphi::entropy_R() const doublereal rt = phiR_t(); doublereal p0 = phi0(); doublereal pR = phiR(); - doublereal sR = tau * (nt + rt) - p0 - pR; - return sR; + return tau * (nt + rt) - p0 - pR; } /* @@ -1277,8 +1266,7 @@ doublereal WaterPropsIAPWSphi::intEnergy_RT() const doublereal tau = TAUsave; doublereal nt = phi0_t(); doublereal rt = phiR_t(); - doublereal uR = tau * (nt + rt); - return uR; + return tau * (nt + rt); } /* @@ -1289,8 +1277,7 @@ doublereal WaterPropsIAPWSphi::cv_R() const doublereal tau = TAUsave; doublereal ntt = phi0_tt(); doublereal rtt = phiR_tt(); - doublereal cvR = - tau * tau * (ntt + rtt); - return cvR; + return - tau * tau * (ntt + rtt); } /* diff --git a/src/thermo/WaterSSTP.cpp b/src/thermo/WaterSSTP.cpp index 9d7b4c1c1..8984a5589 100644 --- a/src/thermo/WaterSSTP.cpp +++ b/src/thermo/WaterSSTP.cpp @@ -263,8 +263,7 @@ void WaterSSTP::getCp_R(doublereal* cpr) const doublereal WaterSSTP::cv_mole() const { - doublereal cv = m_sub->cv(); - return cv; + return m_sub->cv(); } void WaterSSTP::getEnthalpy_RT_ref(doublereal* hrt) const @@ -379,8 +378,7 @@ void WaterSSTP::getStandardVolumes_ref(doublereal* vol) const doublereal WaterSSTP::pressure() const { - doublereal p = m_sub->pressure(); - return p; + return m_sub->pressure(); } void WaterSSTP:: @@ -402,14 +400,12 @@ setPressure(doublereal p) doublereal WaterSSTP::isothermalCompressibility() const { - doublereal val = m_sub->isothermalCompressibility(); - return val; + return m_sub->isothermalCompressibility(); } doublereal WaterSSTP::thermalExpansionCoeff() const { - doublereal val = m_sub->coeffThermExp(); - return val; + return m_sub->coeffThermExp(); } doublereal WaterSSTP::dthermalExpansionCoeffdT() const @@ -426,8 +422,7 @@ doublereal WaterSSTP::dthermalExpansionCoeffdT() const doublereal vald = m_sub->coeffThermExp(); m_sub->setState_TR(T, dens_save); doublereal val2 = m_sub->coeffThermExp(); - doublereal val = (val2 - vald) / 0.04; - return val; + return (val2 - vald) / 0.04; } doublereal WaterSSTP::critTemperature() const diff --git a/src/tpx/Heptane.cpp b/src/tpx/Heptane.cpp index 573287d70..5425874df 100644 --- a/src/tpx/Heptane.cpp +++ b/src/tpx/Heptane.cpp @@ -278,7 +278,7 @@ double Heptane::Pp() */ double Heptane::Psat() { - double log, sum=0,P; + double log, sum=0; if ((T < Tmn) || (T > Tc)) { throw TPX_Error("Heptane::Psat", "Temperature out of range. T = " + fp2str(T)); @@ -288,9 +288,7 @@ double Heptane::Psat() } log = ((Tc/T)-1)*sum; - P=exp(log)*Pc; - - return P; + return exp(log)*Pc; } diff --git a/src/tpx/Hydrogen.cpp b/src/tpx/Hydrogen.cpp index 56f484d8f..2953303bb 100644 --- a/src/tpx/Hydrogen.cpp +++ b/src/tpx/Hydrogen.cpp @@ -228,13 +228,12 @@ double hydrogen::ldens() "Temperature out of range. T = " + fp2str(T)); } double x=1-T/Tc; - double sum, term; + double sum; int i; for (i=1, sum=0; i<=6; i++) { sum+=Dhydro[i]*pow(x, 1+double(i-1)/3.0); } - term = sum+Roc+Dhydro[0]*pow(x,alpha1); - return term; + return sum+Roc+Dhydro[0]*pow(x,alpha1); } diff --git a/src/tpx/RedlichKwong.cpp b/src/tpx/RedlichKwong.cpp index d961f0be5..cb3c87afe 100644 --- a/src/tpx/RedlichKwong.cpp +++ b/src/tpx/RedlichKwong.cpp @@ -11,8 +11,7 @@ namespace tpx double RedlichKwong::up() { - double u = -Pp()/Rho + hresid() + m_energy_offset; - return u; + return -Pp()/Rho + hresid() + m_energy_offset; } double RedlichKwong::hresid() @@ -28,8 +27,7 @@ double RedlichKwong::sresid() double hh = m_b * (Rho/m_mw); double sresid_mol_R = log(z()*(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 sp; + return 8314.3*sresid_mol_R/m_mw; } double RedlichKwong::sp() @@ -39,8 +37,7 @@ double RedlichKwong::sp() //double ss = rgas*(log(Pref/(Rho*rgas*T))); double sr = sresid(); double p = Pp(); - double s = rgas*(log(Pref/p)) + sr + m_entropy_offset; - return s; + return rgas*(log(Pref/p)) + sr + m_entropy_offset; } double RedlichKwong::z() @@ -53,8 +50,7 @@ double RedlichKwong::Pp() { double R = 8314.3; double V = m_mw/Rho; - double pp = R*T/(V - m_b) - m_a/(sqrt(T)*V*(V+m_b)); - return pp; + return R*T/(V - m_b) - m_a/(sqrt(T)*V*(V+m_b)); } double RedlichKwong::Psat() diff --git a/src/tpx/Water.cpp b/src/tpx/Water.cpp index 8a8c34a7e..16bd2119d 100644 --- a/src/tpx/Water.cpp +++ b/src/tpx/Water.cpp @@ -160,7 +160,7 @@ double water::Pp() double water::Psat() { - double log, sum=0,P; + double log, sum=0; if ((T < Tmn) || (T > Tc)) { throw TPX_Error("water::Psat", "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 } log = (Tc/T-1)*sum; - P=exp(log)*Pc; - return P; + return exp(log)*Pc; } /* @@ -199,8 +198,7 @@ double water::ldens() for (i=0; i<8; i++) { sum+=D[i]*pow(1.0 - T/Tc, double(i+1)/3.0); } - double density = Roc*(1+sum); - return density; + return Roc*(1+sum); } double water::Tcrit() diff --git a/src/transport/LiquidTranInteraction.cpp b/src/transport/LiquidTranInteraction.cpp index 254e10f3a..1fdecc9ca 100644 --- a/src/transport/LiquidTranInteraction.cpp +++ b/src/transport/LiquidTranInteraction.cpp @@ -494,8 +494,7 @@ doublereal LTI_Log_MoleFracs::getMixTransProp(doublereal* speciesValues, doubler } } - value = exp(value); - return value; + return exp(value); } diff --git a/src/transport/TortuosityMaxwell.cpp b/src/transport/TortuosityMaxwell.cpp index 8ed8a8817..cb909e1aa 100644 --- a/src/transport/TortuosityMaxwell.cpp +++ b/src/transport/TortuosityMaxwell.cpp @@ -92,8 +92,7 @@ doublereal TortuosityMaxwell::tortuosityFactor(doublereal porosity) */ doublereal TortuosityMaxwell::McMillanFactor(doublereal porosity) { - doublereal tmp = 1 + 3 * (1.0 - porosity) * (relativeConductivities_ - 1.0) / (relativeConductivities_ + 2); - return tmp; + return 1 + 3 * (1.0 - porosity) * (relativeConductivities_ - 1.0) / (relativeConductivities_ + 2); } //==================================================================================================================== } diff --git a/src/transport/WaterTransport.cpp b/src/transport/WaterTransport.cpp index 9061af30d..b1c48cb44 100644 --- a/src/transport/WaterTransport.cpp +++ b/src/transport/WaterTransport.cpp @@ -126,8 +126,7 @@ void WaterTransport::initTP() */ doublereal WaterTransport::viscosity() { - doublereal visc = m_waterProps->viscosityWater(); - return visc; + return m_waterProps->viscosityWater(); } // Returns the thermal conductivity of water at the current conditions @@ -147,8 +146,7 @@ doublereal WaterTransport::viscosity() */ doublereal WaterTransport::thermalConductivity() { - doublereal lambda = m_waterProps->thermalConductivityWater(); - return lambda; + return m_waterProps->thermalConductivityWater(); } } diff --git a/test_problems/cathermo/testIAPWSPres/testPress.cpp b/test_problems/cathermo/testIAPWSPres/testPress.cpp index 9b53874bc..45577e7a2 100644 --- a/test_problems/cathermo/testIAPWSPres/testPress.cpp +++ b/test_problems/cathermo/testIAPWSPres/testPress.cpp @@ -16,8 +16,7 @@ double numdpdt(WaterPropsIAPWS* water, double T, double pres) double Td = T + 0.001; water->setState_TR(Td, rho); double presd = water->pressure(); - double dpdt = (presd - presB) / 0.001; - return dpdt; + return (presd - presB) / 0.001; } int main() diff --git a/test_problems/cxx_ex/examples.cpp b/test_problems/cxx_ex/examples.cpp index 1017d38c1..d41174e7f 100644 --- a/test_problems/cxx_ex/examples.cpp +++ b/test_problems/cxx_ex/examples.cpp @@ -22,8 +22,7 @@ typedef int (*exfun)(int n); int run_example(int n, exfun f, int job = 2) { cout << "\n\n\n\n>>>>> example " << n+1 << "\n\nDescription: " << endl; - int i = f(job); - return i; + return f(job); } // array of example functions