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#include "mixin/TrackedVector.H"
25
26#include <ablastr/constant.H>
27
28#include <AMReX.H>
29#include <AMReX_Extension.H>
30#include <AMReX_Math.H>
31#include <AMReX_REAL.H>
32#include <AMReX_SIMD.H>
33#include <AMReX_SmallMatrix.H>
34
35#include <cmath>
36#include <memory>
37#include <stdexcept>
38#include <tuple>
39#include <vector>
40
41
42namespace impactx::elements
43{
54 {
56 0.1644024074311037,
57 -0.1324009958969339,
58 4.3443060026047219e-002,
59 8.5602654094946495e-002,
60 -0.2433578169042885,
61 0.5297150596779437,
62 0.7164884680963959,
63 -5.2579522442877296e-003,
64 -5.5025369142193678e-002,
65 4.6845673335028933e-002,
66 -2.3279346335638568e-002,
67 4.0800777539657775e-003,
68 4.1378326533752169e-003,
69 -2.5040533340490805e-003,
70 -4.0654981400000964e-003,
71 9.6630592067498289e-003,
72 -8.5275895985990214e-003,
73 -5.8078747006425020e-002,
74 -2.4044337836660403e-002,
75 1.0968240064697212e-002,
76 -3.4461179858301418e-003,
77 -8.1201564869443749e-004,
78 2.1438992904959380e-003,
79 -1.4997753525697276e-003,
80 1.8685171825676386e-004
81 };
82
84 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
85 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
86 0, 0, 0
87 };
88 };
89
100
101 struct RFCavity
102 : public mixin::Named,
103 public mixin::BeamOptic<RFCavity>,
104 public mixin::LinearTransport<RFCavity>,
105 public mixin::Thick,
106 public mixin::Alignment,
107 public mixin::NoFinalize,
108 public mixin::PipeAperture,
110 public amrex::simd::Vectorized<amrex::simd::native_simd_size_particlereal>
111 {
112 static constexpr auto type = "RFCavity";
114
116
137 amrex::ParticleReal escale,
140 std::vector<amrex::ParticleReal> cos_coef,
141 std::vector<amrex::ParticleReal> sin_coef,
144 amrex::ParticleReal rotation_degree = 0,
147 int mapsteps = 10,
148 int nslice = 1,
149 std::optional<std::string> name = std::nullopt
150 )
151 : Named(std::move(name)),
152 Thick(ds, nslice),
153 Alignment(dx, dy, rotation_degree),
155 m_escale(escale), m_freq(freq), m_phase(phase), m_mapsteps(mapsteps),
156 m_id(DynamicData::allocate_id())
157 {
158 m_ncoef = int(cos_coef.size());
159 if (m_ncoef != int(sin_coef.size()))
160 throw std::runtime_error("RFCavity: cos and sin coefficients must have same length!");
161
162 auto& coef = DynamicData::emplace(
163 m_id,
164 std::move(cos_coef),
165 std::move(sin_coef)
166 );
167 m_cos_h_data = coef.cos.host_const().data();
168 m_sin_h_data = coef.sin.host_const().data();
169 }
170
172 void reverse () {
173 // Reversing ds traverses the Fourier profile in the opposite z direction,
174 // so the odd sine terms change sign implicitly via sin(-kz) = -sin(kz).
175 Thick::reverse();
176 }
177
179 using BeamOptic::operator();
180
188 void compute_constants (RefPart const & refpart)
189 {
190 using namespace amrex::literals; // for _rt and _prt
191
192 Alignment::compute_constants(refpart);
193
194 auto const & coef = *DynamicData::get(m_id);
195 m_cos_d_data = coef.cos.device_const().data();
196 m_sin_d_data = coef.sin.device_const().data();
197 }
198
213 template<typename T_Real=amrex::ParticleReal, typename T_IdCpu=uint64_t>
216 T_Real & AMREX_RESTRICT x,
217 T_Real & AMREX_RESTRICT y,
218 T_Real & AMREX_RESTRICT t,
219 T_Real & AMREX_RESTRICT px,
220 T_Real & AMREX_RESTRICT py,
221 T_Real & AMREX_RESTRICT pt,
222 [[maybe_unused]] T_IdCpu const & AMREX_RESTRICT idcpu,
223 [[maybe_unused]] RefPart const & AMREX_RESTRICT refpart
224 ) const
225 {
226 using namespace amrex::literals; // for _rt and _prt
227
228 // get the linear map
230
231 // symplectic linear map for the RF cavity is computed using the
232 // Hamiltonian formalism as described in:
233 // https://uspas.fnal.gov/materials/09UNM/ComputationalMethods.pdf.
234 // R denotes the transfer matrix in the basis (x,px,y,py,t,pt),
235 // so that, e.g., R(3,4) = dyf/dpyi.
236 amrex::SmallVector<T_Real, 6, 1> const v{x, px, y, py, t, pt};
237
238 // push particles using the linear map
239 auto const out = R * v;
240
241 // assign updated values
242 x = out[1];
243 px = out[2];
244 y = out[3];
245 py = out[4];
246 t = out[5];
247 pt = out[6];
248 }
249
255 void operator() (RefPart & AMREX_RESTRICT refpart) const
256 {
257 using namespace amrex::literals; // for _rt and _prt
258 using amrex::Math::powi;
259
260 // assign input reference particle values
261 amrex::ParticleReal const x = refpart.x;
262 amrex::ParticleReal const px = refpart.px;
263 amrex::ParticleReal const y = refpart.y;
264 amrex::ParticleReal const py = refpart.py;
265 amrex::ParticleReal const z = refpart.z;
266 amrex::ParticleReal const pz = refpart.pz;
267 amrex::ParticleReal const pt = refpart.pt;
268 amrex::ParticleReal const s = refpart.s;
269 amrex::ParticleReal const sedge = refpart.sedge;
270
271 // initialize linear map (deviation) values
272 m_map = decltype(m_map)::Identity();
273
274 // initialize the spin-orbit coupling matrix
275 m_spin_coupling = {};
276
277 // length of the current slice
278 amrex::ParticleReal const slice_ds = m_ds / nslice();
279
280 // compute initial value of beta*gamma
281 amrex::ParticleReal const bgi = std::sqrt(powi<2>(pt) - 1.0_prt);
282
283 // call integrator to advance (t,pt)
284 amrex::ParticleReal const zin = s - sedge;
285 amrex::ParticleReal const zout = zin + slice_ds;
286 int const nsteps = m_mapsteps;
287
288 integrators::symp2_integrate_split3(refpart,zin,zout,nsteps,*this);
289 amrex::ParticleReal const ptf = refpart.pt;
290
291 // advance position (x,y,z)
292 refpart.x = x + slice_ds*px/bgi;
293 refpart.y = y + slice_ds*py/bgi;
294 refpart.z = z + slice_ds*pz/bgi;
295
296 // compute final value of beta*gamma
297 amrex::ParticleReal const bgf = std::sqrt(powi<2>(ptf) - 1.0_prt);
298
299 // advance momentum (px,py,pz)
300 refpart.px = px*bgf/bgi;
301 refpart.py = py*bgf/bgi;
302 refpart.pz = pz*bgf/bgi;
303
304 // convert linear map from dynamic to static units
305 amrex::ParticleReal scale_in = 1.0_prt;
306 amrex::ParticleReal scale_fin = 1.0_prt;
307
308 for (int i=1; i<7; i++) {
309 for (int j=1; j<7; j++) {
310 if( i % 2 == 0)
311 scale_fin = bgf;
312 else
313 scale_fin = 1.0_prt;
314 if( j % 2 == 0)
315 scale_in = bgi;
316 else
317 scale_in = 1.0_prt;
318 m_map(i, j) = m_map(i, j) * scale_in / scale_fin;
319 }
320 }
321
322 // convert spin-orbit coupling map from dynamic to static units
323 for (int i=1; i<4; i++) {
324 for (int j=2; j<7; j+=2) {
325 m_spin_coupling(i, j) *= bgi;
326 }
327 }
328
329 // advance integrated path length
330 refpart.s = s + slice_ds;
331 }
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
392
394 using LinearTransport::operator();
395
401 Map6x6
402 transport_map ([[maybe_unused]] RefPart const & AMREX_RESTRICT refpart) const
403 {
404
406 R = m_map;
407
408 // apply the transverse rotation (roll) alignment error
409 return rotate_aligned_map(R);
410 }
411
418 std::tuple<amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal>
420 RF_Efield (amrex::ParticleReal const zeval) const
421 {
422 using namespace amrex::literals; // for _rt and _prt
423 using amrex::Math::powi;
424
425 // pick the right data depending if we are on the host side
426 // (reference particle push) or device side (particles):
427#if AMREX_DEVICE_COMPILE
428 amrex::ParticleReal const * cos_data = m_cos_d_data;
429 amrex::ParticleReal const * sin_data = m_sin_d_data;
430#else
431 amrex::ParticleReal const * cos_data = m_cos_h_data;
432 amrex::ParticleReal const * sin_data = m_sin_h_data;
433#endif
434
435 // specify constants
437 amrex::ParticleReal const zlen = std::abs(m_ds);
438 amrex::ParticleReal const zmid = zlen * 0.5_prt;
439
440 // compute on-axis electric field (z is relative to cavity midpoint)
441 amrex::ParticleReal efield = 0.0;
442 amrex::ParticleReal efieldp = 0.0;
443 amrex::ParticleReal efieldpp = 0.0;
444 amrex::ParticleReal efieldint = 0.0;
445 amrex::ParticleReal const z = zeval - zmid;
446
447 if (std::abs(z) <= zmid)
448 {
449 efield = 0.5_prt*cos_data[0];
450 efieldint = z*efield;
451 for (int j=1; j < m_ncoef; ++j)
452 {
453 efield = efield + cos_data[j] * std::cos(j*2*pi*z/zlen) +
454 sin_data[j] * std::sin(j*2*pi*z/zlen);
455 efieldp = efieldp-j*2*pi*cos_data[j] * std::sin(j*2*pi*z/zlen)/zlen +
456 j*2*pi*sin_data[j] * std::cos(j*2*pi*z/zlen)/zlen;
457 efieldpp = efieldpp- powi<2>(j*2*pi*cos_data[j]/zlen) * std::cos(j*2*pi*z/zlen) -
458 powi<2>(j*2*pi*sin_data[j]/zlen) * std::sin(j*2*pi*z/zlen);
459 efieldint = efieldint + zlen*cos_data[j] * std::sin(j*2*pi*z/zlen)/(j*2*pi) -
460 zlen*sin_data[j] * std::cos(j*2*pi*z/zlen)/(j*2*pi);
461 }
462 }
463 else // endpoint of the RF, outsize zlen
464 {
465 efieldint = std::copysign(zmid, z)*0.5_prt*cos_data[0];
466 for (int j=1; j < m_ncoef; ++j)
467 {
468 efieldint = efieldint - zlen*sin_data[j] * std::cos(j*pi)/(j*2*pi);
469 }
470 }
471 return std::make_tuple(efield, efieldp, efieldint);
472 }
473
483 void map3 (amrex::ParticleReal const tau,
484 RefPart & refpart,
485 [[maybe_unused]] amrex::ParticleReal & zeval) const
486 {
487 using namespace amrex::literals; // for _rt and _prt
488 using amrex::Math::powi;
489
490 // push the reference particle
491 amrex::ParticleReal const t = refpart.t;
492 amrex::ParticleReal const pt = refpart.pt;
493
494 if (pt < -1.0_prt) {
495 refpart.t = t + tau/std::sqrt(1.0_prt - powi<-2>(pt));
496 refpart.pt = pt;
497 }
498 else {
499 refpart.t = t;
500 refpart.pt = pt;
501 }
502
503 // push the linear map equations
507 amrex::ParticleReal const betgam = refpart.beta_gamma();
508
509 m_map(5,5) = R(5,5) + tau*R(6,5)/powi<3>(betgam);
510 m_map(5,6) = R(5,6) + tau*R(6,6)/powi<3>(betgam);
511
512 // BELOW: if spin is needed only:
513 // Define parameters and intermediate constants
516 amrex::ParticleReal const k = (2_prt*pi/c)*m_freq;
517 amrex::ParticleReal const phi = m_phase*(pi/180_prt);
518 amrex::ParticleReal const E0 = m_escale;
519 auto [ez, ezp, ezint] = RF_Efield(zeval);
521
522 // Update spin-orbit coupling matrix here
524 amrex::ParticleReal cos_term = std::cos(k*t+phi);
525 amrex::ParticleReal sin_term = std::sin(k*t+phi);
526 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);
527 dA(1,4) = E0 * tau / std::sqrt(1_prt + powi<2>(pt)) * cos_term * (G + 1_prt/(1_prt - pt));
528 dA(2,1) = -dA(1,3);
529 dA(2,2) = -dA(1,4);
530
531 // update the spin-orbit coupling matrix here
532 m_spin_coupling = A + dA*R;
533 }
534
544 void map2 (amrex::ParticleReal const tau,
545 RefPart & refpart,
546 amrex::ParticleReal & zeval) const
547 {
548 using namespace amrex::literals; // for _rt and _prt
549 using amrex::Math::powi;
550
551 amrex::ParticleReal const t = refpart.t;
552 amrex::ParticleReal const pt = refpart.pt;
553
554 // Define parameters and intermediate constants
557 amrex::ParticleReal const k = (2_prt*pi/c)*m_freq;
558 amrex::ParticleReal const phi = m_phase*(pi/180_prt);
559 amrex::ParticleReal const E0 = m_escale;
560
561 // push the reference particle
562 auto [ez, ezp, ezint] = RF_Efield(zeval);
563 amrex::ignore_unused(ez, ezint);
564
565 refpart.t = t;
566 refpart.pt = pt;
567
568 // push the linear map equations
570 amrex::ParticleReal const s = tau/refpart.beta_gamma();
571 amrex::ParticleReal const L = E0*ezp * std::sin(k*t+phi)/(2_prt*k);
572
573 m_map(1,1) = (1_prt-s*L)*R(1,1) + s*R(2,1);
574 m_map(1,2) = (1_prt-s*L)*R(1,2) + s*R(2,2);
575 m_map(2,1) = -s * powi<2>(L)*R(1,1) + (1_prt+s*L)*R(2,1);
576 m_map(2,2) = -s * powi<2>(L)*R(1,2) + (1_prt+s*L)*R(2,2);
577
578 m_map(3,3) = (1_prt-s*L)*R(3,3) + s*R(4,3);
579 m_map(3,4) = (1_prt-s*L)*R(3,4) + s*R(4,4);
580 m_map(4,3) = -s * powi<2>(L)*R(3,3) + (1_prt+s*L)*R(4,3);
581 m_map(4,4) = -s * powi<2>(L)*R(3,4) + (1_prt+s*L)*R(4,4);
582
583 }
584
594 void map1 (amrex::ParticleReal const tau,
595 RefPart & refpart,
596 amrex::ParticleReal & zeval) const
597 {
598 using namespace amrex::literals; // for _rt and _prt
599
600 amrex::ParticleReal const t = refpart.t;
601 amrex::ParticleReal const pt = refpart.pt;
602 amrex::ParticleReal const z = zeval;
603
604 // Define parameters and intermediate constants
607 amrex::ParticleReal const k = (2_prt*pi/c)*m_freq;
608 amrex::ParticleReal const phi = m_phase*(pi/180_prt);
609 amrex::ParticleReal const E0 = m_escale;
610
611 // push the reference particle
612 auto [ez, ezp, ezint] = RF_Efield(z);
614 zeval = z + tau;
615 auto [ezf, ezpf, ezintf] = RF_Efield(zeval);
617
618 refpart.t = t;
619 refpart.pt = pt - E0*(ezintf-ezint) * std::cos(k*t+phi);
620
621 // push the linear map equations
623 amrex::ParticleReal const M = E0*(ezintf-ezint)*k * std::sin(k*t+phi);
624 amrex::ParticleReal const L = E0*(ezpf-ezp) * std::sin(k*t+phi)/(2_prt*k)+M*0.5_prt;
625
626 m_map(2,1) = L*R(1,1) + R(2,1);
627 m_map(2,2) = L*R(1,2) + R(2,2);
628
629 m_map(4,3) = L*R(3,3) + R(4,3);
630 m_map(4,4) = L*R(3,4) + R(4,4);
631
632 m_map(6,5) = M*R(5,5) + R(6,5);
633 m_map(6,6) = M*R(5,6) + R(6,6);
634
635 }
636
641 int m_id;
642
643 int m_ncoef = 0;
648
649 // Reference-trajectory linearization around the reference particle.
650 // Computed during the reference-particle push and consumed during the
651 // particle push.
652 // mutable: written by the const reference push before the element is copied
653 // into the particle-push functor.
656 };
657
658} // namespace impactx
659
662
663#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:56
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
mixin::TrackedVector< amrex::ParticleReal > sin
Definition RFCavity.H:98
mixin::TrackedVector< amrex::ParticleReal > cos
Definition RFCavity.H:97
Definition RFCavity.H:54
amrex::Vector< amrex::ParticleReal > default_sin_coef
Definition RFCavity.H:83
amrex::Vector< amrex::ParticleReal > default_cos_coef
Definition RFCavity.H:55
Definition RFCavity.H:111
void compute_constants(RefPart const &refpart)
Definition RFCavity.H:188
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:420
int m_ncoef
unique RF cavity id used for data lookup map
Definition RFCavity.H:643
static constexpr auto type
Definition RFCavity.H:112
int m_id
number of map integration steps per slice
Definition RFCavity.H:641
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map1(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition RFCavity.H:594
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:637
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map3(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition RFCavity.H:483
mixin::GPUDataRegistry< CavityFourierCoefficients > DynamicData
Definition RFCavity.H:115
void reverse()
Definition RFCavity.H:172
amrex::ParticleReal const * m_cos_h_data
number of Fourier coefficients
Definition RFCavity.H:644
amrex::ParticleReal m_freq
scaling factor for RF electric field
Definition RFCavity.H:638
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > m_map
non-owning pointer to device sine coefficients
Definition RFCavity.H:654
int m_mapsteps
RF driven phase in deg.
Definition RFCavity.H:640
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map2(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition RFCavity.H:544
amrex::ParticleReal const * m_cos_d_data
non-owning pointer to host sine coefficients
Definition RFCavity.H:646
amrex::ParticleReal const * m_sin_d_data
non-owning pointer to device cosine coefficients
Definition RFCavity.H:647
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=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, amrex::ParticleReal aperture_x=0, amrex::ParticleReal aperture_y=0, int mapsteps=10, int nslice=1, std::optional< std::string > name=std::nullopt)
Definition RFCavity.H:135
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition RFCavity.H:402
amrex::ParticleReal const * m_sin_h_data
non-owning pointer to host cosine coefficients
Definition RFCavity.H:645
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:215
amrex::SmallMatrix< amrex::ParticleReal, 3, 6, amrex::Order::F, 1 > m_spin_coupling
linearized map
Definition RFCavity.H:655
ImpactXParticleContainer::ParticleType PType
Definition RFCavity.H:113
amrex::ParticleReal m_phase
RF frequency in Hz.
Definition RFCavity.H:639
Definition alignment.H:29
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy() const
Definition alignment.H:189
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx() const
Definition alignment.H:179
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 rotate_aligned_map(Map6x6 const &R) const
Definition alignment.H:263
Alignment(amrex::ParticleReal dx, amrex::ParticleReal dy, amrex::ParticleReal rotation_degree)
Definition alignment.H:39
Definition beamoptic.H:529
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
AMREX_GPU_HOST Named(std::optional< std::string > name)
Definition named.H:57
AMREX_FORCE_INLINE std::string name() const
Definition named.H:122
Definition nofinalize.H:22
Definition pipeaperture.H:26
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_x() const
Definition pipeaperture.H:90
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_y() const
Definition pipeaperture.H:101
PipeAperture(amrex::ParticleReal aperture_x, amrex::ParticleReal aperture_y)
Definition pipeaperture.H:32
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
Thick(amrex::ParticleReal ds, int nslice)
Definition thick.H:30
amrex::ParticleReal m_ds
Definition thick.H:68
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds() const
Definition thick.H:53
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition thick.H:43
Definition TrackedVector.H:49