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-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::regionModels::regionFaModel
28 
29 Description
30  Base class for area region models.
31 
32 Usage
33  Example of the model specification:
34  \verbatim
35  <patchName>
36  {
37  // Mandatory entries (runtime modifiable)
38  region <regionName>;
39  active true;
40 
41  // Optional entries (runtime modifiable)
42  infoOutput false;
43  <model>Coeffs
44  {
45  // subdictionary entries
46  }
47 
48  // Mandatory/Optional (derived) entries
49  ...
50  }
51  \endverbatim
52 
53  where the entries mean:
54  \table
55  Property | Description | Type | Reqd | Dflt
56  region | Name of operand region | word | yes | -
57  active | Flag to activate the model | bool | yes | -
58  infoOutput | Flag to activate information output | bool | no | false
59  \endtable
60 
61 SourceFiles
62  regionFaModelI.H
63  regionFaModel.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef regionFaModel_H
68 #define regionFaModel_H
69 
70 #include "volMesh.H"
71 #include "IOdictionary.H"
72 #include "Switch.H"
73 #include "labelList.H"
74 #include "areaFields.H"
75 #include "faMesh.H"
76 #include "volSurfaceMapping.H"
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 namespace Foam
81 {
82 
83 namespace regionModels
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class regionFaModel Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 class regionFaModel
91 :
92  public IOdictionary
93 {
94  // Private Member Functions
95 
96  //- Construct region mesh and fields
97  void constructMeshObjects();
98 
99  //- Initialise the region
100  void initialise();
101 
102  //- Read control parameters from dictionary
103  bool init(const dictionary& dict);
104 
105 
106 protected:
107 
108  // Protected Data
109 
110  //- Reference to the primary mesh database
111  const fvMesh& primaryMesh_;
112 
113  //- Reference to fvPatch
114  const fvPatch& patch_;
115 
116  //- Reference to the time database
117  const Time& time_;
118 
119  //- Active flag
120  Switch active_;
121 
122  //- Active information output
124 
125  //- Model name
126  const word modelName_;
127 
128  //- Pointer to the region mesh database
130 
131  //- Model coefficients dictionary
133 
134  //- Dictionary of output properties
136 
137  //-Volume-to surface mapping
139 
140 
141  // Addressing
142 
143  //- Patch IDs on the primary region coupled to this region
144  label patchID_;
145 
146 
147  //- Region name
149 
150 
151 public:
152 
153  //- Runtime type information
154  TypeName("regionFaModel");
155 
156 
157  //- Default name regionFaModel
158  static const word regionFaModelName;
159 
160  // Constructors
161 
162  //- Construct from mesh and name and dict
164  (
165  const fvPatch& patch,
166  const word& regionType,
167  const word& modelName,
168  const dictionary& dict,
169  bool readFields = true
170  );
171 
172  //- No copy construct
173  regionFaModel(const regionFaModel&) = delete;
174 
175  //- No copy assignment
176  void operator=(const regionFaModel&) = delete;
177 
178 
179  //- Destructor
180  virtual ~regionFaModel() = default;
181 
182 
183  // Member Functions
184 
185  // Access
186 
187  //- Return the reference to the primary mesh database
188  inline const fvMesh& primaryMesh() const;
189 
190  //- Return the reference to the time database
191  inline const Time& time() const;
192 
193  //- Return the active flag
194  inline const Switch& active() const;
195 
196  //- Return the information flag
197  inline const Switch& infoOutput() const;
198 
199  //- Return the model name
200  inline const word& modelName() const;
201 
202  //- Return the region mesh database
203  inline const faMesh& regionMesh() const;
204 
205  //- Return the region mesh database for manipulation
206  inline faMesh& regionMesh();
207 
208  //- Return the model coefficients dictionary
209  inline const dictionary& coeffs() const;
210 
211  //- Return const access to the output properties dictionary
212  inline const IOdictionary& outputProperties() const;
213 
214  //- Return output properties dictionary
215  inline IOdictionary& outputProperties();
216 
217  //- Return the solution dictionary
218  inline const dictionary& solution() const;
219 
220  //- Return patch ID
221  inline label patchID() const;
222 
223 
224  // Help Functions
225 
226  //- Return mapping between surface and volume fields
227  const volSurfaceMapping& vsm() const;
228 
229 
230  // Evolution
231 
232  //- Main driver routing to evolve the region - calls other evolves
233  virtual void evolve();
234 
235  //- Pre-evolve region
236  virtual void preEvolveRegion();
237 
238  //- Evolve the region
239  virtual void evolveRegion();
240 
241  //- Post-evolve region
242  virtual void postEvolveRegion();
243 
244  //- Courant number of the region
245  virtual scalar CourantNumber() const;
246 
247 
248  // IO
249 
250  //- Provide some feedback
251  virtual void info() = 0;
252 };
253 
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 } // End namespace regionFaModels
258 } // End namespace Foam
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 #include "regionFaModelI.H"
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 
267 #endif
268 
269 // ************************************************************************* //
Foam::regionModels::regionFaModel::solution
const dictionary & solution() const
Return the solution dictionary.
Definition: regionFaModelI.H:132
Foam::regionModels::regionFaModel::regionFaModelName
static const word regionFaModelName
Default name regionFaModel.
Definition: regionFaModel.H:181
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::regionModels::regionFaModel::primaryMesh
const fvMesh & primaryMesh() const
Return the reference to the primary mesh database.
Definition: regionFaModelI.H:33
Foam::regionModels::regionFaModel::regionMeshPtr_
autoPtr< faMesh > regionMeshPtr_
Pointer to the region mesh database.
Definition: regionFaModel.H:152
Foam::dictionary::dictionary
dictionary()
Default construct, a top-level empty dictionary.
Definition: dictionary.C:75
volMesh.H
Foam::regionModels::regionFaModel::infoOutput
const Switch & infoOutput() const
Return the information flag.
Definition: regionFaModelI.H:51
Foam::regionModels::regionFaModel::active_
Switch active_
Active flag.
Definition: regionFaModel.H:143
Foam::regionModels::regionFaModel::patchID_
label patchID_
Patch IDs on the primary region coupled to this region.
Definition: regionFaModel.H:167
Foam::regionModels::regionFaModel::CourantNumber
virtual scalar CourantNumber() const
Courant number of the region.
Definition: regionFaModel.C:199
faMesh.H
Foam::regionModels::regionFaModel::regionFaModel
regionFaModel(const fvPatch &patch, const word &regionType, const word &modelName, const dictionary &dict, bool readFields=true)
Construct from mesh and name and dict.
Definition: regionFaModel.C:119
Foam::regionModels::regionFaModel::vsm
const volSurfaceMapping & vsm() const
Return mapping between surface and volume fields.
Definition: regionFaModel.C:110
Foam::regionModels::regionFaModel::coeffs_
dictionary coeffs_
Model coefficients dictionary.
Definition: regionFaModel.H:155
Foam::regionModels::regionFaModel::modelName_
const word modelName_
Model name.
Definition: regionFaModel.H:149
labelList.H
Foam::regionModels::regionFaModel::info
virtual void info()=0
Provide some feedback.
Foam::regionModels::regionFaModel::vsmPtr_
autoPtr< volSurfaceMapping > vsmPtr_
Volume-to surface mapping.
Definition: regionFaModel.H:161
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Switch.H
Foam::regionModels::regionFaModel::postEvolveRegion
virtual void postEvolveRegion()
Post-evolve region.
Definition: regionFaModel.C:195
Foam::regionModels::regionFaModel::active
const Switch & active() const
Return the active flag.
Definition: regionFaModelI.H:45
Foam::regionModels::regionFaModel::coeffs
const dictionary & coeffs() const
Return the model coefficients dictionary.
Definition: regionFaModelI.H:99
areaFields.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::regionModels::regionFaModel::regionMesh
const faMesh & regionMesh() const
Return the region mesh database.
Definition: regionFaModelI.H:63
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::regionModels::regionFaModel::time
const Time & time() const
Return the reference to the time database.
Definition: regionFaModelI.H:39
Foam::regionModels::regionFaModel::preEvolveRegion
virtual void preEvolveRegion()
Pre-evolve region.
Definition: regionFaModel.C:187
Foam::readFields
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Definition: ReadFieldsTemplates.C:312
regionFaModelI.H
Foam::regionModels::regionFaModel::evolveRegion
virtual void evolveRegion()
Evolve the region.
Definition: regionFaModel.C:191
Foam::regionModels::regionFaModel::time_
const Time & time_
Reference to the time database.
Definition: regionFaModel.H:140
IOdictionary.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
volSurfaceMapping.H
Foam::regionModels::regionFaModel::infoOutput_
Switch infoOutput_
Active information output.
Definition: regionFaModel.H:146
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::volSurfaceMapping
Volume to surface and surface to volume mapping.
Definition: volSurfaceMapping.H:57
Foam::regionModels::regionFaModel
Base class for area region models.
Definition: regionFaModel.H:113
Foam::regionModels::regionFaModel::patchID
label patchID() const
Return patch ID.
Definition: regionFaModelI.H:138
Foam::regionModels::regionFaModel::modelName
const word & modelName() const
Return the model name.
Definition: regionFaModelI.H:57
Foam::regionModels::regionFaModel::patch_
const fvPatch & patch_
Reference to fvPatch.
Definition: regionFaModel.H:137
Foam::regionModels::regionFaModel::operator=
void operator=(const regionFaModel &)=delete
No copy assignment.
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::regionModels::regionFaModel::outputProperties
const IOdictionary & outputProperties() const
Return const access to the output properties dictionary.
Definition: regionFaModelI.H:105
Foam::regionModels::regionFaModel::outputPropertiesPtr_
autoPtr< IOdictionary > outputPropertiesPtr_
Dictionary of output properties.
Definition: regionFaModel.H:158
Foam::regionModels::regionFaModel::regionName_
word regionName_
Region name.
Definition: regionFaModel.H:171
Foam::regionModels::regionFaModel::evolve
virtual void evolve()
Main driver routing to evolve the region - calls other evolves.
Definition: regionFaModel.C:163
Foam::regionModels::regionFaModel::primaryMesh_
const fvMesh & primaryMesh_
Reference to the primary mesh database.
Definition: regionFaModel.H:134
Foam::regionModels::regionFaModel::TypeName
TypeName("regionFaModel")
Runtime type information.
Foam::regionModels::regionFaModel::~regionFaModel
virtual ~regionFaModel()=default
Destructor.