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-2019 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 \Sigma |U|^{(C_1 - 1)} U
35  \f]
36 
37  where
38  \vartable
39  \Sigma | 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& Sigma() 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,
185  vectorField& force
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 // ************************************************************************* //
dictionary dict
Variant of the power law porosity model with spatially varying drag coefficient.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const scalarField & Sigma() const
Return the porosity surface area per unit volume zone field.
powerLawLopesdaCostaZone(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Constructor.
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:70
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(rho0+psi *p, rhoMin);# 1 "/home/ubuntu/OpenFOAM-8/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H" 1{ alphav=max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));alphal=1.0 - alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
Definition: pEqn.H:68
const bool writeData(readBool(pdfDictionary.lookup("writeData")))
scalarField Sigma_
Porosity surface area per unit volume zone field.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
U
Definition: pEqn.H:72
const dimensionedScalar & mu
Atomic mass unit.
fvVectorMatrix & UEqn
Definition: UEqn.H:11
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
const word zoneName_
Automatically generated zone name for this porous zone.
Top level model for porosity models.
Definition: porosityModel.H:55
Namespace for OpenFOAM.