ImpactX
Loading...
Searching...
No Matches
RFCavity.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: Chad Mitchell, Axel Huebl
8 * License: BSD-3-Clause-LBNL
9 */
10#ifndef IMPACTX_RFCAVITY_H
11#define IMPACTX_RFCAVITY_H
12
15#include "mixin/alignment.H"
16#include "mixin/beamoptic.H"
17#include "mixin/dynamicdata.H"
19#include "mixin/named.H"
20#include "mixin/nofinalize.H"
21#include "mixin/pipeaperture.H"
22#include "mixin/thick.H"
23#include "mixin/spintransport.H"
24
25#include <ablastr/constant.H>
26
27#include <AMReX.H>
28#include <AMReX_Extension.H>
29#include <AMReX_Math.H>
30#include <AMReX_REAL.H>
31#include <AMReX_SIMD.H>
32#include <AMReX_SmallMatrix.H>
33#include <AMReX_TrackedVector.H>
34
35#include <cmath>
36#include <memory>
37#include <stdexcept>
38#include <tuple>
39#include <vector>
40
41namespace impactx::elements
42{
53 {
55 0.1644024074311037,
56 -0.1324009958969339,
57 4.3443060026047219e-002,
58 8.5602654094946495e-002,
59 -0.2433578169042885,
60 0.5297150596779437,
61 0.7164884680963959,
62 -5.2579522442877296e-003,
63 -5.5025369142193678e-002,
64 4.6845673335028933e-002,
65 -2.3279346335638568e-002,
66 4.0800777539657775e-003,
67 4.1378326533752169e-003,
68 -2.5040533340490805e-003,
69 -4.0654981400000964e-003,
70 9.6630592067498289e-003,
71 -8.5275895985990214e-003,
72 -5.8078747006425020e-002,
73 -2.4044337836660403e-002,
74 1.0968240064697212e-002,
75 -3.4461179858301418e-003,
76 -8.1201564869443749e-004,
77 2.1438992904959380e-003,
78 -1.4997753525697276e-003,
79 1.8685171825676386e-004
80 };
81
83 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
84 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
85 0, 0, 0
86 };
87 };
88
99
100 struct RFCavity
101 : public mixin::Named,
102 public mixin::BeamOptic<RFCavity>,
103 public mixin::LinearTransport<RFCavity>,
104 public mixin::Thick,
105 public mixin::Alignment,
106 public mixin::NoFinalize,
107 public mixin::PipeAperture,
109 public amrex::simd::Vectorized<amrex::simd::native_simd_size_particlereal>
110 {
111 static constexpr auto type = "RFCavity";
113
115
116 static constexpr int DEFAULT_mapsteps = 10;
117
138 amrex::ParticleReal escale,
141 std::vector<amrex::ParticleReal> cos_coef,
142 std::vector<amrex::ParticleReal> sin_coef,
148 int mapsteps = DEFAULT_mapsteps,
150 std::optional<std::string> name = DEFAULT_name
151 )
152 : Named(std::move(name)),
153 Thick(ds, nslice),
154 Alignment(dx, dy, rotation_degree),
156 m_escale(escale), m_freq(freq), m_phase(phase), m_mapsteps(mapsteps),
157 m_id(DynamicData::allocate_id())
158 {
159 m_ncoef = int(cos_coef.size());
160 if (m_ncoef != int(sin_coef.size()))
161 throw std::runtime_error("RFCavity: cos and sin coefficients must have same length!");
162
163 auto& coef = DynamicData::emplace(
164 m_id,
165 std::move(cos_coef),
166 std::move(sin_coef)
167 );
168 m_cos_h_data = coef.cos.host_const().data();
169 m_sin_h_data = coef.sin.host_const().data();
170 }
171
173 void reverse () {
174 // Reversing ds traverses the Fourier profile in the opposite z direction,
175 // so the odd sine terms change sign implicitly via sin(-kz) = -sin(kz).
176 Thick::reverse();
177 }
178
180 using BeamOptic::operator();
181
189 void compute_constants (RefPart const & refpart)
190 {
191 using namespace amrex::literals; // for _rt and _prt
192
193 Alignment::compute_constants(refpart);
194
195 auto const & coef = *DynamicData::get(m_id);
196 m_cos_d_data = coef.cos.device_const().data();
197 m_sin_d_data = coef.sin.device_const().data();
198 }
199
214 template<typename T_Real=amrex::ParticleReal, typename T_IdCpu=uint64_t>
217 T_Real & AMREX_RESTRICT x,
218 T_Real & AMREX_RESTRICT y,
219 T_Real & AMREX_RESTRICT t,
220 T_Real & AMREX_RESTRICT px,
221 T_Real & AMREX_RESTRICT py,
222 T_Real & AMREX_RESTRICT pt,
223 [[maybe_unused]] T_IdCpu const & AMREX_RESTRICT idcpu,
224 [[maybe_unused]] RefPart const & AMREX_RESTRICT refpart
225 ) const
226 {
227 using namespace amrex::literals; // for _rt and _prt
228
229 // get the linear map
231
232 // symplectic linear map for the RF cavity is computed using the
233 // Hamiltonian formalism as described in:
234 // https://uspas.fnal.gov/materials/09UNM/ComputationalMethods.pdf.
235 // R denotes the transfer matrix in the basis (x,px,y,py,t,pt),
236 // so that, e.g., R(3,4) = dyf/dpyi.
237 amrex::SmallVector<T_Real, 6, 1> const v{x, px, y, py, t, pt};
238
239 // push particles using the linear map
240 auto const out = R * v;
241
242 // assign updated values
243 x = out[1];
244 px = out[2];
245 y = out[3];
246 py = out[4];
247 t = out[5];
248 pt = out[6];
249 }
250
256 void operator() (RefPart & AMREX_RESTRICT refpart) const
257 {
258 using namespace amrex::literals; // for _rt and _prt
259 using amrex::Math::powi;
260
261 // assign input reference particle values
262 amrex::ParticleReal const x = refpart.x;
263 amrex::ParticleReal const px = refpart.px;
264 amrex::ParticleReal const y = refpart.y;
265 amrex::ParticleReal const py = refpart.py;
266 amrex::ParticleReal const z = refpart.z;
267 amrex::ParticleReal const pz = refpart.pz;
268 amrex::ParticleReal const pt = refpart.pt;
269 amrex::ParticleReal const s = refpart.s;
270 amrex::ParticleReal const sedge = refpart.sedge;
271
272 // initialize linear map (deviation) values
273 m_map = decltype(m_map)::Identity();
274
275 // initialize the spin-orbit coupling matrix
276 m_spin_coupling = {};
277
278 // length of the current slice
279 amrex::ParticleReal const slice_ds = m_ds / nslice();
280
281 // compute initial value of beta*gamma
282 amrex::ParticleReal const bgi = std::sqrt(powi<2>(pt) - 1.0_prt);
283
284 // call integrator to advance (t,pt)
285 amrex::ParticleReal const zin = s - sedge;
286 amrex::ParticleReal const zout = zin + slice_ds;
287 int const nsteps = m_mapsteps;
288
289 integrators::symp2_integrate_split3(refpart,zin,zout,nsteps,*this);
290 amrex::ParticleReal const ptf = refpart.pt;
291
292 // advance position (x,y,z)
293 refpart.x = x + slice_ds*px/bgi;
294 refpart.y = y + slice_ds*py/bgi;
295 refpart.z = z + slice_ds*pz/bgi;
296
297 // compute final value of beta*gamma
298 amrex::ParticleReal const bgf = std::sqrt(powi<2>(ptf) - 1.0_prt);
299
300 // advance momentum (px,py,pz)
301 refpart.px = px*bgf/bgi;
302 refpart.py = py*bgf/bgi;
303 refpart.pz = pz*bgf/bgi;
304
305 // convert linear map from dynamic to static units
306 amrex::ParticleReal scale_in = 1.0_prt;
307 amrex::ParticleReal scale_fin = 1.0_prt;
308
309 for (int i=1; i<7; i++) {
310 for (int j=1; j<7; j++) {
311 if( i % 2 == 0)
312 scale_fin = bgf;
313 else
314 scale_fin = 1.0_prt;
315 if( j % 2 == 0)
316 scale_in = bgi;
317 else
318 scale_in = 1.0_prt;
319 m_map(i, j) = m_map(i, j) * scale_in / scale_fin;
320 }
321 }
322
323 // convert spin-orbit coupling map from dynamic to static units
324 for (int i=1; i<4; i++) {
325 for (int j=2; j<7; j+=2) {
326 m_spin_coupling(i, j) *= bgi;
327 }
328 }
329
330 // advance integrated path length
331 refpart.s = s + slice_ds;
332 }
333
348 template<typename T_Real=amrex::ParticleReal, typename T_IdCpu=uint64_t>
351 T_Real & AMREX_RESTRICT x,
352 T_Real & AMREX_RESTRICT y,
353 T_Real & AMREX_RESTRICT t,
354 T_Real & AMREX_RESTRICT px,
355 T_Real & AMREX_RESTRICT py,
356 T_Real & AMREX_RESTRICT pt,
357 T_Real & AMREX_RESTRICT sx,
358 T_Real & AMREX_RESTRICT sy,
359 T_Real & AMREX_RESTRICT sz,
360 T_IdCpu const & AMREX_RESTRICT idcpu,
361 RefPart const & AMREX_RESTRICT refpart
362 ) const
363 {
364 using namespace amrex::literals; // for _rt and _prt
365
366 // initialize the three components of the axis-angle vector
367 T_Real lambdax = 0_prt;
368 T_Real lambday = 0_prt;
369 T_Real lambdaz = 0_prt;
370
371 // store the phase space variables in vector form
372 amrex::SmallVector<T_Real, 6, 1> const v{x, px, y, py, t, pt};
373
374 // get the spin-orbit coupling matrix
376
377 // use phase space variables to obtain the angle-axis generator of spin rotation
378 auto const out = A * v;
379
380 // update the angle-axis generator
381 lambdax = out[1];
382 lambday = out[2];
383 lambdaz = out[3];
384
385 // push the spin vector using the generator just determined
386 rotate_spin(lambdax,lambday,lambdaz,sx,sy,sz);
387
388 // phase space push
389 (*this)(x, y, t, px, py, pt, idcpu, refpart);
390 }
391
393 using LinearTransport::operator();
394
400 Map6x6
401 transport_map ([[maybe_unused]] RefPart const & AMREX_RESTRICT refpart) const
402 {
403
405 R = m_map;
406
407 // apply the transverse rotation (roll) alignment error
408 return rotate_aligned_map(R);
409 }
410
417 std::tuple<amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal>
419 RF_Efield (amrex::ParticleReal const zeval) const
420 {
421 using namespace amrex::literals; // for _rt and _prt
422 using amrex::Math::powi;
423
424 // pick the right data depending if we are on the host side
425 // (reference particle push) or device side (particles):
426#if AMREX_DEVICE_COMPILE
427 amrex::ParticleReal const * cos_data = m_cos_d_data;
428 amrex::ParticleReal const * sin_data = m_sin_d_data;
429#else
430 amrex::ParticleReal const * cos_data = m_cos_h_data;
431 amrex::ParticleReal const * sin_data = m_sin_h_data;
432#endif
433
434 // specify constants
436 amrex::ParticleReal const zlen = std::abs(m_ds);
437 amrex::ParticleReal const zmid = zlen * 0.5_prt;
438
439 // compute on-axis electric field (z is relative to cavity midpoint)
440 amrex::ParticleReal efield = 0.0;
441 amrex::ParticleReal efieldp = 0.0;
442 amrex::ParticleReal efieldpp = 0.0;
443 amrex::ParticleReal efieldint = 0.0;
444 amrex::ParticleReal const z = zeval - zmid;
445
446 if (std::abs(z) <= zmid)
447 {
448 efield = 0.5_prt*cos_data[0];
449 efieldint = z*efield;
450 for (int j=1; j < m_ncoef; ++j)
451 {
452 efield = efield + cos_data[j] * std::cos(j*2*pi*z/zlen) +
453 sin_data[j] * std::sin(j*2*pi*z/zlen);
454 efieldp = efieldp-j*2*pi*cos_data[j] * std::sin(j*2*pi*z/zlen)/zlen +
455 j*2*pi*sin_data[j] * std::cos(j*2*pi*z/zlen)/zlen;
456 efieldpp = efieldpp- powi<2>(j*2*pi*cos_data[j]/zlen) * std::cos(j*2*pi*z/zlen) -
457 powi<2>(j*2*pi*sin_data[j]/zlen) * std::sin(j*2*pi*z/zlen);
458 efieldint = efieldint + zlen*cos_data[j] * std::sin(j*2*pi*z/zlen)/(j*2*pi) -
459 zlen*sin_data[j] * std::cos(j*2*pi*z/zlen)/(j*2*pi);
460 }
461 }
462 else // endpoint of the RF, outsize zlen
463 {
464 efieldint = std::copysign(zmid, z)*0.5_prt*cos_data[0];
465 for (int j=1; j < m_ncoef; ++j)
466 {
467 efieldint = efieldint - zlen*sin_data[j] * std::cos(j*pi)/(j*2*pi);
468 }
469 }
470 return std::make_tuple(efield, efieldp, efieldint);
471 }
472
482 void map3 (amrex::ParticleReal const tau,
483 RefPart & refpart,
484 [[maybe_unused]] amrex::ParticleReal & zeval) const
485 {
486 using namespace amrex::literals; // for _rt and _prt
487 using amrex::Math::powi;
488
489 // push the reference particle
490 amrex::ParticleReal const t = refpart.t;
491 amrex::ParticleReal const pt = refpart.pt;
492
493 if (pt < -1.0_prt) {
494 refpart.t = t + tau/std::sqrt(1.0_prt - powi<-2>(pt));
495 refpart.pt = pt;
496 }
497 else {
498 refpart.t = t;
499 refpart.pt = pt;
500 }
501
502 // push the linear map equations
506 amrex::ParticleReal const betgam = refpart.beta_gamma();
507
508 m_map(5,5) = R(5,5) + tau*R(6,5)/powi<3>(betgam);
509 m_map(5,6) = R(5,6) + tau*R(6,6)/powi<3>(betgam);
510
511 // BELOW: if spin is needed only:
512 // Define parameters and intermediate constants
515 amrex::ParticleReal const k = (2_prt*pi/c)*m_freq;
516 amrex::ParticleReal const phi = m_phase*(pi/180_prt);
517 amrex::ParticleReal const E0 = m_escale;
518 auto [ez, ezp, ezint] = RF_Efield(zeval);
520
521 // Update spin-orbit coupling matrix here
523 amrex::ParticleReal cos_term = std::cos(k*t+phi);
524 amrex::ParticleReal sin_term = std::sin(k*t+phi);
525 dA(1,3) = E0 * tau / 2_prt * (k * ez * (G*pt - 1_prt) * sin_term / std::sqrt(1_prt + powi<2>(pt)) + cos_term * (G + 1_prt/(1_prt - pt)) * ezp);
526 dA(1,4) = E0 * tau / std::sqrt(1_prt + powi<2>(pt)) * cos_term * (G + 1_prt/(1_prt - pt));
527 dA(2,1) = -dA(1,3);
528 dA(2,2) = -dA(1,4);
529
530 // update the spin-orbit coupling matrix here
531 m_spin_coupling = A + dA*R;
532 }
533
543 void map2 (amrex::ParticleReal const tau,
544 RefPart & refpart,
545 amrex::ParticleReal & zeval) const
546 {
547 using namespace amrex::literals; // for _rt and _prt
548 using amrex::Math::powi;
549
550 amrex::ParticleReal const t = refpart.t;
551 amrex::ParticleReal const pt = refpart.pt;
552
553 // Define parameters and intermediate constants
556 amrex::ParticleReal const k = (2_prt*pi/c)*m_freq;
557 amrex::ParticleReal const phi = m_phase*(pi/180_prt);
558 amrex::ParticleReal const E0 = m_escale;
559
560 // push the reference particle
561 auto [ez, ezp, ezint] = RF_Efield(zeval);
562 amrex::ignore_unused(ez, ezint);
563
564 refpart.t = t;
565 refpart.pt = pt;
566
567 // push the linear map equations
569 amrex::ParticleReal const s = tau/refpart.beta_gamma();
570 amrex::ParticleReal const L = E0*ezp * std::sin(k*t+phi)/(2_prt*k);
571
572 m_map(1,1) = (1_prt-s*L)*R(1,1) + s*R(2,1);
573 m_map(1,2) = (1_prt-s*L)*R(1,2) + s*R(2,2);
574 m_map(2,1) = -s * powi<2>(L)*R(1,1) + (1_prt+s*L)*R(2,1);
575 m_map(2,2) = -s * powi<2>(L)*R(1,2) + (1_prt+s*L)*R(2,2);
576
577 m_map(3,3) = (1_prt-s*L)*R(3,3) + s*R(4,3);
578 m_map(3,4) = (1_prt-s*L)*R(3,4) + s*R(4,4);
579 m_map(4,3) = -s * powi<2>(L)*R(3,3) + (1_prt+s*L)*R(4,3);
580 m_map(4,4) = -s * powi<2>(L)*R(3,4) + (1_prt+s*L)*R(4,4);
581
582 }
583
593 void map1 (amrex::ParticleReal const tau,
594 RefPart & refpart,
595 amrex::ParticleReal & zeval) const
596 {
597 using namespace amrex::literals; // for _rt and _prt
598
599 amrex::ParticleReal const t = refpart.t;
600 amrex::ParticleReal const pt = refpart.pt;
601 amrex::ParticleReal const z = zeval;
602
603 // Define parameters and intermediate constants
606 amrex::ParticleReal const k = (2_prt*pi/c)*m_freq;
607 amrex::ParticleReal const phi = m_phase*(pi/180_prt);
608 amrex::ParticleReal const E0 = m_escale;
609
610 // push the reference particle
611 auto [ez, ezp, ezint] = RF_Efield(z);
613 zeval = z + tau;
614 auto [ezf, ezpf, ezintf] = RF_Efield(zeval);
616
617 refpart.t = t;
618 refpart.pt = pt - E0*(ezintf-ezint) * std::cos(k*t+phi);
619
620 // push the linear map equations
622 amrex::ParticleReal const M = E0*(ezintf-ezint)*k * std::sin(k*t+phi);
623 amrex::ParticleReal const L = E0*(ezpf-ezp) * std::sin(k*t+phi)/(2_prt*k)+M*0.5_prt;
624
625 m_map(2,1) = L*R(1,1) + R(2,1);
626 m_map(2,2) = L*R(1,2) + R(2,2);
627
628 m_map(4,3) = L*R(3,3) + R(4,3);
629 m_map(4,4) = L*R(3,4) + R(4,4);
630
631 m_map(6,5) = M*R(5,5) + R(6,5);
632 m_map(6,6) = M*R(5,6) + R(6,6);
633
634 }
635
640 int m_id;
641
642 int m_ncoef = 0;
647
648 // Reference-trajectory linearization around the reference particle.
649 // Computed during the reference-particle push and consumed during the
650 // particle push.
651 // mutable: written by the const reference push before the element is copied
652 // into the particle-push functor.
655 };
656
657} // namespace impactx
658
661
662#endif // IMPACTX_RFCAVITY_H
#define AMREX_FORCE_INLINE
#define AMREX_RESTRICT
#define AMREX_GPU_HOST_DEVICE
#define AMREX_GPU_HOST
#define IMPACTX_PUSH_EXTERN_TEMPLATE(ElementType)
Definition PushAll.H:78
#define IMPACTX_GPUDATA_EXTERN(ElementType)
Definition dynamicdata.H:169
amrex_particle_real ParticleReal
constexpr auto c
constexpr T powi(T x) noexcept
__host__ __device__ void ignore_unused(const Ts &...)
SmallMatrix< T, N, 1, Order::F, StartIndex > SmallVector
Definition All.H:55
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void symp2_integrate_split3(RefPart &refpart, amrex::ParticleReal const zin, amrex::ParticleReal const zout, int const nsteps, T_Element const &element)
Definition Integrators.H:82
@ s
fixed s as the independent variable
Definition ImpactXParticleContainer.H:37
@ t
fixed t as the independent variable
Definition ImpactXParticleContainer.H:38
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > Map6x6
Definition CovarianceMatrix.H:20
static constexpr __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > Identity() noexcept
Definition ReferenceParticle.H:33
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta_gamma() const
Definition ReferenceParticle.H:167
amrex::ParticleReal pt
energy, normalized by rest energy
Definition ReferenceParticle.H:42
amrex::ParticleReal gyromagnetic_anomaly
anomalous magnetic moment [unitless]
Definition ReferenceParticle.H:45
amrex::ParticleReal t
clock time * c in meters
Definition ReferenceParticle.H:38
amrex::Gpu::TrackedVector< amrex::ParticleReal > cos
Definition RFCavity.H:96
amrex::Gpu::TrackedVector< amrex::ParticleReal > sin
Definition RFCavity.H:97
Definition RFCavity.H:53
amrex::Vector< amrex::ParticleReal > default_sin_coef
Definition RFCavity.H:82
amrex::Vector< amrex::ParticleReal > default_cos_coef
Definition RFCavity.H:54
Definition RFCavity.H:110
void compute_constants(RefPart const &refpart)
Definition RFCavity.H:189
std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RF_Efield(amrex::ParticleReal const zeval) const
Definition RFCavity.H:419
int m_ncoef
unique RF cavity id used for data lookup map
Definition RFCavity.H:642
static constexpr auto type
Definition RFCavity.H:111
int m_id
number of map integration steps per slice
Definition RFCavity.H:640
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map1(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition RFCavity.H:593
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void spin_and_phasespace_push(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT t, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py, T_Real &AMREX_RESTRICT pt, T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy, T_Real &AMREX_RESTRICT sz, T_IdCpu const &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition RFCavity.H:350
amrex::ParticleReal m_escale
Definition RFCavity.H:636
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map3(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition RFCavity.H:482
mixin::GPUDataRegistry< CavityFourierCoefficients > DynamicData
Definition RFCavity.H:114
void reverse()
Definition RFCavity.H:173
amrex::ParticleReal const * m_cos_h_data
number of Fourier coefficients
Definition RFCavity.H:643
amrex::ParticleReal m_freq
scaling factor for RF electric field
Definition RFCavity.H:637
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > m_map
non-owning pointer to device sine coefficients
Definition RFCavity.H:653
int m_mapsteps
RF driven phase in deg.
Definition RFCavity.H:639
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map2(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition RFCavity.H:543
amrex::ParticleReal const * m_cos_d_data
non-owning pointer to host sine coefficients
Definition RFCavity.H:645
amrex::ParticleReal const * m_sin_d_data
non-owning pointer to device cosine coefficients
Definition RFCavity.H:646
RFCavity(amrex::ParticleReal ds, amrex::ParticleReal escale, amrex::ParticleReal freq, amrex::ParticleReal phase, std::vector< amrex::ParticleReal > cos_coef, std::vector< amrex::ParticleReal > sin_coef, amrex::ParticleReal dx=DEFAULT_dx, amrex::ParticleReal dy=DEFAULT_dy, amrex::ParticleReal rotation_degree=DEFAULT_rotation_degree, amrex::ParticleReal aperture_x=DEFAULT_aperture_x, amrex::ParticleReal aperture_y=DEFAULT_aperture_y, int mapsteps=DEFAULT_mapsteps, int nslice=DEFAULT_nslice, std::optional< std::string > name=DEFAULT_name)
Definition RFCavity.H:136
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition RFCavity.H:401
amrex::ParticleReal const * m_sin_h_data
non-owning pointer to host cosine coefficients
Definition RFCavity.H:644
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT t, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py, T_Real &AMREX_RESTRICT pt, T_IdCpu const &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition RFCavity.H:216
static constexpr int DEFAULT_mapsteps
Definition RFCavity.H:116
amrex::SmallMatrix< amrex::ParticleReal, 3, 6, amrex::Order::F, 1 > m_spin_coupling
linearized map
Definition RFCavity.H:654
ImpactXParticleContainer::ParticleType PType
Definition RFCavity.H:112
amrex::ParticleReal m_phase
RF frequency in Hz.
Definition RFCavity.H:638
Definition alignment.H:29
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy() const
Definition alignment.H:193
static constexpr amrex::ParticleReal DEFAULT_dy
Definition alignment.H:34
static constexpr amrex::ParticleReal DEFAULT_dx
Definition alignment.H:33
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx() const
Definition alignment.H:183
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 rotate_aligned_map(Map6x6 const &R) const
Definition alignment.H:267
Alignment(amrex::ParticleReal dx, amrex::ParticleReal dy, amrex::ParticleReal rotation_degree)
Definition alignment.H:43
static constexpr amrex::ParticleReal DEFAULT_rotation_degree
Definition alignment.H:35
Definition beamoptic.H:567
static std::shared_ptr< CavityFourierCoefficients > const & get(int id)
Definition dynamicdata.H:98
static CavityFourierCoefficients & emplace(int id, Args &&... args)
Definition dynamicdata.H:125
Definition lineartransport.H:50
Definition named.H:29
static constexpr std::nullopt_t DEFAULT_name
Definition named.H:30
AMREX_GPU_HOST Named(std::optional< std::string > name)
Definition named.H:59
AMREX_FORCE_INLINE std::string name() const
Definition named.H:124
Definition nofinalize.H:22
Definition pipeaperture.H:26
static constexpr amrex::ParticleReal DEFAULT_aperture_x
Definition pipeaperture.H:27
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_x() const
Definition pipeaperture.H:93
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_y() const
Definition pipeaperture.H:104
static constexpr amrex::ParticleReal DEFAULT_aperture_y
Definition pipeaperture.H:28
PipeAperture(amrex::ParticleReal aperture_x, amrex::ParticleReal aperture_y)
Definition pipeaperture.H:35
Definition spintransport.H:36
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void rotate_spin(T_Real const &AMREX_RESTRICT lambdax, T_Real const &AMREX_RESTRICT lambday, T_Real const &AMREX_RESTRICT lambdaz, T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy, T_Real &AMREX_RESTRICT sz) const
Definition spintransport.H:48
Definition thick.H:24
static constexpr int DEFAULT_nslice
Definition thick.H:25
Thick(amrex::ParticleReal ds, int nslice)
Definition thick.H:32
amrex::ParticleReal m_ds
Definition thick.H:70
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds() const
Definition thick.H:55
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition thick.H:45