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-2022 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=volFaceZone
53 faceZone <faceZoneName>;
54 }
55 \endverbatim
56
57 where the entries mean:
58 \table
59 Property | Description | Type | Reqd | Dflt
60 selectionMode | Mode of face selection - see below | word | yes | -
61 timeStart | Start time of faOption | scalar | no | -1
62 duration | Duration of faOption execution <!--
63 --> starting from timeStart | scalar | cndtnl | 0
64 faceZone | Name of operand faceZone | word | cndtnl | -
65 \endtable
66
67 Options for the \c selectionMode entry:
68 \verbatim
69 all | Use all faces in the computational domain
70 faceZone | Use a given faceZone
71 \endverbatim
72
73 The inherited entries are elaborated in:
74 - \link faOption.H \endlink
75
76Note
77 - Source/sink options are to be added to the right-hand side of equations.
78
79SourceFiles
80 faceSetOption.C
81
82\*---------------------------------------------------------------------------*/
83
84#ifndef Foam_fa_faceSetOption_H
85#define Foam_fa_faceSetOption_H
86
87#include "faOption.H"
88#include "faceSet.H"
89#include "faMesh.H"
90#include "Time.H"
91
92// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93
94namespace Foam
95{
96namespace fa
97{
98
99/*---------------------------------------------------------------------------*\
100 Class faceSetOption Declaration
101\*---------------------------------------------------------------------------*/
102
103class faceSetOption
104:
105 public fa::option
106{
107public:
108
109 // Public Enumeration
110
111 //- Enumeration for selection mode types
113 {
114 smAll,
116 };
117
118 //- List of selection mode type names
119 static const Enum<selectionModeType> selectionModeTypeNames_;
120
121
122protected:
123
124 // Protected Data
125
126 //- Time start
127 scalar timeStart_;
128
129 //- Duration
130 scalar duration_;
131
132 //- Face selection mode
135 //- Name of zone for (volume) "faceZone" selection
137
138 //- Set of faces to apply source to
140
141 //- Sum of face area
142 scalar A_;
144
145 // Protected Functions
146
147 //- Set face selection name from dictionary input
148 void setSelection(const dictionary& dict);
149
150 //- Set face selection based on user input selection mode
151 void setFaceSelection();
152
153 //- Recalculate the area
154 void setArea();
155
156
157public:
159 //- Runtime type information
160 TypeName("faceSetOption");
162
163 // Constructors
165 //- Construct from components
168 const word& name,
169 const word& modelType,
171 const fvPatch& patch
172 );
174
175 //- Destructor
176 virtual ~faceSetOption() = default;
177
178
179 // Member Functions
180
181 // Access
182
183 //- Return const access to the time start
184 inline scalar timeStart() const noexcept;
185
186 //- Return const access to the duration
187 inline scalar duration() const noexcept;
188
189 //- Return true if within time limits
190 inline bool inTimeLimits(const scalar timeValue) const;
192 //- Return const access to the face selection mode
194
195 //- True if sub-selection should be used
196 inline bool useSubMesh() const noexcept;
197
198 //- Return const access to the name of (volume) face zone
199 //- for "faceZone" selection mode
200 const wordRe& zoneName() const noexcept { return zoneName_; }
201
202 //- Return const access to the total face area
203 inline scalar A() const noexcept;
204
205 //- Return const access to the face selection
206 inline const labelList& faces() const noexcept;
208
209 // Edit
210
211 //- Adjust the time start, return the old value
212 inline scalar timeStart(scalar val) noexcept;
213
214 //- Adjust the duration, return the old value
215 inline scalar duration(scalar val) noexcept;
216
217
218 // Checks
219
220 //- Is the source active?
221 virtual bool isActive();
222
223
224 // IO
225
226 //- Read source dictionary
227 virtual bool read(const dictionary& dict);
228};
229
230
231// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232
233} // End namespace fa
234} // End namespace Foam
235
236// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237
238#include "faceSetOptionI.H"
239
240// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241
242#endif
243
244// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
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 setSelection(const dictionary &dict)
Set face selection name from dictionary input.
Definition: faceSetOption.C:55
const wordRe & zoneName() const noexcept
scalar A_
Sum of face area.
selectionModeType
Enumeration for selection mode types.
selectionModeType selectionMode() const noexcept
Return const access to 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.
virtual bool isActive()
Is the source active?
TypeName("faceSetOption")
Runtime type information.
wordRe zoneName_
Name of zone for (volume) "faceZone" selection.
selectionModeType selectionMode_
Face selection mode.
const labelList & faces() const noexcept
Return const access to the face selection.
static const Enum< selectionModeType > selectionModeTypeNames_
List of selection mode type names.
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.
Definition: faceSetOption.C:81
Base abstract class for handling finite area options (i.e. faOption).
Definition: faOption.H:134
const word & name() const noexcept
Return const access to the source name.
Definition: faOptionI.H:30
const fvPatch & patch() const noexcept
Return const access to fvPatch.
Definition: faOptionI.H:42
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition: wordRe.H:83
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73