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 // Forward Declarations
50 namespace Foam
51 {
52 namespace fa
53 {
54  class optionList;
55 }
56 
57 Ostream& operator<<(Ostream& os, const fa::optionList& options);
58 
59 namespace fa
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class optionList Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class optionList
67 :
68  public PtrList<fa::option>
69 {
70 protected:
71 
72  // Protected Data
73 
74  //- Reference to the mesh database
75  const fvMesh& mesh_;
76 
77  //- Reference to the patch
78  const fvPatch& patch_;
79 
80  //- Time index to check that all defined sources have been applied
81  label checkTimeIndex_;
82 
83 
84  // Protected Member Functions
85 
86  //- Return "options" sub-dictionary (if present) or return dict
87  static const dictionary& optionsDict(const dictionary& dict);
88 
89  //- Read options dictionary
90  bool readOptions(const dictionary& dict);
91 
92  //- Check that all sources have been applied
93  void checkApplied() const;
94 
95  //- Return source for equation with specified name and dimensions
96  template<class Type>
98  (
100  const areaScalarField& h,
101  const word& fieldName,
102  const dimensionSet& ds
103  );
104 
105  //- No copy construct
106  optionList(const optionList&) = delete;
107 
108  //- No copy assignment
109  void operator=(const optionList&) = delete;
110 
111 
112 public:
113 
114  //- Runtime type information
115  TypeName("optionList");
116 
117 
118  // Constructors
119 
120  //- Default construct from patch
121  explicit optionList(const fvPatch& p);
122 
123  //- Construct from patch and dictionary
124  optionList(const fvPatch& p, const dictionary&);
125 
126 
127  //- Destructor
128  virtual ~optionList() = default;
129 
130 
131  // Member Functions
132 
133  //- Reset the source list
134  void reset(const dictionary& dict);
135 
136  //- Return whether there is something to apply to the field
137  bool appliesToField(const word& fieldName) const;
138 
139 
140  // Sources
141 
142  //- Return source for equation
143  template<class Type>
144  tmp<faMatrix<Type>> operator()
145  (
146  const areaScalarField& h,
148  );
149 
150  //- Return source for equation with specified name
151  template<class Type>
152  tmp<faMatrix<Type>> operator()
153  (
154  const areaScalarField& h,
156  const word& fieldName
157  );
158 
159  //- Return source for equation
160  template<class Type>
161  tmp<faMatrix<Type>> operator()
162  (
163  const areaScalarField& h,
164  const areaScalarField& rho,
166  );
167 
168  //- Return source for equation with specified name
169  template<class Type>
170  tmp<faMatrix<Type>> operator()
171  (
172  const areaScalarField& h,
173  const areaScalarField& rho,
175  const word& fieldName
176  );
177 
178 
179  //- Return source for equation with specified name and dimensios
180  template<class Type>
181  tmp<faMatrix<Type>> operator()
182  (
183  const areaScalarField& rho,
185  const dimensionSet& ds
186  );
187 
188 
189  //- Return source for equation with second time derivative
190  template<class Type>
192  (
194  );
195 
196  //- Return source for equation with second time derivative
197  template<class Type>
199  (
201  const word& fieldName
202  );
203 
204 
205  // Constraints
206 
207  //- Apply constraints to equation
208  template<class Type>
209  void constrain(faMatrix<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 fa
239 } // End namespace Foam
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #ifdef NoRepository
244  #include "faOptionListTemplates.C"
245 #endif
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #endif
250 
251 // ************************************************************************* //
Foam::fa::optionList::checkTimeIndex_
label checkTimeIndex_
Time index to check that all defined sources have been applied.
Definition: faOptionList.H:80
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::fa::optionList::optionsDict
static const dictionary & optionsDict(const dictionary &dict)
Return "options" sub-dictionary (if present) or return dict.
Definition: faOptionList.C:44
Foam::faMatrix
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition: faMatricesFwd.H:43
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
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:65
faPatchField.H
Foam::dimensionSet
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:108
rho
rho
Definition: readInitialConditions.H:88
Foam::fa::optionList::patch_
const fvPatch & patch_
Reference to the patch.
Definition: faOptionList.H:77
faOptionListTemplates.C
Foam::fa::optionList::readOptions
bool readOptions(const dictionary &dict)
Read options dictionary.
Definition: faOptionList.C:54
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::fa::optionList::~optionList
virtual ~optionList()=default
Destructor.
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:249
field
rDeltaTY field()
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
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:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam::fa::optionList::optionList
optionList(const optionList &)=delete
No copy construct.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fa::optionList::appliesToField
bool appliesToField(const word &fieldName) const
Return whether there is something to apply to the field.
Definition: faOptionList.C:140
GeometricField.H
Foam::fa::optionList::reset
void reset(const dictionary &dict)
Reset the source list.
Definition: faOptionList.C:108
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:156
PtrList.H
Foam::fa::optionList::mesh_
const fvMesh & mesh_
Reference to the mesh database.
Definition: faOptionList.H:74
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:68
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:290
Foam::fa::optionList::writeData
virtual bool writeData(Ostream &os) const
Write data to Ostream.
Definition: faOptionList.C:162
Foam::fa::optionList::TypeName
TypeName("optionList")
Runtime type information.