Merge commit 'd3b269b7c6ffa0cd68845adfecdfb849316dba71' into nextRelease
[foam-extend-3.2.git] / src / turbulenceModels / compressible / LES / GenSGSStress / GenSGSStress.C
blobf8b6a9ef1abe5557a38a3844b524f9ef3075d5f4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     |
5     \\  /    A nd           | For copyright notice see file Copyright
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "GenSGSStress.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 namespace Foam
32 namespace compressible
34 namespace LESModels
37 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
39 GenSGSStress::GenSGSStress
41     const volScalarField& rho,
42     const volVectorField& U,
43     const surfaceScalarField& phi,
44     const basicThermo& thermoPhysicalModel
47     LESModel
48     (
49         word("GenSGSStress"),
50         rho,
51         U,
52         phi,
53         thermoPhysicalModel
54     ),
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             U_.db(),
83             IOobject::MUST_READ,
84             IOobject::AUTO_WRITE
85         ),
86         mesh_
87     ),
89     muSgs_
90     (
91         IOobject
92         (
93             "muSgs",
94             runTime_.timeName(),
95             U_.db(),
96             IOobject::MUST_READ,
97             IOobject::AUTO_WRITE
98         ),
99         mesh_
100     ),
102     alphaSgs_
103     (
104         IOobject
105         (
106             "alphaSgs",
107             runTime_.timeName(),
108             U_.db(),
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                 U_.db(),
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(fvc::grad(U)().T()))
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 // ************************************************************************* //