Skip to content
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

Track Covariance Map #814

Draft
wants to merge 19 commits into
base: development
Choose a base branch
from

Conversation

ax3l
Copy link
Member

@ax3l ax3l commented Jan 27, 2025

Add a new runtime mode, tracking of 2nd moments in a covariance matrix.

  • generalize initialization Reorder Distribution Init #815
  • add map initialization to each element
  • add maps for core elements (drift, quad, bend, shortrf)
  • push loop
  • diagnostics
  • example(s)
  • documentation

@ax3l ax3l added the component: core Core ImpactX functionality label Jan 27, 2025
src/ImpactX.cpp Fixed Show fixed Hide fixed
@ax3l ax3l force-pushed the topic-track-covariance-map branch 3 times, most recently from 3b71d60 to a91748a Compare January 27, 2025 23:34
src/ImpactX.cpp Outdated Show resolved Hide resolved
@ax3l ax3l force-pushed the topic-track-covariance-map branch from a91748a to ed344c9 Compare January 28, 2025 02:06
// small trick to force every derived class has to implement a method transport_map
// (w/o using a purely virtual function)
T_Element& element = *static_cast<T_Element*>(this);
cm *= element.transport_map(cm);
Copy link
Member

@cemitch99 cemitch99 Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this logic right? The function transport_map in each element takes the reference particle data as input, but this appears to call transport_map with the covariance matrix cm as input. Also, if the intent is to push the covariance matrix by the matrix R, then the math should look like cm = R * cm * R^T, which appears also ImpactX.cpp.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that is outdated. I only fixed it in ImpactX.cpp.

@cemitch99
Copy link
Member

Regarding user control of the run mode, I propose algo.envelope_mode = true/false, with false as the default (particle tracking).

@ax3l
Copy link
Member Author

ax3l commented Jan 31, 2025

We could also make it more general: algo.method =

  • envelope
  • reference_particle
  • tracking (default)

That way we have one flag for all planned modes and we can continue to add modes beyond 3 in the future :D (e.g., ensemble/batch variants of these modes or so)

@cemitch99
Copy link
Member

cemitch99 commented Jan 31, 2025

What about algo.mode = track_envelope, track_ref_part, track_particles, or similar? This could reflect the name of the function used in the push loop. I think "method" is maybe not descriptive enough, and could apply to any algorithm.

@ax3l
Copy link
Member Author

ax3l commented Jan 31, 2025

Perfect

@ax3l
Copy link
Member Author

ax3l commented Jan 31, 2025

Oh, or instead of mode we name it algo.track = envelope, ref_part, particles.

@cemitch99
Copy link
Member

That works, too. FYI: I used algo.mode = track_envelopes in the diagnostics PR, but it's a trivial change.

@ax3l ax3l force-pushed the topic-track-covariance-map branch from ed335ee to 9c39e1f Compare January 31, 2025 23:52
* Update DiagnosticOutput & Reduced Beam Diagnostics

---------

Co-authored-by: Axel Huebl <[email protected]>
@ax3l ax3l force-pushed the topic-track-covariance-map branch from 9c39e1f to fb58249 Compare January 31, 2025 23:55
@ax3l
Copy link
Member Author

ax3l commented Jan 31, 2025

I will fix the Doxygen warning/error later, please ignore for now.

Comment on lines +368 to +370
//if (verbose > 0) {
// amrex::Print() << " Diagnostics: " << diag_enable << "\n";
//}

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: core Core ImpactX functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants