Commit e772987a authored by Tim Jupe's avatar Tim Jupe
Browse files

[cleanup] replace std::pow(Scalar,int) with Dune::power(Scalar,int)

parent 8b88f180
......@@ -177,6 +177,7 @@ static Scalar nusseltNumberForced(const Scalar reynoldsNumber,
*/
using std::sqrt;
using std::pow;
using Dune::power;
Scalar numerator = 0.037 * pow(reynoldsNumber,0.8) * prandtlNumber ;
Scalar reToMin01 = pow(reynoldsNumber,-0.1);
Scalar prTo23 = pow(prandtlNumber, (2./3. ) ) ; // MIND THE pts! :-( otherwise the integer exponent version is chosen
......@@ -184,7 +185,7 @@ static Scalar nusseltNumberForced(const Scalar reynoldsNumber,
Scalar nusseltTurbular = numerator / denominator;
Scalar nusseltLaminar = 0.664 * sqrt(reynoldsNumber) * pow(prandtlNumber, (1./3.) );
Scalar nusseltSingleSphere = 2 + sqrt( pow(nusseltLaminar,2.) + pow(nusseltTurbular,2.));
Scalar nusseltSingleSphere = 2 + sqrt( power(nusseltLaminar,2) + power(nusseltTurbular,2));
Scalar funckyFactor = 1 + 1.5 * (1.-porosity); // for spheres of same size
Scalar nusseltNumber = funckyFactor * nusseltSingleSphere ;
......
......@@ -164,14 +164,15 @@ public:
Scalar fW() const
{
using std::pow;
return g() * pow(1.0 + pow(cw3(), 6.0) / (pow(g(), 6.0) + pow(cw3(), 6.0)), 1.0/6.0);
using Dune::power;
return g() * pow(1.0 + power(cw3(), 6) / (power(g(), 6) + power(cw3(), 6)), 1.0/6.0);
}
//! \brief Returns a model function
Scalar g() const
{
using std::pow;
return r() + cw2() * (pow(r(), 6.0) - r());
using Dune::power;
return r() + cw2() * (power(r(), 6) - r());
}
//! \brief Returns a model function
......
......@@ -190,7 +190,6 @@ public:
const Scalar fMu() const
{
using std::exp;
using std::pow;
return 1.0 - exp(-0.0115 * RANSParentType::yPlus());
}
......
......@@ -169,8 +169,8 @@ public:
using std::abs;
using std::exp;
using std::min;
using std::pow;
using std::sqrt;
using Dune::power;
const Scalar aPlus = 26.0;
const Scalar k = 0.0168;
const Scalar cCP = 1.6;
......@@ -227,7 +227,7 @@ public:
Scalar yFMax = storedYFMax[wallElementIdx];
Scalar fMax = storedFMax[wallElementIdx];
Scalar fWake = min(yFMax * fMax, cWake * yFMax * deltaU * deltaU / fMax);
Scalar fKleb = 1.0 / (1.0 + 5.5 * pow(cKleb * wallDistance / yFMax, 6.0));
Scalar fKleb = 1.0 / (1.0 + 5.5 * power(cKleb * wallDistance / yFMax, 6));
kinematicEddyViscosityOuter[elementIdx] = k * cCP * fWake * fKleb;
kinematicEddyViscosityDifference[elementIdx]
......
......@@ -159,6 +159,7 @@ public:
// make the grid
std::array<std::vector<Scalar>, dim> globalPositions;
using std::pow;
using Dune::power;
for (int dimIdx = 0; dimIdx < dim; dimIdx++)
{
// Each grid direction is subdivided into (numCells + 1) points
......@@ -213,13 +214,13 @@ public:
// if grading factor is not 1.0, do power law spacing
else
{
height = (1.0 - gradingFactor) / (1.0 - pow(gradingFactor, numCells));
height = (1.0 - gradingFactor) / (1.0 - power(gradingFactor, numCells));
if (verbose)
{
std::cout << " -> grading_eff " << gradingFactor
<< " h_min " << height * pow(gradingFactor, 0) * length
<< " h_max " << height * pow(gradingFactor, numCells-1) * length
<< " h_min " << height * power(gradingFactor, 0) * length
<< " h_max " << height * power(gradingFactor, numCells-1) * length
<< std::endl;
}
}
......@@ -232,10 +233,10 @@ public:
if (useGrading)
{
if (increasingCellSize)
hI *= pow(gradingFactor, i-1);
hI *= power(gradingFactor, i-1);
else
hI *= pow(gradingFactor, numCells-i);
hI *= power(gradingFactor, numCells-i);
}
localPositions[i] = localPositions[i-1] + hI;
}
......
......@@ -322,6 +322,7 @@ private:
{
std::array<std::vector<ctype>, dim> globalPositions;
using std::pow;
using Dune::power;
for (int dimIdx = 0; dimIdx < dim; dimIdx++)
{
for (int zoneIdx = 0; zoneIdx < cells[dimIdx].size(); ++zoneIdx)
......@@ -372,13 +373,13 @@ private:
// if grading factor is not 1.0, do power law spacing
else
{
height = (1.0 - gradingFactor) / (1.0 - pow(gradingFactor, numCells));
height = (1.0 - gradingFactor) / (1.0 - power(gradingFactor, numCells));
if (verbose)
{
std::cout << " -> grading_eff " << gradingFactor
<< " h_min " << height * pow(gradingFactor, 0) * length
<< " h_max " << height * pow(gradingFactor, numCells-1) * length
<< " h_min " << height * power(gradingFactor, 0) * length
<< " h_max " << height * power(gradingFactor, numCells-1) * length
<< std::endl;
}
}
......@@ -392,11 +393,11 @@ private:
{
if (increasingCellSize)
{
hI *= pow(gradingFactor, i);
hI *= power(gradingFactor, i);
}
else
{
hI *= pow(gradingFactor, numCells-i-1);
hI *= power(gradingFactor, numCells-i-1);
}
}
localPositions.push_back(localPositions[i] + hI);
......
......@@ -71,6 +71,7 @@ public:
using std::pow;
using std::sqrt;
using std::exp;
using Dune::power;
const Scalar M_m = 1e3*Mesitylene::molarMass(); // [g/mol] molecular weight of mesitylene
const Scalar M_a = 1e3*Air::molarMass(); // [g/mol] molecular weight of air
const Scalar Tb_m = 437.9; // [K] boiling temperature of mesitylene
......@@ -92,7 +93,7 @@ public:
const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_a + 1.0/M_m);
const Scalar Mr = (M_a + M_m)/(M_a*M_m);
const Scalar D_am = (B_*sqrt(temperature*temperature*temperature*Mr))
/(1e-5*pressure*pow(sigma_am, 2) * Omega); // [cm^2/s]
/(1e-5*pressure*power(sigma_am, 2) * Omega); // [cm^2/s]
return 1e-4*D_am; // [m^2/s]
}
......
......@@ -69,6 +69,7 @@ public:
pressure = min(pressure, 1e8); // regularization
using std::pow;
using Dune::power;
using std::sqrt;
using std::exp;
const Scalar M_x = 1e3*Xylene::molarMass(); // [g/mol] molecular weight of xylene
......@@ -90,7 +91,7 @@ public:
const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_a + 1.0/M_x);
const Scalar Mr = (M_a + M_x)/(M_a*M_x);
const Scalar D_ax = (B_*pow(temperature,1.5)*sqrt(Mr))
/(1e-5*pressure*pow(sigma_ax, 2.0)*Omega); // [cm^2/s]
/(1e-5*pressure*power(sigma_ax, 2)*Omega); // [cm^2/s]
return D_ax*1e-4; // [m^2/s]
}
......
......@@ -433,8 +433,8 @@ public:
const Scalar phiCO2 = fugacityCoeffCO2_(temperature, pgCO2, rhoCO2);
using std::log;
using std::pow;
const Scalar exponent = A - log(phiCO2) + 2*B*mol_NaCl + C*pow(mol_NaCl,2);
using Dune::power;
const Scalar exponent = A - log(phiCO2) + 2*B*mol_NaCl + C*power(mol_NaCl,2);
using std::exp;
const Scalar mol_CO2w = pgCO2 / (1e5 * exp(exponent)); /* paper: equation (6) */
......
......@@ -74,6 +74,7 @@ public:
using std::sqrt;
using std::pow;
using Dune::power;
using std::exp;
const Scalar M_m = 1e3*Mesitylene::molarMass(); // [g/mol] molecular weight of mesitylene
const Scalar M_w = 1e3*H2O::molarMass(); // [g/mol] molecular weight of water
......@@ -98,7 +99,7 @@ public:
const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_w + 1.0/M_m);
const Scalar Mr = (M_w + M_m)/(M_w*M_m);
const Scalar D_wm = (B_*pow(temperature, 1.6)*sqrt(Mr))
/(1e-5*pressure*pow(sigma_wm, 2)*Omega); // [cm^2/s]
/(1e-5*pressure*power(sigma_wm, 2)*Omega); // [cm^2/s]
return D_wm*1e-4; // [m^2/s]
}
......
......@@ -78,6 +78,7 @@ public:
using std::sqrt;
using std::exp;
using std::pow;
using Dune::power;
const Scalar M_x = 1e3*Xylene::molarMass(); // [g/mol] molecular weight of xylene
const Scalar M_w = 1e3*H2O::molarMass(); // [g/mol] molecular weight of water
const Scalar Tb_x = 412.9; // [K] boiling temperature of xylene
......@@ -99,7 +100,7 @@ public:
const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_w + 1.0/M_x);
const Scalar Mr = (M_w + M_x)/(M_w*M_x);
const Scalar D_wx = (B_*pow(temperature,1.6)*sqrt(Mr))
/(1e-5*pressure*pow(sigma_wx, 2.0)*Omega); // [cm^2/s]
/(1e-5*pressure*power(sigma_wx, 2)*Omega); // [cm^2/s]
return D_wx*1e-4; // [m^2/s]
}
......
......@@ -244,14 +244,15 @@ public:
const Scalar eta0 = 0.0266958*sqrt(1000.0*molarMass()*temperature)/(sigma*sigma*Omega);
using std::pow;
using Dune::power;
const Scalar tau = criticalTemperature()/temperature;
const Scalar rhoc = 10.4477; // [mol/m^3]
const Scalar delta = 0.001*pressure/(temperature*8.3144598)/rhoc;
const Scalar etaR = 10.72 * pow(tau, 0.2) * delta
+ 1.122 * pow(tau, 0.05) * pow(delta, 4)
+ 0.002019 * pow(tau, 2.4) * pow(delta, 9)
+ 1.122 * pow(tau, 0.05) * power(delta, 4)
+ 0.002019 * pow(tau, 2.4) * power(delta, 9)
- 8.876 * pow(tau, 0.6) * delta * exp(-delta)
- 0.02916 * pow(tau, 3.6) * pow(delta, 8) * exp(-delta);
- 0.02916 * pow(tau, 3.6) * power(delta, 8) * exp(-delta);
return (eta0 + etaR)*1e-6;
}
......@@ -309,19 +310,20 @@ public:
Scalar phi = temperature/100;
using std::pow;
using Dune::power;
Scalar c_p = 0.661738E+01
-0.105885E+01 * phi
+0.201650E+00 * pow(phi,2)
-0.196930E-01 * pow(phi,3)
+0.106460E-02 * pow(phi,4)
-0.303284E-04 * pow(phi,5)
+0.355861E-06 * pow(phi,6);
c_p += -0.549169E+01 * pow(phi,-1)
+0.585171E+01 * pow(phi,-2)
-0.372865E+01 * pow(phi,-3)
+0.133981E+01 * pow(phi,-4)
-0.233758E+00 * pow(phi,-5)
+0.125718E-01 * pow(phi,-6);
+0.201650E+00 * power(phi,2)
-0.196930E-01 * power(phi,3)
+0.106460E-02 * power(phi,4)
-0.303284E-04 * power(phi,5)
+0.355861E-06 * power(phi,6);
c_p += -0.549169E+01 * power(phi,-1)
+0.585171E+01 * power(phi,-2)
-0.372865E+01 * power(phi,-3)
+0.133981E+01 * power(phi,-4)
-0.233758E+00 * power(phi,-5)
+0.125718E-01 * power(phi,-6);
c_p *= IdealGas::R / molarMass(); // in J/(mol*K) / (kg/mol)
return c_p;
......
......@@ -184,11 +184,11 @@ public:
const Scalar m = (1E3/58.44)*(salinity/(1-salinity));
using std::pow;
using Dune::power;
Scalar d_h = 0;
for (int i = 0; i<=3; i++) {
for (int j=0; j<=2; j++) {
d_h = d_h + a[i][j] * pow(theta, i) * pow(m, j);
d_h = d_h + a[i][j] * power(theta, i) * power(m, j);
}
}
......@@ -415,9 +415,10 @@ public:
const Scalar salinity = max(0.0, ThisType::salinity());
using std::pow;
using Dune::power;
using std::exp;
const Scalar T_C = temperature - 273.15;
const Scalar A = (0.42*pow((pow(salinity, 0.8)-0.17), 2) + 0.045)*pow(T_C, 0.8);
const Scalar A = (0.42*power((pow(salinity, 0.8)-0.17), 2) + 0.045)*pow(T_C, 0.8);
const Scalar mu_brine = 0.1 + 0.333*salinity + (1.65+91.9*salinity*salinity*salinity)*exp(-A);
assert(mu_brine > 0.0);
return mu_brine/1000.0;
......
......@@ -366,9 +366,9 @@ public:
/* dmu : excess viscosity at elevated density */
rho = gasDensity(temperature, pressure); /* CO2 mass density [kg/m^3] */
using std::pow;
dmu = d11*rho + d21*rho*rho + d64*pow(rho,6)/(TStar*TStar*TStar)
+ d81*pow(rho,8) + d82*pow(rho,8)/TStar;
using Dune::power;
dmu = d11*rho + d21*rho*rho + d64*power(rho,6)/(TStar*TStar*TStar)
+ d81*power(rho,8) + d82*power(rho,8)/TStar;
visco_CO2 = (mu0 + dmu)/1.0E6; /* conversion to [Pa s] */
......
......@@ -122,8 +122,8 @@ public:
Scalar deltaSpecificGravity = log(refComponentSpecificGravity()/specificGravity());
Scalar deltaMolecularWeight = log(refComponentMolecularWeight()/molecularWeight());
using std::pow;
return A*pow(deltaSpecificGravity,2) + B*deltaSpecificGravity + C*pow(deltaMolecularWeight,2) + D*deltaMolecularWeight
using Dune::power;
return A*power(deltaSpecificGravity,2) + B*deltaSpecificGravity + C*power(deltaMolecularWeight,2) + D*deltaMolecularWeight
+ E*deltaSpecificGravity*deltaMolecularWeight;
}
......@@ -139,8 +139,8 @@ public:
Scalar deltaSpecificGravity = log(refComponentSpecificGravity()/specificGravity());
Scalar deltaMolecularWeight = log(refComponentMolecularWeight()/molecularWeight());
using std::pow;
return A*pow(deltaSpecificGravity,2) + B*deltaSpecificGravity + C*pow(deltaMolecularWeight,2) + D*deltaMolecularWeight
using Dune::power;
return A*power(deltaSpecificGravity,2) + B*deltaSpecificGravity + C*power(deltaMolecularWeight,2) + D*deltaMolecularWeight
+ E*deltaSpecificGravity*deltaMolecularWeight;
}
......@@ -156,8 +156,8 @@ public:
Scalar deltaSpecificGravity = log(refComponentSpecificGravity()/specificGravity());
Scalar deltaMolecularWeight = log(refComponentMolecularWeight()/molecularWeight());
using std::pow;
return A*pow(deltaSpecificGravity,2) + B*deltaSpecificGravity + C*pow(deltaMolecularWeight,2) + D*deltaMolecularWeight
using Dune::power;
return A*power(deltaSpecificGravity,2) + B*deltaSpecificGravity + C*power(deltaMolecularWeight,2) + D*deltaMolecularWeight
+ E*deltaSpecificGravity*deltaMolecularWeight;
}
......@@ -199,8 +199,8 @@ public:
*/
static Scalar boilingTemperature()
{
using std::pow;
return refComponentBoilingTemperature() * pow((1 + 2*perbutationFactorBoilingTemperature())/(1 - 2*perbutationFactorBoilingTemperature()),2);
using Dune::power;
return refComponentBoilingTemperature() * power((1 + 2*perbutationFactorBoilingTemperature())/(1 - 2*perbutationFactorBoilingTemperature()),2);
}
/*!
......@@ -208,8 +208,8 @@ public:
*/
static Scalar criticalTemperature()
{
using std::pow;
return refComponentCriticalTemperature() * pow((1 + 2*perbutationFactorCriticalTemperature())/(1 - 2*perbutationFactorCriticalTemperature()),2);
using Dune::power;
return refComponentCriticalTemperature() * power((1 + 2*perbutationFactorCriticalTemperature())/(1 - 2*perbutationFactorCriticalTemperature()),2);
}
/*!
......@@ -217,8 +217,8 @@ public:
*/
static Scalar criticalPressure()
{
using std::pow;
return refComponentCriticalPressure() * pow((1 + 2*perbutationFactorCriticalPressure())/(1 - 2*perbutationFactorCriticalPressure()),2);
using Dune::power;
return refComponentCriticalPressure() * power((1 + 2*perbutationFactorCriticalPressure())/(1 - 2*perbutationFactorCriticalPressure()),2);
}
/*!
......@@ -450,7 +450,8 @@ public:
Scalar API = 9;
using std::pow;
return ((pow(10,0.10231*pow(API,2)-3.9464*API+46.5037))*(pow(temperatureFahrenheit,-0.04542*pow(API,2)+1.70405*API-19.18)))*0.001;
using Dune::power;
return ((pow(10,0.10231*power(API,2)-3.9464*API+46.5037))*(pow(temperatureFahrenheit,-0.04542*power(API,2)+1.70405*API-19.18)))*0.001;
}
/*!
......
......@@ -209,6 +209,7 @@ public:
using std::abs;
using std::pow;
using Dune::power;
Scalar DTbar = abs(Tbar - 1) + thcond_c4;
Scalar DTbarpow = pow(DTbar, 3./5);
Scalar Q = 2. + thcond_c5 / DTbarpow;
......@@ -224,12 +225,12 @@ public:
Scalar rhobarQ = pow(rhobar, Q);
lam +=
(thcond_d1 / pow(Tbar,10) + thcond_d2) * rhobar18 *
(thcond_d1 / power(Tbar,10) + thcond_d2) * rhobar18 *
exp(thcond_c1 * (1 - rhobar * rhobar18))
+ thcond_d3 * S * rhobarQ *
exp((Q/(1+Q))*(1 - rhobar*rhobarQ))
+ thcond_d4 *
exp(thcond_c2 * pow(Troot,3) + thcond_c3 / pow(rhobar,5));
exp(thcond_c2 * power(Troot,3) + thcond_c3 / power(rhobar,5));
return /*thcond_kstar * */ lam;
}
};
......
......@@ -101,15 +101,16 @@ public:
};
using std::pow;
using Dune::power;
Scalar beta = pow((pressure/1e6 /*from Pa to MPa*/), (1./4.));
Scalar beta2 = pow(beta, 2.);
Scalar beta2 = power(beta, 2);
Scalar E = beta2 + n[2] * beta + n[5];
Scalar F = n[0]*beta2 + n[3]*beta + n[6];
Scalar G = n[1]*beta2 + n[4]*beta + n[7];
using std::sqrt;
Scalar D = ( 2.*G)/(-F -sqrt(pow(F,2.) - 4.*E*G));
Scalar temperature = (n[9] + D - sqrt(pow(n[9]+D , 2.) - 4.* (n[8] + n[9]*D)) ) * 0.5;
Scalar D = ( 2.*G)/(-F -sqrt(power(F,2) - 4.*E*G));
Scalar temperature = (n[9] + D - sqrt(power(n[9]+D , 2) - 4.* (n[8] + n[9]*D)) ) * 0.5;
return temperature;
}
......
......@@ -457,10 +457,10 @@ protected:
Scalar tau = 1 - Tr;
Scalar omega = Component::acentricFactor();
using std::sqrt;
using std::pow;
Scalar f0 = (tau*(-5.97616 + sqrt(tau)*(1.29874 - tau*0.60394)) - 1.06841*pow(tau, 5))/Tr;
Scalar f1 = (tau*(-5.03365 + sqrt(tau)*(1.11505 - tau*5.41217)) - 7.46628*pow(tau, 5))/Tr;
Scalar f2 = (tau*(-0.64771 + sqrt(tau)*(2.41539 - tau*4.26979)) + 3.25259*pow(tau, 5))/Tr;
using Dune::power;
Scalar f0 = (tau*(-5.97616 + sqrt(tau)*(1.29874 - tau*0.60394)) - 1.06841*power(tau, 5))/Tr;
Scalar f1 = (tau*(-5.03365 + sqrt(tau)*(1.11505 - tau*5.41217)) - 7.46628*power(tau, 5))/Tr;
Scalar f2 = (tau*(-0.64771 + sqrt(tau)*(2.41539 - tau*4.26979)) + 3.25259*power(tau, 5))/Tr;
using std::exp;
return Component::criticalPressure()*exp(f0 + omega * (f1 + omega*f2));
}
......
......@@ -65,8 +65,8 @@ public:
const Scalar a01 = params.a01();
const Scalar a02 = params.a02();
using std::pow;
const Scalar aAlphaBeta = a00 + a10 * Sw + a20 * pow(Sw,2) + a11*Sw*pc + a01*pc + a02*pow(pc,2);
using Dune::power;
const Scalar aAlphaBeta = a00 + a10 * Sw + a20 * power(Sw,2) + a11*Sw*pc + a01*pc + a02*power(pc,2);
return aAlphaBeta;
}
......
......@@ -64,11 +64,12 @@ public:
Dune::FieldVector<Scalar, 2> shearStress(const VolumeVariables& volVars) const final
{
using std::pow;
using Dune::power;
using std::hypot;
Dune::FieldVector<Scalar, 2> shearStress(0.0);
Scalar roughnessHeight = pow(25.68/(1.0/manningN_),6.0);
Scalar roughnessHeight = power(25.68/(1.0/manningN_),6);
roughnessHeight = this->limitRoughH(roughnessHeight, volVars.waterDepth());
const Scalar c = pow((volVars.waterDepth() + roughnessHeight),1.0/6.0) * 1.0/(manningN_);
const Scalar uv = hypot(volVars.velocity(0),volVars.velocity(1));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment