Loading...
Searching...
No Matches
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-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::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 | <time>/inputField
39 output file | - | -
40 output field | vol<Type>Field | <time>/outputField
41 \endtable
42
43 where \c Type can be one of:
44 \c Scalar, \c Vector, \c SphericalTensor, \c SymmTensor, or \c Tensor.
45
46Usage
47 Minimal example by using \c system/controlDict.functions:
48 \verbatim
49 limitFieldsFO
50 {
51 // Mandatory entries
52 type limitFields;
53 libs (fieldFunctionObjects);
54 fields <wordList>; // (field1 field2 ... fieldN)
55 limit <word>;
56
57 // Conditional entries
58
59 // when limit = min or both
60 min <scalar>;
61
62 // when limit = max or both
63 max <scalar>;
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: limitFields | word | yes | -
74 libs | Library name: fieldFunctionObjects | word | yes | -
75 fields | List of fields to process | wordList | yes | -
76 limit | Bound to limit - see below | word | yes | -
77 min | Min limit value | scalar | conditional | -
78 max | Max limit value | scalar | conditional | -
79 \endtable
80
81 The inherited entries are elaborated in:
82 - \link functionObject.H \endlink
83
84 Options for the \c limit entry:
85 \verbatim
86 min | specify a minimum value
87 max | specify a maximum value
88 both | specify a minimum value and a maximum value
89 \endverbatim
90
91Note
92 For non-scalar types of input field, the user limit is used to create a
93 scaling factor using the field magnitudes.
94
95SourceFiles
96 limitFields.C
97 limitFieldsTemplates.C
98
99\*---------------------------------------------------------------------------*/
100
101#ifndef Foam_functionObjects_limitFields_H
102#define Foam_functionObjects_limitFields_H
103
104#include "Enum.H"
105#include "fvMeshFunctionObject.H"
106#include "volFieldSelection.H"
107
108// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109
110namespace Foam
111{
112namespace functionObjects
113{
114
115/*---------------------------------------------------------------------------*\
116 Class limitFields Declaration
117\*---------------------------------------------------------------------------*/
118
119class limitFields
120:
122{
123public:
124
125 // Public Enumerations
126
127 enum limitType : unsigned
128 {
129 CLAMP_NONE = 0,
130 CLAMP_MIN = 0x1,
131 CLAMP_MAX = 0x2,
133 };
134
135
136protected:
137
138 // Protected Data
139
140 //- Limit type names
141 static const Enum<limitType> limitTypeNames_;
142
143 //- Fields to limit
144 volFieldSelection fieldSet_;
145
146 //- Limiting type
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");
173
174 // Constructors
175
176 //- Construct from name, Time and dictionary
178 (
179 const word& name,
180 const Time& runTime,
181 const dictionary& dict
182 );
184 //- No copy construct
185 limitFields(const limitFields&) = delete;
186
187 //- No copy assignment
188 void operator=(const limitFields&) = delete;
189
190
191 //- Destructor
192 virtual ~limitFields() = default;
193
194
195 // Member Functions
197 //- Read the function-object dictionary
198 virtual bool read(const dictionary& dict);
199
200 //- Execute the function-object operations
201 virtual bool execute();
202
203 //- Write the function-object results
204 virtual bool write();
205};
207
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210} // End namespace functionObjects
211} // End namespace Foam
212
213// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215#ifdef NoRepository
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:57
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
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Limits input fields to user-specified min and max bounds.
@ CLAMP_MAX
Clamp maximum value.
@ CLAMP_MIN
Clamp minimum value.
bool limitScalarField(const word &fieldName)
Limit a scalar field.
Definition limitFields.C:52
volFieldSelection fieldSet_
Fields to limit.
limitFields(const limitFields &)=delete
No copy construct.
static const Enum< limitType > limitTypeNames_
Limit type names.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
TypeName("limitFields")
Runtime type information.
limitFields(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
virtual bool execute()
Execute the function-object operations.
void operator=(const limitFields &)=delete
No copy assignment.
bool limitField(const word &fieldName)
Limit a field.
virtual bool write()
Write the function-object results.
virtual ~limitFields()=default
Destructor.
limitType withBounds_
Limiting type.
Helper class to manage solver field selections.
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.
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