FreeFOAM The Cross-Platform CFD Toolkit
DeardorffDiffStress.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 "DeardorffDiffStress.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace compressible
34 {
35 namespace LESModels
36 {
37 
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 
42 
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
46 void DeardorffDiffStress::updateSubGridScaleFields(const volScalarField& K)
47 {
48  muSgs_ = ck_*rho()*sqrt(K)*delta();
49  muSgs_.correctBoundaryConditions();
50 
51  alphaSgs_ = muSgs_/Prt_;
52  alphaSgs_.correctBoundaryConditions();
53 }
54 
55 
56 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
57 
58 DeardorffDiffStress::DeardorffDiffStress
59 (
60  const volScalarField& rho,
61  const volVectorField& U,
62  const surfaceScalarField& phi,
63  const basicThermo& thermoPhysicalModel
64 )
65 :
66  LESModel(typeName, rho, U, phi, thermoPhysicalModel),
67  GenSGSStress(rho, U, phi, thermoPhysicalModel),
68 
69  ck_
70  (
72  (
73  "ck",
74  coeffDict_,
75  0.094
76  )
77  ),
78  cm_
79  (
81  (
82  "cm",
83  coeffDict_,
84  4.13
85  )
86  )
87 {
88  updateSubGridScaleFields(0.5*tr(B_));
89 
90  printCoeffs();
91 }
92 
93 
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 
97 {
98  const volTensorField& gradU = tgradU();
99 
100  GenSGSStress::correct(gradU);
101 
102  volSymmTensorField D = symm(gradU);
103 
104  volSymmTensorField P = -rho()*twoSymm(B_ & gradU);
105 
106  volScalarField K = 0.5*tr(B_);
107 
108  solve
109  (
110  fvm::ddt(rho(), B_)
111  + fvm::div(phi(), B_)
112  - fvm::laplacian(DBEff(), B_)
113  + fvm::Sp(cm_*rho()*sqrt(K)/delta(), B_)
114  ==
115  P
116  + 0.8*rho()*K*D
117  - (2*ce_ - 0.667*cm_)*I*rho()*epsilon()
118  );
119 
120 
121  // Bounding the component kinetic energies
122 
123  forAll(B_, celli)
124  {
125  B_[celli].component(symmTensor::XX) =
126  max(B_[celli].component(symmTensor::XX), 1.0e-10);
127  B_[celli].component(symmTensor::YY) =
128  max(B_[celli].component(symmTensor::YY), 1.0e-10);
129  B_[celli].component(symmTensor::ZZ) =
130  max(B_[celli].component(symmTensor::ZZ), 1.0e-10);
131  }
132 
133  K = 0.5*tr(B_);
134  bound(K, k0());
135 
136  updateSubGridScaleFields(K);
137 }
138 
139 
140 bool DeardorffDiffStress::read()
141 {
142  if (GenSGSStress::read())
143  {
144  ck_.readIfPresent(coeffDict());
145  cm_.readIfPresent(coeffDict());
146 
147  return true;
148  }
149  else
150  {
151  return false;
152  }
153 }
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace LESModels
159 } // End namespace compressible
160 } // End namespace Foam
161 
162 // ************************ vim: set sw=4 sts=4 et: ************************ //