13
13
#include < AMReX_REAL.H> // for Real
14
14
#include < AMReX_SmallMatrix.H>
15
15
#include < AMReX_ParmParse.H>
16
+ #include < AMReX_Print.H>
16
17
17
18
#include < cmath>
18
19
@@ -22,7 +23,7 @@ namespace impactx::spacecharge
22
23
envelope_space_charge2D_push (
23
24
[[maybe_unused]] RefPart const & refpart,
24
25
Map6x6 & cm,
25
- [[maybe_unused]] amrex::ParticleReal current,
26
+ amrex::ParticleReal current,
26
27
amrex::ParticleReal ds
27
28
)
28
29
{
@@ -31,11 +32,6 @@ namespace impactx::spacecharge
31
32
// initialize the linear transport map
32
33
Map6x6 R = Map6x6::Identity ();
33
34
34
- // added temporarily for benchmark testing
35
- amrex::ParmParse pp_dist (" dist" );
36
- amrex::ParticleReal beam_current = 0.0 ; // Beam current (A)
37
- pp_dist.query (" current" , beam_current);
38
-
39
35
// physical constants and reference quantities
40
36
amrex::ParticleReal const c = ablastr::constant::SI::c;
41
37
amrex::ParticleReal const ep0 = ablastr::constant::SI::ep0;
@@ -44,10 +40,12 @@ namespace impactx::spacecharge
44
40
amrex::ParticleReal const charge = refpart.charge ;
45
41
amrex::ParticleReal const pt_ref = refpart.pt ;
46
42
amrex::ParticleReal const betgam2 = std::pow (pt_ref, 2 ) - 1 .0_prt;
43
+ amrex::ParticleReal const betgam = std::sqrt (betgam2);
44
+ amrex::ParticleReal const betgam3 = std::pow (betgam,3 );
47
45
48
46
// evaluate the beam space charge perveance from current
49
47
amrex::ParticleReal const IA = 4 .0_prt*pi*ep0*mass*pow (c,3 )/charge;
50
- amrex::ParticleReal const Kpv = (beam_current /IA) * 2 .0_prt/betgam2 ;
48
+ amrex::ParticleReal const Kpv = std::abs (current /IA) * 2 .0_prt/betgam3 ;
51
49
52
50
// evaluate the linear transfer map
53
51
amrex::ParticleReal const sigma2 = cm (1 ,1 )*cm (3 ,3 )-cm (1 ,3 )*cm (1 ,3 );
0 commit comments