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