fieldExtents.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::fieldExtents
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Computes the spatial minimum and maximum extents of an input field.
34
35 The extents are derived from the bound box limits after identifying the
36 locations where field values exceed the user-supplied threshold value.
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
46Usage
47 Minimal example by using \c system/controlDict.functions:
48 \verbatim
49 fieldExtents1
50 {
51 // Mandatory entries (unmodifiable)
52 type fieldExtents;
53 libs (fieldFunctionObjects);
54
55 // Mandatory entries (runtime modifiable)
56 fields (<field1> <field2> ... <fieldN>);
57 threshold 0.5;
58
59 // Optional entries (runtime modifiable)
60 internalField true;
61 referencePosition (0 0 0);
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: fieldExtents | word | yes | -
72 libs | Library name: fieldFunctionObjects | word | yes | -
73 threshold | Value to identify extents boundary | scalar | yes | -
74 fields | List of operand fields | wordList | yes | -
75 internalField | Flag to process the internal field | bool | no | true
76 referencePosition | Reference position | vector | no | (0 0 0)
77 patches | List of patches to process | wordList | no | <all patches>
78 \endtable
79
80 The inherited entries are elaborated in:
81 - \link functionObject.H \endlink
82 - \link writeFile.H \endlink
83
84 Usage by the \c postProcess utility is not available.
85
86Note
87 For non-scalar fields, the magnitude of the field is employed and compared
88 to the value of \c threshold.
89
90See also
91 - Foam::functionObject
92 - Foam::functionObjects::fvMeshFunctionObject
93 - Foam::functionObjects::writeFile
94 - ExtendedCodeGuide::functionObjects::field::fieldExtents
95
96SourceFiles
97 fieldExtents.C
98 fieldExtentsTemplates.C
99
100\*---------------------------------------------------------------------------*/
101
102#ifndef functionObjects_fieldExtents_H
103#define functionObjects_fieldExtents_H
104
105#include "fvMeshFunctionObject.H"
106#include "writeFile.H"
107#include "volFieldSelection.H"
108
109// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110
111namespace Foam
112{
113namespace functionObjects
114{
115
116/*---------------------------------------------------------------------------*\
117 Class fieldExtents Declaration
118\*---------------------------------------------------------------------------*/
119
120class fieldExtents
121:
122 public fvMeshFunctionObject,
123 public writeFile
124{
125
126protected:
127
128 // Protected Data
129
130 //- Flag to write the internal field extents
131 bool internalField_;
132
133 //- Threshold value
134 scalar threshold_;
135
136 //- Reference position
137 point C0_;
138
139 //- Fields to assess
140 volFieldSelection fieldSet_;
141
142 //- Patches to assess
144
145
146 // Protected Member Functions
147
148 //- Output file header information
149 virtual void writeFileHeader(Ostream& os);
150
151 //- Return the field mask
152 template<class Type>
153 tmp<volScalarField> calcMask
154 (
155 const GeometricField<Type, fvPatchField, volMesh>& field
156 ) const;
157
158 //- Main calculation
159 template<class Type>
161 (
162 const word& fieldName,
163 const bool calcMag = false
164 );
165
166
167public:
168
169 //- Runtime type information
170 TypeName("fieldExtents");
171
172
173 // Constructors
174
175 //- Construct from Time and dictionary
177 (
178 const word& name,
179 const Time& runTime,
180 const dictionary& dict
181 );
182
183 //- No copy construct
184 fieldExtents(const fieldExtents&) = delete;
185
186 //- No copy assignment
187 void operator=(const fieldExtents&) = delete;
188
189
190 //- Destructor
191 virtual ~fieldExtents() = default;
192
193
194 // Member Functions
195
196 //- Read the field extents data
197 virtual bool read(const dictionary&);
198
199 //- Execute, currently does nothing
200 virtual bool execute();
201
202 //- Write the fieldExtents
203 virtual bool write();
204};
205
207// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208
209template<>
211(
213) const;
214
215// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217} // End namespace functionObjects
218} // End namespace Foam
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222#ifdef NoRepository
223 #include "fieldExtentsTemplates.C"
224#endif
225
226// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227
228#endif
229
230// ************************************************************************* //
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Computes the spatial minimum and maximum extents of an input field.
Definition: fieldExtents.H:187
volFieldSelection fieldSet_
Fields to assess.
Definition: fieldExtents.H:203
TypeName("fieldExtents")
Runtime type information.
fieldExtents(const fieldExtents &)=delete
No copy construct.
scalar threshold_
Threshold value.
Definition: fieldExtents.H:197
void calcFieldExtents(const word &fieldName, const bool calcMag=false)
Main calculation.
labelHashSet patchIDs_
Patches to assess.
Definition: fieldExtents.H:206
fieldExtents(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: fieldExtents.C:103
bool internalField_
Flag to write the internal field extents.
Definition: fieldExtents.H:194
tmp< volScalarField > calcMask(const GeometricField< Type, fvPatchField, volMesh > &field) const
Return the field mask.
virtual ~fieldExtents()=default
Destructor.
point C0_
Reference position.
Definition: fieldExtents.H:200
void operator=(const fieldExtents &)=delete
No copy assignment.
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition: fieldExtents.C:46
virtual bool execute()
Execute, currently does nothing.
Definition: fieldExtents.C:176
virtual bool write()
Write the fieldExtents.
Definition: fieldExtents.C:182
virtual bool read(const dictionary &)
Read the field extents data.
Definition: fieldExtents.C:126
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Helper class to manage solver field selections.
Base class for writing single files from the function objects.
Definition: writeFile.H:120
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
rDeltaTY field()
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
vector point
Point is a vector.
Definition: point.H:43
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition: HashSet.H:85
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73