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 "alphatWallFunctionFvPatchScalarField.H"
00031 #include "mutWallFunctionFvPatchScalarField.H"
00032 #include "epsilonWallFunctionFvPatchScalarField.H"
00033 #include "kqRWallFunctionFvPatchField.H"
00034 #include "omegaWallFunctionFvPatchScalarField.H"
00035 
00036 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00037 
00038 namespace Foam
00039 {
00040 namespace compressible
00041 {
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 tmp<volScalarField> autoCreateAlphat
00046 (
00047     const word& fieldName,
00048     const fvMesh& mesh
00049 )
00050 {
00051     IOobject alphatHeader
00052     (
00053         fieldName,
00054         mesh.time().timeName(),
00055         mesh,
00056         IOobject::MUST_READ,
00057         IOobject::NO_WRITE,
00058         false
00059     );
00060 
00061     if (alphatHeader.headerOk())
00062     {
00063         return tmp<volScalarField>(new volScalarField(alphatHeader, mesh));
00064     }
00065     else
00066     {
00067         Info<< "--> Creating " << fieldName
00068             << " to employ run-time selectable wall functions" << endl;
00069 
00070         const fvBoundaryMesh& bm = mesh.boundary();
00071 
00072         wordList alphatBoundaryTypes(bm.size());
00073 
00074         forAll(bm, patchI)
00075         {
00076             if (isType<wallFvPatch>(bm[patchI]))
00077             {
00078                 alphatBoundaryTypes[patchI] =
00079                     RASModels::alphatWallFunctionFvPatchScalarField::typeName;
00080             }
00081             else
00082             {
00083                 alphatBoundaryTypes[patchI] =
00084                     calculatedFvPatchField<scalar>::typeName;
00085             }
00086         }
00087 
00088         tmp<volScalarField> alphat
00089         (
00090             new volScalarField
00091             (
00092                 IOobject
00093                 (
00094                     fieldName,
00095                     mesh.time().timeName(),
00096                     mesh,
00097                     IOobject::NO_READ,
00098                     IOobject::NO_WRITE,
00099                     false
00100                 ),
00101                 mesh,
00102                 dimensionedScalar("zero", dimDensity*dimArea/dimTime, 0.0),
00103                 alphatBoundaryTypes
00104             )
00105         );
00106 
00107         Info<< "    Writing new " << fieldName << endl;
00108         alphat().write();
00109 
00110         return alphat;
00111     }
00112 }
00113 
00114 
00115 tmp<volScalarField> autoCreateMut
00116 (
00117     const word& fieldName,
00118     const fvMesh& mesh
00119 )
00120 {
00121     IOobject mutHeader
00122     (
00123         fieldName,
00124         mesh.time().timeName(),
00125         mesh,
00126         IOobject::MUST_READ,
00127         IOobject::NO_WRITE,
00128         false
00129     );
00130 
00131     if (mutHeader.headerOk())
00132     {
00133         return tmp<volScalarField>(new volScalarField(mutHeader, mesh));
00134     }
00135     else
00136     {
00137         Info<< "--> Creating " << fieldName
00138             << " to employ run-time selectable wall functions" << endl;
00139 
00140         const fvBoundaryMesh& bm = mesh.boundary();
00141 
00142         wordList mutBoundaryTypes(bm.size());
00143 
00144         forAll(bm, patchI)
00145         {
00146             if (isType<wallFvPatch>(bm[patchI]))
00147             {
00148                 mutBoundaryTypes[patchI] =
00149                     RASModels::mutWallFunctionFvPatchScalarField::typeName;
00150             }
00151             else
00152             {
00153                 mutBoundaryTypes[patchI] =
00154                     calculatedFvPatchField<scalar>::typeName;
00155             }
00156         }
00157 
00158         tmp<volScalarField> mut
00159         (
00160             new volScalarField
00161             (
00162                 IOobject
00163                 (
00164                     fieldName,
00165                     mesh.time().timeName(),
00166                     mesh,
00167                     IOobject::NO_READ,
00168                     IOobject::NO_WRITE,
00169                     false
00170                 ),
00171                 mesh,
00172                 dimensionedScalar("zero", dimDensity*dimArea/dimTime, 0.0),
00173                 mutBoundaryTypes
00174             )
00175         );
00176 
00177         Info<< "    Writing new " << fieldName << endl;
00178         mut().write();
00179 
00180         return mut;
00181     }
00182 }
00183 
00184 
00185 tmp<volScalarField> autoCreateEpsilon
00186 (
00187     const word& fieldName,
00188     const fvMesh& mesh
00189 )
00190 {
00191     return
00192         autoCreateWallFunctionField
00193         <
00194             scalar,
00195             RASModels::epsilonWallFunctionFvPatchScalarField
00196         >
00197         (
00198             fieldName,
00199             mesh
00200         );
00201 }
00202 
00203 
00204 tmp<volScalarField> autoCreateOmega
00205 (
00206     const word& fieldName,
00207     const fvMesh& mesh
00208 )
00209 {
00210     return
00211         autoCreateWallFunctionField
00212         <
00213             scalar,
00214             RASModels::omegaWallFunctionFvPatchScalarField
00215         >
00216         (
00217             fieldName,
00218             mesh
00219         );
00220 }
00221 
00222 
00223 tmp<volScalarField> autoCreateK
00224 (
00225     const word& fieldName,
00226     const fvMesh& mesh
00227 )
00228 {
00229     return
00230         autoCreateWallFunctionField
00231         <
00232             scalar,
00233             RASModels::kqRWallFunctionFvPatchField<scalar>
00234         >
00235         (
00236             fieldName,
00237             mesh
00238         );
00239 }
00240 
00241 
00242 tmp<volScalarField> autoCreateQ
00243 (
00244     const word& fieldName,
00245     const fvMesh& mesh
00246 )
00247 {
00248     return
00249         autoCreateWallFunctionField
00250         <
00251             scalar,
00252             RASModels::kqRWallFunctionFvPatchField<scalar>
00253         >
00254         (
00255             fieldName,
00256             mesh
00257         );
00258 }
00259 
00260 
00261 tmp<volSymmTensorField> autoCreateR
00262 (
00263     const word& fieldName,
00264     const fvMesh& mesh
00265 )
00266 {
00267     return
00268         autoCreateWallFunctionField
00269         <
00270             symmTensor,
00271             RASModels::kqRWallFunctionFvPatchField<symmTensor>
00272         >
00273         (
00274             fieldName,
00275             mesh
00276         );
00277 }
00278 
00279 
00280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00281 
00282 } // End namespace compressible
00283 } // End namespace Foam
00284 
00285 // ************************************************************************* //
00286 
Copyright © 2000-2009 OpenCFD Ltd