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------------------------------------------------------------------------------
10License
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
26Class
27 Foam::fa::optionList
28
29Description
30 List of finite volume options
31
32SourceFile
33 optionList.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef Foam_faOptionList_H
38#define Foam_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
49namespace Foam
50{
51
52// Forward Declarations
53
54namespace fa
55{
56 class optionList;
57}
58
59Ostream& operator<<(Ostream& os, const fa::optionList& options);
60
61namespace fa
62{
63
64/*---------------------------------------------------------------------------*\
65 Class optionList Declaration
66\*---------------------------------------------------------------------------*/
68class optionList
69:
70 public PtrList<fa::option>
71{
72protected:
73
74 // Protected Data
75
76 //- Reference to the mesh database
77 const fvMesh& mesh_;
78
79 //- Reference to the patch
80 const fvPatch& patch_;
81
82 //- Time index to check that all defined sources have been applied
83 label checkTimeIndex_;
84
85
86 // Protected Member Functions
87
88 //- Return "options" sub-dictionary (if present) or return dict
89 static const dictionary& optionsDict(const dictionary& dict);
90
91 //- Read options dictionary
92 bool readOptions(const dictionary& dict);
93
94 //- Check that all sources have been applied
95 void checkApplied() const;
96
97 //- Return source for equation with specified name and dimensions
98 template<class Type>
100 (
102 const areaScalarField& h,
103 const word& fieldName,
104 const dimensionSet& ds
105 );
106
107 //- No copy construct
108 optionList(const optionList&) = delete;
109
110 //- No copy assignment
111 void operator=(const optionList&) = delete;
112
113
114public:
115
116 //- Runtime type information
117 TypeName("optionList");
118
119
120 // Constructors
121
122 //- Default construct from patch
123 explicit optionList(const fvPatch& p);
124
125 //- Construct from patch and dictionary
126 optionList(const fvPatch& p, const dictionary&);
127
128
129 //- Destructor
130 virtual ~optionList() = default;
131
132
133 // Member Functions
134
135 //- Reset the source list
136 void reset(const dictionary& dict);
137
138 //- Return whether there is something to apply to the field
139 bool appliesToField(const word& fieldName) const;
140
141
142 // Sources
143
144 //- Return source for equation
145 template<class Type>
147 (
148 const areaScalarField& h,
150 );
151
152 //- Return source for equation with specified name
153 template<class Type>
155 (
156 const areaScalarField& h,
158 const word& fieldName
159 );
160
161 //- Return source for equation
162 template<class Type>
164 (
165 const areaScalarField& h,
166 const areaScalarField& rho,
168 );
169
170 //- Return source for equation with specified name
171 template<class Type>
173 (
174 const areaScalarField& h,
175 const areaScalarField& rho,
177 const word& fieldName
178 );
179
180
181 //- Return source for equation with specified name and dimensios
182 template<class Type>
184 (
185 const areaScalarField& rho,
187 const dimensionSet& ds
188 );
189
190
191 //- Return source for equation with second time derivative
192 template<class Type>
194 (
196 );
197
198 //- Return source for equation with second time derivative
199 template<class Type>
201 (
203 const word& fieldName
204 );
205
206
207 // Constraints
208
209 //- Apply constraints to equation
210 template<class Type>
211 void constrain(faMatrix<Type>& eqn);
212
213
214 // Correction
215
216 //- Apply correction to field
217 template<class Type>
219
220
221 // IO
222
223 //- Read dictionary
224 virtual bool read(const dictionary& dict);
225
226 //- Write data to Ostream
227 virtual bool writeData(Ostream& os) const;
228
229 //- Ostream operator
230 friend Ostream& operator<<
231 (
232 Ostream& os,
233 const optionList& options
234 );
235};
236
237
238// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239
240} // End namespace fa
241} // End namespace Foam
242
243// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244
245#ifdef NoRepository
246 #include "faOptionListTemplates.C"
247#endif
248
249// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250
251#endif
252
253// ************************************************************************* //
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
friend Ostream & operator(Ostream &os, const UPtrList< T > &list)
Write UPtrList to Ostream.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:109
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition: faMatrix.H:76
List of finite volume options.
Definition: faOptionList.H:70
void reset(const dictionary &dict)
Reset the source list.
Definition: faOptionList.C:108
const fvMesh & mesh_
Reference to the mesh database.
Definition: faOptionList.H:76
virtual ~optionList()=default
Destructor.
virtual bool writeData(Ostream &os) const
Write data to Ostream.
Definition: faOptionList.C:162
void checkApplied() const
Check that all sources have been applied.
Definition: faOptionList.C:68
void constrain(faMatrix< Type > &eqn)
Apply constraints to equation.
bool readOptions(const dictionary &dict)
Read options dictionary.
Definition: faOptionList.C:54
tmp< faMatrix< Type > > d2dt2(GeometricField< Type, faPatchField, areaMesh > &field, const word &fieldName)
Return source for equation with second time derivative.
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: faOptionList.C:156
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.
tmp< faMatrix< Type > > d2dt2(GeometricField< Type, faPatchField, areaMesh > &field)
Return source for equation with second time derivative.
void operator=(const optionList &)=delete
No copy assignment.
TypeName("optionList")
Runtime type information.
label checkTimeIndex_
Time index to check that all defined sources have been applied.
Definition: faOptionList.H:82
const fvPatch & patch_
Reference to the patch.
Definition: faOptionList.H:79
optionList(const optionList &)=delete
No copy construct.
bool appliesToField(const word &fieldName) const
Return whether there is something to apply to the field.
Definition: faOptionList.C:140
static const dictionary & optionsDict(const dictionary &dict)
Return "options" sub-dictionary (if present) or return dict.
Definition: faOptionList.C:44
Finite-area options.
Definition: faOptions.H:58
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
thermo correct()
rDeltaTY field()
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
dictionary dict
volScalarField & h
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73