applyBoundaryLayer: Ensure nut is up-to-date with the current turbulence fields

Resolves bug-report https://bugs.openfoam.org/view.php?id=2511
This commit is contained in:
Henry Weller 2017-03-22 12:07:15 +00:00
parent d7ffce4f5d
commit 7af84c144d

View file

@ -42,7 +42,7 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// turbulence constants - file-scope // Turbulence constants - file-scope
static const scalar Cmu(0.09); static const scalar Cmu(0.09);
static const scalar kappa(0.41); static const scalar kappa(0.41);
@ -130,14 +130,14 @@ int main(int argc, char *argv[])
if (isA<incompressible::RASModel>(turbulence())) if (isA<incompressible::RASModel>(turbulence()))
{ {
// Calculate nut - reference nut is calculated by the turbulence model // Calculate nut
// on its construction turbulence->validate();
tmp<volScalarField> tnut = turbulence->nut(); tmp<volScalarField> tnut = turbulence->nut();
volScalarField& nut = const_cast<volScalarField&>(tnut()); volScalarField& nut = const_cast<volScalarField&>(tnut());
volScalarField S(mag(dev(symm(fvc::grad(U))))); volScalarField S(mag(dev(symm(fvc::grad(U)))));
nut = (1 - mask)*nut + mask*sqr(kappa*min(y, ybl))*::sqrt(2)*S; nut = (1 - mask)*nut + mask*sqr(kappa*min(y, ybl))*::sqrt(2)*S;
// do not correct BC - wall functions will 'undo' manipulation above // Do not correct BC - wall functions will 'undo' manipulation above
// by using nut from turbulence model // by using nut from turbulence model
if (args.optionFound("writenut")) if (args.optionFound("writenut"))
@ -155,7 +155,7 @@ int main(int argc, char *argv[])
scalar ck0 = pow025(Cmu)*kappa; scalar ck0 = pow025(Cmu)*kappa;
k = (1 - mask)*k + mask*sqr(nut/(ck0*min(y, ybl))); k = (1 - mask)*k + mask*sqr(nut/(ck0*min(y, ybl)));
// do not correct BC - operation may use inconsistent fields wrt these // Do not correct BC - operation may use inconsistent fields wrt these
// local manipulations // local manipulations
// k.correctBoundaryConditions(); // k.correctBoundaryConditions();
@ -169,7 +169,7 @@ int main(int argc, char *argv[])
scalar ce0 = ::pow(Cmu, 0.75)/kappa; scalar ce0 = ::pow(Cmu, 0.75)/kappa;
epsilon = (1 - mask)*epsilon + mask*ce0*k*sqrt(k)/min(y, ybl); epsilon = (1 - mask)*epsilon + mask*ce0*k*sqrt(k)/min(y, ybl);
// do not correct BC - wall functions will use non-updated k from // Do not correct BC - wall functions will use non-updated k from
// turbulence model // turbulence model
// epsilon.correctBoundaryConditions(); // epsilon.correctBoundaryConditions();
@ -193,7 +193,7 @@ int main(int argc, char *argv[])
dimensionedScalar k0("VSMALL", k.dimensions(), VSMALL); dimensionedScalar k0("VSMALL", k.dimensions(), VSMALL);
omega = (1 - mask)*omega + mask*epsilon/(Cmu*k + k0); omega = (1 - mask)*omega + mask*epsilon/(Cmu*k + k0);
// do not correct BC - wall functions will use non-updated k from // Do not correct BC - wall functions will use non-updated k from
// turbulence model // turbulence model
// omega.correctBoundaryConditions(); // omega.correctBoundaryConditions();
@ -217,7 +217,7 @@ int main(int argc, char *argv[])
volScalarField nuTilda(nuTildaHeader, mesh); volScalarField nuTilda(nuTildaHeader, mesh);
nuTilda = nut; nuTilda = nut;
// do not correct BC // Do not correct BC
// nuTilda.correctBoundaryConditions(); // nuTilda.correctBoundaryConditions();
Info<< "Writing nuTilda\n" << endl; Info<< "Writing nuTilda\n" << endl;