STYLE: use cbrt() instead of pow(..,1.0/3.0) in a few more places

This commit is contained in:
Mark Olesen
2019-01-09 12:22:07 +01:00
parent 95d7586b48
commit 07a6e9d83d
22 changed files with 29 additions and 29 deletions

View File

@ -3,5 +3,5 @@
// Friction factor is defined with standard gravity // Friction factor is defined with standard gravity
frictionFactor.primitiveFieldRef() = frictionFactor.primitiveFieldRef() =
mag(2*9.81*sqr(manningField.primitiveField())/ mag(2*9.81*sqr(manningField.primitiveField())/
pow(mag(h.primitiveField()) + 1e-7, 1.0/3.0)); cbrt(mag(h.primitiveField()) + 1e-7));
} }

View File

@ -107,7 +107,7 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo
deltaN_ deltaN_
( (
"deltaN", "deltaN",
1e-8/pow(average(mesh_.V()), 1.0/3.0) 1e-8/cbrt(average(mesh_.V()))
) )
{ {
rhoPhi_.setOriented(); rhoPhi_.setOriented();

View File

@ -1145,7 +1145,7 @@ Foam::tmp<Foam::surfaceVectorField> Foam::phaseSystem::nHatfv
const dimensionedScalar deltaN const dimensionedScalar deltaN
( (
"deltaN", "deltaN",
1e-8/pow(average(mesh_.V()), 1.0/3.0) 1e-8/cbrt(average(mesh_.V()))
); );
// Face unit interface normal // Face unit interface normal

View File

@ -166,7 +166,7 @@ Foam::threePhaseInterfaceProperties::threePhaseInterfaceProperties
deltaN_ deltaN_
( (
"deltaN", "deltaN",
1e-8/pow(average(mixture.U().mesh().V()), 1.0/3.0) 1e-8/cbrt(average(mixture.U().mesh().V()))
), ),
nHatf_ nHatf_

View File

@ -44,9 +44,9 @@ forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
*max *max
( (
mag(U()) - maxSlamVelocity, mag(U()) - maxSlamVelocity,
dimensionedScalar("U0", dimVelocity, 0) dimensionedScalar("U0", dimVelocity, Zero)
) )
/pow(mesh.V(), 1.0/3.0), /cbrt(mesh.V()),
U U
) )
) )

View File

@ -73,7 +73,7 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::isothermal::d() const
"p" "p"
); );
return d0_*pow(p0_/p, 1.0/3.0); return d0_*cbrt(p0_/p);
} }

View File

@ -408,7 +408,7 @@ Foam::multiphaseSystem::multiphaseSystem
deltaN_ deltaN_
( (
"deltaN", "deltaN",
1e-8/pow(average(mesh_.V()), 1.0/3.0) 1e-8/cbrt(average(mesh_.V()))
) )
{ {
calcAlphas(); calcAlphas();

View File

@ -120,7 +120,7 @@ Foam::multiphaseMixture::multiphaseMixture
deltaN_ deltaN_
( (
"deltaN", "deltaN",
1e-8/pow(average(mesh_.V()), 1.0/3.0) 1e-8/cbrt(average(mesh_.V()))
) )
{ {
rhoPhi_.setOriented(); rhoPhi_.setOriented();

View File

@ -84,7 +84,7 @@ Foam::tmp<Foam::volScalarField> Foam::dragModels::Tenneti::CdRe() const
volScalarField F0 volScalarField F0
( (
5.81*alpha1/pow3(alpha2) + 0.48*pow(alpha1, 1.0/3.0)/pow4(alpha2) 5.81*alpha1/pow3(alpha2) + 0.48*cbrt(alpha1)/pow4(alpha2)
); );
volScalarField F1 volScalarField F1

View File

@ -73,7 +73,7 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::isothermal::d() const
"p" "p"
); );
return d0_*pow(p0_/p, 1.0/3.0); return d0_*cbrt(p0_/p);
} }

