porosityModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2024 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 "fvMatricesFwd.H"
41 #include "coordinateSystem.H"
42 #include "dimensionedVector.H"
43 #include "wordRe.H"
44 #include "runTimeSelectionTables.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class porosityModel Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class porosityModel
56 :
57  public regIOobject
58 {
59  // Private Member Functions
60 
61  //- Disallow default bitwise copy construction
62  porosityModel(const porosityModel&) = delete;
63 
64  //- Disallow default bitwise assignment
65  void operator=(const porosityModel&) = delete;
66 
67 
68 protected:
69 
70  // Protected data
71 
72  //- Porosity name
73  word name_;
74 
75  //- Reference to the mesh database
76  const fvMesh& mesh_;
77 
78  //- Name of cellZone
80 
81  //- Local co-ordinate system
83 
84 
85  // Protected Member Functions
86 
87  //- Transform the model data wrt mesh changes
88  virtual void calcTransformModelData() = 0;
89 
90  //- Adjust negative resistance values to be multiplier of max value
92 
93  //- Calculate the porosity force
94  virtual void calcForce
95  (
96  const volVectorField& U,
97  const volScalarField& rho,
98  const volScalarField& mu,
100  ) const = 0;
101 
102  virtual void correct(fvVectorMatrix& UEqn) const = 0;
103 
104  virtual void correct
105  (
106  const fvVectorMatrix& UEqn,
107  volTensorField& AU
108  ) const = 0;
109 
110  //- Return label index
111  label fieldIndex(const label index) const;
112 
113 
114 public:
115 
116  //- Runtime type information
117  TypeName("porosityModel");
118 
119  //- Selection table
121  (
122  autoPtr,
124  mesh,
125  (
126  const word& name,
127  const fvMesh& mesh,
128  const dictionary& dict,
129  const dictionary& coeffDict,
130  const word& cellZoneName
131  ),
132  (name, mesh, dict, coeffDict, cellZoneName)
133  );
134 
135  //- Constructor
137  (
138  const word& name,
139  const fvMesh& mesh,
140  const dictionary& dict,
141  const dictionary& coeffDict,
142  const word& cellZoneName = word::null
143  );
144 
145 
146  //- Selector
148  (
149  const word& name,
150  const fvMesh& mesh,
151  const dictionary& dict,
152  const word& cellZoneName = word::null
153  );
154 
155  //- Destructor
156  virtual ~porosityModel();
157 
158 
159  // Member Functions
160 
161  //- Return const access to the porosity model name
162  inline const word& name() const;
163 
164  //- Return const access to the cell zone name
165  inline const word& zoneName() const;
166 
167  //- Return the force over the cell zone(s)
168  virtual tmp<vectorField> force
169  (
170  const volVectorField& U,
171  const volScalarField& rho,
172  const volScalarField& mu
173  ) const;
174 
175  //- Add resistance
176  virtual void addResistance(fvVectorMatrix& UEqn);
177 
178  //- Add resistance
179  virtual void addResistance
180  (
181  const fvVectorMatrix& UEqn,
182  volTensorField& AU,
183  bool correctAUprocBC
184  );
185 
186 
187  // Mesh changes
188 
189  //- Update for mesh motion
190  virtual bool movePoints();
191 
192  //- Update topology using the given map
193  virtual void topoChange(const polyTopoChangeMap&);
194 
195  //- Update from another mesh using the given map
196  virtual void mapMesh(const polyMeshMap&);
197 
198  //- Redistribute or update using the given distribution map
199  virtual void distribute(const polyDistributionMap&);
200 
201 
202  // I-O
203 
204  //- Write
205  virtual bool writeData(Ostream& os) const
206  {
207  return true;
208  }
209 
210  //- Inherit read from regIOobject
211  using regIOobject::read;
212 
213  //- Read porosity dictionary
214  virtual bool read(const dictionary& dict);
215 };
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #include "porosityModelI.H"
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base class for other coordinate system specifications.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Top level model for porosity models.
Definition: porosityModel.H:57
virtual void addResistance(fvVectorMatrix &UEqn)
Add resistance.
virtual bool movePoints()
Update for mesh motion.
virtual void calcTransformModelData()=0
Transform the model data wrt mesh changes.
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const =0
Calculate the porosity force.
const fvMesh & mesh_
Reference to the mesh database.
Definition: porosityModel.H:75
declareRunTimeSelectionTable(autoPtr, porosityModel, mesh,(const word &name, const fvMesh &mesh, const dictionary &dict, const dictionary &coeffDict, const word &cellZoneName),(name, mesh, dict, coeffDict, cellZoneName))
Selection table.
const word & zoneName() const
Return const access to the cell zone name.
virtual ~porosityModel()
Destructor.
word zoneName_
Name of cellZone.
Definition: porosityModel.H:78
word name_
Porosity name.
Definition: porosityModel.H:72
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
TypeName("porosityModel")
Runtime type information.
virtual bool writeData(Ostream &os) const
Write.
coordinateSystem coordSys_
Local co-ordinate system.
Definition: porosityModel.H:81
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
static autoPtr< porosityModel > New(const word &name, const fvMesh &mesh, const dictionary &dict, const word &cellZoneName=word::null)
Selector.
virtual void correct(fvVectorMatrix &UEqn) const =0
void adjustNegativeResistance(dimensionedVector &resist)
Adjust negative resistance values to be multiplier of max value.
Definition: porosityModel.C:40
const word & name() const
Return const access to the porosity model name.
virtual tmp< vectorField > force(const volVectorField &U, const volScalarField &rho, const volScalarField &mu) const
Return the force over the cell zone(s)
virtual bool read()
Inherit read from regIOobject.
label fieldIndex(const label index) const
Return label index.
Definition: porosityModel.C:66
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
virtual bool read()
Read object.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
static const word null
An empty word.
Definition: word.H:77
fvVectorMatrix & UEqn
Definition: UEqn.H:11
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Forward declarations of fvMatrix specialisations.
U
Definition: pEqn.H:72
const dimensionedScalar mu
Atomic mass unit.
Namespace for OpenFOAM.
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
Macros to ease declaration of run-time selection tables.
dictionary dict