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 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::functionObjects::limitFields
28 
29 Group
30  grpFieldFunctionObjects
31 
32 Description
33  Limits fields to user-specified min and max bounds
34 
35 Note
36  For non-scalar field types, the user limit is used to create a
37  scaling factor using the field magnitudes.
38 
39 Usage
40  Example of function object specification:
41 
42  \verbatim
43  limitFields1
44  {
45  type limitFields;
46  libs ("libfieldFunctionObjects.so");
47  ...
48  fields (U);
49  limit max;
50  max 100;
51  }
52  \endverbatim
53 
54  Where the entries comprise:
55  \table
56  Property | Description | Required | Default
57  type | type name: limitFields | yes |
58  fields | list of fields to process | yes |
59  limit | bound to limit - see below | yes |
60  min | min limit value | partly |
61  max | max limit value | partly |
62  \endtable
63 
64  The \c limit entry can take the value:
65  - \c min : specify a minimum value
66  - \c max : specify a maximum value
67  - \c both : specify a minimum value and a maximum value
68 
69 See also
70  Foam::functionObjects::fvMeshFunctionObject
71 
72 SourceFiles
73  limitFields.C
74  limitFieldsTemplates.C
75 
76 \*---------------------------------------------------------------------------*/
77 
78 #ifndef functionObjects_limitFields_H
79 #define functionObjects_limitFields_H
80 
81 #include "Enum.H"
82 #include "fvMeshFunctionObject.H"
83 #include "volFieldSelection.H"
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 
87 namespace Foam
88 {
89 namespace functionObjects
90 {
91 
92 /*---------------------------------------------------------------------------*\
93  Class limitFields Declaration
94 \*---------------------------------------------------------------------------*/
95 
96 class limitFields
97 :
98  public fvMeshFunctionObject
99 {
100 public:
101 
102  // Public Enumerations
103 
104  enum limitType : unsigned
105  {
106  MIN = 0x1,
107  MAX = 0x2,
108  BOTH = (MIN | MAX)
109  };
110 
111 
112 protected:
113 
114  // Protected Data
115 
116  //- Limit type names
117  static const Enum<limitType> limitTypeNames_;
118 
119  //- Limiting type
121 
122  //- Fields to limit
123  volFieldSelection fieldSet_;
124 
125  //- Minimum limit
126  scalar min_;
127 
128  //- Maximum limit
129  scalar max_;
130 
131 
132  // Protected Member Functions
133 
134  //- Limit a scalar field.
135  // \return true if field of this type was found.
136  bool limitScalarField(const word& fieldName);
137 
138  //- Limit a field.
139  // \return true if field of this type was found.
140  template<class Type>
141  bool limitField(const word& fieldName);
142 
143 
144  //- No copy construct
145  limitFields(const limitFields&) = delete;
146 
147  //- No copy assignment
148  void operator=(const limitFields&) = delete;
149 
150 
151 public:
152 
153  //- Runtime type information
154  TypeName("limitFields");
155 
156 
157  // Constructors
158 
159  //- Construct from Time and dictionary
161  (
162  const word& name,
163  const Time& runTime,
164  const dictionary& dict
165  );
166 
167 
168  //- Destructor
169  virtual ~limitFields() = default;
170 
171 
172  // Member Functions
173 
174  //- Read the field min/max data
175  virtual bool read(const dictionary& dict);
176 
177  //- Execute, currently does nothing
178  virtual bool execute();
179 
180  //- Write the limitFields
181  virtual bool write();
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace functionObjects
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #ifdef NoRepository
193  #include "limitFieldsTemplates.C"
194 #endif
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::functionObjects::limitFields::max_
scalar max_
Maximum limit.
Definition: limitFields.H:158
Foam::functionObjects::limitFields::limitScalarField
bool limitScalarField(const word &fieldName)
Limit a scalar field.
Definition: limitFields.C:58
Foam::Enum< limitType >
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
fvMeshFunctionObject.H
Foam::functionObjects::limitFields
Limits fields to user-specified min and max bounds.
Definition: limitFields.H:125
Foam::functionObjects::limitFields::limitType
limitType
Definition: limitFields.H:133
Foam::functionObjects::limitFields::limitTypeNames_
static const Enum< limitType > limitTypeNames_
Limit type names.
Definition: limitFields.H:146
Foam::functionObjects::limitFields::BOTH
limit by both minimum and maximum values
Definition: limitFields.H:137
Foam::functionObjects::limitFields::MIN
limit by minimum value
Definition: limitFields.H:135
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::functionObjects::limitFields::fieldSet_
volFieldSelection fieldSet_
Fields to limit.
Definition: limitFields.H:152
Foam::functionObjects::limitFields::read
virtual bool read(const dictionary &dict)
Read the field min/max data.
Definition: limitFields.C:107
Foam::functionObjects::limitFields::limit_
limitType limit_
Limiting type.
Definition: limitFields.H:149
Foam::functionObjects::limitFields::TypeName
TypeName("limitFields")
Runtime type information.
Foam::functionObjects::limitFields::write
virtual bool write()
Write the limitFields.
Definition: limitFields.C:172
Foam::functionObjects::volFieldSelection
Helper class to manage solver field selections.
Definition: volFieldSelection.H:52
Foam::functionObjects::limitFields::execute
virtual bool execute()
Execute, currently does nothing.
Definition: limitFields.C:138
Foam::functionObjects::limitFields::~limitFields
virtual ~limitFields()=default
Destructor.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::functionObjects::limitFields::limitFields
limitFields(const limitFields &)=delete
No copy construct.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
limitFieldsTemplates.C
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
volFieldSelection.H
Foam::functionObjects::limitFields::limitField
bool limitField(const word &fieldName)
Limit a field.
Definition: limitFieldsTemplates.C:34
Foam::functionObject::name
const word & name() const
Return the name of this functionObject.
Definition: functionObject.C:131
Foam::functionObjects::limitFields::operator=
void operator=(const limitFields &)=delete
No copy assignment.
Foam::functionObjects::limitFields::min_
scalar min_
Minimum limit.
Definition: limitFields.H:155
Foam::functionObjects::limitFields::MAX
limit by maximum value
Definition: limitFields.H:136
Enum.H