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 incompressible
00035 {
00036 
00037 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00038 
00039 defineTypeNameAndDebug(turbulenceModel, 0);
00040 defineRunTimeSelectionTable(turbulenceModel, turbulenceModel);
00041 
00042 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00043 
00044 turbulenceModel::turbulenceModel
00045 (
00046     const volVectorField& U,
00047     const surfaceScalarField& phi,
00048     transportModel& lamTransportModel
00049 )
00050 :
00051     runTime_(U.time()),
00052     mesh_(U.mesh()),
00053 
00054     U_(U),
00055     phi_(phi),
00056     transportModel_(lamTransportModel)
00057 {}
00058 
00059 
00060 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
00061 
00062 autoPtr<turbulenceModel> turbulenceModel::New
00063 (
00064     const volVectorField& U,
00065     const surfaceScalarField& phi,
00066     transportModel& transport
00067 )
00068 {
00069     word modelName;
00070 
00071     // Enclose the creation of the dictionary to ensure it is deleted
00072     // before the turbulenceModel is created otherwise the dictionary is
00073     // entered in the database twice
00074     {
00075         IOdictionary dict
00076         (
00077             IOobject
00078             (
00079                 "turbulenceProperties",
00080                 U.time().constant(),
00081                 U.db(),
00082                 IOobject::MUST_READ,
00083                 IOobject::NO_WRITE
00084             )
00085         );
00086 
00087         dict.lookup("simulationType") >> modelName;
00088     }
00089 
00090     Info<< "Selecting turbulence model type " << modelName << endl;
00091 
00092     turbulenceModelConstructorTable::iterator cstrIter =
00093         turbulenceModelConstructorTablePtr_->find(modelName);
00094 
00095     if (cstrIter == turbulenceModelConstructorTablePtr_->end())
00096     {
00097         FatalErrorIn
00098         (
00099             "turbulenceModel::New(const volVectorField&, "
00100             "const surfaceScalarField&, transportModel&)"
00101         )   << "Unknown turbulenceModel type " << modelName
00102             << endl << endl
00103             << "Valid turbulenceModel types are :" << endl
00104             << turbulenceModelConstructorTablePtr_->sortedToc()
00105             << exit(FatalError);
00106     }
00107 
00108     return autoPtr<turbulenceModel>(cstrIter()(U, phi, transport));
00109 }
00110 
00111 
00112 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00113 
00114 void turbulenceModel::correct()
00115 {
00116     transportModel_.correct();
00117 }
00118 
00119 
00120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00121 
00122 } // End namespace incompressible
00123 } // End namespace Foam
00124 
00125 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines