Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / turbulenceModels / compressible / LES / GenSGSStress / GenSGSStress.C
blob18a6bde24c1caaafef6b7244039ce713eac0fec4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 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
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 "GenSGSStress.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 namespace Foam
32 namespace compressible
34 namespace LESModels
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 defineTypeNameWithName(GenSGSStress, "GenSGSStress");
42 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
44 GenSGSStress::GenSGSStress
46     const volScalarField& rho,
47     const volVectorField& U,
48     const surfaceScalarField& phi,
49     const basicThermo& thermoPhysicalModel,
50     const word& turbulenceModelName,
51     const word& modelName
54     LESModel(modelName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
56     ce_
57     (
58         dimensioned<scalar>::lookupOrAddToDict
59         (
60             "ce",
61             coeffDict_,
62             1.048
63         )
64     ),
66     Prt_
67     (
68         dimensioned<scalar>::lookupOrAddToDict
69         (
70             "Prt",
71             coeffDict_,
72             1.0
73         )
74     ),
76     B_
77     (
78         IOobject
79         (
80             "B",
81             runTime_.timeName(),
82             mesh_,
83             IOobject::MUST_READ,
84             IOobject::AUTO_WRITE
85         ),
86         mesh_
87     ),
89     muSgs_
90     (
91         IOobject
92         (
93             "muSgs",
94             runTime_.timeName(),
95             mesh_,
96             IOobject::MUST_READ,
97             IOobject::AUTO_WRITE
98         ),
99         mesh_
100     ),
102     alphaSgs_
103     (
104         IOobject
105         (
106             "alphaSgs",
107             runTime_.timeName(),
108             mesh_,
109             IOobject::MUST_READ,
110             IOobject::AUTO_WRITE
111         ),
112         mesh_
113     )
117 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
119 tmp<volSymmTensorField> GenSGSStress::devRhoBeff() const
121     return tmp<volSymmTensorField>
122     (
123         new volSymmTensorField
124         (
125             IOobject
126             (
127                 "devRhoReff",
128                 runTime_.timeName(),
129                 mesh_,
130                 IOobject::NO_READ,
131                 IOobject::NO_WRITE
132             ),
133             rho()*B_ - mu()*dev(twoSymm(fvc::grad(U())))
134         )
135     );
139 tmp<fvVectorMatrix> GenSGSStress::divDevRhoBeff(volVectorField& U) const
141     return
142     (
143         fvc::div(rho()*B_ + 0.05*muSgs_*fvc::grad(U))
144       + fvc::laplacian(0.95*muSgs_, U, "laplacian(muEff,U)")
145       - fvm::laplacian(muEff(), U)
146       - fvc::div(mu()*dev2(T(fvc::grad(U))))
147     );
151 void GenSGSStress::correct(const tmp<volTensorField>& gradU)
153     LESModel::correct(gradU);
157 bool GenSGSStress::read()
159     if (LESModel::read())
160     {
161         ce_.readIfPresent(coeffDict());
163         return true;
164     }
165     else
166     {
167         return false;
168     }
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 } // End namespace LESModels
175 } // End namespace compressible
176 } // End namespace Foam
178 // ************************************************************************* //