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 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  // Optional (inherited) entries
58  ...
59  }
60  \endverbatim
61 
62  where the entries mean:
63  \table
64  Property | Description | Type | Req'd | Dflt
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 
75  Usage by the \c postProcess utility is not available.
76 
77 See also
78  - Foam::functionObject
79  - Foam::functionObjects::fvMeshFunctionObject
80  - ExtendedCodeGuide::functionObjects::field::momentumError
81 
82 SourceFiles
83  momentumError.C
84 
85 \*---------------------------------------------------------------------------*/
86 
87 #ifndef functionObjects_momentumError_H
88 #define functionObjects_momentumError_H
89 
90 #include "fvMeshFunctionObject.H"
91 #include "volFieldsFwd.H"
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 namespace Foam
96 {
97 namespace functionObjects
98 {
99 
100 /*---------------------------------------------------------------------------*\
101  Class momentumError Declaration
102 \*---------------------------------------------------------------------------*/
103 
104 class momentumError
105 :
106  public fvMeshFunctionObject
107 {
108 protected:
109 
110  // Protected Data
111 
112  // Read from dictionary
113 
114  //- Name of pressure field
115  word pName_;
116 
117  //- Name of velocity field
118  word UName_;
119 
120  //- Name of flux field
121  word phiName_;
122 
123 
124  // Protected Member Functions
125 
126  //- Return the effective viscous stress (laminar + turbulent).
127  tmp<volVectorField> divDevRhoReff();
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("momentumError");
134 
135 
136  // Constructors
137 
138  //- Construct from Time and dictionary
140  (
141  const word& name,
142  const Time& runTime,
143  const dictionary& dict
144  );
145 
146  //- No copy construct
147  momentumError(const momentumError&) = delete;
148 
149  //- No copy assignment
150  void operator=(const momentumError&) = delete;
151 
152 
153  //- Destructor
154  virtual ~momentumError() = default;
155 
156 
157  // Member Functions
158 
159  //- Read the forces data
160  virtual bool read(const dictionary&);
161 
162  //- Execute
163  virtual bool execute();
164 
165  //- Write
166  virtual bool write();
167 
168  //- Calculate the momentum error
170 };
171 
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 } // End namespace functionObjects
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #endif
181 
182 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
volFieldsFwd.H
Foam::functionObjects::momentumError
Computes balance terms for the steady momentum equation.
Definition: momentumError.H:155
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:62
fvMeshFunctionObject.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::functionObjects::momentumError::calcMomentError
void calcMomentError()
Calculate the momentum error.
Definition: momentumError.C:178
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:172
Foam::functionObjects::momentumError::execute
virtual bool execute()
Execute.
Definition: momentumError.C:194
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:153
Foam::functionObjects::momentumError::pName_
word pName_
Name of pressure field.
Definition: momentumError.H:166
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::functionObjects::momentumError::UName_
word UName_
Name of velocity field.
Definition: momentumError.H:169
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::functionObject::name
const word & name() const
Return the name of this functionObject.
Definition: functionObject.C:131
Foam::functionObjects::momentumError::operator=
void operator=(const momentumError &)=delete
No copy assignment.
Foam::functionObjects::momentumError::write
virtual bool write()
Write.
Definition: momentumError.C:202
Foam::functionObjects::momentumError::momentumError
momentumError(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: momentumError.C:115