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