FreeFOAM The Cross-Platform CFD Toolkit
patchSummary.C
Go to the documentation of this file.
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.
10 
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.
15 
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.
20 
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/>.
23 
24 Application
25  patchSummary
26 
27 Description
28  Writes fields and boundary condition info for each patch at each requested
29  time instance.
30 
31 Usage
32 
33  - patchSummary [OPTIONS]
34 
35  @param -noZero \n
36  Ignore timestep 0.
37 
38  @param -constant \n
39  Include the constant directory.
40 
41  @param -time <time>\n
42  Apply only to specific time.
43 
44  @param -latestTime \n
45  Only apply to latest time step.
46 
47  @param -case <dir>\n
48  Case directory.
49 
50  @param -parallel \n
51  Run in parallel.
52 
53  @param -help \n
54  Display help message.
55 
56  @param -doc \n
57  Display Doxygen API documentation page for this application.
58 
59  @param -srcDoc \n
60  Display Doxygen source documentation page for this application.
61 
62 \*---------------------------------------------------------------------------*/
63 
64 #include <finiteVolume/fvCFD.H>
65 #include <finiteVolume/volFields.H>
66 #include <OpenFOAM/IOobjectList.H>
67 #include "patchSummaryTemplates.H"
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 int main(int argc, char *argv[])
72 {
73  timeSelector::addOptions();
74 
76 # include <OpenFOAM/setRootCase.H>
77 # include <OpenFOAM/createTime.H>
78 
79  instantList timeDirs = timeSelector::select0(runTime, args);
80 
82 
83  forAll(timeDirs, timeI)
84  {
85  runTime.setTime(timeDirs[timeI], timeI);
86 
87  Info<< "Time = " << runTime.timeName() << nl << endl;
88 
89  const IOobjectList fieldObjs(mesh, runTime.timeName());
90  const wordList objNames = fieldObjs.names();
91 
92  PtrList<volScalarField> vsf(objNames.size());
93  PtrList<volVectorField> vvf(objNames.size());
94  PtrList<volSphericalTensorField> vsptf(objNames.size());
95  PtrList<volSymmTensorField> vsytf(objNames.size());
96  PtrList<volTensorField> vtf(objNames.size());
97 
98  Info<< "Valid fields:" << endl;
99 
100  forAll(objNames, objI)
101  {
102  IOobject obj
103  (
104  objNames[objI],
105  runTime.timeName(),
106  mesh,
107  IOobject::MUST_READ
108  );
109 
110  if (obj.headerOk())
111  {
112  addToFieldList<scalar>(vsf, obj, objI, mesh);
113  addToFieldList<vector>(vvf, obj, objI, mesh);
114  addToFieldList<sphericalTensor>(vsptf, obj, objI, mesh);
115  addToFieldList<symmTensor>(vsytf, obj, objI, mesh);
116  addToFieldList<tensor>(vtf, obj, objI, mesh);
117  }
118  }
119 
120  Info<< endl;
121 
122  const polyBoundaryMesh& bm = mesh.boundaryMesh();
123  forAll(bm, patchI)
124  {
125  Info<< bm[patchI].type() << ": " << bm[patchI].name() << nl;
126  outputFieldList<scalar>(vsf, patchI);
127  outputFieldList<vector>(vvf, patchI);
128  outputFieldList<sphericalTensor>(vsptf, patchI);
129  outputFieldList<symmTensor>(vsytf, patchI);
130  outputFieldList<tensor>(vtf, patchI);
131  Info << endl;
132  }
133  }
134 
135  Info << "End\n" << endl;
136 
137  return 0;
138 }
139 
140 
141 // ************************ vim: set sw=4 sts=4 et: ************************ //