Remove unnecessary numerical constants

This commit is contained in:
Ray Speth 2015-01-15 21:15:07 +00:00
parent a9754874dc
commit ad1cd8c7bb
9 changed files with 16 additions and 30 deletions

View file

@ -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.

View file

@ -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;

View file

@ -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) {

View file

@ -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

View file

@ -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];
}

View file

@ -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);
}
}

View file

@ -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

View file

@ -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;
}

View file

@ -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);
}
}