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-2024 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 fvMesh& mesh,
96  const dictionary& dict,
97  const dictionary& coeffDict
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  //- Coefficients dictionary cached for kEpsilonLopesdaCosta
119  dictionary coeffDict_;
120 
121  //- Cd coefficient
122  scalar Cd_;
123 
124  //- C1 coefficient
125  scalar C1_;
126 
127  //- Name of density field
128  word rhoName_;
129 
130 
131  // Private Member Functions
132 
133  //- Apply resistance
134  template<class RhoFieldType>
135  void apply
136  (
137  scalarField& Udiag,
138  const scalarField& V,
139  const RhoFieldType& rho,
140  const vectorField& U
141  ) const;
142 
143  //- Apply resistance
144  template<class RhoFieldType>
145  void apply
146  (
147  tensorField& AU,
148  const RhoFieldType& rho,
149  const vectorField& U
150  ) const;
151 
152 
153 public:
154 
155  //- Runtime type information
156  TypeName("powerLawLopesdaCosta");
157 
158  // Constructors
159 
161  (
162  const word& name,
163  const fvMesh& mesh,
164  const dictionary& dict,
165  const dictionary& coeffDict,
166  const word& cellZoneName
167  );
168 
169  //- Disallow default bitwise copy construction
171 
172 
173  //- Destructor
174  virtual ~powerLawLopesdaCosta();
175 
176 
177  // Member Functions
178 
179  const dictionary& dict() const
180  {
181  return coeffDict_;
182  }
183 
184  //- Transform the model data wrt mesh changes
185  virtual void calcTransformModelData();
186 
187  //- Calculate the porosity force
188  virtual void calcForce
189  (
191  const volScalarField& rho,
192  const volScalarField& mu,
194  ) const;
195 
196  //- Add resistance
197  virtual void correct(fvVectorMatrix& UEqn) const;
198 
199  //- Add resistance
200  virtual void correct
201  (
203  const volScalarField& rho,
204  const volScalarField& mu
205  ) const;
206 
207  //- Add resistance
208  virtual void correct
209  (
210  const fvVectorMatrix& UEqn,
211  volTensorField& AU
212  ) const;
213 
214 
215  // Member Operators
216 
217  //- Disallow default bitwise assignment
218  void operator=(const powerLawLopesdaCosta&) = delete;
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace porosityModels
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #ifdef NoRepository
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
Generic GeometricField class.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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:96
Top level model for porosity models.
Definition: porosityModel.H:57
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.
powerLawLopesdaCostaZone(const word &name, const fvMesh &mesh, const dictionary &dict, const dictionary &coeffDict)
Constructor.
scalarField Av_
Porosity surface area per unit volume zone field.
Variant of the power law porosity model with spatially varying drag coefficient.
powerLawLopesdaCosta(const word &name, const fvMesh &mesh, const dictionary &dict, const dictionary &coeffDict, 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
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
U
Definition: pEqn.H:72
const dimensionedScalar mu
Atomic mass unit.
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict