atmPlantCanopyTurbSource.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::atmPlantCanopyTurbSource
29 
30 Group
31  grpFvOptionsSources
32 
33 Description
34  Applies sources on either \c epsilon or \c omega to incorporate effects
35  of plant canopy for atmospheric boundary layer modelling.
36 
37  Corrections applied to either of the below, if exist:
38  \verbatim
39  epsilon | Turbulent kinetic energy dissipation rate [m^2/s^3]
40  omega | Specific dissipation rate [1/s]
41  \endverbatim
42 
43  Required fields:
44  \verbatim
45  Cd | Canopy drag coefficient [-]
46  LAD | Leaf area density [m^2/m^3]
47  epsilon | Turbulent kinetic energy dissipation rate [m^2/s^3]
48  omega | Specific dissipation rate [1/s]
49  \endverbatim
50 
51  References:
52  \verbatim
53  Influence of forest (tag:SP):
54  Sogachev, A., & Panferov, O. (2006).
55  Modification of two-equation models to account for plant drag.
56  Boundary-Layer Meteorology, 121(2), 229-266.
57  DOI:10.1007/s10546-006-9073-5
58  \endverbatim
59 
60 Usage
61  Example by using \c constant/fvOptions:
62  \verbatim
63  atmPlantCanopyTurbSource1
64  {
65  // Mandatory entries
66  type atmPlantCanopyTurbSource;
67 
68  // Optional entries
69  Cd <word>;
70  LAD <word>;
71 
72  // Inherited entries
73  ...
74  }
75  \endverbatim
76 
77  where the entries mean:
78  \table
79  Property | Description | Type | Reqd | Deflt
80  type | Type name: atmPlantCanopyTurbSource | word | yes | -
81  Cd | Name of operand canopy drag coefficient field | word | no | Cd
82  LAD | Name of operand leaf area density field | word | no | LAD
83  \endtable
84 
85  The inherited entries are elaborated in:
86  - \link fvOption.H \endlink
87  - \link cellSetOption.H \endlink
88 
89 SourceFiles
90  atmPlantCanopyTurbSource.C
91  atmPlantCanopyTurbSourceTemplates.C
92 
93 \*---------------------------------------------------------------------------*/
94 
95 #ifndef fv_atmPlantCanopyTurbSource_H
96 #define fv_atmPlantCanopyTurbSource_H
97 
98 #include "cellSetOption.H"
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 namespace fv
106 {
107 
108 /*---------------------------------------------------------------------------*\
109  Class atmPlantCanopyTurbSource Declaration
110 \*---------------------------------------------------------------------------*/
111 
112 class atmPlantCanopyTurbSource
113 :
114  public fv::cellSetOption
115 {
116  // Private Data
117 
118  //- Internal flag to determine the working field is epsilon or omega
119  Switch isEpsilon_;
120 
121  //- Required turbulence model coefficients (copied from turb model)
122  dimensionedScalar Cmu_;
123  dimensionedScalar C1_;
124  dimensionedScalar C2_;
125 
126  //- Name of operand canopy drag coefficient field
127  word CdName_;
128 
129  //- Name of operand leaf area density field
130  word LADname_;
132 
133  // Private Member Functions
134 
135  //- Return requested field from the object registry
136  //- or read+register the field to the object registry
137  volScalarField& getOrReadField(const word& fieldName) const;
138 
139  //- Return the modifier for plant canopy effects
140  tmp<volScalarField::Internal> calcPlantCanopyTerm
141  (
143  ) const;
144 
145  //- Apply atmPlantCanopyTurbSource to epsilon
146  template<class AlphaFieldType, class RhoFieldType>
147  void atmPlantCanopyTurbSourceEpsilon
148  (
149  const AlphaFieldType& alpha,
150  const RhoFieldType& rho,
151  fvMatrix<scalar>& eqn,
152  const label fieldi
153  ) const;
154 
155  //- Apply atmPlantCanopyTurbSource to omega
156  template<class AlphaFieldType, class RhoFieldType>
157  void atmPlantCanopyTurbSourceOmega
158  (
159  const AlphaFieldType& alpha,
160  const RhoFieldType& rho,
161  fvMatrix<scalar>& eqn,
162  const label fieldi
163  ) const;
164 
165 
166 public:
167 
168  //- Runtime type information
169  TypeName("atmPlantCanopyTurbSource");
170 
171 
172  // Constructors
173 
174  //- Construct from explicit source name and mesh
176  (
177  const word& sourceName,
178  const word& modelType,
179  const dictionary& dict,
180  const fvMesh& mesh
181  );
182 
183  //- No copy construct
185 
186  //- No copy assignment
187  void operator=(const atmPlantCanopyTurbSource&) = delete;
188 
189 
190  // Member Functions
191 
192  //- Add explicit contribution to epsilon or omega equation
193  //- for incompressible flow computations
194  virtual void addSup
195  (
196  fvMatrix<scalar>& eqn,
197  const label fieldi
198  );
199 
200  //- Add explicit contribution to epsilon or omega equation
201  //- for compressible flow computations
202  virtual void addSup
203  (
204  const volScalarField& rho,
205  fvMatrix<scalar>& eqn,
206  const label fieldi
207  );
208 
209  //- Add explicit contribution to epsilon or omega equation
210  //- for multiphase flow computations
211  virtual void addSup
212  (
213  const volScalarField& alpha,
214  const volScalarField& rho,
215  fvMatrix<scalar>& eqn,
216  const label fieldi
217  );
218 
219  //- Read source dictionary
220  virtual bool read(const dictionary& dict);
221 };
222 
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 } // End namespace fv
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #ifdef NoRepository
233 #endif
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #endif
238 
239 // ************************************************************************* //
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:129
void operator=(const atmPlantCanopyTurbSource &)=delete
No copy assignment.
A class for handling words, derived from Foam::string.
Definition: word.H:63
labelList fv(nPoints)
TypeName("atmPlantCanopyTurbSource")
Runtime type information.
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< scalar > &eqn, const label fieldi)
Add explicit contribution to epsilon or omega equation for incompressible flow computations.
Applies sources on either epsilon or omega to incorporate effects of plant canopy for atmospheric bou...
U
Definition: pEqn.H:72
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: HashPtrTable.H:50
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
virtual bool read(const dictionary &dict)
Read source dictionary.
atmPlantCanopyTurbSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
Namespace for OpenFOAM.