COMP: avoid ambiguous construct from tmp - turbulenceModels/incompressible/RAS

This commit is contained in:
Mark Olesen
2010-12-17 17:32:10 +01:00
parent e6dd7fddbe
commit 3d3c95a37a
24 changed files with 126 additions and 98 deletions

View File

@ -300,7 +300,7 @@ void LRR::correct()
return;
}
volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_)));
volScalarField G("RASModel::G", 0.5*mag(tr(P)));
// Update epsilon and G at the wall
@ -403,7 +403,7 @@ void LRR::correct()
const scalarField& nutw = nut_.boundaryField()[patchi];
vectorField snGradU = U_.boundaryField()[patchi].snGrad();
const vectorField snGradU(U_.boundaryField()[patchi].snGrad());
const vectorField& faceAreas
= mesh_.Sf().boundaryField()[patchi];

View File

@ -242,12 +242,12 @@ void LamBremhorstKE::correct()
// Calculate parameters and coefficients for low-Reynolds number model
Rt_ = sqr(k_)/(nu()*epsilon_);
volScalarField Ry = sqrt(k_)*y_/nu();
tmp<volScalarField> Ry = sqrt(k_)*y_/nu();
fMu_ = sqr(scalar(1) - exp(-0.0165*Ry))*(scalar(1) + 20.5/(Rt_ + SMALL));
volScalarField f1 = scalar(1) + pow(0.05/(fMu_ + SMALL), 3);
volScalarField f2 = scalar(1) - exp(-sqr(Rt_));
tmp<volScalarField> f1 = scalar(1) + pow(0.05/(fMu_ + SMALL), 3);
tmp<volScalarField> f2 = scalar(1) - exp(-sqr(Rt_));
// Dissipation equation

View File

@ -342,7 +342,7 @@ void LaunderGibsonRSTM::correct()
yr_.correct();
}
volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_)));
volScalarField G("RASModel::G", 0.5*mag(tr(P)));
// Update epsilon and G at the wall
@ -388,7 +388,10 @@ void LaunderGibsonRSTM::correct()
}
}
volSymmTensorField reflect = C1Ref_*epsilon_/k_*R_ - C2Ref_*Clg2_*dev(P);
const volSymmTensorField reflect
(
C1Ref_*epsilon_/k_*R_ - C2Ref_*Clg2_*dev(P)
);
tmp<fvSymmTensorMatrix> REqn
(
@ -451,7 +454,7 @@ void LaunderGibsonRSTM::correct()
const scalarField& nutw = nut_.boundaryField()[patchi];
vectorField snGradU = U_.boundaryField()[patchi].snGrad();
const vectorField snGradU(U_.boundaryField()[patchi].snGrad());
const vectorField& faceAreas
= mesh_.Sf().boundaryField()[patchi];

View File

@ -237,12 +237,12 @@ void LaunderSharmaKE::correct()
return;
}
volScalarField S2 = 2*magSqr(symm(fvc::grad(U_)));
tmp<volScalarField> S2 = 2*magSqr(symm(fvc::grad(U_)));
volScalarField G("RASModel::G", nut_*S2);
volScalarField E = 2.0*nu()*nut_*fvc::magSqrGradGrad(U_);
volScalarField D = 2.0*nu()*magSqr(fvc::grad(sqrt(k_)));
const volScalarField E(2.0*nu()*nut_*fvc::magSqrGradGrad(U_));
const volScalarField D(2.0*nu()*magSqr(fvc::grad(sqrt(k_))));
// Dissipation rate equation

View File

