diff --git a/include/cantera/base/ct_defs.h b/include/cantera/base/ct_defs.h index 5b630ce5b..b83c2672c 100644 --- a/include/cantera/base/ct_defs.h +++ b/include/cantera/base/ct_defs.h @@ -49,8 +49,6 @@ namespace Cantera //! Pi const doublereal Pi = 3.14159265358979323846; -//! sqrt(Pi) -const doublereal SqrtPi = std::sqrt(Pi); /*! * @name Variations of the Gas Constant @@ -124,17 +122,6 @@ const int VT = -100, PH = -101, PS = -102, VP = -103, PT = -104, HT = -110, HS = -111, XP = -112, XT = -113; //@} -//! 1/3 -const doublereal OneThird = 1.0/3.0; -//! 5/16 -const doublereal FiveSixteenths = 5.0/16.0; -//! sqrt(10) -const doublereal SqrtTen = std::sqrt(10.0); -//! sqrt(8) -const doublereal SqrtEight = std::sqrt(8.0); -//! sqrt(2) -const doublereal SqrtTwo = std::sqrt(2.0); - //! smallest number to compare to zero. const doublereal SmallNumber = 1.e-300; //! largest number to compare to inf. diff --git a/include/cantera/thermo/NasaPoly1.h b/include/cantera/thermo/NasaPoly1.h index 849c7381e..01b06dec5 100644 --- a/include/cantera/thermo/NasaPoly1.h +++ b/include/cantera/thermo/NasaPoly1.h @@ -138,9 +138,9 @@ public: doublereal cp, h, s; cp = ct0 + ct1 + ct2 + ct3 + ct4; - h = ct0 + 0.5*ct1 + OneThird*ct2 + 0.25*ct3 + 0.2*ct4 + h = ct0 + 0.5*ct1 + 1.0/3.0*ct2 + 0.25*ct3 + 0.2*ct4 + m_coeff[0]*tt[4]; // last term is a5/T - s = ct0*tt[5] + ct1 + 0.5*ct2 + OneThird*ct3 + s = ct0*tt[5] + ct1 + 0.5*ct2 + 1.0/3.0*ct3 +0.25*ct4 + m_coeff[1]; // last term is a6 // return the computed properties in the location in the output @@ -199,7 +199,7 @@ public: doublereal ct3 = m_coeff[5]*tt[2]; // a3 * T^3 doublereal ct4 = m_coeff[6]*tt[3]; // a4 * T^4 - double h_RT = ct0 + 0.5*ct1 + OneThird*ct2 + 0.25*ct3 + 0.2*ct4 + double h_RT = ct0 + 0.5*ct1 + 1.0/3.0*ct2 + 0.25*ct3 + 0.2*ct4 + m_coeff[0]*tt[4]; // last t double h = h_RT * GasConstant * temp; diff --git a/include/cantera/thermo/ShomatePoly.h b/include/cantera/thermo/ShomatePoly.h index a0933a94e..7b599ac77 100644 --- a/include/cantera/thermo/ShomatePoly.h +++ b/include/cantera/thermo/ShomatePoly.h @@ -166,8 +166,8 @@ public: doublereal cp, h, s; cp = A + Bt + Ct2 + Dt3 + Etm2; - h = tt[0]*(A + 0.5*Bt + OneThird*Ct2 + 0.25*Dt3 - Etm2) + F; - s = A*tt[4] + Bt + 0.5*Ct2 + OneThird*Dt3 - 0.5*Etm2 + G; + h = tt[0]*(A + 0.5*Bt + 1.0/3.0*Ct2 + 0.25*Dt3 - Etm2) + F; + s = A*tt[4] + Bt + 0.5*Ct2 + 1.0/3.0*Dt3 - 0.5*Etm2 + G; /* * Shomate polynomials parameterizes assuming units of @@ -228,7 +228,7 @@ public: doublereal Etm2 = m_coeff[4]*tPoly[3]; doublereal F = m_coeff[5]; - doublereal h = tPoly[0]*(A + 0.5*Bt + OneThird*Ct2 + 0.25*Dt3 - Etm2) + F; + doublereal h = tPoly[0]*(A + 0.5*Bt + 1.0/3.0*Ct2 + 0.25*Dt3 - Etm2) + F; double hh = 1.e6 * h; if (h298) { diff --git a/src/thermo/Nasa9Poly1.cpp b/src/thermo/Nasa9Poly1.cpp index b5be4f870..640609691 100644 --- a/src/thermo/Nasa9Poly1.cpp +++ b/src/thermo/Nasa9Poly1.cpp @@ -81,10 +81,10 @@ void Nasa9Poly1::updateProperties(const doublereal* tt, doublereal cpdivR = ct0 + ct1 + ct2 + ct3 + ct4 + ct5 + ct6; - doublereal hdivRT = -ct0 + tt[6]*ct1 + ct2 + 0.5*ct3 + OneThird*ct4 + doublereal hdivRT = -ct0 + tt[6]*ct1 + ct2 + 0.5*ct3 + 1.0/3.0*ct4 + 0.25*ct5 + 0.2*ct6 + m_coeff[7] * tt[4]; doublereal sdivR = -0.5*ct0 - ct1 + tt[6]*ct2 + ct3 + 0.5*ct4 - + OneThird*ct5 + 0.25*ct6 + m_coeff[8]; + + 1.0/3.0*ct5 + 0.25*ct6 + m_coeff[8]; // return the computed properties in the location in the output // arrays for this species diff --git a/src/thermo/NasaThermo.cpp b/src/thermo/NasaThermo.cpp index e06a5bc0f..bab3ac1f3 100644 --- a/src/thermo/NasaThermo.cpp +++ b/src/thermo/NasaThermo.cpp @@ -266,14 +266,14 @@ doublereal NasaThermo::cp_R(double t, const doublereal* c) } doublereal NasaThermo::enthalpy_RT(double t, const doublereal* c) { - return c[2] + 0.5*c[3]*t + OneThird*c[4]*t*t + return c[2] + 0.5*c[3]*t + 1.0/3.0*c[4]*t*t + 0.25*c[5]*t*t*t + 0.2*c[6]*t*t*t*t + c[0]/t; } doublereal NasaThermo::entropy_R(double t, const doublereal* c) { return c[2]*log(t) + c[3]*t + 0.5*c[4]*t*t - + OneThird*c[5]*t*t*t + 0.25*c[6]*t*t*t*t + + 1.0/3.0*c[5]*t*t*t + 0.25*c[6]*t*t*t*t + c[1]; } diff --git a/src/transport/AqueousTransport.cpp b/src/transport/AqueousTransport.cpp index bcaee8373..753a817c1 100644 --- a/src/transport/AqueousTransport.cpp +++ b/src/transport/AqueousTransport.cpp @@ -424,7 +424,7 @@ void AqueousTransport::updateViscosity_T() // m_wratjk(j,k)! factor1 = 1.0 + (m_sqvisc[k]/m_sqvisc[j]) * m_wratjk(k,j); m_phi(k,j) = factor1*factor1 / - (SqrtEight * m_wratkj1(j,k)); + (sqrt(8.0) * m_wratkj1(j,k)); m_phi(j,k) = m_phi(k,j)/(vratiokj * wratiojk); } } diff --git a/src/transport/GasTransport.cpp b/src/transport/GasTransport.cpp index ec85b7035..b9e879dc9 100644 --- a/src/transport/GasTransport.cpp +++ b/src/transport/GasTransport.cpp @@ -190,7 +190,7 @@ void GasTransport::updateViscosity_T() // Note that m_wratjk(k,j) holds the square root of m_wratjk(j,k)! factor1 = 1.0 + (m_sqvisc[k]/m_sqvisc[j]) * m_wratjk(k,j); - m_phi(k,j) = factor1*factor1 / (SqrtEight * m_wratkj1(j,k)); + m_phi(k,j) = factor1*factor1 / (sqrt(8.0) * m_wratkj1(j,k)); m_phi(j,k) = m_phi(k,j)/(vratiokj * wratiojk); } } @@ -650,8 +650,7 @@ void GasTransport::fitProperties(MMCollisionInt& integrals) (Pi * m_sigma[k] * m_sigma[k] * om11); // viscosity - visc = FiveSixteenths - * sqrt(Pi * mw[k] * Boltzmann * t / Avogadro) / + visc = 5.0/16.0 * sqrt(Pi * mw[k] * Boltzmann * t / Avogadro) / (om22 * Pi * m_sigma[k]*m_sigma[k]); // thermal conductivity diff --git a/src/transport/MultiTransport.cpp b/src/transport/MultiTransport.cpp index bc3ce97c9..259072b24 100644 --- a/src/transport/MultiTransport.cpp +++ b/src/transport/MultiTransport.cpp @@ -26,9 +26,9 @@ namespace Cantera */ inline doublereal Frot(doublereal tr, doublereal sqtr) { - const doublereal c1 = 0.5*SqrtPi*Pi; + const doublereal c1 = 0.5*sqrt(Pi)*Pi; const doublereal c2 = 0.25*Pi*Pi + 2.0; - const doublereal c3 = SqrtPi*Pi; + const doublereal c3 = sqrt(Pi)*Pi; return 1.0 + c1*sqtr + c2*tr + c3*sqtr*tr; } diff --git a/src/transport/PecosTransport.cpp b/src/transport/PecosTransport.cpp index c6ba1777e..a4eca6c0e 100755 --- a/src/transport/PecosTransport.cpp +++ b/src/transport/PecosTransport.cpp @@ -537,7 +537,7 @@ void PecosTransport::updateViscosity_T() // m_wratjk(j,k)! factor1 = 1.0 + (m_sqvisc[k]/m_sqvisc[j]) * m_wratjk(k,j); m_phi(k,j) = factor1*factor1 / - (SqrtEight * m_wratkj1(j,k)); + (sqrt(8.0) * m_wratkj1(j,k)); m_phi(j,k) = m_phi(k,j)/(vratiokj * wratiojk); } }