Loading...
Searching...
No Matches
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-2023 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 | postProcessing/<FO>/<time>/file
43 output field | - | -
44 \endtable
45
46Usage
47 Minimal example by using \c system/controlDict.functions:
48 \verbatim
49 fieldExtentsFO
50 {
51 // Mandatory entries
52 type fieldExtents;
53 libs (fieldFunctionObjects);
54 fields (<wordList>); // (<field1> <field2> ... <fieldN>);
55 threshold <scalar>;
56
57 // Optional entries
58 internalField <bool>;
59 referencePosition <vector>; // (0 0 0);
60
61 // Inherited entries
62 ...
63 }
64 \endverbatim
65
66 where the entries mean:
67 \table
68 Property | Description | Type | Reqd | Deflt
69 type | Type name: fieldExtents | word | yes | -
70 libs | Library name: fieldFunctionObjects | word | yes | -
71 threshold | Value to identify extents boundary | scalar | yes | -
72 fields | List of operand fields | wordList | yes | -
73 internalField | Flag to process the internal field | bool | no | true
74 referencePosition | Reference position | vector | no | (0 0 0)
75 patches | List of patches to process | wordList | no | <all patches>
76 \endtable
77
78 The inherited entries are elaborated in:
79 - \link functionObject.H \endlink
80 - \link writeFile.H \endlink
81
82Note
83 For non-scalar fields, the magnitude of the field is employed and compared
84 to the value of \c threshold.
85
86SourceFiles
87 fieldExtents.C
88 fieldExtentsTemplates.C
89
90\*---------------------------------------------------------------------------*/
91
92#ifndef Foam_functionObjects_fieldExtents_H
93#define Foam_functionObjects_fieldExtents_H
94
96#include "writeFile.H"
97#include "volFieldSelection.H"
98
99// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100
101namespace Foam
102{
103namespace functionObjects
104{
105
106/*---------------------------------------------------------------------------*\
107 Class fieldExtents Declaration
108\*---------------------------------------------------------------------------*/
109
110class fieldExtents
111:
113 public writeFile
114{
115protected:
116
117 // Protected Data
118
119 //- Flag to write the internal field extents
120 bool internalField_;
121
122 //- Threshold value
123 scalar threshold_;
124
125 //- Reference position
126 point C0_;
127
128 //- Fields to assess
129 volFieldSelection fieldSet_;
130
131 //- Patches to assess
133
134
135 // Protected Member Functions
136
137 //- Output file header information
138 virtual void writeFileHeader(Ostream& os);
139
140 //- Return the field mask
141 template<class Type>
142 tmp<volScalarField> calcMask
143 (
144 const GeometricField<Type, fvPatchField, volMesh>& field
145 ) const;
146
147 //- Main calculation
148 template<class Type>
150 (
151 const word& fieldName,
152 const bool calcMag = false
153 );
154
155
156public:
157
158 //- Runtime type information
159 TypeName("fieldExtents");
160
161
162 // Constructors
163
164 //- Construct from name, Time and dictionary
166 (
167 const word& name,
168 const Time& runTime,
170 );
171
172 //- No copy construct
173 fieldExtents(const fieldExtents&) = delete;
174
175 //- No copy assignment
176 void operator=(const fieldExtents&) = delete;
177
178
179 //- Destructor
180 virtual ~fieldExtents() = default;
182
183 // Member Functions
184
185 //- Read the function-object dictionary
186 virtual bool read(const dictionary& dict);
187
188 //- Execute the function-object operations
189 virtual bool execute();
190
191 //- Write the function-object results
192 virtual bool write();
193};
194
195
196// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197
198template<>
200(
202) const;
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206} // End namespace functionObjects
207} // End namespace Foam
208
209// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210
211#ifdef NoRepository
212 #include "fieldExtentsTemplates.C"
213#endif
214
215// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216
217#endif
218
219// ************************************************************************* //
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & name() const noexcept
Return the name of this functionObject.
Computes the spatial minimum and maximum extents of an input field.
volFieldSelection fieldSet_
Fields to assess.
TypeName("fieldExtents")
Runtime type information.
fieldExtents(const fieldExtents &)=delete
No copy construct.
scalar threshold_
Threshold value.
void calcFieldExtents(const word &fieldName, const bool calcMag=false)
Main calculation.
fieldExtents(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
bool internalField_
Flag to write the internal field extents.
tmp< volScalarField > calcMask(const GeometricField< Type, fvPatchField, volMesh > &field) const
Return the field mask.
virtual ~fieldExtents()=default
Destructor.
point C0_
Reference position.
void operator=(const fieldExtents &)=delete
No copy assignment.
virtual void writeFileHeader(Ostream &os)
Output file header information.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
labelList patchIDs_
Patches to assess.
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.
Base class for writing single files from the function objects.
Definition writeFile.H:113
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
Definition writeFile.C:200
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
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
vector point
Point is a vector.
Definition point.H:37
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