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-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::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  //- Disallow default bitwise copy construct
100  powerLaw(const powerLaw&);
101 
102  //- Disallow default bitwise assignment
103  void operator=(const powerLaw&);
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("powerLaw");
110 
111  //- Constructor
112  powerLaw
113  (
114  const word& name,
115  const word& modelType,
116  const fvMesh& mesh,
117  const dictionary& dict,
118  const word& cellZoneName
119  );
120 
121  //- Destructor
122  virtual ~powerLaw();
123 
124 
125  // Member Functions
126 
127  //- Transform the model data wrt mesh changes
128  virtual void calcTransformModelData();
129 
130  //- Calculate the porosity force
131  virtual void calcForce
132  (
133  const volVectorField& U,
134  const volScalarField& rho,
135  const volScalarField& mu,
137  ) const;
138 
139  //- Add resistance
140  virtual void correct(fvVectorMatrix& UEqn) const;
141 
142  //- Add resistance
143  virtual void correct
144  (
146  const volScalarField& rho,
147  const volScalarField& mu
148  ) const;
149 
150  //- Add resistance
151  virtual void correct
152  (
153  const fvVectorMatrix& UEqn,
154  volTensorField& AU
155  ) const;
156 
157 
158  // I-O
159 
160  //- Write
161  bool writeData(Ostream& os) const;
162 };
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace porosityModels
167 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #ifdef NoRepository
172  #include "powerLawTemplates.C"
173 #endif
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
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
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
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:53
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
const dimensionedScalar mu
Atomic mass unit.
U
Definition: pEqn.H:72
const word & name() const
Return const access to the porosity model name.
fvVectorMatrix & UEqn
Definition: UEqn.H:13
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Namespace for OpenFOAM.