porosityForce.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::fv::porosityForce
26 
27 Description
28  This model applies the force exerted on the fluid by a porous media
29 
30 Usage
31  Example usage, here employing the Darcy-Forchheimer model:
32  \verbatim
33  porosityForceCoeffs
34  {
35  type DarcyForchheimer;
36 
37  DarcyForchheimerCoeffs
38  {
39  d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
40  f f [0 -1 0 0 0 0 0] (0 0 0);
41 
42  coordinateSystem
43  {
44  type cartesian;
45  origin (0 0 0);
46  coordinateRotation
47  {
48  type axesRotation;
49  e1 (0.70710678 0.70710678 0);
50  e2 (0 0 1);
51  }
52  }
53  }
54  }
55  \endverbatim
56 
57  Note:
58  The porous region must be selected as a cellZone.
59 
60 SourceFiles
61  porosityForce.C
62 
63 \*---------------------------------------------------------------------------*/
64 
65 #ifndef porosityForce_H
66 #define porosityForce_H
67 
68 #include "fvModel.H"
69 
70 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 
72 namespace Foam
73 {
74 
75 class porosityModel;
76 
77 namespace fv
78 {
79 
80 /*---------------------------------------------------------------------------*\
81  Class porosityForce Declaration
82 \*---------------------------------------------------------------------------*/
83 
84 class porosityForce
85 :
86  public fvModel
87 {
88  // Private data
89 
90  //- Names of the velocity fields
91  wordList UNames_;
92 
93  //- Run-time selectable porosity model
94  mutable autoPtr<porosityModel> porosityPtr_;
95 
96 
97  // Private Member Functions
98 
99  //- Reset the porosity model
100  // during construction, re-reading and mesh-change
101  void reset();
102 
103  //- Non-virtual read
104  void readCoeffs();
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("porosityForce");
111 
112 
113  // Constructors
114 
115  //- Construct from components
117  (
118  const word& name,
119  const word& modelType,
120  const fvMesh& mesh,
121  const dictionary& dict
122  );
123 
124  //- Disallow default bitwise copy construction
125  porosityForce(const porosityForce&) = delete;
126 
127 
128  //- Destructor
129  virtual ~porosityForce()
130  {}
131 
132 
133  // Member Functions
134 
135  // Access
136 
137  //- Return the porosity model
138  const porosityModel& model() const
139  {
140  return porosityPtr_();
141  }
142 
143 
144  // Checks
145 
146  //- Return the list of fields for which the fvModel adds source term
147  // to the transport equation
148  virtual wordList addSupFields() const;
149 
150 
151  // Add explicit and implicit contributions
152 
153  //- Add implicit contribution to momentum equation
154  virtual void addSup
155  (
156  const volVectorField& U,
157  fvMatrix<vector>& eqn
158  ) const;
159 
160  //- Add implicit contribution to compressible momentum equation
161  virtual void addSup
162  (
163  const volScalarField& rho,
164  const volVectorField& U,
165  fvMatrix<vector>& eqn
166  ) const;
167 
168  //- Add implicit contribution to phase momentum equation
169  virtual void addSup
170  (
171  const volScalarField& alpha,
172  const volScalarField& rho,
173  const volVectorField& U,
174  fvMatrix<vector>& eqn
175  ) const;
176 
177 
178  // Mesh changes
179 
180  //- Update for mesh motion
181  virtual bool movePoints();
182 
183  //- Update topology using the given map
184  virtual void topoChange(const polyTopoChangeMap&);
185 
186  //- Update from another mesh using the given map
187  virtual void mapMesh(const polyMeshMap&);
188 
189  //- Redistribute or update using the given distribution map
190  virtual void distribute(const polyDistributionMap&);
191 
192 
193  // IO
194 
195  //- Read dictionary
196  virtual bool read(const dictionary& dict);
197 
198 
199  // Member Operators
200 
201  //- Disallow default bitwise assignment
202  void operator=(const porosityForce&) = delete;
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace fv
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************************************************************* //
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
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
Finite volume model abstract base class.
Definition: fvModel.H:59
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
This model applies the force exerted on the fluid by a porous media.
Definition: porosityForce.H:86
virtual bool movePoints()
Update for mesh motion.
virtual void addSup(const volVectorField &U, fvMatrix< vector > &eqn) const
Add implicit contribution to momentum equation.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
TypeName("porosityForce")
Runtime type information.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
const porosityModel & model() const
Return the porosity model.
virtual bool read(const dictionary &dict)
Read dictionary.
void operator=(const porosityForce &)=delete
Disallow default bitwise assignment.
virtual ~porosityForce()
Destructor.
porosityForce(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
Definition: porosityForce.C:85
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
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
A class for handling words, derived from string.
Definition: word.H:62
U
Definition: pEqn.H:72
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict