Loading...
Searching...
No Matches
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-2025 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-area options
31
32SourceFile
33 faOptionList.cxx
34 faOptionList.txx
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_faOptionList_H
39#define Foam_faOptionList_H
40
41#include "faOption.H"
42#include "PtrList.H"
43#include "GeometricField.H"
44#include "geometricOneField.H"
45#include "faPatchField.H"
46#include "fvMesh.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53// Forward Declarations
54
55namespace fa
56{
57 class optionList;
58}
59
60Ostream& operator<<(Ostream& os, const fa::optionList& options);
61
62namespace fa
63{
64
65/*---------------------------------------------------------------------------*\
66 Class optionList Declaration
67\*---------------------------------------------------------------------------*/
68
69class optionList
70:
71 public PtrList<fa::option>
72{
73protected:
74
75 // Protected Data
76
77 //- Reference to the mesh database
78 const fvMesh& mesh_;
79
80 //- The finite-area mesh name
82
83 //- Time index to check that all defined sources have been applied
84 label checkTimeIndex_;
85
86
87 // Protected Member Functions
88
89 //- Return "options" sub-dictionary (if present) or return dict
90 static const dictionary& optionsDict(const dictionary& dict);
92 //- Read options dictionary
93 bool readOptions(const dictionary& dict);
94
95 //- Check that all sources have been applied
96 void checkApplied() const;
97
98 //- Return source for equation with specified name and dimensions
99 template<class Type>
103 const areaScalarField& h,
104 const word& fieldName,
105 const dimensionSet& ds
106 );
108public:
109
110 //- Runtime type information
111 TypeName("optionList");
112
113
114 // Constructors
115
116 //- Default construct from mesh
117 explicit optionList
118 (
119 const fvMesh& mesh,
121 const word& defaultAreaName = word()
122 );
123
124 //- Construct from mesh and dictionary
126 (
127 const fvMesh& mesh,
130 const word& defaultAreaName = word()
131 );
132
133 //- No copy construct
134 optionList(const optionList&) = delete;
135
136 //- No copy assignment
137 void operator=(const optionList&) = delete;
139
140 //- Destructor
141 virtual ~optionList() = default;
142
143
144 // Member Functions
145
146 //- The finite-area mesh name
147 const word& areaName() const noexcept { return areaName_; }
148
149 //- Reset the source list
150 void reset(const dictionary& dict);
151
152 //- Return whether there is something to apply to the field
153 bool appliesToField(const word& fieldName) const;
155
156 // Sources
157
158 //- Return source for equation
159 template<class Type>
161 (
162 const areaScalarField& h,
164 );
165
166 //- Return source for equation with specified name
167 template<class Type>
169 (
170 const areaScalarField& h,
172 const word& fieldName
173 );
174
175 //- Return source for equation
176 template<class Type>
177 tmp<faMatrix<Type>> operator()
179 const areaScalarField& h,
180 const areaScalarField& rho,
182 );
183
184 //- Return source for equation with specified name
185 template<class Type>
186 tmp<faMatrix<Type>> operator()
188 const areaScalarField& h,
189 const areaScalarField& rho,
191 const word& fieldName
192 );
193
194
195 //- Return source for equation with specified name and dimensios
196 template<class Type>
198 (
199 const areaScalarField& rho,
201 const dimensionSet& ds
202 );
203
204
205 //- Return source for equation with second time derivative
206 template<class Type>
210 );
211
212 //- Return source for equation with second time derivative
213 template<class Type>
215 (
217 const word& fieldName
218 );
220
221 // Constraints
222
223 //- Apply constraints to equation
224 template<class Type>
225 void constrain(faMatrix<Type>& eqn);
226
227
228 // Correction
229
230 //- Apply correction to field
231 template<class Type>
233
234
235 // IO
236
237 //- Read dictionary
238 virtual bool read(const dictionary& dict);
239
240 //- Write data to Ostream
241 virtual bool writeData(Ostream& os) const;
242
243 //- Ostream operator
244 friend Ostream& operator<<
245 (
246 Ostream& os,
247 const optionList& options
248 );
249};
250
251
252// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254} // End namespace fa
255} // End namespace Foam
256
257// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258
259#ifdef NoRepository
260 #include "faOptionList.txx"
261#endif
262
263// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264
265#endif
267// ************************************************************************* //
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
constexpr PtrList() noexcept
Definition PtrListI.H:29
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition faMatrix.H:108
List of finite-area options.
void reset(const dictionary &dict)
Reset the source list.
virtual bool read(const dictionary &dict)
Read dictionary.
word areaName_
The finite-area mesh name.
const fvMesh & mesh_
Reference to the mesh database.
void correct(GeometricField< Type, faPatchField, areaMesh > &field)
Apply correction to field.
virtual ~optionList()=default
Destructor.
optionList(const fvMesh &mesh, const word &defaultAreaName=word())
Default construct from mesh.
void checkApplied() const
Check that all sources have been applied.
const word & areaName() const noexcept
The finite-area mesh name.
void constrain(faMatrix< Type > &eqn)
Apply constraints to equation.
bool readOptions(const dictionary &dict)
Read options dictionary.
tmp< faMatrix< Type > > d2dt2(GeometricField< Type, faPatchField, areaMesh > &field, const word &fieldName)
Return source for equation with second time derivative.
virtual bool writeData(Ostream &os) const
Write data to Ostream.
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.
optionList(const optionList &)=delete
No copy construct.
optionList(const fvMesh &mesh, const dictionary &dict, const word &defaultAreaName=word())
Construct from mesh and dictionary.
bool appliesToField(const word &fieldName) const
Return whether there is something to apply to the field.
static const dictionary & optionsDict(const dictionary &dict)
Return "options" sub-dictionary (if present) or return dict.
Finite-area options, which is an IOdictionary of values and a fa::optionList.
Definition faOptions.H:73
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
thermo correct()
rDeltaTY field()
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
Namespace for finite-area.
Definition limitHeight.C:30
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
const direction noexcept
Definition scalarImpl.H:265
dictionary dict
volScalarField & h
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68