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 \*---------------------------------------------------------------------------*/
26 #include "turbulenceModel.H"
27 #include "volFields.H"
28 #include "surfaceFields.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace compressible
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(turbulenceModel, 0);
41 defineRunTimeSelectionTable(turbulenceModel, turbulenceModel);
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 turbulenceModel::turbulenceModel
47 const volScalarField& rho,
48 const volVectorField& U,
49 const surfaceScalarField& phi,
50 const basicThermo& thermophysicalModel,
51 const word& turbulenceModelName
71 thermophysicalModel_(thermophysicalModel)
75 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
77 autoPtr<turbulenceModel> turbulenceModel::New
79 const volScalarField& rho,
80 const volVectorField& U,
81 const surfaceScalarField& phi,
82 const basicThermo& thermophysicalModel,
83 const word& turbulenceModelName
86 // get model name, but do not register the dictionary
87 // otherwise it is registered in the database twice
94 "turbulenceProperties",
97 IOobject::MUST_READ_IF_MODIFIED,
101 ).lookup("simulationType")
104 Info<< "Selecting turbulence model type " << modelType << endl;
106 turbulenceModelConstructorTable::iterator cstrIter =
107 turbulenceModelConstructorTablePtr_->find(modelType);
109 if (cstrIter == turbulenceModelConstructorTablePtr_->end())
113 "turbulenceModel::New(const volScalarField&, "
114 "const volVectorField&, const surfaceScalarField&, "
115 "basicThermo&, const word&)"
116 ) << "Unknown turbulenceModel type "
117 << modelType << nl << nl
118 << "Valid turbulenceModel types:" << endl
119 << turbulenceModelConstructorTablePtr_->sortedToc()
123 return autoPtr<turbulenceModel>
125 cstrIter()(rho, U, phi, thermophysicalModel, turbulenceModelName)
130 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
132 tmp<volScalarField> turbulenceModel::rhoEpsilonEff() const
134 tmp<volTensorField> tgradU = fvc::grad(U_);
135 return mu()*(tgradU() && dev(twoSymm(tgradU()))) + rho_*epsilon();
139 void turbulenceModel::correct()
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 } // End namespace compressible
146 } // End namespace Foam
148 // ************************************************************************* //