kL.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) 2021 OpenCFD Ltd.
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::RASModels::kL
28 
29 Group
30  grpRASTurbulence
31 
32 Description
33  A one-equation (turbulent kinetic energy \c k) turbulence closure
34  model for incompressible and compressible geophysical applications.
35 
36  Turbulent kinetic energy (\c k) is computed with a transport equation
37  and the turbulent length scale (\c L) is computed with an algebraic
38  expression which depends on the local stratification.
39 
40  References:
41  \verbatim
42  Standard model (tag:A):
43  Axell, L. B., & Liungman, O. (2001).
44  A one-equation turbulence model for geophysical applications:
45  comparison with data and the k−ε model.
46  Environmental Fluid Mechanics, 1(1), 71-106.
47  DOI:10.1023/A:1011560202388
48 
49  Canopy-related models (tag:W):
50  Wilson, J. D., & Flesch, T. K. (1999).
51  Wind and remnant tree sway in forest cutblocks.
52  III. A windflow model to diagnose spatial variation.
53  Agricultural and Forest Meteorology, 93(4), 259-282.
54  DOI:10.1016/S0168-1923(98)00121-X
55  \endverbatim
56 
57 Usage
58  Example by using \c constant/turbulenceProperties:
59  \verbatim
60  RAS
61  {
62  // Mandatory entries
63  RASModel kL;
64 
65  // Optional entries
66  kLCoeffs
67  {
68  kappa <scalar>;
69  sigmak <scalar>;
70  beta <scalar>;
71  Cmu0 <scalar>;
72  Lmax <scalar>;
73  CbStable <scalar>;
74  CbUnstable <scalar>;
75  }
76 
77  // Inherited entries
78  ...
79  }
80  \endverbatim
81 
82  where the entries mean:
83  \table
84  Property | Description | Type | Reqd | Deflt
85  RASModel | Type name: kL | word | yes | -
86  kappa | von Karman constant | scalar | no | 0.41
87  sigmak | Empirical model coefficient | scalar | no | 1.0
88  beta | Thermal expansion coefficient [1/K] | scalar | no | 3.3e-3
89  Cmu0 | Empirical model coefficient | scalar | no | 0.556
90  Lmax | Maximum mixing-length scale [m] | scalar | no | GREAT
91  CbStable | Stable stratification constant | scalar | no | 0.25
92  CbUnstable | Unstable stratification constant | scalar | no | 0.35
93  \endtable
94 
95  The inherited entries are elaborated in:
96  - \link eddyViscosity.H \endlink
97 
98  \heading Input fields (mandatory)
99  \plaintable
100  k | Turbulent kinetic energy [m2/s2]
101  T | Potential temperature [K]
102  \endplaintable
103 
104  \heading Input fields (optional)
105  \plaintable
106  canopyHeight | Canopy height [m]
107  plantCd | Plant canopy drag coefficient [-]
108  leafAreaDensity | Leaf area density [1/m]
109  Rt | Turbulent Richardson number [-]
110  L | Characteristic length scale [m]
111  \endplaintable
112 
113 Note
114  - Optional input fields can/should be input
115  by using \c readFields function object.
116 
117 SourceFiles
118  kL.C
119 
120 \*---------------------------------------------------------------------------*/
121 
122 #ifndef kL_H
123 #define kL_H
124 
125 #include "RASModel.H"
126 #include "eddyViscosity.H"
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 namespace Foam
132 {
133 namespace RASModels
134 {
135 
136 /*---------------------------------------------------------------------------*\
137  Class kL Declaration
138 \*---------------------------------------------------------------------------*/
139 
140 template<class BasicTurbulenceModel>
141 class kL
142 :
143  public eddyViscosity<RASModel<BasicTurbulenceModel>>
144 {
145  // Private Member Functions
146 
147  //- Return modified stability function of Launder,
148  //- calibrated with the results of Hogstrom (A:Eq. 31)
149  tmp<volScalarField> Cmu() const;
150 
151  //- Return modified stability function of Launder,
152  //- calibrated with the results of Hogstrom (A:Eq. 32)
153  tmp<volScalarField> CmuPrime() const;
154 
155  //- Return eddy diffusivity (A:Eq. 12)
156  tmp<volScalarField> nutPrime() const;
157 
158  //- Return turbulent kinetic energy dissipation rate due to canopy
159  tmp<volScalarField> epsilonCanopy() const;
160 
161  //- Return turbulent kinetic energy
162  //- dissipation rate due to plains and canopy
163  tmp<volScalarField> epsilon() const;
164 
165  //- Return canopy height
166  tmp<volScalarField> canopyHeight() const;
167 
168  //- Return characteristic length scale
169  tmp<volScalarField> L() const;
170 
171  //- Modify characteristic length scale
172  //- according to the specified stratification
173  void stratification(const volScalarField& fVB);
174 
175  // Generated Methods
176 
177  //- No copy construct
178  kL(const kL&) = delete;
179 
180  //- No copy assignment
181  void operator=(const kL&) = delete;
182 
183 
184 protected:
185 
186  // Protected Data
187 
188  // Model coefficients
189 
190  //- von Karman constant
192 
193  //- Empirical model coefficient
195 
196  //- Thermal expansion coefficient [1/K]
198 
199  //- Empirical model coefficient
201 
202  //- Maximum mixing-length scalar [m]
204 
205  //- Stable stratification constant
207 
208  //- Unstable stratification constant
210 
211 
212  // Fields
213 
214  //- Turbulent kinetic energy [m2/s2]
216 
217  //- Characteristic length scale [m]
219 
220  //- Turbulent Richardson number [-]
222 
223  //- Gravitational acceleration [m2/s2]
225 
226  //- Wall distance
227  // Note: different to wall distance in parent RASModel
228  // which is for near-wall cells only
229  const volScalarField& y_;
230 
231 
232  // Protected Member Functions
233 
234  //- Correct the turbulence viscosity
235  virtual void correctNut();
236 
237  //- Add explicit source for turbulent kinetic energy
238  virtual tmp<fvScalarMatrix> kSource() const;
239 
240 
241 public:
242 
243  typedef typename BasicTurbulenceModel::alphaField alphaField;
244  typedef typename BasicTurbulenceModel::rhoField rhoField;
245  typedef typename BasicTurbulenceModel::transportModel transportModel;
246 
247 
248  //- Runtime type information
249  TypeName("kL");
250 
251 
252  // Constructors
253 
254  //- Construct from components
255  kL
256  (
257  const alphaField& alpha,
258  const rhoField& rho,
259  const volVectorField& U,
260  const surfaceScalarField& alphaRhoPhi,
261  const surfaceScalarField& phi,
262  const transportModel& transport,
263  const word& propertiesName = turbulenceModel::propertiesName,
264  const word& type = typeName
265  );
266 
267 
268  //- Destructor
269  virtual ~kL() = default;
270 
271 
272  // Member Functions
273 
274  //- Re-read model coefficients if they have changed
275  virtual bool read();
276 
277  //- Return the effective diffusivity for k
279  {
281  (
282  "DkEff",
283  (this->nut_/sigmak_ + this->nu())
284  );
285  }
286 
287  //- Return the turbulent kinetic energy field
288  virtual tmp<volScalarField> k() const
289  {
290  return k_;
291  }
292 
293  //- Solve the turbulence equations and correct the turbulence viscosity
294  virtual void correct();
295 };
296 
297 
298 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
299 
300 } // End namespace RASModels
301 } // End namespace Foam
302 
303 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
304 
305 #ifdef NoRepository
306  #include "kL.C"
307 #endif
308 
309 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310 
311 #endif
312 
313 // ************************************************************************* //
Foam::RASModels::kL::Rt_
volScalarField Rt_
Turbulent Richardson number [-].
Definition: kL.H:302
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::RASModels::kL::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: kL.H:326
Foam::RASModels::kL::y_
const volScalarField & y_
Wall distance.
Definition: kL.H:310
Foam::RASModels::kL::correct
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
Definition: kL.C:412
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::RASModels::kL::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: kL.H:325
Foam::RASModels::kL::L_
volScalarField L_
Characteristic length scale [m].
Definition: kL.H:299
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::turbulenceModel::propertiesName
static const word propertiesName
Default name of the turbulence properties dictionary.
Definition: turbulenceModel.H:100
Foam::RASModels::kL::beta_
dimensionedScalar beta_
Thermal expansion coefficient [1/K].
Definition: kL.H:278
Foam::RASModels::kL::k_
volScalarField k_
Turbulent kinetic energy [m2/s2].
Definition: kL.H:296
Foam::RASModels::kL::kSource
virtual tmp< fvScalarMatrix > kSource() const
Add explicit source for turbulent kinetic energy.
Definition: kL.C:236
Foam::RASModels::kL::correctNut
virtual void correctNut()
Correct the turbulence viscosity.
Definition: kL.C:225
Foam::RASModels::kL::kappa_
dimensionedScalar kappa_
von Karman constant
Definition: kL.H:272
rho
rho
Definition: readInitialConditions.H:88
Foam::RASModels::kL::g_
const uniformDimensionedVectorField & g_
Gravitational acceleration [m2/s2].
Definition: kL.H:305
Foam::RASModels::kL::read
virtual bool read()
Re-read model coefficients if they have changed.
Definition: kL.C:392
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
eddyViscosity.H
Foam::UniformDimensionedField< vector >
Foam::RASModels::kL::Cmu0_
dimensionedScalar Cmu0_
Empirical model coefficient.
Definition: kL.H:281
Foam::RASModels::kL::TypeName
TypeName("kL")
Runtime type information.
Foam::RASModels::kL
A one-equation (turbulent kinetic energy k) turbulence closure model for incompressible and compressi...
Definition: kL.H:222
Foam::RASModels::kL::Lmax_
dimensionedScalar Lmax_
Maximum mixing-length scalar [m].
Definition: kL.H:284
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::RASModels::kL::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: kL.H:324
RASModel.H
Foam::dimensioned< scalar >
Foam::RASModels::kL::DkEff
tmp< volScalarField > DkEff() const
Return the effective diffusivity for k.
Definition: kL.H:359
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::RASModels::kL::k
virtual tmp< volScalarField > k() const
Return the turbulent kinetic energy field.
Definition: kL.H:369
Foam::RASModels::kL::sigmak_
dimensionedScalar sigmak_
Empirical model coefficient.
Definition: kL.H:275
uniformDimensionedFields.H
U
U
Definition: pEqn.H:72
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Foam::eddyViscosity
Eddy viscosity turbulence model base class.
Definition: eddyViscosity.H:55
Foam::RASModels::kL::CbUnstable_
dimensionedScalar CbUnstable_
Unstable stratification constant.
Definition: kL.H:290
kL.C
Foam::RASModels::kL::CbStable_
dimensionedScalar CbStable_
Stable stratification constant.
Definition: kL.H:287
Foam::eddyViscosity< RASModel< BasicTurbulenceModel > >::nut_
volScalarField nut_
Definition: eddyViscosity.H:66
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::RASModels::kL::~kL
virtual ~kL()=default
Destructor.