Loading...
Searching...
No Matches
faceSetOption.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-2025 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::fa::faceSetOption
28
29Description
30 Intermediate abstract class for handling
31 face-set options for the derived faOptions.
32
33Usage
34 Minimal example by using \c constant/faOptions:
35 \verbatim
36 <userDefinedName1>
37 {
38 // Mandatory/Optional (inherited) entries
39 ...
40
41 // Mandatory entries (unmodifiable)
42 selectionMode all;
43
44 // Optional entries (runtime modifiable)
45 timeStart 1.0;
46
47 // Conditional mandatory entries (runtime modifiable)
48
49 // when timeStart entry is present
50 duration 1.4;
51
52 // when selectionMode=faceZone
53 faceZones (<name> ...);
54 //or: faceZone <name>;
55
56 // when selectionMode=patch
57 patches (<name> ...)
58 //or: patch <name>;
59 }
60 \endverbatim
61
62 where the entries mean:
63 \table
64 Property | Description | Type | Reqd | Dflt
65 selectionMode | Mode of face selection - see below | word | yes | -
66 timeStart | Start time of faOption | scalar | no | -1
67 duration | Duration of faOption execution <!--
68 --> starting from timeStart | scalar | cndtnl | 0
69 faceSet | Name of operand faceSet | word | cndtnl | -
70 faceZone | Name of operand faceZone(s) | wordRe | cndtnl | -
71 faceZones | Names of operand faceZones | wordRes| cndtnl | -
72 patch | Name of operand poly patch(s) | wordRe | cndtnl | -
73 patches | Names of operand poly patches | wordRes| cndtnl | -
74 \endtable
75
76 Options for the \c selectionMode entry:
77 \verbatim
78 all | Use all faces in the computational domain
79 faceSet | Use subset corresponding to specified (volume) faceSet
80 faceZones | Use subset corresponding to specified (volume) faceZones
81 faceZone | Use subset corresponding to specified (volume) faceZones
82 patch | Use subset corresponding of specified volume patches
83 patches | Use subset corresponding of specified volume patches
84 \endverbatim
85
86 The inherited entries are elaborated in:
87 - \link faOption.H \endlink
88
89Note
90 - Source/sink options are to be added to the right-hand side of equations.
91
92SourceFiles
93 faceSetOption.C
94 faceSetOptionI.H
95
96\*---------------------------------------------------------------------------*/
97
98#ifndef Foam_fa_faceSetOption_H
99#define Foam_fa_faceSetOption_H
100
101#include "faOption.H"
102#include "faceSet.H"
103#include "Time.H"
104
105// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106
107namespace Foam
108{
109namespace fa
110{
111
112/*---------------------------------------------------------------------------*\
113 Class faceSetOption Declaration
114\*---------------------------------------------------------------------------*/
115
116class faceSetOption
117:
118 public fa::option
119{
120public:
121
122 // Public Enumeration
123
124 //- Enumeration for selection mode types
126 {
127 smAll,
128 smFaceSet,
129 smFaceZone,
130 smPatch,
131 };
132
133 //- List of selection mode type names
134 static const Enum<selectionModeType> selectionModeTypeNames_;
135
136
137protected:
138
139 // Protected Data
140
141 //- Time start
142 scalar timeStart_;
143
144 //- Duration
145 scalar duration_;
146
147 //- Face selection mode
149
150 //- Face selection names (for set, zone or patch selections)
151 wordRes selectionNames_;
152
153 //- Set of faces to apply source to
155
156 //- Sum of face area
157 scalar A_;
158
159
160 // Protected Functions
161
162 //- Set face selection name from dictionary input
163 void setSelection(const dictionary& dict);
164
165 //- Set face selection based on user input selection mode
166 void setFaceSelection();
168 //- Recalculate the area
169 void setArea();
170
171 //- Zero all non-selected locations within field
172 template<class Type>
173 inline void subsetFilter(List<Type>& field) const;
174
175
176public:
177
178 //- Runtime type information
179 TypeName("faceSetOption");
182 // Constructors
184 //- Construct from components
186 (
187 const word& name,
188 const word& modelType,
190 const fvMesh& mesh,
192 const word& defaultAreaName = word()
193 );
194
195
196 //- Destructor
197 virtual ~faceSetOption() = default;
198
200 // Member Functions
201
202 // Access
203
204 //- Return const access to the time start
205 inline scalar timeStart() const noexcept;
206
207 //- Return const access to the duration
208 inline scalar duration() const noexcept;
210 //- Return true if within time limits
211 inline bool inTimeLimits(const scalar timeValue) const;
212
213 //- True if sub-selection should be used
214 inline bool useSubMesh() const noexcept;
215
216 //- Return the face selection mode
218
219 //- Return const access to the selection names
220 //- (set, zone or patch selection)
221 inline const wordRes& selectionNames() const noexcept;
222
223 //- Return const access to the first set/zone/patch name
224 inline const wordRe& zoneName() const;
225
226 //- Return const access to the total face area
227 inline scalar A() const noexcept;
228
229 //- Return const access to the local finite-area face selection
230 inline const labelList& faces() const noexcept;
231
232
233 // Edit
234
235 //- Adjust the time start, return the old value
236 inline scalar timeStart(scalar val) noexcept;
237
238 //- Adjust the duration, return the old value
239 inline scalar duration(scalar val) noexcept;
240
241
242 // Checks
243
244 //- Is the source active?
245 virtual bool isActive();
246
247
248 // IO
249
250 //- Read source dictionary
251 virtual bool read(const dictionary& dict);
252};
253
254
255// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257} // End namespace fa
258} // End namespace Foam
259
260// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261
262#include "faceSetOptionI.H"
263
264// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265
266#endif
267
268// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Intermediate abstract class for handling face-set options for the derived faOptions.
scalar timeStart() const noexcept
Return const access to the time start.
labelList faces_
Set of faces to apply source to.
scalar duration() const noexcept
Return const access to the duration.
void setFaceSelection()
Set face selection based on user input selection mode.
virtual ~faceSetOption()=default
Destructor.
void subsetFilter(List< Type > &field) const
Zero all non-selected locations within field.
wordRes selectionNames_
Face selection names (for set, zone or patch selections).
void setSelection(const dictionary &dict)
Set face selection name from dictionary input.
scalar A_
Sum of face area.
selectionModeType
Enumeration for selection mode types.
@ smPatch
"patch" : subset with (volume) patches
@ smFaceZone
"faceZone" : subset with (volume) zone faces
@ smAll
"all" finite-area faces
@ smFaceSet
"faceSet" : subset with (volume) face set
selectionModeType selectionMode() const noexcept
Return the face selection mode.
virtual bool read(const dictionary &dict)
Read source dictionary.
bool useSubMesh() const noexcept
True if sub-selection should be used.
scalar duration_
Duration.
scalar timeStart_
Time start.
const wordRe & zoneName() const
Return const access to the first set/zone/patch name.
virtual bool isActive()
Is the source active?
faceSetOption(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh, const word &defaultAreaName=word())
Construct from components.
TypeName("faceSetOption")
Runtime type information.
selectionModeType selectionMode_
Face selection mode.
const labelList & faces() const noexcept
Return const access to the local finite-area face selection.
static const Enum< selectionModeType > selectionModeTypeNames_
List of selection mode type names.
const wordRes & selectionNames() const noexcept
Return const access to the selection names (set, zone or patch selection).
scalar A() const noexcept
Return const access to the total face area.
bool inTimeLimits(const scalar timeValue) const
Return true if within time limits.
void setArea()
Recalculate the area.
Base abstract class for handling finite area options (i.e. faOption).
Definition faOption.H:149
const fvMesh & mesh() const noexcept
Return const access to the volume mesh.
Definition faOption.H:385
const word & name() const noexcept
The source name.
Definition faOption.H:380
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition wordRe.H:81
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
Namespace for finite-area.
Definition limitHeight.C:30
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
const direction noexcept
Definition scalarImpl.H:265
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68