FreeFOAM The Cross-Platform CFD Toolkit
GenEddyVisc.C
Go to the documentation of this file.
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.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 namespace compressible
33 {
34 namespace LESModels
35 {
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
39 GenEddyVisc::GenEddyVisc
40 (
41  const volScalarField& rho,
42  const volVectorField& U,
43  const surfaceScalarField& phi,
44  const basicThermo& thermoPhysicalModel
45 )
46 :
47  LESModel
48  (
49  word("GenEddyVisc"), rho, U, phi, thermoPhysicalModel
50  ),
51 
52  ce_
53  (
55  (
56  "ce",
57  coeffDict_,
58  1.048
59  )
60  ),
61 
62  Prt_
63  (
65  (
66  "Prt",
67  coeffDict_,
68  1.0
69  )
70  ),
71 
72  k_
73  (
74  IOobject
75  (
76  "k",
77  runTime_.timeName(),
78  mesh_,
81  ),
82  mesh_
83  ),
84 
85  muSgs_
86  (
87  IOobject
88  (
89  "muSgs",
90  runTime_.timeName(),
91  mesh_,
94  ),
95  mesh_
96  ),
97 
98  alphaSgs_
99  (
100  IOobject
101  (
102  "alphaSgs",
103  runTime_.timeName(),
104  mesh_,
107  ),
108  mesh_
109  )
110 {}
111 
112 
113 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 
115 tmp<volSymmTensorField> GenEddyVisc::B() const
116 {
117  return ((2.0/3.0)*I)*k_ - (muSgs_/rho())*dev(twoSymm(fvc::grad(U())));
118 }
119 
120 
121 tmp<volSymmTensorField> GenEddyVisc::devRhoBeff() const
122 {
123  return -muEff()*dev(twoSymm(fvc::grad(U())));
124 }
125 
126 
127 tmp<fvVectorMatrix> GenEddyVisc::divDevRhoBeff(volVectorField& U) const
128 {
129  return
130  (
131  - fvm::laplacian(muEff(), U) - fvc::div(muEff()*dev2(fvc::grad(U)().T()))
132  );
133 }
134 
135 
137 {
138  LESModel::correct(gradU);
139 }
140 
141 
142 bool GenEddyVisc::read()
143 {
144  if (LESModel::read())
145  {
146  ce_.readIfPresent(coeffDict());
147  Prt_.readIfPresent(coeffDict());
148 
149  return true;
150  }
151  else
152  {
153  return false;
154  }
155 }
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace LESModels
161 } // End namespace compressible
162 } // End namespace Foam
163 
164 // ************************ vim: set sw=4 sts=4 et: ************************ //