residuals.H
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) 2015-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 Class
25  Foam::functionObjects::residuals
26 
27 Description
28  Writes out the initial residual for specified fields.
29 
30  Example of function object specification:
31  \verbatim
32  residuals
33  {
34  type residuals;
35  writeControl timeStep;
36  writeInterval 1;
37  fields
38  (
39  U
40  p
41  );
42  }
43  \endverbatim
44 
45  Output data is written to the dir postProcessing/residuals/<timeDir>/
46  For vector/tensor fields, e.g. U, where an equation is solved for each
47  component, the largest residual of each component is written out.
48 
49 See also
50  Foam::functionObject
51  Foam::functionObjects::fvMeshFunctionObject
52  Foam::functionObjects::logFiles
53  Foam::functionObjects::timeControl
54 
55 SourceFiles
56  residuals.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef functionObjects_residuals_H
61 #define functionObjects_residuals_H
62 
63 #include "fvMeshFunctionObject.H"
64 #include "logFiles.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 namespace functionObjects
71 {
72 
73 /*---------------------------------------------------------------------------*\
74  Class residuals Declaration
75 \*---------------------------------------------------------------------------*/
76 
77 class residuals
78 :
79  public fvMeshFunctionObject,
80  public logFiles
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 public:
105 
106  //- Runtime type information
107  TypeName("residuals");
108 
109 
110  // Constructors
111 
112  //- Construct from Time and dictionary
113  residuals
114  (
115  const word& name,
116  const Time& runTime,
117  const dictionary& dict
118  );
119 
120  //- Disallow default bitwise copy construction
121  residuals(const residuals&) = delete;
122 
123 
124  //- Destructor
125  virtual ~residuals();
126 
127 
128  // Member Functions
129 
130  //- Read the controls
131  virtual bool read(const dictionary&);
132 
133  //- Execute, currently does nothing
134  virtual bool execute();
135 
136  //- Write the residuals
137  virtual bool write();
138 
139 
140  // Member Operators
141 
142  //- Disallow default bitwise assignment
143  void operator=(const residuals&) = delete;
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace functionObjects
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #ifdef NoRepository
155  #include "residualsTemplates.C"
156 #endif
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************************************************************* //
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:158
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.
engineTime & runTime
void operator=(const residuals &)=delete
Disallow default bitwise assignment.
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
Writes out the initial residual for specified fields.
Definition: residuals.H:76
A class for handling words, derived from string.
Definition: word.H:59
virtual ~residuals()
Destructor.
Definition: residuals.C:67
residuals(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: residuals.C:50
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