Skip to content

Commit 7c39662

Browse files
committed
Correct perveance calculation. Hard-coded current for testing.
1 parent 1878ab0 commit 7c39662

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/particles/spacecharge/EnvelopeSpaceChargePush.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <AMReX_REAL.H> // for Real
1414
#include <AMReX_SmallMatrix.H>
1515
#include <AMReX_ParmParse.H>
16+
#include <AMReX_Print.H>
1617

1718
#include <cmath>
1819

@@ -22,7 +23,7 @@ namespace impactx::spacecharge
2223
envelope_space_charge2D_push (
2324
[[maybe_unused]] RefPart const & refpart,
2425
Map6x6 & cm,
25-
[[maybe_unused]] amrex::ParticleReal current,
26+
amrex::ParticleReal current,
2627
amrex::ParticleReal ds
2728
)
2829
{
@@ -31,11 +32,6 @@ namespace impactx::spacecharge
3132
// initialize the linear transport map
3233
Map6x6 R = Map6x6::Identity();
3334

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-
3935
// physical constants and reference quantities
4036
amrex::ParticleReal const c = ablastr::constant::SI::c;
4137
amrex::ParticleReal const ep0 = ablastr::constant::SI::ep0;
@@ -44,10 +40,12 @@ namespace impactx::spacecharge
4440
amrex::ParticleReal const charge = refpart.charge;
4541
amrex::ParticleReal const pt_ref = refpart.pt;
4642
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);
4745

4846
// evaluate the beam space charge perveance from current
4947
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;
5149

5250
// evaluate the linear transfer map
5351
amrex::ParticleReal const sigma2 = cm(1,1)*cm(3,3)-cm(1,3)*cm(1,3);

src/tracking/envelope.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ namespace impactx
127127
if (space_charge)
128128
{
129129
// push Covariance Matrix in 2D space charge fields
130-
amrex::ParticleReal current=0.0; //TODO: This must be set.
130+
amrex::ParticleReal current=0.5; //TODO: This must be set.
131131
spacecharge::envelope_space_charge2D_push(ref,cm,current,slice_ds);
132132
}
133133

0 commit comments

Comments
 (0)