ImpactX
Loading...
Searching...
No Matches
HandleISR.H
Go to the documentation of this file.
1/* Copyright 2022-2026 The Regents of the University of California, through Lawrence
2 * Berkeley National Laboratory (subject to receipt of any required
3 * approvals from the U.S. Dept. of Energy). All rights reserved.
4 *
5 * This file is part of ImpactX.
6 *
7 * Authors: Alex Bojanich, Chad Mitchell, Axel Huebl
8 * License: BSD-3-Clause-LBNL
9 */
10#ifndef HANDLE_ISR_H
11#define HANDLE_ISR_H
12
14#include "ISRBendElement.H"
15#include "ISRPush.H"
16
17#include <cmath>
18#include <vector>
19
20
22{
31 template <typename T_Element>
32 void HandleISR (
33 impactx::ImpactXParticleContainer& particle_container,
34 T_Element const& element_variant,
35 amrex::Real slice_ds
36 )
37 {
38 if (slice_ds == 0.0) { return; }
39
40 BL_PROFILE("impactx::particles::wakefields::HandleISR")
41
42 amrex::ParmParse pp_algo("algo");
43 bool isr = false;
44 pp_algo.queryAdd("isr", isr);
45
46 // Call the ISR bend function
47 auto const [element_has_isr, R] = impactx::particles::wakefields::ISRBendElement(element_variant, particle_container.GetRefParticle());
48
49 // Enter loop if lattice has bend element
50 if (isr && element_has_isr)
51 {
52
53 int isr_order = 1;
54 pp_algo.queryAddWithParser("isr_order", isr_order);
55
56 bool isr_on_ref_part = false;
57 pp_algo.queryAdd("isr_on_ref_part", isr_on_ref_part);
58
59 // Call function to kick particles with wake
60 impactx::particles::wakefields::ISRPush(particle_container, slice_ds, R, isr_order, isr_on_ref_part);
61 }
62 }
63
64} // namespace impactx::particles::wakefields
65
66#endif // HANDLE_ISR_H
#define BL_PROFILE(a)
int queryAdd(std::string_view name, T &ref)
int queryAddWithParser(std::string_view name, T &ref)
Definition ImpactXParticleContainer.H:136
RefPart & GetRefParticle()
Definition ImpactXParticleContainer.cpp:419
amrex_real Real
Definition ChargeBinning.cpp:17
void HandleISR(impactx::ImpactXParticleContainer &particle_container, T_Element const &element_variant, amrex::Real slice_ds)
Definition HandleISR.H:32
void ISRPush(ImpactXParticleContainer &pc, amrex::ParticleReal slice_ds, amrex::ParticleReal rc, int isr_order, bool isr_on_ref_part)
Definition ISRPush.cpp:23
std::tuple< bool, amrex::Real > ISRBendElement(VariantType const &element_variant, RefPart const &refpart)
Definition ISRBendElement.H:35