Skip to content

Conversation

ax3l
Copy link
Member

@ax3l ax3l commented Aug 18, 2025

Introduce methods to control which parameters (moments, min/max, covariances, etc.) to reduce in particle reduced beam characteristics/moments. Speed up usage, to avoid that recording the history of beam moments can dominate simple simulation runs.

Fix #1102

To Do

  • Verify that simply reducing only 11 instead of 22 variables is indeed faster.
  • Decide if we need a "reduction level" (increasingly more) or an all-out group selection (bitmask) -- will influence how many variants to pre-compile
  • Implement more
  • Maybe simplify to one reduction?

Introduce methods to control which parameters (moments,
min/max, covariances, etc.) to reduce in particle reduced
beam characteristics/moments. Speed up usage, to avoid that
recording the history of beam moments can dominate simple
simulation runs.
WeiqunZhang pushed a commit to AMReX-Codes/amrex that referenced this pull request Aug 19, 2025
## Summary

In C++ it is not allowed to make a zero-sized array type like `int[0]`
so a more verbose way using `amrex::TypeArray<int, 0>` needs to be used.
Additionally, `std::declval` is now used instead of `Types{}`.

## Additional background

Zero-variants in BLAST-ImpactX/impactx#1104

## Checklist

The proposed changes:
- [x] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX
users
- [ ] include documentation in the code and/or rst files, if appropriate
Observed:
- too explicit
- split min/max out separately, seldomly needed
- make the other options "stack"
@ax3l ax3l added this to the FY25 HTU LDRD milestone Aug 28, 2025
WeiqunZhang added a commit to AMReX-Codes/amrex that referenced this pull request Sep 11, 2025
## Summary

Sometimes one needs the underlying (u)int value of an `enum class`,
e.g., when building bitmasks. This adds a helper function to
`AMREX_ENUM`.

## Additional background

BLAST-ImpactX/impactx#1104

---------

Co-authored-by: Weiqun Zhang <[email protected]>

constexpr MomentSelection operator| (MomentSelection lhs, MomentSelection rhs) noexcept
{
return static_cast<MomentSelection>(static_cast<std::underlying_type_t<MomentSelection>>(lhs) | static_cast<std::underlying_type_t<MomentSelection>>(rhs));
Copy link
Member Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Beam Diagnostics is too Slow

1 participant