|
ImpactX
|
Namespaces | |
| namespace | detail |
| namespace | diagnostics |
| namespace | distribution |
| namespace | elements |
| namespace | envelope |
| namespace | initialization |
| namespace | integrators |
| namespace | particles |
| namespace | transformation |
Classes | |
| struct | Config |
| struct | CopyAndMarkNegative |
| struct | Envelope |
| class | ImpactX |
| class | ImpactXParticleContainer |
| struct | IntSoA |
| class | ParConstIterSoA |
| class | ParIterSoA |
| struct | ParticleChunk |
| struct | RealSoA |
| struct | RefPart |
| struct | TrackingState |
Typedefs | |
| using | Map6x6 = amrex::SmallMatrix<amrex::ParticleReal, 6, 6, amrex::Order::F, 1> |
| using | CovarianceMatrix = Map6x6 |
Enumerations | |
| enum class | CoordSystem { s , t } |
| enum class | TrackingDirection { Forward , Backward } |
Functions | |
| template<typename T_Element, bool UseSimd = true, typename F> | |
| void | ParallelFor (int n, F &&f) |
| SpaceChargeAlgo | get_space_charge_algo () |
| std::string | to_string (SpaceChargeAlgo sca) |
| AMREX_ENUM (SpaceChargeAlgo, False, True_3D, Gauss3D, Gauss2p5D, True_2D, True_2p5D) | |
| void | read_element (std::string const &element_name, std::list< elements::KnownElements > &m_lattice, int nslice_default) |
| std::unordered_map< int, std::pair< amrex::MultiFab, amrex::MultiFab > > | flatten_charge_to_2D (std::unordered_map< int, amrex::MultiFab > const &rho, amrex::Box domain_3d) |
| std::unordered_map< int, amrex::MultiFab > | project_charge_to_2D (std::unordered_map< int, amrex::MultiFab > const &rho, amrex::Box domain_3d) |
| void | collect_lost_particles (ImpactXParticleContainer &source) |
| Map6x6 | symplectic_form () |
| void | push (ImpactXParticleContainer &pc, elements::KnownElements &element_variant, int step, int period) |
| void | push (RefPart &ref, elements::KnownElements &element_variant) |
| template<typename T_Element> | |
| void | push_all (ImpactXParticleContainer &pc, T_Element &element, int step, int period, bool omp_parallel=true) |
| ParticleChunk | split_equally (amrex::Long npart, amrex::Long index, amrex::Long size) |
| template<typename HookFn, typename CollectiveKicks, typename ElementPush> | |
| void | track_lattice_particles (std::list< elements::KnownElements > &lattice, ImpactXParticleContainer &pc, TrackingState &tracking_state, HookFn const &call_hook, CollectiveKicks &&collective_kicks, ElementPush &&element_push) |
| using impactx::CovarianceMatrix = Map6x6 |
this is the 6x6 covariance matrix
| using impactx::Map6x6 = amrex::SmallMatrix<amrex::ParticleReal, 6, 6, amrex::Order::F, 1> |
this is a 6x6 matrix
|
strong |
|
strong |
Direction in which the lattice is traversed.
Forward is ordinary tracking (entrance to exit). Backward traverses the periods, elements and space-charge slices in reverse, inverts each element's map, and applies the per-slice operations in mirrored order, i.e. time-symmetric back-tracking.
| Enumerator | |
|---|---|
| Forward | |
| Backward | |
| impactx::AMREX_ENUM | ( | SpaceChargeAlgo | , |
| False | , | ||
| True_3D | , | ||
| Gauss3D | , | ||
| Gauss2p5D | , | ||
| True_2D | , | ||
| True_2p5D | ) |
Space Charge: Implemented algorithms
| - | Disabled: no space charge calculation |
| - | 3D beam distribution |
| - | Assume a 3D Gaussian beam distribution |
| - | Assume a transverse 2D Gaussian beam distribution |
| - | Averaged 2D transverse beam distribution |
| - | Averaged 2D transverse beam distribution with a current along s |
| void impactx::collect_lost_particles | ( | ImpactXParticleContainer & | source | ) |
Move lost particles into a separate container
If particles are marked as lost, by setting their id to negative, we will move them to another particle container, store their position when lost and stop pushing them in the beamline.
| source | the beam particle container that might loose particles |
| std::unordered_map< int, std::pair< amrex::MultiFab, amrex::MultiFab > > impactx::flatten_charge_to_2D | ( | std::unordered_map< int, amrex::MultiFab > const & | rho, |
| amrex::Box | domain_3d ) |
| SpaceChargeAlgo impactx::get_space_charge_algo | ( | ) |
Return the currently active space charge algorithm
| void impactx::ParallelFor | ( | int | n, |
| F && | f ) |
A generalized ParallelFor that dispatches to amrex::ParallelFor or amrex::ParallelForSIMD depending on whether the element type T_Element is vectorized.
| T_Element | the element type |
| UseSimd | default-on if AMREX_USE_SIMD is set, allows disabling SIMD for performance corner cases |
| F | the functor type |
| n | the number of items to iterate over |
| f | the functor to execute |
| std::unordered_map< int, amrex::MultiFab > impactx::project_charge_to_2D | ( | std::unordered_map< int, amrex::MultiFab > const & | rho, |
| amrex::Box | domain_3d ) |
Project a deposited 3D charge density to 2D (x-y).
Convenience wrapper around flatten_charge_to_2D that keeps only the unique (charge-conserving) projection per level.
| rho | the deposited (raw, un-summed) 3D charge per level |
| domain_3d | the level-0 simulation domain (cell-centered) |
| void impactx::push | ( | ImpactXParticleContainer & | pc, |
| elements::KnownElements & | element_variant, | ||
| int | step, | ||
| int | period ) |
Push a whole particle beam (incl. reference particle) through an element
| [in,out] | pc | container of the particles to push |
| [in,out] | element_variant | a single element to push the particles through |
| [in] | step | global step for diagnostics |
| [in] | period | for periodic lattices, this is the current period (turn or cycle) |
| void impactx::push | ( | RefPart & | ref, |
| elements::KnownElements & | element_variant ) |
Push the reference particle through an element
| [in,out] | ref | the reference particle |
| [in,out] | element_variant | a single element to push the particles through |
| void impactx::push_all | ( | ImpactXParticleContainer & | pc, |
| T_Element & | element, | ||
| int | step, | ||
| int | period, | ||
| bool | omp_parallel = true ) |
Push all particles in a particle container.
This element pushes first the reference particle, then all other particles. All particles are pushed independently with the same logic. Particles are relative to the reference particle.
| [in,out] | pc | particle container to push |
| [in,out] | element | the beamline element |
| [in] | step | global step for diagnostics |
| [in] | period | for periodic lattices, this is the current period (turn or cycle) |
| [in] | omp_parallel | allow threading via OpenMP for the particle iterator loop (note: if OMP backend is active) |
| void impactx::read_element | ( | std::string const & | element_name, |
| std::list< elements::KnownElements > & | m_lattice, | ||
| int | nslice_default ) |
Read a lattice element
Read a lattice element from amrex::ParmParse, initialize it and append it to m_lattice.
| [in] | element_name | element name |
| [in,out] | m_lattice | the accelerator lattice |
| [in] | nslice_default |
| ParticleChunk impactx::split_equally | ( | amrex::Long | npart, |
| amrex::Long | index, | ||
| amrex::Long | size ) |
Split an array of contiguous elements into well-balanched chunks.
This function contains the auxiliary math to split npart contiguous particles into contiguous chunks of size, returning the individual starting offset and chunk size. It also deals with distributing remainders well.
This can be used for distributed logic for MPI and OpenMP parallelism alike.
| npart | total number of elements/particles |
| index | my index in parallelization, e.g., MPI rank or OpenMP thread id |
| size | the parallelization space, e.g., MPI size or OpenMP max threads |
|
inline |
Return the 6x6 skew-symmetric symplectic form
diag([[0,1],[-1,0]], [[0,1],[-1,0]], [[0,1],[-1,0]]) for the phase space ordering (x, px, y, py, t, pt).
Note: commonly referred to as J (especially in accelerator physics), but sometimes called Omega to avoid confusion with complex structures.
| std::string impactx::to_string | ( | SpaceChargeAlgo | sca | ) |
A user-friendly string
Returns a string that is similar to the spelling in user input options.
| void impactx::track_lattice_particles | ( | std::list< elements::KnownElements > & | lattice, |
| ImpactXParticleContainer & | pc, | ||
| TrackingState & | tracking_state, | ||
| HookFn const & | call_hook, | ||
| CollectiveKicks && | collective_kicks, | ||
| ElementPush && | element_push ) |
Traverse the lattice for particle (beam + reference) tracking, applying the per-slice physics as two composable operations.
This function performs the nested lattice traversal (looping over periods, then over the beamline elements in each period, then over the collective-effect slices within each element). It also maintains the user-defined hooks, the reference-particle edge update and the global step counter. The caller supplies the per-slice physics as a collective_kicks (space charge, CSR, ISR, ...) and an element_push (the external-field of an element). Keeping the kick and the transport as separate, composable operations isolates the collective-effect composition: forward, this applies K then M per slice (first order). Planned: second-order Strang split K(1/2) [M K]^(n-1) M K(1/2).
Hooks, the reference-particle edge update, the step counter and the tracking-state element pointer are maintained on Forward tracking only.
The number of periods (lattice.periods) and verbosity (impactx.verbose) are read from the inputs. The step counter is advanced from its current value, so the caller is expected to reset it (to 0) before a forward run.
| HookFn | callable void (std::string const & name) invoking a named hook |
| CollectiveKicks | callable, see ElementPush for the signature |
| ElementPush | callable void (elements::KnownElements & element, int element_index, int slice_step, int nslice, amrex::ParticleReal slice_ds, int step, int period) |
| [in,out] | lattice | the beamline elements to traverse |
| [in,out] | pc | beam particle container (reference particle / edge update) |
| [in,out] | tracking_state | tracking state shared with hooks (element, step, period); its m_direction selects the traversal direction |
| [in] | call_hook | registry for user-specified callback hooks |
| [in] | collective_kicks | applied collective effect kicks (SC, CSR, ISR, etc.), per-slice |
| [in] | element_push | applied the external-field of an element, per-slice |