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) incompressible::turbulenceModel::New(U, phi, laminarTransport)
); );
// Hack to correct nut // Correct nut
// Note: in previous versions of the code, nut was initialised on turbulence->validate();
// 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();
return tmp<volScalarField>(new volScalarField(turbulence->nut())); return tmp<volScalarField>(new volScalarField(turbulence->nut()));
} }
@ -296,6 +291,11 @@ int main(int argc, char *argv[])
"scalar", "scalar",
"boundary-layer thickness as Cbl * mean distance to wall" "boundary-layer thickness as Cbl * mean distance to wall"
); );
argList::addBoolOption
(
"write-nut",
"Write the turbulence viscosity field"
);
#include "setRootCase.H" #include "setRootCase.H"
@ -316,6 +316,8 @@ int main(int argc, char *argv[])
<< exit(FatalError); << exit(FatalError);
} }
bool writeNut = args.optionFound("write-nut");
#include "createTime.H" #include "createTime.H"
#include "createNamedMesh.H" #include "createNamedMesh.H"
#include "createFields.H" #include "createFields.H"
@ -348,7 +350,11 @@ int main(int argc, char *argv[])
// 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
correctProcessorPatches<scalar>(nut); correctProcessorPatches<scalar>(nut);
if (writeNut)
{
Info<< "Writing nut\n" << endl;
nut.write(); nut.write();
}
// Boundary layer turbulence kinetic energy // Boundary layer turbulence kinetic energy
scalar ck0 = pow025(Cmu)*kappa; scalar ck0 = pow025(Cmu)*kappa;
@ -362,7 +368,7 @@ int main(int argc, char *argv[])
blendField("k", mesh, mask, kBL); blendField("k", mesh, mask, kBL);
blendField("epsilon", mesh, mask, epsilonBL); blendField("epsilon", mesh, mask, epsilonBL);
calcOmegaField(mesh, mask, kBL, epsilonBL); calcOmegaField(mesh, mask, kBL, epsilonBL);
setField(mesh, "nuTilda", nut); if (writeNut) setField(mesh, "nuTilda", nut);
// Write the updated U field // Write the updated U field
Info<< "Writing U\n" << endl; Info<< "Writing U\n" << endl;