BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / turbulenceModels / compressible / LES / oneEqEddy / oneEqEddy.C
blob10b069b449bd6cfc531abc263271b0b93ae2ba1e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "oneEqEddy.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 namespace Foam
33 namespace compressible
35 namespace LESModels
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(oneEqEddy, 0);
41 addToRunTimeSelectionTable(LESModel, oneEqEddy, dictionary);
43 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
45 void oneEqEddy::updateSubGridScaleFields()
47     muSgs_ = ck_*rho()*sqrt(k_)*delta();
48     muSgs_.correctBoundaryConditions();
50     alphaSgs_ = muSgs_/Prt_;
51     alphaSgs_.correctBoundaryConditions();
55 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
57 oneEqEddy::oneEqEddy
59     const volScalarField& rho,
60     const volVectorField& U,
61     const surfaceScalarField& phi,
62     const basicThermo& thermoPhysicalModel,
63     const word& turbulenceModelName,
64     const word& modelName
67     LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
68     GenEddyVisc(rho, U, phi, thermoPhysicalModel),
70     k_
71     (
72         IOobject
73         (
74             "k",
75             runTime_.timeName(),
76             mesh_,
77             IOobject::MUST_READ,
78             IOobject::AUTO_WRITE
79         ),
80         mesh_
81     ),
83     ck_
84     (
85         dimensioned<scalar>::lookupOrAddToDict
86         (
87             "ck",
88             coeffDict_,
89             0.094
90         )
91     )
93     updateSubGridScaleFields();
95     printCoeffs();
99 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
101 void oneEqEddy::correct(const tmp<volTensorField>& tgradU)
103     const volTensorField& gradU = tgradU();
105     GenEddyVisc::correct(gradU);
107     volScalarField divU(fvc::div(phi()/fvc::interpolate(rho())));
108     volScalarField G(2*muSgs_*(gradU && dev(symm(gradU))));
110     tmp<fvScalarMatrix> kEqn
111     (
112         fvm::ddt(rho(), k_)
113       + fvm::div(phi(), k_)
114       - fvm::laplacian(DkEff(), k_)
115      ==
116         G
117       - fvm::SuSp(2.0/3.0*rho()*divU, k_)
118       - fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_)
119     );
121     kEqn().relax();
122     kEqn().solve();
124     bound(k_, kMin_);
126     updateSubGridScaleFields();
130 bool oneEqEddy::read()
132     if (GenEddyVisc::read())
133     {
134         ck_.readIfPresent(coeffDict());
136         return true;
137     }
138     else
139     {
140         return false;
141     }
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 } // End namespace LESModels
148 } // End namespace compressible
149 } // End namespace Foam
151 // ************************************************************************* //