powerLawLopesdaCosta.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) 2018-2023 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::powerLawLopesdaCosta
26 
27 Description
28  Variant of the power law porosity model with spatially varying
29  drag coefficient
30 
31  given by:
32 
33  \f[
34  S = -\rho C_d A_v |U|^{(C_1 - 1)} U
35  \f]
36 
37  where
38  \vartable
39  A_v | Porosity surface area per unit volume
40  C_d | Model linear coefficient
41  C_1 | Model exponent coefficient
42  \endvartable
43 
44  Reference:
45  \verbatim
46  Costa, J. C. P. L. D. (2007).
47  Atmospheric flow over forested and non-forested complex terrain.
48  \endverbatim
49 
50 See also
51  Foam::RASModels::kEpsilonLopesdaCosta
52 
53 SourceFiles
54  powerLawLopesdaCosta.C
55  powerLawLopesdaCostaTemplates.C
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef powerLawLopesdaCosta_H
60 #define powerLawLopesdaCosta_H
61 
62 #include "porosityModel.H"
63 #include "Function1.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 namespace porosityModels
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class powerLawLopesdaCostaZone Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class powerLawLopesdaCostaZone
77 {
78 protected:
79 
80  // Protected data
81 
82  //- Automatically generated zone name for this porous zone
83  const word zoneName_;
84 
85  //- Porosity surface area per unit volume zone field
87 
88 
89 public:
90 
91  //- Constructor
93  (
94  const word& name,
95  const word& modelType,
96  const fvMesh& mesh,
98  );
99 
100  // Member Functions
101 
102  //- Return the porosity surface area per unit volume zone field
103  const scalarField& Av() const;
104 };
105 
106 
107 /*---------------------------------------------------------------------------*\
108  Class powerLawLopesdaCosta Declaration
109 \*---------------------------------------------------------------------------*/
110 
112 :
114  public porosityModel
115 {
116  // Private Data
117 
118  //- Cd coefficient
119  scalar Cd_;
120 
121  //- C1 coefficient
122  scalar C1_;
123 
124  //- Name of density field
125  word rhoName_;
126 
127 
128  // Private Member Functions
129 
130  //- Apply resistance
131  template<class RhoFieldType>
132  void apply
133  (
134  scalarField& Udiag,
135  const scalarField& V,
136  const RhoFieldType& rho,
137  const vectorField& U
138  ) const;
139 
140  //- Apply resistance
141  template<class RhoFieldType>
142  void apply
143  (
144  tensorField& AU,
145  const RhoFieldType& rho,
146  const vectorField& U
147  ) const;
148 
149 
150 public:
151 
152  //- Runtime type information
153  TypeName("powerLawLopesdaCosta");
154 
155  // Constructors
156 
158  (
159  const word& name,
160  const word& modelType,
161  const fvMesh& mesh,
162  const dictionary& dict,
163  const word& cellZoneName
164  );
165 
166  //- Disallow default bitwise copy construction
168 
169 
170  //- Destructor
171  virtual ~powerLawLopesdaCosta();
172 
173 
174  // Member Functions
175 
176  //- Transform the model data wrt mesh changes
177  virtual void calcTransformModelData();
178 
179  //- Calculate the porosity force
180  virtual void calcForce
181  (
182  const volVectorField& U,
183  const volScalarField& rho,
184  const volScalarField& mu,
186  ) const;
187 
188  //- Add resistance
189  virtual void correct(fvVectorMatrix& UEqn) const;
190 
191  //- Add resistance
192  virtual void correct
193  (
195  const volScalarField& rho,
196  const volScalarField& mu
197  ) const;
198 
199  //- Add resistance
200  virtual void correct
201  (
202  const fvVectorMatrix& UEqn,
203  volTensorField& AU
204  ) const;
205 
206 
207  // I-O
208 
209  //- Write
210  bool writeData(Ostream& os) const;
211 
212 
213  // Member Operators
214 
215  //- Disallow default bitwise assignment
216  void operator=(const powerLawLopesdaCosta&) = delete;
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace porosityModels
223 } // End namespace Foam
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #ifdef NoRepository
229 #endif
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************************************************************* //
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Top level model for porosity models.
Definition: porosityModel.H:57
const dictionary & dict() const
Return dictionary used for model construction.
const word & name() const
Return const access to the porosity model name.
virtual tmp< vectorField > force(const volVectorField &U, const volScalarField &rho, const volScalarField &mu) const
Return the force over the cell zone(s)
const word zoneName_
Automatically generated zone name for this porous zone.
const scalarField & Av() const
Return the porosity surface area per unit volume zone field.
scalarField Av_
Porosity surface area per unit volume zone field.
powerLawLopesdaCostaZone(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Constructor.
Variant of the power law porosity model with spatially varying drag coefficient.
powerLawLopesdaCosta(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict, const word &cellZoneName)
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
void operator=(const powerLawLopesdaCosta &)=delete
Disallow default bitwise assignment.
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
TypeName("powerLawLopesdaCosta")
Runtime type information.
A class for handling words, derived from string.
Definition: word.H:62
fvVectorMatrix & UEqn
Definition: UEqn.H:11
U
Definition: pEqn.H:72
const dimensionedScalar mu
Atomic mass unit.
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dictionary dict