powerLawLopesdaCosta.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) 2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::porosityModels::powerLawLopesdaCosta
28 
29 Description
30  Variant of the power law porosity model with spatially varying
31  drag coefficient
32 
33  given by:
34 
35  \f[
36  S = -\rho C_d \Sigma |U|^{(C_1 - 1)} U
37  \f]
38 
39  where
40  \vartable
41  \Sigma | Porosity surface area per unit volume
42  C_d | Model linear coefficient
43  C_1 | Model exponent coefficient
44  \endvartable
45 
46  Reference:
47  \verbatim
48  Costa, J. C. P. L. D. (2007).
49  Atmospheric flow over forested and non-forested complex terrain.
50  \endverbatim
51 
52 See also
53  Foam::RASModels::kEpsilonLopesdaCosta
54 
55 SourceFiles
56  powerLawLopesdaCosta.C
57  powerLawLopesdaCostaTemplates.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef powerLawLopesdaCosta_H
62 #define powerLawLopesdaCosta_H
63 
64 #include "porosityModel.H"
65 #include "Function1.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace porosityModels
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class powerLawLopesdaCostaZone Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class powerLawLopesdaCostaZone
79 {
80 protected:
81 
82  // Protected data
83 
84  //- Automatically generated zone name for this porous zone
85  const word zoneName_;
86 
87  //- Porosity surface area per unit volume zone field
89 
90 
91 public:
92 
93  //- Constructor
95  (
96  const word& name,
97  const word& modelType,
98  const fvMesh& mesh,
100  );
101 
102  // Member Functions
103 
104  //- Return the porosity surface area per unit volume zone field
105  const scalarField& Sigma() const;
106 };
107 
108 
109 /*---------------------------------------------------------------------------*\
110  Class powerLawLopesdaCosta Declaration
111 \*---------------------------------------------------------------------------*/
112 
114 :
116  public porosityModel
117 {
118  // Private data
119 
120  //- Cd coefficient
121  scalar Cd_;
122 
123  //- C1 coefficient
124  scalar C1_;
125 
126  //- Name of density field
127  word rhoName_;
128 
129 
130  // Private Member Functions
131 
132  //- Apply resistance
133  template<class RhoFieldType>
134  void apply
135  (
136  scalarField& Udiag,
137  const scalarField& V,
138  const RhoFieldType& rho,
139  const vectorField& U
140  ) const;
141 
142  //- Apply resistance
143  template<class RhoFieldType>
144  void apply
145  (
146  tensorField& AU,
147  const RhoFieldType& rho,
148  const vectorField& U
149  ) const;
150 
151 
152  //- No copy construct
154 
155  //- No copy assignment
156  void operator=(const powerLawLopesdaCosta&) = delete;
157 
158 
159 public:
160 
161  //- Runtime type information
162  TypeName("powerLawLopesdaCosta");
163 
164  //- Constructor
166  (
167  const word& name,
168  const word& modelType,
169  const fvMesh& mesh,
170  const dictionary& dict,
171  const word& cellZoneName
172  );
173 
174  //- Destructor
175  virtual ~powerLawLopesdaCosta();
176 
177 
178  // Member Functions
179 
180  //- Transform the model data wrt mesh changes
181  virtual void calcTransformModelData();
182 
183  //- Calculate the porosity force
184  virtual void calcForce
185  (
186  const volVectorField& U,
187  const volScalarField& rho,
188  const volScalarField& mu,
190  ) const;
191 
192  //- Add resistance
193  virtual void correct(fvVectorMatrix& UEqn) const;
194 
195  //- Add resistance
196  virtual void correct
197  (
199  const volScalarField& rho,
200  const volScalarField& mu
201  ) const;
202 
203  //- Add resistance
204  virtual void correct
205  (
206  const fvVectorMatrix& UEqn,
207  volTensorField& AU
208  ) const;
209 
210 
211  // I-O
212 
213  //- Write
214  bool writeData(Ostream& os) const;
215 };
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace porosityModels
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #ifdef NoRepository
226 #endif
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::porosityModels::powerLawLopesdaCostaZone::Sigma_
scalarField Sigma_
Porosity surface area per unit volume zone field.
Definition: powerLawLopesdaCosta.H:99
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::constant::physicoChemical::mu
const dimensionedScalar mu
Atomic mass unit.
Definition: createFieldRefs.H:4
Foam::porosityModel::name
const word & name() const
Return const access to the porosity model name.
Definition: porosityModelI.H:44
Foam::porosityModels::powerLawLopesdaCosta::calcForce
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
Definition: powerLawLopesdaCosta.C:337
Function1.H
Foam::porosityModels::powerLawLopesdaCosta::TypeName
TypeName("powerLawLopesdaCosta")
Runtime type information.
porosityModel.H
rho
rho
Definition: readInitialConditions.H:88
Foam::porosityModels::powerLawLopesdaCosta::writeData
bool writeData(Ostream &os) const
Write.
Definition: powerLawLopesdaCosta.C:413
Foam::porosityModels::powerLawLopesdaCostaZone::powerLawLopesdaCostaZone
powerLawLopesdaCostaZone(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Constructor.
Definition: powerLawLopesdaCosta.C:51
Foam::porosityModels::powerLawLopesdaCosta::correct
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
Definition: powerLawLopesdaCosta.C:354
Foam::porosityModel::force
virtual tmp< vectorField > force(const volVectorField &U, const volScalarField &rho, const volScalarField &mu)
Return the force over the cell zone(s)
Foam::Field< scalar >
Foam::porosityModels::powerLawLopesdaCostaZone
Definition: powerLawLopesdaCosta.H:89
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::porosityModels::powerLawLopesdaCosta::~powerLawLopesdaCosta
virtual ~powerLawLopesdaCosta()
Destructor.
Definition: powerLawLopesdaCosta.C:319
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::porosityModels::powerLawLopesdaCostaZone::Sigma
const scalarField & Sigma() const
Return the porosity surface area per unit volume zone field.
Definition: powerLawLopesdaCosta.C:326
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
powerLawLopesdaCostaTemplates.C
U
U
Definition: pEqn.H:72
Foam::porosityModel
Top level model for porosity models.
Definition: porosityModel.H:57
Foam::porosityModels::powerLawLopesdaCostaZone::zoneName_
const word zoneName_
Automatically generated zone name for this porous zone.
Definition: powerLawLopesdaCosta.H:96
Foam::porosityModels::powerLawLopesdaCosta::calcTransformModelData
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
Definition: powerLawLopesdaCosta.C:332
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
UEqn
fvVectorMatrix & UEqn
Definition: UEqn.H:13
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::porosityModel::dict
const dictionary & dict() const
Return dictionary used for model construction.
Definition: porosityModelI.H:56
Foam::porosityModels::powerLawLopesdaCosta
Variant of the power law porosity model with spatially varying drag coefficient.
Definition: powerLawLopesdaCosta.H:124