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

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-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 "backwardsCompatibilityWallFunctions.H"
00027 
00028 #include <finiteVolume/calculatedFvPatchField.H>
00029 #include <incompressibleRASModels/nutWallFunctionFvPatchScalarField.H>
00030 #include <incompressibleRASModels/nutLowReWallFunctionFvPatchScalarField.H>
00031 #include <incompressibleRASModels/epsilonWallFunctionFvPatchScalarField.H>
00032 #include <incompressibleRASModels/kqRWallFunctionFvPatchField.H>
00033 #include <incompressibleRASModels/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 (isA<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> autoCreateLowReNut
00115 (
00116     const word& fieldName,
00117     const fvMesh& mesh
00118 )
00119 {
00120     IOobject nutHeader
00121     (
00122         fieldName,
00123         mesh.time().timeName(),
00124         mesh,
00125         IOobject::MUST_READ,
00126         IOobject::NO_WRITE,
00127         false
00128     );
00129 
00130     if (nutHeader.headerOk())
00131     {
00132         return tmp<volScalarField>(new volScalarField(nutHeader, mesh));
00133     }
00134     else
00135     {
00136         Info<< "--> Creating " << fieldName
00137             << " to employ run-time selectable wall functions" << endl;
00138 
00139         const fvBoundaryMesh& bm = mesh.boundary();
00140 
00141         wordList nutBoundaryTypes(bm.size());
00142 
00143         forAll(bm, patchI)
00144         {
00145             if (isA<wallFvPatch>(bm[patchI]))
00146             {
00147                 nutBoundaryTypes[patchI] =
00148                     RASModels::nutLowReWallFunctionFvPatchScalarField::typeName;
00149             }
00150             else
00151             {
00152                 nutBoundaryTypes[patchI] =
00153                     calculatedFvPatchField<scalar>::typeName;
00154             }
00155         }
00156 
00157         tmp<volScalarField> nut
00158         (
00159             new volScalarField
00160             (
00161                 IOobject
00162                 (
00163                     fieldName,
00164                     mesh.time().timeName(),
00165                     mesh,
00166                     IOobject::NO_READ,
00167                     IOobject::NO_WRITE,
00168                     false
00169                 ),
00170                 mesh,
00171                 dimensionedScalar("zero", dimArea/dimTime, 0.0),
00172                 nutBoundaryTypes
00173             )
00174         );
00175 
00176         Info<< "    Writing new " << fieldName << endl;
00177         nut().write();
00178 
00179         return nut;
00180     }
00181 }
00182 
00183 
00184 tmp<volScalarField> autoCreateEpsilon
00185 (
00186     const word& fieldName,
00187     const fvMesh& mesh
00188 )
00189 {
00190     return
00191         autoCreateWallFunctionField
00192         <
00193             scalar,
00194             RASModels::epsilonWallFunctionFvPatchScalarField
00195         >
00196         (
00197             fieldName,
00198             mesh
00199         );
00200 }
00201 
00202 
00203 tmp<volScalarField> autoCreateOmega
00204 (
00205     const word& fieldName,
00206     const fvMesh& mesh
00207 )
00208 {
00209     return
00210         autoCreateWallFunctionField
00211         <
00212             scalar,
00213             RASModels::omegaWallFunctionFvPatchScalarField
00214         >
00215         (
00216             fieldName,
00217             mesh
00218         );
00219 }
00220 
00221 
00222 tmp<volScalarField> autoCreateK
00223 (
00224     const word& fieldName,
00225     const fvMesh& mesh
00226 )
00227 {
00228     return
00229         autoCreateWallFunctionField
00230         <
00231             scalar,
00232             RASModels::kqRWallFunctionFvPatchField<scalar>
00233         >
00234         (
00235             fieldName,
00236             mesh
00237         );
00238 }
00239 
00240 
00241 tmp<volScalarField> autoCreateQ
00242 (
00243     const word& fieldName,
00244     const fvMesh& mesh
00245 )
00246 {
00247     return
00248         autoCreateWallFunctionField
00249         <
00250             scalar,
00251             RASModels::kqRWallFunctionFvPatchField<scalar>
00252         >
00253         (
00254             fieldName,
00255             mesh
00256         );
00257 }
00258 
00259 
00260 tmp<volSymmTensorField> autoCreateR
00261 (
00262     const word& fieldName,
00263     const fvMesh& mesh
00264 )
00265 {
00266     return
00267         autoCreateWallFunctionField
00268         <
00269             symmTensor,
00270             RASModels::kqRWallFunctionFvPatchField<symmTensor>
00271         >
00272         (
00273             fieldName,
00274             mesh
00275         );
00276 }
00277 
00278 
00279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00280 
00281 } // End namespace incompressible
00282 } // End namespace Foam
00283 
00284 // ************************ vim: set sw=4 sts=4 et: ************************ //
00285 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines