All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-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::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  (
145  const volScalarField& rho,
146  const volScalarField& mu
147  ) const;
148 
149  //- Add resistance
150  virtual void correct
151  (
152  const fvVectorMatrix& UEqn,
153  volTensorField& AU
154  ) const;
155 
156 
157  // I-O
158 
159  //- Write
160  bool writeData(Ostream& os) const;
161 
162 
163  // Member Operators
164 
165  //- Disallow default bitwise assignment
166  void operator=(const powerLaw&) = delete;
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace porosityModels
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #ifdef NoRepository
178  #include "powerLawTemplates.C"
179 #endif
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #endif
184 
185 // ************************************************************************* //
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
virtual tmp< vectorField > force(const volVectorField &U, const volScalarField &rho, const volScalarField &mu)
Return the force over the cell zone(s)
TypeName("powerLaw")
Runtime type information.
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
Definition: powerLaw.C:69
dynamicFvMesh & mesh
powerLaw(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict, const word &cellZoneName)
Definition: powerLaw.C:46
A class for handling words, derived from string.
Definition: word.H:59
Power law porosity model, given by:
Definition: powerLaw.H:69
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:54
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
Definition: powerLaw.C:76
virtual ~powerLaw()
Destructor.
Definition: powerLaw.C:63
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
Definition: powerLaw.C:93
bool writeData(Ostream &os) const
Write.
Definition: powerLaw.C:156
U
Definition: pEqn.H:72
const dimensionedScalar & mu
Atomic mass unit.
const word & name() const
Return const access to the porosity model name.
fvVectorMatrix & UEqn
Definition: UEqn.H:11
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
void operator=(const powerLaw &)=delete
Disallow default bitwise assignment.
Namespace for OpenFOAM.