postChannel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
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  postChannel
26 
27 Description
28  Post-processes data from channel flow calculations.
29 
30  For each time: calculate: txx, txy,tyy, txy,
31  eps, prod, vorticity, enstrophy and helicity. Assuming that the mesh
32  is periodic in the x and z directions, collapse Umeanx, Umeany, txx,
33  txy and tyy to a line and print them as standard output.
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #include "argList.H"
38 #include "timeSelector.H"
39 #include "volFields.H"
40 #include "channelIndex.H"
41 #include "makeGraph.H"
42 #include "writeFile.H"
43 
44 using namespace Foam;
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 int main(int argc, char *argv[])
49 {
52 
53  #include "setRootCase.H"
54  #include "createTime.H"
55 
56  // Get times list
58 
59  #include "createMesh.H"
60  #include "readTransportProperties.H"
61 
62  const word& gFormat = runTime.graphFormat();
63 
64  // Setup channel indexing for averaging over channel down to a line
65 
66  IOdictionary channelDict
67  (
68  IOobject
69  (
70  "postChannelDict",
71  mesh.time().system(),
72  mesh,
75  )
76  );
77  channelIndex channelIndexing(mesh, channelDict);
78 
79 
80  // For each time step read all fields
81  forAll(timeDirs, timeI)
82  {
83  runTime.setTime(timeDirs[timeI], timeI);
84  Info<< "Collapsing fields for time " << runTime.timeName() << endl;
85 
86  #include "readFields.H"
87  #include "calculateFields.H"
88 
89  // Average fields over channel down to a line
90  #include "collapse.H"
91  }
92 
93  Info<< "\nEnd\n" << endl;
94 
95  return 0;
96 }
97 
98 
99 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
static void noParallel()
Remove the parallel options.
Definition: argList.C:174
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:626
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:239
Does averaging of fields over layers of cells. Assumes layered mesh.
Definition: channelIndex.H:51
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
virtual void setTime(const Time &)
Reset the time and time-index to those of the given time.
Definition: Time.C:873
const word & system() const
Return system name.
Definition: TimePaths.H:114
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
Definition: timeSelector.C:252
const word & graphFormat() const
Default graph format.
Definition: Time.H:306
messageStream Info
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
Definition: timeSelector.C:114
Namespace for OpenFOAM.