initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / turbulenceModels / compressible / turbulenceModel / turbulenceModel.C
blob15cce81cc148cbf2baa07613a4c8d7520e909309
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 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 "turbulenceModel.H"
28 #include "volFields.H"
29 #include "surfaceFields.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace Foam
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
53     runTime_(U.time()),
54     mesh_(U.mesh()),
56     rho_(rho),
57     U_(U),
58     phi_(phi),
59     thermophysicalModel_(thermophysicalModel)
63 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
65 autoPtr<turbulenceModel> turbulenceModel::New
67     const volScalarField& rho,
68     const volVectorField& U,
69     const surfaceScalarField& phi,
70     const basicThermo& thermophysicalModel
73     word modelName;
75     // Enclose the creation of the dictionary to ensure it is deleted
76     // before the turbulenceModel is created otherwise the dictionary is
77     // entered in the database twice
78     {
79         IOdictionary dict
80         (
81             IOobject
82             (
83                 "turbulenceProperties",
84                 U.time().constant(),
85                 U.db(),
86                 IOobject::MUST_READ,
87                 IOobject::NO_WRITE
88             )
89         );
91         dict.lookup("simulationType") >> modelName;
92     }
94     Info<< "Selecting turbulence model type " << modelName << endl;
96     turbulenceModelConstructorTable::iterator cstrIter =
97         turbulenceModelConstructorTablePtr_->find(modelName);
99     if (cstrIter == turbulenceModelConstructorTablePtr_->end())
100     {
101         FatalErrorIn
102         (
103             "turbulenceModel::New(const volScalarField&, "
104             "const volVectorField&, const surfaceScalarField&, "
105             "basicThermo&)"
106         )   << "Unknown turbulenceModel type " << modelName
107             << endl << endl
108             << "Valid turbulenceModel types are :" << endl
109             << turbulenceModelConstructorTablePtr_->toc()
110             << exit(FatalError);
111     }
113     return autoPtr<turbulenceModel>
114     (
115         cstrIter()(rho, U, phi, thermophysicalModel)
116     );
120 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
122 void turbulenceModel::correct()
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 } // End namespace compressible
129 } // End namespace Foam
131 // ************************************************************************* //