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
24#include <ablastr/constant.H>
25
26#include <AMReX.H>
27#include <AMReX_Extension.H>
28#include <AMReX_Math.H>
29#include <AMReX_REAL.H>
30#include <AMReX_SIMD.H>
31#include <AMReX_SmallMatrix.H>
32#include <AMReX_TrackedVector.H>
33
34#include <cmath>
35#include <memory>
36#include <stdexcept>
37#include <tuple>
38#include <vector>
39
40namespace impactx::elements
41{
55 {
57 0.350807812299706,
58 0.323554693720069,
59 0.260320578919415,
60 0.182848575294969,
61 0.106921016050403,
62 4.409581845710694E-002,
63 -9.416427163897508E-006,
64 -2.459452716865687E-002,
65 -3.272762575737291E-002,
66 -2.936414401076162E-002,
67 -1.995780078926890E-002,
68 -9.102893342953847E-003,
69 -2.456410658713271E-006,
70 5.788233017324325E-003,
71 8.040408292420691E-003,
72 7.480064552867431E-003,
73 5.230254569468851E-003,
74 2.447614547094685E-003,
75 -1.095525090532255E-006,
76 -1.614586867387170E-003,
77 -2.281365457438345E-003,
78 -2.148709081338292E-003,
79 -1.522541739363011E-003,
80 -7.185505862719508E-004,
81 -6.171194824600157E-007,
82 4.842109305036943E-004,
83 6.874508102002901E-004,
84 6.535550288205728E-004,
85 4.648795813759210E-004,
86 2.216564722797528E-004,
87 -4.100982995210341E-007,
88 -1.499332112463395E-004,
89 -2.151538438342482E-004,
90 -2.044590946652016E-004,
91 -1.468242784844341E-004
92 };
93
95 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
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
99 };
100 };
101
112
114 : public mixin::Named,
115 public mixin::BeamOptic<SoftSolenoid>,
116 public mixin::LinearTransport<SoftSolenoid>,
117 public mixin::Thick,
118 public mixin::Alignment,
119 public mixin::NoFinalize,
120 public mixin::PipeAperture,
122 public amrex::simd::Vectorized<amrex::simd::native_simd_size_particlereal>
123 {
124 static constexpr auto type = "SoftSolenoid";
126
128
129 static constexpr int DEFAULT_unit = 0;
130 static constexpr int DEFAULT_mapsteps = 10;
131
155 amrex::ParticleReal bscale,
156 std::vector<amrex::ParticleReal> cos_coef,
157 std::vector<amrex::ParticleReal> sin_coef,
158 int unit = DEFAULT_unit,
164 int mapsteps = DEFAULT_mapsteps,
166 std::optional<std::string> name = DEFAULT_name
167 )
168 : Named(std::move(name)),
169 Thick(ds, nslice),
170 Alignment(dx, dy, rotation_degree),
172 m_bscale(bscale), m_unit(unit), m_mapsteps(mapsteps),
173 m_id(DynamicData::allocate_id())
174 {
175 m_ncoef = int(cos_coef.size());
176 if (m_ncoef != int(sin_coef.size()))
177 throw std::runtime_error("SoftSolenoid: cos and sin coefficients must have same length!");
178
179 auto& coef = DynamicData::emplace(
180 m_id,
181 std::move(cos_coef),
182 std::move(sin_coef)
183 );
184 m_cos_h_data = coef.cos.host_const().data();
185 m_sin_h_data = coef.sin.host_const().data();
186 }
187
189 void reverse () {
190 // Reversing ds traverses the Fourier profile in the opposite z direction,
191 // so the odd sine terms change sign implicitly via sin(-kz) = -sin(kz).
192 Thick::reverse();
193 }
194
196 using BeamOptic::operator();
197
205 void compute_constants (RefPart const & refpart)
206 {
207 using namespace amrex::literals; // for _rt and _prt
208
209 Alignment::compute_constants(refpart);
210
211 // Ensure dynamic coefficient data is on GPU and we have fresh pointers to it
212 auto const & coef = *DynamicData::get(m_id);
213 m_cos_d_data = coef.cos.device_const().data();
214 m_sin_d_data = coef.sin.device_const().data();
215 }
216
231 template<typename T_Real=amrex::ParticleReal, typename T_IdCpu=uint64_t>
234 T_Real & AMREX_RESTRICT x,
235 T_Real & AMREX_RESTRICT y,
236 T_Real & AMREX_RESTRICT t,
237 T_Real & AMREX_RESTRICT px,
238 T_Real & AMREX_RESTRICT py,
239 T_Real & AMREX_RESTRICT pt,
240 [[maybe_unused]] T_IdCpu const & AMREX_RESTRICT idcpu,
241 [[maybe_unused]] RefPart const & AMREX_RESTRICT refpart
242 ) const
243 {
244 using namespace amrex::literals; // for _rt and _prt
245
246 // get the linear map
248
249 // symplectic linear map for a solenoid is computed using the
250 // Hamiltonian formalism as described in:
251 // https://uspas.fnal.gov/materials/09UNM/ComputationalMethods.pdf.
252 // R denotes the transfer matrix in the basis (x,px,y,py,t,pt),
253 // so that, e.g., R(3,4) = dyf/dpyi.
254 amrex::SmallVector<T_Real, 6, 1> const v{x, px, y, py, t, pt};
255
256 // push particles using the linear map
257 auto const out = R * v;
258
259 // assign updated values
260 x = out[1];
261 px = out[2];
262 y = out[3];
263 py = out[4];
264 t = out[5];
265 pt = out[6];
266 }
267
273 void operator() (RefPart & AMREX_RESTRICT refpart) const
274 {
275 using namespace amrex::literals; // for _rt and _prt
276 using amrex::Math::powi;
277
278 // assign input reference particle values
279 amrex::ParticleReal const x = refpart.x;
280 amrex::ParticleReal const px = refpart.px;
281 amrex::ParticleReal const y = refpart.y;
282 amrex::ParticleReal const py = refpart.py;
283 amrex::ParticleReal const z = refpart.z;
284 amrex::ParticleReal const pz = refpart.pz;
285 amrex::ParticleReal const pt = refpart.pt;
286 amrex::ParticleReal const s = refpart.s;
287 amrex::ParticleReal const sedge = refpart.sedge;
288
289 // initialize linear map (deviation) values
290 m_map = decltype(m_map)::Identity();
291
292 // initialize the spin-orbit coupling matrix and the spin rotation vector
294 m_spin_coupling = {};
295
296 // length of the current slice
297 amrex::ParticleReal const slice_ds = m_ds / nslice();
298
299 // compute initial value of beta*gamma
300 amrex::ParticleReal const bgi = std::sqrt(powi<2>(pt) - 1.0_prt);
301
302 // call integrator to advance (t,pt)
303 amrex::ParticleReal const zin = s - sedge;
304 amrex::ParticleReal const zout = zin + slice_ds;
305 int const nsteps = m_mapsteps;
306
307 integrators::symp2_integrate_split3(refpart,zin,zout,nsteps,*this);
308 amrex::ParticleReal const ptf = refpart.pt;
309
310 /* print computed linear map:
311 for(int i=1; i<7; ++i){
312 for(int j=1; j<7; ++j){
313 amrex::PrintToFile("SolMap.txt") << i << " " <<
314 j << " " << m_map(i,j) << "\n";
315 }
316 }
317 */
318
319 // advance position (x,y,z)
320 refpart.x = x + slice_ds*px/bgi;
321 refpart.y = y + slice_ds*py/bgi;
322 refpart.z = z + slice_ds*pz/bgi;
323
324 // compute final value of beta*gamma
325 amrex::ParticleReal const bgf = std::sqrt(powi<2>(ptf) - 1.0_prt);
326
327 // advance momentum (px,py,pz)
328 refpart.px = px*bgf/bgi;
329 refpart.py = py*bgf/bgi;
330 refpart.pz = pz*bgf/bgi;
331
332 // advance integrated path length
333 refpart.s = s + slice_ds;
334 }
335
350 template<typename T_Real=amrex::ParticleReal, typename T_IdCpu=uint64_t>
353 T_Real & AMREX_RESTRICT x,
354 T_Real & AMREX_RESTRICT y,
355 T_Real & AMREX_RESTRICT t,
356 T_Real & AMREX_RESTRICT px,
357 T_Real & AMREX_RESTRICT py,
358 T_Real & AMREX_RESTRICT pt,
359 T_Real & AMREX_RESTRICT sx,
360 T_Real & AMREX_RESTRICT sy,
361 T_Real & AMREX_RESTRICT sz,
362 T_IdCpu const & AMREX_RESTRICT idcpu,
363 RefPart const & AMREX_RESTRICT refpart
364 ) const
365 {
366 using namespace amrex::literals; // for _rt and _prt
367
368 // initialize the three components of the axis-angle vector
369 T_Real lambdax = 0_prt;
370 T_Real lambday = 0_prt;
371 T_Real lambdaz = 0_prt;
372
373 // store the phase space variables in vector form
374 amrex::SmallVector<T_Real, 6, 1> const v{x, px, y, py, t, pt};
375
376 // get the spin-orbit coupling matrix
378
379 // use phase space variables to obtain the angle-axis generator of spin rotation
380 auto const out = A * v;
381
382 // update the angle-axis generator
383 lambdax = out[1];
384 lambday = out[2];
385 lambdaz = out[3];
386
387 // push the spin vector using the generator just determined
388 rotate_spin(lambdax,lambday,lambdaz,sx,sy,sz);
389
390 // axis-angle vector components generating the reference spin map
392 lambdax = lambda(1);
393 lambday = lambda(2);
394 lambdaz = lambda(3);
395
396 // push the spin vector using the generator just determined
397 rotate_spin(lambdax,lambday,lambdaz,sx,sy,sz);
398
399 // phase space push
400 (*this)(x, y, t, px, py, pt, idcpu, refpart);
401 }
402
404 using LinearTransport::operator();
405
412 Map6x6
413 transport_map ([[maybe_unused]] RefPart const & AMREX_RESTRICT refpart) const
414 {
415
417 R = m_map;
418
419 // apply the transverse rotation (roll) alignment error
420 return rotate_aligned_map(R);
421 }
422
429 std::tuple<amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal>
431 Sol_Bfield (amrex::ParticleReal const zeval) const
432 {
433 using namespace amrex::literals; // for _rt and _prt
434
435 // pick the right data depending if we are on the host side
436 // (reference particle push) or device side (particles):
437#if AMREX_DEVICE_COMPILE
438 amrex::ParticleReal const * cos_data = m_cos_d_data;
439 amrex::ParticleReal const * sin_data = m_sin_d_data;
440#else
441 amrex::ParticleReal const * cos_data = m_cos_h_data;
442 amrex::ParticleReal const * sin_data = m_sin_h_data;
443#endif
444
445 // specify constants
447 amrex::ParticleReal const zlen = std::abs(m_ds);
448 amrex::ParticleReal const zmid = zlen * 0.5_prt;
449
450 // compute on-axis magnetic field (z is relative to solenoid midpoint)
451 amrex::ParticleReal bfield = 0.0;
452 amrex::ParticleReal bfieldp = 0.0;
453 amrex::ParticleReal bfieldint = 0.0;
454 amrex::ParticleReal const z = zeval - zmid;
455
456 if (std::abs(z) <= zmid)
457 {
458 bfield = 0.5_prt*cos_data[0];
459 bfieldint = z*bfield;
460 for (int j=1; j < m_ncoef; ++j)
461 {
462 bfield = bfield + cos_data[j] * std::cos(j*2*pi*z/zlen) +
463 sin_data[j] * std::sin(j*2*pi*z/zlen);
464 bfieldp = bfieldp-j*2*pi*cos_data[j] * std::sin(j*2*pi*z/zlen)/zlen +
465 j*2*pi*sin_data[j] * std::cos(j*2*pi*z/zlen)/zlen;
466 bfieldint = bfieldint + zlen*cos_data[j] * std::sin(j*2*pi*z/zlen)/(j*2*pi) -
467 zlen*sin_data[j] * std::cos(j*2*pi*z/zlen)/(j*2*pi);
468 }
469 }
470 return std::make_tuple(bfield, bfieldp, bfieldint);
471 }
472
482 void map1 (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 amrex::ParticleReal const z = zeval;
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 zeval = z + tau;
504
505 // push the linear map equations
507 amrex::ParticleReal const betgam = refpart.beta_gamma();
508
509 m_map(1,1) = R(1,1) + tau*R(2,1);
510 m_map(1,2) = R(1,2) + tau*R(2,2);
511 m_map(1,3) = R(1,3) + tau*R(2,3);
512 m_map(1,4) = R(1,4) + tau*R(2,4);
513
514 m_map(3,1) = R(3,1) + tau*R(4,1);
515 m_map(3,2) = R(3,2) + tau*R(4,2);
516 m_map(3,3) = R(3,3) + tau*R(4,3);
517 m_map(3,4) = R(3,4) + tau*R(4,4);
518
519 m_map(5,5) = R(5,5) + tau*R(6,5)/powi<2>(betgam);
520 m_map(5,6) = R(5,6) + tau*R(6,6)/powi<2>(betgam);
521
522 }
523
533 void map2 (amrex::ParticleReal const tau,
534 RefPart & refpart,
535 amrex::ParticleReal & zeval) const
536 {
537 using namespace amrex::literals; // for _rt and _prt
538 using amrex::Math::powi;
539
540 amrex::ParticleReal const t = refpart.t;
541 amrex::ParticleReal const pt = refpart.pt;
542
543 // Define parameters and intermediate constants
544 amrex::ParticleReal const B0 =
545 m_unit == 1 ?
546 m_bscale / refpart.rigidity_Tm() :
547 m_bscale;
548
549 // push the reference particle
550 auto [bz, bzp, bzint] = Sol_Bfield(zeval);
551 amrex::ignore_unused(bzp, bzint);
552
553 refpart.t = t;
554 refpart.pt = pt;
555
556 // push the linear map equations
558 amrex::ParticleReal const alpha = B0*bz*0.5_prt;
559 amrex::ParticleReal const alpha2 = powi<2>(alpha);
560
561 m_map(2,1) = R(2,1) - tau*alpha2*R(1,1);
562 m_map(2,2) = R(2,2) - tau*alpha2*R(1,2);
563 m_map(2,3) = R(2,3) - tau*alpha2*R(1,3);
564 m_map(2,4) = R(2,4) - tau*alpha2*R(1,4);
565
566 m_map(4,1) = R(4,1) - tau*alpha2*R(3,1);
567 m_map(4,2) = R(4,2) - tau*alpha2*R(3,2);
568 m_map(4,3) = R(4,3) - tau*alpha2*R(3,3);
569 m_map(4,4) = R(4,4) - tau*alpha2*R(3,4);
570
571 // BELOW: if spin is needed only:
575 amrex::ParticleReal const gamma = refpart.gamma();
576 amrex::ParticleReal const beta = refpart.beta();
578 amrex::ParticleReal Gfactor = (gamma - 1_prt) * G;
579 amrex::ParticleReal const cs = std::cos(v(3));
580 amrex::ParticleReal const sn = std::sin(v(3));
581
582 // Update spin-orbit coupling matrix here
583 dA(1,1) = Gfactor * tau * alpha2 * (-2_prt*sn + tau*cs*alpha);
584 dA(1,2) = 2_prt * Gfactor * tau * alpha * cs;
585 dA(1,3) = Gfactor * tau * alpha2 * (2_prt*cs + tau*sn*alpha);
586 dA(1,4) = 2_prt * Gfactor * tau * alpha * sn;
587 dA(2,1) = -Gfactor * tau * alpha2 * (2_prt*cs + tau*sn*alpha);
588 dA(2,2) = -2_prt * Gfactor * tau * alpha * sn;
589 dA(2,3) = Gfactor * tau * alpha2 * (-2_prt*sn + tau*cs*alpha);
590 dA(2,4) = 2_prt * Gfactor * tau * cs * alpha;
591 dA(3,6) = -2_prt *(1_prt + G) * tau * alpha/beta;
592
593 // update the spin-orbit coupling matrix here
594 m_spin_coupling = A + dA*R;
595
596 }
597
607 void map3 (amrex::ParticleReal const tau,
608 RefPart & refpart,
609 amrex::ParticleReal & zeval) const
610 {
611 using namespace amrex::literals; // for _rt and _prt
612
613 amrex::ParticleReal const t = refpart.t;
614 amrex::ParticleReal const pt = refpart.pt;
615 amrex::ParticleReal const z = zeval;
616
617 // Define parameters and intermediate constants
618 amrex::ParticleReal const B0 =
619 m_unit == 1 ?
620 m_bscale / refpart.rigidity_Tm() :
621 m_bscale;
622
623 // push the reference particle
624 auto [bz, bzp, bzint] = Sol_Bfield(z);
625 amrex::ignore_unused(bzp, bzint);
626
627 refpart.t = t;
628 refpart.pt = pt;
629
630 // push the linear map equations
632 amrex::ParticleReal const theta = tau*B0*bz*0.5_prt;
633 amrex::ParticleReal const cs = std::cos(theta);
634 amrex::ParticleReal const sn = std::sin(theta);
635
636 m_map(1,1) = R(1,1)*cs + R(3,1)*sn;
637 m_map(1,2) = R(1,2)*cs + R(3,2)*sn;
638 m_map(1,3) = R(1,3)*cs + R(3,3)*sn;
639 m_map(1,4) = R(1,4)*cs + R(3,4)*sn;
640
641 m_map(2,1) = R(2,1)*cs + R(4,1)*sn;
642 m_map(2,2) = R(2,2)*cs + R(4,2)*sn;
643 m_map(2,3) = R(2,3)*cs + R(4,3)*sn;
644 m_map(2,4) = R(2,4)*cs + R(4,4)*sn;
645
646 m_map(3,1) = R(3,1)*cs - R(1,1)*sn;
647 m_map(3,2) = R(3,2)*cs - R(1,2)*sn;
648 m_map(3,3) = R(3,3)*cs - R(1,3)*sn;
649 m_map(3,4) = R(3,4)*cs - R(1,4)*sn;
650
651 m_map(4,1) = R(4,1)*cs - R(2,1)*sn;
652 m_map(4,2) = R(4,2)*cs - R(2,2)*sn;
653 m_map(4,3) = R(4,3)*cs - R(2,3)*sn;
654 m_map(4,4) = R(4,4)*cs - R(2,4)*sn;
655
656 // BELOW: if spin is needed only:
658 amrex::ParticleReal dv_z = 0_prt;
660
661 // Update reference spin rotation vector here
662 dv_z = -(1_prt + G) * tau * B0 * bz;
663 m_spin_rotation_vector(3) = v(3) + dv_z;
664
665 }
666
668 int m_unit;
670 int m_id;
671
672 int m_ncoef = 0;
677
678 // Reference-trajectory linearization around the reference particle.
679 // Computed during the reference-particle push and consumed during the
680 // particle push.
681 // mutable: written by the const reference push before the element is copied
682 // into the particle-push functor.
686 };
687
688} // namespace impactx
689
692
693#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: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_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rigidity_Tm() const
Definition ReferenceParticle.H:260
amrex::ParticleReal gyromagnetic_anomaly
anomalous magnetic moment [unitless]
Definition ReferenceParticle.H:45
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta() const
Definition ReferenceParticle.H:151
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal gamma() const
Definition ReferenceParticle.H:139
amrex::ParticleReal t
clock time * c in meters
Definition ReferenceParticle.H:38
Definition SoftSol.H:123
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:431
static constexpr int DEFAULT_unit
Definition SoftSol.H:129
int m_id
number of map integration steps per slice
Definition SoftSol.H:670
int m_mapsteps
unit specification for quad strength
Definition SoftSol.H:669
void compute_constants(RefPart const &refpart)
Definition SoftSol.H:205
amrex::ParticleReal const * m_sin_d_data
non-owning pointer to device cosine coefficients
Definition SoftSol.H:676
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition SoftSol.H:413
static constexpr auto type
Definition SoftSol.H:124
static constexpr int DEFAULT_mapsteps
Definition SoftSol.H:130
SoftSolenoid(amrex::ParticleReal ds, amrex::ParticleReal bscale, std::vector< amrex::ParticleReal > cos_coef, std::vector< amrex::ParticleReal > sin_coef, int unit=DEFAULT_unit, 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 SoftSol.H:153
amrex::SmallMatrix< amrex::ParticleReal, 3, 6, amrex::Order::F, 1 > m_spin_coupling
linearized map
Definition SoftSol.H:684
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map3(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition SoftSol.H:607
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > m_map
non-owning pointer to device sine coefficients
Definition SoftSol.H:683
int m_ncoef
unique soft solenoid id used for data lookup map
Definition SoftSol.H:672
ImpactXParticleContainer::ParticleType PType
Definition SoftSol.H:125
void reverse()
Definition SoftSol.H:189
amrex::ParticleReal const * m_sin_h_data
non-owning pointer to host cosine coefficients
Definition SoftSol.H:674
amrex::ParticleReal const * m_cos_h_data
number of Fourier coefficients
Definition SoftSol.H:673
amrex::ParticleReal m_bscale
Definition SoftSol.H:667
mixin::GPUDataRegistry< SolenoidFourierCoefficients > DynamicData
Definition SoftSol.H:127
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 SoftSol.H:352
int m_unit
scaling factor for solenoid Bz field
Definition SoftSol.H:668
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map2(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition SoftSol.H:533
amrex::SmallMatrix< amrex::ParticleReal, 3, 1, amrex::Order::F, 1 > m_spin_rotation_vector
linearized spin-orbit coupling matrix
Definition SoftSol.H:685
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void map1(amrex::ParticleReal const tau, RefPart &refpart, amrex::ParticleReal &zeval) const
Definition SoftSol.H:482
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 SoftSol.H:233
amrex::ParticleReal const * m_cos_d_data
non-owning pointer to host sine coefficients
Definition SoftSol.H:675
Definition SoftSol.H:55
amrex::Vector< amrex::ParticleReal > default_sin_coef
Definition SoftSol.H:94
amrex::Vector< amrex::ParticleReal > default_cos_coef
Definition SoftSol.H:56
amrex::Gpu::TrackedVector< amrex::ParticleReal > sin
Definition SoftSol.H:110
amrex::Gpu::TrackedVector< amrex::ParticleReal > cos
Definition SoftSol.H:109
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< 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
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