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-2021 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::fa::faceSetOption
28 
29 Description
30  Intermediate abstract class for handling
31  face-set options for the derived faOptions.
32 
33 Usage
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 
76 Note
77  - Source/sink options are to be added to the right-hand side of equations.
78 
79 SourceFiles
80  faceSetOption.C
81 
82 \*---------------------------------------------------------------------------*/
83 
84 #ifndef faceSetOption_H
85 #define faceSetOption_H
86 
87 #include "faOption.H"
88 #include "faceSet.H"
89 #include "faMesh.H"
90 #include "Time.H"
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 namespace Foam
95 {
96 namespace fa
97 {
98 
99 /*---------------------------------------------------------------------------*\
100  Class faceSetOption Declaration
101 \*---------------------------------------------------------------------------*/
102 
103 class faceSetOption
104 :
105  public fa::option
106 {
107 public:
108 
109  // Public Enumeration
110 
111  //- Enumeration for selection mode types
112  enum selectionModeType
113  {
114  smAll,
116  };
117 
118  //- List of selection mode type names
119  static const Enum<selectionModeType> selectionModeTypeNames_;
120 
121 
122 protected:
123 
124  // Protected Data
125 
126  //- Time start
127  scalar timeStart_;
128 
129  //- Duration
130  scalar duration_;
131 
132  //- Face selection mode
134 
135  //- Name of "volFaceZone" selection
137 
138  //- Set of faces to apply source to
140 
141  //- Sum of face area
142  scalar A_;
143 
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 
157 public:
158 
159  //- Runtime type information
160  TypeName("faceSetOption");
161 
162 
163  // Constructors
164 
165  //- Construct from components
167  (
168  const word& name,
169  const word& modelType,
170  const dictionary& dict,
171  const fvPatch& patch
172  );
173 
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;
191 
192  //- Return const access to the face selection mode
193  inline selectionModeType selectionMode() const noexcept;
194 
195  //- True if sub-selection should be used
196  inline bool useSubMesh() const noexcept;
197 
198  //- Return const access to the name of face set for "faceZone"
199  //- selectionMode
200  inline const word& faceSetName() const noexcept;
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;
207 
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 // ************************************************************************* //
Foam::fa::faceSetOption::A_
scalar A_
Sum of face area.
Definition: faceSetOption.H:173
Foam::fa::faceSetOption::faceSetName
const word & faceSetName() const noexcept
Definition: faceSetOptionI.H:69
Foam::Enum< selectionModeType >
Foam::fa::faceSetOption::duration
scalar duration() const noexcept
Return const access to the duration.
Definition: faceSetOptionI.H:36
Foam::fa::option::name
const word & name() const noexcept
Return const access to the source name.
Definition: faOptionI.H:30
Foam::fa::faceSetOption::duration_
scalar duration_
Duration.
Definition: faceSetOption.H:161
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fa::faceSetOption::TypeName
TypeName("faceSetOption")
Runtime type information.
Foam::fa::option::patch
const fvPatch & patch() const noexcept
Return const access to fvPatch.
Definition: faOptionI.H:42
Foam::fa::faceSetOption
Intermediate abstract class for handling face-set options for the derived faOptions.
Definition: faceSetOption.H:134
faMesh.H
Foam::fa::faceSetOption::timeStart
scalar timeStart() const noexcept
Return const access to the time start.
Definition: faceSetOptionI.H:30
Foam::fa::faceSetOption::useSubMesh
bool useSubMesh() const noexcept
True if sub-selection should be used.
Definition: faceSetOptionI.H:63
Foam::fa::faceSetOption::faces
const labelList & faces() const noexcept
Return const access to the face selection.
Definition: faceSetOptionI.H:81
Foam::fa::faceSetOption::selectionModeType
selectionModeType
Enumeration for selection mode types.
Definition: faceSetOption.H:143
Foam::fa::faceSetOption::selectionModeTypeNames_
static const Enum< selectionModeType > selectionModeTypeNames_
List of selection mode type names.
Definition: faceSetOption.H:150
faceSet.H
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
dict
dictionary dict
Definition: searchingEngine.H:14
faOption.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fa::faceSetOption::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: faceSetOption.C:230
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fa::faceSetOption::faces_
labelList faces_
Set of faces to apply source to.
Definition: faceSetOption.H:170
Time.H
Foam::fa::faceSetOption::selectionMode_
selectionModeType selectionMode_
Face selection mode.
Definition: faceSetOption.H:164
Foam::fa::faceSetOption::smVolFaceZone
Definition: faceSetOption.H:146
Foam::fa::option
Base abstract class for handling finite area options (i.e. faOption).
Definition: faOption.H:133
Foam::List< label >
Foam::fa::faceSetOption::faceSetOption
faceSetOption(const word &name, const word &modelType, const dictionary &dict, const fvPatch &patch)
Construct from components.
Definition: faceSetOption.C:177
Foam::fa::faceSetOption::timeStart_
scalar timeStart_
Time start.
Definition: faceSetOption.H:158
Foam::fa::faceSetOption::smAll
Definition: faceSetOption.H:145
Foam::fa::faceSetOption::setArea
void setArea()
Recalculate the area.
Definition: faceSetOption.C:81
Foam::fa::faceSetOption::isActive
virtual bool isActive()
Is the source active?
Definition: faceSetOption.C:205
Foam::fa::faceSetOption::faceSetName_
word faceSetName_
Name of "volFaceZone" selection.
Definition: faceSetOption.H:167
Foam::fa::faceSetOption::setSelection
void setSelection(const dictionary &dict)
Set face selection name from dictionary input.
Definition: faceSetOption.C:55
Foam::fa::faceSetOption::inTimeLimits
bool inTimeLimits(const scalar timeValue) const
Return true if within time limits.
Definition: faceSetOptionI.H:42
Foam::fa::faceSetOption::A
scalar A() const noexcept
Return const access to the total face area.
Definition: faceSetOptionI.H:75
Foam::fa::faceSetOption::setFaceSelection
void setFaceSelection()
Set face selection based on user input selection mode.
Definition: faceSetOption.C:108
Foam::fa::faceSetOption::selectionMode
selectionModeType selectionMode() const noexcept
Return const access to the face selection mode.
Definition: faceSetOptionI.H:57
Foam::fa::faceSetOption::~faceSetOption
virtual ~faceSetOption()=default
Destructor.