Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
OPAL
src
Commits
6f22df2f
Commit
6f22df2f
authored
Jul 20, 2020
by
kraus
Browse files
Resolve "Source elements should delete particles that are pushed back into it"
parent
5c83e306
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
21 deletions
+10
-21
src/Algorithms/ParallelTTracker.cpp
src/Algorithms/ParallelTTracker.cpp
+4
-8
src/Algorithms/ParallelTTracker.h
src/Algorithms/ParallelTTracker.h
+0
-2
src/Classic/AbsBeamline/Source.cpp
src/Classic/AbsBeamline/Source.cpp
+6
-11
No files found.
src/Algorithms/ParallelTTracker.cpp
View file @
6f22df2f
...
...
@@ -75,8 +75,7 @@ ParallelTTracker::ParallelTTracker(const Beamline &beamline,
fieldEvaluationTimer_m
(
IpplTimings
::
getTimer
(
"External field eval"
)),
BinRepartTimer_m
(
IpplTimings
::
getTimer
(
"Binaryrepart"
)),
WakeFieldTimer_m
(
IpplTimings
::
getTimer
(
"WakeField"
)),
particleMatterStatus_m
(
false
),
totalParticlesInSimulation_m
(
0
)
particleMatterStatus_m
(
false
)
{}
ParallelTTracker
::
ParallelTTracker
(
const
Beamline
&
beamline
,
...
...
@@ -108,8 +107,7 @@ ParallelTTracker::ParallelTTracker(const Beamline &beamline,
fieldEvaluationTimer_m
(
IpplTimings
::
getTimer
(
"External field eval"
)),
BinRepartTimer_m
(
IpplTimings
::
getTimer
(
"Binaryrepart"
)),
WakeFieldTimer_m
(
IpplTimings
::
getTimer
(
"WakeField"
)),
particleMatterStatus_m
(
false
),
totalParticlesInSimulation_m
(
0
)
particleMatterStatus_m
(
false
)
{
for
(
unsigned
int
i
=
0
;
i
<
zstop
.
size
();
++
i
)
{
stepSizes_m
.
push_back
(
dt
[
i
],
zstop
[
i
],
maxSteps
[
i
]);
...
...
@@ -257,7 +255,6 @@ void ParallelTTracker::execute() {
saveCavityPhases
();
numParticlesInSimulation_m
=
itsBunch_m
->
getTotalNum
();
totalParticlesInSimulation_m
=
itsBunch_m
->
getTotalNum
();
setTime
();
...
...
@@ -588,7 +585,6 @@ void ParallelTTracker::computeExternalFields(OrbitThreader &oth) {
ne
=
itsBunch_m
->
destroyT
();
}
numParticlesInSimulation_m
=
itsBunch_m
->
getTotalNum
();
totalParticlesInSimulation_m
-=
ne
;
deletedParticles_m
=
true
;
}
...
...
@@ -599,7 +595,7 @@ void ParallelTTracker::computeExternalFields(OrbitThreader &oth) {
if
(
ne
>
0
)
{
msg
<<
level1
<<
"* Deleted "
<<
ne
<<
" particles, "
<<
"remaining "
<<
total
ParticlesInSimulation_m
<<
" particles"
<<
endl
;
<<
"remaining "
<<
num
ParticlesInSimulation_m
<<
" particles"
<<
endl
;
}
}
...
...
@@ -1390,4 +1386,4 @@ void ParallelTTracker::evenlyDistributeParticles() {
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
// End:
\ No newline at end of file
src/Algorithms/ParallelTTracker.h
View file @
6f22df2f
...
...
@@ -244,8 +244,6 @@ private:
std
::
set
<
ParticleMatterInteractionHandler
*>
activeParticleMatterInteractionHandlers_m
;
bool
particleMatterStatus_m
;
unsigned
long
totalParticlesInSimulation_m
;
/********************** END VARIABLES ***********************************/
void
kickParticles
(
const
BorisPusher
&
pusher
);
...
...
src/Classic/AbsBeamline/Source.cpp
View file @
6f22df2f
...
...
@@ -45,17 +45,13 @@ bool Source::apply(const size_t &i, const double &t, Vector_t &/*E*/, Vector_t &
const
Vector_t
&
P
=
RefPartBunch_m
->
P
[
i
];
const
double
&
dt
=
RefPartBunch_m
->
dt
[
i
];
const
double
recpgamma
=
Physics
::
c
*
dt
/
Util
::
getGamma
(
P
);
const
double
end
=
getElementLength
();
if
(
online_m
&&
dt
<
0.0
)
{
if
(
R
(
2
)
>
end
&&
(
R
(
2
)
+
P
(
2
)
*
recpgamma
)
<
end
)
{
double
frac
=
(
end
-
R
(
2
))
/
(
P
(
2
)
*
recpgamma
);
if
(
online_m
&&
R
(
2
)
<=
0.0
&&
P
(
2
)
<
0.0
)
{
double
frac
=
-
R
(
2
)
/
(
P
(
2
)
*
recpgamma
);
lossDs_m
->
addParticle
(
R
+
frac
*
recpgamma
*
P
,
P
,
RefPartBunch_m
->
ID
[
i
],
t
+
frac
*
dt
,
0
);
lossDs_m
->
addParticle
(
R
+
frac
*
recpgamma
*
P
,
P
,
RefPartBunch_m
->
ID
[
i
],
t
+
frac
*
dt
,
0
);
return
true
;
}
return
true
;
}
return
false
;
...
...
@@ -98,5 +94,4 @@ void Source::getDimensions(double &zBegin, double &zEnd) const {
ElementBase
::
ElementType
Source
::
getType
()
const
{
return
SOURCE
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
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