-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Lost Particle w/ Runtime Attr #795
base: development
Are you sure you want to change the base?
Conversation
For some processes and/or diagnostics, we add extra runtime attributes to our beam (particle container). The logic that collected "lost" particles in the beamline, i.e., as marked as lost in apertures, did not account for extra runtime attributes and thus got lost in bookkeeping. This fixes the collection logic to be more robust and also copy any extra runtime attributes over to the "lost" particle recording. This was first seen with an input that used the nonlinear lens (NLL), NLL-invariant diagnostics and an aperture at the same time.
src/particles/CollectLost.cpp
Outdated
// Check destination has the same attributes as source + "s_lost" | ||
for (auto & name : source.GetRealSoANames()) | ||
{ | ||
if (!dest.HasRealComp(name)) { | ||
dest.AddRealComp(name); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@atmyers question for you: we use amrex::filterAndTransformParticles
below.
I am a bit afraid that when the order of attributes added in dest
is not 100% the same as in source
that this gets confused.
In particular, the attributes in source
are something like:
- x,y,t,px,py,pt,I,H
and indest
- x,y,t,px,py,pt,s,I,H
s
, I
and H
are runtime components, all are Real
.
Will that lead to broken/mismatched or partial copies from source
to dest
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to add a few asserts, but maybe we need to generalize with new helper methods/functions for copies that help with the matching a bit, to simplify complex bookkeeping.
For some processes and/or diagnostics, we add extra runtime attributes to our beam (particle container). The logic that collected "lost" particles in the beamline, i.e., as marked as lost in apertures, did not account for extra runtime attributes and thus got lost in bookkeeping.
This fixes the collection logic to be more robust and also copy any extra runtime attributes over to the "lost" particle recording.
This was first seen with an input that used the nonlinear lens (NLL), NLL-invariant diagnostics and an aperture at the same time. Fix #762