1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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& transport,
61 const word& turbulenceModelName
64 turbulenceModel(U, phi, transport, turbulenceModelName),
73 IOobject::MUST_READ_IF_MODIFIED,
78 printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
79 coeffDict_(subOrEmptyDict(type + "Coeffs")),
81 kMin_("kMin", sqr(dimVelocity), SMALL),
82 delta_(LESdelta::New("delta", U.mesh(), *this))
84 kMin_.readIfPresent(*this);
86 // Force the construction of the mesh deltaCoeffs which may be needed
87 // for the construction of the derived models and BCs
92 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
94 autoPtr<LESModel> LESModel::New
96 const volVectorField& U,
97 const surfaceScalarField& phi,
98 transportModel& transport,
99 const word& turbulenceModelName
102 // get model name, but do not register the dictionary
103 // otherwise it is registered in the database twice
113 IOobject::MUST_READ_IF_MODIFIED,
120 Info<< "Selecting LES turbulence model " << modelType << endl;
122 dictionaryConstructorTable::iterator cstrIter =
123 dictionaryConstructorTablePtr_->find(modelType);
125 if (cstrIter == dictionaryConstructorTablePtr_->end())
131 "const volVectorField&, "
132 "const surfaceScalarField& ,"
136 ) << "Unknown LESModel type "
137 << modelType << nl << nl
138 << "Valid LESModel types:" << endl
139 << dictionaryConstructorTablePtr_->sortedToc()
143 return autoPtr<LESModel>
145 cstrIter()(U, phi, transport, turbulenceModelName)
150 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
152 void LESModel::correct(const tmp<volTensorField>&)
154 turbulenceModel::correct();
159 void LESModel::correct()
161 correct(fvc::grad(U_));
165 bool LESModel::read()
167 //if (regIOobject::read())
169 // Bit of trickery : we are both IOdictionary ('RASProperties') and
170 // an regIOobject from the turbulenceModel level. Problem is to distinguish
171 // between the two - we only want to reread the IOdictionary.
173 bool ok = IOdictionary::readData
175 IOdictionary::readStream
180 IOdictionary::close();
184 if (const dictionary* dictPtr = subDictPtr(type() + "Coeffs"))
186 coeffDict_ <<= *dictPtr;
189 delta_().read(*this);
191 kMin_.readIfPresent(*this);
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 } // End namespace incompressible
205 } // End namespace Foam
207 // ************************************************************************* //