From 1b698117733df3b2b2394de60f3bc1ca9f9357f1 Mon Sep 17 00:00:00 2001 From: Chad Mitchell Date: Fri, 26 Apr 2024 13:22:12 -0700 Subject: [PATCH] Adjusting example inputs. --- .../input_spectrometer.in | 19 +++--- .../run_spectrometer.py | 65 +++++++++++-------- 2 files changed, 48 insertions(+), 36 deletions(-) diff --git a/examples/achromatic_spectrometer/input_spectrometer.in b/examples/achromatic_spectrometer/input_spectrometer.in index a37f7dc79..464c42d3d 100644 --- a/examples/achromatic_spectrometer/input_spectrometer.in +++ b/examples/achromatic_spectrometer/input_spectrometer.in @@ -33,24 +33,23 @@ bend1.phi = 10.0 bend1.B = 0.0 plasma_lens.type = line -plasma_lens.elements = plend dr pl dr pl dr pl dr pl dr p1 dr p1 dr p1 dr p1 dr p1 dr p1end +plasma_lens.elements = drend pl dr pl dr pl dr pl dr pl dr pl dr pl dr pl dr pl dr pl drend -p1end.type = tapered_plasma_lens -p1end.k = 125.0 -p1end.taper = 11.488289081903567 -p1end.units = 0 +drend.type = drift +drend.ds = 0.001 -p1.type = tapered_plasma_lens -p1.k = 250.0 #focal length 0.5 m -p1.taper = 11.488289081903567 -p1.units = 0 +pl.type = tapered_plasma_lens +pl.k = 0.2 #focal length 0.5 m +pl.taper = 11.488289081903567 +pl.units = 0 dr.type = drift -dr.ds = 0.25 +dr.ds = 0.002 drift1.type = drift drift1.ds = 1.0 + ############################################################################### # Algorithms ############################################################################### diff --git a/examples/achromatic_spectrometer/run_spectrometer.py b/examples/achromatic_spectrometer/run_spectrometer.py index 949457785..810e4da6d 100755 --- a/examples/achromatic_spectrometer/run_spectrometer.py +++ b/examples/achromatic_spectrometer/run_spectrometer.py @@ -19,9 +19,8 @@ # domain decomposition & space charge mesh sim.init_grids() -# load a 2 GeV electron beam with an initial -# unnormalized rms emittance of 2 nm -kin_energy_MeV = 2.0e3 # reference energy +# load a 1 GeV electron beam +kin_energy_MeV = 1.0e3 # reference energy bunch_charge_C = 1.0e-9 # used with space charge npart = 10000 # number of macro particles @@ -31,14 +30,14 @@ # particle bunch distr = distribution.Waterbag( - sigmaX=3.9984884770e-5, - sigmaY=3.9984884770e-5, + sigmaX=3.162277660e-6, + sigmaY=3.162277660e-6, sigmaT=1.0e-3, - sigmaPx=2.6623538760e-5, - sigmaPy=2.6623538760e-5, - sigmaPt=2.0e-3, - muxpx=-0.846574929020762, - muypy=0.846574929020762, + sigmaPx=3.16227766017e-4, + sigmaPy=3.16227766017e-4, + sigmaPt=2.0e-2, + muxpx=0.0, + muypy=0.0, mutpt=0.0, ) sim.add_particles(bunch_charge_C, distr, npart) @@ -46,23 +45,37 @@ # add beam diagnostics monitor = elements.BeamMonitor("monitor", backend="h5") -# design the accelerator lattice) +# design the accelerator lattice ns = 25 # number of slices per ds in the element -fodo = [ - monitor, - elements.Drift(ds=0.25, nslice=ns), - monitor, - elements.Quad(ds=1.0, k=1.0, nslice=ns), - monitor, - elements.Drift(ds=0.5, nslice=ns), - monitor, - elements.Quad(ds=1.0, k=-1.0, nslice=ns), - monitor, - elements.Drift(ds=0.25, nslice=ns), - monitor, -] -# assign a fodo segment -sim.lattice.extend(fodo) + +# specify thick tapered plasma lens element +lens_length = 0.02 #length in m +num_lenses = 10 +focal_length = 0.5 #focal length in m +dtaper = 11.488289081903567 # 1/(horizontal dispersion in m) +ds = lens_length / num_lenses +dk = 1.0/(focal_length * num_lenses) + +# drifts appearing the drift-kick sequence +ds_half = ds / 2.0 +dr = elements.Drift(ds=ds_half, nslice=ns) + +# define the lens segments +thick_lens = [] +for j in range(0, num_lenses): + pl = elements.TaperedPL(k=dk, taper=dtaper, units=0) + segment = [dr, pl, dr] + thick_lens.extend(segment) + +bend = elements.ExactSbend(ds=1.0, phi=10.0, B=0.0, nslice=ns) +drift = elements.Drift(ds=1.0, nslice=ns) + +# specify the lattice sequence +sim.lattice.append(monitor) +sim.lattice.append(bend) +sim.lattice.extend(thick_lens) +sim.lattice.append(drift) +sim.lattice.append(monitor) # run simulation sim.evolve()