eddyI.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) 2015 OpenFOAM Foundation
9  Copyright (C) 2016-2021 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 \*---------------------------------------------------------------------------*/
28 
29 #include "mathematicalConstants.H"
30 
31 using namespace Foam::constant;
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 Foam::scalar Foam::eddy::epsi(Random& rndGen) const
36 {
37  // Random number with zero mean and unit variance
38  return rndGen.sample01<scalar>() > 0.5 ? 1 : -1;
39 }
40 
41 
42 inline Foam::label Foam::eddy::patchFaceI() const noexcept
43 {
44  return patchFaceI_;
45 }
46 
47 
48 inline const Foam::point& Foam::eddy::position0() const noexcept
49 {
50  return position0_;
51 }
52 
53 
54 inline Foam::scalar Foam::eddy::x() const noexcept
55 {
56  return x_;
57 }
58 
59 
60 inline const Foam::vector& Foam::eddy::sigma() const noexcept
61 {
62  return sigma_;
63 }
64 
65 
66 inline const Foam::vector& Foam::eddy::alpha() const noexcept
67 {
68  return alpha_;
69 }
70 
71 
72 inline const Foam::tensor& Foam::eddy::Rpg() const noexcept
73 {
74  return Rpg_;
75 }
76 
77 
78 inline Foam::scalar Foam::eddy::c1() const noexcept
79 {
80  return c1_;
81 }
82 
83 
84 inline Foam::point Foam::eddy::position(const vector& n) const
85 {
86  return position0_ + n*x_;
87 }
88 
89 
91 {
92  return vector(epsi(rndGen), epsi(rndGen), epsi(rndGen));
93 }
94 
95 
96 inline Foam::scalar Foam::eddy::volume() const
97 {
98  return mathematical::pi*4.0/3.0*cmptProduct(sigma_);
99 }
100 
102 void Foam::eddy::move(const scalar dx)
103 {
104  x_ += dx;
105 }
106 
107 
108 Foam::boundBox Foam::eddy::bounds(const bool global) const
109 {
110  boundBox bb;
111 
112  if (global)
113  {
114  bb.min() = Rpg_ & -sigma_;
115  bb.max() = Rpg_ & sigma_;
116  }
117  else
118  {
119  bb.min() = -sigma_;
120  bb.max() = sigma_;
121  }
122 
123  return bb;
124 }
125 
126 
127 // ************************************************************************* //
Different types of constants.
label patchFaceI() const noexcept
Return the patch face index that spawned the eddy.
Definition: eddyI.H:35
boundBox bounds(const bool global=true) const
Eddy bounds.
Definition: eddyI.H:101
Cmpt cmptProduct(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
Definition: VectorSpaceI.H:597
Random rndGen
Definition: createFields.H:23
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
const point & min() const noexcept
Minimum describing the bounding box.
Definition: boundBoxI.H:162
point position(const vector &n) const
Return the eddy position.
Definition: eddyI.H:77
const point & max() const noexcept
Maximum describing the bounding box.
Definition: boundBoxI.H:168
scalar x() const noexcept
Return the distance from the reference position.
Definition: eddyI.H:47
constexpr scalar pi(M_PI)
Vector< scalar > vector
Definition: vector.H:57
Random number generator.
Definition: Random.H:55
scalar volume() const
Volume.
Definition: eddyI.H:89
const direction noexcept
Definition: Scalar.H:258
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
vector epsilon(Random &rndGen) const
Return random vector of -1 and 1&#39;s.
Definition: eddyI.H:83
scalar c1() const noexcept
Return the model coefficient c1.
Definition: eddyI.H:71
const vector & sigma() const noexcept
Return the length scales in 3-D space.
Definition: eddyI.H:53
const tensor & Rpg() const noexcept
Return the coordinate system transformation from local principal to global axes.
Definition: eddyI.H:65
label n
void move(const scalar dx)
Move the eddy.
Definition: eddyI.H:95
const point & position0() const noexcept
Return the reference position.
Definition: eddyI.H:41
Tensor of scalars, i.e. Tensor<scalar>.
const vector & alpha() const noexcept
Return the time-averaged intensity.
Definition: eddyI.H:59