Loading...
Searching...
No Matches
columnAverage.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) 2018-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::columnAverage
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Computes the arithmetic average of given quantities along columns of cells
34 in a given direction for structured-like layered meshes. It is, for example,
35 useful for channel-like cases where spanwise average of a field is desired.
36 However, the \c columnAverage function object does not operate on arbitrary
37 unstructured meshes.
38
39 For each patch face, calculates the average value of all cells attached in
40 the patch face normal direction, and then pushes the average value back
41 to all cells in the column.
42
43 Operands:
44 \table
45 Operand | Type | Location
46 input | vol<Type>Field | <time>/inputField
47 output file | - | -
48 output field | vol<Type>Field | <time>/outputField
49 \endtable
50
51 where \c Type can be one of:
52 \c Scalar, \c Vector, \c SphericalTensor, \c SymmTensor, or \c Tensor.
53
54Usage
55 Minimal example by using \c system/controlDict.functions:
56 \verbatim
57 columnAverageFO
58 {
59 // Mandatory entries
60 type columnAverage;
61 libs (fieldFunctionObjects);
62 patches (<wordRes>); // (<patch1> <patch2> ... <patchN>);
63 fields (<wordList>); // (<field1> <field2> ... <fieldN>);
64
65 // Inherited entries
66 ...
67 }
68 \endverbatim
69
70 where the entries mean:
71 \table
72 Property | Description | Type | Reqd | Deflt
73 type | Type name: columnAverage | word | yes | -
74 libs | Library name: fieldFunctionObjects | word | yes | -
75 patches | Names of patches to collapse onto | wordRes | yes | -
76 fields | Names of the operand fields | wordList | yes | -
77 \endtable
78
79 The inherited entries are elaborated in:
80 - \link functionObject.H \endlink
81
82SourceFiles
83 columnAverage.C
84 columnAverageTemplates.C
85
86\*---------------------------------------------------------------------------*/
87
88#ifndef Foam_functionObjects_columnAverage_H
89#define Foam_functionObjects_columnAverage_H
90
91#include "volFieldsFwd.H"
93#include "volFieldSelection.H"
94
95// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96
97namespace Foam
98{
99
100// Forward Declarations
101class globalIndex;
102class meshStructure;
103
104namespace functionObjects
105{
106
107/*---------------------------------------------------------------------------*\
108 Class columnAverage Declaration
109\*---------------------------------------------------------------------------*/
110
111class columnAverage
112:
114{
115 // Private Data
116
117 //- Patches on which to collapse the fields (in sorted order)
118 labelList patchIDs_;
119
120 //- Fields to collapse
121 volFieldSelection fieldSet_;
122
123 //- Global addressing and mesh structure for column-based addressing
124 mutable autoPtr<globalIndex> globalFaces_;
125 mutable autoPtr<globalIndex> globalEdges_;
126 mutable autoPtr<globalIndex> globalPoints_;
127 mutable autoPtr<meshStructure> meshStructurePtr_;
128
129
130 // Private Member Functions
131
132 //- Create the column average field name
133 const word averageName(const word& fieldName) const;
134
135 //- Return the column-based addressing
136 const meshStructure& meshAddressing(const polyMesh&) const;
137
138 //- Calculate the averaged field and return true if successful
139 template<class Type>
140 bool columnAverageField(const word& fieldName);
141
142
143public:
144
145 //- Runtime type information
146 TypeName("columnAverage");
147
148
149 // Constructors
150
151 //- Construct from name, Time and dictionary
153 (
154 const word& name,
155 const Time& runTime,
156 const dictionary& dict
157 );
158
159 //- No copy construct
160 columnAverage(const columnAverage&) = delete;
161
162 //- No copy assignment
163 void operator=(const columnAverage&) = delete;
164
165
166 //- Destructor
167 virtual ~columnAverage() = default;
168
169
170 // Member Functions
171
172 //- Read the function-object dictionary
173 virtual bool read(const dictionary& dict);
174
175 //- Execute the function-object operations
176 virtual bool execute();
177
178 //- Write the function-object results
179 virtual bool write();
180};
181
182
183// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184
185} // End namespace functionObjects
186} // End namespace Foam
187
188// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190#ifdef NoRepository
191 #include "columnAverageTemplates.C"
192#endif
193
194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195
196#endif
197
198// ************************************************************************* //
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
Computes the arithmetic average of given quantities along columns of cells in a given direction for s...
columnAverage(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
virtual ~columnAverage()=default
Destructor.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
columnAverage(const columnAverage &)=delete
No copy construct.
TypeName("columnAverage")
Runtime type information.
virtual bool execute()
Execute the function-object operations.
void operator=(const columnAverage &)=delete
No copy assignment.
virtual bool write()
Write the function-object results.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Helper class to manage solver field selections.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Definition globalIndex.H:77
Detect extruded mesh structure given a set of faces (uindirectPrimitivePatch).
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
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.
List< label > labelList
A List of labels.
Definition List.H:62
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.