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 
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 
101 
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 // ************************************************************************* //
Foam::Random
Random number generator.
Definition: Random.H:59
Foam::Tensor< scalar >
Foam::eddy::Rpg
const tensor & Rpg() const noexcept
Definition: eddyI.H:72
Foam::eddy::sigma
const vector & sigma() const noexcept
Return the length scales in 3-D space.
Definition: eddyI.H:60
mathematicalConstants.H
Foam::eddy::alpha
const vector & alpha() const noexcept
Return the time-averaged intensity.
Definition: eddyI.H:66
Foam::eddy::c1
scalar c1() const noexcept
Return the model coefficient c1.
Definition: eddyI.H:78
Foam::eddy::epsilon
vector epsilon(Random &rndGen) const
Return random vector of -1 and 1's.
Definition: eddyI.H:90
Foam::constant
Different types of constants.
Definition: atomicConstants.C:38
Foam::eddy::bounds
boundBox bounds(const bool global=true) const
Eddy bounds.
Definition: eddyI.H:108
Foam::eddy::position0
const point & position0() const noexcept
Return the reference position.
Definition: eddyI.H:48
Foam::cmptProduct
Cmpt cmptProduct(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
Definition: VectorSpaceI.H:596
Foam::eddy::volume
scalar volume() const
Volume.
Definition: eddyI.H:96
Foam::eddy::move
void move(const scalar dx)
Move the eddy.
Definition: eddyI.H:102
Foam::boundBox::max
const point & max() const
Maximum describing the bounding box.
Definition: boundBoxI.H:97
Foam::boundBox::min
const point & min() const
Minimum describing the bounding box.
Definition: boundBoxI.H:91
Foam::eddy::x
scalar x() const noexcept
Return the distance from the reference position.
Definition: eddyI.H:54
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::eddy::position
point position(const vector &n) const
Return the eddy position.
Definition: eddyI.H:84
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::constant::mathematical::pi
constexpr scalar pi(M_PI)
Foam::Vector< scalar >
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
rndGen
Random rndGen
Definition: createFields.H:23
Foam::eddy::patchFaceI
label patchFaceI() const noexcept
Return the patch face index that spawned the eddy.
Definition: eddyI.H:42