faOptionList.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) 2019-2020 OpenCFD Ltd.
9 ------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fa::optionList
28 
29 Description
30  List of finite volume options
31 
32 SourceFile
33  optionList.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef faOptionList_H
38 #define faOptionList_H
39 
40 #include "faOption.H"
41 #include "PtrList.H"
42 #include "GeometricField.H"
43 #include "geometricOneField.H"
44 #include "faPatchField.H"
45 #include "fvMesh.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declaration of friend functions and operators
53 namespace fa
54 {
55  class optionList;
56 }
57 
58 Ostream& operator<<(Ostream& os, const fa::optionList& options);
59 
60 namespace fa
61 {
62 
63 /*---------------------------------------------------------------------------*\
64  Class optionList Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class optionList
68 :
69  public PtrList<option>
70 {
71 protected:
72 
73  // Protected Data
74 
75  //- Reference to the mesh database
76  const fvMesh& mesh_;
77 
78  //- Reference to the patch
79  const fvPatch& patch_;
80 
81  //- Time index to check that all defined sources have been applied
82  label checkTimeIndex_;
83 
84 
85  // Protected Member Functions
86 
87  //- Return the "options" sub-dictionary if present otherwise return dict
88  const dictionary& optionsDict(const dictionary& dict) const;
89 
90  //- Read options dictionary
91  bool readOptions(const dictionary& dict);
92 
93  //- Check that all sources have been applied
94  void checkApplied() const;
95 
96  //- Return source for equation with specified name and dimensions
97  template<class Type>
99  (
101  const areaScalarField& h,
102  const word& fieldName,
103  const dimensionSet& ds
104  );
105 
106  //- No copy construct
107  optionList(const optionList&) = delete;
108 
109  //- No copy assignment
110  void operator=(const optionList&) = delete;
111 
112 
113 public:
114 
115  //- Runtime type information
116  TypeName("optionList");
117 
118 
119  // Constructors
120 
121  //- Construct null
122  optionList(const fvPatch& p);
123 
124  //- Construct from mesh and dictionary
125  optionList(const fvPatch&, const dictionary& );
126 
127 
128  //- Destructor
129  virtual ~optionList()
130  {}
131 
132 
133  // Member Functions
134 
135  //- Reset the source list
136  void reset(const dictionary& dict);
137 
138 
139  // Sources
140 
141  //- Return source for equation
142  template<class Type>
143  tmp<faMatrix<Type>> operator()
144  (
145  const areaScalarField& h,
147  );
148 
149  //- Return source for equation with specified name
150  template<class Type>
151  tmp<faMatrix<Type>> operator()
152  (
153  const areaScalarField& h,
155  const word& fieldName
156  );
157 
158  //- Return source for equation
159  template<class Type>
160  tmp<faMatrix<Type>> operator()
161  (
162  const areaScalarField& h,
163  const areaScalarField& rho,
165  );
166 
167  //- Return source for equation with specified name
168  template<class Type>
169  tmp<faMatrix<Type>> operator()
170  (
171  const areaScalarField& h,
172  const areaScalarField& rho,
174  const word& fieldName
175  );
176 
177 
178  //- Return source for equation with specified name and dimensios
179  template<class Type>
180  tmp<faMatrix<Type>> operator()
181  (
182  const areaScalarField& rho,
184  const dimensionSet& ds
185  );
186 
187 
188  //- Return source for equation with second time derivative
189  template<class Type>
191  (
193  );
194 
195  //- Return source for equation with second time derivative
196  template<class Type>
198  (
200  const word& fieldName
201  );
202 
203 
204  // Constraints
205 
206  //- Apply constraints to equation
207  template<class Type>
208  void constrain(faMatrix<Type>& eqn);
209 
210 
211  // Correction
212 
213  //- Apply correction to field
214  template<class Type>
216 
217 
218  // IO
219 
220  //- Read dictionary
221  virtual bool read(const dictionary& dict);
222 
223  //- Write data to Ostream
224  virtual bool writeData(Ostream& os) const;
225 
226  //- Ostream operator
227  friend Ostream& operator<<
228  (
229  Ostream& os,
230  const optionList& options
231  );
232 };
233 
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace fa
238 } // End namespace Foam
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 #ifdef NoRepository
243  #include "faOptionListTemplates.C"
244 #endif
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #endif
249 
250 // ************************************************************************* //
Foam::fa::optionList::~optionList
virtual ~optionList()
Destructor.
Definition: faOptionList.H:128
Foam::fa::optionList::checkTimeIndex_
label checkTimeIndex_
Time index to check that all defined sources have been applied.
Definition: faOptionList.H:81
Foam::fa::optionList::source
tmp< faMatrix< Type > > source(GeometricField< Type, faPatchField, areaMesh > &field, const areaScalarField &h, const word &fieldName, const dimensionSet &ds)
Return source for equation with specified name and dimensions.
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::faMatrix
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition: faMatrix.H:59
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fa::optionList::d2dt2
tmp< faMatrix< Type > > d2dt2(GeometricField< Type, faPatchField, areaMesh > &field)
Return source for equation with second time derivative.
Foam::fa::optionList::operator=
void operator=(const optionList &)=delete
No copy assignment.
Foam::fa::optionList
List of finite volume options.
Definition: faOptionList.H:66
faPatchField.H
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:65
rho
rho
Definition: readInitialConditions.H:88
Foam::fa::optionList::patch_
const fvPatch & patch_
Reference to the patch.
Definition: faOptionList.H:78
faOptionListTemplates.C
Foam::fa::optionList::readOptions
bool readOptions(const dictionary &dict)
Read options dictionary.
Definition: faOptionList.C:59
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::constant::universal::h
const dimensionedScalar h
Planck constant.
Definition: setRegionSolidFields.H:33
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::fa::optionList::constrain
void constrain(faMatrix< Type > &eqn)
Apply constraints to equation.
Definition: faOptionListTemplates.C:224
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
dict
dictionary dict
Definition: searchingEngine.H:14
faOption.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
fvMesh.H
Foam::fa::optionList::optionList
optionList(const optionList &)=delete
No copy construct.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
GeometricField.H
Foam::fa::optionList::reset
void reset(const dictionary &dict)
Reset the source list.
Definition: faOptionList.C:115
Foam::fa::options
Finite-area options.
Definition: faOptions.H:54
geometricOneField.H
Foam::fa::optionList::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: faOptionList.C:147
PtrList.H
Foam::fa::optionList::mesh_
const fvMesh & mesh_
Reference to the mesh database.
Definition: faOptionList.H:75
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::fa::optionList::checkApplied
void checkApplied() const
Check that all sources have been applied.
Definition: faOptionList.C:74
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::fa::optionList::correct
void correct(GeometricField< Type, faPatchField, areaMesh > &field)
Apply correction to field.
Definition: faOptionListTemplates.C:257
Foam::fa::optionList::writeData
virtual bool writeData(Ostream &os) const
Write data to Ostream.
Definition: faOptionList.C:153
Foam::fa::optionList::optionsDict
const dictionary & optionsDict(const dictionary &dict) const
Return the "options" sub-dictionary if present otherwise return dict.
Definition: faOptionList.C:44
Foam::fa::optionList::TypeName
TypeName("optionList")
Runtime type information.