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  //- Non-virtual read
100  void readCoeffs(const dictionary& dict);
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("porosityForce");
107 
108 
109  // Constructors
110 
111  //- Construct from components
113  (
114  const word& name,
115  const word& modelType,
116  const fvMesh& mesh,
117  const dictionary& dict
118  );
119 
120  //- Disallow default bitwise copy construction
121  porosityForce(const porosityForce&) = delete;
122 
123 
124  //- Destructor
125  virtual ~porosityForce()
126  {}
127 
128 
129  // Member Functions
130 
131  // Access
132 
133  //- Return the porosity model
134  const porosityModel& model() const
135  {
136  return porosityPtr_();
137  }
138 
139 
140  // Checks
141 
142  //- Return the list of fields for which the fvModel adds source term
143  // to the transport equation
144  virtual wordList addSupFields() const;
145 
146 
147  // Add explicit and implicit contributions
148 
149  //- Add implicit contribution to momentum equation
150  virtual void addSup
151  (
152  const volVectorField& U,
153  fvMatrix<vector>& eqn
154  ) const;
155 
156  //- Add implicit contribution to compressible momentum equation
157  virtual void addSup
158  (
159  const volScalarField& rho,
160  const volVectorField& U,
161  fvMatrix<vector>& eqn
162  ) const;
163 
164  //- Add implicit contribution to phase momentum equation
165  virtual void addSup
166  (
167  const volScalarField& alpha,
168  const volScalarField& rho,
169  const volVectorField& U,
170  fvMatrix<vector>& eqn
171  ) const;
172 
173 
174  // Mesh changes
175 
176  //- Update for mesh motion
177  virtual bool movePoints();
178 
179  //- Update topology using the given map
180  virtual void topoChange(const polyTopoChangeMap&);
181 
182  //- Update from another mesh using the given map
183  virtual void mapMesh(const polyMeshMap&);
184 
185  //- Redistribute or update using the given distribution map
186  virtual void distribute(const polyDistributionMap&);
187 
188 
189  // IO
190 
191  //- Read dictionary
192  virtual bool read(const dictionary& dict);
193 
194 
195  // Member Operators
196 
197  //- Disallow default bitwise assignment
198  void operator=(const porosityForce&) = delete;
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace fv
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
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 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
Finite volume model abstract base class.
Definition: fvModel.H:60
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:69
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
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.
Definition: porosityForce.C:96
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:79
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