initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / turbulenceModels / incompressible / LES / GenEddyVisc / GenEddyVisc.C
blob96ca79245db39053b376a1cd115946e8d93f8008
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 "GenEddyVisc.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 namespace Foam
33 namespace incompressible
35 namespace LESModels
38 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
40 GenEddyVisc::GenEddyVisc
42     const volVectorField& U,
43     const surfaceScalarField& phi,
44     transportModel& transport
47     LESModel(word("GenEddyVisc"), U, phi, transport),
49     ce_
50     (
51         dimensioned<scalar>::lookupOrAddToDict
52         (
53             "ce",
54             coeffDict_,
55             1.048
56         )
57     ),
59     nuSgs_
60     (
61         IOobject
62         (
63             "nuSgs",
64             runTime_.timeName(),
65             mesh_,
66             IOobject::MUST_READ,
67             IOobject::AUTO_WRITE
68         ),
69         mesh_
70     )
72 //    printCoeffs();
76 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
78 tmp<volSymmTensorField> GenEddyVisc::B() const
80     return ((2.0/3.0)*I)*k() - nuSgs_*twoSymm(fvc::grad(U()));
84 tmp<volSymmTensorField> GenEddyVisc::devBeff() const
86     return -nuEff()*dev(twoSymm(fvc::grad(U())));
90 tmp<fvVectorMatrix> GenEddyVisc::divDevBeff(volVectorField& U) const
92     return
93     (
94       - fvm::laplacian(nuEff(), U) - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
95     );
99 void GenEddyVisc::correct(const tmp<volTensorField>& gradU)
101     LESModel::correct(gradU);
105 bool GenEddyVisc::read()
107     if (LESModel::read())
108     {
109         ce_.readIfPresent(coeffDict());
111         return true;
112     }
113     else
114     {
115         return false;
116     }
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 } // End namespace LESModels
123 } // End namespace incompressible
124 } // End namespace Foam
126 // ************************************************************************* //