Better bounding on topo change
[foam-extend-3.2.git] / src / turbulenceModels / compressible / turbulenceModel / turbulenceModel.C
blob6d6f47db70e13a30b10e544359300446de505c6f
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "turbulenceModel.H"
27 #include "volFields.H"
28 #include "surfaceFields.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
34 namespace compressible
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 defineTypeNameAndDebug(turbulenceModel, 0);
40 defineRunTimeSelectionTable(turbulenceModel, turbulenceModel);
42 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
44 turbulenceModel::turbulenceModel
46     const volScalarField& rho,
47     const volVectorField& U,
48     const surfaceScalarField& phi,
49     const basicThermo& thermophysicalModel
52     runTime_(U.time()),
53     mesh_(U.mesh()),
55     rho_(rho),
56     U_(U),
57     phi_(phi),
58     thermophysicalModel_(thermophysicalModel)
62 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
64 autoPtr<turbulenceModel> turbulenceModel::New
66     const volScalarField& rho,
67     const volVectorField& U,
68     const surfaceScalarField& phi,
69     const basicThermo& thermophysicalModel
72     word modelName;
74     // Enclose the creation of the dictionary to ensure it is deleted
75     // before the turbulenceModel is created otherwise the dictionary is
76     // entered in the database twice
77     {
78         IOdictionary dict
79         (
80             IOobject
81             (
82                 "turbulenceProperties",
83                 U.time().constant(),
84                 U.db(),
85                 IOobject::MUST_READ,
86                 IOobject::NO_WRITE
87             )
88         );
90         dict.lookup("simulationType") >> modelName;
91     }
93     Info<< "Selecting turbulence model type " << modelName << endl;
95     turbulenceModelConstructorTable::iterator cstrIter =
96         turbulenceModelConstructorTablePtr_->find(modelName);
98     if (cstrIter == turbulenceModelConstructorTablePtr_->end())
99     {
100         FatalErrorIn
101         (
102             "turbulenceModel::New(const volScalarField&, "
103             "const volVectorField&, const surfaceScalarField&, "
104             "basicThermo&)"
105         )   << "Unknown turbulenceModel type " << modelName
106             << endl << endl
107             << "Valid turbulenceModel types are :" << endl
108             << turbulenceModelConstructorTablePtr_->sortedToc()
109             << exit(FatalError);
110     }
112     return autoPtr<turbulenceModel>
113     (
114         cstrIter()(rho, U, phi, thermophysicalModel)
115     );
119 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
121 void turbulenceModel::correct()
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 } // End namespace compressible
128 } // End namespace Foam
130 // ************************************************************************* //