Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
4bd6aba5
Commit
4bd6aba5
authored
Dec 07, 2010
by
graham
Browse files
ENH: Better handling of injection rates less than one parcel per timestep.
parent
837bb584
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C
View file @
4bd6aba5
...
...
@@ -38,7 +38,24 @@ Foam::label Foam::PatchInjection<CloudType>::parcelsToInject
{
if
((
time0
>=
0
.
0
)
&&
(
time0
<
duration_
))
{
return
round
(
fraction_
*
(
time1
-
time0
)
*
parcelsPerSecond_
);
scalar
nParcels
=
fraction_
*
(
time1
-
time0
)
*
parcelsPerSecond_
;
cachedRandom
&
rnd
=
this
->
owner
().
rndGen
();
label
nParcelsToInject
=
floor
(
nParcels
);
// Inject an additional parcel with a probability based on the
// remainder after the floor function
if
(
nParcelsToInject
>
0
&&
(
nParcels
-
scalar
(
nParcelsToInject
)
>
rnd
.
position
(
0
.
0
,
1
.
0
))
)
{
++
nParcelsToInject
;
}
return
nParcelsToInject
;
}
else
{
...
...
@@ -173,6 +190,7 @@ void Foam::PatchInjection<CloudType>::setPositionAndCell
if
(
cellOwners_
.
size
()
>
0
)
{
cachedRandom
&
rnd
=
this
->
owner
().
rndGen
();
label
cellI
=
rnd
.
position
<
label
>
(
0
,
cellOwners_
.
size
()
-
1
);
cellOwner
=
cellOwners_
[
cellI
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment