dalpeMassonCanopySource.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 | Copyright (C) 2015-2017 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  Copyright is held by the author.
25 
26 Class
27  Foam::fv::dalpeMassonCanopySource
28 
29 Group
30  grpFvOptionsSources
31 
32 Author
33  David Segersson, Swedish Meteorological and Hydrological Institute, david.segersson@smhi.se
34 
35 Description
36 
37  Momentum source term is expressed as:
38  \f[
39  S_u = -\rho C_d \alpha u^2
40  \f]
41 
42  Source term for k is expressed as:
43 
44  \f[
45  S_k = \rho C_d \alpha \left(\beta_p u^3 - \beta_d k u \right)
46  \f]
47 
48  Source term for epsilon is expressed as:
49 
50  \f[
51  S_{\epsilon}=\rho C_d \alpha \frac{\epsilon}{k} \left(C_{\epsilon 4} \beta_p u^3 - C_{\epsilon 5} \beta_d k u \right)
52  \f]
53 
54  where
55  \beta_p (1.0), \betad_d (5.03), C_{\epsilon 4} (0.78) and C_{epsilon 5} (0.78) are dimensionless coefficients
56  \vartable
57  \rho | density
58  u | magnitude of velocity
59  k | turbulent kinetic energy
60  \alpha | leaf area density [m]
61  C_d | tree canopy drag coefficient
62  \endvartable
63 
64  Use with any variant of the k-\epsilon turbulence model.
65 
66  Reference:
67  Momentum and turbulence source/sink-terms for tree canopy according to
68  B. DalpĂ© and C. Masson. Numerical simulation of wind flow near a forest
69  edge. J. of Wind Eng. and Ind. Aerodyn, 2006
70 
71 
72 Usage
73  Example usage:
74  \verbatim
75  canopy
76  {
77  type dalpeMassonCanopySource;
78  active on; // toggle the option
79  writeFields on; // write to disk
80  readLanduseFromRaster on; // read landuse from raster
81  readCanopyHeightFromRaster on; // read canopy height from raster
82  sourcePatches (ground forest); // for which patches to set landuse
83  patchLanduse (0 1); // landuse code per patch (if not read from raster)
84 
85  landuse
86  {
87 
88  low_birch // name of landuse class
89  {
90  code 1; // code of landuse class
91  Cd 0.2; // drag coefficient of trees
92  LAI 2.15; // Leaf Area Index (used if LADmax is not specified)
93  LADmax 1.2; // Maximum Leaf Area Density [m ^-1]
94  z0 0.06; // roughness length [m]
95  height 7.5; // tree canopy height (if not read from raster)
96 
97  // Vertical profile of Leaf Area Density
98  // first value is closest to ground
99  // each value represents an equal share of the tree height
100  // e.g. for a 4 m tree and 4 values, each value will represent 1 m
101  // values are scaled so that the highest will correspond to LADMax
102 
103  LADProfile ( 0.05 0.1 0.15 0.35 1.1 0.9 0.5 0.2 0.15 0.05 0.01 );
104  };
105 
106  grass
107  {
108  code 0;
109  Cd 0.2;
110  LAI 0;
111  z0 0.06;
112  height 0;
113  LADProfile ( 0.05 0.1 0.15 0.35 1.1 0.9 0.5 0.2 0.15 0.05 0.01 );
114  };
115 
116  };
117  }
118  \endverbatim
119 
120 SourceFiles
121  dalpeMassonCanopySource.C
122 
123 \*---------------------------------------------------------------------------*/
124 
125 #ifndef dalpeMassonCanopySource_H
126 #define dalpeMassonCanopySource_H
127 
128 #include "fvOption.H"
129 #include "dimensionedTypes.H"
130 #include "wallFvPatch.H"
131 #include "canopySource.H"
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 namespace Foam
136 {
137 namespace fv
138 {
139 
140 /*---------------------------------------------------------------------------*\
141  Class dalpeMassonCanopySource Declaration
142 \*---------------------------------------------------------------------------*/
143 
144 class dalpeMassonCanopySource
145 :
146  public canopySource
147 {
148 private:
149 
150  // Canopy coefficients
155 
156  //- Disallow default bitwise copy construct
158 
159  //- Disallow default bitwise assignment
160  void operator=(const dalpeMassonCanopySource&);
161 
162 
163  //- Source term to momentum equation
164  template<class RhoFieldType>
165  void addSup
166  (
167  const RhoFieldType& rho,
168  fvMatrix<vector>& eqn,
169  const label fieldi
170  );
171 
172  template<class RhoFieldType>
173  void addSup
174  (
175  const RhoFieldType& rho,
176  fvMatrix<scalar>& eqn,
177  const label fieldi
178  );
179 
180 
181  // Private Member Functions
182 
183 
184 public:
185 
186 
187  //- Runtime type information
188  TypeName("dalpeMassonCanopySource");
189 
190 
191  // Constructors
192 
193  //- Construct from components
195  (
196  const word& name,
197  const word& modelType,
198  const dictionary& dict,
199  const fvMesh& mesh
200  );
201 
202 
203  //- Destructor
204  virtual ~dalpeMassonCanopySource()
205  {}
206 
207 
208  // Member Functions
209  // access
210 
211  dimensionedScalar betaP() const
212  {
213  return betaP_;
214  }
215 
216  dimensionedScalar betaD() const
217  {
218  return betaD_;
219  }
220 
221  dimensionedScalar C4() const
222  {
223  return C4_;
224  }
225 
226  dimensionedScalar C5() const
227  {
228  return C5_;
229  }
230 
231  // add source terms to momentum equations
232  void addSup
233  (
234  const volScalarField& rho,
236  const label fieldi
237  );
238 
239  void addSup
240  (
241  fvMatrix<vector>& eqn,
242  const label fieldi
243  );
244 
245 
246  //- Source term to scalar equations (k & epsilon)
247  void addSup
248  (
249  fvMatrix<scalar>& eqn,
250  const label fieldi
251  );
252 
253  //- Source term to compressible scalar equation (k & epsilon)
254  void addSup
255  (
256  const volScalarField& rho,
257  fvMatrix<scalar>& eqn,
258  const label fieldi
259  );
260 
261 };
262 
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 } // End namespace fv
267 } // End namespace Foam
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 #endif
272 
273 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fv::dalpeMassonCanopySource::TypeName
TypeName("dalpeMassonCanopySource")
Runtime type information.
Foam::fv::dalpeMassonCanopySource::C4_
dimensionedScalar C4_
Definition: dalpeMassonCanopySource.H:172
Foam::fv::option::name
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
wallFvPatch.H
Foam::fv::dalpeMassonCanopySource::betaP
dimensionedScalar betaP() const
Definition: dalpeMassonCanopySource.H:230
Foam::fv::dalpeMassonCanopySource::betaD_
dimensionedScalar betaD_
Definition: dalpeMassonCanopySource.H:171
Foam::fv::dalpeMassonCanopySource::C4
dimensionedScalar C4() const
Definition: dalpeMassonCanopySource.H:240
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::fv::canopySource
Base class for momentum and turbulence source/sink-terms for tree canopy.
Definition: canopySource.H:119
Foam::fv::dalpeMassonCanopySource::addSup
void addSup(const RhoFieldType &rho, fvMatrix< vector > &eqn, const label fieldi)
Source term to momentum equation.
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
Foam::fv::dalpeMassonCanopySource::C5_
dimensionedScalar C5_
Definition: dalpeMassonCanopySource.H:173
Foam::fv::dalpeMassonCanopySource::betaP_
dimensionedScalar betaP_
Definition: dalpeMassonCanopySource.H:170
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::fv::dalpeMassonCanopySource::C5
dimensionedScalar C5() const
Definition: dalpeMassonCanopySource.H:245
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fv::dalpeMassonCanopySource
Momentum source term is expressed as:
Definition: dalpeMassonCanopySource.H:163
rho
rho
Definition: pEqn.H:3
fv
labelList fv(nPoints)
Foam::fv::dalpeMassonCanopySource::dalpeMassonCanopySource
dalpeMassonCanopySource(const dalpeMassonCanopySource &)
Disallow default bitwise copy construct.
Foam::fv::dalpeMassonCanopySource::~dalpeMassonCanopySource
virtual ~dalpeMassonCanopySource()
Destructor.
Definition: dalpeMassonCanopySource.H:223
fvOption.H
Foam::fv::dalpeMassonCanopySource::operator=
void operator=(const dalpeMassonCanopySource &)
Disallow default bitwise assignment.
Foam::fv::option::mesh
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
dimensionedTypes.H
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::fv::dalpeMassonCanopySource::betaD
dimensionedScalar betaD() const
Definition: dalpeMassonCanopySource.H:235