DarcyForchheimer.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2017 OpenFOAM Foundation
9  Copyright (C) 2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::porosityModels::DarcyForchheimer
29 
30 Description
31  Darcy-Forchheimer law porosity model, given by:
32 
33  \f[
34  S = - (\mu d + \frac{\rho |U|}{2} f) U
35  \f]
36 
37  where
38  \vartable
39  d | Darcy coefficient [1/m2]
40  f | Forchheimer coefficient [1/m]
41  \endvartable
42 
43  Since negative Darcy/Forchheimer parameters are invalid, they can be used
44  to specify a multiplier (of the max component).
45 
46  The orientation of the porous region is defined with the same notation as
47  a coordinate system, but only a Cartesian coordinate system is valid.
48 
49 SourceFiles
50  DarcyForchheimer.C
51  DarcyForchheimerTemplates.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef Foam_porosityModels_DarcyForchheimer_H
56 #define Foam_porosityModels_DarcyForchheimer_H
57 
58 #include "porosityModel.H"
59 #include "dimensionedTensor.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 namespace porosityModels
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class DarcyForchheimer Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class DarcyForchheimer
73 :
74  public porosityModel
75 {
76  // Private Data
77 
78  //- Darcy coefficient XYZ components (user-supplied) [1/m2]
79  dimensionedVector dXYZ_;
80 
81  //- Forchheimer coefficient XYZ components (user-supplied) [1/m]
82  dimensionedVector fXYZ_;
83 
84  //- Darcy coefficient - converted from dXYZ [1/m2]
86 
87  //- Forchheimer coefficient - converted from fXYZ [1/m]
89 
90  //- Name of density field
91  word rhoName_;
92 
93  //- Name of dynamic viscosity field
94  word muName_;
95 
96  //- Name of kinematic viscosity field
97  word nuName_;
98 
99 
100  // Private Member Functions
101 
102  //- Apply
103  template<class RhoFieldType>
104  void apply
105  (
106  scalarField& Udiag,
107  vectorField& Usource,
108  const scalarField& V,
109  const RhoFieldType& rho,
110  const scalarField& mu,
111  const vectorField& U
112  ) const;
113 
114  //- Apply
115  template<class RhoFieldType>
116  void apply
117  (
118  tensorField& AU,
119  const RhoFieldType& rho,
120  const scalarField& mu,
121  const vectorField& U
122  ) const;
123 
124  //- No copy construct
125  DarcyForchheimer(const DarcyForchheimer&) = delete;
126 
127  //- No copy assignment
128  void operator=(const DarcyForchheimer&) = delete;
129 
130 
131 public:
132 
133  //- Runtime type information
134  TypeName("DarcyForchheimer");
135 
136  //- Constructor
138  (
139  const word& name,
140  const word& modelType,
141  const fvMesh& mesh,
142  const dictionary& dict,
143  const wordRe& cellZoneName
144  );
145 
146  //- Destructor
147  virtual ~DarcyForchheimer() = default;
148 
149 
150  // Member Functions
151 
152  //- Transform the model data wrt mesh changes
153  virtual void calcTransformModelData();
154 
155  //- Calculate the porosity force
156  virtual void calcForce
157  (
158  const volVectorField& U,
159  const volScalarField& rho,
160  const volScalarField& mu,
162  ) const;
163 
164  //- Add resistance
165  virtual void correct(fvVectorMatrix& UEqn) const;
166 
167  //- Add resistance
168  virtual void correct
169  (
171  const volScalarField& rho,
172  const volScalarField& mu
173  ) const;
174 
175  //- Add resistance
176  virtual void correct
177  (
178  const fvVectorMatrix& UEqn,
179  volTensorField& AU
180  ) const;
181 
182 
183  // I-O
184 
185  //- Write
186  bool writeData(Ostream& os) const;
187 };
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace porosityModels
192 } // End namespace Foam
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #ifdef NoRepository
197  #include "DarcyForchheimerTemplates.C"
198 #endif
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #endif
203 
204 // ************************************************************************* //
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 a number of values (eg...
Definition: dictionary.H:129
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
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 Foam::string.
Definition: word.H:63
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:64
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
Definition: wordRe.H:78
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
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
virtual ~DarcyForchheimer()=default
Destructor.
Namespace for OpenFOAM.