@ -335,7 +335,7 @@ void LienCubicKE::correct()
gradU_ = fvc::grad(U_);
// generation term
volScalarField S2 = symm(gradU_) && gradU_;
tmp<volScalarField> S2 = symm(gradU_) && gradU_;
volScalarField G
(

View File

@ -409,19 +409,25 @@ void LienCubicKELowRe::correct()
gradU_ = fvc::grad(U_);
// generation term
volScalarField S2 = symm(gradU_) && gradU_;
tmp<volScalarField> S2 = symm(gradU_) && gradU_;
yStar_ = sqrt(k_)*y_/nu() + SMALL;
volScalarField Rt = sqr(k_)/(nu()*epsilon_);
tmp<volScalarField> Rt = sqr(k_)/(nu()*epsilon_);
volScalarField fMu =
const volScalarField fMu
(
(scalar(1) - exp(-Am_*yStar_))
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL);
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)
);
const volScalarField f2
(
scalar(1) - 0.3*exp(-sqr(Rt))
);
volScalarField f2 = scalar(1) - 0.3*exp(-sqr(Rt));
volScalarField G =
Cmu_*fMu*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU_);
volScalarField G
(
Cmu_*fMu*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU_)
);
// Dissipation equation
tmp<fvScalarMatrix> epsEqn

View File

@ -197,7 +197,7 @@ LienLeschzinerLowRe::LienLeschzinerLowRe
tmp<volSymmTensorField> LienLeschzinerLowRe::R() const
{
volTensorField gradU = fvc::grad(U_);
tmp<volTensorField> gradU = fvc::grad(U_);
return tmp<volSymmTensorField>
(
@ -288,19 +288,21 @@ void LienLeschzinerLowRe::correct()
scalar Cmu75 = pow(Cmu_.value(), 0.75);
volTensorField gradU = fvc::grad(U_);
const volTensorField gradU(fvc::grad(U_));
// generation term
volScalarField S2 = symm(gradU) && gradU;
tmp<volScalarField> S2 = symm(gradU) && gradU;
yStar_ = sqrt(k_)*y_/nu() + SMALL;
volScalarField Rt = sqr(k_)/(nu()*epsilon_);
tmp<volScalarField> Rt = sqr(k_)/(nu()*epsilon_);
volScalarField fMu =
volScalarField fMu
(
(scalar(1) - exp(-Am_*yStar_))
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL);
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)
);
volScalarField f2 = scalar(1) - 0.3*exp(-sqr(Rt));
const volScalarField f2(scalar(1) - 0.3*exp(-sqr(Rt)));
volScalarField G("RASModel::G", Cmu_*fMu*sqr(k_)/epsilon_*S2);

View File

@ -237,8 +237,6 @@ NonlinearKEShih::NonlinearKEShih
tmp<volSymmTensorField> NonlinearKEShih::R() const
{
volTensorField gradU_ = fvc::grad(U_);
return tmp<volSymmTensorField>
(
new volSymmTensorField
@ -251,7 +249,7 @@ tmp<volSymmTensorField> NonlinearKEShih::R() const
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(gradU_) + nonlinearStress_,
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)) + nonlinearStress_,
k_.boundaryField().types()
)
);
@ -328,7 +326,7 @@ void NonlinearKEShih::correct()
gradU_ = fvc::grad(U_);
// generation term
volScalarField S2 = symm(gradU_) && gradU_;
tmp<volScalarField> S2 = symm(gradU_) && gradU_;
volScalarField G
(

View File

@ -250,13 +250,14 @@ void RNGkEpsilon::correct()
return;
}
volScalarField S2 = 2*magSqr(symm(fvc::grad(U_)));
const volScalarField S2(2*magSqr(symm(fvc::grad(U_))));
volScalarField G("RASModel::G", nut_*S2);
volScalarField eta = sqrt(S2)*k_/epsilon_;
volScalarField R =
((eta*(scalar(1) - eta/eta0_))/(scalar(1) + beta_*eta*sqr(eta)));
const volScalarField eta(sqrt(S2)*k_/epsilon_);
volScalarField R
(
((eta*(scalar(1) - eta/eta0_))/(scalar(1) + beta_*eta*sqr(eta)))
);
// Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();

View File

