Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
lagrangian
dieselSpray
spraySubModels
dispersionModel
gradientDispersionRAS
gradientDispersionRAS.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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
\*---------------------------------------------------------------------------*/
25
26
#include <
OpenFOAM/error.H
>
27
28
#include "
gradientDispersionRAS.H
"
29
#include <
OpenFOAM/addToRunTimeSelectionTable.H
>
30
31
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32
33
namespace
Foam
34
{
35
36
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37
38
defineTypeNameAndDebug
(gradientDispersionRAS, 0);
39
40
addToRunTimeSelectionTable
41
(
42
dispersionModel,
43
gradientDispersionRAS,
44
dictionary
45
);
46
47
48
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49
50
// Construct from components
51
gradientDispersionRAS::gradientDispersionRAS
52
(
53
const
dictionary
& dict,
54
spray
& sm
55
)
56
:
57
dispersionRASModel
(dict, sm)
58
{}
59
60
61
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
62
63
gradientDispersionRAS::~gradientDispersionRAS
()
64
{}
65
66
67
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68
69
void
gradientDispersionRAS::disperseParcels
()
const
70
{
71
72
const
scalar
cps
= 0.16432;
73
74
scalar dt =
spray_
.
runTime
().
deltaT
().
value
();
75
const
volScalarField
&
k
=
turbulence
().k();
76
volVectorField
gradk =
fvc::grad
(k);
77
const
volScalarField
& epsilon =
turbulence
().epsilon();
78
const
volVectorField
&
U
=
spray_
.
U
();
79
80
for
81
(
82
spray::iterator
elmnt
=
spray_
.
begin
();
83
elmnt
!=
spray_
.
end
();
84
++
elmnt
85
)
86
{
87
label celli =
elmnt
().cell();
88
scalar UrelMag =
mag
(
elmnt
().
U
() - U[celli] -
elmnt
().Uturb());
89
90
scalar Tturb =
min
91
(
92
k[celli]/epsilon[celli],
93
cps*
pow
(k[celli], 1.5)/epsilon[celli]/(UrelMag + SMALL)
94
);
95
// parcel is perturbed by the turbulence
96
if
(dt < Tturb)
97
{
98
elmnt
().tTurb() += dt;
99
100
if
(
elmnt
().tTurb() > Tturb)
101
{
102
elmnt
().tTurb() = 0.0;
103
104
scalar sigma =
sqrt
(2.0*k[celli]/3.0);
105
vector
dir = -gradk[celli]/(
mag
(gradk[celli]) + SMALL);
106
107
// numerical recipes... Ch. 7. Random Numbers...
108
scalar x1 = 0.0;
109
scalar x2 = 0.0;
110
scalar rsq = 10.0;
111
while
((rsq > 1.0) || (rsq == 0.0))
112
{
113
x1 = 2.0*
spray_
.
rndGen
().
scalar01
() - 1.0;
114
x2 = 2.0*
spray_
.
rndGen
().
scalar01
() - 1.0;
115
rsq = x1*x1 + x2*x2;
116
}
117
118
scalar fac =
sqrt
(-2.0*
log
(rsq)/rsq);
119
120
// in 2D calculations the -grad(k) is always
121
// away from the axis of symmetry
122
// This creates a 'hole' in the spray and to
123
// prevent this we let x1 be both negative/positive
124
if
(
spray_
.
twoD
())
125
{
126
fac *= x1;
127
}
128
else
129
{
130
fac *=
mag
(x1);
131
}
132
133
elmnt
().Uturb() = sigma*fac*dir;
134
}
135
}
136
else
137
{
138
elmnt
().tTurb() = GREAT;
139
elmnt
().Uturb() =
vector::zero
;
140
}
141
}
142
}
143
144
145
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146
147
}
// End namespace Foam
148
149
// ************************ vim: set sw=4 sts=4 et: ************************ //