ENH: applyBoundaryLayer - added -write-nut option to write nut|nuTilda (default=no)

This commit is contained in:
Andrew Heather 2017-12-15 11:15:50 +00:00
parent 445017c741
commit 912b38fd9c

View File

@ -261,13 +261,8 @@ tmp<volScalarField> calcNut
incompressible::turbulenceModel::New(U, phi, laminarTransport)
);
// Hack to correct nut
// Note: in previous versions of the code, nut was initialised on
// construction of the turbulence model. This is no longer the
// case for the Templated Turbulence models. The call to correct
// below will evolve the turbulence model equations and update
// nut, whereas only nut update is required. Need to revisit.
turbulence->correct();
// Correct nut
turbulence->validate();
return tmp<volScalarField>(new volScalarField(turbulence->nut()));
}
@ -296,6 +291,11 @@ int main(int argc, char *argv[])
"scalar",
"boundary-layer thickness as Cbl * mean distance to wall"
);
argList::addBoolOption
(
"write-nut",
"Write the turbulence viscosity field"
);
#include "setRootCase.H"
@ -316,6 +316,8 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
bool writeNut = args.optionFound("write-nut");
#include "createTime.H"
#include "createNamedMesh.H"
#include "createFields.H"
@ -348,7 +350,11 @@ int main(int argc, char *argv[])
// Do not correct BC - wall functions will 'undo' manipulation above
// by using nut from turbulence model
correctProcessorPatches<scalar>(nut);
nut.write();
if (writeNut)
{
Info<< "Writing nut\n" << endl;
nut.write();
}
// Boundary layer turbulence kinetic energy
scalar ck0 = pow025(Cmu)*kappa;
@ -362,7 +368,7 @@ int main(int argc, char *argv[])
blendField("k", mesh, mask, kBL);
blendField("epsilon", mesh, mask, epsilonBL);
calcOmegaField(mesh, mask, kBL, epsilonBL);
setField(mesh, "nuTilda", nut);
if (writeNut) setField(mesh, "nuTilda", nut);
// Write the updated U field
Info<< "Writing U\n" << endl;