ImpactX
Loading...
Searching...
No Matches
HandleISR.H
Go to the documentation of this file.
1/* Copyright 2022-2023 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{
29 template <typename T_Element>
30 void HandleISR (
31 impactx::ImpactXParticleContainer& particle_container,
32 T_Element const& element_variant,
33 amrex::Real slice_ds
34 )
35 {
36 BL_PROFILE("impactx::particles::wakefields::HandleISR")
37
38 amrex::ParmParse pp_algo("algo");
39 bool isr = false;
40 pp_algo.queryAdd("isr", isr);
41
42 // Call the ISR bend function
43 auto const [element_has_isr, R] = impactx::particles::wakefields::ISRBendElement(element_variant, particle_container.GetRefParticle());
44
45 // Enter loop if lattice has bend element
46 if (isr && element_has_isr)
47 {
48
49 int isr_order = 1;
50 pp_algo.queryAddWithParser("isr_order", isr_order);
51
52 // Call function to kick particles with wake
53 impactx::particles::wakefields::ISRPush(particle_container, slice_ds, R, isr_order);
54 }
55 }
56
57} // namespace impactx::particles::wakefields
58
59#endif // HANDLE_ISR_H
#define BL_PROFILE(a)
int queryAddWithParser(const char *name, T &ref)
int queryAdd(const char *name, T &ref)
Definition ImpactXParticleContainer.H:133
RefPart & GetRefParticle()
Definition ImpactXParticleContainer.cpp:378
Definition ChargeBinning.cpp:17
void ISRPush(ImpactXParticleContainer &pc, amrex::ParticleReal slice_ds, amrex::ParticleReal rc, int isr_order)
Definition ISRPush.cpp:23
void HandleISR(impactx::ImpactXParticleContainer &particle_container, T_Element const &element_variant, amrex::Real slice_ds)
Definition HandleISR.H:30
std::tuple< bool, amrex::Real > ISRBendElement(VariantType const &element_variant, RefPart const &refpart)
Definition ISRBendElement.H:35