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-------------------------------------------------------------------------------
11License
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
30
31using namespace Foam::constant;
32
33// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34
35Foam::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
42inline Foam::label Foam::eddy::patchFaceI() const noexcept
43{
44 return patchFaceI_;
45}
46
47
49{
50 return position0_;
51}
52
53
54inline Foam::scalar Foam::eddy::x() const noexcept
55{
56 return x_;
57}
58
59
61{
62 return sigma_;
63}
64
65
67{
68 return alpha_;
69}
70
71
73{
74 return Rpg_;
75}
76
77
78inline 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
96inline Foam::scalar Foam::eddy::volume() const
97{
98 return mathematical::pi*4.0/3.0*cmptProduct(sigma_);
99}
100
101
102void Foam::eddy::move(const scalar dx)
103{
104 x_ += dx;
105}
106
107
108Foam::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// ************************************************************************* //
label n
Random number generator.
Definition: Random.H:60
Type sample01()
Return a sample whose components lie in the range [0,1].
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:64
const point & min() const
Minimum describing the bounding box.
Definition: boundBoxI.H:91
const point & max() const
Maximum describing the bounding box.
Definition: boundBoxI.H:97
scalar c1() const noexcept
Return the model coefficient c1.
Definition: eddyI.H:78
const tensor & Rpg() const noexcept
Definition: eddyI.H:72
const point & position0() const noexcept
Return the reference position.
Definition: eddyI.H:48
scalar volume() const
Volume.
Definition: eddyI.H:96
boundBox bounds(const bool global=true) const
Eddy bounds.
Definition: eddyI.H:108
const vector & alpha() const noexcept
Return the time-averaged intensity.
Definition: eddyI.H:66
label patchFaceI() const noexcept
Return the patch face index that spawned the eddy.
Definition: eddyI.H:42
scalar x() const noexcept
Return the distance from the reference position.
Definition: eddyI.H:54
const vector & sigma() const noexcept
Return the length scales in 3-D space.
Definition: eddyI.H:60
virtual void move()=0
scalar epsilon
constexpr scalar pi(M_PI)
Different types of constants.
Cmpt cmptProduct(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
Definition: VectorSpaceI.H:598
const direction noexcept
Definition: Scalar.H:223
Vector< scalar > vector
Definition: vector.H:61
Random rndGen
Definition: createFields.H:23