postCalc.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) 2011-2015 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  postCalc
26 
27 Description
28  Generic wrapper for calculating a quantity at each time
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "calc.H"
33 #include "timeSelector.H"
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39  void tryCalc(const argList& args, const Time& runTime, const fvMesh& mesh)
40  {
42 
43  try
44  {
45  calc(args, runTime, mesh);
46  }
47  catch(IOerror& err)
48  {
49  Warning<< err << endl;
50  }
51  }
52 }
53 
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 int main(int argc, char *argv[])
58 {
60  #include "addRegionOption.H"
62  (
63  "noWrite",
64  "suppress writing results"
65  );
66  #include "addDictOption.H"
67 
68  #include "setRootCase.H"
69  #include "createTime.H"
71  #include "createNamedMesh.H"
72 
73  forAll(timeDirs, timeI)
74  {
75  runTime.setTime(timeDirs[timeI], timeI);
76 
77  Foam::Info<< "Time = " << runTime.timeName() << Foam::endl;
78 
79  mesh.readUpdate();
80 
81  Foam::tryCalc(args, runTime, mesh);
82 
84  }
85 
86  return 0;
87 }
88 
89 
90 // ************************************************************************* //
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::Warning
messageStream Warning
Foam::calc
void calc(const argList &args, const Time &runTime, const fvMesh &mesh)
Definition: Lambda2.C:38
Foam::argList::addBoolOption
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Definition: argList.C:98
Foam::argList
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:97
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
addDictOption.H
Foam::Info
messageStream Info
addRegionOption.H
main
int main(int argc, char *argv[])
Definition: postCalc.C:54
calc.H
Function prototype for all simple post-processing functions e.g. calcDivPhi, calcMagU etc.
createNamedMesh.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::error::throwExceptions
void throwExceptions()
Definition: error.H:121
setRootCase.H
timeDirs
static instantList timeDirs
Definition: globalFoam.H:44
Foam::tryCalc
void tryCalc(const argList &args, const Time &runTime, const fvMesh &mesh)
Definition: postCalc.C:36
Foam::timeSelector::addOptions
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
Definition: timeSelector.C:114
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
timeSelector.H
createTime.H
Foam::IOerror
Report an I/O error.
Definition: error.H:195
Foam::timeSelector::select0
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
Definition: timeSelector.C:253
args
Foam::argList args(argc, argv)