View File

@ -503,7 +503,7 @@ Foam::multiphaseSystem::multiphaseSystem
deltaN_ deltaN_
( (
"deltaN", "deltaN",
1e-8/pow(average(mesh_.V()), 1.0/3.0) 1e-8/cbrt(average(mesh_.V()))
) )
{ {
forAll(phases(), phasei) forAll(phases(), phasei)

View File

@ -73,7 +73,7 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::isothermal::d() const
"p" "p"
); );
return d0_*pow(p0_/p, 1.0/3.0); return d0_*cbrt(p0_/p);
} }

View File

@ -48,7 +48,7 @@ void Foam::LESModels::cubeRootVolDelta::calcDelta()
if (nD == 3) if (nD == 3)
{ {
delta_.primitiveFieldRef() = deltaCoeff_*pow(mesh.V(), 1.0/3.0); delta_.primitiveFieldRef() = deltaCoeff_ * cbrt(mesh.V());
} }
else if (nD == 2) else if (nD == 2)
{ {

View File

@ -94,7 +94,7 @@ eddyDissipationDiffusionModel<ReactionThermo, ThermoType>::rtDiff() const
); );
volScalarField& delta = tdelta.ref(); volScalarField& delta = tdelta.ref();
delta.ref() = pow(this->mesh().V(), 1.0/3.0); delta.ref() = cbrt(this->mesh().V());
delta.correctBoundaryConditions(); delta.correctBoundaryConditions();
// NOTE: Assume Prt = 1 // NOTE: Assume Prt = 1

View File

@ -470,8 +470,8 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const
const scalar cellOwnerVol = max(0.0, V[cellOwner[intFacei]]); const scalar cellOwnerVol = max(0.0, V[cellOwner[intFacei]]);
const scalar cellNeighbourVol = max(0.0, V[cellNeighbour[intFacei]]); const scalar cellNeighbourVol = max(0.0, V[cellNeighbour[intFacei]]);
scalar targetFaceSizeA = Foam::pow(cellOwnerVol, 1.0/3.0); scalar targetFaceSizeA = Foam::cbrt(cellOwnerVol);
scalar targetFaceSizeB = Foam::pow(cellNeighbourVol, 1.0/3.0); scalar targetFaceSizeB = Foam::cbrt(cellNeighbourVol);
targetFaceSizes[intFacei] = 0.5*(targetFaceSizeA + targetFaceSizeB); targetFaceSizes[intFacei] = 0.5*(targetFaceSizeA + targetFaceSizeB);
} }
@ -505,7 +505,7 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const
const label extFacei = patchFacei + patch.start(); const label extFacei = patchFacei + patch.start();
const scalar cellOwnerVol = max(0.0, V[cellOwner[extFacei]]); const scalar cellOwnerVol = max(0.0, V[cellOwner[extFacei]]);
targetFaceSizes[extFacei] = Foam::pow(cellOwnerVol, 1.0/3.0); targetFaceSizes[extFacei] = Foam::cbrt(cellOwnerVol);
} }
} }
} }
@ -526,8 +526,8 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const
const scalar cellOwnerVol = max(0.0, V[cellOwner[localFacei]]); const scalar cellOwnerVol = max(0.0, V[cellOwner[localFacei]]);
const scalar cellNeighbourVol = neiCellVolumes[bFacei++]; const scalar cellNeighbourVol = neiCellVolumes[bFacei++];
scalar targetFaceSizeA = Foam::pow(cellOwnerVol, 1.0/3.0); scalar targetFaceSizeA = Foam::cbrt(cellOwnerVol);
scalar targetFaceSizeB = Foam::pow(cellNeighbourVol, 1.0/3.0); scalar targetFaceSizeB = Foam::cbrt(cellNeighbourVol);
targetFaceSizes[localFacei] targetFaceSizes[localFacei]
= 0.5*(targetFaceSizeA + targetFaceSizeB); = 0.5*(targetFaceSizeA + targetFaceSizeB);

