ImpactX
Loading...
Searching...
No Matches
SoftSol.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_SOFTSOL_H
11#define IMPACTX_SOFTSOL_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/TrackedVector.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
34#include <cmath>
35#include <memory>
36#include <stdexcept>
37#include <tuple>
38#include <vector>
39
40
41namespace impactx::elements
42{
56 {
58 0.350807812299706,
59 0.323554693720069,
60 0.260320578919415,
61 0.182848575294969,
62 0.106921016050403,
63 4.409581845710694E-002,
64 -9.416427163897508E-006,
65 -2.459452716865687E-002,
66 -3.272762575737291E-002,
67 -2.936414401076162E-002,
68 -1.995780078926890E-002,
69 -9.102893342953847E-003,
70 -2.456410658713271E-006,
71 5.788233017324325E-003,
72 8.040408292420691E-003,
73 7.480064552867431E-003,
74 5.230254569468851E-003,
75 2.447614547094685E-003,
76 -1.095525090532255E-006,
77 -1.614586867387170E-003,
78 -2.281365457438345E-003,
79 -2.148709081338292E-003,
80 -1.522541739363011E-003,
81 -7.185505862719508E-004,
82 -6.171194824600157E-007,
83 4.842109305036943E-004,
84 6.874508102002901E-004,
85 6.535550288205728E-004,
86 4.648795813759210E-004,
87 2.216564722797528E-004,
88 -4.100982995210341E-007,
89 -1.499332112463395E-004,
90 -2.151538438342482E-004,
91 -2.044590946652016E-004,
92 -1.468242784844341E-004
93 };
94
96 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
97 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
98 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99 0, 0, 0, 0, 0
100 };
101 };
102
113
115 : public mixin::Named,
116 public mixin::BeamOptic<SoftSolenoid>,
117 public mixin::LinearTransport<SoftSolenoid>,
118 public mixin::Thick,
119 public mixin::Alignment,
120 public mixin::NoFinalize,
121 public mixin::PipeAperture,
123 public amrex::simd::Vectorized<amrex::simd::native_simd_size_particlereal>
124 {
125 static constexpr auto type = "SoftSolenoid";
127
129
153 amrex::ParticleReal bscale,
154 std::vector<amrex::ParticleReal> cos_coef,
155 std::vector<amrex::ParticleReal> sin_coef,
156 int unit,
159 amrex::ParticleReal rotation_degree = 0,
162 int mapsteps = 10,
163 int nslice = 1,
164 std::optional<std::string> name = std::nullopt
165 )
166 : Named(std::move(name)),
167 Thick(ds, nslice),
168 Alignment(dx, dy, rotation_degree),
170 m_bscale(bscale), m_unit(unit), m_mapsteps(mapsteps),
171 m_id(DynamicData::allocate_id())
172 {
173 m_ncoef = int(cos_coef.size());
174 if (m_ncoef != int(sin_coef.size()))
175 throw std::runtime_error("SoftSolenoid: cos and sin coefficients must have same length!");
176
177 auto& coef = DynamicData::emplace(
178 m_id,
179 std::move(cos_coef),
180 std::move(sin_coef)
181 );
182 m_cos_h_data = coef.cos.host_const().data();
183 m_sin_h_data = coef.sin.host_const().data();
184 }
185
187 void reverse () {
188 // Reversing ds traverses the Fourier profile in the opposite z direction,
189 // so the odd sine terms change sign implicitly via sin(-kz) = -sin(kz).
190 Thick::reverse();
191 }
192
194 using BeamOptic::operator();
195
203 void compute_constants (RefPart const & refpart)
204 {
205 using namespace amrex::literals; // for _rt and _prt
206
207 Alignment::compute_constants(refpart);
208
209 // Ensure dynamic coefficient data is on GPU and we have fresh pointers to it
210 auto const & coef = *DynamicData::get(m_id);
211 m_cos_d_data = coef.cos.device_const().data();
212 m_sin_d_data = coef.sin.device_const().data();
213 }
214
229 template<typename T_Real=amrex::ParticleReal, typename T_IdCpu=uint64_t>
232 T_Real & AMREX_RESTRICT x,
233 T_Real & AMREX_RESTRICT y,
234 T_Real & AMREX_RESTRICT t,
235 T_Real & AMREX_RESTRICT px,
236 T_Real & AMREX_RESTRICT py,
237 T_Real & AMREX_RESTRICT pt,
238 T_IdCpu & AMREX_RESTRICT idcpu,
239 RefPart const & AMREX_RESTRICT refpart
240 ) const
241 {
242 using namespace amrex::literals; // for _rt and _prt
243
244 // shift due to alignment errors of the element
245 shift_in(x, y, px, py);
246
247 // get the linear map
249
250 // symplectic linear map for a solenoid is computed using the
251 // Hamiltonian formalism as described in:
252 // https://uspas.fnal.gov/materials/09UNM/ComputationalMethods.pdf.
253 // R denotes the transfer matrix in the basis (x,px,y,py,t,pt),
254 // so that, e.g., R(3,4) = dyf/dpyi.
255 amrex::SmallVector<T_Real, 6, 1> const v{x, px, y, py, t, pt};
256
257 // push particles using the linear map
258 auto const out = R * v;
259
260 // assign updated values
261 x = out[1];
262 px = out[2];
263 y = out[3];
264 py = out[4];
265 t = out[5];
266 pt = out[6];
267
268 // apply transverse aperture
269 apply_aperture(x, y, idcpu);
270
271 // undo shift due to alignment errors of the element
272 shift_out(x, y, px, py);
273 }
274
280 void operator() (RefPart & AMREX_RESTRICT refpart) const
281 {
282 using namespace amrex::literals; // for _rt and _prt
283 using amrex::Math::powi;
284
285 // assign input reference particle values
286 amrex::ParticleReal const x = refpart.x;
287 amrex::ParticleReal const px = refpart.px;
288 amrex::ParticleReal const y = refpart.y;
289 amrex::ParticleReal const py = refpart.py;
290 amrex::ParticleReal const z = refpart.z;
291 amrex::ParticleReal const pz = refpart.pz;
292 amrex::ParticleReal const pt = refpart.pt;
293 amrex::ParticleReal const s = refpart.s;
294 amrex::ParticleReal const sedge = refpart.sedge;
295
296 // initialize linear map (deviation) values
297 refpart.map = decltype(refpart.map)::Identity();
298
299 // initialize the spin-orbit coupling matrix and the spin rotation vector
300 refpart.spin_rotation_vector = {};
301 refpart.spin_coupling = {};
302
303 // length of the current slice
304 amrex::ParticleReal const slice_ds = m_ds / nslice();
305
306 // compute initial value of beta*gamma
307 amrex::ParticleReal const bgi = std::sqrt(powi<2>(pt) - 1.0_prt);
308
309 // call integrator to advance (t,pt)
310 amrex::ParticleReal const zin = s - sedge;
311 amrex::ParticleReal const zout = zin + slice_ds;
312 int const nsteps = m_mapsteps;
313
314 integrators::symp2_integrate_split3(refpart,zin,zout,nsteps,*this);
315 amrex::ParticleReal const ptf = refpart.pt;
316
317 /* print computed linear map:
318 for(int i=1; i<7; ++i){
319 for(int j=1; j<7; ++j){
320 amrex::PrintToFile("SolMap.txt") << i << " " <<
321 j << " " << refpart.map(i,j) << "\n";
322 }
323 }
324 */
325
326 // advance position (x,y,z)
327 refpart.x = x + slice_ds*px/bgi;
328 refpart.y = y + slice_ds*py/bgi;
329 refpart.z = z + slice_ds*pz/bgi;
330
331 // compute final value of beta*gamma
332 amrex::ParticleReal const bgf = std::sqrt(powi<2>(ptf) - 1.0_prt);
333
334 // advance momentum (px,py,pz)
335 refpart.px = px*bgf/bgi;
336 refpart.py = py*bgf/bgi;
337 refpart.pz = pz*bgf/bgi;
338
339 // advance integrated path length
340 refpart.s = s + slice_ds;
341 }
342
343
358 template<typename T_Real=amrex::ParticleReal, typename T_IdCpu=uint64_t>
361 T_Real & AMREX_RESTRICT x,
362 T_Real & AMREX_RESTRICT y,
363 T_Real & AMREX_RESTRICT t,
364 T_Real & AMREX_RESTRICT px,
365 T_Real & AMREX_RESTRICT py,
366 T_Real & AMREX_RESTRICT pt,
367 T_Real & AMREX_RESTRICT sx,
368 T_Real & AMREX_RESTRICT sy,
369 T_Real & AMREX_RESTRICT sz,
370 T_IdCpu & AMREX_RESTRICT idcpu,
371 RefPart const & AMREX_RESTRICT refpart
372 ) const
373 {
374 using namespace amrex::literals; // for _rt and _prt
375
376 // initialize the three components of the axis-angle vector
377 T_Real lambdax = 0_prt;
378 T_Real lambday = 0_prt;
379 T_Real lambdaz = 0_prt;
380
381 // store the phase space variables in vector form
382 amrex::SmallVector<T_Real, 6, 1> const v{x, px, y, py, t, pt};
383
384 // get the spin-orbit coupling matrix
386
387 // use phase space variables to obtain the angle-axis generator of spin rotation
388 auto const out = A * v;
389
390 // update the angle-axis generator
391 lambdax = out[1];
392 lambday = out[2];
393 lambdaz = out[3];
394
395 // push the spin vector using the generator just determined
396 rotate_spin(lambdax,lambday,lambdaz,sx,sy,sz);
397
398 // axis-angle vector components generating the reference spin map
399 amrex::SmallMatrix<amrex::ParticleReal, 3, 1, amrex::Order::F, 1> const lambda = refpart.spin_rotation_vector;
400 lambdax = lambda(1);
401 lambday = lambda(2);
402 lambdaz = lambda(3);
403
404 // push the spin vector using the generator just determined
405 rotate_spin(lambdax,lambday,lambdaz,sx,sy,sz);
406
407 // phase space push
408 (*this)(x, y, t, px, py, pt, idcpu, refpart);
409 }
410
411
413 using LinearTransport::operator();
414
421 Map6x6
422 transport_map ([[maybe_unused]] RefPart const & AMREX_RESTRICT refpart) const
423 {
424
426 R = refpart.map;
427
428 return R;
429 }
430
437 std::tuple<amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal>
439 Sol_Bfield (amrex::ParticleReal const zeval) const
440 {
441 using namespace amrex::literals; // for _rt and _prt
442
443 // pick the right data depending if we are on the host side
444 // (reference particle push) or device side (particles):
445#if AMREX_DEVICE_COMPILE
446 amrex::ParticleReal const * cos_data = m_cos_d_data;
447 amrex::ParticleReal const * sin_data = m_sin_d_data;
448#else
449 amrex::ParticleReal const * cos_data = m_cos_h_data;
450 amrex::ParticleReal const * sin_data = m_sin_h_data;
451#endif
452
453 // specify constants
455 amrex::ParticleReal const zlen = std::abs(m_ds);
456 amrex::ParticleReal const zmid = zlen * 0.5_prt;
457
458 // compute on-axis magnetic field (z is relative to solenoid midpoint)
459 amrex::ParticleReal bfield = 0.0;
460 amrex::ParticleReal bfieldp = 0.0;
461 amrex::ParticleReal bfieldint = 0.0;
462 amrex::ParticleReal const z = zeval - zmid;
463
464 if (std::abs(z) <= zmid)
465 {
466 bfield = 0.5_prt*cos_data[0];
467 bfieldint = z*bfield;
468 for (int j=1; j < m_ncoef; ++j)
469 {
470 bfield = bfield + cos_data[j] * std::cos(j*2*pi*z/zlen) +
471 sin_data[j] * std::sin(j*2*pi*z/zlen);
472 bfieldp = bfieldp-j*2*pi*cos_data[j] * std::sin(j*2*pi*z/zlen)/zlen +
473 j*2*pi*sin_data[j] * std::cos(j*2*pi*z/zlen)/zlen;
474 bfieldint = bfieldint + zlen*cos_data[j] * std::sin(j*2*pi*z/zlen)/(j*2*pi) -
475 zlen*sin_data[j] * std::cos(j*2*pi*z/zlen)/(j*2*pi);
476 }
477 }
478 return std::make_tuple(bfield, bfieldp, bfieldint);
479 }
480
490 void map1 (amrex::ParticleReal const tau,
491 RefPart & refpart,
492 [[maybe_unused]] amrex::ParticleReal & zeval) const
493 {
494 using namespace amrex::literals; // for _rt and _prt
495 using amrex::Math::powi;
496
497 // push the reference particle
498 amrex::ParticleReal const t = refpart.t;
499 amrex::ParticleReal const pt = refpart.pt;
500 amrex::ParticleReal const z = zeval;
501
502 if (pt < -1.0_prt) {
503 refpart.t = t + tau/std::sqrt(1.0_prt - powi<-2>(pt));
504 refpart.pt = pt;
505 }
506 else {
507 refpart.t = t;
508 refpart.pt = pt;
509 }
510
511 zeval = z + tau;
512
513 // push the linear map equations
515 amrex::ParticleReal const betgam = refpart.beta_gamma();
516
517 refpart.map(1,1) = R(1,1) + tau*R(2,1);
518 refpart.map(1,2) = R(1,2) + tau*R(2,2);
519 refpart.map(1,3) = R(1,3) + tau*R(2,3);
520 refpart.map(1,4) = R(1,4) + tau*R(2,4);
521
522 refpart.map(3,1) = R(3,1) + tau*R(4,1);
523 refpart.map(3,2) = R(3,2) + tau*R(4,2);
524 refpart.map(3,3) = R(3,3) + tau*R(4,3);
525 refpart.map(3,4) = R(3,4) + tau*R(4,4);
526
527 refpart.map(5,5) = R(5,5) + tau*R(6,5)/powi<2>(betgam);
528 refpart.map(5,6) = R(5,6) + tau*R(6,6)/powi<2>(betgam);
529
530 }
531
541 void map2 (amrex::ParticleReal const tau,
542 RefPart & refpart,
543 amrex::ParticleReal & zeval) const
544 {
545 using namespace amrex::literals; // for _rt and _prt
546 using amrex::Math::powi;
547
548 amrex::ParticleReal const t = refpart.t;
549 amrex::ParticleReal const pt = refpart.pt;
550
551 // Define parameters and intermediate constants
552 amrex::ParticleReal const B0 =
553 m_unit == 1 ?
554 m_bscale / refpart.rigidity_Tm() :
555 m_bscale;
556
557 // push the reference particle
558 auto [bz, bzp, bzint] = Sol_Bfield(zeval);
559 amrex::ignore_unused(bzp, bzint);
560
561 refpart.t = t;
562 refpart.pt = pt;
563
564 // push the linear map equations
566 amrex::ParticleReal const alpha = B0*bz*0.5_prt;
567 amrex::ParticleReal const alpha2 = powi<2>(alpha);
568
569 refpart.map(2,1) = R(2,1) - tau*alpha2*R(1,1);
570 refpart.map(2,2) = R(2,2) - tau*alpha2*R(1,2);
571 refpart.map(2,3) = R(2,3) - tau*alpha2*R(1,3);
572 refpart.map(2,4) = R(2,4) - tau*alpha2*R(1,4);
573
574 refpart.map(4,1) = R(4,1) - tau*alpha2*R(3,1);
575 refpart.map(4,2) = R(4,2) - tau*alpha2*R(3,2);
576 refpart.map(4,3) = R(4,3) - tau*alpha2*R(3,3);
577 refpart.map(4,4) = R(4,4) - tau*alpha2*R(3,4);
578
579 // BELOW: if spin is needed only:
583 amrex::ParticleReal const gamma = refpart.gamma();
584 amrex::ParticleReal const beta = refpart.beta();
586 amrex::ParticleReal Gfactor = (gamma - 1_prt) * G;
587 amrex::ParticleReal const cs = std::cos(v(3));
588 amrex::ParticleReal const sn = std::sin(v(3));
589
590 // Update spin-orbit coupling matrix here
591 dA(1,1) = Gfactor * tau * alpha2 * (-2_prt*sn + tau*cs*alpha);
592 dA(1,2) = 2_prt * Gfactor * tau * alpha * cs;
593 dA(1,3) = Gfactor * tau * alpha2 * (2_prt*cs + tau*sn*alpha);
594 dA(1,4) = 2_prt * Gfactor * tau * alpha * sn;
595 dA(2,1) = -Gfactor * tau * alpha2 * (2_prt*cs + tau*sn*alpha);
596 dA(2,2) = -2_prt * Gfactor * tau * alpha * sn;
597 dA(2,3) = Gfactor * tau * alpha2 * (-2_prt*sn + tau*cs*alpha);
598 dA(2,4) = 2_prt * Gfactor * tau * cs * alpha;
599 dA(3,6) = -2_prt *(1_prt + G) * tau * alpha/beta;
600
601 // update the spin-orbit coupling matrix here
602 refpart.spin_coupling = A + dA*R;
603
604 }
605
615 void map3 (amrex::ParticleReal const tau,
616 RefPart & refpart,
617 amrex::ParticleReal & zeval) const
618 {
619 using namespace amrex::literals; // for _rt and _prt
620
621 amrex::ParticleReal const t = refpart.t;
622 amrex::ParticleReal const pt = refpart.pt;
623 amrex::ParticleReal const z = zeval;
624
625 // Define parameters and intermediate constants
626 amrex::ParticleReal const B0 =
627 m_unit == 1 ?
628 m_bscale / refpart.rigidity_Tm() :
629 m_bscale;
630
631 // push the reference particle
632 auto [bz, bzp, bzint] = Sol_Bfield(z);
633 amrex::ignore_unused(bzp, bzint);
634
635 refpart.t = t;
636 refpart.pt = pt;
637
638 // push the linear map equations
640 amrex::ParticleReal const theta = tau*B0*bz*0.5_prt;
641 amrex::ParticleReal const cs = std::cos(theta);
642 amrex::ParticleReal const sn = std::sin(theta);
643
644 refpart.map(1,1) = R(1,1)*cs + R(3,1)*sn;
645 refpart.map(1,2) = R(1,2)*cs + R(3,2)*sn;
646 refpart.map(1,3) = R(1,3)*cs + R(3,3)*sn;
647 refpart.map(1,4) = R(1,4)*cs + R(3,4)*sn;
648
649 refpart.map(2,1) = R(2,1)*cs + R(4,1)*sn;
650 refpart.map(2,2) = R(2,2)*cs + R(4,2)*sn;
651 refpart.map(2,3) = R(2,3)*cs + R(4,3)*sn;
652 refpart.map(2,4) = R(2,4)*cs + R(4,4)*sn;
653
654 refpart.map(3,1) = R(3,1)*cs - R(1,1)*sn;
655 refpart.map(3,2) = R(3,2)*cs - R(1,2)*sn;
656 refpart.map(3,3) = R(3,3)*cs - R(1,3)*sn;
657 refpart.map(3,4) = R(3,4)*cs - R(1,4)*sn;
658
659 refpart.map(4,1) = R(4,1)*cs - R(2,1)*sn;
660 refpart.map(4,2) = R(4,2)*cs - R(2,2)*sn;
661 refpart.map(4,3) = R(4,3)*cs - R(2,3)*sn;
662 refpart.map(4,4) = R(4,4)*cs - R(2,4)*sn;
663
664 // BELOW: if spin is needed only:
666 amrex::ParticleReal dv_z = 0_prt;
668
669 // Update reference spin rotation vector here
670 dv_z = -(1_prt + G) * tau * B0 * bz;
671 refpart.spin_rotation_vector(3) = v(3) + dv_z;
672
673 }
674
676 int m_unit;
678 int m_id;
679
680 int m_ncoef = 0;
685 };
686
687} // namespace impactx
688
691
692#endif // IMPACTX_SOFTSOL_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 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:79
@ 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:168
amrex::ParticleReal pt
energy, normalized by rest energy
Definition ReferenceParticle.H:42
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > map
linearized map
Definition ReferenceParticle.H:48
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rigidity_Tm() const
Definition ReferenceParticle.H:261
amrex::SmallMatrix< amrex::ParticleReal, 3, 6, amrex::Order::F, 1 > spin_coupling
linearized spin-orbit coupling matrix
Definition ReferenceParticle.H:49
amrex::ParticleReal gyromagnetic_anomaly
anomalous magnetic moment [unitless]
Definition ReferenceParticle.H:45
amrex::SmallMatrix< amrex::ParticleReal, 3, 1, amrex::Order::F, 1 > spin_rotation_vector
reference spin rotation vector
Definition ReferenceParticle.H:50
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta() const
Definition ReferenceParticle.H:152
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal gamma() const
Definition ReferenceParticle.H:140
amrex::ParticleReal t
clock time * c in meters
Definition ReferenceParticle.H:38
Definition SoftSol.H:124
std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Sol_Bfield(amrex::ParticleReal const zeval) const
Definition SoftSol.H:439
int m_id
number of map integration steps per slice
Definition SoftSol.H:678
int m_mapsteps
unit specification for quad strength
Definition SoftSol.H:677
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 &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition SoftSol.H:360
void compute_constants(RefPart const &refpart)
Definition SoftSol.H:203
amrex::ParticleReal const * m_sin_d_data
non-owning pointer to device cosine coefficients
Definition SoftSol.H:684
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 &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition SoftSol.H:231
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition SoftSol.H:422
static constexpr auto type
Definition SoftSol.H:125
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map3(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition SoftSol.H:615
SoftSolenoid(amrex::ParticleReal ds, amrex::ParticleReal bscale, std::vector< amrex::ParticleReal > cos_coef, std::vector< amrex::ParticleReal > sin_coef, int unit, 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 SoftSol.H:151
int m_ncoef
unique soft solenoid id used for data lookup map
Definition SoftSol.H:680
ImpactXParticleContainer::ParticleType PType
Definition SoftSol.H:126
void reverse()
Definition SoftSol.H:187
amrex::ParticleReal const * m_sin_h_data
non-owning pointer to host cosine coefficients
Definition SoftSol.H:682
amrex::ParticleReal const * m_cos_h_data
number of Fourier coefficients
Definition SoftSol.H:681
amrex::ParticleReal m_bscale
Definition SoftSol.H:675
mixin::GPUDataRegistry< SolenoidFourierCoefficients > DynamicData
Definition SoftSol.H:128
int m_unit
scaling factor for solenoid Bz field
Definition SoftSol.H:676
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map2(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition SoftSol.H:541
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map1(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition SoftSol.H:490
amrex::ParticleReal const * m_cos_d_data
non-owning pointer to host sine coefficients
Definition SoftSol.H:683
Definition SoftSol.H:56
amrex::Vector< amrex::ParticleReal > default_sin_coef
Definition SoftSol.H:95
amrex::Vector< amrex::ParticleReal > default_cos_coef
Definition SoftSol.H:57
mixin::TrackedVector< amrex::ParticleReal > sin
Definition SoftSol.H:111
mixin::TrackedVector< amrex::ParticleReal > cos
Definition SoftSol.H:110
Definition alignment.H:27
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_out(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py) const
Definition alignment.H:109
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy() const
Definition alignment.H:146
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx() const
Definition alignment.H:136
Alignment(amrex::ParticleReal dx, amrex::ParticleReal dy, amrex::ParticleReal rotation_degree)
Definition alignment.H:36
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_in(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py) const
Definition alignment.H:78
Definition beamoptic.H:436
static std::shared_ptr< SolenoidFourierCoefficients > const & get(int id)
Definition dynamicdata.H:98
static SolenoidFourierCoefficients & 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 void apply_aperture(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_IdCpu &AMREX_RESTRICT idcpu) const
Definition pipeaperture.H:59
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