Loading...
Searching...
No Matches
regionFaModel.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::regionModels::regionFaModel
28
29Description
30 Base class for area region models.
31
32Usage
33 Example of the model specification:
34 \verbatim
35 <patchName>
36 {
37 // Mandatory entries
38 region <word>;
39 active <bool>;
40
41 <model>Coeffs
42 {
43 // subdictionary entries
44 }
45
46 // Optional entries
47 infoOutput <bool>;
48
49 // Inherited entries
50 ...
51 }
52 \endverbatim
53
54 where the entries mean:
55 \table
56 Property | Description | Type | Reqd | Deflt
57 region | Name of operand region | word | yes | -
58 area | Name of the finite-area mesh | word | no | region0
59 active | Flag to activate the model | bool | yes | -
60 suffixing | Suffix hint for model variables | word | no | -
61 infoOutput | Flag to activate information output | bool | no | false
62 \endtable
63
64Note
65 The \c suffixing parameter is a hint that individual models may use
66 when automatically generating variable names internally. For example,
67 a model \em may provide ("T" + suffixing) and ("q" + suffixing)
68 as its default names temperature and flux fields, respectively.
69 If the user specifies \c suffixing = "_foo", those \em default names
70 would then become "T_foo" and "q_foo", respectively.
71 Suffixing (true|false|none|default|...) currently selects between
72 no suffix and ('_'+region).
73
74SourceFiles
75 regionFaModelI.H
76 regionFaModel.C
77
78\*---------------------------------------------------------------------------*/
79
80#ifndef Foam_regionFaModel_H
81#define Foam_regionFaModel_H
82
83#include "volMesh.H"
84#include "volSurfaceMapping.H"
85
86// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87
88namespace Foam
89{
90namespace regionModels
91{
92
93/*---------------------------------------------------------------------------*\
94 Class regionFaModel Declaration
95\*---------------------------------------------------------------------------*/
96
97class regionFaModel
98:
99 public IOdictionary
100{
101 // Private Member Functions
102
103 //- Construct region mesh and fields
104 void constructMeshObjects(const dictionary&);
105
106 //- Initialise the region
107 void initialise();
108
109 //- Read control parameters from dictionary
110 bool init(const dictionary& dict);
111
112
113protected:
114
115 // Protected Data
116
117 //- Reference to the primary mesh database
118 const fvMesh& primaryMesh_;
119
120 //- Reference to the time database
121 const Time& time_;
122
123 //- Active flag
124 Switch active_;
125
126 //- Active information output
127 Switch infoOutput_;
129 //- Model name
130 const word modelName_;
131
132 //- Suffix hint for automatic model variable names (default: "")
134
135 //- The finite-area mesh name (default: region0)
137
138 //- Region name
140
141 //- Model coefficients dictionary
143
144 //- Pointer to the region mesh database
146
147 //- Dictionary of output properties
149
150 //- Volume/surface mapping
152
153
154public:
155
156 //- Runtime type information
157 TypeName("regionFaModel");
158
159
160 //- Default name regionFaModel
161 static const word regionFaModelName;
163 // Constructors
164
165 //- Construct from mesh and name and dict
168 const fvMesh& mesh,
169 const word& regionType,
170 const word& modelName,
171 const dictionary& dict,
172 bool readFields = true
173 );
174
175 //- No copy construct
176 regionFaModel(const regionFaModel&) = delete;
178 //- No copy assignment
179 void operator=(const regionFaModel&) = delete;
180
181
182 //- Destructor
183 virtual ~regionFaModel() = default;
184
185
186 // Member Functions
188 // Access
189
190 //- Return the reference to the primary mesh database
191 const fvMesh& primaryMesh() const noexcept { return primaryMesh_; }
193 //- Return the reference to the time database
194 const Time& time() const noexcept { return time_; }
195
196 //- Return the active flag
197 Switch active() const noexcept { return active_; }
198
199 //- Return the information flag
200 Switch infoOutput() const noexcept { return infoOutput_; }
201
202 //- The finite-area mesh name (extracted from dictionary)
203 const word& areaName() const noexcept { return areaName_; }
204
205 //- Return the model name
206 const word& modelName() const noexcept { return modelName_; }
208 //- Return the region mesh database
209 inline const faMesh& regionMesh() const;
210
211 //- Return the region mesh database for manipulation
213
214 //- Return the model coefficients dictionary
215 const dictionary& coeffs() const noexcept { return coeffs_; }
216
217 //- Return const access to the output properties dictionary
218 inline const IOdictionary& outputProperties() const;
219
220 //- Return output properties dictionary
222
223 //- Return the solution dictionary
224 inline const dictionary& solution() const;
225
227 // Addressing
228
229 //- List of patch IDs on the primary region coupled to this region
230 inline const labelList& primaryPatchIDs() const;
231
232 //- True if patchi on the primary region is coupled to this region
233 inline bool isRegionPatch(const label patchi) const;
234
235
236 // Helper Functions
237
238 //- Return mapping between surface and volume fields
239 const volSurfaceMapping& vsm() const;
240
241 //- The suffix hint for automatic model variable names
242 const word& suffixHint() const noexcept { return suffixHint_; }
243
244 //- Return the concatenation of \p base and the suffix hint
245 inline word suffixed(const char* base) const;
246
247 //- Return the concatenation of \p base and the suffix hint
248 inline word suffixed(const std::string& base) const;
249
251 // Evolution
252
253 //- Main driver routing to evolve the region - calls other evolves
254 virtual void evolve();
255
256 //- Pre-evolve region
257 virtual void preEvolveRegion();
258
259 //- Evolve the region
260 virtual void evolveRegion();
261
262 //- Post-evolve region
263 virtual void postEvolveRegion();
264
265 //- Courant number of the region
266 virtual scalar CourantNumber() const;
267
268
269 // IO
270
271 //- Provide some feedback
272 virtual void info() = 0;
273};
274
275
276// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277
278} // End namespace regionFaModels
279} // End namespace Foam
280
281// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282
283#include "regionFaModelI.H"
284
285// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287
288#endif
289
290// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOdictionary(const IOobject &io, const dictionary *fallback=nullptr)
Construct given an IOobject and optional fallback dictionary content.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition Switch.H:81
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
dictionary()
Default construct, a top-level empty dictionary.
Definition dictionary.C:68
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition faMesh.H:140
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Base class for area region models.
autoPtr< IOdictionary > outputPropertiesPtr_
Dictionary of output properties.
virtual ~regionFaModel()=default
Destructor.
word areaName_
The finite-area mesh name (default: region0).
const Time & time_
Reference to the time database.
word suffixHint_
Suffix hint for automatic model variable names (default: "").
const word modelName_
Model name.
virtual void postEvolveRegion()
Post-evolve region.
const dictionary & solution() const
Return the solution dictionary.
Switch infoOutput_
Active information output.
word suffixed(const char *base) const
Return the concatenation of base and the suffix hint.
autoPtr< volSurfaceMapping > vsmPtr_
Volume/surface mapping.
static const word regionFaModelName
Default name regionFaModel.
const word & areaName() const noexcept
The finite-area mesh name (extracted from dictionary).
Switch active() const noexcept
Return the active flag.
virtual scalar CourantNumber() const
Courant number of the region.
const Time & time() const noexcept
Return the reference to the time database.
bool isRegionPatch(const label patchi) const
True if patchi on the primary region is coupled to this region.
dictionary coeffs_
Model coefficients dictionary.
void operator=(const regionFaModel &)=delete
No copy assignment.
Switch infoOutput() const noexcept
Return the information flag.
autoPtr< faMesh > regionMeshPtr_
Pointer to the region mesh database.
virtual void preEvolveRegion()
Pre-evolve region.
virtual void evolve()
Main driver routing to evolve the region - calls other evolves.
const fvMesh & primaryMesh_
Reference to the primary mesh database.
virtual void info()=0
Provide some feedback.
const volSurfaceMapping & vsm() const
Return mapping between surface and volume fields.
const faMesh & regionMesh() const
Return the region mesh database.
const word & suffixHint() const noexcept
The suffix hint for automatic model variable names.
const fvMesh & primaryMesh() const noexcept
Return the reference to the primary mesh database.
const IOdictionary & outputProperties() const
Return const access to the output properties dictionary.
const labelList & primaryPatchIDs() const
List of patch IDs on the primary region coupled to this region.
TypeName("regionFaModel")
Runtime type information.
regionFaModel(const fvMesh &mesh, const word &regionType, const word &modelName, const dictionary &dict, bool readFields=true)
Construct from mesh and name and dict.
const word & modelName() const noexcept
Return the model name.
regionFaModel(const regionFaModel &)=delete
No copy construct.
const dictionary & coeffs() const noexcept
Return the model coefficients dictionary.
virtual void evolveRegion()
Evolve the region.
Volume to surface and surface to volume mapping.
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
Namespace for OpenFOAM.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
List< label > labelList
A List of labels.
Definition List.H:62
const direction noexcept
Definition scalarImpl.H:265
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68