initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / test / nearWallDist-wave / testYPlus.C
blobfd718be64305815bcb734070ac44b8f058fba329
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-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 Description
26     Calculate distance to wall.
28 \*---------------------------------------------------------------------------*/
30 #include "fvCFD.H"
31 #include "wallDistData.H"
32 #include "wallPointYPlus.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // Main program:
37 int main(int argc, char *argv[])
39 #   include "setRootCase.H"
40 #   include "createTime.H"
41 #   include "createMesh.H"
43     Info<< "Mesh read in = "
44         << runTime.cpuTimeIncrement()
45         << " s\n" << endl << endl;
48     Info<< "Time now = " << runTime.timeName() << endl;
50     // wall distance and yStar
52     volScalarField yStar
53     (
54         IOobject
55         (
56             "yStar",
57             mesh.time().timeName(),
58             mesh
59         ),
60         mesh,
61         dimensionedScalar("yStar", dimless, 1.0)
62     );
64     // Fill wall patches of yStar with some value.
65     forAll(mesh.boundary(), patchI)
66     {
67         const fvPatch& patch = mesh.boundary()[patchI];
69         if (typeid(patch) == typeid(wallFvPatch))
70         {
71             fvPatchScalarField& wallData = yStar.boundaryField()[patchI];
73             forAll(patch, patchFaceI)
74             {
75 // Hack. Just some value.
76                 wallData[patchFaceI] = 1/2500.0;
77             }
78         }
79     }
82     // Do distance calculation, transporting values of yStar
83     wallPointYPlus::yPlusCutOff = 200;
84     wallDistData<wallPointYPlus> y(mesh, yStar, true);
86     if (y.nUnset() != 0)
87     {
88         WarningIn(args.executable())
89             << "There are " << y.nUnset()
90             << " remaining unset cells and/or boundary values" << endl;
91     }
94     y.write();
96     y.data().write();
98     volScalarField yPlus
99     (
100         IOobject
101         (
102             "yPlus",
103             mesh.time().timeName(),
104             mesh
105         ),
106         y/y.data()
107     );
109     yPlus.write();
111     Info<< "End\n" << endl;
113     return 0;
120 // ************************************************************************* //