Loading...
Searching...
No Matches
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 | postProcessing/<FO>/<time>/file
63 output field | - | -
64 \endtable
65
66Usage
67 Minimal example by using \c system/controlDict.functions:
68 \verbatim
69 continuityErrorFO
70 {
71 // Mandatory entries
72 type continuityError;
73 libs (fieldFunctionObjects);
74
75 // Optional entries
76 phi <word>;
77
78 // Inherited entries
79 ...
80 }
81 \endverbatim
82
83 where the entries mean:
84 \table
85 Property | Description | Type | Reqd | Deflt
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
95SourceFiles
96 continuityError.C
97
98\*---------------------------------------------------------------------------*/
99
100#ifndef Foam_functionObjects_continuityError_H
101#define Foam_functionObjects_continuityError_H
102
103#include "Switch.H"
104#include "fvMeshFunctionObject.H"
105#include "writeFile.H"
106
107// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108
109namespace Foam
110{
111namespace functionObjects
112{
113
114/*---------------------------------------------------------------------------*\
115 Class continuityError Declaration
116\*---------------------------------------------------------------------------*/
117
118class continuityError
119:
121 public writeFile
122{
123protected:
124
125 // Protected Data
126
127 //- Name of flux field
128 word phiName_;
129
130 //- Cumulative error
131 scalar cumulative_;
132
133
134 // Protected Member Functions
135
136 //- Output file header information
137 virtual void writeFileHeader(Ostream& os);
138
139
140public:
141
142 //- Runtime type information
143 TypeName("continuityError");
144
145
146 // Constructors
147
148 //- Construct from name, Time and dictionary
150 (
151 const word& name,
152 const Time& runTime,
153 const dictionary& dict
154 );
155
156 //- No copy construct
157 continuityError(const continuityError&) = delete;
158
159 //- No copy assignment
160 void operator=(const continuityError&) = delete;
161
162
163 //- Destructor
164 virtual ~continuityError() = default;
165
166
167 // Member Functions
168
169 //- Read the function-object dictionary
170 virtual bool read(const dictionary& dict);
171
172 //- Execute the function-object operations
173 virtual bool execute();
174
175 //- Write the function-object results
176 virtual bool write();
177};
178
179
180// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182} // End namespace functionObjects
183} // End namespace Foam
184
185// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187#endif
188
189// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
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.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
continuityError(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
virtual void writeFileHeader(Ostream &os)
Output file header information.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
void operator=(const continuityError &)=delete
No copy assignment.
continuityError(const continuityError &)=delete
No copy construct.
TypeName("continuityError")
Runtime type information.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Base class for writing single files from the function objects.
Definition writeFile.H:113
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
Definition writeFile.C:200
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68