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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2019 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::optionList
29 
30 Description
31  List of finite volume options
32 
33 SourceFile
34  optionList.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef fvOptionList_H
39 #define fvOptionList_H
40 
41 #include "fvOption.H"
42 #include "PtrList.H"
43 #include "GeometricField.H"
44 #include "geometricOneField.H"
45 #include "fvPatchField.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declaration of friend functions and operators
53 
54 namespace fv
55 {
56  class optionList;
57 }
58 
59 Ostream& operator<<(Ostream& os, const fv::optionList& options);
60 
61 namespace fv
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class optionList Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class optionList
69 :
70  public PtrList<option>
71 {
72 protected:
73 
74  // Protected data
75 
76  //- Reference to the mesh database
77  const fvMesh& mesh_;
78 
79  //- Time index to check that all defined sources have been applied
80  label checkTimeIndex_;
81 
82 
83  // Protected Member Functions
84 
85  //- Return the "options" sub-dictionary if present otherwise return dict
86  const dictionary& optionsDict(const dictionary& dict) const;
87 
88  //- Read options dictionary
89  bool readOptions(const dictionary& dict);
90 
91  //- Check that all sources have been applied
92  void checkApplied() const;
93 
94  //- Return source for equation with specified name and dimensions
95  template<class Type>
97  (
99  const word& fieldName,
100  const dimensionSet& ds
101  );
102 
103  //- No copy construct
104  optionList(const optionList&) = delete;
105 
106  //- No copy assignment
107  void operator=(const optionList&) = delete;
108 
109 
110 public:
111 
112  //- Runtime type information
113  TypeName("optionList");
114 
115 
116  // Constructors
117 
118  //- Construct null
119  optionList(const fvMesh& mesh);
120 
121  //- Construct from mesh and dictionary
122  optionList(const fvMesh& mesh, const dictionary& dict);
123 
124 
125  //- Destructor
126  virtual ~optionList() = default;
127 
128 
129  // Member Functions
130 
131  //- Reset the source list
132  void reset(const dictionary& dict);
133 
134  //- Return whether there is something to apply to the field
135  bool appliesToField(const word& fieldName) const;
136 
137 
138  // Sources
139 
140  //- Return source for equation
141  template<class Type>
142  tmp<fvMatrix<Type>> operator()
143  (
145  );
146 
147  //- Return source for equation with specified name
148  template<class Type>
149  tmp<fvMatrix<Type>> operator()
150  (
152  const word& fieldName
153  );
154 
155  //- Return source for equation
156  template<class Type>
157  tmp<fvMatrix<Type>> operator()
158  (
159  const volScalarField& rho,
161  );
162 
163  //- Return source for equation with specified name
164  template<class Type>
165  tmp<fvMatrix<Type>> operator()
166  (
167  const volScalarField& rho,
169  const word& fieldName
170  );
171 
172  //- Return source for equation
173  template<class Type>
174  tmp<fvMatrix<Type>> operator()
175  (
176  const volScalarField& alpha,
177  const volScalarField& rho,
179  );
180 
181  //- Return source for equation with specified name
182  template<class Type>
183  tmp<fvMatrix<Type>> operator()
184  (
185  const volScalarField& alpha,
186  const volScalarField& rho,
188  const word& fieldName
189  );
190 
191  //- Return source for equation
192  template<class Type>
193  tmp<fvMatrix<Type>> operator()
194  (
195  const volScalarField& alpha,
196  const geometricOneField& rho,
198  );
199 
200  //- Return source for equation
201  template<class Type>
202  tmp<fvMatrix<Type>> operator()
203  (
204  const geometricOneField& alpha,
205  const volScalarField& rho,
207  );
208 
209  //- Return source for equation
210  template<class Type>
211  tmp<fvMatrix<Type>> operator()
212  (
213  const geometricOneField& alpha,
214  const geometricOneField& rho,
216  );
217 
218  //- Return source for equation with second time derivative
219  template<class Type>
221  (
223  );
224 
225  //- Return source for equation with second time derivative
226  template<class Type>
228  (
230  const word& fieldName
231  );
232 
233 
234  // Constraints
235 
236  //- Apply constraints to equation
237  template<class Type>
238  void constrain(fvMatrix<Type>& eqn);
239 
240 
241  // Correction
242 
243  //- Apply correction to field
244  template<class Type>
246 
247 
248  // IO
249 
250  //- Read dictionary
251  virtual bool read(const dictionary& dict);
252 
253  //- Write data to Ostream
254  virtual bool writeData(Ostream& os) const;
255 
256  //- Ostream operator
257  friend Ostream& operator<<
258  (
259  Ostream& os,
260  const optionList& options
261  );
262 };
263 
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 } // End namespace fv
268 } // End namespace Foam
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 #ifdef NoRepository
273  #include "fvOptionListTemplates.C"
274 #endif
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 #endif
279 
280 // ************************************************************************* //
Foam::fv::optionList::appliesToField
bool appliesToField(const word &fieldName) const
Return whether there is something to apply to the field.
Definition: fvOptionList.C:142
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fv::optionList::correct
void correct(GeometricField< Type, fvPatchField, volMesh > &field)
Apply correction to field.
Definition: fvOptionListTemplates.C:321
Foam::fv::optionList::optionsDict
const dictionary & optionsDict(const dictionary &dict) const
Return the "options" sub-dictionary if present otherwise return dict.
Definition: fvOptionList.C:45
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::fv::optionList::constrain
void constrain(fvMatrix< Type > &eqn)
Apply constraints to equation.
Definition: fvOptionListTemplates.C:288
Foam::fv::optionList::optionList
optionList(const optionList &)=delete
No copy construct.
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::fv::optionList::mesh_
const fvMesh & mesh_
Reference to the mesh database.
Definition: fvOptionList.H:76
Foam::fv::optionList::~optionList
virtual ~optionList()=default
Destructor.
fvOptionListTemplates.C
Foam::fv::optionList::reset
void reset(const dictionary &dict)
Reset the source list.
Definition: fvOptionList.C:110
Foam::geometricOneField
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
Definition: geometricOneField.H:54
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:65
Foam::fv::optionList::d2dt2
tmp< fvMatrix< Type > > d2dt2(GeometricField< Type, fvPatchField, volMesh > &field)
Return source for equation with second time derivative.
rho
rho
Definition: readInitialConditions.H:88
Foam::fv::optionList::checkTimeIndex_
label checkTimeIndex_
Time index to check that all defined sources have been applied.
Definition: fvOptionList.H:79
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::fv::optionList::TypeName
TypeName("optionList")
Runtime type information.
Foam::fv::optionList::readOptions
bool readOptions(const dictionary &dict)
Read options dictionary.
Definition: fvOptionList.C:60
Foam::fv::optionList::operator=
void operator=(const optionList &)=delete
No copy assignment.
Foam::fv::optionList::checkApplied
void checkApplied() const
Check that all sources have been applied.
Definition: fvOptionList.C:75
field
rDeltaTY field()
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:62
Foam::fv::options
Finite-volume options.
Definition: fvOptions.H:55
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
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
GeometricField.H
fv
labelList fv(nPoints)
geometricOneField.H
Foam::fv::optionList::source
tmp< fvMatrix< Type > > source(GeometricField< Type, fvPatchField, volMesh > &field, const word &fieldName, const dimensionSet &ds)
Return source for equation with specified name and dimensions.
fvOption.H
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
PtrList.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::fv::optionList
List of finite volume options.
Definition: fvOptionList.H:67
Foam::fv::optionList::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: fvOptionList.C:160
fvPatchField.H
Foam::fv::optionList::writeData
virtual bool writeData(Ostream &os) const
Write data to Ostream.
Definition: fvOptionList.C:166