valueAverage.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) 2022 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::valueAverage
28 
29 Group
30  grpFieldFunctionObjects
31 
32 Description
33  Computes the ensemble- or time-based singular-value average values,
34  with optional windowing, from the output of function objects
35  that generate non-field type values (e.g. \c Cd of \c forceCoeffs or
36  \c momentum_x in \c momentum function objects).
37 
38  Operands:
39  \table
40  Operand | Type | Location
41  input | - | -
42  output file | dat | $FOAM_CASE/postProcessing/<FO>/<time>/<file>
43  output field | - | -
44  \endtable
45 
46 Usage
47  Minimal example by using \c system/controlDict.functions:
48  \verbatim
49  valueAverage1
50  {
51  // Mandatory entries (unmodifiable)
52  type valueAverage;
53  libs (fieldFunctionObjects);
54 
55  // Mandatory entries (runtime modifiable)
56  functionObject <FO>; // forceCoeffs1;
57  fields (<field1> ... <fieldN>); // (Cm Cd Cl);
58 
59  // Optional entries (runtime modifiable)
60  resetOnRestart false;
61  window 0.5;
62 
63  // Optional (inherited) entries
64  ...
65  }
66  \endverbatim
67 
68  where the entries mean:
69  \table
70  Property | Description | Type | Req'd | Dflt
71  type | Type name: valueAverage | word | yes | -
72  libs | Library name: fieldFunctionObjects | word | yes | -
73  functionObject | Name of function object to retrieve data | word | yes | -
74  fields | Names of operand fields | wordList | yes | -
75  resetOnRestart | Reset the averaging on restart | bool | no | false
76  window | Averaging window | scalar | no | VGREAT
77  \endtable
78 
79  The inherited entries are elaborated in:
80  - \link regionFunctionObject.H \endlink
81  - \link valueAverageBase.H \endlink
82 
83  Usage by the \c postProcess utility is not available.
84 
85 See also
86  - Foam::functionObject
87  - Foam::functionObjects::valueAverageBase
88  - ExtendedCodeGuide::functionObjects::field::valueAverage
89 
90 SourceFiles
91  valueAverage.C
92  valueAverageTemplates.C
93 
94 \*---------------------------------------------------------------------------*/
95 
96 #ifndef functionObjects_valueAverage_H
97 #define functionObjects_valueAverage_H
98 
99 #include "regionFunctionObject.H"
100 #include "valueAverageBase.H"
101 #include "writeFile.H"
102 
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 
105 namespace Foam
106 {
107 namespace functionObjects
108 {
109 
110 /*---------------------------------------------------------------------------*\
111  Class valueAverage Declaration
112 \*---------------------------------------------------------------------------*/
113 
114 class valueAverage
115 :
116  public regionFunctionObject,
117  public valueAverageBase
118 {
119 public:
120 
121  //- Runtime type information
122  TypeName("valueAverage");
123 
124 
125  // Constructors
126 
127  //- Construct from Time and dictionary
129  (
130  const word& name,
131  const Time& runTime,
132  const dictionary& dict
133  );
134 
135  //- No copy construct
136  valueAverage(const valueAverage&) = delete;
137 
138  //- No copy assignment
139  void operator=(const valueAverage&) = delete;
140 
141 
142  //- Destructor
143  virtual ~valueAverage() = default;
144 
145 
146  // Public Member Functions
147 
148  //- Read the field value average data
149  virtual bool read(const dictionary&);
150 
151  //- Execute
152  virtual bool execute();
153 
154  //- Write the value average
155  virtual bool write();
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace functionObjects
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
168 // ************************************************************************* //
dictionary dict
virtual ~valueAverage()=default
Destructor.
valueAverage(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: valueAverage.C:38
virtual bool execute()
Execute.
Definition: valueAverage.C:64
engineTime & runTime
const word & name() const noexcept
Return the name of this functionObject.
virtual bool write()
Write the value average.
Definition: valueAverage.C:71
TypeName("valueAverage")
Runtime type information.
void operator=(const valueAverage &)=delete
No copy assignment.
virtual bool read(const dictionary &)
Read the field value average data.
Definition: valueAverage.C:53
Namespace for OpenFOAM.