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