COMP: adjust code for nu() as tmp<volScalarField>

This commit is contained in:
Mark Olesen
2010-12-22 09:38:27 +01:00
parent bf915ce841
commit e81e392ae6
18 changed files with 34 additions and 25 deletions

View File

@ -1,7 +1,7 @@
{ {
// Evaluate near-wall behaviour // Evaluate near-wall behaviour
scalar nu = turbulence->nu().boundaryField()[patchId][faceId]; scalar nu = turbulence->nu()().boundaryField()[patchId][faceId];
scalar nut = turbulence->nut()().boundaryField()[patchId][faceId]; scalar nut = turbulence->nut()().boundaryField()[patchId][faceId];
symmTensor R = turbulence->devReff()().boundaryField()[patchId][faceId]; symmTensor R = turbulence->devReff()().boundaryField()[patchId][faceId];
scalar epsilon = turbulence->epsilon()()[cellId]; scalar epsilon = turbulence->epsilon()()[cellId];
@ -31,4 +31,4 @@
<< ", y+ = " << yPlus << ", u+ = " << uPlus << ", y+ = " << yPlus << ", u+ = " << uPlus
<< ", k+ = " << kPlus << ", epsilon+ = " << epsilonPlus << ", k+ = " << kPlus << ", epsilon+ = " << epsilonPlus
<< endl; << endl;
} }

View File

@ -104,6 +104,8 @@ int main(int argc, char *argv[])
const fvPatchList& patches = mesh.boundary(); const fvPatchList& patches = mesh.boundary();
const volScalarField nuLam(sgsModel->nu());
forAll(patches, patchi) forAll(patches, patchi)
{ {
const fvPatch& currPatch = patches[patchi]; const fvPatch& currPatch = patches[patchi];
@ -117,7 +119,7 @@ int main(int argc, char *argv[])
nuEff.boundaryField()[patchi] nuEff.boundaryField()[patchi]
*mag(U.boundaryField()[patchi].snGrad()) *mag(U.boundaryField()[patchi].snGrad())
) )
/sgsModel->nu().boundaryField()[patchi]; /nuLam.boundaryField()[patchi];
const scalarField& Yp = yPlus.boundaryField()[patchi]; const scalarField& Yp = yPlus.boundaryField()[patchi];
Info<< "Patch " << patchi Info<< "Patch " << patchi

View File

@ -98,7 +98,7 @@ tmp<volScalarField> laminar::nuSgs() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("nuSgs", nu().dimensions(), 0.0) dimensionedScalar("nuSgs", nu()().dimensions(), 0.0)
) )
); );
} }

View File

@ -51,7 +51,8 @@ void vanDriestDelta::calcDelta()
const LESModel& lesModel = mesh_.lookupObject<LESModel>("LESProperties"); const LESModel& lesModel = mesh_.lookupObject<LESModel>("LESProperties");
const volVectorField& U = lesModel.U(); const volVectorField& U = lesModel.U();
const volScalarField& nu = lesModel.nu(); const tmp<volScalarField> tnu = lesModel.nu();
const volScalarField& nu = tnu();
tmp<volScalarField> nuSgs = lesModel.nuSgs(); tmp<volScalarField> nuSgs = lesModel.nuSgs();
volScalarField ystar volScalarField ystar

View File

@ -182,7 +182,7 @@ tmp<scalarField> RASModel::yPlus(const label patchNo, const scalar Cmu) const
Yp = pow025(Cmu) Yp = pow025(Cmu)
*y_[patchNo] *y_[patchNo]
*sqrt(k()().boundaryField()[patchNo].patchInternalField()) *sqrt(k()().boundaryField()[patchNo].patchInternalField())
/nu().boundaryField()[patchNo]; /nu()().boundaryField()[patchNo];
} }
else else
{ {

View File

@ -199,7 +199,8 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
const tmp<volScalarField> tk = rasModel.k(); const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk(); const volScalarField& k = tk();
const scalarField& nuw = rasModel.nu().boundaryField()[patchI]; const tmp<volScalarField> tnu = rasModel.nu();
const scalarField& nuw = tnu().boundaryField()[patchI];
const tmp<volScalarField> tnut = rasModel.nut(); const tmp<volScalarField> tnut = rasModel.nut();
const volScalarField& nut = tnut(); const volScalarField& nut = tnut();

View File

@ -207,7 +207,7 @@ void kappatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalar Cmu25 = pow(Cmu_, 0.25); const scalar Cmu25 = pow(Cmu_, 0.25);
const scalarField& y = rasModel.y()[patchI]; const scalarField& y = rasModel.y()[patchI];
const scalarField& nuw = rasModel.nu().boundaryField()[patchI]; const scalarField& nuw = rasModel.nu()().boundaryField()[patchI];
const tmp<volScalarField> tk = rasModel.k(); const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk(); const volScalarField& k = tk();

View File

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

View File

@ -47,7 +47,7 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcNut() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; 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]; const scalarField& nuw = rasModel.nu()().boundaryField()[patchI];
return max return max
( (
@ -69,7 +69,7 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
rasModel.U().boundaryField()[patch().index()]; 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& nuw = rasModel.nu()().boundaryField()[patch().index()];
const scalarField& nutw = *this; const scalarField& nutw = *this;
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0)); tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
@ -181,7 +181,7 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::yPlus() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI]; const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField& nuw = rasModel.nu().boundaryField()[patchI]; const scalarField& nuw = rasModel.nu()().boundaryField()[patchI];
return y*calcUTau(mag(Uw.snGrad()))/nuw; return y*calcUTau(mag(Uw.snGrad()))/nuw;
} }

