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-2018 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/m2]
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/m2]
77 
78  //- Forchheimer coeffient XYZ components (user-supplied) [1/m]
79  dimensionedVector fXYZ_;
80 
81  //- Darcy coefficient - converted from dXYZ [1/m2]
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  //- Disallow default bitwise copy construct
123 
124  //- Disallow default bitwise assignment
125  void operator=(const DarcyForchheimer&);
126 
127 
128 public:
129 
130  //- Runtime type information
131  TypeName("DarcyForchheimer");
132 
133  //- Constructor
135  (
136  const word& name,
137  const word& modelType,
138  const fvMesh& mesh,
139  const dictionary& dict,
140  const word& cellZoneName
141  );
142 
143  //- Destructor
144  virtual ~DarcyForchheimer();
145 
146 
147  // Member Functions
148 
149  //- Transform the model data wrt mesh changes
150  virtual void calcTransformModelData();
151 
152  //- Calculate the porosity force
153  virtual void calcForce
154  (
155  const volVectorField& U,
156  const volScalarField& rho,
157  const volScalarField& mu,
159  ) const;
160 
161  //- Add resistance
162  virtual void correct(fvVectorMatrix& UEqn) const;
163 
164  //- Add resistance
165  virtual void correct
166  (
168  const volScalarField& rho,
169  const volScalarField& mu
170  ) const;
171 
172  //- Add resistance
173  virtual void correct
174  (
175  const fvVectorMatrix& UEqn,
176  volTensorField& AU
177  ) const;
178 
179 
180  // I-O
181 
182  //- Write
183  bool writeData(Ostream& os) const;
184 };
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace porosityModels
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #ifdef NoRepository
194  #include "DarcyForchheimerTemplates.C"
195 #endif
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
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:137
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:60
virtual tmp< vectorField > force(const volVectorField &U, const volScalarField &rho, const volScalarField &mu)
Return the force over the cell zone(s)
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
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.