ENH: patchCloud: return pTraits<Type>::max for unfound points
[OpenFOAM-1.7.x.git] / applications / utilities / postProcessing / wall / wallHeatFlux / wallHeatFlux.C
blobc1bd9f05f4d47cd32ad6618a566cb095694840ae
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2010 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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 Application
25     wallHeatFlux
27 Description
28     Calculates and writes the heat flux for all patches as the boundary field
29     of a volScalarField and also prints the integrated flux for all wall
30     patches.
32 \*---------------------------------------------------------------------------*/
34 #include "fvCFD.H"
35 #include "hCombustionThermo.H"
36 #include "RASModel.H"
37 #include "wallFvPatch.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 int main(int argc, char *argv[])
43     timeSelector::addOptions();
44     #include "setRootCase.H"
45     #include "createTime.H"
46     instantList timeDirs = timeSelector::select0(runTime, args);
47     #include "createMesh.H"
49     forAll(timeDirs, timeI)
50     {
51         runTime.setTime(timeDirs[timeI], timeI);
52         Info<< "Time = " << runTime.timeName() << endl;
53         mesh.readUpdate();
55         #include "createFields.H"
57         surfaceScalarField heatFlux =
58             fvc::interpolate(RASModel->alphaEff())*fvc::snGrad(h);
60         const surfaceScalarField::GeometricBoundaryField& patchHeatFlux =
61             heatFlux.boundaryField();
63         Info<< "\nWall heat fluxes [W]" << endl;
64         forAll(patchHeatFlux, patchi)
65         {
66             if (isA<wallFvPatch>(mesh.boundary()[patchi]))
67             {
68                 Info<< mesh.boundary()[patchi].name()
69                     << " "
70                     << sum
71                        (
72                            mesh.magSf().boundaryField()[patchi]
73                           *patchHeatFlux[patchi]
74                        )
75                     << endl;
76             }
77         }
78         Info<< endl;
80         volScalarField wallHeatFlux
81         (
82             IOobject
83             (
84                 "wallHeatFlux",
85                 runTime.timeName(),
86                 mesh
87             ),
88             mesh,
89             dimensionedScalar("wallHeatFlux", heatFlux.dimensions(), 0.0)
90         );
92         forAll(wallHeatFlux.boundaryField(), patchi)
93         {
94             wallHeatFlux.boundaryField()[patchi] = patchHeatFlux[patchi];
95         }
97         wallHeatFlux.write();
98     }
100     Info<< "End" << endl;
102     return 0;
105 // ************************************************************************* //