continuityError.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2019-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::functionObjects::continuityError
28 
29 Group
30  grpFieldFunctionObjects
31 
32 Description
33  Computes local, global and cumulative continuity errors for a flux field.
34 
35  Local continuity error, \f$ \epsilon_{local} \f$:
36  \f[
37  \epsilon_{local} = \Delta_t \langle |x| \rangle
38  \f]
39 
40  Global continuity error, \f$ \epsilon_{global} \f$:
41  \f[
42  \epsilon_{global} = \Delta_t \langle |x| \rangle
43  \f]
44 
45  Cumulative continuity, \f$ \epsilon_{cum} \f$:
46  \f[
47  \epsilon_{cum} += \epsilon_{global}
48  \f]
49 
50  where
51  \vartable
52  \Delta_t | Time-step size
53  \langle . \rangle | Cell-volume weighted average operator
54  x | \f$ \div \phi \f$
55  phi | Flux field
56  \endvartable
57 
58  Operands:
59  \table
60  Operand | Type | Location
61  input | - | -
62  output file | dat | $FOAM_CASE/postProcessing/<FO>/<time>/<file>
63  output field | - | -
64  \endtable
65 
66 Usage
67  Minimal example by using \c system/controlDict.functions:
68  \verbatim
69  continuityError1
70  {
71  // Mandatory entries (unmodifiable)
72  type continuityError;
73  libs (fieldFunctionObjects);
74 
75  // Optional entries (runtime modifiable)
76  phi phi;
77 
78  // Optional (inherited) entries
79  ...
80  }
81  \endverbatim
82 
83  where the entries mean:
84  \table
85  Property | Description | Type | Req'd | Dflt
86  type | Type name: continuityError | word | yes | -
87  libs | Library name: fieldFunctionObjects | word | yes | -
88  phi | Name of flux field | word | no | phi
89  \endtable
90 
91  The inherited entries are elaborated in:
92  - \link functionObject.H \endlink
93  - \link writeFile.H \endlink
94 
95  Usage by the \c postProcess utility is not available.
96 
97 See also
98  - Foam::functionObject
99  - Foam::functionObjects::fvMeshFunctionObject
100  - Foam::functionObjects::writeFile
101  - ExtendedCodeGuide::functionObjects::field::continuityError
102 
103 SourceFiles
104  continuityError.C
105 
106 \*---------------------------------------------------------------------------*/
107 
108 #ifndef functionObjects_continuityError_H
109 #define functionObjects_continuityError_H
110 
111 #include "Switch.H"
112 #include "fvMeshFunctionObject.H"
113 #include "writeFile.H"
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 namespace Foam
118 {
119 namespace functionObjects
120 {
121 
122 /*---------------------------------------------------------------------------*\
123  Class continuityError Declaration
124 \*---------------------------------------------------------------------------*/
125 
126 class continuityError
127 :
128  public fvMeshFunctionObject,
129  public writeFile
130 {
131 protected:
132 
133  // Protected Data
134 
135  //- Name of flux field
136  word phiName_;
137 
138  //- Cumulative error
139  scalar cumulative_;
140 
141 
142  // Protected Member Functions
143 
144  //- Output file header information
145  virtual void writeFileHeader(Ostream& os);
146 
147 
148 public:
149 
150  //- Runtime type information
151  TypeName("continuityError");
152 
153 
154  // Constructors
155 
156  //- Construct from Time and dictionary
158  (
159  const word& name,
160  const Time& runTime,
161  const dictionary& dict
162  );
163 
164  //- No copy construct
165  continuityError(const continuityError&) = delete;
166 
167  //- No copy assignment
168  void operator=(const continuityError&) = delete;
169 
170 
171  //- Destructor
172  virtual ~continuityError() = default;
173 
174 
175  // Member Functions
176 
177  //- Read the field min/max data
178  virtual bool read(const dictionary&);
179 
180  //- Execute, currently does nothing
181  virtual bool execute();
182 
183  //- Write the continuityError
184  virtual bool write();
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace functionObjects
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
writeFile.H
Foam::functionObjects::continuityError
Computes local, global and cumulative continuity errors for a flux field.
Definition: continuityError.H:181
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
fvMeshFunctionObject.H
Foam::functionObjects::continuityError::phiName_
word phiName_
Name of flux field.
Definition: continuityError.H:191
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::functionObjects::continuityError::operator=
void operator=(const continuityError &)=delete
No copy assignment.
Foam::functionObjects::continuityError::write
virtual bool write()
Write the continuityError.
Definition: continuityError.C:102
Switch.H
Foam::functionObjects::continuityError::execute
virtual bool execute()
Execute, currently does nothing.
Definition: continuityError.C:96
Foam::functionObjects::continuityError::continuityError
continuityError(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: continuityError.C:63
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::functionObjects::continuityError::read
virtual bool read(const dictionary &)
Read the field min/max data.
Definition: continuityError.C:83
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::continuityError::cumulative_
scalar cumulative_
Cumulative error.
Definition: continuityError.H:194
Foam::functionObjects::continuityError::TypeName
TypeName("continuityError")
Runtime type information.
Foam::functionObjects::continuityError::~continuityError
virtual ~continuityError()=default
Destructor.
Foam::functionObject::name
const word & name() const
Return the name of this functionObject.
Definition: functionObject.C:131
Foam::functionObjects::continuityError::writeFileHeader
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition: continuityError.C:47
Foam::functionObjects::writeFile
Base class for writing single files from the function objects.
Definition: writeFile.H:119
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56