ENH: patchCloud: return pTraits<Type>::max for unfound points
[OpenFOAM-1.7.x.git] / src / turbulenceModels / compressible / LES / GenEddyVisc / GenEddyVisc.C
blob70e8b1426f959c4dfbeabf84ad5c80510de9bb93
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-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 "GenEddyVisc.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 namespace Foam
32 namespace compressible
34 namespace LESModels
37 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
39 GenEddyVisc::GenEddyVisc
41     const volScalarField& rho,
42     const volVectorField& U,
43     const surfaceScalarField& phi,
44     const basicThermo& thermoPhysicalModel
47     LESModel
48     (
49         word("GenEddyVisc"), rho, U, phi, thermoPhysicalModel
50     ),
52     ce_
53     (
54         dimensioned<scalar>::lookupOrAddToDict
55         (
56             "ce",
57             coeffDict_,
58             1.048
59         )
60     ),
62     Prt_
63     (
64         dimensioned<scalar>::lookupOrAddToDict
65         (
66             "Prt",
67             coeffDict_,
68             1.0
69         )
70     ),
72     k_
73     (
74         IOobject
75         (
76             "k",
77             runTime_.timeName(),
78             mesh_,
79             IOobject::MUST_READ,
80             IOobject::AUTO_WRITE
81         ),
82         mesh_
83     ),
85     muSgs_
86     (
87         IOobject
88         (
89             "muSgs",
90             runTime_.timeName(),
91             mesh_,
92             IOobject::MUST_READ,
93             IOobject::AUTO_WRITE
94         ),
95         mesh_
96     ),
98     alphaSgs_
99     (
100         IOobject
101         (
102             "alphaSgs",
103             runTime_.timeName(),
104             mesh_,
105             IOobject::MUST_READ,
106             IOobject::AUTO_WRITE
107         ),
108         mesh_
109     )
113 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
115 tmp<volSymmTensorField> GenEddyVisc::B() const
117     return ((2.0/3.0)*I)*k_ - (muSgs_/rho())*dev(twoSymm(fvc::grad(U())));
121 tmp<volSymmTensorField> GenEddyVisc::devRhoBeff() const
123     return -muEff()*dev(twoSymm(fvc::grad(U())));
127 tmp<fvVectorMatrix> GenEddyVisc::divDevRhoBeff(volVectorField& U) const
129     return
130     (
131       - fvm::laplacian(muEff(), U) - fvc::div(muEff()*dev2(fvc::grad(U)().T()))
132     );
136 void GenEddyVisc::correct(const tmp<volTensorField>& gradU)
138     LESModel::correct(gradU);
142 bool GenEddyVisc::read()
144     if (LESModel::read())
145     {
146         ce_.readIfPresent(coeffDict());
147         Prt_.readIfPresent(coeffDict());
149         return true;
150     }
151     else
152     {
153         return false;
154     }
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 } // End namespace LESModels
161 } // End namespace compressible
162 } // End namespace Foam
164 // ************************************************************************* //