powerLaw.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 | Copyright (C) 2012-2015 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::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 
41 SourceFiles
42  powerLaw.C
43  powerLawTemplates.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef powerLaw_H
48 #define powerLaw_H
49 
50 #include "porosityModel.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 namespace porosityModels
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class powerLaw Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class powerLaw
64 :
65  public porosityModel
66 {
67  // Private data
68 
69  //- C0 coefficient
70  scalar C0_;
71 
72  //- C1 coefficient
73  scalar C1_;
74 
75  //- Name of density field
76  word rhoName_;
77 
78 
79  // Private Member Functions
80 
81  //- Apply resistance
82  template<class RhoFieldType>
83  void apply
84  (
85  scalarField& Udiag,
86  const scalarField& V,
87  const RhoFieldType& rho,
88  const vectorField& U
89  ) const;
90 
91  //- Apply resistance
92  template<class RhoFieldType>
93  void apply
94  (
95  tensorField& AU,
96  const RhoFieldType& rho,
97  const vectorField& U
98  ) const;
99 
100  //- Disallow default bitwise copy construct
101  powerLaw(const powerLaw&);
102 
103  //- Disallow default bitwise assignment
104  void operator=(const powerLaw&);
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("powerLaw");
111 
112  //- Constructor
113  powerLaw
114  (
115  const word& name,
116  const word& modelType,
117  const fvMesh& mesh,
118  const dictionary& dict,
119  const word& cellZoneName
120  );
121 
122  //- Destructor
123  virtual ~powerLaw();
124 
125 
126  // Member Functions
127 
128  //- Transform the model data wrt mesh changes
129  virtual void calcTransformModelData();
130 
131  //- Calculate the porosity force
132  virtual void calcForce
133  (
134  const volVectorField& U,
135  const volScalarField& rho,
136  const volScalarField& mu,
138  ) const;
139 
140  //- Add resistance
141  virtual void correct(fvVectorMatrix& UEqn) const;
142 
143  //- Add resistance
144  virtual void correct
145  (
147  const volScalarField& rho,
148  const volScalarField& mu
149  ) const;
150 
151  //- Add resistance
152  virtual void correct
153  (
154  const fvVectorMatrix& UEqn,
155  volTensorField& AU
156  ) const;
157 
158 
159  // I-O
160 
161  //- Write
162  bool writeData(Ostream& os) const;
163 };
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace porosityModels
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #ifdef NoRepository
173  #include "powerLawTemplates.C"
174 #endif
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
dictionary dict
U
Definition: pEqn.H:83
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
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:71
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
Definition: powerLaw.C:93
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const word & name() const
Return const access to the porosity model name.
virtual ~powerLaw()
Destructor.
Definition: powerLaw.C:63
const dimensionedScalar mu
Atomic mass unit.
fvVectorMatrix & UEqn
Definition: UEqn.H:13
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
bool writeData(Ostream &os) const
Write.
Definition: powerLaw.C:152
Namespace for OpenFOAM.
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
Definition: powerLaw.C:76