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 // ************************************************************************* //
cellSetOptionI.H
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fv::cellSetOption
Cell-set options abtract base class. Provides a base set of controls, e.g.
Definition: cellSetOption.H:71
Foam::fv::cellSetOption::cellSetOption
cellSetOption(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: cellSetOption.C:190
Foam::fv::option::name
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
Foam::fv::cellSetOption::selectionMode_
selectionModeType selectionMode_
Cell selection mode.
Definition: cellSetOption.H:104
Foam::fv::cellSetOption::V_
scalar V_
Sum of cell volumes.
Definition: cellSetOption.H:116
Foam::fv::cellSetOption::~cellSetOption
virtual ~cellSetOption()
Destructor.
Definition: cellSetOption.C:217
Foam::fv::cellSetOption::V
scalar V() const
Return const access to the total cell volume.
Definition: cellSetOptionI.H:67
Foam::fv::cellSetOption::smPoints
@ smPoints
Definition: cellSetOption.H:82
Foam::fv::cellSetOption::cellSetName
const word & cellSetName() const
Return const access to the name of cell set for "cellSet".
Definition: cellSetOptionI.H:61
Foam::fv::cellSetOption::duration
scalar duration() const
Return const access to the duration.
Definition: cellSetOptionI.H:34
Foam::fv::cellSetOption::cells
const labelList & cells() const
Return const access to the cell set.
Definition: cellSetOptionI.H:73
Foam::fv::cellSetOption::selectionMode
const selectionModeType & selectionMode() const
Return const access to the cell selection mode.
Definition: cellSetOptionI.H:55
Foam::fv::cellSetOption::setSelection
void setSelection(const dictionary &dict)
Set the cellSet or points selection.
Definition: cellSetOption.C:62
Foam::fv::option
Finite volume options abtract base class. Provides a base set of controls, e.g.
Definition: fvOption.H:65
Foam::fv::cellSetOption::selectionModeTypeNames_
static const NamedEnum< selectionModeType, 4 > selectionModeTypeNames_
Word list of selection mode type names.
Definition: cellSetOption.H:90
Foam::fv::cellSetOption::isActive
virtual bool isActive()
Is the source active?
Definition: cellSetOption.C:223
Foam::fv::cellSetOption::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: cellSetOptionIO.C:30
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:80
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fv::cellSetOption::timeStart
scalar timeStart() const
Return const access to the time start.
Definition: cellSetOptionI.H:28
Foam::fv::cellSetOption::smCellZone
@ smCellZone
Definition: cellSetOption.H:84
fv
labelList fv(nPoints)
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:59
Foam::fv::option::mesh
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
Foam::fv::cellSetOption::duration_
scalar duration_
Duration.
Definition: cellSetOption.H:101
Foam::fv::cellSetOption::cellSetName_
word cellSetName_
Name of cell set 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:40
Foam::fv::cellSetOption::smCellSet
@ smCellSet
Definition: cellSetOption.H:83
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:97
Foam::NamedEnum< selectionModeType, 4 >
Foam::fv::cellSetOption::smAll
@ smAll
Definition: cellSetOption.H:85