22 DATurbulenceModel::DATurbulenceModel(
29 mesh.time().timeName(),
37 allOptions_(
daOption.getAllOptions()),
38 nut_(const_cast<volScalarField&>(
39 mesh.thisDb().lookupObject<volScalarField>(
"nut"))),
40 U_(const_cast<volVectorField&>(
41 mesh.thisDb().lookupObject<volVectorField>(
"U"))),
42 phi_(const_cast<surfaceScalarField&>(
43 mesh.thisDb().lookupObject<surfaceScalarField>(
"phi"))),
47 mesh.time().timeName(),
53 dimensionedScalar(
"phase", dimensionSet(0, 0, 0, 0, 0, 0, 0), 1.0),
54 zeroGradientFvPatchField<scalar>::typeName),
55 phaseRhoPhi_(const_cast<surfaceScalarField&>(
56 mesh.thisDb().lookupObject<surfaceScalarField>(
"phi"))),
57 #ifdef IncompressibleFlow
59 "DARegDbSinglePhaseTransportModel")),
60 laminarTransport_(daRegDbTransport_.getObject()),
62 "DARegDbTurbulenceModelIncompressible")),
63 turbulence_(daRegDbTurbIncomp_.getObject()),
68 mesh.time().timeName(),
74 dimensionedScalar(
"rho", dimensionSet(0, 0, 0, 0, 0, 0, 0), 1.0),
75 zeroGradientFvPatchField<scalar>::typeName),
77 #ifdef CompressibleFlow
79 thermo_(daRegDbThermo_.getObject()),
81 "DARegDbTurbulenceModelCompressible")),
82 turbulence_(daRegDbTurbComp_.getObject()),
84 rho_(const_cast<volScalarField&>(
mesh.thisDb().lookupObject<volScalarField>(
"rho"))),
88 "turbulenceProperties",
89 mesh.time().constant(),
94 coeffDict_(turbDict_.subDict(
"RAS")),
95 kMin_(dimensioned<scalar>::lookupOrAddToDict(
100 epsilonMin_(dimensioned<scalar>::lookupOrAddToDict(
103 kMin_.dimensions() / dimTime,
105 omegaMin_(dimensioned<scalar>::lookupOrAddToDict(
110 nuTildaMin_(dimensioned<scalar>::lookupOrAddToDict(
118 #ifdef IncompressibleFlow
121 IOdictionary transportProperties(
123 "transportProperties",
124 mesh.time().constant(),
129 Pr_ = readScalar(transportProperties.lookup(
"Pr"));
131 if (
mesh_.thisDb().foundObject<volScalarField>(
"alphat"))
133 Prt_ = readScalar(transportProperties.lookup(
"Prt"));
138 #ifdef CompressibleFlow
141 IOdictionary thermophysicalProperties(
143 "thermophysicalProperties",
144 mesh.time().constant(),
150 thermophysicalProperties.subDict(
"mixture").subDict(
"transport").lookup(
"Pr"));
152 if (
mesh_.thisDb().foundObject<volScalarField>(
"alphat"))
154 const IOdictionary& turbDict =
mesh_.thisDb().lookupObject<IOdictionary>(
"turbulenceProperties");
155 dictionary rasSubDict = turbDict.subDict(
"RAS");
156 Prt_ = rasSubDict.getScalar(
"Prt");
165 const word modelType,
169 if (
daOption.getAllOptions().lookupOrDefault<label>(
"debug", 0))
171 Info <<
"Selecting " << modelType <<
" for DATurbulenceModel" << endl;
174 dictionaryConstructorTable::iterator cstrIter =
175 dictionaryConstructorTablePtr_->find(modelType);
177 if (cstrIter == dictionaryConstructorTablePtr_->end())
180 "DATurbulenceModel::New"
186 <<
"Unknown DATurbulenceModel type "
187 << modelType << nl << nl
188 <<
"Valid DATurbulenceModel types:" << endl
189 << dictionaryConstructorTablePtr_->sortedToc()
193 return autoPtr<DATurbulenceModel>(
209 if (
mesh_.thisDb().foundObject<volScalarField>(
"alphat"))
211 dimensionedScalar
Prt(
216 volScalarField&
alphat =
const_cast<volScalarField&
>(
217 mesh_.thisDb().lookupObject<volScalarField>(
"alphat"));
219 alphat.correctBoundaryConditions();
230 return tmp<volScalarField>(
245 #ifdef IncompressibleFlow
246 const volScalarField&
alphat =
mesh_.thisDb().lookupObject<volScalarField>(
"alphat");
247 return tmp<volScalarField>(
253 #ifdef CompressibleFlow
254 const volScalarField&
alphat =
mesh_.thisDb().lookupObject<volScalarField>(
"alphat");
255 return tmp<volScalarField>(
258 thermo_.alphaEff(
alphat)));
271 #ifdef IncompressibleFlow
272 return laminarTransport_.nu();
275 #ifdef CompressibleFlow
276 return thermo_.mu() / rho_;
286 return this->
nu() /
Pr_;
298 #ifdef CompressibleFlow
301 FatalErrorIn(
"flowCondition not valid!") << abort(FatalError);
313 return tmp<volSymmTensorField>(
314 new volSymmTensorField(
316 IOobject::groupName(
"devRhoReff",
U_.group()),
317 mesh_.time().timeName(),
332 #ifdef IncompressibleFlow
333 word
divScheme =
"div((nuEff*dev2(T(grad(U)))))";
335 #ifdef CompressibleFlow
336 word
divScheme =
"div(((rho*nuEff)*dev2(T(grad(U)))))";
339 volScalarField& phase =
phase_;
340 volScalarField&
rho = rho_;
343 -fvm::laplacian(phase *
rho *
nuEff(),
U)
374 #ifdef CompressibleFlow
375 const fluidThermo& DATurbulenceModel::getThermo()
const
394 volScalarField yPlus(
397 mesh_.time().timeName(),
400 IOobject::AUTO_WRITE),
402 dimensionedScalar(dimless, Zero));
403 volScalarField::Boundary& yPlusBf = yPlus.boundaryFieldRef();
405 const nearWallDist nwd(
mesh_);
406 const volScalarField::Boundary& d = nwd.y();
408 const fvPatchList& patches =
mesh_.boundary();
410 const volScalarField::Boundary& nutBf =
nut_.boundaryField();
411 const volVectorField::Boundary& UBf =
U_.boundaryField();
414 volScalarField
nu = this->
nu();
416 const volScalarField::Boundary& nuEffBf =
nuEff.boundaryField();
417 const volScalarField::Boundary& nuBf =
nu.boundaryField();
421 const fvPatch& patch = patches[patchI];
423 if (isA<nutWallFunctionFvPatchScalarField>(nutBf[patchI]))
425 const nutWallFunctionFvPatchScalarField& nutPf =
426 dynamic_cast<const nutWallFunctionFvPatchScalarField&
>(
429 yPlusBf[patchI] = nutPf.yPlus();
431 else if (isA<wallFvPatch>(patch))
437 * mag(UBf[patchI].snGrad()))
446 const fvPatch& patch = patches[patchI];
447 if (isA<wallFvPatch>(patch))
449 forAll(yPlusBf[patchI], faceI)
451 yPlusAll.append(yPlusBf[patchI][faceI]);
455 scalar minYplus = gMin(yPlusAll);
456 scalar maxYplus = gMax(yPlusAll);
457 scalar avgYplus = gAverage(yPlusAll);
459 Info <<
"yPlus min: " << minYplus
460 <<
" max: " << maxYplus
461 <<
" mean: " << avgYplus << endl;
466 const label printInterval)
const
473 if (
runTime.timeIndex() % printInterval == 0 ||
runTime.timeIndex() == 1)
490 FatalErrorIn(
"DATurbulenceModel::getSAProdTerm")
491 <<
"Child class not implemented!"
492 << abort(FatalError);
496 const volScalarField& mySource,
504 FatalErrorIn(
"DATurbulenceModel::invTranProdNuTildaEqn")
505 <<
"Child class not implemented!"
506 << abort(FatalError);
516 FatalErrorIn(
"DATurbulenceModel::calcLduResidualTurb")
517 <<
"Child class not implemented!"
518 << abort(FatalError);
528 FatalErrorIn(
"DATurbulenceModel::constructPseudoNuTildaEqn")
529 <<
"Child class not implemented!"
530 << abort(FatalError);
540 FatalErrorIn(
"DATurbulenceModel::rhsSolvePseudoNuTildaEqn")
541 <<
"Child class not implemented!"
542 << abort(FatalError);