turbulentIntensityKineticEnergyFvScalarFieldSource.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023-2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::turbulentIntensityKineticEnergyFvScalarFieldSource
26 
27 Description
28  This source condition provides a turbulent kinetic energy based on
29  user-supplied turbulence intensity, defined as a fraction of the
30  mean velocity:
31 
32  \f[
33  k = 1.5 (I |U|)^2
34  \f]
35 
36  where
37 
38  \vartable
39  k | kinetic energy values
40  I | turbulence intensity
41  U | velocity field
42  \endvartable
43 
44  In the case of a sink, the current cell values are used instead.
45 
46 Usage
47  \table
48  Property | Description | Required | Default value
49  intensity | fraction of mean field [0-1] | yes |
50  U | velocity field name | no | U
51  \endtable
52 
53  Example of the boundary condition specification:
54  \verbatim
55  <sourceName>
56  {
57  type turbulentIntensityKineticEnergyInlet;
58  intensity 0.05; // 5% turbulence
59  }
60  \endverbatim
61 
62 SourceFiles
63  turbulentIntensityKineticEnergyFvScalarFieldSource.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef turbulentIntensityKineticEnergyFvScalarFieldSource_H
68 #define turbulentIntensityKineticEnergyFvScalarFieldSource_H
69 
70 #include "fvFieldSources.H"
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 namespace Foam
75 {
76 
77 /*---------------------------------------------------------------------------*\
78  Class turbulentIntensityKineticEnergyFvScalarFieldSource Declaration
79 \*---------------------------------------------------------------------------*/
80 
81 class turbulentIntensityKineticEnergyFvScalarFieldSource
82 :
83  public fvScalarFieldSource
84 {
85 private:
86 
87  // Private Data
88 
89  //- Turbulent intensity as fraction of mean velocity
90  scalar intensity_;
91 
92  //- Name of the velocity field
93  word UName_;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("turbulentIntensityKineticEnergy");
100 
101 
102  // Constructors
103 
104  //- Construct from internal field and dictionary
106  (
108  const dictionary& dict
109  );
110 
111  //- Copy constructor setting internal field reference
113  (
116  );
117 
118  //- Construct and return a clone setting internal field reference
120  (
122  ) const
123  {
125  (
127  (
128  *this,
129  iF
130  )
131  );
132  }
133 
134 
135  //- Destructor
137 
138 
139  // Member Functions
140 
141  //- Return the source value
143  (
144  const fvSource& model,
146  ) const;
147 
148  //- Return the source value
150  (
151  const fvSource& model,
152  const scalarField& source,
153  const labelUList& cells
154  ) const;
155 
156  //- Return the internal coefficient
158  (
159  const fvSource& model,
161  ) const;
162 
163  //- Return the internal coefficient
165  (
166  const fvSource& model,
167  const scalarField& source,
168  const labelUList& cells
169  ) const;
170 
171  //- Write
172  virtual void write(Ostream&) const;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Base class for finite volume sources.
Definition: fvSource.H:52
A class for managing temporary objects.
Definition: tmp.H:55
This source condition provides a turbulent kinetic energy based on user-supplied turbulence intensity...
turbulentIntensityKineticEnergyFvScalarFieldSource(const DimensionedField< scalar, volMesh > &, const dictionary &dict)
Construct from internal field and dictionary.
virtual autoPtr< fvScalarFieldSource > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual tmp< DimensionedField< scalar, volMesh > > sourceValue(const fvSource &model, const DimensionedField< scalar, volMesh > &source) const
Return the source value.
virtual tmp< DimensionedField< scalar, volMesh > > internalCoeff(const fvSource &model, const DimensionedField< scalar, volMesh > &source) const
Return the internal coefficient.
TypeName("turbulentIntensityKineticEnergy")
Runtime type information.
const cellShapeList & cells
Namespace for OpenFOAM.
dictionary dict