cellSetOption.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2017 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fv::cellSetOption
29 
30 Description
31  Cell-set options abstract base class. Provides a base set of controls,
32  e.g.:
33  \verbatim
34  type scalarExplicitSource // Source type
35  active on; // on/off switch
36 
37  timeStart 0.0; // Start time
38  duration 1000.0; // Duration
39  selectionMode cellSet; // cellSet, points, cellZone
40  .
41  .
42  .
43  \endverbatim
44 
45 Note
46  Source/sink options are to be added to the equation R.H.S.
47 
48 SourceFiles
49  cellSetOption.C
50  cellSetOptionIO.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef cellSetOption_H
55 #define cellSetOption_H
56 
57 #include "fvOption.H"
58 #include "cellSet.H"
59 #include "fvMesh.H"
60 #include "Time.H"
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 namespace Foam
65 {
66 namespace fv
67 {
68 
69 /*---------------------------------------------------------------------------*\
70  Class cellSetOption Declaration
71 \*---------------------------------------------------------------------------*/
72 
73 class cellSetOption
74 :
75  public option
76 {
77 public:
78 
79  // Public data
80 
81  //- Enumeration for selection mode types
83  {
87  smAll
88  };
89 
90  //- List of selection mode type names
92 
93 
94 protected:
95 
96  // Protected data
97 
98  //- Time start
99  scalar timeStart_;
100 
101  //- Duration
102  scalar duration_;
103 
104  //- Cell selection mode
106 
107  //- Name of set/zone for "cellSet" and "cellZone" selectionMode
109 
110  //- List of points for "points" selectionMode
112 
113  //- Set of cells to apply source to
115 
116  //- Sum of cell volumes
117  scalar V_;
118 
119 
120  // Protected functions
121 
122  //- Set the cellSet or points selection
123  void setSelection(const dictionary& dict);
124 
125  //- Set the cell set based on the user input selection mode
126  void setCellSet();
127 
128  //- Recalculate the volume
129  void setVol();
130 
131 
132 public:
133 
134  //- Runtime type information
135  TypeName("cellSetOption");
136 
137 
138  // Constructors
139 
140  //- Construct from components
142  (
143  const word& name,
144  const word& modelType,
145  const dictionary& dict,
146  const fvMesh& mesh
147  );
148 
149 
150  //- Destructor
151  virtual ~cellSetOption() = default;
152 
153 
154  // Member Functions
155 
156  // Access
157 
158  //- Return const access to the time start
159  inline scalar timeStart() const;
160 
161  //- Return const access to the duration
162  inline scalar duration() const;
163 
164  //- Return true if within time limits
165  inline bool inTimeLimits(const scalar time) const;
166 
167  //- Return const access to the cell selection mode
168  inline const selectionModeType& selectionMode() const;
169 
170  //- Return const access to the name of cell set for "cellSet"
171  // selectionMode
172  inline const word& cellSetName() const;
173 
174  //- Return const access to the total cell volume
175  inline scalar V() const;
176 
177  //- Return const access to the cell set
178  inline const labelList& cells() const;
179 
180 
181  // Edit
182 
183  //- Return access to the time start
184  inline scalar& timeStart();
185 
186  //- Return access to the duration
187  inline scalar& duration();
188 
189 
190  // Checks
191 
192  //- Is the source active?
193  virtual bool isActive();
194 
195 
196  // IO
197 
198  //- Read source dictionary
199  virtual bool read(const dictionary& dict);
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace fv
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #include "cellSetOptionI.H"
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
Foam::fv::cellSetOption::setVol
void setVol()
Recalculate the volume.
Definition: cellSetOption.C:94
Foam::fv::cellSetOption::duration
scalar duration() const
Return const access to the duration.
Definition: cellSetOptionI.H:36
Foam::Enum< selectionModeType >
cellSetOptionI.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fv::cellSetOption
Cell-set options abstract base class. Provides a base set of controls, e.g.:
Definition: cellSetOption.H:72
Foam::fv::cellSetOption::cellSetOption
cellSetOption(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: cellSetOption.C:200
Foam::fv::option::name
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:30
Foam::fv::cellSetOption::selectionMode_
selectionModeType selectionMode_
Cell selection mode.
Definition: cellSetOption.H:104
Foam::fv::cellSetOption::~cellSetOption
virtual ~cellSetOption()=default
Destructor.
Foam::fv::cellSetOption::V_
scalar V_
Sum of cell volumes.
Definition: cellSetOption.H:116
Foam::fv::cellSetOption::V
scalar V() const
Return const access to the total cell volume.
Definition: cellSetOptionI.H:69
Foam::fv::cellSetOption::smPoints
Definition: cellSetOption.H:83
Foam::fv::cellSetOption::cellSetName
const word & cellSetName() const
Return const access to the name of cell set for "cellSet".
Definition: cellSetOptionI.H:63
Foam::fv::cellSetOption::cells
const labelList & cells() const
Return const access to the cell set.
Definition: cellSetOptionI.H:75
Foam::fv::cellSetOption::selectionMode
const selectionModeType & selectionMode() const
Return const access to the cell selection mode.
Definition: cellSetOptionI.H:57
Foam::fv::cellSetOption::setSelection
void setSelection(const dictionary &dict)
Set the cellSet or points selection.
Definition: cellSetOption.C:58
Foam::fv::option
Finite volume options abstract base class. Provides a base set of controls, e.g.:
Definition: fvOption.H:69
Foam::fv::cellSetOption::isActive
virtual bool isActive()
Is the source active?
Definition: cellSetOption.C:225
Foam::fv::cellSetOption::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: cellSetOption.C:255
Foam::fv::cellSetOption::cells_
labelList cells_
Set of cells to apply source to.
Definition: cellSetOption.H:113
Foam::fv::cellSetOption::TypeName
TypeName("cellSetOption")
Runtime type information.
Foam::fv::cellSetOption::selectionModeType
selectionModeType
Enumeration for selection mode types.
Definition: cellSetOption.H:81
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fv::cellSetOption::timeStart
scalar timeStart() const
Return const access to the time start.
Definition: cellSetOptionI.H:30
Foam::fv::cellSetOption::smCellZone
Definition: cellSetOption.H:85
fv
labelList fv(nPoints)
Time.H
Foam::fv::cellSetOption::selectionModeTypeNames_
static const Enum< selectionModeType > selectionModeTypeNames_
List of selection mode type names.
Definition: cellSetOption.H:90
fvOption.H
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:102
Foam::fv::option::mesh
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:36
Foam::fv::cellSetOption::duration_
scalar duration_
Duration.
Definition: cellSetOption.H:101
Foam::fv::cellSetOption::cellSetName_
word cellSetName_
Name of set/zone for "cellSet" and "cellZone" selectionMode.
Definition: cellSetOption.H:107
cellSet.H
Foam::fv::cellSetOption::points_
List< point > points_
List of points for "points" selectionMode.
Definition: cellSetOption.H:110
Foam::fv::cellSetOption::inTimeLimits
bool inTimeLimits(const scalar time) const
Return true if within time limits.
Definition: cellSetOptionI.H:42
Foam::fv::cellSetOption::smCellSet
Definition: cellSetOption.H:84
Foam::fv::cellSetOption::timeStart_
scalar timeStart_
Time start.
Definition: cellSetOption.H:98
Foam::fv::cellSetOption::setCellSet
void setCellSet()
Set the cell set based on the user input selection mode.
Definition: cellSetOption.C:121
Foam::fv::cellSetOption::smAll
Definition: cellSetOption.H:86