changed isA<wallPolyPatch> & isA<wallFvPatch> almost everywhere
[openfoam-extend-OpenFOAM-1.6-ext.git] / src / turbulenceModels / compressible / RAS / backwardsCompatibility / wallFunctions / backwardsCompatibilityWallFunctions.C
blob234d4522831f2382ca953f9073137c337f0904ad
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
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 "alphatWallFunctionFvPatchScalarField.H"
31 #include "mutWallFunctionFvPatchScalarField.H"
32 #include "mutLowReWallFunctionFvPatchScalarField.H"
33 #include "epsilonWallFunctionFvPatchScalarField.H"
34 #include "kqRWallFunctionFvPatchField.H"
35 #include "omegaWallFunctionFvPatchScalarField.H"
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 namespace Foam
41 namespace compressible
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 tmp<volScalarField> autoCreateAlphat
48     const word& fieldName,
49     const fvMesh& mesh
52     IOobject alphatHeader
53     (
54         fieldName,
55         mesh.time().timeName(),
56         mesh,
57         IOobject::MUST_READ,
58         IOobject::NO_WRITE,
59         false
60     );
62     if (alphatHeader.headerOk())
63     {
64         return tmp<volScalarField>(new volScalarField(alphatHeader, 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 alphatBoundaryTypes(bm.size());
75         forAll(bm, patchI)
76         {
77             if (bm[patchI].isWall())
78             {
79                 alphatBoundaryTypes[patchI] =
80                     RASModels::alphatWallFunctionFvPatchScalarField::typeName;
81             }
82             else
83             {
84                 alphatBoundaryTypes[patchI] =
85                     calculatedFvPatchField<scalar>::typeName;
86             }
87         }
89         tmp<volScalarField> alphat
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", dimDensity*dimArea/dimTime, 0.0),
104                 alphatBoundaryTypes
105             )
106         );
108         Info<< "    Writing new " << fieldName << endl;
109         alphat().write();
111         return alphat;
112     }
116 tmp<volScalarField> autoCreateMut
118     const word& fieldName,
119     const fvMesh& mesh
122     IOobject mutHeader
123     (
124         fieldName,
125         mesh.time().timeName(),
126         mesh,
127         IOobject::MUST_READ,
128         IOobject::NO_WRITE,
129         false
130     );
132     if (mutHeader.headerOk())
133     {
134         return tmp<volScalarField>(new volScalarField(mutHeader, mesh));
135     }
136     else
137     {
138         Info<< "--> Creating " << fieldName
139             << " to employ run-time selectable wall functions" << endl;
141         const fvBoundaryMesh& bm = mesh.boundary();
143         wordList mutBoundaryTypes(bm.size());
145         forAll(bm, patchI)
146         {
147             if (bm[patchI].isWall())
148             {
149                 mutBoundaryTypes[patchI] =
150                     RASModels::mutWallFunctionFvPatchScalarField::typeName;
151             }
152             else
153             {
154                 mutBoundaryTypes[patchI] =
155                     calculatedFvPatchField<scalar>::typeName;
156             }
157         }
159         tmp<volScalarField> mut
160         (
161             new volScalarField
162             (
163                 IOobject
164                 (
165                     fieldName,
166                     mesh.time().timeName(),
167                     mesh,
168                     IOobject::NO_READ,
169                     IOobject::NO_WRITE,
170                     false
171                 ),
172                 mesh,
173                 dimensionedScalar("zero", dimDensity*dimArea/dimTime, 0.0),
174                 mutBoundaryTypes
175             )
176         );
178         Info<< "    Writing new " << fieldName << endl;
179         mut().write();
181         return mut;
182     }
186 tmp<volScalarField> autoCreateLowReMut
188     const word& fieldName,
189     const fvMesh& mesh
192     IOobject mutHeader
193     (
194         fieldName,
195         mesh.time().timeName(),
196         mesh,
197         IOobject::MUST_READ,
198         IOobject::NO_WRITE,
199         false
200     );
202     if (mutHeader.headerOk())
203     {
204         return tmp<volScalarField>(new volScalarField(mutHeader, mesh));
205     }
206     else
207     {
208         Info<< "--> Creating " << fieldName
209             << " to employ run-time selectable wall functions" << endl;
211         const fvBoundaryMesh& bm = mesh.boundary();
213         wordList mutBoundaryTypes(bm.size());
215         forAll(bm, patchI)
216         {
217             if (bm[patchI].isWall())
218             {
219                 mutBoundaryTypes[patchI] =
220                     RASModels::mutLowReWallFunctionFvPatchScalarField::typeName;
221             }
222             else
223             {
224                 mutBoundaryTypes[patchI] =
225                     calculatedFvPatchField<scalar>::typeName;
226             }
227         }
229         tmp<volScalarField> mut
230         (
231             new volScalarField
232             (
233                 IOobject
234                 (
235                     fieldName,
236                     mesh.time().timeName(),
237                     mesh,
238                     IOobject::NO_READ,
239                     IOobject::NO_WRITE,
240                     false
241                 ),
242                 mesh,
243                 dimensionedScalar("zero", dimDensity*dimArea/dimTime, 0.0),
244                 mutBoundaryTypes
245             )
246         );
248         Info<< "    Writing new " << fieldName << endl;
249         mut().write();
251         return mut;
252     }
256 tmp<volScalarField> autoCreateEpsilon
258     const word& fieldName,
259     const fvMesh& mesh
262     return
263         autoCreateWallFunctionField
264         <
265             scalar,
266             RASModels::epsilonWallFunctionFvPatchScalarField
267         >
268         (
269             fieldName,
270             mesh
271         );
275 tmp<volScalarField> autoCreateOmega
277     const word& fieldName,
278     const fvMesh& mesh
281     return
282         autoCreateWallFunctionField
283         <
284             scalar,
285             RASModels::omegaWallFunctionFvPatchScalarField
286         >
287         (
288             fieldName,
289             mesh
290         );
294 tmp<volScalarField> autoCreateK
296     const word& fieldName,
297     const fvMesh& mesh
300     return
301         autoCreateWallFunctionField
302         <
303             scalar,
304             RASModels::kqRWallFunctionFvPatchField<scalar>
305         >
306         (
307             fieldName,
308             mesh
309         );
313 tmp<volScalarField> autoCreateQ
315     const word& fieldName,
316     const fvMesh& mesh
319     return
320         autoCreateWallFunctionField
321         <
322             scalar,
323             RASModels::kqRWallFunctionFvPatchField<scalar>
324         >
325         (
326             fieldName,
327             mesh
328         );
332 tmp<volSymmTensorField> autoCreateR
334     const word& fieldName,
335     const fvMesh& mesh
338     return
339         autoCreateWallFunctionField
340         <
341             symmTensor,
342             RASModels::kqRWallFunctionFvPatchField<symmTensor>
343         >
344         (
345             fieldName,
346             mesh
347         );
351 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
353 } // End namespace compressible
354 } // End namespace Foam
356 // ************************************************************************* //