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 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 [m2/s3]
40  omega | Specific dissipation rate [1/s]
41  \endverbatim
42 
43  Required fields:
44  \verbatim
45  epsilon/omega | Dissipation rate OR Spec. dissipation rate [m2/s3]/[1/s]
46  plantCd | Plant canopy drag coefficient [-]
47  leafAreaDensity | Leaf area density [1/m]
48  \endverbatim
49 
50  References:
51  \verbatim
52  Influence of forest (tag:SP):
53  Sogachev, A., & Panferov, O. (2006).
54  Modification of two-equation models to account for plant drag.
55  Boundary-Layer Meteorology, 121(2), 229-266.
56  DOI:10.1007/s10546-006-9073-5
57  \endverbatim
58 
59 Usage
60  Example by using \c constant/fvOptions:
61  \verbatim
62  atmPlantCanopyTurbSource1
63  {
64  // Mandatory entries (unmodifiable)
65  type atmPlantCanopyTurbSource;
66 
67  atmPlantCanopyTurbSourceCoeffs
68  {
69  // Mandatory (inherited) entries (unmodifiable)
70  selectionMode all;
71 
72  // Optional entries (unmodifiable)
73  rho rho;
74  }
75 
76  // Optional (inherited) entries
77  ...
78  }
79  \endverbatim
80 
81  where the entries mean:
82  \table
83  Property | Description | Type | Req'd | Dflt
84  type | Type name: atmPlantCanopyTurbSource | word | yes | -
85  rho | Name of density field | word | no | rho
86  \endtable
87 
88  The inherited entries are elaborated in:
89  - \link fvOption.H \endlink
90  - \link cellSetOption.H \endlink
91 
92 SourceFiles
93  atmPlantCanopyTurbSource.C
94  atmPlantCanopyTurbSourceTemplates.C
95 
96 \*---------------------------------------------------------------------------*/
97 
98 #ifndef fv_atmPlantCanopyTurbSource_H
99 #define fv_atmPlantCanopyTurbSource_H
100 
101 #include "cellSetOption.H"
102 #include "turbulentTransportModel.H"
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 namespace Foam
107 {
108 namespace fv
109 {
110 
111 /*---------------------------------------------------------------------------*\
112  Class atmPlantCanopyTurbSource Declaration
113 \*---------------------------------------------------------------------------*/
114 
115 class atmPlantCanopyTurbSource
116 :
117  public fv::cellSetOption
118 {
119  // Private Data
120 
121  //- Internal flag to determine the working field is epsilon or omega
122  Switch isEpsilon_;
123 
124  //- Name of density field
125  const word rhoName_;
126 
127  //- Required turbulence model coefficients (copied from turb model)
128  dimensionedScalar Cmu_;
129  dimensionedScalar C1_;
130  dimensionedScalar C2_;
131 
132 
133  // Fields
134 
135  //- Plant canopy drag coefficient field [-]
136  volScalarField plantCd_;
137 
138  //- Leaf area density field [1/m]
139  volScalarField leafAreaDensity_;
140 
141 
142  // Private Member Functions
143 
144  //- Return the modifier for plant canopy effects
145  tmp<volScalarField::Internal> calcPlantCanopyTerm
146  (
148  ) const;
149 
150  //- Apply atmPlantCanopyTurbSource to epsilon
151  template<class AlphaFieldType, class RhoFieldType>
152  void atmPlantCanopyTurbSourceEpsilon
153  (
154  const AlphaFieldType& alpha,
155  const RhoFieldType& rho,
156  fvMatrix<scalar>& eqn,
157  const label fieldi
158  ) const;
159 
160  //- Apply atmPlantCanopyTurbSource to omega
161  template<class AlphaFieldType, class RhoFieldType>
162  void atmPlantCanopyTurbSourceOmega
163  (
164  const AlphaFieldType& alpha,
165  const RhoFieldType& rho,
166  fvMatrix<scalar>& eqn,
167  const label fieldi
168  ) const;
169 
170 
171 public:
172 
173  //- Runtime type information
174  TypeName("atmPlantCanopyTurbSource");
175 
176 
177  // Constructors
178 
179  //- Construct from explicit source name and mesh
181  (
182  const word& sourceName,
183  const word& modelType,
184  const dictionary& dict,
185  const fvMesh& mesh
186  );
187 
188  //- No copy construct
190 
191  //- No copy assignment
192  void operator=(const atmPlantCanopyTurbSource&) = delete;
193 
194 
195  // Member Functions
196 
197  //- Add explicit contribution to epsilon or omega equation
198  //- for incompressible flow computations
199  virtual void addSup
200  (
201  fvMatrix<scalar>& eqn,
202  const label fieldi
203  );
204 
205  //- Add explicit contribution to epsilon or omega equation
206  //- for compressible flow computations
207  virtual void addSup
208  (
209  const volScalarField& rho,
210  fvMatrix<scalar>& eqn,
211  const label fieldi
212  );
213 
214  //- Add explicit contribution to epsilon or omega equation
215  //- for multiphase flow computations
216  virtual void addSup
217  (
218  const volScalarField& alpha,
219  const volScalarField& rho,
220  fvMatrix<scalar>& eqn,
221  const label fieldi
222  );
223 
224  //- Read source dictionary (effectively no-op)
225  virtual bool read(const dictionary& dict)
226  {
227  return true;
228  }
229 };
230 
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 } // End namespace fv
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #ifdef NoRepository
241 #endif
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #endif
246 
247 // ************************************************************************* //
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::cellSetOption
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Definition: cellSetOption.H:163
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fv::atmPlantCanopyTurbSource::read
virtual bool read(const dictionary &dict)
Read source dictionary (effectively no-op)
Definition: atmPlantCanopyTurbSource.H:242
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
turbulentTransportModel.H
Foam::fv::atmPlantCanopyTurbSource::addSup
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Definition: atmPlantCanopyTurbSource.C:151
rho
rho
Definition: readInitialConditions.H:88
cellSetOption.H
Foam::GeometricField< vector, fvPatchField, volMesh >::Internal
DimensionedField< vector, volMesh > Internal
Type of the internal field from which this GeometricField is derived.
Definition: GeometricField.H:107
Foam::fv::atmPlantCanopyTurbSource::atmPlantCanopyTurbSource
atmPlantCanopyTurbSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
Definition: atmPlantCanopyTurbSource.C:60
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::dimensioned< scalar >
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
U
U
Definition: pEqn.H:72
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::atmPlantCanopyTurbSource::TypeName
TypeName("atmPlantCanopyTurbSource")
Runtime type information.
atmPlantCanopyTurbSourceTemplates.C
Foam::fv::atmPlantCanopyTurbSource::operator=
void operator=(const atmPlantCanopyTurbSource &)=delete
No copy assignment.
Foam::fv::atmPlantCanopyTurbSource
Applies sources on either epsilon or omega to incorporate effects of plant canopy for atmospheric bou...
Definition: atmPlantCanopyTurbSource.H:132