47 alphaK1_(dimensioned<scalar>::lookupOrAddToDict(
51 alphaK2_(dimensioned<scalar>::lookupOrAddToDict(
55 alphaOmega1_(dimensioned<scalar>::lookupOrAddToDict(
59 alphaOmega2_(dimensioned<scalar>::lookupOrAddToDict(
63 gamma1_(dimensioned<scalar>::lookupOrAddToDict(
67 gamma2_(dimensioned<scalar>::lookupOrAddToDict(
71 beta1_(dimensioned<scalar>::lookupOrAddToDict(
75 beta2_(dimensioned<scalar>::lookupOrAddToDict(
79 betaStar_(dimensioned<scalar>::lookupOrAddToDict(
83 a1_(dimensioned<scalar>::lookupOrAddToDict(
87 b1_(dimensioned<scalar>::lookupOrAddToDict(
91 c1_(dimensioned<scalar>::lookupOrAddToDict(
95 F3_(Switch::lookupOrAddToDict(
99 ca1_(dimensionedScalar::lookupOrAddToDict(
103 ca2_(dimensionedScalar::lookupOrAddToDict(
107 ce1_(dimensionedScalar::lookupOrAddToDict(
111 ce2_(dimensionedScalar::lookupOrAddToDict(
115 cThetat_(dimensionedScalar::lookupOrAddToDict(
119 sigmaThetat_(dimensionedScalar::lookupOrAddToDict(
123 lambdaErr_(this->coeffDict_.lookupOrDefault(
"lambdaErr", 1e-6)),
124 maxLambdaIter_(this->coeffDict_.lookupOrDefault(
"maxLambdaIter", 10)),
125 deltaU_(
"deltaU", dimVelocity, SMALL),
127 omega_(const_cast<volScalarField&>(
128 mesh_.thisDb().lookupObject<volScalarField>(
"omega"))),
132 mesh.time().timeName(),
137 #ifdef CompressibleFlow
138 dimensionedScalar(
"omegaRes", dimensionSet(1, -3, -2, 0, 0, 0, 0), 0.0),
140 #ifdef IncompressibleFlow
141 dimensionedScalar(
"omegaRes", dimensionSet(0, 0, -2, 0, 0, 0, 0), 0.0),
143 zeroGradientFvPatchField<scalar>::typeName),
144 k_(const_cast<volScalarField&>(
145 mesh_.thisDb().lookupObject<volScalarField>(
"k"))),
149 mesh.time().timeName(),
154 #ifdef CompressibleFlow
155 dimensionedScalar(
"kRes", dimensionSet(1, -1, -3, 0, 0, 0, 0), 0.0),
157 #ifdef IncompressibleFlow
158 dimensionedScalar(
"kRes", dimensionSet(0, 2, -3, 0, 0, 0, 0), 0.0),
160 zeroGradientFvPatchField<scalar>::typeName),
161 ReThetat_(const_cast<volScalarField&>(
162 mesh_.thisDb().lookupObject<volScalarField>(
"ReThetat"))),
166 mesh_.time().timeName(),
171 #ifdef CompressibleFlow
172 dimensionedScalar(
"ReThetatRes", dimensionSet(1, -3, -1, 0, 0, 0, 0), 0.0),
174 #ifdef IncompressibleFlow
175 dimensionedScalar(
"ReThetatRes", dimensionSet(0, 0, -1, 0, 0, 0, 0), 0.0),
177 zeroGradientFvPatchScalarField::typeName),
178 gammaInt_(const_cast<volScalarField&>(
179 mesh_.thisDb().lookupObject<volScalarField>(
"gammaInt"))),
183 mesh_.time().timeName(),
188 #ifdef CompressibleFlow
189 dimensionedScalar(
"gammaIntRes", dimensionSet(1, -3, -1, 0, 0, 0, 0), 0.0),
191 #ifdef IncompressibleFlow
192 dimensionedScalar(
"gammaIntRes", dimensionSet(0, 0, -1, 0, 0, 0, 0), 0.0),
194 zeroGradientFvPatchScalarField::typeName),
195 gammaIntEff_(const_cast<volScalarField::Internal&>(
196 mesh_.thisDb().lookupObject<volScalarField::Internal>(
"gammaIntEff"))),
197 y_(mesh_.thisDb().lookupObject<volScalarField>(
"yWall"))
202 IOdictionary fvSchemes(
205 mesh.time().system(),
210 word ddtScheme = word(fvSchemes.subDict(
"ddtSchemes").lookup(
"default"));
211 if (ddtScheme ==
"steadyState")
214 daOption.getAllOptions().lookupOrDefault<label>(
"printInterval", 100);
219 daOption.getAllOptions().lookupOrDefault<label>(
"printIntervalUnsteady", 500);
223 label nWallFaces = 0;
226 if (
omega_.boundaryField()[patchI].type() ==
"omegaWallFunction"
227 &&
omega_.boundaryField()[patchI].size() > 0)
244 const volScalarField& CDkOmega)
const
247 tmp<volScalarField> CDkOmegaPlus = max(
249 dimensionedScalar(
"1.0e-10", dimless / sqr(dimTime), 1.0e-10));
251 tmp<volScalarField> arg1 = min(
255 scalar(500) * (this->
nu()) / (sqr(
y_) *
omega_)),
259 return tanh(pow4(arg1));
265 tmp<volScalarField> arg2 = min(
268 scalar(500) * (this->
nu()) / (sqr(
y_) *
omega_)),
271 return tanh(sqr(arg2));
277 tmp<volScalarField> arg3 = min(
281 return 1 - tanh(pow4(arg3));
286 tmp<volScalarField> f23(
F2());
297 const volScalarField::Internal& GbyNu0,
298 const volScalarField::Internal& F2,
299 const volScalarField::Internal& S2)
const
308 const volScalarField::Internal& G)
const
314 const volScalarField& F1,
315 const volTensorField& gradU)
const
322 const volScalarField&
rho = rho_;
323 return tmp<fvScalarMatrix>(
326 dimVolume *
rho.dimensions() *
k_.dimensions() / dimTime));
331 const volScalarField&
rho = rho_;
332 return tmp<fvScalarMatrix>(
335 dimVolume *
rho.dimensions() *
omega_.dimensions() / dimTime));
339 const volScalarField::Internal& S2,
340 const volScalarField::Internal& gamma,
341 const volScalarField::Internal& beta)
const
343 const volScalarField&
rho = rho_;
344 return tmp<fvScalarMatrix>(
347 dimVolume *
rho.dimensions() *
omega_.dimensions() / dimTime));
352 const volScalarField& CDkOmega)
const
354 const volScalarField Ry(
y_ * sqrt(
k_) / this->
nu());
355 const volScalarField
F3(exp(-pow(Ry / 120.0, 8)));
357 return max(this->
F1SST(CDkOmega),
F3);
361 const volScalarField::Internal& G)
const
367 const volScalarField& F1,
368 const volTensorField& gradU)
const
375 const volScalarField::Internal& Us,
376 const volScalarField::Internal& Omega,
377 const volScalarField::Internal& nu)
const
379 const volScalarField::Internal& omega =
omega_();
380 const volScalarField::Internal& y =
y_();
382 const volScalarField::Internal delta(375 * Omega *
nu *
ReThetat_() * y / sqr(Us));
383 const volScalarField::Internal ReOmega(sqr(y) * omega /
nu);
384 const volScalarField::Internal Fwake(exp(-sqr(ReOmega / 1e5)));
386 return tmp<volScalarField::Internal>(
387 new volScalarField::Internal(
388 IOobject::groupName(
"Fthetat",
U_.group()),
391 Fwake * exp(-pow4((y / delta))),
399 tmp<volScalarField::Internal> tReThetac(
400 new volScalarField::Internal(
402 IOobject::groupName(
"ReThetac",
U_.group()),
403 mesh_.time().timeName(),
407 volScalarField::Internal&
ReThetac = tReThetac.ref();
411 const scalar ReThetat =
ReThetat_[celli];
417 + 120.656e-4 * ReThetat
418 - 868.230e-6 * sqr(ReThetat)
419 + 696.506e-9 * pow3(ReThetat)
420 - 174.105e-12 * pow4(ReThetat))
421 : scalar(ReThetat - 593.11 - 0.482 * (ReThetat - 1870));
428 const volScalarField::Internal& nu)
const
431 tmp<volScalarField::Internal> tFlength(
432 new volScalarField::Internal(
434 IOobject::groupName(
"Flength",
U_.group()),
435 mesh_.time().timeName(),
439 volScalarField::Internal&
Flength = tFlength.ref();
441 const volScalarField::Internal& omega =
omega_();
442 const volScalarField::Internal& y =
y_();
446 const scalar ReThetat =
ReThetat_[celli];
452 - 119.270e-4 * ReThetat
453 - 132.567e-6 * sqr(ReThetat);
455 else if (ReThetat < 596)
459 - 123.939e-2 * ReThetat
460 + 194.548e-5 * sqr(ReThetat)
461 - 101.695e-8 * pow3(ReThetat);
463 else if (ReThetat < 1200)
465 Flength[celli] = 0.5 - 3e-4 * (ReThetat - 596);
472 const scalar Fsublayer =
473 exp(-sqr(sqr(y[celli]) * omega[celli] / (200 *
nu[celli])));
475 Flength[celli] =
Flength[celli] * (1 - Fsublayer) + 40 * Fsublayer;
482 const volScalarField::Internal& Rev,
483 const volScalarField::Internal& ReThetac,
484 const volScalarField::Internal& RT)
const
486 const volScalarField::Internal Fonset1(Rev / (2.193 *
ReThetac));
488 const volScalarField::Internal Fonset2(
489 min(max(Fonset1, pow4(Fonset1)), scalar(2)));
491 const volScalarField::Internal Fonset3(max(1 - pow3(RT / 2.5), scalar(0)));
493 return tmp<volScalarField::Internal>(
494 new volScalarField::Internal(
495 IOobject::groupName(
"Fonset",
U_.group()),
496 max(Fonset2 - Fonset3, scalar(0))));
500 const volScalarField::Internal& Us,
501 const volScalarField::Internal& dUsds,
502 const volScalarField::Internal& nu)
const
505 tmp<volScalarField::Internal> tReThetat0(
506 new volScalarField::Internal(
508 IOobject::groupName(
"ReThetat0",
U_.group()),
509 mesh_.time().timeName(),
513 volScalarField::Internal&
ReThetat0 = tReThetat0.ref();
515 const volScalarField&
k =
k_;
522 max(100 * sqrt((2.0 / 3.0) *
k[celli]) / Us[celli], scalar(0.027)));
536 const scalar lambda0 =
lambda;
540 const scalar Flambda =
546 * exp(-pow(Tu / 1.5, 1.5)))
548 + 0.275 * (1 - exp(-35 *
lambda))
552 (1173.51 - 589.428 * Tu + 0.2196 / sqr(Tu))
553 * Flambda *
nu[celli]
558 const scalar Flambda =
564 * exp(-pow(Tu / 1.5, 1.5)))
566 + 0.275 * (1 - exp(-35 *
lambda))
570 331.50 * pow((Tu - 0.5658), -0.671)
571 * Flambda *
nu[celli] / Us[celli];
574 lambda = sqr(thetat) /
nu[celli] * dUsds[celli];
577 lambdaErr = mag(
lambda - lambda0);
579 maxIter = max(maxIter, ++iter);
583 ReThetat0[celli] = max(thetat * Us[celli] /
nu[celli], scalar(20));
589 <<
"Number of lambda iterations exceeds maxLambdaIter("
624 word stateName = modelStates[idxI];
625 if (stateName ==
"nut")
627 modelStates[idxI] =
"omega";
628 modelStates.append(
"k");
629 modelStates.append(
"ReThetat");
630 modelStates.append(
"gammaInt");
643 const volVectorField
U =
mesh_.thisDb().lookupObject<volVectorField>(
"U");
644 tmp<volTensorField> tgradU = fvc::grad(
U);
645 volScalarField S2(2 * magSqr(symm(tgradU())));
649 nut_.correctBoundaryConditions();
666 k_.correctBoundaryConditions();
694 omega_.correctBoundaryConditions();
708 if (
omega_.boundaryField()[patchI].type() ==
"omegaWallFunction"
709 and
omega_.boundaryField()[patchI].size() > 0)
711 const UList<label>& faceCells =
mesh_.boundaryMesh()[patchI].faceCells();
733 if (
omega_.boundaryField()[patchI].type() ==
"omegaWallFunction"
734 &&
omega_.boundaryField()[patchI].size() > 0)
736 const UList<label>& faceCells =
mesh_.boundaryMesh()[patchI].faceCells();
741 omega_.boundaryFieldRef()[patchI][faceI] =
omega_[faceCells[faceI]];
800 label stateConSize = stateCon.size();
804 forAll(stateCon[idxI], idxJ)
806 word conStateName = stateCon[idxI][idxJ];
807 if (conStateName ==
"nut")
809 stateCon[idxI][idxJ] =
"omega";
810 stateCon[idxI].append(
"k");
811 stateCon[idxI].append(
"ReThetat");
812 stateCon[idxI].append(
"gammaInt");
822 forAll(stateCon[idxI], idxJ)
824 word conStateName = stateCon[idxI][idxJ];
825 if (conStateName ==
"U")
832 stateCon[idxI].append(
"U");
837 if (idxI != stateConSize - 1)
840 forAll(stateCon[idxI + 1], idxJ)
842 word conStateName = stateCon[idxI + 1][idxJ];
843 if (conStateName ==
"U")
850 stateCon[idxI + 1].append(
"U");
856 "In DAStateInfo, nut shows in the largest connectivity level! "
857 "This is not supported!")
904 if (
mesh_.thisDb().foundObject<volScalarField>(
"p"))
908 else if (
mesh_.thisDb().foundObject<volScalarField>(
"p_rgh"))
915 "Neither p nor p_rgh was found in mesh.thisDb()!"
916 "addModelResidualCon failed to setup turbulence residuals!")
921 #ifdef IncompressibleFlow
925 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt",
"phi"},
926 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt"},
927 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt"}
932 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt",
"phi"},
933 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt"},
934 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt"}
940 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt",
"phi"},
941 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt"},
942 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt"}
948 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt",
"phi"},
949 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt"},
950 {
"U",
"omega",
"k",
"ReThetat",
"gammaInt"}
954 #ifdef CompressibleFlow
958 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt",
"phi"},
959 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt"},
960 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt"}
965 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt",
"phi"},
966 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt"},
967 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt"}
973 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt",
"phi"},
974 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt"},
975 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt"}
981 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt",
"phi"},
982 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt"},
983 {
"U",
"T", pName,
"omega",
"k",
"ReThetat",
"gammaInt"}
1001 dictionary dummyOptions;
1032 word divKScheme =
"div(phi,k)";
1033 word divOmegaScheme =
"div(phi,omega)";
1034 word divReThetatScheme =
"div(phi,ReThetat)";
1035 word divGammaIntScheme =
"div(phi,gammaInt)";
1041 isPC = options.getLabel(
"isPC");
1045 divKScheme =
"div(pc)";
1046 divOmegaScheme =
"div(pc)";
1047 divReThetatScheme =
"div(pc)";
1048 divGammaIntScheme =
"div(pc)";
1056 volScalarField::Internal divU(fvc::div(fvc::absolute(
phi_ / fvc::interpolate(rho_),
U_)));
1058 tmp<volTensorField> tgradU = fvc::grad(
U_);
1059 volScalarField S2(2 * magSqr(symm(tgradU())));
1060 volScalarField::Internal GbyNu0((tgradU() && dev(twoSymm(tgradU()))));
1061 volScalarField::Internal G(
"kOmegaSSTLM:G",
nut_ * GbyNu0);
1066 omega_.boundaryFieldRef().updateCoeffs();
1075 volScalarField CDkOmega(
1078 volScalarField
F1(this->
F1(CDkOmega));
1079 volScalarField
F23(this->
F23());
1083 volScalarField::Internal
gamma(this->
gamma(F1));
1084 volScalarField::Internal
beta(this->
beta(F1));
1087 tmp<fvScalarMatrix> omegaEqn(
1102 omegaEqn.ref().relax();
1103 omegaEqn.ref().boundaryManipulate(
omega_.boundaryFieldRef());
1110 SolverPerformance<scalar> solverOmega =
solve(omegaEqn);
1113 Info <<
"omega Initial residual: " << solverOmega.initialResidual() << endl
1114 <<
" Final residual: " << solverOmega.finalResidual() << endl;
1132 tmp<fvScalarMatrix> kEqn(
1137 - fvm::SuSp((2.0 / 3.0) *
phase_() * rho_() * divU,
k_)
1150 SolverPerformance<scalar> solverK =
solve(kEqn);
1153 Info <<
"k Initial residual: " << solverK.initialResidual() << endl
1154 <<
" Final residual: " << solverK.finalResidual() << endl;
1177 const tmp<volScalarField> tnu = this->
nu();
1178 const volScalarField::Internal&
nu = tnu()();
1179 const volScalarField::Internal& y =
y_();
1182 tmp<volTensorField> tgradULM = fvc::grad(
U_);
1183 const volScalarField::Internal Omega(sqrt(2 * magSqr(skew(tgradULM()()))));
1184 const volScalarField::Internal S(sqrt(2 * magSqr(symm(tgradULM()()))));
1185 const volScalarField::Internal Us(max(mag(
U_()),
deltaU_));
1186 const volScalarField::Internal dUsds((
U_() & (
U_() & tgradULM()())) / sqr(Us));
1192 const volScalarField::Internal t(500 *
nu / sqr(Us));
1193 const volScalarField::Internal Pthetat(
1197 tmp<fvScalarMatrix> ReThetatEqn(
1203 ReThetatEqn.ref().relax();
1210 SolverPerformance<scalar> solverReThetat =
solve(ReThetatEqn);
1213 Info <<
"ReThetat Initial residual: " << solverReThetat.initialResidual() << endl
1214 <<
" Final residual: " << solverReThetat.finalResidual() << endl;
1233 const volScalarField::Internal Rev(sqr(y) * S /
nu);
1234 const volScalarField::Internal RT(
k_() / (
nu *
omega_()));
1237 const volScalarField::Internal Pgamma(
1241 const volScalarField::Internal Fturb(exp(-pow4(0.25 * RT)));
1243 const volScalarField::Internal Egamma(
1247 tmp<fvScalarMatrix> gammaIntEqn(
1254 gammaIntEqn.ref().relax();
1261 SolverPerformance<scalar> solverGammaInt =
solve(gammaIntEqn);
1264 Info <<
"gammaInt Initial residual: " << solverGammaInt.initialResidual() << endl
1265 <<
" Final residual: " << solverGammaInt.finalResidual() << endl;
1270 const volScalarField::Internal Freattach(exp(-pow4(RT / 20.0)));
1271 const volScalarField::Internal gammaSep(
1272 min(2 * max(Rev / (3.235 *
ReThetac) - 1, scalar(0)) * Freattach, scalar(2))