Loading...
Searching...
No Matches
momentumError.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) 2020-2021 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::momentumError
28
29Group
30 grpForcesFunctionObjects
31
32Description
33 Computes balance terms for the steady momentum equation.
34
35 Operands:
36 \table
37 Operand | Type | Location
38 input | - | -
39 output file | - | -
40 output field | volVectorField | <time>/file
41 \endtable
42
43Usage
44 Minimal example by using \c system/controlDict.functions:
45 \verbatim
46 momentumErrorFO
47 {
48 // Mandatory entries
49 type momentumError;
50 libs (fieldFunctionObjects);
51
52 // Optional entries
53 p <word>;
54 U <word>;
55 phi <word>;
56
57 // Inherited entries
58 ...
59 }
60 \endverbatim
61
62 where the entries mean:
63 \table
64 Property | Description | Type | Reqd | Deflt
65 type | Type name: momentumError | word | yes | -
66 libs | Library name: fieldFunctionObjects | word | yes | -
67 p | Name of pressure field | word | no | p
68 U | Name of velocity field | word | no | U
69 phi | Name of flux field | word | no | phi
70 \endtable
71
72 The inherited entries are elaborated in:
73 - \link functionObject.H \endlink
74 - \link zoneSubSet.H \endlink
75
76Note
77 - Optionally the user can specify \c cellZones to create a sub-mesh for the
78 \c momentumError calculation.
79
80SourceFiles
81 momentumError.C
82
83\*---------------------------------------------------------------------------*/
84
85#ifndef Foam_functionObjects_momentumError_H
86#define Foam_functionObjects_momentumError_H
87
89#include "volFieldsFwd.H"
90#include "zoneSubSet.H"
91
92// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93
94namespace Foam
95{
96namespace functionObjects
97{
98
99/*---------------------------------------------------------------------------*\
100 Class momentumError Declaration
101\*---------------------------------------------------------------------------*/
102
103class momentumError
104:
106{
107protected:
108
109 // Protected Data
110
111 // Read from dictionary
112
113 //- Name of pressure field
114 word pName_;
115
116 //- Name of velocity field
117 word UName_;
118
119 //- Name of flux field
120 word phiName_;
121
122 //- Sub-set mesh
123 autoPtr<Detail::zoneSubSet> zoneSubSetPtr_;
124
125
126 // Protected Member Functions
127
128 //- Return the effective viscous stress (laminar + turbulent).
129 tmp<volVectorField> divDevRhoReff();
130
131
132public:
133
134 //- Runtime type information
135 TypeName("momentumError");
136
137
138 // Constructors
139
140 //- Construct from name, Time and dictionary
142 (
143 const word& name,
144 const Time& runTime,
145 const dictionary& dict
146 );
147
148 //- No copy construct
149 momentumError(const momentumError&) = delete;
151 //- No copy assignment
152 void operator=(const momentumError&) = delete;
153
154
155 //- Destructor
156 virtual ~momentumError() = default;
157
158
159 // Member Functions
160
161 //- Read the function-object dictionary
162 virtual bool read(const dictionary& dict);
164 //- Execute the function-object operations
165 virtual bool execute();
166
167 //- Write the function-object results
168 virtual bool write();
169
170 //- Calculate the momentum error
171 void calcMomentError();
172};
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177} // End namespace functionObjects
178} // End namespace Foam
179
180// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181
182#endif
183
184// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
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.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Computes balance terms for the steady momentum equation.
word pName_
Name of pressure field.
word UName_
Name of velocity field.
void operator=(const momentumError &)=delete
No copy assignment.
TypeName("momentumError")
Runtime type information.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
virtual ~momentumError()=default
Destructor.
tmp< volVectorField > divDevRhoReff()
Return the effective viscous stress (laminar + turbulent).
momentumError(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
momentumError(const momentumError &)=delete
No copy construct.
void calcMomentError()
Calculate the momentum error.
virtual bool execute()
Execute the function-object operations.
autoPtr< Detail::zoneSubSet > zoneSubSetPtr_
Sub-set mesh.
virtual bool write()
Write the function-object results.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
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
Forwards and collection of common volume field types.