1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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 \*---------------------------------------------------------------------------*/
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace compressible
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 defineTypeNameAndDebug(LESModel, 0);
40 defineRunTimeSelectionTable(LESModel, dictionary);
41 addToRunTimeSelectionTable(turbulenceModel, LESModel, turbulenceModel);
43 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
45 void LESModel::printCoeffs()
49 Info<< type() << "Coeffs" << coeffDict_ << endl;
54 // * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * * //
59 const volScalarField& rho,
60 const volVectorField& U,
61 const surfaceScalarField& phi,
62 const basicThermo& thermoPhysicalModel
65 turbulenceModel(rho, U, phi, thermoPhysicalModel),
79 printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
80 coeffDict_(subOrEmptyDict(type + "Coeffs")),
82 k0_("k0", dimVelocity*dimVelocity, SMALL),
84 delta_(LESdelta::New("delta", U.mesh(), *this))
86 readIfPresent("k0", k0_);
88 // Force the construction of the mesh deltaCoeffs which may be needed
89 // for the construction of the derived models and BCs
94 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
96 autoPtr<LESModel> LESModel::New
98 const volScalarField& rho,
99 const volVectorField& U,
100 const surfaceScalarField& phi,
101 const basicThermo& thermoPhysicalModel
106 // Enclose the creation of the dictionary to ensure it is deleted
107 // before the turbulenceModel is created otherwise the dictionary is
108 // entered in the database twice
122 dict.lookup("LESModel") >> modelName;
125 Info<< "Selecting LES turbulence model " << modelName << endl;
127 dictionaryConstructorTable::iterator cstrIter =
128 dictionaryConstructorTablePtr_->find(modelName);
130 if (cstrIter == dictionaryConstructorTablePtr_->end())
134 "LESModel::New(const volVectorField& U, const "
135 "surfaceScalarField& phi, const basicThermo&)"
136 ) << "Unknown LESModel type " << modelName
138 << "Valid LESModel types are :" << endl
139 << dictionaryConstructorTablePtr_->toc()
143 return autoPtr<LESModel>(cstrIter()(rho, U, phi, thermoPhysicalModel));
147 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
149 void LESModel::correct(const tmp<volTensorField>&)
155 void LESModel::correct()
157 correct(fvc::grad(U_));
161 bool LESModel::read()
163 if (regIOobject::read())
165 if (const dictionary* dictPtr = subDictPtr(type() + "Coeffs"))
167 coeffDict_ <<= *dictPtr;
170 readIfPresent("k0", k0_);
172 delta_().read(*this);
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace compressible
186 } // End namespace Foam
188 // ************************************************************************* //