View File

@ -370,7 +370,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
auto& Co = CoPtr.ref(); auto& Co = CoPtr.ref();
Co.primitiveFieldRef() = Co.primitiveFieldRef() =
mesh_.time().deltaT()*mag(*UNamePtr)/pow(mesh_.V(), 1.0/3.0); mesh_.time().deltaT()*mag(*UNamePtr)/cbrt(mesh_.V());
indicator_ = indicator_ =
max max

View File

@ -42,7 +42,7 @@ Foam::AveragingMethods::Moment<Type>::Moment
dataY_(FieldField<Field, Type>::operator[](2)), dataY_(FieldField<Field, Type>::operator[](2)),
dataZ_(FieldField<Field, Type>::operator[](3)), dataZ_(FieldField<Field, Type>::operator[](3)),
transform_(mesh.nCells(), Zero), transform_(mesh.nCells(), Zero),
scale_(0.5*pow(mesh.V(), 1.0/3.0)) scale_(0.5*cbrt(mesh.V()))
{ {
scalar a = 1.0/24.0; scalar a = 1.0/24.0;
scalar b = 0.5854101966249685; scalar b = 0.5854101966249685;

View File

@ -89,7 +89,7 @@ Foam::ParticleStressModels::Lun::tau
0.6 0.6
/ max / max
( (
1.0 - pow(alpha/alphaPacked_,1.0/3.0), 1.0 - cbrt(alpha/alphaPacked_),
max(eps_*(1.0 - alpha), SMALL) max(eps_*(1.0 - alpha), SMALL)
) )
); );

View File

@ -179,7 +179,7 @@ void Foam::inclinedFilmNusseltHeightFvPatchScalarField::updateCoeffs()
operator== operator==
( (
pow(3*sqr(mup/rhop)/(gTan + ROOTVSMALL), 1.0/3.0)*pow(Re, 1.0/3.0) cbrt(3*sqr(mup/rhop)/(gTan + ROOTVSMALL))*cbrt(Re)
); );
fixedValueFvPatchScalarField::updateCoeffs(); fixedValueFvPatchScalarField::updateCoeffs();

View File

@ -179,7 +179,7 @@ void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::updateCoeffs()
const scalarField Re(max(G, scalar(0))/mup); const scalarField Re(max(G, scalar(0))/mup);
operator==(n*pow(gTan*mup/(3*rhop), 1.0/3.0)*pow(Re, 2.0/3.0)); operator==(n*cbrt(gTan*mup/(3*rhop))*pow(Re, 2.0/3.0));
fixedValueFvPatchVectorField::updateCoeffs(); fixedValueFvPatchVectorField::updateCoeffs();
} }

View File

@ -236,15 +236,15 @@ inline Foam::scalar Foam::PengRobinsonGas<Specie>::Z
{ {
// One root is real // One root is real
const scalar D05 = sqrt(D); const scalar D05 = sqrt(D);
const scalar S = pow(Rl + D05, 1.0/3.0); const scalar S = cbrt(Rl + D05);
scalar Tl = 0; scalar Tl = 0;
if (D05 > Rl) if (D05 > Rl)
{ {
Tl = -pow(mag(Rl - D05), 1.0/3.0); Tl = -cbrt(mag(Rl - D05));
} }
else else
{ {
Tl = pow(Rl - D05, 1.0/3.0); Tl = cbrt(Rl - D05);
} }
root = S + Tl - a2/3.0; root = S + Tl - a2/3.0;

View File

@ -165,7 +165,7 @@ Foam::interfaceProperties::interfaceProperties
deltaN_ deltaN_
( (
"deltaN", "deltaN",
1e-8/pow(average(alpha1.mesh().V()), 1.0/3.0) 1e-8/cbrt(average(alpha1.mesh().V()))
), ),
alpha1_(alpha1), alpha1_(alpha1),