initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / turbulenceModels / incompressible / RAS / backwardsCompatibility / wallFunctions / backwardsCompatibilityWallFunctions.C
blobbfa6bb78a17caaf44b37338efa140b9522c3fb7b
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2008-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "backwardsCompatibilityWallFunctions.H"
29 #include "calculatedFvPatchField.H"
30 #include "nutWallFunctionFvPatchScalarField.H"
31 #include "epsilonWallFunctionFvPatchScalarField.H"
32 #include "kqRWallFunctionFvPatchField.H"
33 #include "omegaWallFunctionFvPatchScalarField.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 namespace Foam
39 namespace incompressible
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 tmp<volScalarField> autoCreateNut
46     const word& fieldName,
47     const fvMesh& mesh
50     IOobject nutHeader
51     (
52         fieldName,
53         mesh.time().timeName(),
54         mesh,
55         IOobject::MUST_READ,
56         IOobject::NO_WRITE,
57         false
58     );
60     if (nutHeader.headerOk())
61     {
62         return tmp<volScalarField>(new volScalarField(nutHeader, mesh));
63     }
64     else
65     {
66         Info<< "--> Creating " << fieldName
67             << " to employ run-time selectable wall functions" << endl;
69         const fvBoundaryMesh& bm = mesh.boundary();
71         wordList nutBoundaryTypes(bm.size());
73         forAll(bm, patchI)
74         {
75             if (isType<wallFvPatch>(bm[patchI]))
76             {
77                 nutBoundaryTypes[patchI] =
78                     RASModels::nutWallFunctionFvPatchScalarField::typeName;
79             }
80             else
81             {
82                 nutBoundaryTypes[patchI] =
83                     calculatedFvPatchField<scalar>::typeName;
84             }
85         }
87         tmp<volScalarField> nut
88         (
89             new volScalarField
90             (
91                 IOobject
92                 (
93                     fieldName,
94                     mesh.time().timeName(),
95                     mesh,
96                     IOobject::NO_READ,
97                     IOobject::NO_WRITE,
98                     false
99                 ),
100                 mesh,
101                 dimensionedScalar("zero", dimArea/dimTime, 0.0),
102                 nutBoundaryTypes
103             )
104         );
106         Info<< "    Writing new " << fieldName << endl;
107         nut().write();
109         return nut;
110     }
114 tmp<volScalarField> autoCreateEpsilon
116     const word& fieldName,
117     const fvMesh& mesh
120     return
121         autoCreateWallFunctionField
122         <
123             scalar,
124             RASModels::epsilonWallFunctionFvPatchScalarField
125         >
126         (
127             fieldName,
128             mesh
129         );
133 tmp<volScalarField> autoCreateOmega
135     const word& fieldName,
136     const fvMesh& mesh
139     return
140         autoCreateWallFunctionField
141         <
142             scalar,
143             RASModels::omegaWallFunctionFvPatchScalarField
144         >
145         (
146             fieldName,
147             mesh
148         );
152 tmp<volScalarField> autoCreateK
154     const word& fieldName,
155     const fvMesh& mesh
158     return
159         autoCreateWallFunctionField
160         <
161             scalar,
162             RASModels::kqRWallFunctionFvPatchField<scalar>
163         >
164         (
165             fieldName,
166             mesh
167         );
171 tmp<volScalarField> autoCreateQ
173     const word& fieldName,
174     const fvMesh& mesh
177     return
178         autoCreateWallFunctionField
179         <
180             scalar,
181             RASModels::kqRWallFunctionFvPatchField<scalar>
182         >
183         (
184             fieldName,
185             mesh
186         );
190 tmp<volSymmTensorField> autoCreateR
192     const word& fieldName,
193     const fvMesh& mesh
196     return
197         autoCreateWallFunctionField
198         <
199             symmTensor,
200             RASModels::kqRWallFunctionFvPatchField<symmTensor>
201         >
202         (
203             fieldName,
204             mesh
205         );
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 } // End namespace incompressible
212 } // End namespace Foam
214 // ************************************************************************* //