initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / turbulenceModels / LES / compressible / DeardorffDiffStress / DeardorffDiffStress.C
blob28f31e7164f01d7536356324d7407db526323eb5
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 "DeardorffDiffStress.H"
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
34 namespace compressible
36 namespace LESModels
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 defineTypeNameAndDebug(DeardorffDiffStress, 0);
42 addToRunTimeSelectionTable(LESModel, DeardorffDiffStress, dictionary);
44 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
46 // from components
47 DeardorffDiffStress::DeardorffDiffStress
49     const volScalarField& rho,
50     const volVectorField& U,
51     const surfaceScalarField& phi,
52     const basicThermo& thermoPhysicalModel
55     LESModel(typeName, rho, U, phi, thermoPhysicalModel),
56     GenSGSStress(rho, U, phi, thermoPhysicalModel),
58     ck_
59     (
60         dimensioned<scalar>::lookupOrAddToDict
61         (
62             "ck",
63             coeffDict(),
64             0.094
65         )
66     ),
67     cm_
68     (
69         dimensioned<scalar>::lookupOrAddToDict
70         (
71             "cm",
72             coeffDict(),
73             4.13
74         )
75     )
77     printCoeffs();
81 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
83 void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
85     const volTensorField& gradU = tgradU();
87     GenSGSStress::correct(gradU);
89     volSymmTensorField D = symm(gradU);
91     volSymmTensorField P = -rho()*twoSymm(B_ & gradU);
93     volScalarField K = 0.5*tr(B_);
95     solve
96     (
97         fvm::ddt(rho(), B_)
98       + fvm::div(phi(), B_)
99       - fvm::laplacian(DBEff(), B_)
100       + fvm::Sp(cm_*rho()*sqrt(K)/delta(), B_)
101      ==
102         P
103       + 0.8*rho()*K*D
104       - (2*ce_ - 0.667*cm_)*I*rho()*epsilon()
105     );
108     // Bounding the component kinetic energies
110     forAll(B_, celli)
111     {
112         B_[celli].component(symmTensor::XX) =
113             max(B_[celli].component(symmTensor::XX), 1.0e-10);
114         B_[celli].component(symmTensor::YY) =
115             max(B_[celli].component(symmTensor::YY), 1.0e-10);
116         B_[celli].component(symmTensor::ZZ) =
117             max(B_[celli].component(symmTensor::ZZ), 1.0e-10);
118     }
120     K = 0.5*tr(B_);
121     bound(K, k0());
123     muSgs_ = ck_*rho()*sqrt(K)*delta();
124     muSgs_.correctBoundaryConditions();
128 bool DeardorffDiffStress::read()
130     if (GenSGSStress::read())
131     {
132         ck_.readIfPresent(coeffDict());
133         cm_.readIfPresent(coeffDict());
135         return true;
136     }
137     else
138     {
139         return false;
140     }
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 } // End namespace LESModels
147 } // End namespace compressible
148 } // End namespace Foam
150 // ************************************************************************* //