BUGFIX: Illegal use of uninitialised value (backport)
[foam-extend-3.2.git] / applications / utilities / postProcessing / wall / wallShearStress / wallShearStress.C
blobe2ba47cb3fa65e2716350c3114fea970494895a0
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 Application
26     wallShearStress
28 Description
29     Calculates and writes the wall shear stress, for the specified times.
31 \*---------------------------------------------------------------------------*/
33 #include "fvCFD.H"
34 #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
35 #include "RASModel.H"
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 int main(int argc, char *argv[])
41     timeSelector::addOptions();
42     #include "setRootCase.H"
43     #include "createTime.H"
44     instantList timeDirs = timeSelector::select0(runTime, args);
45     #include "createMesh.H"
47     forAll(timeDirs, timeI)
48     {
49         runTime.setTime(timeDirs[timeI], timeI);
50         Info<< "Time = " << runTime.timeName() << endl;
51         mesh.readUpdate();
53         #include "createFields.H"
55         volSymmTensorField Reff(RASModel->devReff());
57         volVectorField wallShearStress
58         (
59             IOobject
60             (
61                 "wallShearStress",
62                 runTime.timeName(),
63                 mesh,
64                 IOobject::NO_READ,
65                 IOobject::AUTO_WRITE
66             ),
67             mesh,
68             dimensionedVector
69             (
70                 "wallShearStress",
71                 Reff.dimensions(),
72                 vector::zero
73             )
74         );
76         forAll(wallShearStress.boundaryField(), patchi)
77         {
78             wallShearStress.boundaryField()[patchi] =
79             (
80                 -mesh.Sf().boundaryField()[patchi]
81                 /mesh.magSf().boundaryField()[patchi]
82             ) & Reff.boundaryField()[patchi];
83         }
85         wallShearStress.write();
86     }
88     Info<< "End" << endl;
90     return 0;
94 // ************************************************************************* //