powerLaw.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-2021 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::powerLaw
26 
27 Description
28  Power law porosity model, given by:
29 
30  \f[
31  S = - \rho C_0 |U|^{(C_1 - 1)} U
32  \f]
33 
34  where
35  \vartable
36  C_0 | model linear coefficient
37  C_1 | model exponent coefficient
38  \endvartable
39 
40 SourceFiles
41  powerLaw.C
42  powerLawTemplates.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef powerLaw_H
47 #define powerLaw_H
48 
49 #include "porosityModel.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 namespace porosityModels
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class powerLaw Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class powerLaw
63 :
64  public porosityModel
65 {
66  // Private Data
67 
68  //- C0 coefficient
69  scalar C0_;
70 
71  //- C1 coefficient
72  scalar C1_;
73 
74  //- Name of density field
75  word rhoName_;
76 
77 
78  // Private Member Functions
79 
80  //- Apply resistance
81  template<class RhoFieldType>
82  void apply
83  (
84  scalarField& Udiag,
85  const scalarField& V,
86  const RhoFieldType& rho,
87  const vectorField& U
88  ) const;
89 
90  //- Apply resistance
91  template<class RhoFieldType>
92  void apply
93  (
94  tensorField& AU,
95  const RhoFieldType& rho,
96  const vectorField& U
97  ) const;
98 
99 
100 public:
101 
102  //- Runtime type information
103  TypeName("powerLaw");
104 
105  // Constructors
106 
107  powerLaw
108  (
109  const word& name,
110  const word& modelType,
111  const fvMesh& mesh,
112  const dictionary& dict,
113  const word& cellZoneName
114  );
115 
116  //- Disallow default bitwise copy construction
117  powerLaw(const powerLaw&) = delete;
118 
119 
120  //- Destructor
121  virtual ~powerLaw();
122 
123 
124  // Member Functions
125 
126  //- Transform the model data wrt mesh changes
127  virtual void calcTransformModelData();
128 
129  //- Calculate the porosity force
130  virtual void calcForce
131  (
132  const volVectorField& U,
133  const volScalarField& rho,
134  const volScalarField& mu,
136  ) const;
137 
138  //- Add resistance
139  virtual void correct(fvVectorMatrix& UEqn) const;
140 
141  //- Add resistance
142  virtual void correct
143  (
144  const fvVectorMatrix& UEqn,
145  volTensorField& AU
146  ) const;
147 
148 
149  // I-O
150 
151  //- Write
152  bool writeData(Ostream& os) const;
153 
154 
155  // Member Operators
156 
157  //- Disallow default bitwise assignment
158  void operator=(const powerLaw&) = delete;
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace porosityModels
165 } // End namespace Foam
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #ifdef NoRepository
170  #include "powerLawTemplates.C"
171 #endif
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
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:99
const dictionary & dict() const
Return dictionary used for model construction.
const word & name() const
Return const access to the porosity model name.
virtual tmp< vectorField > force(const volVectorField &U, const volScalarField &rho, const volScalarField &mu) const
Return the force over the cell zone(s)
Power law porosity model, given by:
Definition: powerLaw.H:72
void operator=(const powerLaw &)=delete
Disallow default bitwise assignment.
virtual ~powerLaw()
Destructor.
Definition: powerLaw.C:63
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
Definition: powerLaw.C:76
bool writeData(Ostream &os) const
Write.
Definition: powerLaw.C:141
TypeName("powerLaw")
Runtime type information.
powerLaw(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict, const word &cellZoneName)
Definition: powerLaw.C:46
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
Definition: powerLaw.C:93
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
Definition: powerLaw.C:69
A class for handling words, derived from string.
Definition: word.H:62
fvVectorMatrix & UEqn
Definition: UEqn.H:11
U
Definition: pEqn.H:72
const dimensionedScalar mu
Atomic mass unit.
Namespace for OpenFOAM.