FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "turbulenceModel.H"
00027 #include <finiteVolume/volFields.H>
00028 #include <finiteVolume/surfaceFields.H>
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 namespace compressible
00035 {
00036 
00037 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00038 
00039 defineTypeNameAndDebug(turbulenceModel, 0);
00040 defineRunTimeSelectionTable(turbulenceModel, turbulenceModel);
00041 
00042 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00043 
00044 turbulenceModel::turbulenceModel
00045 (
00046     const volScalarField& rho,
00047     const volVectorField& U,
00048     const surfaceScalarField& phi,
00049     const basicThermo& thermophysicalModel
00050 )
00051 :
00052     runTime_(U.time()),
00053     mesh_(U.mesh()),
00054 
00055     rho_(rho),
00056     U_(U),
00057     phi_(phi),
00058     thermophysicalModel_(thermophysicalModel)
00059 {}
00060 
00061 
00062 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
00063 
00064 autoPtr<turbulenceModel> turbulenceModel::New
00065 (
00066     const volScalarField& rho,
00067     const volVectorField& U,
00068     const surfaceScalarField& phi,
00069     const basicThermo& thermophysicalModel
00070 )
00071 {
00072     word modelName;
00073 
00074     // Enclose the creation of the dictionary to ensure it is deleted
00075     // before the turbulenceModel is created otherwise the dictionary is
00076     // entered in the database twice
00077     {
00078         IOdictionary dict
00079         (
00080             IOobject
00081             (
00082                 "turbulenceProperties",
00083                 U.time().constant(),
00084                 U.db(),
00085                 IOobject::MUST_READ,
00086                 IOobject::NO_WRITE
00087             )
00088         );
00089 
00090         dict.lookup("simulationType") >> modelName;
00091     }
00092 
00093     Info<< "Selecting turbulence model type " << modelName << endl;
00094 
00095     turbulenceModelConstructorTable::iterator cstrIter =
00096         turbulenceModelConstructorTablePtr_->find(modelName);
00097 
00098     if (cstrIter == turbulenceModelConstructorTablePtr_->end())
00099     {
00100         FatalErrorIn
00101         (
00102             "turbulenceModel::New(const volScalarField&, "
00103             "const volVectorField&, const surfaceScalarField&, "
00104             "basicThermo&)"
00105         )   << "Unknown turbulenceModel type " << modelName
00106             << endl << endl
00107             << "Valid turbulenceModel types are :" << endl
00108             << turbulenceModelConstructorTablePtr_->sortedToc()
00109             << exit(FatalError);
00110     }
00111 
00112     return autoPtr<turbulenceModel>
00113     (
00114         cstrIter()(rho, U, phi, thermophysicalModel)
00115     );
00116 }
00117 
00118 
00119 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00120 
00121 void turbulenceModel::correct()
00122 {}
00123 
00124 
00125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00126 
00127 } // End namespace compressible
00128 } // End namespace Foam
00129 
00130 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines