Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
applications
utilities
postProcessing
foamCalc
foamCalc.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
foamCalc
26
27
Description
28
Generic wrapper for calculating a quantity at each time.
29
30
Split into four phases:
31
1. Intialise
32
2. Pre-time calculation loop
33
3. Calculation loop
34
4. Post-calculation loop
35
36
Usage
37
38
- foamCalc [OPTIONS] <operation> <fields>
39
40
@param <operation> \n
41
@todo Detailed description of argument.
42
43
@param <fields> \n
44
@todo Detailed description of argument.
45
46
@param -noWrite \n
47
Suppress output to files.
48
49
@param -dictionary <dictionary name>\n
50
Use specified dictionary.
51
52
@param -noZero \n
53
Ignore timestep 0.
54
55
@param -constant \n
56
Include the constant directory.
57
58
@param -time <time>\n
59
Apply only to specific time.
60
61
@param -latestTime \n
62
Only apply to latest time step.
63
64
@param -case <dir>\n
65
Case directory.
66
67
@param -parallel \n
68
Run in parallel.
69
70
@param -help \n
71
Display help message.
72
73
@param -doc \n
74
Display Doxygen API documentation page for this application.
75
76
@param -srcDoc \n
77
Display Doxygen source documentation page for this application.
78
79
\*---------------------------------------------------------------------------*/
80
81
#include <
OpenFOAM/timeSelector.H
>
82
#include <
foamCalcFunctions/calcType.H
>
83
84
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85
86
int
main
(
int
argc,
char
*argv[])
87
{
88
Foam::timeSelector::addOptions
();
89
Foam::argList::validOptions
.
insert
(
"noWrite"
,
""
);
90
Foam::argList::validOptions
.
insert
(
"dict"
,
"dictionary name"
);
91
Foam::argList::validArgs
.
append
(
"operation"
);
92
Foam::argList::validArgs
.
append
(
"field"
);
93
94
if
(argc < 2)
95
{
96
FatalError
97
<<
"No utility has been supplied"
<<
nl
98
<<
exit
(
FatalError
);
99
}
100
101
Foam::argList
args
(argc, argv,
false
);
102
if
(!
args
.
checkRootCase
())
103
{
104
Foam::FatalError
.
exit
();
105
}
106
# include <
OpenFOAM/createTime.H
>
107
Foam::instantList
timeDirs
=
Foam::timeSelector::select0
(runTime,
args
);
108
# include <
OpenFOAM/createMesh.H
>
109
110
word
utilityName =
args
.
additionalArgs
()[0];
111
112
Foam::autoPtr<Foam::calcType>
utility
113
(
114
calcType::New(utilityName)
115
);
116
117
utility().tryInit();
118
119
utility().tryPreCalc(
args
, runTime,
mesh
);
120
121
forAll
(timeDirs, timeI)
122
{
123
runTime.setTime(timeDirs[timeI], timeI);
124
125
Foam::Info
<<
"Time = "
<< runTime.timeName() <<
Foam::endl
;
126
127
mesh
.
readUpdate
();
128
129
utility().tryCalc(
args
, runTime,
mesh
);
130
131
Foam::Info
<<
Foam::endl
;
132
}
133
134
utility().tryPostCalc(
args
, runTime,
mesh
);
135
136
Info
<<
"End\n"
<<
endl
;
137
138
return
0;
139
}
140
141
142
// ************************ vim: set sw=4 sts=4 et: ************************ //