OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

turbulenceModel.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "turbulenceModel.H"
00028 #include "volFields.H"
00029 #include "surfaceFields.H"
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 namespace compressible
00036 {
00037 
00038 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00039 
00040 defineTypeNameAndDebug(turbulenceModel, 0);
00041 defineRunTimeSelectionTable(turbulenceModel, turbulenceModel);
00042 
00043 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00044 
00045 turbulenceModel::turbulenceModel
00046 (
00047     const volScalarField& rho,
00048     const volVectorField& U,
00049     const surfaceScalarField& phi,
00050     const basicThermo& thermophysicalModel
00051 )
00052 :
00053     runTime_(U.time()),
00054     mesh_(U.mesh()),
00055 
00056     rho_(rho),
00057     U_(U),
00058     phi_(phi),
00059     thermophysicalModel_(thermophysicalModel)
00060 {}
00061 
00062 
00063 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
00064 
00065 autoPtr<turbulenceModel> turbulenceModel::New
00066 (
00067     const volScalarField& rho,
00068     const volVectorField& U,
00069     const surfaceScalarField& phi,
00070     const basicThermo& thermophysicalModel
00071 )
00072 {
00073     word modelName;
00074 
00075     // Enclose the creation of the dictionary to ensure it is deleted
00076     // before the turbulenceModel is created otherwise the dictionary is
00077     // entered in the database twice
00078     {
00079         IOdictionary dict
00080         (
00081             IOobject
00082             (
00083                 "turbulenceProperties",
00084                 U.time().constant(),
00085                 U.db(),
00086                 IOobject::MUST_READ,
00087                 IOobject::NO_WRITE
00088             )
00089         );
00090 
00091         dict.lookup("simulationType") >> modelName;
00092     }
00093 
00094     Info<< "Selecting turbulence model type " << modelName << endl;
00095 
00096     turbulenceModelConstructorTable::iterator cstrIter =
00097         turbulenceModelConstructorTablePtr_->find(modelName);
00098 
00099     if (cstrIter == turbulenceModelConstructorTablePtr_->end())
00100     {
00101         FatalErrorIn
00102         (
00103             "turbulenceModel::New(const volScalarField&, "
00104             "const volVectorField&, const surfaceScalarField&, "
00105             "basicThermo&)"
00106         )   << "Unknown turbulenceModel type " << modelName
00107             << endl << endl
00108             << "Valid turbulenceModel types are :" << endl
00109             << turbulenceModelConstructorTablePtr_->toc()
00110             << exit(FatalError);
00111     }
00112 
00113     return autoPtr<turbulenceModel>
00114     (
00115         cstrIter()(rho, U, phi, thermophysicalModel)
00116     );
00117 }
00118 
00119 
00120 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00121 
00122 void turbulenceModel::correct()
00123 {}
00124 
00125 
00126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00127 
00128 } // End namespace compressible
00129 } // End namespace Foam
00130 
00131 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd