volumeBlockage.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) 2019-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::fv::volumeBlockage
26 
27 Description
28  This fvModel adds transport terms into the equations to account for the
29  presence of a constant volume fraction. The volume fraction is read from
30  constant/alpha.<volumePhase>, where <volumePhase> is given as a
31  parameter to the fvModel. Both advective and diffusive terms are added, and
32  the resulting solution is time-accurate. The flux and velocity are treated
33  as superficial.
34 
35  This can be used to represent the effect of porous media that are caused
36  purely by the reduction in volume of the fluid phase; i.e., additional
37  volumeBlockage, and changes to transport and diffusion rates. It does not
38  represent losses or transfers with the porous media. That requires separate
39  sub-modelling.
40 
41 Usage
42  \table
43  Property | Description | Req'd? | Default
44  phi | Name of the flux field | no | phi
45  rho | Name of the density field | no | rho
46  U | Name of the velocity field | no | U
47  volumePhase | Name of the phase associated with the volume fraction \\
48  | yes |
49  \endtable
50 
51  Example specification:
52  \verbatim
53  volumeBlockage1
54  {
55  type volumeBlockage;
56 
57  phi phi;
58  rho rho;
59  U U;
60 
61  volumePhase solid;
62  }
63  \endverbatim
64 
65 SourceFiles
66  volumeBlockage.C
67 
68 \*---------------------------------------------------------------------------*/
69 
70 #ifndef volumeBlockage_H
71 #define volumeBlockage_H
72 
73 #include "fvModel.H"
74 #include "surfaceFields.H"
75 #include "volFields.H"
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 namespace fv
82 {
83 
84 /*---------------------------------------------------------------------------*\
85  Class volumeBlockage Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 class volumeBlockage
89 :
90  public fvModel
91 {
92  // Private Member Data
93 
94  //- The name of the flux field
95  word phiName_;
96 
97  //- The name of the density field
98  word rhoName_;
99 
100  //- The name of the velocity field
101  word UName_;
102 
103  //- The name of the volume fraction phase
104  word volumePhaseName_;
105 
106 
107  // Private Member Functions
108 
109  //- Non-virtual read
110  void readCoeffs();
111 
112  //- Get the volume fraction field
113  const volScalarField& volumeAlpha() const;
114 
115  //- Get the diffusivity for a given field
116  tmp<volScalarField> D(const word& fieldName) const;
117 
118 
119  // Sources
120 
121  //- Add source terms to an equation
122  template<class Type, class AlphaFieldType>
123  void addGeneralSupType
124  (
125  const AlphaFieldType& alpha,
127  ) const;
128 
129  //- Add a source term to an equation
130  template<class Type, class AlphaFieldType>
131  void addAlphaSupType
132  (
133  const AlphaFieldType& alpha,
134  const VolField<Type>& field,
135  fvMatrix<Type>& eqn
136  ) const;
137 
138  //- Add a source term to a scalar equation
139  template<class AlphaFieldType>
140  void addAlphaSupType
141  (
142  const AlphaFieldType& alpha,
143  const volScalarField& field,
144  fvMatrix<scalar>& eqn
145  ) const;
146 
147  //- Add a source term to a vector equation
148  template<class AlphaFieldType>
149  void addAlphaSupType
150  (
151  const AlphaFieldType& alpha,
152  const volVectorField& field,
153  fvMatrix<vector>& eqn
154  ) const;
155 
156  //- Add a source term to an equation
157  template<class Type>
158  void addSupType
159  (
160  const VolField<Type>& field,
161  fvMatrix<Type>& eqn
162  ) const;
163 
164  //- Add a source term to a compressible equation
165  template<class Type>
166  void addSupType
167  (
168  const volScalarField& rho,
169  const VolField<Type>& field,
170  fvMatrix<Type>& eqn
171  ) const;
172 
173  //- Add a source term to a phase equation
174  template<class Type>
175  void addSupType
176  (
177  const volScalarField& alpha,
178  const volScalarField& rho,
179  const VolField<Type>& field,
180  fvMatrix<Type>& eqn
181  ) const;
182 
183 
184 public:
185 
186  //- Runtime type information
187  TypeName("volumeBlockage");
188 
189 
190  // Constructors
191 
192  //- Construct from components
194  (
195  const word& name,
196  const word& modelType,
197  const fvMesh& mesh,
198  const dictionary& dict
199  );
200 
201  //- Disallow default bitwise copy construction
202  volumeBlockage(const volumeBlockage&) = delete;
203 
204 
205  //- Destructor
206  virtual ~volumeBlockage();
207 
208 
209  // Member Functions
210 
211  // Checks
212 
213  //- Return true if the fvModel adds a source term to the given
214  // field's transport equation
215  virtual bool addsSupToField(const word& fieldName) const;
216 
217  //- Return the list of fields for which the fvModel adds source term
218  // to the transport equation
219  virtual wordList addSupFields() const;
220 
221 
222  // Sources
223 
224  //- Add a source term to an equation
226 
227  //- Add a source term to a compressible equation
229 
230  //- Add a source term to a phase equation
232 
233 
234  // Mesh changes
235 
236  //- Update for mesh motion
237  virtual bool movePoints();
238 
239  //- Update topology using the given map
240  virtual void topoChange(const polyTopoChangeMap&);
241 
242  //- Update from another mesh using the given map
243  virtual void mapMesh(const polyMeshMap&);
244 
245  //- Redistribute or update using the given distribution map
246  virtual void distribute(const polyDistributionMap&);
247 
248 
249  // IO
250 
251  //- Read dictionary
252  virtual bool read(const dictionary& dict);
253 
254 
255  // Member Operators
256 
257  //- Disallow default bitwise assignment
258  void operator=(const volumeBlockage&) = delete;
259 };
260 
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 } // End namespace fv
265 } // End namespace Foam
266 
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268 
269 #endif
270 
271 // ************************************************************************* //
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
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:99
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
static const word & fieldName()
Return the name of the field associated with a source term. Special.
Definition: fvModelI.H:39
This fvModel adds transport terms into the equations to account for the presence of a constant volume...
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
volumeBlockage(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
virtual bool movePoints()
Add a source term to an equation.
virtual bool read(const dictionary &dict)
Read dictionary.
void operator=(const volumeBlockage &)=delete
Disallow default bitwise assignment.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
TypeName("volumeBlockage")
Runtime type information.
virtual bool addsSupToField(const word &fieldName) const
Return true if the fvModel adds a source term to the given.
virtual ~volumeBlockage()
Destructor.
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.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
#define DEFINE_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:62
#define DEFINE_FV_MODEL_ADD_RHO_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:43
#define DEFINE_FV_MODEL_ADD_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:26
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
labelList fv(nPoints)
dictionary dict
Foam::surfaceFields.