porosityModel.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 | Copyright (C) 2012-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::porosityModel
26 
27 Description
28  Top level model for porosity models
29 
30 SourceFiles
31  porosityModel.C
32  porosityModelNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef porosityModel_H
37 #define porosityModel_H
38 
39 #include "fvMesh.H"
40 #include "dictionary.H"
41 #include "fvMatricesFwd.H"
42 #include "runTimeSelectionTables.H"
43 #include "coordinateSystem.H"
44 #include "dimensionedVector.H"
45 #include "keyType.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class porosityModel Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class porosityModel
57 :
58  public regIOobject
59 {
60  // Private Member Functions
61 
62  //- Disallow default bitwise copy construct
64 
65  //- Disallow default bitwise assignment
66  void operator=(const porosityModel&);
67 
68 
69 protected:
70 
71  // Protected data
72 
73  //- Porosity name
74  word name_;
75 
76  //- Reference to the mesh database
77  const fvMesh& mesh_;
78 
79  //- Dictionary used for model construction
80  const dictionary dict_;
81 
82  //- Model coefficients dictionary
84 
85  //- Porosity active flag
86  bool active_;
87 
88  //- Name(s) of cell-zone
90 
91  //- Cell zone IDs
93 
94  //- Local co-ordinate system
96 
97 
98  // Protected Member Functions
99 
100 
101  //- Transform the model data wrt mesh changes
102  virtual void calcTransformModelData() = 0;
103 
104  //- Adjust negative resistance values to be multiplier of max value
106 
107  //- Calculate the porosity force
108  virtual void calcForce
109  (
110  const volVectorField& U,
111  const volScalarField& rho,
112  const volScalarField& mu,
114  ) const = 0;
115 
116  virtual void correct(fvVectorMatrix& UEqn) const = 0;
117 
118  virtual void correct
119  (
121  const volScalarField& rho,
122  const volScalarField& mu
123  ) const = 0;
124 
125  virtual void correct
126  (
127  const fvVectorMatrix& UEqn,
128  volTensorField& AU
129  ) const = 0;
130 
131  //- Return label index
132  label fieldIndex(const label index) const;
133 
134 
135 public:
136 
137  //- Runtime type information
138  TypeName("porosityModel");
139 
140  //- Selection table
142  (
143  autoPtr,
145  mesh,
146  (
147  const word& modelName,
148  const word& name,
149  const fvMesh& mesh,
150  const dictionary& dict,
151  const word& cellZoneName
152  ),
153  (modelName, name, mesh, dict, cellZoneName)
154  );
155 
156  //- Constructor
158  (
159  const word& name,
160  const word& modelType,
161  const fvMesh& mesh,
162  const dictionary& dict,
163  const word& cellZoneName = word::null
164  );
165 
166  //- Return pointer to new porosityModel object created on the freestore
167  // from an Istream
168  class iNew
169  {
170  //- Reference to the mesh database
171  const fvMesh& mesh_;
172  const word& name_;
173 
174  public:
175 
177  (
178  const fvMesh& mesh,
179  const word& name
180  )
181  :
182  mesh_(mesh),
183  name_(name)
184  {}
187  {
188  const dictionary dict(is);
189 
191  (
193  (
194  name_,
195  mesh_,
196  dict
197  )
198  );
199  }
200  };
201 
202  //- Selector
204  (
205  const word& name,
206  const fvMesh& mesh,
207  const dictionary& dict,
208  const word& cellZoneName = word::null
209  );
210 
211  //- Destructor
212  virtual ~porosityModel();
213 
214 
215  // Member Functions
216 
217  //- Return const access to the porosity model name
218  inline const word& name() const;
219 
220  //- Return const access to the porosity active flag
221  inline bool active() const;
222 
223  //- Return const access to the cell zone IDs
224  inline const labelList& cellZoneIDs() const;
225 
226  //- Transform the model data wrt mesh changes
227  virtual void transformModelData();
228 
229  //- Return the force over the cell zone(s)
230  virtual tmp<vectorField> force
231  (
232  const volVectorField& U,
233  const volScalarField& rho,
234  const volScalarField& mu
235  );
236 
237  //- Add resistance
238  virtual void addResistance(fvVectorMatrix& UEqn);
239 
240  //- Add resistance
241  virtual void addResistance
242  (
243  fvVectorMatrix& UEqn,
244  const volScalarField& rho,
245  const volScalarField& mu
246  );
247 
248  //- Add resistance
249  virtual void addResistance
250  (
251  const fvVectorMatrix& UEqn,
252  volTensorField& AU,
253  bool correctAUprocBC
254  );
255 
256 
257  // I-O
258 
259  //- Write
260  virtual bool writeData(Ostream& os) const;
261 
262  //- Inherit read from regIOobject
263  using regIOobject::read;
264 
265  //- Read porosity dictionary
266  virtual bool read(const dictionary& dict);
267 };
268 
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 } // End namespace Foam
273 
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 
276 #include "porosityModelI.H"
277 
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279 
280 #endif
281 
282 // ************************************************************************* //
Base class for other coordinate system specifications.
A class for handling keywords in dictionaries.
Definition: keyType.H:64
dictionary dict
U
Definition: pEqn.H:83
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual bool writeData(Ostream &os) const
Write.
virtual bool read()
Read object.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
coordinateSystem coordSys_
Local co-ordinate system.
Definition: porosityModel.H:94
dictionary coeffs_
Model coefficients dictionary.
Definition: porosityModel.H:82
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual tmp< vectorField > force(const volVectorField &U, const volScalarField &rho, const volScalarField &mu)
Return the force over the cell zone(s)
declareRunTimeSelectionTable(autoPtr, porosityModel, mesh,(const word &modelName, const word &name, const fvMesh &mesh, const dictionary &dict, const word &cellZoneName),(modelName, name, mesh, dict, cellZoneName))
Selection table.
iNew(const fvMesh &mesh, const word &name)
const labelList & cellZoneIDs() const
Return const access to the cell zone IDs.
bool active_
Porosity active flag.
Definition: porosityModel.H:85
bool active() const
Return const access to the porosity active flag.
TypeName("porosityModel")
Runtime type information.
label fieldIndex(const label index) const
Return label index.
Definition: porosityModel.C:64
autoPtr< porosityModel > operator()(Istream &is) const
word name_
Porosity name.
Definition: porosityModel.H:73
void adjustNegativeResistance(dimensionedVector &resist)
Adjust negative resistance values to be multiplier of max value.
Definition: porosityModel.C:40
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
static const word null
An empty word.
Definition: word.H:77
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
virtual void correct(fvVectorMatrix &UEqn) const =0
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const fvMesh & mesh_
Reference to the mesh database.
Definition: porosityModel.H:76
virtual void transformModelData()
Transform the model data wrt mesh changes.
labelList cellZoneIDs_
Cell zone IDs.
Definition: porosityModel.H:91
Return pointer to new porosityModel object created on the freestore.
const dictionary dict_
Dictionary used for model construction.
Definition: porosityModel.H:79
const dimensionedScalar mu
Atomic mass unit.
virtual ~porosityModel()
Destructor.
Forward declarations of fvMatrix specializations.
keyType zoneName_
Name(s) of cell-zone.
Definition: porosityModel.H:88
const word & name() const
Return const access to the porosity model name.
fvVectorMatrix & UEqn
Definition: UEqn.H:13
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:65
virtual void calcTransformModelData()=0
Transform the model data wrt mesh changes.
static autoPtr< porosityModel > New(const word &name, const fvMesh &mesh, const dictionary &dict, const word &cellZoneName=word::null)
Selector.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void addResistance(fvVectorMatrix &UEqn)
Add resistance.
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const =0
Calculate the porosity force.
Top level model for porosity models.
Definition: porosityModel.H:55
Namespace for OpenFOAM.