fvOptionList.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::optionList
26 
27 Description
28  List of finite volume options
29 
30 SourceFile
31  optionList.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef fvOptionList_H
36 #define fvOptionList_H
37 
38 #include "fvOption.H"
39 #include "PtrList.H"
40 #include "GeometricField.H"
41 #include "geometricOneField.H"
42 #include "fvPatchField.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of friend functions and operators
50 
51 namespace fv
52 {
53  class optionList;
54 }
55 
56 Ostream& operator<<(Ostream& os, const fv::optionList& options);
57 
58 namespace fv
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class optionList Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class optionList
66 :
67  public PtrList<option>
68 {
69 protected:
70 
71  // Protected data
72 
73  //- Reference to the mesh database
74  const fvMesh& mesh_;
75 
76  //- Time index to check that all defined sources have been applied
78 
79 
80  // Protected Member Functions
81 
82  //- Return the "options" sub-dictionary if present otherwise return dict
83  const dictionary& optionsDict(const dictionary& dict) const;
84 
85  //- Read options dictionary
86  bool readOptions(const dictionary& dict);
87 
88  //- Check that all sources have been applied
89  void checkApplied() const;
90 
91  //- Disallow default bitwise copy construct
92  optionList(const optionList&);
93 
94  //- Disallow default bitwise assignment
95  void operator=(const optionList&);
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("optionList");
102 
103 
104  // Constructors
105 
106  //- Construct null
107  optionList(const fvMesh& mesh);
108 
109  //- Construct from mesh and dictionary
110  optionList(const fvMesh& mesh, const dictionary& dict);
111 
112 
113  //- Destructor
114  virtual ~optionList()
115  {}
116 
117 
118  // Member Functions
119 
120  //- Reset the source list
121  void reset(const dictionary& dict);
122 
123 
124  // Sources
125 
126  //- Return source for equation
127  template<class Type>
129  (
131  );
132 
133  //- Return source for equation with specified name
134  template<class Type>
136  (
138  const word& fieldName
139  );
140 
141  //- Return source for equation
142  template<class Type>
144  (
145  const volScalarField& rho,
147  );
148 
149  //- Return source for equation with specified name
150  template<class Type>
152  (
153  const volScalarField& rho,
155  const word& fieldName
156  );
157 
158  //- Return source for equation
159  template<class Type>
161  (
162  const volScalarField& alpha,
163  const volScalarField& rho,
165  );
166 
167  //- Return source for equation with specified name
168  template<class Type>
170  (
171  const volScalarField& alpha,
172  const volScalarField& rho,
174  const word& fieldName
175  );
176 
177  //- Return source for equation
178  template<class Type>
180  (
181  const volScalarField& alpha,
182  const geometricOneField& rho,
184  );
185 
186  //- Return source for equation
187  template<class Type>
189  (
190  const geometricOneField& alpha,
191  const volScalarField& rho,
193  );
194 
195  //- Return source for equation
196  template<class Type>
198  (
199  const geometricOneField& alpha,
200  const geometricOneField& rho,
202  );
203 
204 
205  // Constraints
206 
207  //- Apply constraints to equation
208  template<class Type>
209  void constrain(fvMatrix<Type>& eqn);
210 
211 
212  // Correction
213 
214  //- Apply correction to field
215  template<class Type>
217 
218 
219  // IO
220 
221  //- Read dictionary
222  virtual bool read(const dictionary& dict);
223 
224  //- Write data to Ostream
225  virtual bool writeData(Ostream& os) const;
226 
227  //- Ostream operator
228  friend Ostream& operator<<
229  (
230  Ostream& os,
231  const optionList& options
232  );
233 };
234 
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 } // End namespace fv
239 } // End namespace Foam
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #ifdef NoRepository
244  #include "fvOptionListTemplates.C"
245 #endif
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #endif
250 
251 // ************************************************************************* //
Foam::fv::optionList::operator=
void operator=(const optionList &)
Disallow default bitwise assignment.
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fv::optionList::correct
void correct(GeometricField< Type, fvPatchField, volMesh > &field)
Apply correction to field.
Definition: fvOptionListTemplates.C:277
Foam::fv::optionList::optionsDict
const dictionary & optionsDict(const dictionary &dict) const
Return the "options" sub-dictionary if present otherwise return dict.
Definition: fvOptionList.C:43
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::fv::optionList::constrain
void constrain(fvMatrix< Type > &eqn)
Apply constraints to equation.
Definition: fvOptionListTemplates.C:246
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:216
Foam::fv::optionList::mesh_
const fvMesh & mesh_
Reference to the mesh database.
Definition: fvOptionList.H:73
fvOptionListTemplates.C
Foam::fv::optionList::reset
void reset(const dictionary &dict)
Reset the source list.
Definition: fvOptionList.C:108
Foam::geometricOneField
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
Definition: geometricOneField.H:52
Foam::fv::optionList::checkTimeIndex_
label checkTimeIndex_
Time index to check that all defined sources have been applied.
Definition: fvOptionList.H:76
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::fv::optionList::TypeName
TypeName("optionList")
Runtime type information.
Foam::fv::optionList::readOptions
bool readOptions(const dictionary &dict)
Read options dictionary.
Definition: fvOptionList.C:58
Foam::fv::optionList::checkApplied
void checkApplied() const
Check that all sources have been applied.
Definition: fvOptionList.C:73
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
Foam::fv::options
Finite-volume options.
Definition: fvOptions.H:52
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
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
rho
rho
Definition: pEqn.H:3
GeometricField.H
fv
labelList fv(nPoints)
geometricOneField.H
fvOption.H
Foam::fv::optionList::~optionList
virtual ~optionList()
Destructor.
Definition: fvOptionList.H:113
Foam::PtrList< option >::operator
friend Ostream & operator(Ostream &, const PtrList< T > &)
Foam::fvMatrix< Type >
Foam::fv::optionList::optionList
optionList(const optionList &)
Disallow default bitwise copy construct.
PtrList.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::fv::optionList
List of finite volume options.
Definition: fvOptionList.H:64
Foam::fv::optionList::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: fvOptionList.C:139
fvPatchField.H
Foam::fv::optionList::writeData
virtual bool writeData(Ostream &os) const
Write data to Ostream.
Definition: fvOptionList.C:145