OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

wallHeatFlux.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Application
00026     wallHeatFlux
00027 
00028 Description
00029     Calculates and writes the heat flux for all patches as the boundary field
00030     of a volScalarField and also prints the integrated flux for all wall
00031     patches.
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #include "fvCFD.H"
00036 #include "hCombustionThermo.H"
00037 #include "RASModel.H"
00038 #include "wallFvPatch.H"
00039 
00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00041 
00042 int main(int argc, char *argv[])
00043 {
00044     timeSelector::addOptions();
00045     #include "setRootCase.H"
00046     #include "createTime.H"
00047     instantList timeDirs = timeSelector::select0(runTime, args);
00048     #include "createMesh.H"
00049 
00050     forAll(timeDirs, timeI)
00051     {
00052         runTime.setTime(timeDirs[timeI], timeI);
00053         Info<< "Time = " << runTime.timeName() << endl;
00054         mesh.readUpdate();
00055 
00056         #include "createFields.H"
00057 
00058         surfaceScalarField heatFlux =
00059             fvc::interpolate(RASModel->alphaEff())*fvc::snGrad(h);
00060 
00061         const surfaceScalarField::GeometricBoundaryField& patchHeatFlux =
00062             heatFlux.boundaryField();
00063 
00064         Info<< "\nWall heat fluxes [W]" << endl;
00065         forAll(patchHeatFlux, patchi)
00066         {
00067             if (typeid(mesh.boundary()[patchi]) == typeid(wallFvPatch))
00068             {
00069                 Info<< mesh.boundary()[patchi].name()
00070                     << " "
00071                     << sum
00072                        (
00073                            mesh.magSf().boundaryField()[patchi]
00074                           *patchHeatFlux[patchi]
00075                        )
00076                     << endl;
00077             }
00078         }
00079         Info<< endl;
00080 
00081         volScalarField wallHeatFlux
00082         (
00083             IOobject
00084             (
00085                 "wallHeatFlux",
00086                 runTime.timeName(),
00087                 mesh
00088             ),
00089             mesh,
00090             dimensionedScalar("wallHeatFlux", heatFlux.dimensions(), 0.0)
00091         );
00092 
00093         forAll(wallHeatFlux.boundaryField(), patchi)
00094         {
00095             wallHeatFlux.boundaryField()[patchi] = patchHeatFlux[patchi];
00096         }
00097 
00098         wallHeatFlux.write();
00099     }
00100 
00101     Info<< "End" << endl;
00102 
00103     return 0;
00104 }
00105 
00106 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd