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-2015 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 
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 
44 Note:
45  Source/sink options are to be added to the equation R.H.S.
46 
47 SourceFiles
48  cellSetOption.C
49  cellSetOptionIO.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef cellSetOption_H
54 #define cellSetOption_H
55 
56 #include "fvOption.H"
57 #include "cellSet.H"
58 #include "fvMesh.H"
59 #include "Time.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 namespace fv
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class cellSetOption Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class cellSetOption
73 :
74  public option
75 {
76 public:
77 
78  // Public data
79 
80  //- Enumeration for selection mode types
82  {
86  smAll
87  };
88 
89  //- Word 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 cell set 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 
129 public:
130 
131  //- Runtime type information
132  TypeName("cellSetOption");
133 
134 
135  // Constructors
136 
137  //- Construct from components
139  (
140  const word& name,
141  const word& modelType,
142  const dictionary& dict,
143  const fvMesh& mesh
144  );
145 
146 
147  //- Destructor
148  virtual ~cellSetOption();
149 
150 
151  // Member Functions
152 
153  // Access
154 
155  //- Return const access to the time start
156  inline scalar timeStart() const;
157 
158  //- Return const access to the duration
159  inline scalar duration() const;
160 
161  //- Return true if within time limits
162  inline bool inTimeLimits(const scalar time) const;
163 
164  //- Return const access to the cell selection mode
165  inline const selectionModeType& selectionMode() const;
166 
167  //- Return const access to the name of cell set for "cellSet"
168  // selectionMode
169  inline const word& cellSetName() const;
170 
171  //- Return const access to the total cell volume
172  inline scalar V() const;
173 
174  //- Return const access to the cell set
175  inline const labelList& cells() const;
176 
177 
178  // Edit
179 
180  //- Return access to the time start
181  inline scalar& timeStart();
182 
183  //- Return access to the duration
184  inline scalar& duration();
185 
186 
187  // Checks
188 
189  //- Is the source active?
190  virtual bool isActive();
191 
192 
193  // IO
194 
195  //- Read source dictionary
196  virtual bool read(const dictionary& dict);
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace fv
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #include "cellSetOptionI.H"
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
Cell-set options abtract base class. Provides a base set of controls, e.g.
Definition: cellSetOption.H:71
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
Finite volume options abtract base class. Provides a base set of controls, e.g.
Definition: fvOption.H:65
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
selectionModeType
Enumeration for selection mode types.
Definition: cellSetOption.H:80
virtual bool read(const dictionary &dict)
Read source dictionary.
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
bool inTimeLimits(const scalar time) const
Return true if within time limits.
const selectionModeType & selectionMode() const
Return const access to the cell selection mode.
A class for handling words, derived from string.
Definition: word.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
TypeName("cellSetOption")
Runtime type information.
labelList cells_
Set of cells to apply source to.
Namespace for OpenFOAM.
scalar V_
Sum of cell volumes.
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
dictionary dict
virtual bool isActive()
Is the source active?
scalar V() const
Return const access to the total cell volume.
scalar duration_
Duration.
cellSetOption(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
scalar timeStart_
Time start.
Definition: cellSetOption.H:98
word cellSetName_
Name of cell set for "cellSet" and "cellZone" selectionMode.
static const NamedEnum< selectionModeType, 4 > selectionModeTypeNames_
Word list of selection mode type names.
Definition: cellSetOption.H:90
const word & cellSetName() const
Return const access to the name of cell set for "cellSet".
labelList fv(nPoints)
selectionModeType selectionMode_
Cell selection mode.
void setCellSet()
Set the cell set based on the user input selection mode.
Definition: cellSetOption.C:92
scalar timeStart() const
Return const access to the time start.
scalar duration() const
Return const access to the duration.
virtual ~cellSetOption()
Destructor.
List< point > points_
List of points for "points" selectionMode.