DarcyForchheimer.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-2019 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::porosityModels::DarcyForchheimer
26 
27 Description
28  Darcy-Forchheimer law porosity model, given by:
29 
30  \f[
31  S = - (\mu d + \frac{\rho |U|}{2} f) U
32  \f]
33 
34  where
35  \vartable
36  d | Darcy coefficient [1/m^2]
37  f | Forchheimer coefficient [1/m]
38  \endvartable
39 
40  Since negative Darcy/Forchheimer parameters are invalid, they can be used
41  to specify a multiplier (of the max component).
42 
43  The orientation of the porous region is defined with the same notation as
44  a co-ordinate system, but only a Cartesian co-ordinate system is valid.
45 
46 SourceFiles
47  DarcyForchheimer.C
48  DarcyForchheimerTemplates.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef DarcyForchheimer_H
53 #define DarcyForchheimer_H
54 
55 #include "porosityModel.H"
56 #include "dimensionedTensor.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 namespace porosityModels
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class DarcyForchheimer Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class DarcyForchheimer
70 :
71  public porosityModel
72 {
73  // Private Data
74 
75  //- Darcy coeffient XYZ components (user-supplied) [1/m^2]
77 
78  //- Forchheimer coeffient XYZ components (user-supplied) [1/m]
79  dimensionedVector fXYZ_;
80 
81  //- Darcy coefficient - converted from dXYZ [1/m^2]
83 
84  //- Forchheimer coefficient - converted from fXYZ [1/m]
86 
87  //- Name of density field
88  word rhoName_;
89 
90  //- Name of dynamic viscosity field
91  word muName_;
92 
93  //- Name of kinematic viscosity field
94  word nuName_;
95 
96 
97  // Private Member Functions
98 
99  //- Apply
100  template<class RhoFieldType>
101  void apply
102  (
103  scalarField& Udiag,
104  vectorField& Usource,
105  const scalarField& V,
106  const RhoFieldType& rho,
107  const scalarField& mu,
108  const vectorField& U
109  ) const;
110 
111  //- Apply
112  template<class RhoFieldType>
113  void apply
114  (
115  tensorField& AU,
116  const RhoFieldType& rho,
117  const scalarField& mu,
118  const vectorField& U
119  ) const;
120 
121 
122 public:
123 
124  //- Runtime type information
125  TypeName("DarcyForchheimer");
126 
127  // Constructors
128 
130  (
131  const word& name,
132  const word& modelType,
133  const fvMesh& mesh,
134  const dictionary& dict,
135  const word& cellZoneName
136  );
137 
138  //- Disallow default bitwise copy construction
139  DarcyForchheimer(const DarcyForchheimer&) = delete;
140 
141 
142  //- Destructor
143  virtual ~DarcyForchheimer();
144 
145 
146  // Member Functions
147 
148  //- Transform the model data wrt mesh changes
149  virtual void calcTransformModelData();
150 
151  //- Calculate the porosity force
152  virtual void calcForce
153  (
154  const volVectorField& U,
155  const volScalarField& rho,
156  const volScalarField& mu,
158  ) const;
159 
160  //- Add resistance
161  virtual void correct(fvVectorMatrix& UEqn) const;
162 
163  //- Add resistance
164  virtual void correct
165  (
167  const volScalarField& rho,
168  const volScalarField& mu
169  ) const;
170 
171  //- Add resistance
172  virtual void correct
173  (
174  const fvVectorMatrix& UEqn,
175  volTensorField& AU
176  ) const;
177 
178 
179  // I-O
180 
181  //- Write
182  bool writeData(Ostream& os) const;
183 
184 
185  // Member Operators
186 
187  //- Disallow default bitwise assignment
188  void operator=(const DarcyForchheimer&) = delete;
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace porosityModels
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #ifdef NoRepository
200  #include "DarcyForchheimerTemplates.C"
201 #endif
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
bool writeData(Ostream &os) const
Write.
const dictionary & dict() const
Return dictionary used for model construction.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
virtual tmp< vectorField > force(const volVectorField &U, const volScalarField &rho, const volScalarField &mu)
Return the force over the cell zone(s)
DarcyForchheimer(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict, const word &cellZoneName)
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
dynamicFvMesh & mesh
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
A class for handling words, derived from string.
Definition: word.H:59
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
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void operator=(const DarcyForchheimer &)=delete
Disallow default bitwise assignment.
Darcy-Forchheimer law porosity model, given by:
const dimensionedScalar mu
Atomic mass unit.
TypeName("DarcyForchheimer")
Runtime type information.
U
Definition: pEqn.H:72
const word & name() const
Return const access to the porosity model name.
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
fvVectorMatrix & UEqn
Definition: UEqn.H:13
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Namespace for OpenFOAM.