FreeFOAM The Cross-Platform CFD Toolkit
oneEqEddy.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 
26 #include "oneEqEddy.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace compressible
34 {
35 namespace LESModels
36 {
37 
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 
40 defineTypeNameAndDebug(oneEqEddy, 0);
41 addToRunTimeSelectionTable(LESModel, oneEqEddy, dictionary);
42 
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
44 
45 void oneEqEddy::updateSubGridScaleFields()
46 {
47  muSgs_ = ck_*rho()*sqrt(k_)*delta();
48  muSgs_.correctBoundaryConditions();
49 
50  alphaSgs_ = muSgs_/Prt_;
51  alphaSgs_.correctBoundaryConditions();
52 }
53 
54 
55 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
56 
57 oneEqEddy::oneEqEddy
58 (
59  const volScalarField& rho,
60  const volVectorField& U,
61  const surfaceScalarField& phi,
62  const basicThermo& thermoPhysicalModel
63 )
64 :
65  LESModel(typeName, rho, U, phi, thermoPhysicalModel),
66  GenEddyVisc(rho, U, phi, thermoPhysicalModel),
67 
68  ck_
69  (
71  (
72  "ck",
73  coeffDict_,
74  0.094
75  )
76  )
77 {
78  updateSubGridScaleFields();
79 
80  printCoeffs();
81 }
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
87 {
88  const volTensorField& gradU = tgradU();
89 
90  GenEddyVisc::correct(gradU);
91 
93  volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU)));
94 
95  fvScalarMatrix kEqn
96  (
97  fvm::ddt(rho(), k_)
98  + fvm::div(phi(), k_)
99  - fvm::laplacian(DkEff(), k_)
100  ==
101  G
102  - fvm::SuSp(2.0/3.0*rho()*divU, k_)
103  - fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_)
104  );
105 
106  kEqn.relax();
107  kEqn.solve();
108 
109  bound(k_, k0());
110 
111  updateSubGridScaleFields();
112 }
113 
114 
115 bool oneEqEddy::read()
116 {
117  if (GenEddyVisc::read())
118  {
119  ck_.readIfPresent(coeffDict());
120 
121  return true;
122  }
123  else
124  {
125  return false;
126  }
127 }
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace LESModels
133 } // End namespace compressible
134 } // End namespace Foam
135 
136 // ************************ vim: set sw=4 sts=4 et: ************************ //