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 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
powerLaw
Power law porosity model, given by:
Foam::constant::physicoChemical::mu
const dimensionedScalar mu
Atomic mass unit.
Definition: createFields.H:13
Foam::porosityModel::name
const word & name() const
Return const access to the porosity model name.
Definition: porosityModelI.H:26
Foam::porosityModels::powerLaw::apply
void apply(scalarField &Udiag, const scalarField &V, const RhoFieldType &rho, const vectorField &U) const
Apply resistance.
Definition: powerLawTemplates.C:30
powerLawTemplates.C
porosityModel.H
U
U
Definition: pEqn.H:46
Foam::porosityModels::powerLaw::rhoName_
word rhoName_
Name of density field.
Definition: powerLaw.H:83
Foam::porosityModels::powerLaw::calcForce
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
Definition: powerLaw.C:76
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
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::porosityModels::powerLaw::writeData
bool writeData(Ostream &os) const
Write.
Definition: powerLaw.C:152
UEqn
tmp< fvVectorMatrix > UEqn(fvm::div(phi, U)+MRF.DDt(U)+turbulence->divDevReff(U)==fvOptions(U))
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::porosityModels::powerLaw::calcTransformModelData
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
Definition: powerLaw.C:69
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::porosityModels::powerLaw::operator=
void operator=(const powerLaw &)
Disallow default bitwise assignment.
rho
rho
Definition: pEqn.H:3
Foam::porosityModels::powerLaw::C0_
scalar C0_
C0 coefficient.
Definition: powerLaw.H:77
Foam::porosityModel
Top level model for porosity models.
Definition: porosityModel.H:55
Foam::porosityModels::powerLaw
Definition: powerLaw.H:70
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::porosityModels::powerLaw::TypeName
TypeName("powerLaw")
Runtime type information.
Foam::porosityModels::powerLaw::powerLaw
powerLaw(const powerLaw &)
Disallow default bitwise copy construct.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::porosityModels::powerLaw::~powerLaw
virtual ~powerLaw()
Destructor.
Definition: powerLaw.C:63
Foam::porosityModels::powerLaw::correct
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
Definition: powerLaw.C:93
Foam::porosityModels::powerLaw::C1_
scalar C1_
C1 coefficient.
Definition: powerLaw.H:80