atmLengthScaleTurbSource.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::atmLengthScaleTurbSource
29 
30 Group
31  grpFvOptionsSources
32 
33 Description
34  Applies sources on either \c epsilon or \c omega to correct
35  mixing-length scale estimations 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, either of the below:
44  \verbatim
45  epsilon | Turbulent kinetic energy dissipation rate [m2/s3]
46  omega | Specific dissipation rate [1/s]
47  \endverbatim
48 
49  References:
50  \verbatim
51  Mixing-length scale limiter for epsilon (tag:AC):
52  Apsley, D. D., & Castro, I. P. (1997).
53  A limited-length-scale k-ε model for the neutral and
54  stably-stratified atmospheric boundary layer.
55  Boundary-layer meteorology, 83(1), 75-98.
56  DOI:10.1023/A:1000252210512
57 
58  Mixing-length scale limiter for omega (tag:L):
59  Langner, J. (2016).
60  Implementierung und validierung von RANS-modellen der
61  thermisch geschichteten, atmosphärischen grenzschicht.
62  Masterarbeit zum thema, Technische Universität Berlin.
63 
64  Mixing-length scale estimation (tag:P):
65  Pope, S. B. (2000).
66  Turbulent flows.
67  Cambridge, UK: Cambridge Univ. Press
68  DOI:10.1017/CBO9780511840531
69  \endverbatim
70 
71 Usage
72  Example by using \c constant/fvOptions:
73  \verbatim
74  atmLengthScaleTurbSource1
75  {
76  // Mandatory entries (unmodifiable)
77  type atmLengthScaleTurbSource;
78 
79  atmLengthScaleTurbSourceCoeffs
80  {
81  // Mandatory (inherited) entries (unmodifiable)
82  selectionMode all;
83 
84  // Optional entries (unmodifiable)
85  rho rho;
86  Lmax 41.575;
87  n 3.0;
88  }
89 
90  // Optional (inherited) entries
91  ...
92  }
93  \endverbatim
94 
95  where the entries mean:
96  \table
97  Property | Description | Type | Req'd | Dflt
98  type | Type name: atmLengthScaleTurbSource | word | yes | -
99  rho | Name of density field | word | no | rho
100  Lmax | Maximum mixing-length scale [m] | scalar | no | 41.575
101  n | Mixing-length scale exponent | scalar | no | 3.0
102  \endtable
103 
104  The inherited entries are elaborated in:
105  - \link fvOption.H \endlink
106  - \link cellSetOption.H \endlink
107 
108 See also
109  - cellSetOption.H
110 
111 SourceFiles
112  atmLengthScaleTurbSource.C
113  atmLengthScaleTurbSourceTemplates.C
114 
115 \*---------------------------------------------------------------------------*/
116 
117 #ifndef fv_atmLengthScaleTurbSource_H
118 #define fv_atmLengthScaleTurbSource_H
119 
120 #include "cellSetOption.H"
121 #include "turbulentTransportModel.H"
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 namespace Foam
126 {
127 namespace fv
128 {
129 
130 /*---------------------------------------------------------------------------*\
131  Class atmLengthScaleTurbSource Declaration
132 \*---------------------------------------------------------------------------*/
133 
134 class atmLengthScaleTurbSource
135 :
136  public fv::cellSetOption
137 {
138  // Private Data
139 
140  //- Internal flag to determine the working field is epsilon or omega
141  bool isEpsilon_;
142 
143  //- Name of density field
144  const word rhoName_;
145 
146  //- Maximum mixing-length scale [m]
147  const dimensionedScalar Lmax_;
148 
149  //- Mixing-length scale exponent
150  const dimensionedScalar n_;
151 
152  //- Required turbulence model coefficients (copied from turb model)
153  dimensionedScalar Cmu_;
154  dimensionedScalar C1_;
155  dimensionedScalar C2_;
156  dimensionedScalar C3_;
157 
158 
159  // Private Member Functions
160 
161  //- Return mixing-length scale modifier for epsilon-based models
162  tmp<volScalarField::Internal> calcC1Star
163  (
166  ) const;
167 
168  //- Return mixing-length scale modifier for omega-based models
169  tmp<volScalarField::Internal> calcGammaStar
170  (
172  const volScalarField::Internal& omega,
175  ) const;
176 
177  //- Apply atmLengthScaleTurbSource to epsilon
178  template<class AlphaFieldType, class RhoFieldType>
179  void atmLengthScaleTurbSourceEpsilon
180  (
181  const AlphaFieldType& alpha,
182  const RhoFieldType& rho,
183  fvMatrix<scalar>& eqn,
184  const label fieldi
185  ) const;
186 
187  //- Apply atmLengthScaleTurbSource to omega
188  template<class AlphaFieldType, class RhoFieldType>
189  void atmLengthScaleTurbSourceOmega
190  (
191  const AlphaFieldType& alpha,
192  const RhoFieldType& rho,
193  fvMatrix<scalar>& eqn,
194  const label fieldi
195  ) const;
196 
197 
198 public:
199 
200  //- Runtime type information
201  TypeName("atmLengthScaleTurbSource");
202 
203 
204  // Constructors
205 
206  //- Construct from explicit source name and mesh
208  (
209  const word& sourceName,
210  const word& modelType,
211  const dictionary& dict,
212  const fvMesh& mesh
213  );
214 
215  //- No copy construct
217 
218  //- No copy assignment
219  void operator=(const atmLengthScaleTurbSource&) = delete;
220 
221 
222  // Member Functions
223 
224  //- Add explicit contribution to epsilon or omega equation
225  //- for incompressible flow computations
226  virtual void addSup
227  (
228  fvMatrix<scalar>& eqn,
229  const label fieldi
230  );
231 
232  //- Add explicit contribution to epsilon or omega equation
233  //- for compressible flow computations
234  virtual void addSup
235  (
236  const volScalarField& rho,
237  fvMatrix<scalar>& eqn,
238  const label fieldi
239  );
240 
241  //- Add explicit contribution to epsilon or omega equation
242  //- for multiphase flow computations
243  virtual void addSup
244  (
245  const volScalarField& alpha,
246  const volScalarField& rho,
247  fvMatrix<scalar>& eqn,
248  const label fieldi
249  );
250 
251  //- Read source dictionary (effectively no-op)
252  virtual bool read(const dictionary& dict)
253  {
254  return true;
255  }
256 };
257 
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 } // End namespace fv
262 } // End namespace Foam
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #ifdef NoRepository
268 #endif
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 #endif
273 
274 // ************************************************************************* //
Foam::fv::atmLengthScaleTurbSource::addSup
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Definition: atmLengthScaleTurbSource.C:178
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::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
turbulentTransportModel.H
Foam::fv::atmLengthScaleTurbSource
Applies sources on either epsilon or omega to correct mixing-length scale estimations for atmospheric...
Definition: atmLengthScaleTurbSource.H:163
rho
rho
Definition: readInitialConditions.H:88
cellSetOption.H
Foam::GeometricField< scalar, fvPatchField, volMesh >::Internal
DimensionedField< scalar, volMesh > Internal
Type of the internal field from which this GeometricField is derived.
Definition: GeometricField.H:107
beta
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
atmLengthScaleTurbSourceTemplates.C
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)
Foam::fv::atmLengthScaleTurbSource::TypeName
TypeName("atmLengthScaleTurbSource")
Runtime type information.
Foam::fv::atmLengthScaleTurbSource::read
virtual bool read(const dictionary &dict)
Read source dictionary (effectively no-op)
Definition: atmLengthScaleTurbSource.H:281
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
gamma
const scalar gamma
Definition: EEqn.H:9
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
epsilon
scalar epsilon
Definition: evaluateNearWall.H:7
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::atmLengthScaleTurbSource::atmLengthScaleTurbSource
atmLengthScaleTurbSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
Definition: atmLengthScaleTurbSource.C:83
Foam::fv::atmLengthScaleTurbSource::operator=
void operator=(const atmLengthScaleTurbSource &)=delete
No copy assignment.