residuals.H
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) 2015-2016 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 Class
25  Foam::functionObjects::residuals
26 
27 Group
28  grpUtilitiesFunctionObjects
29 
30 Description
31  Writes out the initial residual for specified fields.
32 
33  Example of function object specification:
34  \verbatim
35  residuals
36  {
37  type residuals;
38  writeControl timeStep;
39  writeInterval 1;
40  fields
41  (
42  U
43  p
44  );
45  }
46  \endverbatim
47 
48  Output data is written to the dir postProcessing/residuals/<timeDir>/
49  For vector/tensor fields, e.g. U, where an equation is solved for each
50  component, the largest residual of each component is written out.
51 
52 See also
53  Foam::functionObject
54  Foam::functionObjects::fvMeshFunctionObject
55  Foam::functionObjects::logFiles
56  Foam::functionObjects::timeControl
57 
58 SourceFiles
59  residuals.C
60 
61 \*---------------------------------------------------------------------------*/
62 
63 #ifndef functionObjects_residuals_H
64 #define functionObjects_residuals_H
65 
66 #include "fvMeshFunctionObject.H"
67 #include "logFiles.H"
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 namespace Foam
72 {
73 namespace functionObjects
74 {
75 
76 /*---------------------------------------------------------------------------*\
77  Class residuals Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 class residuals
81 :
82  public fvMeshFunctionObject,
83  public logFiles
84 {
85 protected:
86 
87  // Protected data
88 
89  //- Fields to write residuals
91 
92 
93  // Protected Member Functions
94 
95  //- Output field header information
96  template<class Type>
97  void writeFileHeader(const word& fieldName);
98 
99  //- Output file header information
100  virtual void writeFileHeader(const label i);
101 
102  //- Calculate the field min/max
103  template<class Type>
104  void writeResidual(const word& fieldName);
105 
106 
107 private:
108 
109  // Private member functions
110 
111  //- Disallow default bitwise copy construct
112  residuals(const residuals&);
113 
114  //- Disallow default bitwise assignment
115  void operator=(const residuals&);
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("residuals");
122 
123 
124  // Constructors
125 
126  //- Construct from Time and dictionary
127  residuals
128  (
129  const word& name,
130  const Time& runTime,
131  const dictionary& dict
132  );
133 
134 
135  //- Destructor
136  virtual ~residuals();
137 
138 
139  // Member Functions
140 
141  //- Read the controls
142  virtual bool read(const dictionary&);
143 
144  //- Execute, currently does nothing
145  virtual bool execute();
146 
147  //- Write the residuals
148  virtual bool write();
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace functionObjects
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #ifdef NoRepository
160  #include "residualsTemplates.C"
161 #endif
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
void writeResidual(const word &fieldName)
Calculate the field min/max.
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual bool write()
Write the residuals.
Definition: residuals.C:112
const word & name() const
Return the name of this functionObject.
virtual bool execute()
Execute, currently does nothing.
Definition: residuals.C:106
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
void writeFileHeader(const word &fieldName)
Output field header information.
virtual bool read(const dictionary &)
Read the controls.
Definition: residuals.C:73
TypeName("residuals")
Runtime type information.
wordList fieldSet_
Fields to write residuals.
Definition: residuals.H:89
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Writes out the initial residual for specified fields.
Definition: residuals.H:79
A class for handling words, derived from string.
Definition: word.H:59
virtual ~residuals()
Destructor.
Definition: residuals.C:67
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Namespace for OpenFOAM.
functionObject base class for creating, maintaining and writing log files e.g. integrated of averaged...
Definition: logFiles.H:57