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

backwardsCompatibilityWallFunctions.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) 2008-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 "backwardsCompatibilityWallFunctions.H"
00028 
00029 #include "calculatedFvPatchField.H"
00030 #include "nutWallFunctionFvPatchScalarField.H"
00031 #include "epsilonWallFunctionFvPatchScalarField.H"
00032 #include "kqRWallFunctionFvPatchField.H"
00033 #include "omegaWallFunctionFvPatchScalarField.H"
00034 
00035 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00036 
00037 namespace Foam
00038 {
00039 namespace incompressible
00040 {
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 tmp<volScalarField> autoCreateNut
00045 (
00046     const word& fieldName,
00047     const fvMesh& mesh
00048 )
00049 {
00050     IOobject nutHeader
00051     (
00052         fieldName,
00053         mesh.time().timeName(),
00054         mesh,
00055         IOobject::MUST_READ,
00056         IOobject::NO_WRITE,
00057         false
00058     );
00059 
00060     if (nutHeader.headerOk())
00061     {
00062         return tmp<volScalarField>(new volScalarField(nutHeader, mesh));
00063     }
00064     else
00065     {
00066         Info<< "--> Creating " << fieldName
00067             << " to employ run-time selectable wall functions" << endl;
00068 
00069         const fvBoundaryMesh& bm = mesh.boundary();
00070 
00071         wordList nutBoundaryTypes(bm.size());
00072 
00073         forAll(bm, patchI)
00074         {
00075             if (isType<wallFvPatch>(bm[patchI]))
00076             {
00077                 nutBoundaryTypes[patchI] =
00078                     RASModels::nutWallFunctionFvPatchScalarField::typeName;
00079             }
00080             else
00081             {
00082                 nutBoundaryTypes[patchI] =
00083                     calculatedFvPatchField<scalar>::typeName;
00084             }
00085         }
00086 
00087         tmp<volScalarField> nut
00088         (
00089             new volScalarField
00090             (
00091                 IOobject
00092                 (
00093                     fieldName,
00094                     mesh.time().timeName(),
00095                     mesh,
00096                     IOobject::NO_READ,
00097                     IOobject::NO_WRITE,
00098                     false
00099                 ),
00100                 mesh,
00101                 dimensionedScalar("zero", dimArea/dimTime, 0.0),
00102                 nutBoundaryTypes
00103             )
00104         );
00105 
00106         Info<< "    Writing new " << fieldName << endl;
00107         nut().write();
00108 
00109         return nut;
00110     }
00111 }
00112 
00113 
00114 tmp<volScalarField> autoCreateEpsilon
00115 (
00116     const word& fieldName,
00117     const fvMesh& mesh
00118 )
00119 {
00120     return
00121         autoCreateWallFunctionField
00122         <
00123             scalar,
00124             RASModels::epsilonWallFunctionFvPatchScalarField
00125         >
00126         (
00127             fieldName,
00128             mesh
00129         );
00130 }
00131 
00132 
00133 tmp<volScalarField> autoCreateOmega
00134 (
00135     const word& fieldName,
00136     const fvMesh& mesh
00137 )
00138 {
00139     return
00140         autoCreateWallFunctionField
00141         <
00142             scalar,
00143             RASModels::omegaWallFunctionFvPatchScalarField
00144         >
00145         (
00146             fieldName,
00147             mesh
00148         );
00149 }
00150 
00151 
00152 tmp<volScalarField> autoCreateK
00153 (
00154     const word& fieldName,
00155     const fvMesh& mesh
00156 )
00157 {
00158     return
00159         autoCreateWallFunctionField
00160         <
00161             scalar,
00162             RASModels::kqRWallFunctionFvPatchField<scalar>
00163         >
00164         (
00165             fieldName,
00166             mesh
00167         );
00168 }
00169 
00170 
00171 tmp<volScalarField> autoCreateQ
00172 (
00173     const word& fieldName,
00174     const fvMesh& mesh
00175 )
00176 {
00177     return
00178         autoCreateWallFunctionField
00179         <
00180             scalar,
00181             RASModels::kqRWallFunctionFvPatchField<scalar>
00182         >
00183         (
00184             fieldName,
00185             mesh
00186         );
00187 }
00188 
00189 
00190 tmp<volSymmTensorField> autoCreateR
00191 (
00192     const word& fieldName,
00193     const fvMesh& mesh
00194 )
00195 {
00196     return
00197         autoCreateWallFunctionField
00198         <
00199             symmTensor,
00200             RASModels::kqRWallFunctionFvPatchField<symmTensor>
00201         >
00202         (
00203             fieldName,
00204             mesh
00205         );
00206 }
00207 
00208 
00209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00210 
00211 } // End namespace incompressible
00212 } // End namespace Foam
00213 
00214 // ************************************************************************* //
00215 
Copyright © 2000-2009 OpenCFD Ltd