limitFields.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) 2019-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::limitFields
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Limits input fields to user-specified min and max bounds.
34
35 Operands:
36 \table
37 Operand | Type | Location
38 input | vol<Type>Field | $FOAM_CASE/<time>/<inpField>
39 output file | - | -
40 output field | vol<Type>Field | $FOAM_CASE/<time>/<outField>
41 \endtable
42
43 where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
44
45Note
46 For non-scalar types of input field, the user limit is used to create a
47 scaling factor using the field magnitudes.
48
49Usage
50 Minimal example by using \c system/controlDict.functions:
51 \verbatim
52 limitFields1
53 {
54 // Mandatory entries (unmodifiable)
55 type limitFields;
56 libs (fieldFunctionObjects);
57
58 // Mandatory entries (runtime modifiable)
59 fields (U);
60 limit max;
61 max 100;
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: limitFields | word | yes | -
72 libs | Library name: fieldFunctionObjects | word | yes | -
73 fields | List of fields to process | wordList | yes | -
74 limit | Bound to limit - see below | word | yes | -
75 min | Min limit value | scalar | conditional | -
76 max | Max limit value | scalar | conditional | -
77 \endtable
78
79 Options for the \c limit entry:
80 \verbatim
81 min : specify a minimum value
82 max : specify a maximum value
83 both : specify a minimum value and a maximum value
84 \endverbatim
85
86 The inherited entries are elaborated in:
87 - \link functionObject.H \endlink
88
89 Usage by the \c postProcess utility is not available.
90
91See also
92 - Foam::functionObject
93 - Foam::functionObjects::fvMeshFunctionObject
94 - ExtendedCodeGuide::functionObjects::field::limitFields
95
96SourceFiles
97 limitFields.C
98 limitFieldsTemplates.C
99
100\*---------------------------------------------------------------------------*/
101
102#ifndef functionObjects_limitFields_H
103#define functionObjects_limitFields_H
104
105#include "Enum.H"
106#include "fvMeshFunctionObject.H"
107#include "volFieldSelection.H"
108
109// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110
111namespace Foam
112{
113namespace functionObjects
114{
115
116/*---------------------------------------------------------------------------*\
117 Class limitFields Declaration
118\*---------------------------------------------------------------------------*/
119
120class limitFields
121:
122 public fvMeshFunctionObject
123{
124public:
125
126 // Public Enumerations
127
128 enum limitType : unsigned
129 {
130 MIN = 0x1,
131 MAX = 0x2,
132 BOTH = (MIN | MAX)
133 };
134
135
136protected:
137
138 // Protected Data
139
140 //- Limit type names
141 static const Enum<limitType> limitTypeNames_;
142
143 //- Limiting type
145
146 //- Fields to limit
147 volFieldSelection fieldSet_;
148
149 //- Minimum limit
150 scalar min_;
151
152 //- Maximum limit
153 scalar max_;
154
155
156 // Protected Member Functions
157
158 //- Limit a scalar field.
159 // \return true if field of this type was found.
160 bool limitScalarField(const word& fieldName);
161
162 //- Limit a field.
163 // \return true if field of this type was found.
164 template<class Type>
165 bool limitField(const word& fieldName);
166
167
168public:
169
170 //- Runtime type information
171 TypeName("limitFields");
172
173
174 // Constructors
175
176 //- Construct from Time and dictionary
178 (
179 const word& name,
180 const Time& runTime,
181 const dictionary& dict
182 );
183
184 //- No copy construct
185 limitFields(const limitFields&) = delete;
186
187 //- No copy assignment
188 void operator=(const limitFields&) = delete;
189
191 //- Destructor
192 virtual ~limitFields() = default;
193
194
195 // Member Functions
196
197 //- Read the field min/max data
198 virtual bool read(const dictionary& dict);
199
200 //- Execute, currently does nothing
201 virtual bool execute();
202
203 //- Write the limitFields
204 virtual bool write();
205};
206
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210} // End namespace functionObjects
211} // End namespace Foam
212
213// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215#ifdef NoRepository
216 #include "limitFieldsTemplates.C"
217#endif
218
219// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220
221#endif
222
223// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
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.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Limits input fields to user-specified min and max bounds.
Definition: limitFields.H:180
@ BOTH
limit by both minimum and maximum values
Definition: limitFields.H:189
@ MIN
limit by minimum value
Definition: limitFields.H:187
@ MAX
limit by maximum value
Definition: limitFields.H:188
limitType limit_
Limiting type.
Definition: limitFields.H:201
bool limitScalarField(const word &fieldName)
Limit a scalar field.
Definition: limitFields.C:58
volFieldSelection fieldSet_
Fields to limit.
Definition: limitFields.H:204
limitFields(const limitFields &)=delete
No copy construct.
static const Enum< limitType > limitTypeNames_
Limit type names.
Definition: limitFields.H:198
virtual bool read(const dictionary &dict)
Read the field min/max data.
Definition: limitFields.C:107
TypeName("limitFields")
Runtime type information.
virtual bool execute()
Execute, currently does nothing.
Definition: limitFields.C:138
void operator=(const limitFields &)=delete
No copy assignment.
bool limitField(const word &fieldName)
Limit a field.
virtual bool write()
Write the limitFields.
Definition: limitFields.C:172
virtual ~limitFields()=default
Destructor.
Helper class to manage solver field selections.
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73