From 66ea343cea8c1725aea754003062e3919c0417b1 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Sun, 17 Jan 2010 18:17:55 +0000 Subject: [PATCH] Doxygen update - no code changed - All the easy warning messages are eliminated now from the trunk. --- Cantera/src/base/utilities.h | 6 +- Cantera/src/base/xml.cpp | 26 +- Cantera/src/base/xml.h | 2 +- Cantera/src/thermo/WaterProps.cpp | 352 ++++++++++++------------ Cantera/src/thermo/WaterProps.h | 1 + Cantera/src/thermo/WaterPropsIAPWSphi.h | 2 +- 6 files changed, 195 insertions(+), 194 deletions(-) diff --git a/Cantera/src/base/utilities.h b/Cantera/src/base/utilities.h index 7b5221555..e54f87c61 100644 --- a/Cantera/src/base/utilities.h +++ b/Cantera/src/base/utilities.h @@ -29,7 +29,7 @@ //! Unary operator to multiply the argument by a constant. /*! * The form of this operator is designed for use by std::transform. - * @see @ref scale. + * @see @ref scale(). */ template struct timesConstant : public std::unary_function { @@ -574,9 +574,9 @@ namespace Cantera { return sum; } - //! scale a templated vector by a constant factor. + //! Scale a templated vector by a constant factor. /*! - * The template arguments are: template + * The template arguments are: template * * This function is essentially a wrapper around the stl * function %scale(). The function is has one template diff --git a/Cantera/src/base/xml.cpp b/Cantera/src/base/xml.cpp index d4c6f0e80..3f3912ede 100644 --- a/Cantera/src/base/xml.cpp +++ b/Cantera/src/base/xml.cpp @@ -245,7 +245,7 @@ namespace Cantera { } } - /** + /* * Searches a string for the first occurrence of a valid * quoted string. Quotes can start with either a single * quote or a double quote, but must also end with the same @@ -288,7 +288,7 @@ namespace Cantera { return static_cast(iloc1)+1; } - /** + /* * parseTag parses XML tags, i.e., the XML elements that are * inbetween angle brackets. */ @@ -677,9 +677,9 @@ namespace Cantera { return child(cname).value(); } - //! Overloaded parenthesis operator with one augment - //! returns the value of an XML child node as a string - /*! + // Overloaded parenthesis operator with one augment + // returns the value of an XML child node as a string + /* * @param cname Name of the child node to the current * node, for which you want the value */ @@ -714,7 +714,7 @@ namespace Cantera { m_attribs[attrib] = fp2str(value, fmt); } - // The operator[] is overloaded to provide a lookup capability + // The operator[] is overloaded to provide a lookup capability // on attributes for the current XML element. /* * For example @@ -752,7 +752,7 @@ namespace Cantera { return ""; } - // Returns a changeable value of the attributes map for the current node + // Returns a changeable value of the attributes map for the current node /* * Note this is a simple accessor routine. And, it is a private function. * It's used in some internal copy and assignment routines @@ -859,9 +859,9 @@ namespace Cantera { } - //! This routine carries out a search for an XML node based - //! on both the xml element name and the attribute ID. - /*! + // This routine carries out a search for an XML node based + // on both the xml element name and the attribute ID. + /* * If exact matches are found for both fields, the pointer * to the matching XML Node is returned. * @@ -944,8 +944,8 @@ namespace Cantera { return 0; } - // This routine carries out a recursive search for an XML node based - // on an attribute of each XML node + // This routine carries out a recursive search for an XML node based + // on an attribute of each XML node /* * If exact match is found with respect to the attribute name and * value of the attribute, the pointer @@ -1234,7 +1234,7 @@ namespace Cantera { } } - /** + /* * Write an XML subtree to an output stream. This is the * main recursive routine. It doesn't put a final endl * on. This is fixed up in the public method. diff --git a/Cantera/src/base/xml.h b/Cantera/src/base/xml.h index b66567446..f3063ba9f 100644 --- a/Cantera/src/base/xml.h +++ b/Cantera/src/base/xml.h @@ -303,7 +303,7 @@ namespace Cantera { */ std::string value(const std::string &cname) const; - //! Overloaded parenthesis operator with one augment + //! The Overloaded parenthesis operator with one augment //! returns the value of an XML child node as a string /*! * @param cname Name of the child node to the current diff --git a/Cantera/src/thermo/WaterProps.cpp b/Cantera/src/thermo/WaterProps.cpp index ae1c1e598..9ba777163 100644 --- a/Cantera/src/thermo/WaterProps.cpp +++ b/Cantera/src/thermo/WaterProps.cpp @@ -130,41 +130,41 @@ namespace Cantera { * * units = returns density in kg m-3. */ - double WaterProps::density_T(double T, double P, int ifunc) { - double Tc = T - 273.15; - const double U1 = 288.9414; - const double U2 = 508929.2; - const double U3 = 68.12963; - const double U4 = -3.9863; + doublereal WaterProps::density_T(doublereal T, doublereal P, int ifunc) { + doublereal Tc = T - 273.15; + const doublereal U1 = 288.9414; + const doublereal U2 = 508929.2; + const doublereal U3 = 68.12963; + const doublereal U4 = -3.9863; - double tmp1 = Tc + U1; - double tmp4 = Tc + U4; - double t4t4 = tmp4 * tmp4; - double tmp3 = Tc + U3; - double rho = 1000. * (1.0 - tmp1*t4t4/(U2 * tmp3)); + doublereal tmp1 = Tc + U1; + doublereal tmp4 = Tc + U4; + doublereal t4t4 = tmp4 * tmp4; + doublereal tmp3 = Tc + U3; + doublereal rho = 1000. * (1.0 - tmp1*t4t4/(U2 * tmp3)); /* * Impose an ideal gas lower bound on rho. We need this * to ensure positivity of rho, even though it is * grossly unrepresentative. */ - double rhomin = P / (GasConstant * T); + doublereal rhomin = P / (GasConstant * T); if (rho < rhomin) { rho = rhomin; if (ifunc == 1) { - double drhodT = - rhomin / T; + doublereal drhodT = - rhomin / T; return drhodT; } else if (ifunc == 3) { - double drhodP = rhomin / P; + doublereal drhodP = rhomin / P; return drhodP; } else if (ifunc == 2) { - double d2rhodT2 = 2.0 * rhomin / (T * T); + doublereal d2rhodT2 = 2.0 * rhomin / (T * T); return d2rhodT2; } } if (ifunc == 1) { - double drhodT = 1000./U2 * ( + doublereal drhodT = 1000./U2 * ( - tmp4 * tmp4 / (tmp3) - tmp1 * 2 * tmp4 / (tmp3) + tmp1 * t4t4 / (tmp3*tmp3) @@ -173,8 +173,8 @@ namespace Cantera { } else if (ifunc == 3) { return 0.0; } else if (ifunc == 2) { - double t3t3 = tmp3 * tmp3; - double d2rhodT2 = 1000./U2 * + doublereal t3t3 = tmp3 * tmp3; + doublereal d2rhodT2 = 1000./U2 * ((-4.0*tmp4-2.0*tmp1)/tmp3 + (2.0*t4t4 + 4.0*tmp1*tmp4)/t3t3 - 2.0*tmp1 * t4t4/(t3t3*tmp3)); @@ -215,67 +215,67 @@ namespace Cantera { * value at 25C, relEps = 78.38 * */ - double WaterProps::relEpsilon(double T, double P_pascal, + doublereal WaterProps::relEpsilon(doublereal T, doublereal P_pascal, int ifunc) { - const double U1 = 3.4279E2; - const double U2 = -5.0866E-3; - const double U3 = 9.4690E-7; - const double U4 = -2.0525; - const double U5 = 3.1159E3; - const double U6 = -1.8289E2; - const double U7 = -8.0325E3; - const double U8 = 4.2142E6; - const double U9 = 2.1417; - double T2 = T * T; + const doublereal U1 = 3.4279E2; + const doublereal U2 = -5.0866E-3; + const doublereal U3 = 9.4690E-7; + const doublereal U4 = -2.0525; + const doublereal U5 = 3.1159E3; + const doublereal U6 = -1.8289E2; + const doublereal U7 = -8.0325E3; + const doublereal U8 = 4.2142E6; + const doublereal U9 = 2.1417; + doublereal T2 = T * T; - double eps1000 = U1 * exp(U2 * T + U3 * T2); - double C = U4 + U5/(U6 + T); - double B = U7 + U8/T + U9 * T; + doublereal eps1000 = U1 * exp(U2 * T + U3 * T2); + doublereal C = U4 + U5/(U6 + T); + doublereal B = U7 + U8/T + U9 * T; - double Pbar = P_pascal * 1.0E-5; - double tmpBpar = B + Pbar; - double tmpB1000 = B + 1000.0; - double ltmp = log(tmpBpar/tmpB1000); - double epsRel = eps1000 + C * ltmp; + doublereal Pbar = P_pascal * 1.0E-5; + doublereal tmpBpar = B + Pbar; + doublereal tmpB1000 = B + 1000.0; + doublereal ltmp = log(tmpBpar/tmpB1000); + doublereal epsRel = eps1000 + C * ltmp; if (ifunc == 1 || ifunc == 2) { - double tmpC = U6 + T; - double dCdT = - U5/(tmpC * tmpC); + doublereal tmpC = U6 + T; + doublereal dCdT = - U5/(tmpC * tmpC); - double dBdT = - U8/(T * T) + U9; + doublereal dBdT = - U8/(T * T) + U9; - double deps1000dT = eps1000 * (U2 + 2.0 * U3 * T); + doublereal deps1000dT = eps1000 * (U2 + 2.0 * U3 * T); - double dltmpdT = (dBdT/tmpBpar - dBdT/tmpB1000); + doublereal dltmpdT = (dBdT/tmpBpar - dBdT/tmpB1000); if (ifunc == 1) { - double depsReldT = deps1000dT + dCdT * ltmp + C * dltmpdT; + doublereal depsReldT = deps1000dT + dCdT * ltmp + C * dltmpdT; return depsReldT; } - double T3 = T2 * T; - double d2CdT2 = - 2.0 * dCdT / tmpC; - double d2BdT2 = 2.0 * U8 / (T3); + doublereal T3 = T2 * T; + doublereal d2CdT2 = - 2.0 * dCdT / tmpC; + doublereal d2BdT2 = 2.0 * U8 / (T3); - double d2ltmpdT2 = (d2BdT2*(1.0/tmpBpar - 1.0/tmpB1000) + + doublereal d2ltmpdT2 = (d2BdT2*(1.0/tmpBpar - 1.0/tmpB1000) + dBdT*dBdT*(1.0/(tmpB1000*tmpB1000) - 1.0/(tmpBpar*tmpBpar))); - double d2eps1000dT2 = (deps1000dT * (U2 + 2.0 * U3 * T) + eps1000 * (2.0 * U3)); + doublereal d2eps1000dT2 = (deps1000dT * (U2 + 2.0 * U3 * T) + eps1000 * (2.0 * U3)); if (ifunc == 2) { - double d2epsReldT2 = (d2eps1000dT2 + d2CdT2 * ltmp + 2.0 * dCdT * dltmpdT + doublereal d2epsReldT2 = (d2eps1000dT2 + d2CdT2 * ltmp + 2.0 * dCdT * dltmpdT + C * d2ltmpdT2); return d2epsReldT2; } } if (ifunc == 3) { - double dltmpdP = 1.0E-5 / tmpBpar; - double depsReldP = C * dltmpdP; + doublereal dltmpdP = 1.0E-5 / tmpBpar; + doublereal depsReldP = C * dltmpdP; return depsReldP; } return epsRel; } - /** + /* * ADebye calculates the value of A_Debye as a function * of temperature and pressure according to relations * that take into account the temperature and pressure @@ -318,12 +318,12 @@ namespace Cantera { * * (statically defined within the object) */ - double WaterProps::ADebye(double T, double P_input, int ifunc) { - const double e = 1.60217653E-19; - const double epsilon0 = 8.854187817E-12; - const double R = 8.314472E3; - double psat = satPressure(T); - double P; + doublereal WaterProps::ADebye(doublereal T, doublereal P_input, int ifunc) { + const doublereal e = 1.60217653E-19; + const doublereal epsilon0 = 8.854187817E-12; + const doublereal R = 8.314472E3; + doublereal psat = satPressure(T); + doublereal P; if (psat > P_input) { //printf("ADebye WARNING: p_input < psat: %g %g\n", // P_input, psat); @@ -331,17 +331,17 @@ namespace Cantera { } else { P = P_input; } - double epsRelWater = relEpsilon(T, P, 0); + doublereal epsRelWater = relEpsilon(T, P, 0); //printf("releps calc = %g, compare to 78.38\n", epsRelWater); - //double B_Debye = 3.28640E9; - const double Na = 6.0221415E26; + //doublereal B_Debye = 3.28640E9; + const doublereal Na = 6.0221415E26; - double epsilon = epsilon0 * epsRelWater; - double dw = density_IAPWS(T, P); - double tmp = sqrt( 2.0 * Na * dw / 1000.); - double tmp2 = e * e * Na / (epsilon * R * T); - double tmp3 = tmp2 * sqrt(tmp2); - double A_Debye = tmp * tmp3 / (8.0 * Pi); + doublereal epsilon = epsilon0 * epsRelWater; + doublereal dw = density_IAPWS(T, P); + doublereal tmp = sqrt( 2.0 * Na * dw / 1000.); + doublereal tmp2 = e * e * Na / (epsilon * R * T); + doublereal tmp3 = tmp2 * sqrt(tmp2); + doublereal A_Debye = tmp * tmp3 / (8.0 * Pi); /* @@ -350,20 +350,20 @@ namespace Cantera { * dAdT = - 3/2 Ad/T - 1/2 Ad/Vw d(Vw)/dT - 3/2 Ad/eps d(eps)/dT */ if (ifunc == 1 || ifunc == 2) { - double dAdT = - 1.5 * A_Debye / T; + doublereal dAdT = - 1.5 * A_Debye / T; - double depsRelWaterdT = relEpsilon(T, P, 1); + doublereal depsRelWaterdT = relEpsilon(T, P, 1); dAdT -= A_Debye * (1.5 * depsRelWaterdT / epsRelWater); //int methodD = 1; - //double ddwdT = density_T_new(T, P, 1); - // double contrib1 = A_Debye * (0.5 * ddwdT / dw); + //doublereal ddwdT = density_T_new(T, P, 1); + // doublereal contrib1 = A_Debye * (0.5 * ddwdT / dw); /* * calculate d(lnV)/dT _constantP, i.e., the cte */ - double cte = coeffThermalExp_IAPWS(T, P); - double contrib2 = - A_Debye * (0.5 * cte); + doublereal cte = coeffThermalExp_IAPWS(T, P); + doublereal contrib2 = - A_Debye * (0.5 * cte); //dAdT += A_Debye * (0.5 * ddwdT / dw); dAdT += contrib2; @@ -383,14 +383,14 @@ namespace Cantera { * -> we will take each of the terms in dAdT and differentiate * it again. */ - double d2AdT2 = 1.5 / T * (A_Debye/T - dAdT); + doublereal d2AdT2 = 1.5 / T * (A_Debye/T - dAdT); - double d2epsRelWaterdT2 = relEpsilon(T, P, 2); + doublereal d2epsRelWaterdT2 = relEpsilon(T, P, 2); - //double dT = -0.01; - //double TT = T + dT; - //double depsRelWaterdTdel = relEpsilon(TT, P, 1); - //double d2alt = (depsRelWaterdTdel- depsRelWaterdT ) / dT; + //doublereal dT = -0.01; + //doublereal TT = T + dT; + //doublereal depsRelWaterdTdel = relEpsilon(TT, P, 1); + //doublereal d2alt = (depsRelWaterdTdel- depsRelWaterdT ) / dT; //printf("diff %g %g\n",d2epsRelWaterdT2, d2alt); // HKM -> checks out, i.e., they are the same. @@ -398,15 +398,15 @@ namespace Cantera { - A_Debye / epsRelWater * (d2epsRelWaterdT2 - depsRelWaterdT * depsRelWaterdT / epsRelWater)); - double deltaT = -0.1; - double Tdel = T + deltaT; - double cte_del = coeffThermalExp_IAPWS(Tdel, P); - double dctedT = (cte_del - cte) / Tdel; + doublereal deltaT = -0.1; + doublereal Tdel = T + deltaT; + doublereal cte_del = coeffThermalExp_IAPWS(Tdel, P); + doublereal dctedT = (cte_del - cte) / Tdel; - //double d2dwdT2 = density_T_new(T, P, 2); + //doublereal d2dwdT2 = density_T_new(T, P, 2); - double contrib3 = 0.5 * ( -(dAdT * cte) -(A_Debye * dctedT)); + doublereal contrib3 = 0.5 * ( -(dAdT * cte) -(A_Debye * dctedT)); d2AdT2 += contrib3; return d2AdT2; @@ -426,14 +426,14 @@ namespace Cantera { */ if (ifunc == 3) { - double dAdP = 0.0; + doublereal dAdP = 0.0; - double depsRelWaterdP = relEpsilon(T, P, 3); + doublereal depsRelWaterdP = relEpsilon(T, P, 3); dAdP -= A_Debye * (1.5 * depsRelWaterdP / epsRelWater); - double kappa = isothermalCompressibility_IAPWS(T,P); + doublereal kappa = isothermalCompressibility_IAPWS(T,P); - //double ddwdP = density_T_new(T, P, 3); + //doublereal ddwdP = density_T_new(T, P, 3); dAdP += A_Debye * (0.5 * kappa); return dAdP; @@ -442,8 +442,8 @@ namespace Cantera { return A_Debye; } - double WaterProps::satPressure(double T) { - double pres = m_waterIAPWS->psat(T); + doublereal WaterProps::satPressure(doublereal T) { + doublereal pres = m_waterIAPWS->psat(T); return pres; } @@ -455,8 +455,8 @@ namespace Cantera { * @param T Temperature (kelvin) * @param P pressure (pascal) */ - double WaterProps::density_IAPWS(double temp, double press) { - double dens = m_waterIAPWS->density(temp, press, WATER_LIQUID); + doublereal WaterProps::density_IAPWS(doublereal temp, doublereal press) { + doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID); return dens; } @@ -465,28 +465,28 @@ namespace Cantera { * This function uses the internal state of the * underlying water object */ - double WaterProps::density_IAPWS() const { - double dens = m_waterIAPWS->density(); + doublereal WaterProps::density_IAPWS() const { + doublereal dens = m_waterIAPWS->density(); return dens; } - double WaterProps::coeffThermalExp_IAPWS(double temp, double press) { - double dens = m_waterIAPWS->density(temp, press, WATER_LIQUID); + doublereal WaterProps::coeffThermalExp_IAPWS(doublereal temp, doublereal press) { + doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID); if (dens < 0.0) { throw CanteraError("WaterProps::coeffThermalExp_IAPWS", "Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press)); } - double cte = m_waterIAPWS->coeffThermExp(); + doublereal cte = m_waterIAPWS->coeffThermExp(); return cte; } - double WaterProps::isothermalCompressibility_IAPWS(double temp, double press) { - double dens = m_waterIAPWS->density(temp, press, WATER_LIQUID); + doublereal WaterProps::isothermalCompressibility_IAPWS(doublereal temp, doublereal press) { + doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID); if (dens < 0.0) { throw CanteraError("WaterProps::isothermalCompressibility_IAPWS", "Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press)); } - double kappa = m_waterIAPWS->isothermalCompressibility(); + doublereal kappa = m_waterIAPWS->isothermalCompressibility(); return kappa; } @@ -497,12 +497,12 @@ namespace Cantera { // Parameters for the viscosityWater() function //@{ - const double H[4] = {1., + const doublereal H[4] = {1., 0.978197, 0.579829, -0.202354}; //! parameter - const double Hij[6][7] = + const doublereal Hij[6][7] = { { 0.5132047, 0.2151778, -0.2818107, 0.1778064, -0.04176610, 0., 0.}, { 0.3205656, 0.7317883, -1.070786 , 0.4605040, 0., -0.01578386, 0.}, @@ -511,10 +511,10 @@ namespace Cantera { {-0.7782567, 0.0 , 0., 0. , 0., 0., 0.}, { 0.1885447, 0.0 , 0., 0. , 0., 0., 0.}, }; - const double TStar = 647.27; // Kelvin - const double rhoStar = 317.763; // kg / m3 - const double presStar = 22.115E6; // Pa - const double muStar = 55.071E-6; //Pa s + const doublereal TStar = 647.27; // Kelvin + const doublereal rhoStar = 317.763; // kg / m3 + const doublereal presStar = 22.115E6; // Pa + const doublereal muStar = 55.071E-6; //Pa s //@} // Returns the viscosity of water at the current conditions @@ -533,66 +533,66 @@ namespace Cantera { * for steam and for water, even near the critical point. * Pressures above 500 MPa and temperature above 900 C are suspect. */ - double WaterProps::viscosityWater() const { + doublereal WaterProps::viscosityWater() const { - double temp = m_waterIAPWS->temperature(); - double dens = m_waterIAPWS->density(); + doublereal temp = m_waterIAPWS->temperature(); + doublereal dens = m_waterIAPWS->density(); //WaterPropsIAPWS *waterP = new WaterPropsIAPWS(); //m_waterIAPWS->setState_TR(temp, dens); - //double pressure = m_waterIAPWS->pressure(); + //doublereal pressure = m_waterIAPWS->pressure(); //printf("pressure = %g\n", pressure); //dens = 18.02 * pressure / (GasConstant * temp); //printf ("mod dens = %g\n", dens); - double rhobar = dens/rhoStar; - double tbar = temp / TStar; - // double pbar = pressure / presStar; + doublereal rhobar = dens/rhoStar; + doublereal tbar = temp / TStar; + // doublereal pbar = pressure / presStar; - double tbar2 = tbar * tbar; - double tbar3 = tbar2 * tbar; + doublereal tbar2 = tbar * tbar; + doublereal tbar3 = tbar2 * tbar; - double mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3); + doublereal mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3); //printf("mu0bar = %g\n", mu0bar); //printf("mu0 = %g\n", mu0bar * muStar); - double tfac1 = 1.0 / tbar - 1.0; - double tfac2 = tfac1 * tfac1; - double tfac3 = tfac2 * tfac1; - double tfac4 = tfac3 * tfac1; - double tfac5 = tfac4 * tfac1; + doublereal tfac1 = 1.0 / tbar - 1.0; + doublereal tfac2 = tfac1 * tfac1; + doublereal tfac3 = tfac2 * tfac1; + doublereal tfac4 = tfac3 * tfac1; + doublereal tfac5 = tfac4 * tfac1; - double rfac1 = rhobar - 1.0; - double rfac2 = rfac1 * rfac1; - double rfac3 = rfac2 * rfac1; - double rfac4 = rfac3 * rfac1; - double rfac5 = rfac4 * rfac1; - double rfac6 = rfac5 * rfac1; + doublereal rfac1 = rhobar - 1.0; + doublereal rfac2 = rfac1 * rfac1; + doublereal rfac3 = rfac2 * rfac1; + doublereal rfac4 = rfac3 * rfac1; + doublereal rfac5 = rfac4 * rfac1; + doublereal rfac6 = rfac5 * rfac1; - double sum = (Hij[0][0] + Hij[1][0]*tfac1 + Hij[4][0]*tfac4 + Hij[5][0]*tfac5 + + doublereal sum = (Hij[0][0] + Hij[1][0]*tfac1 + Hij[4][0]*tfac4 + Hij[5][0]*tfac5 + Hij[0][1]*rfac1 + Hij[1][1]*tfac1*rfac1 + Hij[2][1]*tfac2*rfac1 + Hij[3][1]*tfac3*rfac1 + Hij[0][2]*rfac2 + Hij[1][2]*tfac1*rfac2 + Hij[2][2]*tfac2*rfac2 + Hij[0][3]*rfac3 + Hij[1][3]*tfac1*rfac3 + Hij[2][3]*tfac2*rfac3 + Hij[3][3]*tfac3*rfac3 + Hij[0][4]*rfac4 + Hij[3][4]*tfac3*rfac4 + Hij[1][5]*tfac1*rfac5 + Hij[3][6]*tfac3*rfac6 ); - double mu1bar = std::exp(rhobar * sum); + doublereal mu1bar = std::exp(rhobar * sum); // Apply the near-critical point corrections if necessary - double mu2bar = 1.0; + doublereal mu2bar = 1.0; if ((tbar >= 0.9970) && tbar <= 1.0082) { if ((rhobar >= 0.755) && (rhobar <= 1.290)) { - double drhodp = 1.0 / m_waterIAPWS->dpdrho(); + doublereal drhodp = 1.0 / m_waterIAPWS->dpdrho(); drhodp *= presStar / rhoStar; - double xsi = rhobar * drhodp; + doublereal xsi = rhobar * drhodp; if (xsi >= 21.93) { mu2bar = 0.922 * std::pow(xsi, 0.0263); } } } - double mubar = mu0bar * mu1bar * mu2bar; + doublereal mubar = mu0bar * mu1bar * mu2bar; return mubar * muStar; } @@ -612,19 +612,19 @@ namespace Cantera { * for steam and for water, even near the critical point. * Pressures above 500 MPa and temperature above 900 C are suspect. */ - double WaterProps::thermalConductivityWater() const { - static const double Tstar = 647.27; - static const double rhostar = 317.763; - static const double lambdastar = 0.4945; - static const double presstar = 22.115E6; - static const double L[4] = + doublereal WaterProps::thermalConductivityWater() const { + static const doublereal Tstar = 647.27; + static const doublereal rhostar = 317.763; + static const doublereal lambdastar = 0.4945; + static const doublereal presstar = 22.115E6; + static const doublereal L[4] = { 1.0000, 6.978267, 2.599096, -0.998254 }; - static const double Lji[6][5] = + static const doublereal Lji[6][5] = { { 1.3293046, 1.7018363, 5.2246158, 8.7127675, -1.8525999}, {-0.40452437, -2.2156845, -10.124111, -9.5000611, 0.93404690}, @@ -634,41 +634,41 @@ namespace Cantera { { 0.044809953, -0.11203160, 0.13333849, 0.0, 0.0}, }; - double temp = m_waterIAPWS->temperature(); - double dens = m_waterIAPWS->density(); + doublereal temp = m_waterIAPWS->temperature(); + doublereal dens = m_waterIAPWS->density(); - double rhobar = dens/rhostar; - double tbar = temp / Tstar; - double tbar2 = tbar * tbar; - double tbar3 = tbar2 * tbar; - double lambda0bar = sqrt(tbar) / (L[0] + L[1]/tbar + L[2]/tbar2 + L[3]/tbar3); + doublereal rhobar = dens/rhostar; + doublereal tbar = temp / Tstar; + doublereal tbar2 = tbar * tbar; + doublereal tbar3 = tbar2 * tbar; + doublereal lambda0bar = sqrt(tbar) / (L[0] + L[1]/tbar + L[2]/tbar2 + L[3]/tbar3); - //double lambdagas = lambda0bar * lambdastar * 1.0E3; + //doublereal lambdagas = lambda0bar * lambdastar * 1.0E3; - double tfac1 = 1.0 / tbar - 1.0; - double tfac2 = tfac1 * tfac1; - double tfac3 = tfac2 * tfac1; - double tfac4 = tfac3 * tfac1; + doublereal tfac1 = 1.0 / tbar - 1.0; + doublereal tfac2 = tfac1 * tfac1; + doublereal tfac3 = tfac2 * tfac1; + doublereal tfac4 = tfac3 * tfac1; - double rfac1 = rhobar - 1.0; - double rfac2 = rfac1 * rfac1; - double rfac3 = rfac2 * rfac1; - double rfac4 = rfac3 * rfac1; - double rfac5 = rfac4 * rfac1; + doublereal rfac1 = rhobar - 1.0; + doublereal rfac2 = rfac1 * rfac1; + doublereal rfac3 = rfac2 * rfac1; + doublereal rfac4 = rfac3 * rfac1; + doublereal rfac5 = rfac4 * rfac1; - double sum = (Lji[0][0] + Lji[0][1]*tfac1 + Lji[0][2]*tfac2 + Lji[0][3]*tfac3 + Lji[0][4]*tfac4 + + doublereal sum = (Lji[0][0] + Lji[0][1]*tfac1 + Lji[0][2]*tfac2 + Lji[0][3]*tfac3 + Lji[0][4]*tfac4 + Lji[1][0]*rfac1 + Lji[1][1]*tfac1*rfac1 + Lji[1][2]*tfac2*rfac1 + Lji[1][3]*tfac3*rfac1 + Lji[1][4]*tfac4*rfac1 + Lji[2][0]*rfac2 + Lji[2][1]*tfac1*rfac2 + Lji[2][2]*tfac2*rfac2 + Lji[2][3]*tfac3*rfac2 + Lji[3][0]*rfac3 + Lji[3][1]*tfac1*rfac3 + Lji[3][2]*tfac2*rfac3 + Lji[3][3]*tfac3*rfac3 + Lji[4][0]*rfac4 + Lji[4][1]*tfac1*rfac4 + Lji[4][2]*tfac2*rfac4 + Lji[5][0]*rfac5 + Lji[5][1]*tfac1*rfac5 + Lji[5][2]*tfac2*rfac5 ); - double lambda1bar = exp(rhobar * sum); + doublereal lambda1bar = exp(rhobar * sum); - double mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3); + doublereal mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3); - double tfac5 = tfac4 * tfac1; - double rfac6 = rfac5 * rfac1; + doublereal tfac5 = tfac4 * tfac1; + doublereal rfac6 = rfac5 * rfac1; sum = (Hij[0][0] + Hij[1][0]*tfac1 + Hij[4][0]*tfac4 + Hij[5][0]*tfac5 + Hij[0][1]*rfac1 + Hij[1][1]*tfac1*rfac1 + Hij[2][1]*tfac2*rfac1 + Hij[3][1]*tfac3*rfac1 + @@ -677,17 +677,17 @@ namespace Cantera { Hij[0][4]*rfac4 + Hij[3][4]*tfac3*rfac4 + Hij[1][5]*tfac1*rfac5 + Hij[3][6]*tfac3*rfac6 ); - double mu1bar = std::exp(rhobar * sum); + doublereal mu1bar = std::exp(rhobar * sum); - double t2r2 = tbar * tbar / (rhobar * rhobar); - double drhodp = 1.0 / m_waterIAPWS->dpdrho(); + doublereal t2r2 = tbar * tbar / (rhobar * rhobar); + doublereal drhodp = 1.0 / m_waterIAPWS->dpdrho(); drhodp *= presStar / rhoStar; - double xsi = rhobar * drhodp; - double xsipow = std::pow(xsi, 0.4678); - double rho1 = rhobar - 1.; - double rho2 = rho1 * rho1; - double rho4 = rho2 * rho2; - double temp2 = (tbar - 1.0) * (tbar - 1.0); + doublereal xsi = rhobar * drhodp; + doublereal xsipow = std::pow(xsi, 0.4678); + doublereal rho1 = rhobar - 1.; + doublereal rho2 = rho1 * rho1; + doublereal rho4 = rho2 * rho2; + doublereal temp2 = (tbar - 1.0) * (tbar - 1.0); /* * beta = M / (rho * Rgas) (d (pressure) / dT) at constant rho @@ -697,15 +697,15 @@ namespace Cantera { * beta = delta (phi0_d() + phiR_d()) * - tau delta (phi0_dt() + phiR_dt()) */ - double beta = m_waterIAPWS->coeffPresExp(); + doublereal beta = m_waterIAPWS->coeffPresExp(); - double dpdT_const_rho = beta * GasConstant * dens / 18.015268; + doublereal dpdT_const_rho = beta * GasConstant * dens / 18.015268; dpdT_const_rho *= Tstar / presstar; - double 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); - double lambda = ( lambda0bar * lambda1bar + lambda2bar) * lambdastar; + doublereal lambda = ( lambda0bar * lambda1bar + lambda2bar) * lambdastar; return lambda; } diff --git a/Cantera/src/thermo/WaterProps.h b/Cantera/src/thermo/WaterProps.h index a738e20de..1f88ef781 100644 --- a/Cantera/src/thermo/WaterProps.h +++ b/Cantera/src/thermo/WaterProps.h @@ -146,6 +146,7 @@ namespace Cantera { //! Simple calculation of water density at atmospheric pressure. //! Valid up to boiling point. /*! + * static function. * This formulation has no dependence on the pressure and shouldn't * be used where accuracy is needed. * diff --git a/Cantera/src/thermo/WaterPropsIAPWSphi.h b/Cantera/src/thermo/WaterPropsIAPWSphi.h index cbd905d21..bb105dd81 100644 --- a/Cantera/src/thermo/WaterPropsIAPWSphi.h +++ b/Cantera/src/thermo/WaterPropsIAPWSphi.h @@ -59,7 +59,7 @@ public: * @param tau Dimensionless temperature = T_c/T * @param delta Dimensionless density = delta = rho / Rho_c */ - double phi_dd(doublereal tau, doublereal delta); + doublereal phi_dd(doublereal tau, doublereal delta); //! First derivative of phi wrt tau /*!