View File

@ -49,7 +49,7 @@ tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcNut() const
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magUp(mag(Uw.patchInternalField() - Uw)); const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField magGradU(mag(Uw.snGrad())); const scalarField magGradU(mag(Uw.snGrad()));
const scalarField& nuw = rasModel.nu().boundaryField()[patchI]; const scalarField& nuw = rasModel.nu()().boundaryField()[patchI];
return return
max max
@ -182,7 +182,7 @@ tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::yPlus() const
const scalarField& y = rasModel.y()[patchI]; const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[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& nuw = rasModel.nu()().boundaryField()[patchI];
const scalarField Rey(magUp*y/nuw); const scalarField Rey(magUp*y/nuw);
return Rey/(calcUPlus(Rey) + ROOTVSMALL); return Rey/(calcUPlus(Rey) + ROOTVSMALL);

View File

@ -47,7 +47,7 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcNut() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[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& nuw = rasModel.nu()().boundaryField()[patchI];
tmp<scalarField> tyPlus = calcYPlus(magUp); tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus(); scalarField& yPlus = tyPlus();
@ -77,7 +77,7 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcYPlus
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI]; const scalarField& y = rasModel.y()[patchI];
const scalarField& nuw = rasModel.nu().boundaryField()[patchI]; const scalarField& nuw = rasModel.nu()().boundaryField()[patchI];
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0)); tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus(); scalarField& yPlus = tyPlus();

View File

@ -71,7 +71,7 @@ tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
const scalarField& y = rasModel.y()[patchI]; const scalarField& y = rasModel.y()[patchI];
const tmp<volScalarField> tk = rasModel.k(); const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk(); const volScalarField& k = tk();
const scalarField& nuw = rasModel.nu().boundaryField()[patchI]; const scalarField& nuw = rasModel.nu()().boundaryField()[patchI];
const scalar Cmu25 = pow025(Cmu_); const scalar Cmu25 = pow025(Cmu_);

View File

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

View File

@ -204,7 +204,8 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
const tmp<volScalarField> tk = rasModel.k(); const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk(); const volScalarField& k = tk();
const scalarField& nuw = rasModel.nu().boundaryField()[patchI]; const tmp<volScalarField> tnu = rasModel.nu();
const scalarField& nuw = tnu().boundaryField()[patchI];
const tmp<volScalarField> tnut = rasModel.nut(); const tmp<volScalarField> tnut = rasModel.nut();
const volScalarField& nut = tnut(); const volScalarField& nut = tnut();

View File

@ -54,6 +54,8 @@ Description
} }
} }
const volScalarField nuLam(this->nu());
//- Accumulate the wall face contributions to epsilon and G //- Accumulate the wall face contributions to epsilon and G
// Increment cellBoundaryFaceCount for each face for averaging // Increment cellBoundaryFaceCount for each face for averaging
forAll(patches, patchi) forAll(patches, patchi)
@ -64,7 +66,7 @@ Description
{ {
#include "checkPatchFieldTypes.H" #include "checkPatchFieldTypes.H"
const scalarField& nuw = nu().boundaryField()[patchi]; const scalarField& nuw = nuLam.boundaryField()[patchi];
const scalarField& nutw = nut_.boundaryField()[patchi]; const scalarField& nutw = nut_.boundaryField()[patchi];
const scalarField magFaceGradU const scalarField magFaceGradU

View File

@ -34,13 +34,15 @@ Description
const scalar yPlusLam = this->yPlusLam(kappa_.value(), E_.value()); const scalar yPlusLam = this->yPlusLam(kappa_.value(), E_.value());
const volScalarField nuLam(this->nu());
forAll(patches, patchi) forAll(patches, patchi)
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isA<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
const scalarField& nuw = nu().boundaryField()[patchi]; const scalarField& nuw = nuLam.boundaryField()[patchi];
scalarField& nutw = nut_.boundaryField()[patchi]; scalarField& nutw = nut_.boundaryField()[patchi];
forAll(curPatch, facei) forAll(curPatch, facei)

View File

@ -72,7 +72,7 @@ tmp<volScalarField> laminar::nut() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("nut", nu().dimensions(), 0.0) dimensionedScalar("nut", nu()().dimensions(), 0.0)
) )
); );
} }

View File

@ -92,7 +92,7 @@ tmp<volScalarField> laminar::nut() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("nut", nu().dimensions(), 0.0) dimensionedScalar("nut", nu()().dimensions(), 0.0)
) )
); );
} }