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 -------------------------------------------------------------------------------
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::momentumError
28 
29 Group
30  grpForcesFunctionObjects
31 
32 Description
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 | $FOAM_CASE/<time>/<file>
41  \endtable
42 
43 Usage
44  Minimal example by using \c system/controlDict.functions:
45  \verbatim
46  momentumError1
47  {
48  // Mandatory entries (unmodifiable)
49  type momentumError;
50  libs (fieldFunctionObjects);
51 
52  // Optional entries (runtime modifiable)
53  p <pName>;
54  U <UName>;
55  phi <phiName>;
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 
76  Usage by the \c postProcess utility is not available.
77 
78 Note
79  - Optionally the user can specify \c cellZones to create a sub-mesh for the
80  \c momentumError calculation.
81 
82 See also
83  - Foam::functionObject
84  - Foam::functionObjects::fvMeshFunctionObject
85  - ExtendedCodeGuide::functionObjects::field::momentumError
86 
87 SourceFiles
88  momentumError.C
89 
90 \*---------------------------------------------------------------------------*/
91 
92 #ifndef functionObjects_momentumError_H
93 #define functionObjects_momentumError_H
94 
95 #include "fvMeshFunctionObject.H"
96 #include "volFieldsFwd.H"
97 #include "zoneSubSet.H"
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 namespace Foam
102 {
103 namespace functionObjects
104 {
105 
106 /*---------------------------------------------------------------------------*\
107  Class momentumError Declaration
108 \*---------------------------------------------------------------------------*/
109 
110 class momentumError
111 :
112  public fvMeshFunctionObject
113 {
114 protected:
115 
116  // Protected Data
117 
118  // Read from dictionary
119 
120  //- Name of pressure field
121  word pName_;
122 
123  //- Name of velocity field
124  word UName_;
125 
126  //- Name of flux field
127  word phiName_;
128 
129  //- Sub-set mesh
130  autoPtr<Detail::zoneSubSet> zoneSubSetPtr_;
131 
132 
133  // Protected Member Functions
134 
135  //- Return the effective viscous stress (laminar + turbulent).
136  tmp<volVectorField> divDevRhoReff();
137 
138 
139 public:
140 
141  //- Runtime type information
142  TypeName("momentumError");
143 
144 
145  // Constructors
146 
147  //- Construct from Time and dictionary
149  (
150  const word& name,
151  const Time& runTime,
152  const dictionary& dict
153  );
154 
155  //- No copy construct
156  momentumError(const momentumError&) = delete;
157 
158  //- No copy assignment
159  void operator=(const momentumError&) = delete;
160 
161 
162  //- Destructor
163  virtual ~momentumError() = default;
164 
165 
166  // Member Functions
167 
168  //- Read the forces data
169  virtual bool read(const dictionary&);
170 
171  //- Execute
172  virtual bool execute();
173 
174  //- Write
175  virtual bool write();
176 
177  //- Calculate the momentum error
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace functionObjects
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
volFieldsFwd.H
Foam::functionObjects::momentumError
Computes balance terms for the steady momentum equation.
Definition: momentumError.H:161
Foam::functionObjects::momentumError::divDevRhoReff
tmp< volVectorField > divDevRhoReff()
Return the effective viscous stress (laminar + turbulent).
Definition: momentumError.C:52
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:65
fvMeshFunctionObject.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::functionObjects::momentumError::calcMomentError
void calcMomentError()
Calculate the momentum error.
Definition: momentumError.C:244
Foam::functionObjects::momentumError::~momentumError
virtual ~momentumError()=default
Destructor.
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::functionObjects::momentumError::phiName_
word phiName_
Name of flux field.
Definition: momentumError.H:178
Foam::functionObjects::momentumError::execute
virtual bool execute()
Execute.
Definition: momentumError.C:286
Foam::functionObjects::momentumError::zoneSubSetPtr_
autoPtr< Detail::zoneSubSet > zoneSubSetPtr_
Sub-set mesh.
Definition: momentumError.H:181
Foam::functionObjects::momentumError::TypeName
TypeName("momentumError")
Runtime type information.
Foam::functionObjects::momentumError::read
virtual bool read(const dictionary &)
Read the forces data.
Definition: momentumError.C:207
Foam::functionObjects::momentumError::pName_
word pName_
Name of pressure field.
Definition: momentumError.H:172
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::functionObjects::momentumError::UName_
word UName_
Name of velocity field.
Definition: momentumError.H:175
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::functionObjects::momentumError::operator=
void operator=(const momentumError &)=delete
No copy assignment.
zoneSubSet.H
Foam::functionObjects::momentumError::write
virtual bool write()
Write.
Definition: momentumError.C:294
Foam::functionObjects::momentumError::momentumError
momentumError(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: momentumError.C:137