atmAmbientTurbSource.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::atmAmbientTurbSource
29 
30 Group
31  grpFvOptionsSources
32 
33 Description
34  Applies sources on \c k and either \c epsilon or \c omega to prevent them
35  droping below a specified ambient value for atmospheric boundary
36  layer modelling. Such adjustment reportedly increases numerical
37  stability for very stable atmospheric stability conditions, and prevents
38  nonphysical oscillations in regions of low shear at higher altitudes.
39 
40  Corrections applied to:
41  \verbatim
42  k | Turbulent kinetic energy [m2/s2]
43  \endverbatim
44 
45  Corrections applied to either of the below, if exist:
46  \verbatim
47  epsilon | Turbulent kinetic energy dissipation rate [m2/s3]
48  omega | Specific dissipation rate [1/s]
49  \endverbatim
50 
51  Required fields:
52  \verbatim
53  k | Turbulent kinetic energy [m2/s2]
54  epsilon/omega | Dissipation rate OR Spec. dissipation rate [m2/s3]/[1/s]
55  \endverbatim
56 
57  References:
58  \verbatim
59  Background turbulence (tag:RS):
60  Rumsey, C. L., & Spalart, P. R. (2009).
61  Turbulence model behavior in low Reynolds number
62  regions of aerodynamic flowfields.
63  AIAA journal, 47(4), 982-993.
64  DOI:10.2514/1.39947
65  \endverbatim
66 
67 Usage
68  Example by using \c constant/fvOptions:
69  \verbatim
70  atmAmbientTurbSource1
71  {
72  // Mandatory entries (unmodifiable)
73  type atmAmbientTurbSource;
74 
75  atmAmbientTurbSourceCoeffs
76  {
77  // Mandatory (inherited) entries (unmodifiable)
78  selectionMode all;
79 
80  // Mandatory entries (unmodifiable)
81  kAmb 0.0;
82 
83  // Optional entries (unmodifiable)
84  rho rho;
85  epsilonAmb 0.0;
86  omegaAmb 0.0;
87  }
88 
89  // Optional (inherited) entries
90  ...
91  }
92  \endverbatim
93 
94  where the entries mean:
95  \table
96  Property | Description | Type | Req'd | Dflt
97  type | Type name: atmAmbientTurbSource | word | yes | -
98  kAmb | Ambient value for \c k | scalar | yes | -
99  rho | Name of density field | word | no | rho
100  epsilonAmb | Ambient value for \c epsilon | scalar | no | 0.0
101  omegaAmb | Ambient value for \c omega | scalar | no | 0.0
102  \endtable
103 
104  The inherited entries are elaborated in:
105  - \link fvOption.H \endlink
106  - \link cellSetOption.H \endlink
107 
108 SourceFiles
109  atmAmbientTurbSource.C
110  atmAmbientTurbSourceTemplates.C
111 
112 \*---------------------------------------------------------------------------*/
113 
114 #ifndef fv_atmAmbientTurbSource_H
115 #define fv_atmAmbientTurbSource_H
116 
117 #include "cellSetOption.H"
118 #include "turbulentTransportModel.H"
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 namespace Foam
123 {
124 namespace fv
125 {
126 
127 /*---------------------------------------------------------------------------*\
128  Class atmAmbientTurbSource Declaration
129 \*---------------------------------------------------------------------------*/
130 
131 class atmAmbientTurbSource
132 :
133  public fv::cellSetOption
134 {
135  // Private Data
136 
137  //- Internal flag to determine the working field is epsilon or omega
138  Switch isEpsilon_;
139 
140  //- Name of density field
141  const word rhoName_;
142 
143  //- Ambient turbulent kinetic energy value [m2/s2]
144  const dimensionedScalar kAmb_;
145 
146  //- Ambient turbulent kinetic energy dissipation rate value [m2/s3]
147  const dimensionedScalar epsilonAmb_;
148 
149  //- Ambient specific dissipation rate value [1/s]
150  const dimensionedScalar omegaAmb_;
151 
152  //- Required turbulence model coefficients (copied from turb model)
153  dimensionedScalar Cmu_;
154  dimensionedScalar C2_;
155 
156 
157  // Private Member Functions
158 
159  //- Apply atmAmbientTurbSource to epsilon field
160  template<class AlphaFieldType, class RhoFieldType>
161  void atmAmbientTurbSourceEpsilon
162  (
163  const AlphaFieldType& alpha,
164  const RhoFieldType& rho,
165  fvMatrix<scalar>& eqn,
166  const label fieldi
167  ) const;
168 
169  //- Apply atmAmbientTurbSource to omega field
170  template<class AlphaFieldType, class RhoFieldType>
171  void atmAmbientTurbSourceOmega
172  (
173  const AlphaFieldType& alpha,
174  const RhoFieldType& rho,
175  fvMatrix<scalar>& eqn,
176  const label fieldi
177  ) const;
178 
179  //- Apply atmAmbientTurbSource to k field
180  template<class AlphaFieldType, class RhoFieldType>
181  void atmAmbientTurbSourceK
182  (
183  const AlphaFieldType& alpha,
184  const RhoFieldType& rho,
185  fvMatrix<scalar>& eqn,
186  const label fieldi
187  ) const;
188 
189 
190 public:
191 
192  //- Runtime type information
193  TypeName("atmAmbientTurbSource");
194 
195 
196  // Constructors
197 
198  //- Construct from explicit source name and mesh
200  (
201  const word& sourceName,
202  const word& modelType,
203  const dictionary& dict,
204  const fvMesh& mesh
205  );
206 
207  //- No copy construct
209 
210  //- No copy assignment
211  void operator=(const atmAmbientTurbSource&) = delete;
212 
213 
214  // Member Functions
215 
216  //- Add explicit contribution to epsilon or omega equation
217  //- for incompressible flow computations
218  virtual void addSup
219  (
220  fvMatrix<scalar>& eqn,
221  const label fieldi
222  );
223 
224  //- Add explicit contribution to epsilon or omega equation
225  //- for compressible flow computations
226  virtual void addSup
227  (
228  const volScalarField& rho,
229  fvMatrix<scalar>& eqn,
230  const label fieldi
231  );
232 
233  //- Add explicit contribution to epsilon or omega equation
234  //- for multiphase flow computations
235  virtual void addSup
236  (
237  const volScalarField& alpha,
238  const volScalarField& rho,
239  fvMatrix<scalar>& eqn,
240  const label fieldi
241  );
242 
243  //- Read source dictionary (effectively no-op)
244  virtual bool read(const dictionary& dict)
245  {
246  return true;
247  }
248 };
249 
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 } // End namespace fv
254 } // End namespace Foam
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 #ifdef NoRepository
260 #endif
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 #endif
265 
266 // ************************************************************************* //
Foam::fv::atmAmbientTurbSource::TypeName
TypeName("atmAmbientTurbSource")
Runtime type information.
Foam::fv::atmAmbientTurbSource::read
virtual bool read(const dictionary &dict)
Read source dictionary (effectively no-op)
Definition: atmAmbientTurbSource.H:279
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::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
turbulentTransportModel.H
Foam::fv::atmAmbientTurbSource::addSup
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Definition: atmAmbientTurbSource.C:154
rho
rho
Definition: readInitialConditions.H:88
Foam::fv::atmAmbientTurbSource::atmAmbientTurbSource
atmAmbientTurbSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
Definition: atmAmbientTurbSource.C:47
cellSetOption.H
Foam::fv::atmAmbientTurbSource::operator=
void operator=(const atmAmbientTurbSource &)=delete
No copy assignment.
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
atmAmbientTurbSourceTemplates.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::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::fv::atmAmbientTurbSource
Applies sources on k and either epsilon or omega to prevent them droping below a specified ambient va...
Definition: atmAmbientTurbSource.H:166
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 >