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