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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::porosityModels::powerLaw
28 
29 Description
30  Power law porosity model, given by:
31 
32  \f[
33  S = - \rho C_0 |U|^{(C_1 - 1)} U
34  \f]
35 
36  where
37  \vartable
38  C_0 | model linear coefficient
39  C_1 | model exponent coefficient
40  \endvartable
41 
42 SourceFiles
43  powerLaw.C
44  powerLawTemplates.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef porosityModels_powerLaw_H
49 #define porosityModels_powerLaw_H
50 
51 #include "porosityModel.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 namespace porosityModels
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class powerLaw Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class powerLaw
65 :
66  public porosityModel
67 {
68  // Private data
69 
70  //- C0 coefficient
71  scalar C0_;
72 
73  //- C1 coefficient
74  scalar C1_;
75 
76  //- Name of density field
77  word rhoName_;
78 
79 
80  // Private Member Functions
81 
82  //- Apply resistance
83  template<class RhoFieldType>
84  void apply
85  (
86  scalarField& Udiag,
87  const scalarField& V,
88  const RhoFieldType& rho,
89  const vectorField& U
90  ) const;
91 
92  //- Apply resistance
93  template<class RhoFieldType>
94  void apply
95  (
96  tensorField& AU,
97  const RhoFieldType& rho,
98  const vectorField& U
99  ) const;
100 
101  //- No copy construct
102  powerLaw(const powerLaw&) = delete;
103 
104  //- No copy assignment
105  void operator=(const powerLaw&) = delete;
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("powerLaw");
112 
113  //- Constructor
114  powerLaw
115  (
116  const word& name,
117  const word& modelType,
118  const fvMesh& mesh,
119  const dictionary& dict,
120  const word& cellZoneName
121  );
122 
123  //- Destructor
124  virtual ~powerLaw() = default;
125 
126 
127  // Member Functions
128 
129  //- Transform the model data wrt mesh changes
130  virtual void calcTransformModelData();
131 
132  //- Calculate the porosity force
133  virtual void calcForce
134  (
135  const volVectorField& U,
136  const volScalarField& rho,
137  const volScalarField& mu,
139  ) const;
140 
141  //- Add resistance
142  virtual void correct(fvVectorMatrix& UEqn) const;
143 
144  //- Add resistance
145  virtual void correct
146  (
148  const volScalarField& rho,
149  const volScalarField& mu
150  ) const;
151 
152  //- Add resistance
153  virtual void correct
154  (
155  const fvVectorMatrix& UEqn,
156  volTensorField& AU
157  ) const;
158 
159 
160  // I-O
161 
162  //- Write
163  bool writeData(Ostream& os) const;
164 };
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace porosityModels
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #ifdef NoRepository
174  #include "powerLawTemplates.C"
175 #endif
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::constant::physicoChemical::mu
const dimensionedScalar mu
Atomic mass unit.
Definition: createFieldRefs.H:4
Foam::porosityModel::name
const word & name() const
Return const access to the porosity model name.
Definition: porosityModelI.H:44
powerLawTemplates.C
porosityModel.H
rho
rho
Definition: readInitialConditions.H:88
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:73
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< scalar >
Foam::porosityModels::powerLaw::writeData
bool writeData(Ostream &os) const
Write.
Definition: powerLaw.C:153
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::porosityModels::powerLaw::~powerLaw
virtual ~powerLaw()=default
Destructor.
Foam::porosityModels::powerLaw::calcTransformModelData
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
Definition: powerLaw.C:66
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
U
U
Definition: pEqn.H:72
Foam::porosityModel
Top level model for porosity models.
Definition: porosityModel.H:57
Foam::porosityModels::powerLaw
Power law porosity model, given by:
Definition: powerLaw.H:71
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
UEqn
fvVectorMatrix & UEqn
Definition: UEqn.H:13
Foam::porosityModels::powerLaw::TypeName
TypeName("powerLaw")
Runtime type information.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::porosityModel::dict
const dictionary & dict() const
Return dictionary used for model construction.
Definition: porosityModelI.H:56
Foam::porosityModels::powerLaw::correct
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
Definition: powerLaw.C:90