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  // Private Member Functions
93 
94  //- Construct region mesh and fields
95  void constructMeshObjects();
96 
97  //- Initialise the region
98  void initialise();
99 
100 
101 protected:
102 
103  // Protected Data
104 
105  //- Reference to the primary mesh database
106  const fvMesh& primaryMesh_;
107 
108  //- Reference to fvPatch
109  const fvPatch& patch_;
110 
111  //- Reference to the time database
112  const Time& time_;
113 
114  //- Active flag
115  Switch active_;
116 
117  //- Active information output
119 
120  //- Model name
121  const word modelName_;
122 
123  //- Pointer to the region mesh database
125 
126  //- Model coefficients dictionary
128 
129  //-Volume-to surface mapping
131 
132 
133  // Addressing
134 
135  //- Patch IDs on the primary region coupled to this region
136  label patchID_;
137 
138 
139  //- Region name
141 
142 
143  // Protected Member Functions
144 
145  //- Read control parameters from dictionary
146  virtual bool read(const dictionary& dict);
147 
148 
149 public:
150 
151  //- Runtime type information
152  TypeName("regionFaModel");
153 
154 
155  // Constructors
156 
157  //- Construct from mesh and name and dict
159  (
160  const fvPatch& patch,
161  const word& regionType,
162  const word& modelName,
163  const dictionary& dict,
164  bool readFields = true
165  );
166 
167  //- No copy construct
168  regionFaModel(const regionFaModel&) = delete;
169 
170  //- No copy assignment
171  void operator=(const regionFaModel&) = delete;
172 
173 
174  //- Destructor
175  virtual ~regionFaModel() = default;
176 
177 
178  // Member Functions
179 
180  // Access
181 
182  //- Return the reference to the primary mesh database
183  inline const fvMesh& primaryMesh() const;
184 
185  //- Return the reference to the time database
186  inline const Time& time() const;
187 
188  //- Return the active flag
189  inline const Switch& active() const;
190 
191  //- Return the information flag
192  inline const Switch& infoOutput() const;
193 
194  //- Return the model name
195  inline const word& modelName() const;
196 
197  //- Return the region mesh database
198  inline const faMesh& regionMesh() const;
199 
200  //- Return the region mesh database for manipulation
201  inline faMesh& regionMesh();
202 
203  //- Return the model coefficients dictionary
204  inline const dictionary& coeffs() const;
205 
206  //- Return the solution dictionary
207  inline const dictionary& solution() const;
208 
209  //- Return volSurfaceMapping
210  const volSurfaceMapping& vsm() const;
211 
212 
213  // Addressing
214 
215  //- Return the list of patch IDs on the primary region coupled
216  //- to this region
217  inline label patchID();
218 
219 
220  // Evolution
221 
222  //- Main driver routing to evolve the region - calls other evolves
223  virtual void evolve();
224 
225  //- Pre-evolve region
226  virtual void preEvolveRegion();
227 
228  //- Evolve the region
229  virtual void evolveRegion();
230 
231  //- Post-evolve region
232  virtual void postEvolveRegion();
233 
234 
235  // IO
236 
237  //- Provide some feedback
238  virtual void info();
239 };
240 
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 } // End namespace regionFaModels
245 } // End namespace Foam
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #include "regionFaModelI.H"
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 
254 #endif
255 
256 // ************************************************************************* //
Foam::regionModels::regionFaModel::solution
const dictionary & solution() const
Return the solution dictionary.
Definition: regionFaModelI.H:106
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:62
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:147
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:138
Foam::regionModels::regionFaModel::patchID_
label patchID_
Patch IDs on the primary region coupled to this region.
Definition: regionFaModel.H:159
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:97
Foam::regionModels::regionFaModel::vsm
const volSurfaceMapping & vsm() const
Return volSurfaceMapping.
Definition: regionFaModel.C:88
Foam::regionModels::regionFaModel::coeffs_
dictionary coeffs_
Model coefficients dictionary.
Definition: regionFaModel.H:150
Foam::regionModels::regionFaModel::modelName_
const word modelName_
Model name.
Definition: regionFaModel.H:144
labelList.H
Foam::regionModels::regionFaModel::vsmPtr_
autoPtr< volSurfaceMapping > vsmPtr_
Volume-to surface mapping.
Definition: regionFaModel.H:153
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:164
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:121
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
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:156
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:160
Foam::regionModels::regionFaModel::time_
const Time & time_
Reference to the time database.
Definition: regionFaModel.H:135
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:141
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:56
Foam::regionModels::regionFaModel::read
virtual bool read(const dictionary &dict)
Read control parameters from dictionary.
Definition: regionFaModel.C:68
Foam::regionModels::regionFaModel
Base class for area region models.
Definition: regionFaModel.H:113
Foam::regionModels::regionFaModel::patchID
label patchID()
Definition: regionFaModelI.H:112
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:132
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:77
Foam::regionModels::regionFaModel::info
virtual void info()
Provide some feedback.
Definition: regionFaModel.C:168
Foam::regionModels::regionFaModel::regionName_
word regionName_
Region name.
Definition: regionFaModel.H:163
Foam::regionModels::regionFaModel::evolve
virtual void evolve()
Main driver routing to evolve the region - calls other evolves.
Definition: regionFaModel.C:132
Foam::regionModels::regionFaModel::primaryMesh_
const fvMesh & primaryMesh_
Reference to the primary mesh database.
Definition: regionFaModel.H:129
Foam::regionModels::regionFaModel::TypeName
TypeName("regionFaModel")
Runtime type information.
Foam::regionModels::regionFaModel::~regionFaModel
virtual ~regionFaModel()=default
Destructor.