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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::functionObjects::continuityError
28
29Group
30 grpFieldFunctionObjects
31
32Description
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
66Usage
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
97See also
98 - Foam::functionObject
99 - Foam::functionObjects::fvMeshFunctionObject
100 - Foam::functionObjects::writeFile
101 - ExtendedCodeGuide::functionObjects::field::continuityError
102
103SourceFiles
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
117namespace Foam
118{
119namespace functionObjects
120{
121
122/*---------------------------------------------------------------------------*\
123 Class continuityError Declaration
124\*---------------------------------------------------------------------------*/
125
126class continuityError
127:
128 public fvMeshFunctionObject,
129 public writeFile
130{
131protected:
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
148public:
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// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195#endif
196
197// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Computes local, global and cumulative continuity errors for a flux field.
virtual ~continuityError()=default
Destructor.
continuityError(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual void writeFileHeader(Ostream &os)
Output file header information.
virtual bool execute()
Execute, currently does nothing.
virtual bool write()
Write the continuityError.
void operator=(const continuityError &)=delete
No copy assignment.
continuityError(const continuityError &)=delete
No copy construct.
TypeName("continuityError")
Runtime type information.
virtual bool read(const dictionary &)
Read the field min/max data.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Base class for writing single files from the function objects.
Definition: writeFile.H:120
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73