atmPlantCanopyUSource.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) 2020 ENERCON GmbH
9  Copyright (C) 2020-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fv::atmPlantCanopyUSource
29 
30 Group
31  grpFvOptionsSources
32 
33 Description
34  Applies sources on velocity (i.e. \c U) to incorporate effects
35  of plant canopy for atmospheric boundary layer modelling.
36 
37  Corrections applied to:
38  \verbatim
39  U | Velocity [m/s]
40  \endverbatim
41 
42  Required fields:
43  \verbatim
44  U | Velocity [m/s]
45  Cd | Plant canopy drag coefficient [-]
46  LAD | Leaf area density [1/m]
47  \endverbatim
48 
49  References:
50  \verbatim
51  Influence of forest (tag:SP):
52  Sogachev, A., & Panferov, O. (2006).
53  Modification of two-equation models to account for plant drag.
54  Boundary-Layer Meteorology, 121(2), 229-266.
55  DOI:10.1007/s10546-006-9073-5
56 
57  Governing equations (tag:BSG):
58  Brozovsky, J., Simonsen, A., & Gaitani, N. (2021).
59  Validation of a CFD model for the evaluation of urban microclimate
60  at high latitudes: A case study in Trondheim, Norway.
61  Building and Environment, 205, 108175.
62  DOI:10.1016/j.buildenv.2021.108175
63  \endverbatim
64 
65 Usage
66  Example by using \c constant/fvOptions:
67  \verbatim
68  atmPlantCanopyUSource1
69  {
70  // Mandatory entries
71  type atmPlantCanopyUSource;
72 
73  // Optional entries
74  Cd <word>;
75  LAD <word>;
76 
77  // Inherited entries
78  ...
79  }
80  \endverbatim
81 
82  where the entries mean:
83  \table
84  Property | Description | Type | Reqd | Deflt
85  type | Type name: atmPlantCanopyUSource | word | yes | -
86  Cd | Name of operand canopy drag coefficient field | word | no | Cd
87  LAD | Name of operand leaf area density field | word | no | LAD
88  \endtable
89 
90  The inherited entries are elaborated in:
91  - \link fvOption.H \endlink
92  - \link cellSetOption.H \endlink
93 
94 SourceFiles
95  atmPlantCanopyUSource.C
96  atmPlantCanopyUSourceTemplates.C
97 
98 \*---------------------------------------------------------------------------*/
99 
100 #ifndef fv_atmPlantCanopyUSource_H
101 #define fv_atmPlantCanopyUSource_H
102 
103 #include "cellSetOption.H"
104 #include "fvMatrices.H"
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 namespace Foam
109 {
110 namespace fv
111 {
112 
113 /*---------------------------------------------------------------------------*\
114  Class atmPlantCanopyUSource Declaration
115 \*---------------------------------------------------------------------------*/
116 
117 class atmPlantCanopyUSource
118 :
119  public fv::cellSetOption
120 {
121  // Private Data
122 
123  //- Name of operand canopy drag coefficient field
124  word CdName_;
125 
126  //- Name of operand leaf area density field
127  word LADname_;
128 
129 
130  // Private Member Functions
131 
132  //- Return requested field from the object registry
133  //- or read+register the field to the object registry
134  volScalarField& getOrReadField(const word& fieldName) const;
135 
137 public:
138 
139  //- Runtime type information
140  TypeName("atmPlantCanopyUSource");
141 
142 
143  // Constructors
144 
145  //- Construct from explicit source name and mesh
147  (
148  const word& sourceName,
149  const word& modelType,
150  const dictionary& dict,
151  const fvMesh& mesh
152  );
153 
154  //- No copy construct
156 
157  //- No copy assignment
158  void operator=(const atmPlantCanopyUSource&) = delete;
159 
160 
161  // Member Functions
162 
163  //- Add explicit contribution to momentum equation
164  virtual void addSup
165  (
166  fvMatrix<vector>& eqn,
167  const label fieldi
168  );
169 
170  //- Add explicit contribution to compressible momentum equation
171  virtual void addSup
172  (
173  const volScalarField& rho,
174  fvMatrix<vector>& eqn,
175  const label fieldi
176  );
177 
178  //- Add explicit contribution to phase momentum equation
179  virtual void addSup
180  (
181  const volScalarField& alpha,
182  const volScalarField& rho,
183  fvMatrix<vector>& eqn,
184  const label fieldi
185  );
186 
187  //- Read source dictionary
188  virtual bool read(const dictionary& dict);
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace fv
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
dictionary dict
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:30
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
atmPlantCanopyUSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:84
Applies sources on velocity (i.e. U) to incorporate effects of plant canopy for atmospheric boundary ...
A class for handling words, derived from Foam::string.
Definition: word.H:63
labelList fv(nPoints)
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:64
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add explicit contribution to momentum equation.
void operator=(const atmPlantCanopyUSource &)=delete
No copy assignment.
virtual bool read(const dictionary &dict)
Read source dictionary.
TypeName("atmPlantCanopyUSource")
Runtime type information.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:79
A special matrix type and solver, designed for finite volume solutions of scalar equations.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Namespace for OpenFOAM.