Forward compatibility: flex
[foam-extend-3.2.git] / src / turbulenceModels / incompressible / RAS / backwardsCompatibility / wallFunctions / backwardsCompatibilityWallFunctions.C
blob4d3ee036cc839bb955d155c2b1205ffedab8a82d
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "backwardsCompatibilityWallFunctions.H"
28 #include "calculatedFvPatchField.H"
29 #include "nutWallFunctionFvPatchScalarField.H"
30 #include "nutLowReWallFunctionFvPatchScalarField.H"
31 #include "epsilonWallFunctionFvPatchScalarField.H"
32 #include "kqRWallFunctionFvPatchField.H"
33 #include "RWallFunctionFvPatchSymmTensorField.H"
34 #include "omegaWallFunctionFvPatchScalarField.H"
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 namespace Foam
40 namespace incompressible
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 tmp<volScalarField> autoCreateNut
47     const word& fieldName,
48     const fvMesh& mesh,
49     const objectRegistry& obj
52     IOobject nutHeader
53     (
54         fieldName,
55         mesh.time().timeName(),
56         obj,
57         IOobject::MUST_READ,
58         IOobject::NO_WRITE,
59         false
60     );
62     if (nutHeader.headerOk())
63     {
64         return tmp<volScalarField>(new volScalarField(nutHeader, mesh));
65     }
66     else
67     {
68         Info<< "--> Creating " << fieldName
69             << " to employ run-time selectable wall functions" << endl;
71         const fvBoundaryMesh& bm = mesh.boundary();
73         wordList nutBoundaryTypes(bm.size());
75         forAll(bm, patchI)
76         {
77             if (bm[patchI].isWall())
78             {
79                 nutBoundaryTypes[patchI] =
80                     RASModels::nutWallFunctionFvPatchScalarField::typeName;
81             }
82             else
83             {
84                 nutBoundaryTypes[patchI] =
85                     calculatedFvPatchField<scalar>::typeName;
86             }
87         }
89         tmp<volScalarField> nut
90         (
91             new volScalarField
92             (
93                 IOobject
94                 (
95                     fieldName,
96                     mesh.time().timeName(),
97                     mesh,
98                     IOobject::NO_READ,
99                     IOobject::NO_WRITE,
100                     false
101                 ),
102                 mesh,
103                 dimensionedScalar("zero", dimArea/dimTime, 0.0),
104                 nutBoundaryTypes
105             )
106         );
108         Info<< "    Writing new " << fieldName << endl;
109         nut().write();
111         return nut;
112     }
116 tmp<volScalarField> autoCreateNut
118     const word& fieldName,
119     const fvMesh& mesh
122     return autoCreateNut(fieldName, mesh, mesh);
126 tmp<volScalarField> autoCreateLowReNut
128     const word& fieldName,
129     const fvMesh& mesh,
130     const objectRegistry& obj
133     IOobject nutHeader
134     (
135         fieldName,
136         mesh.time().timeName(),
137         obj,
138         IOobject::MUST_READ,
139         IOobject::NO_WRITE,
140         false
141     );
143     if (nutHeader.headerOk())
144     {
145         return tmp<volScalarField>(new volScalarField(nutHeader, mesh));
146     }
147     else
148     {
149         Info<< "--> Creating " << fieldName
150             << " to employ run-time selectable wall functions" << endl;
152         const fvBoundaryMesh& bm = mesh.boundary();
154         wordList nutBoundaryTypes(bm.size());
156         forAll(bm, patchI)
157         {
158             if (bm[patchI].isWall())
159             {
160                 nutBoundaryTypes[patchI] =
161                     RASModels::nutLowReWallFunctionFvPatchScalarField::typeName;
162             }
163             else
164             {
165                 nutBoundaryTypes[patchI] =
166                     calculatedFvPatchField<scalar>::typeName;
167             }
168         }
170         tmp<volScalarField> nut
171         (
172             new volScalarField
173             (
174                 IOobject
175                 (
176                     fieldName,
177                     mesh.time().timeName(),
178                     mesh,
179                     IOobject::NO_READ,
180                     IOobject::NO_WRITE,
181                     false
182                 ),
183                 mesh,
184                 dimensionedScalar("zero", dimArea/dimTime, 0.0),
185                 nutBoundaryTypes
186             )
187         );
189         Info<< "    Writing new " << fieldName << endl;
190         nut().write();
192         return nut;
193     }
197 tmp<volScalarField> autoCreateLowReNut
199     const word& fieldName,
200     const fvMesh& mesh
203     return autoCreateLowReNut(fieldName, mesh, mesh);
207 tmp<volScalarField> autoCreateEpsilon
209     const word& fieldName,
210     const fvMesh& mesh,
211     const objectRegistry& obj
214     return
215         autoCreateWallFunctionField
216         <
217             scalar,
218             RASModels::epsilonWallFunctionFvPatchScalarField
219         >
220         (
221             fieldName,
222             mesh,
223             obj
224         );
228 tmp<volScalarField> autoCreateEpsilon
230     const word& fieldName,
231     const fvMesh& mesh
234     return
235         autoCreateWallFunctionField
236         <
237             scalar,
238             RASModels::epsilonWallFunctionFvPatchScalarField
239         >
240         (
241             fieldName,
242             mesh,
243             mesh
244         );
248 tmp<volScalarField> autoCreateOmega
250     const word& fieldName,
251     const fvMesh& mesh,
252     const objectRegistry& obj
255     return
256         autoCreateWallFunctionField
257         <
258             scalar,
259             RASModels::omegaWallFunctionFvPatchScalarField
260         >
261         (
262             fieldName,
263             mesh,
264             obj
265         );
269 tmp<volScalarField> autoCreateOmega
271     const word& fieldName,
272     const fvMesh& mesh
275     return
276         autoCreateWallFunctionField
277         <
278             scalar,
279             RASModels::omegaWallFunctionFvPatchScalarField
280         >
281         (
282             fieldName,
283             mesh,
284             mesh
285         );
289 tmp<volScalarField> autoCreateK
291     const word& fieldName,
292     const fvMesh& mesh,
293     const objectRegistry& obj
296     return
297         autoCreateWallFunctionField
298         <
299             scalar,
300             RASModels::kqRWallFunctionFvPatchField<scalar>
301         >
302         (
303             fieldName,
304             mesh,
305             obj
306         );
310 tmp<volScalarField> autoCreateK
312     const word& fieldName,
313     const fvMesh& mesh
316     return
317         autoCreateWallFunctionField
318         <
319             scalar,
320             RASModels::kqRWallFunctionFvPatchField<scalar>
321         >
322         (
323             fieldName,
324             mesh,
325             mesh
326         );
330 tmp<volScalarField> autoCreateQ
332     const word& fieldName,
333     const fvMesh& mesh,
334     const objectRegistry& obj
337     return
338         autoCreateWallFunctionField
339         <
340             scalar,
341             RASModels::kqRWallFunctionFvPatchField<scalar>
342         >
343         (
344             fieldName,
345             mesh,
346             obj
347         );
351 tmp<volScalarField> autoCreateQ
353     const word& fieldName,
354     const fvMesh& mesh
357     return
358         autoCreateWallFunctionField
359         <
360             scalar,
361             RASModels::kqRWallFunctionFvPatchField<scalar>
362         >
363         (
364             fieldName,
365             mesh,
366             mesh
367         );
371 tmp<volSymmTensorField> autoCreateR
373     const word& fieldName,
374     const fvMesh& mesh,
375     const objectRegistry& obj
378     return
379         autoCreateWallFunctionField
380         <
381             symmTensor,
382             RASModels::kqRWallFunctionFvPatchField<symmTensor>
383         >
384         (
385             fieldName,
386             mesh,
387             obj
388         );
392 tmp<volSymmTensorField> autoCreateR
394     const word& fieldName,
395     const fvMesh& mesh
398     return
399         autoCreateWallFunctionField
400         <
401             symmTensor,
402             // New wall functions for R.  HJ, 14/Dec/2011
403             RASModels::RWallFunctionFvPatchSymmTensorField
404         >
405         (
406             fieldName,
407             mesh,
408             mesh
409         );
413 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
415 } // End namespace incompressible
416 } // End namespace Foam
418 // ************************************************************************* //