1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace incompressible
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(LESModel, 0);
39 defineRunTimeSelectionTable(LESModel, dictionary);
40 addToRunTimeSelectionTable(turbulenceModel, LESModel, turbulenceModel);
42 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
44 void LESModel::printCoeffs()
48 Info<< type() << "Coeffs" << coeffDict_ << endl;
53 // * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * * //
58 const volVectorField& U,
59 const surfaceScalarField& phi,
60 transportModel& lamTransportModel
63 turbulenceModel(U, phi, lamTransportModel),
77 printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
78 coeffDict_(subOrEmptyDict(type + "Coeffs")),
80 k0_("k0", dimVelocity*dimVelocity, SMALL),
81 delta_(LESdelta::New("delta", U.mesh(), *this))
83 readIfPresent("k0", k0_);
85 // Force the construction of the mesh deltaCoeffs which may be needed
86 // for the construction of the derived models and BCs
91 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
93 autoPtr<LESModel> LESModel::New
95 const volVectorField& U,
96 const surfaceScalarField& phi,
97 transportModel& transport
102 // Enclose the creation of the dictionary to ensure it is deleted
103 // before the turbulenceModel is created otherwise the dictionary is
104 // entered in the database twice
118 dict.lookup("LESModel") >> modelName;
121 Info<< "Selecting LES turbulence model " << modelName << endl;
123 dictionaryConstructorTable::iterator cstrIter =
124 dictionaryConstructorTablePtr_->find(modelName);
126 if (cstrIter == dictionaryConstructorTablePtr_->end())
130 "LESModel::New(const volVectorField& U, const "
131 "surfaceScalarField& phi, transportModel&)"
132 ) << "Unknown LESModel type " << modelName
134 << "Valid LESModel types are :" << endl
135 << dictionaryConstructorTablePtr_->sortedToc()
139 return autoPtr<LESModel>(cstrIter()(U, phi, transport));
143 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
145 void LESModel::correct(const tmp<volTensorField>&)
147 turbulenceModel::correct();
152 void LESModel::correct()
154 correct(fvc::grad(U_));
158 bool LESModel::read()
160 if (regIOobject::read())
162 if (const dictionary* dictPtr = subDictPtr(type() + "Coeffs"))
164 coeffDict_ <<= *dictPtr;
167 delta_().read(*this);
169 readIfPresent("k0", k0_);
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 } // End namespace incompressible
183 } // End namespace Foam
185 // ************************************************************************* //