58 static const scalar Cmu(0.09);
59 static const scalar
kappa(0.41);
63 void correctProcessorPatches(GeometricField<Type, fvPatchField, volMesh>&
fld)
65 if (UPstream::parRun())
67 fld.boundaryFieldRef().template evaluateCoupled<processorFvPatch>();
74 const word& fieldName,
83 mesh.time().timeName(),
94 pf = (1 - mask)*pf + mask*boundaryLayerField;
101 correctProcessorPatches(
fld);
121 mesh.time().timeName(),
125 IOobject::NO_REGISTER
133 pf = (1 - mask)*pf + mask*epsilonBL/(Cmu*kBL + SMALL);
140 correctProcessorPatches(omega);
151 const word& fieldName,
158 mesh.time().timeName(),
162 IOobject::NO_REGISTER
174 correctProcessorPatches(
fld);
182 tmp<volScalarField> calcNut
197 ).typeHeaderOk<IOdictionary>(
true)
209 autoPtr<compressible::turbulenceModel>
turbulence 230 #include "createPhi.H" 235 autoPtr<incompressible::turbulenceModel>
turbulence 248 int main(
int argc,
char *argv[])
252 "Apply a simplified boundary-layer model to the velocity and" 253 " turbulence fields based on the 1/7th power-law." 262 "Specify the boundary-layer thickness" 268 "Boundary-layer thickness as Cbl * mean distance to wall" 270 argList::addBoolOption
272 "writeTurbulenceFields",
273 "Write the turbulence fields" 275 argList::addOptionCompat
277 "writeTurbulenceFields", {
"write-nut", 1906}
285 <<
"Neither option 'ybl' or 'Cbl' have been provided to calculate " 286 <<
"the boundary-layer thickness.\n" 287 <<
"Please choose either 'ybl' OR 'Cbl'." 293 <<
"Both 'ybl' and 'Cbl' have been provided to calculate " 294 <<
"the boundary-layer thickness.\n" 295 <<
"Please choose either 'ybl' OR 'Cbl'." 299 const bool writeTurbulenceFields =
args.
found(
"writeTurbulenceFields");
303 #include "createFields.H" 310 Info<<
"Setting boundary layer velocity" <<
nl <<
endl;
311 const scalar yblv = ybl.value();
314 if ((
y[celli] > 0) && (
y[celli] <= yblv))
317 U[celli] *=
::pow(
y[celli]/yblv, (1.0/7.0));
320 mask.correctBoundaryConditions();
321 correctProcessorPatches(
U);
323 if (writeTurbulenceFields)
334 correctProcessorPatches(
nut);
348 blendField(
"k",
mesh, mask, kBL);
349 blendField(
"epsilon",
mesh, mask, epsilonBL);
350 calcOmegaField(
mesh, mask, kBL, epsilonBL);
Info<< "Reading thermophysical properties\"<< endl;autoPtr< psiReactionThermo > pThermo(psiReactionThermo::New(mesh))
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void clamp_min(const Type &lower)
Impose lower (floor) clamp on the field values (in-place)
constexpr char nl
The newline '\n' character (0x0a)
const word dictName("faMeshDefinition")
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar pow025(const dimensionedScalar &ds)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
SymmTensor< Cmpt > devSymm(const SymmTensor< Cmpt > &st)
Return the deviatoric part of the symmetric part of a SymmTensor.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
psiReactionThermo & thermo
singlePhaseTransportModel laminarTransport(U, phi)
surfacesMesh setField(triSurfaceToAgglom)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::argList args(argc, argv)
Creates and initialises the face-flux field phi.
bool found(const word &optName) const
Return true if the named option is found.
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)