00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "LaunderGibsonRSTM.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "wallFvPatch.H"
00030
00031 #include "backwardsCompatibilityWallFunctions.H"
00032
00033
00034
00035 namespace Foam
00036 {
00037 namespace incompressible
00038 {
00039 namespace RASModels
00040 {
00041
00042
00043
00044 defineTypeNameAndDebug(LaunderGibsonRSTM, 0);
00045 addToRunTimeSelectionTable(RASModel, LaunderGibsonRSTM, dictionary);
00046
00047
00048
00049 LaunderGibsonRSTM::LaunderGibsonRSTM
00050 (
00051 const volVectorField& U,
00052 const surfaceScalarField& phi,
00053 transportModel& lamTransportModel
00054 )
00055 :
00056 RASModel(typeName, U, phi, lamTransportModel),
00057
00058 Cmu_
00059 (
00060 dimensioned<scalar>::lookupOrAddToDict
00061 (
00062 "Cmu",
00063 coeffDict_,
00064 0.09
00065 )
00066 ),
00067 kappa_
00068 (
00069 dimensioned<scalar>::lookupOrAddToDict
00070 (
00071 "kappa",
00072 coeffDict_,
00073 0.41
00074 )
00075 ),
00076 Clg1_
00077 (
00078 dimensioned<scalar>::lookupOrAddToDict
00079 (
00080 "Clg1",
00081 coeffDict_,
00082 1.8
00083 )
00084 ),
00085 Clg2_
00086 (
00087 dimensioned<scalar>::lookupOrAddToDict
00088 (
00089 "Clg2",
00090 coeffDict_,
00091 0.6
00092 )
00093 ),
00094 C1_
00095 (
00096 dimensioned<scalar>::lookupOrAddToDict
00097 (
00098 "C1",
00099 coeffDict_,
00100 1.44
00101 )
00102 ),
00103 C2_
00104 (
00105 dimensioned<scalar>::lookupOrAddToDict
00106 (
00107 "C2",
00108 coeffDict_,
00109 1.92
00110 )
00111 ),
00112 Cs_
00113 (
00114 dimensioned<scalar>::lookupOrAddToDict
00115 (
00116 "Cs",
00117 coeffDict_,
00118 0.25
00119 )
00120 ),
00121 Ceps_
00122 (
00123 dimensioned<scalar>::lookupOrAddToDict
00124 (
00125 "Ceps",
00126 coeffDict_,
00127 0.15
00128 )
00129 ),
00130 sigmaR_
00131 (
00132 dimensioned<scalar>::lookupOrAddToDict
00133 (
00134 "sigmaR",
00135 coeffDict_,
00136 0.81967
00137 )
00138 ),
00139 sigmaEps_
00140 (
00141 dimensioned<scalar>::lookupOrAddToDict
00142 (
00143 "sigmaEps",
00144 coeffDict_,
00145 1.3
00146 )
00147 ),
00148 C1Ref_
00149 (
00150 dimensioned<scalar>::lookupOrAddToDict
00151 (
00152 "C1Ref",
00153 coeffDict_,
00154 0.5
00155 )
00156 ),
00157 C2Ref_
00158 (
00159 dimensioned<scalar>::lookupOrAddToDict
00160 (
00161 "C2Ref",
00162 coeffDict_,
00163 0.3
00164 )
00165 ),
00166 couplingFactor_
00167 (
00168 dimensioned<scalar>::lookupOrAddToDict
00169 (
00170 "couplingFactor",
00171 coeffDict_,
00172 0.0
00173 )
00174 ),
00175
00176 yr_(mesh_),
00177
00178 R_
00179 (
00180 IOobject
00181 (
00182 "R",
00183 runTime_.timeName(),
00184 mesh_,
00185 IOobject::NO_READ,
00186 IOobject::AUTO_WRITE
00187 ),
00188 autoCreateR("R", mesh_)
00189 ),
00190 k_
00191 (
00192 IOobject
00193 (
00194 "k",
00195 runTime_.timeName(),
00196 mesh_,
00197 IOobject::NO_READ,
00198 IOobject::AUTO_WRITE
00199 ),
00200 autoCreateK("k", mesh_)
00201 ),
00202 epsilon_
00203 (
00204 IOobject
00205 (
00206 "epsilon",
00207 runTime_.timeName(),
00208 mesh_,
00209 IOobject::NO_READ,
00210 IOobject::AUTO_WRITE
00211 ),
00212 autoCreateEpsilon("epsilon", mesh_)
00213 ),
00214 nut_
00215 (
00216 IOobject
00217 (
00218 "nut",
00219 runTime_.timeName(),
00220 mesh_,
00221 IOobject::NO_READ,
00222 IOobject::AUTO_WRITE
00223 ),
00224 autoCreateNut("nut", mesh_)
00225 )
00226 {
00227 nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
00228 nut_.correctBoundaryConditions();
00229
00230 if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
00231 {
00232 FatalErrorIn
00233 (
00234 "LaunderGibsonRSTM::LaunderGibsonRSTM"
00235 "(const volVectorField& U, const surfaceScalarField& phi,"
00236 "transportModel& lamTransportModel)"
00237 ) << "couplingFactor = " << couplingFactor_
00238 << " is not in range 0 - 1" << nl
00239 << exit(FatalError);
00240 }
00241
00242 printCoeffs();
00243 }
00244
00245
00246
00247
00248 tmp<volSymmTensorField> LaunderGibsonRSTM::devReff() const
00249 {
00250 return tmp<volSymmTensorField>
00251 (
00252 new volSymmTensorField
00253 (
00254 IOobject
00255 (
00256 "devRhoReff",
00257 runTime_.timeName(),
00258 mesh_,
00259 IOobject::NO_READ,
00260 IOobject::NO_WRITE
00261 ),
00262 R_ - nu()*dev(twoSymm(fvc::grad(U_)))
00263 )
00264 );
00265 }
00266
00267
00268 tmp<fvVectorMatrix> LaunderGibsonRSTM::divDevReff(volVectorField& U) const
00269 {
00270 if (couplingFactor_.value() > 0.0)
00271 {
00272 return
00273 (
00274 fvc::div(R_ + couplingFactor_*nut_*fvc::grad(U), "div(R)")
00275 + fvc::laplacian((1.0-couplingFactor_)*nut_, U, "laplacian(nuEff,U)")
00276 - fvm::laplacian(nuEff(), U)
00277 );
00278 }
00279 else
00280 {
00281 return
00282 (
00283 fvc::div(R_)
00284 + fvc::laplacian(nut_, U, "laplacian(nuEff,U)")
00285 - fvm::laplacian(nuEff(), U)
00286 );
00287 }
00288 }
00289
00290
00291 bool LaunderGibsonRSTM::read()
00292 {
00293 if (RASModel::read())
00294 {
00295 Cmu_.readIfPresent(coeffDict());
00296 Clg1_.readIfPresent(coeffDict());
00297 Clg2_.readIfPresent(coeffDict());
00298 C1_.readIfPresent(coeffDict());
00299 C2_.readIfPresent(coeffDict());
00300 Cs_.readIfPresent(coeffDict());
00301 Ceps_.readIfPresent(coeffDict());
00302 sigmaR_.readIfPresent(coeffDict());
00303 sigmaEps_.readIfPresent(coeffDict());
00304 C1Ref_.readIfPresent(coeffDict());
00305 C2Ref_.readIfPresent(coeffDict());
00306
00307 couplingFactor_.readIfPresent(coeffDict());
00308
00309 if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
00310 {
00311 FatalErrorIn("LaunderGibsonRSTM::read()")
00312 << "couplingFactor = " << couplingFactor_
00313 << " is not in range 0 - 1"
00314 << exit(FatalError);
00315 }
00316
00317 return true;
00318 }
00319 else
00320 {
00321 return false;
00322 }
00323 }
00324
00325
00326 void LaunderGibsonRSTM::correct()
00327 {
00328 RASModel::correct();
00329
00330 if (!turbulence_)
00331 {
00332 return;
00333 }
00334
00335 if (mesh_.changing())
00336 {
00337 yr_.correct();
00338 }
00339
00340 volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
00341 volScalarField G("RASModel::G", 0.5*mag(tr(P)));
00342
00343
00344 epsilon_.boundaryField().updateCoeffs();
00345
00346
00347 tmp<fvScalarMatrix> epsEqn
00348 (
00349 fvm::ddt(epsilon_)
00350 + fvm::div(phi_, epsilon_)
00351 - fvm::Sp(fvc::div(phi_), epsilon_)
00352
00353 - fvm::laplacian(DepsilonEff(), epsilon_)
00354 ==
00355 C1_*G*epsilon_/k_
00356 - fvm::Sp(C2_*epsilon_/k_, epsilon_)
00357 );
00358
00359 epsEqn().relax();
00360
00361 epsEqn().boundaryManipulate(epsilon_.boundaryField());
00362
00363 solve(epsEqn);
00364 bound(epsilon_, epsilon0_);
00365
00366
00367
00368
00369 const fvPatchList& patches = mesh_.boundary();
00370
00371 forAll(patches, patchi)
00372 {
00373 const fvPatch& curPatch = patches[patchi];
00374
00375 if (typeid(curPatch) == typeid(wallFvPatch))
00376 {
00377 forAll(curPatch, facei)
00378 {
00379 label faceCelli = curPatch.faceCells()[facei];
00380 P[faceCelli] *=
00381 min(G[faceCelli]/(0.5*mag(tr(P[faceCelli])) + SMALL), 1.0);
00382 }
00383 }
00384 }
00385
00386 volSymmTensorField reflect = C1Ref_*epsilon_/k_*R_ - C2Ref_*Clg2_*dev(P);
00387
00388 tmp<fvSymmTensorMatrix> REqn
00389 (
00390 fvm::ddt(R_)
00391 + fvm::div(phi_, R_)
00392 - fvm::Sp(fvc::div(phi_), R_)
00393
00394 - fvm::laplacian(DREff(), R_)
00395 + fvm::Sp(Clg1_*epsilon_/k_, R_)
00396 ==
00397 P
00398 + (2.0/3.0*(Clg1_ - 1)*I)*epsilon_
00399 - Clg2_*dev(P)
00400
00401
00402 + symm
00403 (
00404 I*((yr_.n() & reflect) & yr_.n())
00405 - 1.5*(yr_.n()*(reflect & yr_.n())
00406 + (yr_.n() & reflect)*yr_.n())
00407 )*pow(Cmu_, 0.75)*pow(k_, 1.5)/(kappa_*yr_*epsilon_)
00408 );
00409
00410 REqn().relax();
00411 solve(REqn);
00412
00413 R_.max
00414 (
00415 dimensionedSymmTensor
00416 (
00417 "zero",
00418 R_.dimensions(),
00419 symmTensor
00420 (
00421 k0_.value(), -GREAT, -GREAT,
00422 k0_.value(), -GREAT,
00423 k0_.value()
00424 )
00425 )
00426 );
00427
00428 k_ == 0.5*tr(R_);
00429 bound(k_, k0_);
00430
00431
00432
00433 nut_ = Cmu_*sqr(k_)/epsilon_;
00434 nut_.correctBoundaryConditions();
00435
00436
00437
00438
00439 forAll(patches, patchi)
00440 {
00441 const fvPatch& curPatch = patches[patchi];
00442
00443 if (typeid(curPatch) == typeid(wallFvPatch))
00444 {
00445 symmTensorField& Rw = R_.boundaryField()[patchi];
00446
00447 const scalarField& nutw = nut_.boundaryField()[patchi];
00448
00449 vectorField snGradU = U_.boundaryField()[patchi].snGrad();
00450
00451 const vectorField& faceAreas
00452 = mesh_.Sf().boundaryField()[patchi];
00453
00454 const scalarField& magFaceAreas
00455 = mesh_.magSf().boundaryField()[patchi];
00456
00457 forAll(curPatch, facei)
00458 {
00459
00460 tensor gradUw
00461 = (faceAreas[facei]/magFaceAreas[facei])*snGradU[facei];
00462
00463
00464 tensor tauw = -nutw[facei]*2*symm(gradUw);
00465
00466
00467 Rw[facei].xy() = tauw.xy();
00468 Rw[facei].xz() = tauw.xz();
00469 Rw[facei].yz() = tauw.yz();
00470 }
00471 }
00472 }
00473 }
00474
00475
00476
00477
00478 }
00479 }
00480 }
00481
00482