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 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  //- Disallow default bitwise copy construct
151 
152  //- Disallow default bitwise assignment
153  void operator=(const powerLawLopesdaCosta&);
154 
155 
156 public:
157 
158  //- Runtime type information
159  TypeName("powerLawLopesdaCosta");
160 
161  //- Constructor
163  (
164  const word& name,
165  const word& modelType,
166  const fvMesh& mesh,
167  const dictionary& dict,
168  const word& cellZoneName
169  );
170 
171  //- Destructor
172  virtual ~powerLawLopesdaCosta();
173 
174 
175  // Member Functions
176 
177  //- Transform the model data wrt mesh changes
178  virtual void calcTransformModelData();
179 
180  //- Calculate the porosity force
181  virtual void calcForce
182  (
183  const volVectorField& U,
184  const volScalarField& rho,
185  const volScalarField& mu,
186  vectorField& force
187  ) const;
188 
189  //- Add resistance
190  virtual void correct(fvVectorMatrix& UEqn) const;
191 
192  //- Add resistance
193  virtual void correct
194  (
196  const volScalarField& rho,
197  const volScalarField& mu
198  ) const;
199 
200  //- Add resistance
201  virtual void correct
202  (
203  const fvVectorMatrix& UEqn,
204  volTensorField& AU
205  ) const;
206 
207 
208  // I-O
209 
210  //- Write
211  bool writeData(Ostream& os) const;
212 };
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace porosityModels
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #ifdef NoRepository
223 #endif
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
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:137
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:53
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(psi *p+alphal *rhol0+((alphav *psiv+alphal *psil) - psi) *pSat, rhoMin);# 1 "/home/ubuntu/OpenFOAM-6/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:72
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
const dimensionedScalar mu
Atomic mass unit.
U
Definition: pEqn.H:72
fvVectorMatrix & UEqn
Definition: UEqn.H:13
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.