Implement the improved and adaptive binning algorithm from OPAL (master thesis Alexander Liemen)
Summary
This merge request integrates the particle binning functionality developed in my master's thesis into the OPALX codebase. The integration combines energy binning capabilities with the existing particle tracking system, laying the groundwork for binned field solving later.
Background
This merge addresses the need for efficient particle binning in OPALX simulations similar to OPAL, as detailed in my thesis. The binning functionality was initially developed in a separate repository and has now been fully integrated into the main codebase while preserving commit history.
Changes Made
Core Binning Implementation
-
New binning module: Complete binning functionality added in
src/PartBunch/Binning/
directory - AdaptBins class: New class integrated into OPALX for handling particle binning operations
-
Configuration options: Added four new OPALX OPTIONS:
-
MAXBINS
: Maximum number of bins allowed -
BINNINGALPHA
: Alpha parameter for binning cost function -
BINNINGBETA
: Beta parameter for binning cost function -
DESIREDWIDTH
: Target width for adaptive bin sizing
-
OPALX Integration
-
ParallelTracker modifications: Added
sampler_m
for on-the-fly particle sampling within the stepper loop (for the flattop test case, TODO: might want to remove this!) - Debug output: Implemented binning debug information and histogram output (for testing)
Next Steps:
- The binned field solver (which will iterate over bins and solve fields for each bin) remains to be implemented.
- All parameters and functionality are documented in the linked thesis report. Wiki documentation will be added in a subsequent update.