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  This function object 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::writeFiles
55  Foam::functionObjects::timeControl
56 
57 SourceFiles
58  residuals.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef functionObjects_residuals_H
63 #define functionObjects_residuals_H
64 
65 #include "writeFiles.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace functionObjects
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class residuals Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class residuals
79 :
80  public writeFiles
81 {
82 protected:
83 
84  // Protected data
85 
86  //- Fields to write residuals
88 
89 
90  // Protected Member Functions
91 
92  //- Output field header information
93  template<class Type>
94  void writeFileHeader(const word& fieldName);
95 
96  //- Output file header information
97  virtual void writeFileHeader(const label i);
98 
99  //- Calculate the field min/max
100  template<class Type>
101  void writeResidual(const word& fieldName);
102 
103 
104 private:
105 
106  // Private member functions
107 
108  //- Disallow default bitwise copy construct
109  residuals(const residuals&);
110 
111  //- Disallow default bitwise assignment
112  void operator=(const residuals&);
113 
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("residuals");
119 
120 
121  // Constructors
122 
123  //- Construct from Time and dictionary
124  residuals
125  (
126  const word& name,
127  const Time& runTime,
128  const dictionary& dict
129  );
130 
131 
132  //- Destructor
133  virtual ~residuals();
134 
135 
136  // Member Functions
137 
138  //- Read the controls
139  virtual bool read(const dictionary&);
140 
141  //- Execute, currently does nothing
142  virtual bool execute();
143 
144  //- Write the residuals
145  virtual bool write();
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace functionObjects
152 } // End namespace Foam
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #ifdef NoRepository
157  #include "residualsTemplates.C"
158 #endif
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
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:115
virtual bool execute()
Execute, currently does nothing.
Definition: residuals.C:109
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.
functionObject base class for writing files
Definition: writeFiles.H:56
virtual bool read(const dictionary &)
Read the controls.
Definition: residuals.C:78
TypeName("residuals")
Runtime type information.
wordList fieldSet_
Fields to write residuals.
Definition: residuals.H:86
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
This function object writes out the initial residual for specified fields.
Definition: residuals.H:77
const word & name() const
Return the name of this functionObject.
A class for handling words, derived from string.
Definition: word.H:59
virtual ~residuals()
Destructor.
Definition: residuals.C:72
Namespace for OpenFOAM.