1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "PDRkEpsilon.H"
27 #include "PDRDragModel.H"
28 #include "addToRunTimeSelectionTable.H"
30 #include "backwardsCompatibilityWallFunctions.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace compressible
41 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 defineTypeNameAndDebug(PDRkEpsilon, 0);
44 addToRunTimeSelectionTable(RASModel, PDRkEpsilon, dictionary);
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 PDRkEpsilon::PDRkEpsilon
50 const volScalarField& rho,
51 const volVectorField& U,
52 const surfaceScalarField& phi,
53 const basicThermo& thermophysicalModel,
54 const word& turbulenceModelName,
58 kEpsilon(rho, U, phi, thermophysicalModel, turbulenceModelName, modelName),
62 dimensioned<scalar>::lookupOrAddToDict
72 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
74 PDRkEpsilon::~PDRkEpsilon()
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 bool PDRkEpsilon::read()
84 C4_.readIfPresent(coeffDict_);
94 void PDRkEpsilon::correct()
98 // Re-calculate viscosity
99 mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
100 mut_.correctBoundaryConditions();
102 // Re-calculate thermal diffusivity
104 alphat_.correctBoundaryConditions();
111 volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_)));
115 divU += fvc::div(mesh_.phi());
118 tmp<volTensorField> tgradU = fvc::grad(U_);
119 volScalarField G("RASModel::G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
122 // Update espsilon and G at the wall
123 epsilon_.boundaryField().updateCoeffs();
125 // Add the blockage generation term so that it is included consistently
126 // in both the k and epsilon equations
127 const volScalarField& betav =
128 U_.db().lookupObject<volScalarField>("betav");
130 const volScalarField& Lobs =
131 U_.db().lookupObject<volScalarField>("Lobs");
133 const PDRDragModel& drag =
134 U_.db().lookupObject<PDRDragModel>("PDRDragModel");
136 volScalarField GR(drag.Gk());
139 (C4_*(Lobs + dimensionedScalar("minLength", dimLength, VSMALL)));
141 // Dissipation equation
142 tmp<fvScalarMatrix> epsEqn
144 betav*fvm::ddt(rho_, epsilon_)
145 + fvm::div(phi_, epsilon_)
146 - fvm::laplacian(DepsilonEff(), epsilon_)
148 C1_*betav*G*epsilon_/k_
149 + 1.5*pow(Cmu_, 3.0/4.0)*GR*sqrt(k_)/LI
150 - fvm::SuSp(((2.0/3.0)*C1_)*betav*rho_*divU, epsilon_)
151 - fvm::Sp(C2_*betav*rho_*epsilon_/k_, epsilon_)
156 epsEqn().boundaryManipulate(epsilon_.boundaryField());
159 bound(epsilon_, epsilonMin_);
162 // Turbulent kinetic energy equation
164 tmp<fvScalarMatrix> kEqn
166 betav*fvm::ddt(rho_, k_)
168 - fvm::laplacian(DkEff(), k_)
171 - fvm::SuSp((2.0/3.0)*betav*rho_*divU, k_)
172 - fvm::Sp(betav*rho_*epsilon_/k_, k_)
179 // Re-calculate viscosity
180 mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
181 mut_.correctBoundaryConditions();
183 // Re-calculate thermal diffusivity
185 alphat_.correctBoundaryConditions();
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 } // End namespace RASModels
192 } // End namespace compressible
193 } // End namespace Foam
195 // ************************************************************************* //