@ -50,7 +50,7 @@ tmp<volScalarField> SpalartAllmaras::chi() const
tmp<volScalarField> SpalartAllmaras::fv1(const volScalarField& chi) const
{
volScalarField chi3 = pow3(chi);
const volScalarField chi3(pow3(chi));
return chi3/(chi3 + pow3(Cv1_));
}
@ -71,7 +71,7 @@ tmp<volScalarField> SpalartAllmaras::fv3
const volScalarField& fv1
) const
{
volScalarField chiByCv2 = (1/Cv2_)*chi;
const volScalarField chiByCv2((1/Cv2_)*chi);
return
(scalar(1) + chi*fv1)
@ -83,18 +83,25 @@ tmp<volScalarField> SpalartAllmaras::fv3
tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
{
volScalarField r = min
volScalarField r
(
min
(
nuTilda_
/(
max(Stilda, dimensionedScalar("SMALL", Stilda.dimensions(), SMALL))
max
(
Stilda,
dimensionedScalar("SMALL", Stilda.dimensions(), SMALL)
)
*sqr(kappa_*d_)
),
scalar(10.0)
)
);
r.boundaryField() == 0.0;
volScalarField g = r + Cw2_*(pow6(r) - r);
const volScalarField g(r + Cw2_*(pow6(r) - r));
return g*pow((1.0 + pow6(Cw3_))/(pow6(g) + pow6(Cw3_)), 1.0/6.0);
}
@ -320,7 +327,7 @@ tmp<volSymmTensorField> SpalartAllmaras::devReff() const
tmp<fvVectorMatrix> SpalartAllmaras::divDevReff(volVectorField& U) const
{
volScalarField nuEff_ = nuEff();
const volScalarField nuEff_(nuEff());
return
(
@ -368,12 +375,14 @@ void SpalartAllmaras::correct()
d_.correct();
}
volScalarField chi = this->chi();
volScalarField fv1 = this->fv1(chi);
const volScalarField chi(this->chi());
const volScalarField fv1(this->fv1(chi));
volScalarField Stilda =
const volScalarField Stilda
(
fv3(chi, fv1)*::sqrt(2.0)*mag(skew(fvc::grad(U_)))
+ fv2(chi, fv1)*nuTilda_/sqr(kappa_*d_);
+ fv2(chi, fv1)*nuTilda_/sqr(kappa_*d_)
);
tmp<fvScalarMatrix> nuTildaEqn
(

View File

@ -130,7 +130,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
void atmBoundaryLayerInletEpsilonFvPatchScalarField::updateCoeffs()
{
const vectorField& c = patch().Cf();
scalarField coord = (c & z_);
tmp<scalarField> coord = (c & z_);
scalarField::operator=(pow3(Ustar_)/(kappa_*(coord - zGround_ + z0_)));
}

View File

@ -145,12 +145,12 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
void atmBoundaryLayerInletVelocityFvPatchVectorField::updateCoeffs()
{
const vectorField& c = patch().Cf();
scalarField coord = (c & z_);
const scalarField coord(c & z_);
scalarField Un(coord.size());
forAll(coord, i)
{
if((coord[i] - zGround_) < Href_)
if ((coord[i] - zGround_) < Href_)
{
Un[i] = (Ustar_/kappa_)*log((coord[i] - zGround_ + z0_)/z0_);
}

View File

@ -112,23 +112,23 @@ void fixedShearStressFvPatchVectorField::updateCoeffs()
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const vectorField Ui = Uw.patchInternalField();
const vectorField Ui(Uw.patchInternalField());
vector tauHat = tau0_/(mag(tau0_) + ROOTVSMALL);
const scalarField& ry = patch().deltaCoeffs();
scalarField nuEffw = rasModel.nuEff()().boundaryField()[patchI];
tmp<scalarField> nuEffw = rasModel.nuEff()().boundaryField()[patchI];
vectorField UwUpdated =
tmp<vectorField> UwUpdated =
tauHat*(tauHat & (tau0_*(1.0/(ry*nuEffw)) + Ui));
operator==(UwUpdated);
if (debug)
{
vectorField nHat = this->patch().nf();
volSymmTensorField Reff = rasModel.devReff();
tmp<vectorField> nHat = this->patch().nf();
volSymmTensorField Reff(rasModel.devReff());
Info << "tau : " << (nHat & Reff.boundaryField()[patchI])() << endl;
}

View File

@ -207,7 +207,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magGradUw = mag(Uw.snGrad());
const scalarField magGradUw(mag(Uw.snGrad()));
// Set epsilon and G
forAll(nutw, faceI)

View File

@ -50,7 +50,7 @@ tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcNut() const
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
// The flow velocity at the adjacent cell centre
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus();
@ -272,9 +272,9 @@ tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::yPlus() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
tmp<scalarField> magUp = mag(Uw.patchInternalField() - Uw);
return calcYPlus(magUp);
return calcYPlus(magUp());
}

View File

@ -46,7 +46,7 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcNut() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magGradU = mag(Uw.snGrad());
const scalarField magGradU(mag(Uw.snGrad()));
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
return max
@ -67,7 +67,7 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
const fvPatchVectorField& Uw =
rasModel.U().boundaryField()[patch().index()];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField& nuw = rasModel.nu().boundaryField()[patch().index()];
const scalarField& nutw = *this;

View File

@ -47,8 +47,8 @@ tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcNut() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField magGradU = mag(Uw.snGrad());
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField magGradU(mag(Uw.snGrad()));
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
return
@ -181,9 +181,9 @@ tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::yPlus() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
const scalarField Rey = magUp*y/nuw;
const scalarField Rey(magUp*y/nuw);
return Rey/(calcUPlus(Rey) + ROOTVSMALL);
}

View File

@ -46,7 +46,7 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcNut() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
tmp<scalarField> tyPlus = calcYPlus(magUp);
@ -167,7 +167,7 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::yPlus() const
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
return calcYPlus(magUp);
}

View File

@ -219,7 +219,7 @@ tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk();
const scalarField kwc = k.boundaryField()[patchI].patchInternalField();
tmp<scalarField> kwc = k.boundaryField()[patchI].patchInternalField();
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
return pow025(Cmu_)*y*sqrt(kwc)/nuw;

View File

@ -212,7 +212,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magGradUw = mag(Uw.snGrad());
const scalarField magGradUw(mag(Uw.snGrad()));
// Set omega and G
forAll(nutw, faceI)

View File

@ -67,7 +67,10 @@ Description
const scalarField& nuw = nu().boundaryField()[patchi];
const scalarField& nutw = nut_.boundaryField()[patchi];
scalarField magFaceGradU = mag(U_.boundaryField()[patchi].snGrad());
const scalarField magFaceGradU
(
mag(U_.boundaryField()[patchi].snGrad())
);
forAll(curPatch, facei)
{

View File

@ -46,13 +46,13 @@ addToRunTimeSelectionTable(RASModel, kOmegaSST, dictionary);
tmp<volScalarField> kOmegaSST::F1(const volScalarField& CDkOmega) const
{
volScalarField CDkOmegaPlus = max
tmp<volScalarField> CDkOmegaPlus = max
(
CDkOmega,
dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10)
);
volScalarField arg1 = min
tmp<volScalarField> arg1 = min
(
min
(
@ -71,7 +71,7 @@ tmp<volScalarField> kOmegaSST::F1(const volScalarField& CDkOmega) const
tmp<volScalarField> kOmegaSST::F2() const
{
volScalarField arg2 = min
tmp<volScalarField> arg2 = min
(
max
(
@ -347,16 +347,18 @@ void kOmegaSST::correct()
y_.correct();
}
volScalarField S2 = magSqr(symm(fvc::grad(U_)));
const volScalarField S2(magSqr(symm(fvc::grad(U_))));
volScalarField G("RASModel::G", nut_*2*S2);
// Update omega and G at the wall
omega_.boundaryField().updateCoeffs();
volScalarField CDkOmega =
(2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_;
const volScalarField CDkOmega
(
(2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_
);
volScalarField F1 = this->F1(CDkOmega);
const volScalarField F1(this->F1(CDkOmega));
// Turbulent frequency equation
tmp<fvScalarMatrix> omegaEqn

View File

@ -46,7 +46,7 @@ addToRunTimeSelectionTable(RASModel, qZeta, dictionary);
tmp<volScalarField> qZeta::fMu() const
{
volScalarField Rt = q_*k_/(2.0*nu()*zeta_);
const volScalarField Rt(q_*k_/(2.0*nu()*zeta_));
if (anisotropic_)
{
@ -63,7 +63,7 @@ tmp<volScalarField> qZeta::fMu() const
tmp<volScalarField> qZeta::f2() const
{
volScalarField Rt = q_*k_/(2.0*nu()*zeta_);
tmp<volScalarField> Rt = q_*k_/(2.0*nu()*zeta_);
return scalar(1) - 0.3*exp(-sqr(Rt));
}
@ -293,10 +293,10 @@ void qZeta::correct()
return;
}
volScalarField S2 = 2*magSqr(symm(fvc::grad(U_)));
tmp<volScalarField> S2 = 2*magSqr(symm(fvc::grad(U_)));
volScalarField G("RASModel::G", nut_/(2.0*q_)*S2);
volScalarField E = nu()*nut_/q_*fvc::magSqrGradGrad(U_);
const volScalarField E(nu()*nut_/q_*fvc::magSqrGradGrad(U_));
// Zeta equation

View File

@ -54,19 +54,23 @@ tmp<volScalarField> realizableKE::rCmu
tmp<volSymmTensorField> tS = dev(symm(gradU));
const volSymmTensorField& S = tS();
volScalarField W =
tmp<volScalarField> W
(
(2*sqrt(2.0))*((S&S)&&S)
/(
magS*S2
+ dimensionedScalar("small", dimensionSet(0, 0, -3, 0, 0), SMALL)
)
);
tS.clear();
volScalarField phis =
(1.0/3.0)*acos(min(max(sqrt(6.0)*W, -scalar(1)), scalar(1)));
volScalarField As = sqrt(6.0)*cos(phis);
volScalarField Us = sqrt(S2/2.0 + magSqr(skew(gradU)));
tmp<volScalarField> phis
(
(1.0/3.0)*acos(min(max(sqrt(6.0)*W, -scalar(1)), scalar(1)))
);
tmp<volScalarField> As = sqrt(6.0)*cos(phis);
tmp<volScalarField> Us = sqrt(S2/2.0 + magSqr(skew(gradU)));
return 1.0/(A0_ + As*Us*k_/epsilon_);
}
@ -77,8 +81,8 @@ tmp<volScalarField> realizableKE::rCmu
const volTensorField& gradU
)
{
volScalarField S2 = 2*magSqr(dev(symm(gradU)));
volScalarField magS = sqrt(S2);
const volScalarField S2(2*magSqr(dev(symm(gradU))));
tmp<volScalarField> magS = sqrt(S2);
return rCmu(gradU, S2, magS);
}
@ -270,12 +274,12 @@ void realizableKE::correct()
return;
}
volTensorField gradU = fvc::grad(U_);
volScalarField S2 = 2*magSqr(dev(symm(gradU)));
volScalarField magS = sqrt(S2);
const volTensorField gradU(fvc::grad(U_));
const volScalarField S2(2*magSqr(dev(symm(gradU))));
const volScalarField magS(sqrt(S2));
volScalarField eta = magS*k_/epsilon_;
volScalarField C1 = max(eta/(scalar(5) + eta), scalar(0.43));
const volScalarField eta(magS*k_/epsilon_);
tmp<volScalarField> C1 = max(eta/(scalar(5) + eta), scalar(0.43));
volScalarField G("RASModel::G", nut_*S2);