initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / turbulenceModels / compressible / LES / GenSGSStress / GenSGSStress.C
blob1f4e57552739e65b30524ec0eb769148bd214781
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "GenSGSStress.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 namespace Foam
33 namespace compressible
35 namespace LESModels
38 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
40 GenSGSStress::GenSGSStress
42     const volScalarField& rho,
43     const volVectorField& U,
44     const surfaceScalarField& phi,
45     const basicThermo& thermoPhysicalModel
48     LESModel
49     (
50         word("GenSGSStress"),
51         rho,
52         U,
53         phi,
54         thermoPhysicalModel
55     ),
57     ce_
58     (
59         dimensioned<scalar>::lookupOrAddToDict
60         (
61             "ce",
62             coeffDict_,
63             1.048
64         )
65     ),
67     Prt_
68     (
69         dimensioned<scalar>::lookupOrAddToDict
70         (
71             "Prt",
72             coeffDict_,
73             1.0
74         )
75     ),
77     B_
78     (
79         IOobject
80         (
81             "B",
82             runTime_.timeName(),
83             mesh_,
84             IOobject::MUST_READ,
85             IOobject::AUTO_WRITE
86         ),
87         mesh_
88     ),
90     muSgs_
91     (
92         IOobject
93         (
94             "muSgs",
95             runTime_.timeName(),
96             mesh_,
97             IOobject::MUST_READ,
98             IOobject::AUTO_WRITE
99         ),
100         mesh_
101     ),
103     alphaSgs_
104     (
105         IOobject
106         (
107             "alphaSgs",
108             runTime_.timeName(),
109             mesh_,
110             IOobject::MUST_READ,
111             IOobject::AUTO_WRITE
112         ),
113         mesh_
114     )
118 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
120 tmp<volSymmTensorField> GenSGSStress::devRhoBeff() const
122     return tmp<volSymmTensorField>
123     (
124         new volSymmTensorField
125         (
126             IOobject
127             (
128                 "devRhoReff",
129                 runTime_.timeName(),
130                 mesh_,
131                 IOobject::NO_READ,
132                 IOobject::NO_WRITE
133             ),
134             rho()*B_ - mu()*dev(twoSymm(fvc::grad(U())))
135         )
136     );
140 tmp<fvVectorMatrix> GenSGSStress::divDevRhoBeff(volVectorField& U) const
142     return
143     (
144         fvc::div(rho()*B_ + 0.05*muSgs_*fvc::grad(U))
145       + fvc::laplacian(0.95*muSgs_, U, "laplacian(muEff,U)")
146       - fvm::laplacian(muEff(), U)
147       - fvc::div(mu()*dev2(fvc::grad(U)().T()))
148     );
152 void GenSGSStress::correct(const tmp<volTensorField>& gradU)
154     LESModel::correct(gradU);
158 bool GenSGSStress::read()
160     if (LESModel::read())
161     {
162         ce_.readIfPresent(coeffDict());
164         return true;
165     }
166     else
167     {
168         return false;
169     }
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 } // End namespace LESModels
176 } // End namespace compressible
177 } // End namespace Foam
179 // ************************************************************************* //