beam radius optimisation for electron driven plasma wakefield acceleration

81
University College London Master’s Project Beam Radius Optimisation for Electron-Driven Plasma Wakefield Acceleration Author: Stephen Lucas Supervisors: Professor Matthew Wing Dr Simon Jolly A project submitted in fulfilment of the requirements for the degree of Master in Science High Energy Physics Group UCL Department of Physics and Astronomy March 2013

Upload: stephen-andrew-lucas

Post on 12-Apr-2015

20 views

Category:

Documents


2 download

DESCRIPTION

UCL MSci Physics Project

TRANSCRIPT

Page 1: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

University College London

Master’s Project

Beam Radius Optimisation forElectron-Driven Plasma Wakefield

Acceleration

Author:

Stephen Lucas

Supervisors:

Professor Matthew Wing

Dr Simon Jolly

A project submitted in fulfilment of the requirements

for the degree of Master in Science

High Energy Physics Group

UCL Department of Physics and Astronomy

March 2013

Page 2: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Declaration of Authorship

I, Stephen Lucas, declare that this project titled, ‘Beam Radius Optimisation for Electron-

Driven Plasma Wakefield Acceleration’ and the work presented in it are my own. I confirm

that:

� This work was done wholly or mainly while in candidature for a research degree at this

University.

� Where any part of this project has previously been submitted for a degree or any other

qualification at this University or any other institution, this has been clearly stated.

� Where I have consulted the published work of others, this is always clearly attributed.

� Where I have quoted from the work of others, the source is always given. With the

exception of such quotations, this thesis is entirely my own work.

� I have acknowledged all main sources of help.

� Where the project is based on work done by myself jointly with others, I have made

clear exactly what was done by others and what I have contributed myself.

Signed:

Date:

i

Page 3: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

UNIVERSITY COLLEGE LONDON

Abstract

Faculty of Physical and Mathematical Sciences

UCL Department of Physics and Astronomy

Master in Science

Beam Radius Optimisation for Electron-Driven Plasma Wakefield Acceleration

by Stephen Lucas

The beam width (σr) dependence of the wakefield that can be driven in a cell of uniform

hydrogen plasma is investigated for a driver bunch with fixed length (22.5µm), particle

number (106, 1020) and energy (3 GeV). Performing particle in cell simulations using EPOCH,

it is found that for beams of constant charge, the maximum longitudinal electric field that can

be achieved is inversely proportional to their width. Current data suggests that introducing

an emittance of 0.03 mm mrad to the beam reduces the time-averaged wakefield that can

be driven but not the overall form of its σr-dependence. For beams in which the peak

number density is constant (such that an increase in width corresponds to an increase in

the total charge) the wakefields achieved are found to grow with increasing σr. Simulation

data is compared against theoretical predictions with discrepancies seen in both cases. For

the constant charge data, the discrepancies are significant. Reasons for these discrepancies

remain unclear and a control data set is needed before cause can be asserted.

Page 4: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Acknowledgements

Special thanks to Professor Matthew Wing for providing constant support and guidance

in terms of which direction to take the project. Likewise, special thanks to Dr. Simon

Jolly whose ‘figsave’ function has been used to enhance the aesthetic quality of the figures

featured in this report. For his constant assistance with EPOCH issues encountered and for

providing accessible data analysis tools, such as the EPOCH GUI, credit goes to the UCL

PhD student James Holloway. Similar thanks to UCL MSc student Johnathon Nydell for

providing documentation on using the input deck in EPOCH and providing the basic fitting

function on which the amplitude-fitting function described here has been built. Additional

thanks to Scott Mandry for his advice regarding the final presentation and how to generate

MATLAB animations in Linux. Finally, a gargantuan thank you to whomever is responsible

for the 24 hour opening of the UCL science library.

iii

Page 5: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Contents

Declaration of Authorship i

Abstract ii

Acknowledgements iii

List of Figures vi

List of Tables vii

Physical Constants viii

Symbols ix

1 Introduction 1

1.1 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.3 1D Cold Plasma Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.4 Principles of Plasma Wakefield Acceleration . . . . . . . . . . . . . . . . . . . 4

2 Theory 8

2.1 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2 Theoretical Framework in 3D . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2.1 The Linear Regime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.3 Radial Dependence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.3.1 Constant Charge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.3.2 Variable Charge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.4 Beam Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.5 Aims and Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3 Data Analysis 18

3.1 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.2 Simulation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.3 Amplitude Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.4 Results (No Emittance) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.4.1 Constant Charge Model . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.4.2 Variable Charge Model . . . . . . . . . . . . . . . . . . . . . . . . . . 25

iv

Page 6: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Contents v

3.4.3 Modifying The Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.5 Results (Emittance) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

3.6 3D Simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

4 Conclusion 34

4.1 Project Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.2 Further Investigations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

A Additional Figures 36

A.1 Constant Charge Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

A.2 Variable Charge Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

A.3 Emittance Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

B Code 42

References 70

Page 7: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

List of Figures

1.1 Plasma response to an ultra-relativistic beam . . . . . . . . . . . . . . . . . . 5

1.2 Ion bubble cavity structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.3 Plasma wakefield acceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.1 Radial dependence of the wakefield for a bi-Gaussian driver bunch . . . . . . 12

2.2 Sinusoidal plasma response in the linear regime . . . . . . . . . . . . . . . . . 13

2.3 Constant charge model radial dependence . . . . . . . . . . . . . . . . . . . . 15

2.4 Variable charge model radial dependence . . . . . . . . . . . . . . . . . . . . . 16

2.5 Peak number density comparison for constant and variable charge . . . . . . 16

3.1 2D Wakefield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.2 Example of successful cropping . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3.3 Example of anomalous data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3.4 Constant charge: Ez0 vs. σr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.5 Constant charge: absolute relative difference in Ez0 . . . . . . . . . . . . . . . 24

3.6 Variable charge: Ez0 vs. σr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.7 Variable charge: absolute relative difference in Ez0 . . . . . . . . . . . . . . . 26

3.8 Least squares fit using mathematica . . . . . . . . . . . . . . . . . . . . . . . 28

3.9 Emittance: comparison of nb0 and Ez0 with time . . . . . . . . . . . . . . . . 30

3.10 Emittance: Ez0 for an extended time interval . . . . . . . . . . . . . . . . . . 31

3.11 Emittance: comparison with constant charge data . . . . . . . . . . . . . . . 32

3.12 Constant charge: 3D vs. 2D data . . . . . . . . . . . . . . . . . . . . . . . . . 33

A.1 Generic form of the incomplete gamma function . . . . . . . . . . . . . . . . . 36

A.2 Constant charge: difference between maximum and sine-fitted Ez0 . . . . . . 37

A.3 Constant charge: power-law fit to EPOCH 2D data . . . . . . . . . . . . . . . 37

A.4 Constant charge: difference between theoretical and EPOCH Ez0 . . . . . . . 38

A.5 Variable charge: difference between maximum and sine-fitted Ez0 . . . . . . . 38

A.6 Variable charge: polynomial fit to EPOCH 2D data . . . . . . . . . . . . . . . 39

A.7 Variable charge: difference between theoretical and EPOCH Ez0 . . . . . . . 39

A.8 Emittance: exponential fit to dEz0dt data . . . . . . . . . . . . . . . . . . . . . 40

A.9 Emittance: exploding electric fields at cell boundary . . . . . . . . . . . . . . 40

A.10 Emittance: converging electric fields over time . . . . . . . . . . . . . . . . . . 41

vi

Page 8: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

List of Tables

3.1 Simulation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.2 Constant Charge: Least Squares Fit . . . . . . . . . . . . . . . . . . . . . . . 27

3.3 Variable Charge: Least Squares Fit . . . . . . . . . . . . . . . . . . . . . . . . 27

3.4 Constant Charge: Beam Temperatures . . . . . . . . . . . . . . . . . . . . . . 32

vii

Page 9: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Physical Constants

Speed of light c = 3.00× 108 ms−2

Unit of electronic charge e = 1.60× 10−19 C

Permitivitty of free space ε0 = 8.85× 10−12 Fm−1

Electron mass me = 9.11× 10−31 kg

Boltzmann constant kB = 1.38× 10−23 JK−1

viii

Page 10: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Symbols

Plasma frequency ωp

Plasma wavelength λp

Plasma wavenumber kp

Plasma density ne

Beam length σz

Beam radius σr

Angular divergence σθ

Temperature T

Emittance ε

Beam number density nb

Peak nb nb0

Current density j

Beam velocity vb

Longitudinal electric field Ez

Maximum Ez Ez0

Resolution in z δz

Resolution in y δy

Resolution in x δx

Distance behind beam ξ

Transformer ratio R

ix

Page 11: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Introduction

1.1 Chapter Summary

In this chapter a brief history of conventional particle accelerators is given and used to

motivate the development of plasma accelerators. The mathematics underpinning the 1D

response of a plasma to perturbations in its number density is then introduced to allow for

the definition of important plasma parameters. These parameters are then used to explain

the concept of plasma wakefield acceleration in general. To close, the chapter reviews the

current state of plasma wakefield accelerator experiments and presents the line of inquiry

that the project will follow.

1.2 Motivation

As of the 1930s, conventional particle accelerators have been increasing their centre of mass

energies by an order of magnitude every 10 years [1]. Since the 1980s however, this expo-

nential increase in the maximum achievable collision energy (the ‘energy frontier’), has been

curtailed by largely economic, and to a lesser extent, technological, constraints.

In July 2012, both the ATLAS and CMS experiments at the LHC released preliminary results

indicative of a Higgs boson in the mass regime of 125 – 126 GeV. Elucidating this particle’s

properties, such as its spin and interaction strength, as well observing new phenomena in

general, will require the completion of the next generation, high energy lepton accelerator –

the International Linear Collider (ILC).

Despite the media attention surrounding the LHC’s discovery, the use of particle accelerators

is not confined to the verifying or falsifying of fundamental physical theories. Their practical

applications include roles in: cancer therapy, materials science, food sterilisation, fusion

research and the transmutation of nuclear waste. It is therefore in a large number of people’s

interests if the cost and scalability of such machines can be improved upon.

1

Page 12: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 1 - Introduction to Plasma Wakefield Acceleration 2

The fully upgraded ILC intends to collide counter propagating beams of electrons and

positrons, each with a centre of mass energy of 1TeV. The point-like nature of these parti-

cles yields cleaner collisions, but their light masses (compared to the protons collided at the

LHC, for example) results in significant energy losses due to synchrotron radiation. The ILC

and other high energy future lepton accelerators must therefore be built as linear, one-pass

colliders.

Existing linear colliders, such as the Stanford Linear Collider (SLAC), consist of a metal

cavity in which electrodes are contained and an alternating voltage is applied to accelerate

charged particles between them. The energies of the emerging particles is limited by the

peak power of the radio frequency (RF) source and by the maximum accelerating gradient

that can be maintained within the cavity. The latter being the larger limiting factor of the

two. Commonly used cavity materials, such as copper and niobium, restrict the maximum

sustainable accelerating gradient to around 100 MV/m. Electric fields above this will ionise

the cavities themselves, thereby destroying the accelerator.

The ILC aims to operate with an accelerating gradient of 31.5 MV/m, requiring 31 km to

produce the collision energy of 1 TeV. At an estimated construction cost of £4.27 billion [2]

as of 2007, this will overtake the LHC as one of the most expensive scientific instruments

ever built [3]. To better the economic burden associated with building such accelerators this

project will consider the compact solution of plasma wakefield acceleration (PWA) and ways

in which it may be optimised.

1.3 1D Cold Plasma Dynamics

A cold quasi-neutral plasma can be defined as a group of massive, slowly moving, positive

ions, surrounded by a cloud of free electrons, such that on a macroscopic scale the whole

system is neutral and exhibits collective behaviour[4]. If there is a local fluctuation in the

electron density (i.e. away from that of the uniform ion background), electric fields will be

generated in a direction that acts to restore the plasma’s neutrality. Any displaced electrons

will be accelerated back towards their equilibrium positions – gaining kinetic energy as they

do so. During this acceleration, the electrons acquire inertia and overshoot their original

positions, setting up a space-charge oscillation that oscillates with the plasma frequency, ωp.

An expression for the plasma frequency can be derived as follows. Assuming ions to be im-

mobile, oscillations to be small relative to the background plasma density, and an absence of

temperature and external fields, let n0, v0,and E0 represent the equilibrium plasma density,

electron velocity and electric field respectively. Small perturbations in these values are then

denoted by n1, v1 and E1.

Page 13: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 1 - Introduction to Plasma Wakefield Acceleration 3

The total plasma density, n, electron velocity, v, and electric field, E, may then be written

as the sum of these terms.

n = n0 + n1

v = v0 + v1

E = E0 + E1

For small oscillations, the restoring force that arises due to charge separation is linearly pro-

portional to the displacement of the plasma’s electrons. The perturbed terms will therefore

behave sinusoidally:

n1 = n1ei(kz−ωt)

v1 = v1ei(kz−ωt)z

E1 = E1ei(kz−ωt)z

Since a cold uniform quasi-neutral plasma is assumed, E0 = v0 = ∆n0 = 0 and the linearised

forms of the continuity equation, Gauss’ law, and the electron’s equation of motion, read:

∇ ·E1 = −en1

ε0(1.1)

∂n1

∂t+ n0∇ · v1 = 0 (1.2)

me∂v1

∂t= −eE1 (1.3)

Where ∂n0∂t = 0 due to the assumption of constant initial density and n0∇ · v1 � n1∇ · v1

due to the assumption of small perturbations.

Substitution of the appropriate oscillating terms into equations (1.1 - 1.3) produces three

linear equations:

ε0ikE1 = −en1 (1.4)

− iωn1 = −n0ikv1 (1.5)

− imeωv1 = −eE1 (1.6)

Which can then be combined to solve for ωp:

ωp =

√nee2

ε0me(1.7)

Page 14: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 1 - Introduction to Plasma Wakefield Acceleration 4

For later manipulation, it is useful to re-state equation (1.7) in cgs units:

ωp[cgs] =

√4πnee2

me(1.8)

Note that in the equations above, n0 has been replaced by ne, as n0 represents the background

plasma electron density and is more commonly referred to ne in the literature.

Referring to equation (1.6), it can be seen that for a large amplitude oscillation, i.e. n1 ' ne,with relativistic phase velocity c, the absolute magnitude of E is given by:

|E| = ωpmec

e= c

[meneε

]0.5(1.9)

For a plasma density of ne ∼ 1018cm−3, this yields an accelerating gradient in the order of 100

GV/m. Compared to the metallic cavities discussed earlier, this represents a thousandfold

increase in the upper limit on the maximum electric fields that can be supported. Plasma

acceleration therefore takes advantage of this property, achieving higher energies over shorter

distances, provided the right conditions.

1.4 Principles of Plasma Wakefield Acceleration

Experimental data has confirmed that a plasma wave supporting a strong longitudinal electric

field can be generated by firing a short, high charge, ultra-relativistic beam of particles (or

laser light) into a plasma [5, 6]. Since the mid 1990s the peak energy gain seen in such

experiments has been increasing by an order of magnitude every five years [1]. The peak

accelerating field of 52 GVm−1 achieved over a metre-scale distance at SLAC marks a recent

(2007) example of progress in this field.

With the Diamond Light Source’s (DLS) 3 GeV electron beam in mind, this project will

consider electron-driven plasma wakefield acceleration (EDPWA) only. In doing so, the

scope of the results will not be limited since in the linear regime (the regime in which

perturbations in the plasma density are small compared to the background density), the

mathematical description for positively charged drivers is identical (bar a π change in the

spatial variation of the electric field).

The physical picture describing plasma wakefield acceleration for charged driver beams is in

many ways similar to the situation described earlier (section 1.3). For the case of an ap-

propriately sized, relativistic, electron beam as the driver, the Coulomb force of the beam’s

space charge repels the plasma electrons, leaving behind the heavier, less mobile ions. These

Page 15: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 1 - Introduction to Plasma Wakefield Acceleration 5

displaced electrons are then accelerated back towards the static ions, creating an on-axis en-

hancement of the electron density behind the driver pulse. The general concept is illustrated

in figure 1.1.

t = 1 t = 2 t = 3

Figure 1.1: The response of plasma electrons (blue) to a short, ultra-relativistic, electrondriver (purple) travelling in the rightward direction at arbitrary time steps 1, 2and 3. Darker regions correspond to higher electron densities with the arrowsrepresenting the direction in which the plasma electrons experience motion.For a clearer illustration see Animation 1 (Appendix A).

As explained earlier, these electrons overshoot their original positions and set up a space-

charge oscillation - the ‘wake’, which in turn produces a repeating pattern of alternating

positive and negative charge. The distance between regions of the same charge being on the

scale of one plasma wavelength, λp, while accelerating structure as a whole can span several

λp behind the beam [7]. This pattern, referred to as the ‘ion bubble’ cavity structure moves

with the driver’s phase velocity and is shown in figure 1.2 in terms of the longitudinal electric

field at each point in the plasma cell.

As can be seen from figure 1.2, the longitudinal electric field varies continuously along the

length of the driver bunch and extends several µm behind it. The force on a given electron

in the beam is F = −eE, meaning that electrons at the beam’s core experience deceleration

while a small fraction in the back are able to ride the plasma wave in the same direction

as the beam’s propagation (from left to right in figure 1.2). These accelerating regions are

represented by the gradients between the large positive (red) and large negative (blue) electric

fields seen in 1.2.

The number of electrons that experience acceleration in these regions can be increased via

the injection of an appropriately timed witness bunch. The witness bunch, along with the

tail of the driver will be focused by the strong transverse electric fields generated by the wake.

However, in loading the plasma wave this way, the maximum longitudinal electric field that

can be achieved is reduced [8]. Provided that the driver moves with velocity vb w c (so

that the witness bunch cannot out run the accelerating structure), energy will be transferred

from the driver to particles in the witness bunch. The efficiency with which is limited by the

transformer ratio.

R =Ewitnessmax

Edrivermax

≤ 2− Nwitness

Ndriver(1.10)

Page 16: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 1 - Introduction to Plasma Wakefield Acceleration 6

Figure 1.2: Top: aerial view of a bi-Gaussian, 3 GeV electron beam containing 106 par-ticles, with σz = σr = 22.5µm, immersed in a cell of hydrogen plasma 2.2λplong and 2.2λp thick, where λp = 100µm and ne = 1.11× 1023m −3.Bottom: the longitudinal electric field created by the presence of this beamin the same cell. Red regions correspond to large negative forces on the beamelectrons, while for the blue regions the converse is true. The colour bars onthe right hand side represent the beam number density (m−3) and longitudinalelectric field (V/m).

Where Edrivermax is the maximum energy of particles in the driver beam and Ewitnessmax is the

maximum energy of particles in the witness beam. Ndriver and Nwitness refer to the number

of particles in the driver and witness bunches. Note that the transformer ratio is at most two

and decreases for witness beams of increasing particle number. Simulations have shown that

this upper limit of 2 can be overcome by using a drive bunch with an asymmetric current

profile, though this technically challenging in practice and experimental demonstration is

still to follow [9].

Despite the experimental success that PWA has enjoyed, several issues need addressing be-

fore PWA can be realised on a larger scale. Of these, the most notable involves creating

driver bunch lengths that correspond to significant wakefields and maintaining this bunch

length as the beam propagates. Despite compression methods being conceivable, these are

usually demanding in the size and RF power that they require [10]. An alternative approach,

Page 17: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 1 - Introduction to Plasma Wakefield Acceleration 7

Figure 1.3: Electrons in the back of the beam (red) experiencing acceleration due thestrong longitudinal electric fields at the back of the ion bubbles.

supported by simulation data, has shown that the electrostatic interaction between a wake-

field and a beam can modulate the beam into a series of micro-bunches, each with length

∼ λp, which can then go on to drive the wakefield closer to resonance.

This report will assume that the issues described are not beyond resolve and will focus on

identifying which value of radial driver bunch length generates the largest longitudinal electric

field in the plasma. A σr-dependent temperature, T , for a fixed emittance, ε, will then be

introduced into the beam to see how this affects the results. These aims and objectives are

discussed further in 2.5.

Page 18: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Theory

2.1 Chapter Summary

In this chapter the 1D plasma dynamics introduced in chapter 1 is extended to three dimen-

sions and modified to describe the plasma response to a beam with a bi-Gaussian profile.

The theoretical wakefield is then analysed as a function of the beam width for beams of

constant and variable charge. The outcome of this analysis is then used to inform the final

aims and objectives of the project.

2.2 Theoretical Framework in 3D

To model how the longitudinal electric field varies as a function of both the plasma and

driver beam parameters, it is necessary to first understand the dynamics involved and derive

a new equation accordingly.

Following the method outlined in [11], we begin by considering a particle of arbitrary charge

q, travelling with relativistic velocity vb ∼= c through a plasma. Taking the z-direction as

the axis of propagation, and assuming that the particle’s external charge density, ρ0, is

concentrated at its centre, we define:

ρ0 = qδ(r)δ(z − ct) (2.1)

Where r is the radial polar coordinate and δ the Dirac-delta function. The δ(z − ct) term

dictates that the particle is localised at z = ct only. The response of the plasma can then

be determined by applying the same linearised equations used previously, with the following

Maxwell equations now introduced:

∇×E1 = −1

c

∂B

∂t(2.2)

∇×B = −4π

cj +

1

c

∂E1

∂t(2.3)

8

Page 19: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 2 - 3D Plasma Dynamics 9

∇ ·E1 = −4πen1 + 4πρ0 (2.4)

Where j is the current density and B the magnetic field associated with the moving charges.

E1 and v1 retain their original definitions. Note that the difference in sign between n1 and

ρ0 in Poisson’s equation (2.4) arises from the fact that no assumption has been made about

the polarity of the input particle’s charge.

Recalling that the equation of motion for an electron displaced in the plasma is given by

(1.3), it can be found that by taking the time-derivative of the continuity equation (1.2) and

substituting Poisson’s equation (2.4) into the resulting divergence term, the following results:

∂2n1

∂t2+ ω2

pn1 = ω2p

(qe

)δ(r)δ(z − ct) (2.5)

Re-writing δ(z−ct) as δ(t− zc )/c, it can then be seen that (2.5) is akin to the general equation

of motion for a driven harmonic oscillator, namely:

n1 + ω2n1 = F (t) ∀ t > 0 (2.6)

Where t-derivatives have been relabelled in dot notation. Maintaining our assumption of

initial homogeneity in the plasma density and replacing F (t) with δ(t− t′), where t′ = zc , the

equation above can be recast in terms of the Green’s function G(t, t′):

G(t, t′) + ω2G(t, t′) = δ(t− t′) (2.7)

Which has the general solution1:

n1(t) = G(t, t′) = Θ(t− t′) 1

ωsin(ω(t− t′)) (2.8)

Note that by definition, the Heaviside step function, Θ, is 0 for values of t < zc and 1

otherwise. By comparison with equation (2.5), we see that our equation for n1(t) is of the

form:

n1(t) =

[ωp q δ(r)

c e

]sin(ωp(t−

z

c))Θ(t− z

c) (2.9)

To obtain an expression for the longitudinal electric field, we first take the curl of Faraday’s

law (2.2), and substitute in the time derivative of the Ampere-Maxwell equation (2.3). The

wave equation for E1 is then:(∂2

∂t2−∇2c2

)E1 = −4π

∂j

∂t− c2∇ (∇ ·E1) (2.10)

Where ∇ × ∇ × E1 = ∇ (∇ ·E1) − ∇2 E1 has been used to allow for the inclusion of

Poisson’s equation (2.4). Since j is the current per unit area, we can incorporate equation

1For full working see [12]

Page 20: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 2 - 3D Plasma Dynamics 10

(1.3) as follows:∂j

∂t= −n0e

∂v1

∂t= n0e

2 E1

me(2.11)

Now, by separating ∇2 into the sum of its transverse and longitudinal components, ∇⊥2 +

∂2/∂z2, and assuming that the z, t dependence of the wakefield is a function of the (z − c t)term only, i.e. ∂2/∂t2 = c2

(∂2/∂z2

), substitution of equation (2.4) and (2.9) into (2.10)

gives the following:

(∇⊥

2 − k2p

)E1 = (−4πqkp)∇

[δ(r)Θ(t− z

c) sin(ωp(t−

z

c))]

(2.12)

Where the dispersion relation k2p =

ω2p

c2has been used and ∇ · ρ0 = 0 implemented. Applying

the ∇ operator to the right hand side of equation (2.12) yields an expression containing the

longitudinal electric field, Ez:

(∇⊥

2 − k2p

)Ez = 4πq k2

p δ(r) Θ(t− z

c) cos(ωp(t−

z

c)) (2.13)

Equation (2.13) may then be solved by noting that the radial dependence of Ez is the Green’s

function response to the Kelvin-Helmholtz equation:

Ez = −2q k2pK0(kp r) δ(r) Θ(t− z

c) cos(ωp(t−

z

c)) (2.14)

Where K0 is the zeroth-order modified Bessel function of the second kind and a function of

the variables kp and r.

So far we have derived the longitudinal wakefield produced behind a single test particle of

charge q confined to position z = ct. To model experimental data, i.e. data obtained by

firing an ultra-relativistic beam of charged particles into a plasma, we replace q with a three-

dimensional charge density ρb(r, θ, ξ). Where r, θ and ξ refer to cylindrical polar coordinates

with the standard z coordinate being replaced by ξ, where ξ = z − ct. This modification

arises from the fact that z refers to the position of the head of the beam and we are interested

in the electric field generated behind it.

To derive the wakefield generated by such a beam, we integrate over equation(2.14) with ρb

taking the place of q:

Ez(r, θ, ξ) =

− 2k2p

∫ ξ

∞dξ′∫ ∞

0r′ dr′

∫ 2π

0dθ′ ρb(r

′, θ′, ξ′)K0(kp |r− r′|) cos(kp(ξ − ξ′)

)(2.15)

Where again, the dispersion relation c =ωpkp

has been used. Note that the primed variables

refer to dummy variables and the perpendicular distance between the r and θ directions is

given by |r− r′| =[r2 + r′2 − 2rr′ cos(θ − θ′)

] 12 .

Page 21: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 2 - 3D Plasma Dynamics 11

If the charge density ρb is separable such that ρb = ρ‖(ξ) ρ⊥(r, θ), then the longitudinal

electric field can be expressed as the product of its ξ and r components:

Ez(r, ξ) = Z ′(ξ)R(r) (2.16)

Where:

Z ′(ξ) =∂Z

∂ξ= −4π

∫ ξ

∞dξ′ ρ‖(ξ

′) cos(kp(ξ − ξ′)) (2.17)

R(r) =k2p

∫ 2π

0dθ′∫ ∞

0r′ dr′ρ⊥(r′, θ)K0(kp|r− r′|) (2.18)

To obtain an analytical expression for the wakefield response for a bi-Gaussian driver bunch,

the parallel and perpendicular components of the charge density are considered individually.

Beams with bi-Gaussian profiles (i.e. Gaussian distributed in the z and r directions), repre-

sent the closest physical description of beams that are commonly used in particle accelerator

experiments. Hence, optimising the wakefield response for such beams, should, in theory,

represent the most practical result.

For a beam with a Gaussian longitudinal profile ρ‖ = qnbe− ξ2

2σ2z , where σz is the rms length

of the driving bunch, evaluating equation (2.16) at r = 0 and a distance behind the beam

such that ξ � −σz gives:

Ez(0, ξ) =

{√2π(qe

)(mecωpe

)(nb0ne

)(kpσze

kpσ2z

2

)R(0)

}cos(kpξ) (2.19)

Where:

R(0) = k2p

∫ 2π

0dθ

∫ ∞0

r′ dr′ρ⊥(r′)K0(kpr) (2.20)

And nb0 is the peak value for the number density nb, distributed such that

nb = nb0exp[−1

2

(z2

σ2z

+ r2

σ2r

)].

For a beam with transverse profile ρ⊥ = qnbe− r2

2σ2r , where σr is the rms beam width of the

bunch, equation (2.18) gives [13]:

R(0) =

(k2pσ

2r

2

)ek2pσ

2r

2 Γ

(0,k2pσ

2r

2

)(2.21)

Where Γ(

0,k2pσ

2r

2

)is the incomplete Gamma function and has the general definition Γ(α, β) =∫∞

β tα−1 e−t dt. For increasing σr the incomplete gamma function term decays to zero (see

Appendix A, figure A.1). Note that equation (2.21) contains all of the wakefield’s radial

dependence and plateaus to 1 for large values of σr, as is shown in figure 2.1.

Page 22: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 2 - 3D Plasma Dynamics 12

0.001 0.002 0.003 0.004 0.005Σr @mD

0.9988

0.9990

0.9992

0.9994

0.9996

0.9998

1.0000RH0L

Figure 2.1: The radial dependence of the wakefield as embodied by equation (2.21),plateauing to 1 for large σr.

Combining equations (2.19) and (2.21), we obtain the absolute wake amplitude for a bi-

Gaussian driver bunch:

Ez0 =√

2π(mcωp

e

){(qe

)(nb0ne

)(kpσze

−k2p2 (σ2

z−σ2r))(

k2pσ

2r

2

(0,k2pσ

2r

2

)}(2.22)

While this represents the maximum wakefield that one can expect to generate for a given set

of beam parameters, it is worth noting that due to the cos(kpξ) term in (2.19) the electric

field will vary sinusoidally with time and hence the beam’s propagation distance (provided

that ne � n)b0). This is illustrated in figure 2.2 for some ‘typical’ experimental parameters

[6].

We can simplify equation (2.22) by recalling the form of ωp in c.g.s units (1.8) and that

for a 3D beam in which the total charge is constant, the total particle number is given by

N = (2π)32 σ2

r σz nb0, leaving:

Ez0 = qNk2p

{ek2p2 (σ2

r−σ2z)Γ

(0,k2pσ

2r

2

)}(2.23)

This is the equation given in [13] by W.Lu et al. For fixed beam parameters it is a function

of kp only. Given the frequency with which equation (2.23) will be referred to in this report,

it has been boxed for emphasis and easy identification by the reader. Its validity will be

tested extensively by comparing its predictions against data obtained from particle-in-cell

(PIC) simulations using EPOCH.

Page 23: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 2 - 3D Plasma Dynamics 13

5. ´ 10-5 1. ´ 10-4 1.5 ´ 10-4 2. ´ 10-4 2.5 ´ 10-4Ξ @mD

-1. ´ 107

-5. ´ 106

5. ´ 106

1. ´ 107

Ez @V�mD

Figure 2.2: The theoretical wakefield response of an infinite hydrogen plasma with uniformdensity ne = 1.11 × 1023m−3 as a symmetrical (σz = σr = 22.52µm), bi-Gaussian electron beam with 1.6×10−4 nC of charge, traverses a section of itslength equivalent to ξ = 250µm. This plot has been generated using equation(2.19) with R(0) given by (2.21).

2.2.1 The Linear Regime

With the radial dependence of the wakefield generated by bi-Gaussian driver bunches now

known, an attempt can be made to maximise equation (2.23) for a given σr. This is simple

to do for σz, where in the wide beam limit (σr � 10µm), R(0) ≈ 1, as is exemplified by

figure 2.1. For a beam of fixed length σz and normalised beam density nb0/ne, differentiating

equation (2.23) with respect to kp produces the well known result that Ez is maximised for

σz =√

2/kp.

This result is also true in the linear regime [13] which, as discussed earlier, represents the

limit in which the compressions and rarefactions of the plasma wave are assumed small

relative to the background plasma density. Roughly speaking, this regime is satisfied for

nb � ne. Above this, the electric field can no longer be described by equation (2.19) and the

blowout regime is achieved. The term ‘blow out’ here refers to the fact that in this regime

the perturbations in the plasma density are as large as the background plasma density itself,

causing larger regions of near zero electron density to be observed behind the driver [8]. The

plasma electrons are essentially ‘blown out’ by the beam’s space charge.

For our purposes, the wide beam limit will not be satisfied as σr will be varied within two

plasma wavelengths of the 1D optimum result for σz2. The linear regime however, will be,

2This because it is known that smaller beam widths correspond to larger wakefields - see next section.

Page 24: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 2 - 3D Plasma Dynamics 14

with the number of electrons in the beam being N = 106. For a driver with bunch length

σz =√

2/kp and bunch radius close to this, the number density of the beam is significantly

less than the number density of the plasma (where ne = 1023m−3 is considered as a ‘typical’

experimental plasma density [6] and is used for simulations in this project - see next chapter).

It is natural to ask whether generating results in this regime produces wakefields of interest or

even reflects experimental capabilities. Referring to figure 2.1, we see that for the parameters

listed, the amplitude of the wakefield is approximately 12.5 MeV. This is about a tenth of the

upper limit that RF cavities can sustain. We know from equation 2.23 that the amplitude

of the wakefield depends linearly on N , the number of charged particles in the beam (2.23).

If the linear regime is assumed to hold for nb < 100ne, then we can estimate the upper limit

on N before the blow out regime is approached.

Taking a ‘typical’ plasma density to be ne = 1023m−3 , and applying the 1D result that Ez

is maximised for σz =√

2/kp, then for symmetric bi-Gaussian beams we find that the upper

limit of N is in the order of 1012. This in turn would suggest that electric fields as large as

0.1 TeV/m can be described in the linear regime.

It is therefore a worthwhile endeavour to study the linear regime, as although the blow out

regime can generate larger electric fields [8], the linear regime is still able to surpass the 100

MV/m limit imposed on conventional metallic cavities. What’s more is that the wakefields

generated in the linear regime are less chaotic (compared to wakefields generated in the blow

out regime), which in turn may imply that they can be more easily loaded with an externally

injected beam of charged particles.

2.3 Radial Dependence

2.3.1 Constant Charge

The absolute wakefield from equation (2.23) is plotted in 2.3 as a function of σr. One notable

feature of this plot is that there is no peak in Ez0 for a given σr. Rather, for infinitely

thin beams we see that Ez0 asymptotes to infinity. Physically, this makes sense since an

infinitely thin beam of constant charge would have an infinitely high peak number density.

Greater peak number densities would be associated with greater Coulombic repulsion between

electrons in the beam and the plasma, thus amplifying the plasma response. Recalling

equation 2.22, we saw that there is a linear dependence between the peak number density

and the maximum electric field that can be achieved for a bi-Gaussian driver bunch.

Page 25: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 2 - 3D Plasma Dynamics 15

1. ´ 10-5 2. ´ 10-5 3. ´ 10-5 4. ´ 10-5 5. ´ 10-5Σr @mD

1. ´ 107

2. ´ 107

3. ´ 107

4. ´ 107

5. ´ 107

6. ´ 107

Ez0 @V�mD

Figure 2.3: The σr dependence of the absolute wakefield as given by equation (2.23). Notethat this plot has been generated using the same parameters used in figure 2.2with the exception that σr now varies from 0.5 - 50 µm.

2.3.2 Variable Charge

For the variable charge case, the opposite trend is observed. Rather than keeping the total

beam charge constant, the peak number density is kept constant. As our beam has its width

increased we add more charge to it, such that the charge per unit volume is the same, while

the total charge itself is increased. The σr-dependence of Ez0 is plotted below in 2.4. Note

that in this model the total number of particles is no longer given by N = (2π)32 σ2

r σz nb0.

Instead, the peak number density of the beam is independent of the beam’s rms width and

length with N = nb0. To drive wakefields of interest (> MV/m), N must be in the order of

1019.

Rather than trying to identify an optimum value for the rms beam width, this project will

test the trends predicted by 2.23 against simulation results generated in EPOCH for both

the constant and variable charge cases.

2.4 Beam Temperature

Compressing a beam of constant total charge increases its peak number density, and hence

the wakefield that can be driven by it. However, this is at the expense of the beam’s

temperature. By forcing the beam’s constituent particles closer together the Coulombic

Page 26: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 2 - 3D Plasma Dynamics 16

1. ´ 10-5 2. ´ 10-5 3. ´ 10-5 4. ´ 10-5 5. ´ 10-5Σr @mD

1. ´ 107

2. ´ 107

3. ´ 107

4. ´ 107

5. ´ 107

6. ´ 107

Ez0 @V�mD

Figure 2.4: The σr dependence of the absolute wakefield as given by equation(2.23) for thevariable charge case. Note that this plot has been generated using the sameparameters used in figure 2.3 with the exception that N = nb0 = 1020.

-0.0001 -0.00005 0.00005 0.0001r @mD

5.0 ´ 109

1.0 ´ 1010

1.5 ´ 1010

2.0 ´ 1010

2.5 ´ 1010

3.0 ´ 1010

3.5 ´ 1010

nb @m-3D

(a) Constant Charge Model

-0.0001 -0.00005 0.00005 0.0001r @mD

200 000

400 000

600 000

800 000

1 ´ 106

nb @m-3D

(b) Variable Charge Model

Figure 2.5: Left: Radial profile of the beam charge density for the constant charge case.Right Radial profile of the beam charge density for the variable charge case.

Both plotted for σr = 3√2

4kp, σr =

√2

2kpand σr =

√2

kp.

repulsion is increased and therefore acts to blow the beam apart. For a beam with emittance

ε = σrσθ, where σθ is the angular spread of the bunch; the temperature in the transverse

direction, Tr, can be determined from the beam’s kinetic energy [14].

1

2kBTr =

1

2mv2

r =1

2mc2β2γ2σ2

θ (2.24)

Where m is the rest mass of the beam’s constituent particles and vr is the transverse compo-

nent of the beam’s velocity. Note that γ denotes the Lorentz factor and that β = vc ≈ 1 for

relativistic beams. It is assumed here that the angle between the transverse component of

Page 27: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 2 - 3D Plasma Dynamics 17

velocity and axis of propagation is small, such that σθ = vr/βc. Recalling that σθ = ε/σr and

that for a beam with energy E, γ = Emc2

, we thus obtain the following relationship between

the transverse temperature and rms width of the beam:

Tr =E2

mc2

1

kB

ε2

σ2r

(2.25)

This inverse-square relationship between Tr and σr can thus be implemented into simulations

and used to determine whether the higher temperatures associated with smaller σr result in

lower time-averaged wakefields.

2.5 Aims and Objectives

Now that the relevant theory has been introduced, the aims of the project can be summarised

as follows:

• To test the predictions outlined by W. Lu et al. in equation (2.23) against data obtained

from 2 and 3 dimensional simulations by scanning over a range of σr values using

EPOCH.

• To introduce a σr-dependent beam temperature into simulations and determine whether

the trend of smaller beam radii driving larger wakefields still holds.

• To identify reasons for any discrepancies between the theoretical and simulation data.

Page 28: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Data Analysis

3.1 Chapter Summary

In this chapter the choice of simulation parameters is introduced and explained before the

procedures used to analyse the data are developed. Differences between the simulation and

expected data are discussed for the constant and variable charge models. An emittance of

0.03 mm mrad is then introduced to the constant charge beam and compared against the

original data. Finally, 2D simulations are extended to 3D for a smaller range of σr.

3.2 Simulation Parameters

Table 3.1: Simulation parameters used for the 2D σr scans in EPOCH.

Parameter Value

Plasma HydrogenPlasma profile Uniform

Plasma density, ne [m−3] 1.18× 1023

λp [µm] 100Simulation Box [µm× µm] 220(z)× 220(y)

Particles per cell 6Timestep, dt [fs] 66.6Duration, tend [dt] 12 dt

Beam profile Bi-Gaussian

σz =√

2kp

[µm] 22.5

σy [λp/300] 1 - 450Nconstant 1× 106

Nvariable 1× 1020

E [GeV ] 3Ty [K] 0

δz [per σz] 6δy [per σy] 6

Table 3.1 shows the simulation parameters chosen for the σr scans performed using the 2D

version of EPOCH. The number of grid points in z has been denoted by δz and likewise, the

18

Page 29: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 19

number of grid points in y by δy. Nconstant and Nvariable represent the number of particles in

the beam for the constant and variable charge cases. Recall that for the constant charge case

that nb0 = Nconstant/(2π)32σ2

yσz and that for the variable charge case Nvariable = nb0. Since

the simulations are 2 dimensional σr = σy. The reasons for the selected values of Nconstant

and Nvariable are explained in section 2.2.1.

It is important to note that the simulations do not start with the beam fully immersed in

plasma. Instead, the beam is initially positioned 55µm behind the plasma so that as the

beam propagates the peak in its number density approaches the plasma gradually. The

response of the plasma is highly dependent on the beam profile; remaining in the linear

regime requires that peak in beam number density is not the first point of contact between

the beam and the plasma . Hard-cut beams (beams with a steep leading edge) for example,

are known to drive stronger wakefields [15].

The choice of the remaining parameters is intended to reflect experimentally sensible values.

Hydrogen gas is readily available and can easily be ionised into plasma through the appli-

cation of a high voltage (i.e using a discharge tube). The density, as mentioned earlier is in

the same order of magnitude as the Lithium vapour used in the energy doubling experiment

at SLAC and its uniformity is assumed achievable, for example, by using a pulsed plasma

discharge in argon [16]. The dimensions of the simulation box are equivalent to 2.2λp×2.2λp

- meaning that at least one period of the sinusoidal variation of electric field with z can be

analysed. The amplitude of this sinusoidal variation can then be fitted and compared to the

amplitude predicted by W.Lu et al.

To enable the acquisition of data for a large range of σr values, the simulation duration of

0.8 ps is chosen so to allow enough time for the wakefield to be established. It was noted

that for time steps corresponding to 0.73 ps and above that there was very little variation in

electric field with time. To avoid acquiring excessive amounts of data 0.8 ps was chosen as

tend.

The range in σr corresponds to (0.01 - 6.66)√

2kp

where√

2kp

is the optimum rms beam length in

the linear regime. The reason for this asymmetry of values about the optimum value of σz is

that for smaller and smaller beam widths, larger and larger resolutions in y are required to

accurately resolve the wakefield structure. For a beam fully immersed in plasma, the time

taken for the simulation to complete is linearly proportional to the resolution in y (assuming

that the resolution in z is kept constant) [17]. This linear dependence between run time and

resolution therefore constrains the lower limit of σr values that can be practically simulated.

The range quoted in table 3.1 encompasses a broad enough range for the general trend to be

seen and takes an acceptable amount of time to run.

Page 30: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 20

As a final note, the beam energy of 3 GeV has been chosen to match that of the electron

beam at Diamond (RAL) while the temperature of 0 K is in line with the assumptions made

in the derivation of equation (2.23).

3.3 Amplitude Fitting

Figure 3.1 shows the general form of the 2D electric field data generated in EPOCH for the

simulation parameters chosen. Its form is characteristic of wakefields generated in the linear

regime.

Figure 3.1: The longitudinal electric field plotted against its position in z and y for aconstant charge beam fired into a plasma with the parameters listed in 3.1.Note that for the data above, σr = 22.5µm and t = 0.8 ps.

In order to compute the maximum electric field Ez0, a function was written in MATLAB to

truncate the data to the sinusoidal regions only. It performs this task using the following

method:

1. Determine the halfway point of the cell in the y-direction and consider the Ez vs. z

data for this halfway point.

2. Find the maximum value of Ez in this range and proceed only if this value is less than

the cut off-value specified by the user.

Page 31: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 21

3. Add the minimum and maximum Ez values to determine the ‘zero’ line - i.e. the

halfway point between the maximum and minimum.

4. Identify the minimum between the first data point and the maximum Ez data point.

5. Define a new range in the data, starting from the minimum identified above and ending

at the maximum Ez.

6. Identify the data point in this range that is closest to the ‘zero-line’ and use this as the

starting point to crop from.

7. Define a second range in the data starting from the maximum Ez and ending at the

final data point.

8. Within this range identify the minimum and define a new range starting at this mini-

mum and ending at the final data point.

9. Find the maximum within this range and truncate the previous range to end at this

maximum.

10. Identify the data point within this range that is closest to the ‘zero’ line and define

this as the point at which to end the crop.

11. Smooth the data in this interval by averaging over every 5 data points.

12. Fit a sinusoid of the form Asin(Bx + C) + D using a least squares fit, making initial

estimates for the values of A,B,C and D based on properties of the data.

13. Compare the amplitude from this fit to the amplitude expected by equation (2.23).

See Appendix B for the full code (‘Auto Sine Fit2.m’ ). Note that the fitting of the sinusoid is

required to ensure that the amplitude, i.e. the maximum electric field, Ez0, is not a result of

noise. Two examples are shown below to illustrate the effectiveness of the cropping method.

The first is an example of a ‘good’ crop while the second represents data in which there is

no sinusoid to be seen. For the latter case, the sine-fitting is avoided and the amplitude set

equal to zero.

To determine which values of Ez returned by EPOCH are reasonable, a modified form of

equation (2.22) is used. These modifications depend on whether the constant or variable

charge case is being considered. MATLAB’s incomplete gamma function is set equal to

zero too early for the values of σr considered here and so equation (2.23) cannot be used to

determine a cut-off value for Ez. Instead, it was found that for the constant charge case,

omitting the incomplete gamma function and exponential in σr term gave a value of Ez

close to the maximum value observed (note that this value is independent of σr). To allow

Page 32: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 22

0 10 20 30 40 50 60−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1x 10

8

0.12 um per unit cell

Long

itudi

nal E

lect

ric F

ield

[V/m

]

Figure 3.2: Side cut of the longitudinal electric field data at t = 0.73 ps for σr =2λp

300 . Thepoint of intersection between the vertical lines and the data points correspondsto where the data is cropped to (right) and from (left). The horizontal linerepresents the halfway point between the maximum and minimum longitudinalelectric field.

0 10 20 30 40 50−8

−7

−6

−5

−4

−3

−2

−1

0

1x 10

12

2.5 um per unit cell

Long

itudi

nal E

lect

ric F

ield

[V/m

]

Figure 3.3: Side cut of the longitudinal electric field data at t = 0.73 ps for σr =42λp

300 . Thespatial variation of the electric field is no longer sinusoidal and the maximumand minimum in electric field imply that the results are anomalous.

legroom for any unexpected effects that the theory may not have accounted for, this value

was multiplied by 100 and set as the upper limit on Ez.

For the variable charge case it was found that the same modification to equation 2.23 pre-

served the general trend of Ez increasing with σr but that the cut-off value was no longer

independent of σr. As a result, the modified form of equation 2.23 was evaluated at the

Page 33: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 23

largest value of σr in the simulation range. This produced values of Ez already 100 times

larger than those expected by the theory and so was used as the upper limit on Ez.

The scripts that call on the auto-cropping function have been written with their future utility

in mind. To alternate between the constant and variable charge cases it was decided that

the user should be prompted to enter in the plasma density, the number of particles in the

beam and the number of simulations to be analysed. This meant that any simulations ran

with changes to these parameters could be easily updated and that the cut-off value for

Ez could be changed (in the variable charge case) depending on the maximum value of σr

being considered. To avoid unnecessary analysis the user is also asked to specify whether

they wish to analyse simulation data for the constant or variable charge cases. The exact

implementation of the above can be seen in Appendix B (‘AutoCropResUpExtended.m’ ).

3.4 Results (No Emittance)

3.4.1 Constant Charge Model

0 0.5 1 1.5

x 10−4

10

11

12

13

14

15

16

17

18

19

20

RMS Beam Width, σr [m]

Log(

Am

plitu

de)

[V/m

]

EPOCH

W.Lu et al.

Figure 3.4: A comparison of the maximum longitudinal electric field, Ez0, generated inEPOCH against the longitudinal electric field expected from equation 2.23 forthe constant charge case. Due to the large range in Ez0, the natural logarithmhas been taken for easier comparison. Note that the gap observed betweenσr = (11 − 16)µm for the EPOCH data is due to anomalous results. Anexample of which is shown in figure 3.3.

Page 34: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 24

The most prominent feature of figure 3.4 is that there is a large discrepancy between the

theoretical and simulation generated values of Ez0. For the small values of σr tested (σr <

10µm) we see convergence between the two, with the divergence seeming to increase and

level off to a constant value for σr > 50µm. This can be seen more clearly by looking at

the absolute relative difference, as is plotted in figure 3.5. Only on one occasion does a

theoretical result fall within the error bars of the simulation data (σr = 0.67µm). Note that

the error bars on Ez0 are equal to twice the root mean square error on the fitted amplitudes

and correspond to a confidence interval of 95%. Standard error propagation has been applied

to these errors for the plot of log(Ez0) vs. σr (see appendix B, ‘AutoCropResUpExtended.m’

for the calculation).

0 0.5 1 1.5

x 10−4

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

RMS Beam Width, σr [m]

Abs

olut

e R

elat

ive

Diff

eren

ce

Figure 3.5: The absolute relative difference between the values of Ez generated in EPOCHand those predicted by W. Lu et al.

Looking at figure 3.5 it can be seen that the absolute relative difference between the theoret-

ical and simulation data plateaus to approximately 0.9 for values of σr = 0.5µm and above.

The reasons for this discrepancy - its existence and its trend, remains unclear.

To gauge the accuracy of the sine-fitting function we can look at the difference between the

raw maximum electric field values generated in EPOCH and the amplitude determined from

the fit. It is expected that the fitted amplitude will always underestimate the maximum data

point due to the smoothing that preludes the fitting. We find that on average, these differ

by 2.27× 105 V m−1 with a mean absolute relative difference of 0.16. The fitted amplitude is

therefore, on average, 84 % of the maximum Ez in the EPOCH data set. The trend in the

Page 35: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 25

absolute relative difference between the maximum data point and the fitted amplitude vs.

σr is somewhat noisy but does imply that for σr > 60µm the relative difference increases for

increasing σr. The relevant data can be seen in Appendix A, figure A.2. The form of this

difference, as well as its magnitude is not enough to explain why the theory is almost ten

times larger than the simulation results for a large range of σr. Instead we must turn our

attention to the theory and the assumptions that it makes.

3.4.2 Variable Charge Model

0 0.5 1 1.5

x 10−4

0

0.5

1

1.5

2

2.5

3

3.5

x 107

RMS Beam Width, σr [m]

Ele

ctric

Fie

ld A

mpl

itude

[V/m

]

EPOCHW.Lu et al.

Figure 3.6: Maximum longitudinal electric field seen for σr = (0.33−150)µm in the variablecharge model.

For the variable charge case, it can be seen from figure 3.6 that there is a marked improvement

in agreement between the two data sets. Firstly, we see that the theoretical curve passes

through the error bars of the simulation data for values of σr & 32.95µm, with the two

converging for increasing σr. Again, this can be seen more clearly by referring to the absolute

relative difference, shown in figure 3.5. For values of σr > 101µm the theoretical curve falls

entirely within the simulation data’s error bars, with the absolute relative difference being

less than 1× 10−3.

The mean absolute relative difference between EPOCH’s maximum Ez0 and the amplitude

fitted to this data is similar to the constant charge case, having a slightly larger value of

0.16. As before, this difference increases for increasing σr and so cannot fully explain the

Page 36: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 26

0 0.5 1 1.5

x 10−4

0

2

4

6

8

10

12

RMS Beam Width, σr [m]

Abs

olut

e R

elat

ive

Diff

eren

ce

Figure 3.7: Absolute relative difference between the Ez0 predicted by equation 2.23 andthe 2D data obtained in EPOCH.

discrepancy seen for smaller σr (see figure A.5). Nonetheless, we can test the ‘goodness’ of

the theoretical fit and see if any modifications can be argued for.

3.4.3 Modifying The Theory

Equation 2.23 was derived under the following assumptions:

• The plasma is not subject to any external fields (e.g magnetic or temperature).

• The beam has a bi-Gaussian profile and has no emittance, ε.

• Perturbations in the plasma density are small relative to the plasma density itself (the

linear regime).

• Plasma ions are heavy and immobile.

• The plasma density is initially uniform (∂ne∂t = 0).

For the simulation data, all of these assumptions can be easily verified. The first is defined

from within the simulation settings while the remaining four can be checked by looking at

the number density of the beam electrons, plasma electrons and plasma ions. Differences in

Page 37: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 27

these number densities for the first and final time steps (0.8 ps) were found to be negligible.

Furthermore, the sinusoidal form of the wakefields seen for a majority of σr suggests that

the plasma response is well within the linear regime. The anomalous results seen between

σr = (11 − 16)µm for both charge models are thought to owe their origins to an error in

EPOCH, and not to an actual physical effect.

Despite the theoretical fit appearing to be a reasonable description of the variable charge

simulation data, performing a χ2 test reveals that the difference is statistically significant

(see Appendix B, ‘AutoCropResUpExtended.m’ to see how this was calculated), with an

associated p-value of 0. In an attempt to ameliorate this ‘badness-of-fit’, equation 2.23 was

recast in the following form:

Ez0 = C1

(mc2

e

){(qe

)(nb0ne

)k4p σz σ

2r exp

(C2k

2p

[σ2z − σ2

r

])Γ

(0,k2pσ

2r

2

)}+ C3 (3.1)

Where C1,C2 and C3 represent (scalar) constants to be determined (note that nb0 is always

re-written in terms of the relevant N factor for the constant and variable charge cases).

Values of these constants that minimise the difference between the two data sets were found

using mathematica’s ‘FindFit’ function (see Appendix B). The results of this process are

shown in tables 3.2 and 3.3.

Table 3.2: Mathematica’s least squares fit for equation 3.1 for the constant charge model.

Constant Original FindFit

C1 (4π)−1 ' 7.95774× 10−2 −1.98839× 10−4

C2 5.00× 10−1 6.20339× 10−1

C3[V m−1] 0.00 2.12357× 106

Table 3.3: Mathematica’s least squares fit for equation 3.1 for the variable charge model

Constant Original FindFit

C1

√π2 ' 1.25331 1.12416

C2 5.00× 10−1 4.99654× 10−1

C3[V m−1] 0.00 4.62001× 106

It can be seen from table 3.2 that for the constant charge case C1 and C3 are vastly to

different to the values that they take in equation (3.1). The factor of 0.5 in the exponent is

increased by approximately 1.2, whereas for the variable charge the 0.5 factor is essentially

unchanged. Similarly, the amplitude-factor, C1, is within 0.12915 of the (π/2)0.5 factor for

the variable charge model, with only the offset term, C3, having a notable increase. Given

the deviation seen in figure 3.4 (constant charge), we expect there to be significant differences

Page 38: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 28

between the fitted and theoretical constants tabulated above, particularly for the offset and

decay (C2) terms - for example, the ‘kink’ in the theoretical curve is too shallow for smaller

σr. Plotting equation (3.1) with these new ‘optimised’ constants reveals an improvement

between the theoretical and variable charge simulated data only. For the constant charge

data, the new ‘fit’ is inadequate in modelling the data for all values of σr. The two fits are

compared directly in figure 3.8.

0 0.5 1 1.5

x 10−4

0

2

4

6

8

10

12

14

16

18x 10

7

RMS Beam Width, σr [m]

Ele

ctric

Fie

ld A

mpl

itude

[V/m

]

EPOCH

W.Lu et al.

LSQ Fit

(a) Constant Charge Modified Model

0 0.5 1 1.5

x 10−4

0

0.5

1

1.5

2

2.5

3

3.5

x 107

RMS Beam Width, σr [m]

Ele

ctric

Fie

ld A

mpl

itude

[V/m

]

EPOCH

W.Lu et al.

LSQ Fit

(b) Variable Charge Modified Model

Figure 3.8: Comparisons of the original data with modified forms of the theory using theconstants C1, C2 and C3 given in tables 3.2 and 3.3.

Page 39: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 29

The modified form of theory for the variable charge model is clearly a better description of

the simulation the data. The drawback however, is that it is difficult justify these new values

of C1, C2 and C3 from a physical source. Since the simulation data is not truly ‘experimental’

there is an ambiguity in which of the two data sets is to faulter. Ultimately, a control data

set is needed. Given the widespread academic use of EPOCH, it seems unlikely that the

simulations performed here have provoked a new line of scrutiny.

3.5 Results (Emittance)

To determine whether introducing the σr-dependent temperature derived in section 2.4 alters

the trend of increasingly smaller beam radii driving increasingly larger wakefields, simulations

were run with the same parameters listed in table 3.1 (for the constant charge model) but

with an emittance of 1 mm mrad introduced. This value of emittance was chosen to represent

an experimental emittance (for example, the PS beam at CERN has an emittance of 0.1 mm-

mrad) whilst being large enough for the beam ‘explosion’ effect to be seen. Implementing

this emittance was found to increase the simulation run time by impractical factors and so

was scaled down to 0.03 mm mrad (≈√

0.001× 1 mm mrad) as a compromise. Scaling the

emittance in this way was found to alleviate the run time problem aforementioned - provided

that the rms beam width was no less than10λp300 .

Due to the complexity of the dynamics associated with the diverging 3 GeV electron beam

in plasma, it was unknown for how long the simulations should be allowed to run for. To

enable a reduction in beam number density to be seen for a broad range of σr values, the

simulation duration was extended from 12 to 100 dt, with dt changed from 66.6 fs to 333 fs.

As can be seen from figure 3.9, it was found that for all beam widths tested, a general decrease

in peak number density with time was observed. From equation (2.22) we saw that there is

a linear dependence of Ez0 on nb0 and so a decrease in peak number density should imply a

proportionate reduction in the wakefield’s amplitude. This was approximately observed for

all σr tested, a notable exception being the σr =20λp300 case where an increase in electric field

was observed once nb0 had fallen to zero (see figure 3.9). This can be seen in appendix A,

figure A.9.

It was decided that to avoid this bug of excessively large electric fields (e.g. 1024 V m−1 at

34 ps), the longitudinal electric field would be analysed for the first 25 time steps only. The

reason being that this allows the smallest σr, and hence highest temperature simulation to be

compared against the others. Faster reduction rates in beam number density should translate

into faster reductions in wakefield amplitude, and so any trade-off between this effect and

the fact that thinner beams drive stronger wakefields should be seen for smaller σr. Figure

Page 40: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 30

0 0.5 1 1.5 2 2.5 3

x 10−11

0

1

2

3

4

5

6

7

8x 10

19

Time [s]

Pea

k B

eam

Num

ber

Den

sity

[m− 3]

20 λp/300

25 λp/300

35 λp/300

40 λp/3000

50 λp/300

(a) Peak Beam Number Density vs. Time

1 2 3 4 5 6 7 8

x 10−12

2

3

4

5

6

7

8

9x 10

6

Long

itudi

nal E

lect

ric F

ield

[V/m

]

Time [s]

(b) Maximum Longitudinal Electric Field vs. Time

Figure 3.9: Comparison of the peak beam number density with time for a beam with aninverse-square σr-dependent temperature and the resulting change in wake-field driven. In (b), the time-interval has been truncated to 8.3 ps to avoidanomalous results.

3.9 suggests that this rate of change in number density does not directly affect the rate of

change in the driven wakefield’s amplitude. Comparing the slopes in Ez0 for σr =20λp300 and

σr =40λp300 it can be seen that only for the first case is the decline in electric field amplitude

visible. For the σr =40λp300 simulation, more time is needed before the downward trend can be

acknowledged. It is possible that the temperatures associated with σr = (35− 50)λp300 (listed

in table 3.4) are too low for the desired beam explosion effect to be seen.

Page 41: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 31

0 0.5 1 1.5 2 2.5 3 3.5

x 10−11

1

1.5

2

2.5

3

3.5

4

4.5

5x 10

6

Max

imum

Lon

gitu

dina

l Ele

ctric

Fie

ld [V

/m]

Time[s]

35 λp/300

40 λp/300

50 λp/300

60 λp/300

70 λp/300

Figure 3.10: Comparison of the maximum longitudinal electric field observed over 33.3 psfor σr = (35− 70)

λp

300 , where λp = 100µm.

Looking to figure 3.9(b), it seems feasible that extending the range in σr and the end point of

the simulation could reveal an overlap between the electric fields associated with successively

smaller σr. Fitting a line of the form Ez0 = mt+ C to the σr =35λp300 and

40λp300 electric field

data in 3.10 reveals that the two should intersect after 42 ps (see Appendix A, figure A.10).

This would require tend to be increased by a factor of 1.3. Despite the increase in run time

needed to obtain data for such a tend, its possible that as the number density of the beam

diminishes with time, the plasma dynamics will become easier to simulate. This requires

further investigation.

Plotting dEz0dt for each of the σr shown in figure 3.10 and fitting an exponential to the results

indicates that:dEz0dt

= −6.149× 1017 exp(−6.705× 10−2 σr) (3.2)

Where σr is in units ofλp300 . See appendix A, figure A.8 for this fit against the data.

Clearly, the accuracy of this trend depends on the accuracy of the linear fit and realisti-

cally, more tests at smaller σr are required before this relationship can ascertain confidence.

Nonetheless, it contradicts the idea that the rate in the rate of decline in Ez0 will increase

for decreasing σr. It should be noted that attempts at obtaining data for smaller σr were

made but proved futile. Even when halving resolution in y from 6 points per σr to 3, too

few time steps were returned for meaningful analysis.

Page 42: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 32

Table 3.4: Beam temperatures calculated using equation 2.25 for different σr. Note thatλp = 100µm.

σr[λp/300] Tr [1012K]

20 4.1225 2.6430 1.8335 1.3540 1.0350 0.6660 0.4670 0.3375 0.2980 0.2690 0.20110 0.14

The time-averaged wakefield over the first 8.3 ps for the σr shown in 3.4 is plotted in figure

3.11. As expected, the amplitude of the wakefield is less than that seen in the absence of

beam temperature. The difference between the two appears to diverge for σr < 10µm. If

more computational saves could be found to allow probing of smaller σr then it is possible

that the ε = 1 mm mrad data would no longer mirror the T = 0K trend.

0.5 1 1.5 2 2.5 3 3.5

x 10−5

12

13

14

15

16

17

18

19

RMS Beam Width, σr [m]

Log(

Am

plitu

de)

[V/m

]

EPOCH (T = 0 K)W.Lu et al. (T = 0 K)Emittance = 0.03 mm mrad

Figure 3.11: Comparison of the original results for the constant charge model with theEz0 data obtained by introducing a σr-dependent temperature.

Page 43: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 3 - Data Analysis and Discussion 33

3.6 3D Simulations

As a last resort in addressing the large discrepancy seen between the theory outlined by W.

Lu et al. and the results obtained in EPOCH, the parameters in table 3.1 (for the constant

charge case) were extended to a three dimensional simulation. To ensure the same resolution

in both radial directions, the resolution in x, δx, was set equal to the resolution in y (see table

3.1). The results of this process are illustrated in 3.12. Reassuringly, we see that the 2D and

3D EPOCH results are in relatively good agreement, though for the 3D data the increase in

Ez0 seems to increase less sharply for smaller σr. It should be noted that the raw maximum

electric field, as opposed to a sinusoidal fitted amplitude, has been plotted for the 3D data

due to the late stage in the project in which the data was obtained. Nonetheless, figure 3.12

refutes the idea that the theoretical discrepancy is due to an inability of 2D simulations to

describe 3D plasma dynamics.

1 2 3 4 5 6

x 10−5

12

13

14

15

16

17

18

RMS Beam Width, σr [m]

Log(

Am

plitu

de)

[V/m

]

EPOCH 2DW.Lu et al.EPOCH 3D

Figure 3.12: 3D data compared against the 2D and theoretical (3D) data obtained previ-ously.

Page 44: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Conclusion

4.1 Project Summary

The aims of the project have been met with limited success. For both the 2D and 3D

simulations performed, a significant discrepancy is seen between the theoretical and simulated

data, particularly in the case for the constant charge model. Introducing a σr-dependent

temperature was found to reduce the magnitude of the wakefield driven over time, but not

at a rate that gave larger σr preference. If further computational saves can be made, then it

is possible that extending the range to smaller σr may unveil the ‘sweet-spot’ in σr that was

hoped for.

Attempts were made to address the source of discrepancy seen in figures 3.4 and 3.6. By

comparing the fitted amplitudes with the maximum data points generated in EPOCH, it

was found that the under-estimating effect due to averaging could not explain the trend or

magnitude in the discrepancies seen. The assumptions made in deriving the theory were

checked by looking at the plasma electron and ion number densities for the time steps con-

sidered. It was thought that the assumption of immobile ions may have been invalid for

the hydrogen plasma - since this plasma consists of individual protons as opposed to the

collection of protons and neutrons that comprise the heavier elements. This however, was

found not to be the case. The proton density appeared uniform (within the limits of noise)

and the sinusoidal forms of the wakefields observed suggest that the response of the plasma

was as expected. If not in size, then at least in form.

As discussed earlier, a third source of data is needed to decipher whether the inaccuracy

lies with EPOCH or equation 2.23. Several anomalies were found in the data output by

EPOCH but these generally consisted of unacceptably large electric fields, and therefore

cannot explain why the electric fields seen in the constant charge case are so much lower

than expected. It remains unclear as to why the theory is a better representation of the

variable charge data than the constant.

34

Page 45: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Chapter 4 - Conclusion 35

4.2 Further Investigations

Despite the partial failure in fulfilling the aims of the project, the tools to pursue them

further are now in place. For wakefields of the form shown in 3.1, a function has been

written to hone in on the sinusoidal regions only. As long as the data contains one period of

sinusoidal variation, with a maximum that corresponds to the maximum of the sine-curve,

then this region will be identified. Scripts have also been written to call on this function and

enable more accurate analysis of the electric field as it varies with a chosen parameter. In

‘TimeAverageEmit.m’ (see Appendix B) for example, the amplitude of the wakefield can be

fitted at each time step, for each individual increment in the parameter of interest (σr in this

case). The number of time steps to be considered as well as simulations deemed ‘successful’

are defined outside of MATLAB (see Appendix B ‘DidItRun.sh’ and ‘success.sh’ ) so that

minimum user input is required.

In terms of optimising the beam radius for EDPWA, it is evident from the data that the

smaller the root mean square beam width, the stronger the wakefield driven. Charged beams

cannot be compressed ad infinitum due to the increasing effect of Coulombic repulsion and

there is experimental evidence to suggest that the lower limit on transverse beam compression

is on the nano-metre scale [18]. An extension of this project could look into the affects of the

transverse focusing forces associated with the plasma ion bubbles and whether these can be

taken advantage of to compress the beam further. Alternatively, the transverse size of the

accelerating structure itself could be analysed for a range of σr. While it has been shown

that thinner beams driver stronger wakefields, it is possible that the smaller transverse scales

associated with these wakefields may cause problems in how effectively they can be loaded

with a witness bunch. An analytical model for the time-dependence of σr for beams with

emittance propagating in plasma could also be developed and compared against the results

presented in this report.

Page 46: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Additional Figures

Animation 1

An animation illustrating the general concept of plasma wakefield acceleration can be found

here:

www.megaswf.com/file/2561293

Data directories

The simulation data can be found at:

Constant charge: [email protected]/unix/pdpwa/slucas/RadiusResGauss

Variable charge: [email protected]/unix/pdpwa/slucas/RadiusUnNorm20

Emittance: [email protected]/unix/pdpwa/slucas/EmitScanScaled

3D (constant charge): [email protected]/unix/pdpwa/slucas/3DSims2

0 1 2 3 4 5x0.0

0.2

0.4

0.6

0.8

1.0GH0, xL

Figure A.1: The general form of the incomplete Gamma function Γ(0, x).

36

Page 47: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix A - Additional Information 37

A.1 Constant Charge Data

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

x 10−4

0.06

0.08

0.1

0.12

0.14

0.16

0.18

0.2

0.22

RMS Beam Width σr [m]

Rel

ativ

e D

iffer

ence

Figure A.2: The difference between the maximum electric field and the fitted amplitudeas a fraction of the maximum electric field for the constant charge case.

0 0.5 1 1.5

x 10−4

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2x 10

8

RMS Beam Width, σr [m]

Max

imum

Ele

ctric

Fie

ld [V

/m]

EPOCH 2DPower FitW.Lu et al.

Figure A.3: The exponential of the constant charge data shown in figure 3.4 (i.e. theoriginal data). Using MATLAB’s ‘cftool’ a power-law function of the formf(σr) = aσbr + c has been fitted to the EPOCH 2D data. Optimised constantswere found to be a = 34.05, b = −1.04 and c = −5.027× 105.

Page 48: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix A - Additional Information 38

0 0.5 1 1.5

x 10−4

0

1

2

3

4

5

6

7x 10

7

RMS Beam Width, σr [m]

Diff

eren

ce (

The

ory

− S

im)

[V/m

]

Difference Exponential Fit

Figure A.4: Difference between theoretical Ez0 and EPOCH Ez0 for the constant chargemodel. An exponential fit of the form f(σr) = A exp(Bσr) +C exp(Dσr) hasbeen added in red. Using MATLAB’s ‘cftool’, these constants were found tobe: A = 5.639×107, B = −8139×104, C = 3.772×106 and D = −1.357×104.

A.2 Variable Charge Data

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

x 10−4

0.06

0.08

0.1

0.12

0.14

0.16

0.18

0.2

0.22

RMS Beam Width, σr [m]

Rel

ativ

e D

iffer

ence

Figure A.5: The difference between the maximum electric field and the fitted amplitudeas a fraction of the maximum electric field for the variable charge case.

Page 49: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix A - Additional Information 39

0 0.5 1 1.5

x 10−4

0

0.5

1

1.5

2

2.5

3

3.5

x 107

RMS Beam Width, σr [m]

Ele

ctric

Fie

ld A

mpl

itude

[V/m

]

EPOCH PolynomialW.Lu et al.

Figure A.6: A 5th order polynomial fit to the variable charge EPOCH 2D data shown infigure 3.6. For a function of the form f(σr) = p1σ

5r+p2σ

4r+p3σ

3r+p2σ

2r+p1σr+

p0 optimised constants were found to be p1 = 4.083 × 1027, p2 = −2.015 ×1024, p3 = 3.848×1020, p4 = −3.59×1016, p5 = 1.698×12 and p6 = 1.305×106.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

x 10−4

−5

−4

−3

−2

−1

0

1x 10

6

RMS Beam Width [m]

Diff

eren

ce (

The

ory

− S

im)

[V/m

]

Figure A.7: Difference between theoretical Ez0 and EPOCH Ez0 for the variable chargemodel. It was found that even high order (> 9) polynomials did not describethis difference accurately.

Page 50: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix A - Additional Information 40

A.3 Emittance Data

35 40 45 50 55 60 65 70−6

−5

−4

−3

−2

−1

0x 10

16

RMS Beam Width, σr [λ

p/300]

Rat

e of

dec

line

in E

z [V/s

]

dEz/dt

Exponential Fit

Figure A.8: dEz0

dt vs. σr for the data shown in figure 3.10, the curve in red is described byequation 3.5.

0 0.5 1 1.5 2 2.5 3 3.5

x 10−11

0

0.5

1

1.5

2

2.5

3

3.5

4x 10

24

Long

itudi

nal E

lect

ric F

ield

[V/m

]

Time [s]

Figure A.9: Huge electric fields seen for the, ε = 0.03 mm mrad, σr =20λp

300 simulation.This is thought to be due to an error in EPOCH.

Page 51: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix A - Additional Information 41

1 1.5 2 2.5 3 3.5

x 10−11

2

2.2

2.4

2.6

2.8

3

3.2

3.4

3.6

3.8

4x 10

6

Max

imum

Lon

gitu

dina

l Ele

ctric

Fie

ld [V

/m]

Time [s]

35 λp/300

40 λp/300

− 5.7e16*t + 4.3e6

− 4.5e16*t + 3.8e6

Figure A.10: Linear fits to Ez0 vs. time for σr =35λp

300 and σr =40λp

300 .

Page 52: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Code

‘Auto Sine Fit2.m’

The function written to crop sinusoidal regions of electric field and fit sine-curves to the data

generated in EPOCH is provided below.

1 % The following function looks at the electric field in x and y in a 2D

2 % plasma cell and crops data to focus on the sinusodial region only. The

3 % data is averaged every 5 data points (smoothed) before MATLAB 's fittype

4 % function fits a sinusoid of the form ASin(Bx + C) + D. The

5 % amplitude is then passed on to various scripts for further analysis.

6 % Typically:

7 % data1 = Answer.Electric_Field.Ex.data;

8 % data2 = Answer.Grid.Grid.y;

9 % data3 = Answer.Grid.Grid.x;

10 % m = the range to be looped over

11

12 function[Amplitude , error]= Auto_Sine_Fit2(data1 , data2 , data3 , m);

13

14 global Amplitude;

15 global error;

16 global LimitE;

17

18 ycut = round(0.5*( length(data2))); % Make cut at halfway along y point

19 x = data3; % Keep x-data the same

20 xlength = length(data3) - 1; % Need data1 and x to have same range

21 data = data1 (1: xlength , ycut);

22 %plot (1: xlength , data) % Check form of your data

23 %hold on

24

25 maxEx = max(data1 (1: xlength , ycut));

26

27 if maxEx < LimitE

28

29 minEx = min(data1 (1: xlength , ycut));

30 divider = (maxEx + minEx); % Set the 'zero ' line

31 dividerArray (1: xlength) = divider;

32 columnDivider = transpose(dividerArray);

33 plot (1: xlength , columnDivider)

34 hold on

35

42

Page 53: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 43

36 % Split data into 2 regions to identify where to crop

37

38 verticalChop1 = find(data == maxEx);

39 xIndice = transpose (1: xlength);

40 dataEx1 = data (1: verticalChop1);

41

42 lowerVerticalChop1 = find(dataEx1 == min(dataEx1));

43 newdataEx1 = data(lowerVerticalChop1:verticalChop1);

44 d1Length = length(newdataEx1);

45 columnDivider1 = columnDivider (1: d1Length);

46 difference1 = abs(newdataEx1 - columnDivider1);

47 identifyMin1 = sort(difference1);

48 % Minimum difference corresponds to first point to make the crop

49 crop1 = lowerVerticalChop1 + find(difference1 == identifyMin1 (1));

50

51 %plot(crop1 , data) % Uncomment to check position of crop1

52 % title(['Ex-', timestep ]);

53 % ylabel('Volts (V)');

54 % xlabel('0.0011 mm per unit cell '); % CHANGE AS APPROPRIATE

55 %hold on

56

57 upperStart = verticalChop1;

58 upperEnd = xIndice(end);

59 dataLowerInterv = data(verticalChop1:upperEnd);

60 secondMin = find(dataLowerInterv == min(dataLowerInterv));

61 cut1 = secondMin + upperStart;

62 dataUpperInterv = data(cut1:upperEnd);

63 secondMax = find(dataUpperInterv == max(dataUpperInterv));

64 cut2 = cut1 + secondMax;

65

66 if cut2 - cut1 > 2 % Avoid data sets where second min and second ...

max are very close

67 dataUpperInterv2 = data(cut1:cut2);

68 d2Length = length(dataUpperInterv2);

69 columnDivider2 = columnDivider (1: d2Length);

70 difference2 = abs(dataUpperInterv2 - columnDivider2);

71 identifyMin2 = sort(difference2);

72 crop2 = cut1 + find(difference2 == identifyMin2 (1));

73 plot(crop2 , data)

74 %See what plot looks like with these crops imposed

75

76 %disp('Done cuts ');

77

78 %hold off

79

80 %figure (2);

81 croppedData = data(crop1:crop2);

82 %plot(crop1:crop2 , croppedData); %Check your cropped data

83 %xlim([crop1 crop2])

84 %title(['Ex-', timestep ]);

85 %ylabel('Volts (V)');

86 %xlabel('0.0011 mm per unit cell ');

87

88 % Now , smooth data and fit sine curve

89 % Smooth by averaging

Page 54: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 44

90

91 range = crop2 - crop1;

92 length(range); % Check if unexpected behaviour

93 xNow = transpose(crop1:crop2);

94 lengthxNow(m) = length(xNow);

95

96 % Average over every 5 data points

97 for n=3: range - 2;

98 croppedData(n) = (croppedData(n-2) + croppedData(n-1) + ...

croppedData(n) + croppedData(n+1) + croppedData(n+2)) / 5;

99 end

100

101 %disp('Done averaging ')

102

103 %disp('Averaging done ');

104

105 %figure (3);

106 %plot(crop1:crop2 , croppedData);

107 %xlim([crop1 crop2])

108 %title(['Ex-', timestep ]);

109 %ylabel('Volts (V)');

110 %xlabel('Cell no. ');

111

112 % Now we fit the sinusoid

113

114 f = fittype('a + b*sin(c*x + d)');

115

116 % Some initial estimates for the sinusoid fitter , based on data

117 a_fit0 = divider; % the 'zero ' line

118 b_fit0 = (maxEx - minEx) / 2; % the amplitude

119 c_fit0 = (2*pi / crop2); % estimate c based on second ...

intercept with zero line

120 d_fit0 = -crop1; % shift the sine curve forward so to start ...

from crop1

121

122 ourstart0 = [a_fit0 , b_fit0 , c_fit0 , d_fit0 ];

123

124 [fit_params0 , errors] = fit(xNow ,croppedData , f, 'Startpoint ', ...

ourstart0);

125 a_fit0 = fit_params0.a;

126 b_fit0 = fit_params0.b;

127 c_fit0 = fit_params0.c;

128 d_fit0 = fit_params0.d;

129

130 y_fit0 = a_fit0 + b_fit0*sin(c_fit0*xNow +d_fit0);

131

132 %figure (4);

133 %plot(xNow , croppedData , 'b. ', xNow , y_fit0 , 'c-');

134 %xlim([crop1 crop2])

135 %title(['Ex-', timestep ]);

136 %ylabel('Volts (V)');

137 %xlabel('0.0011 mm per unit cell ');

138 %hold on

139

140 error(m) = errors.rmse; % 95% confidence intervals

Page 55: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 45

141 Amplitude(m) = b_fit0;

142

143 else

144 % Reject anomalous amplitudes - not sinusoidal

145 Amplitude(m) = 0;

146 error(m) = 0;

147 end

148

149 else

150 % Reject amplitudes that are too big

151 Amplitude(m) = 0;

152 error(m) = 0;

153 end

‘AutoCropResUpExtended.m’

An example script calling on the ‘Auto Sine Fit2.m’ function is inserted below. This script

has been used to generate a majority of plots shown in chapter 3.

1 clear all

2

3 % The following script looks at the longitudinal electric field vs. beam

4 % radius for the constant and variable charge cases. The case to be

5 % considered is input by the user as are the number of particles in the

6 % beam , the plasma density and the number of simulations to be considered.

7 % These latter three variables are used to determine whether Auto_Sine_Fit2

8 % produces 'sensible ' values for the amplitude. Fitted amplitudes that are

9 % above this limit are rejected. The rest of the script then imports the

10 % theoeretical data from Mathematica (LeastSquares.nb) (which is necessary

11 % due to the unusual nature of MATLAB 's incomplete gamma function), and

12 % compares it against the simulation results. A chi -squared test

13 % is attempted to gage how well the theory describes the sims.

14

15 % Comment out any of the figures that you wish to suppress.

16

17

18 global Amplitude

19 global error

20 global LimitE;

21

22 me = 9.11e -31;

23 c = 3e8;

24 e = 1.6e -19;

25 perm = 8.85e -12;

26

27 % Use simulation parameters to determine range of beam radii to be analysed ...

and to

28 % constrain amplitudes below a threshold value - LimitE.

29

30 particleN = input('Enter the number of particles in the beam: ');

31 plasmaDen = input('Enter the plasma density (m^-3): ');

32 simN = input('Enter total number of simulations: ');

33 Normalised = input('Is your beam charge normalised? Y/N: ', 's');

Page 56: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 46

34

35 while (Normalised 6= 'Y') && (Normalised 6= 'N')

36 Normalised = input('Is your beam charge normalised? Y/N: ', 's');

37 end

38

39 if (Normalised == 'Y') && (particleN / plasmaDen) > 10e-5

40 disp('Warning - your beam may not be normalised ')

41 end

42

43 if isempty(Normalised)

44 (Normalised == 'Y');

45 end

46

47 omegap = (( plasmaDen*e*e)/(me*perm))^0.5;

48 kp = omegap/c;

49 sigmaz = sqrt (2)/kp;

50 lambdap = (2*pi) / kp;

51 sigmar = (lambdap /300)*simN;

52

53 % Define LimitE for each case and import the relevant data from

54 % Mathematica.

55

56 if (Normalised == 'Y');

57 LimitE = ...

100*(1/4* pi)*((me*c*c)/e)*( particleN/plasmaDen)*kp^4*exp(-0.5*kp^2* sigmaz ^2);

58 mathematicaTheoryEz = importdata('TheoryEzMathematica.mat '); % Continuous ...

Range

59 mathematicaLogEz = log(mathematicaTheoryEz); % Easier to see trend

60 mathematicaFitNorm = importdata('fittedMathematica.mat ');% Fitted Data

61 mathematicaR = 1: length(mathematicaTheoryEz);

62 mathematicaRUnits = mathematicaR. *( lambdap /300);

63 data3D = importdata('3DMaxEz.mat '); % 3D Data

64 sigr3D = importdata('3Dsigr.mat '); % 3D Data Range

65 else

66 LimitE = ...

(1/4*pi)*((me*c*c)/e)*( particleN/plasmaDen)*kp^4* sigmaz*sigmar ^2*exp(-0.5*kp^2* sigmaz ^2);

67 UnNormTheoryEz = importdata('UnNormTheoryEz.mat '); % W. Lu theory ...

(UnNormalised)

68 UnNormfittedMathematica = importdata('UnNormfittedMathematica.mat ');

69 mathematicaR = 1: length(UnNormTheoryEz);% Theory shifted using LSQ

70 mathematicaRUnits = mathematicaR. *( lambdap /300);

71 end

72

73

74 % Fit sine curves to the longitudinal electric field vs. x at the 11th

75 % timestep (11th timestep being taken as the time at which the beam is

76 % fully immersed in the plasma).

77

78 % Note that if you wish to re-run this script , you may want to comment this

79 % part out and import the results generated in the previous run (see below).

80

81 for j = 1:simN;

82

83 if (Normalised == 'Y')

Page 57: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 47

84 dir = ...

strcat (['/unix/pdpwa/slucas/RadiusResGauss/RadiusScanResUp/RadiusScan/RadiusTest ' ...

int2str(j) '/']);

85 end

86

87 if (Normalised == 'N')

88 %dir = strcat (['/unix/pdpwa/slucas/RadiusUnNorm20/RadiusScan/RadiusTest ' ...

int2str(j) '/']);

89 dir = strcat (['/unix/pdpwa/slucas/RadiusUnNormRun2/RadiusScan/RadiusTest ' ...

int2str(j) '/']);

90 end

91

92

93 timestep='0011'; %%look at last time step since stuff has had time to happen.

94

95 path = [dir , timestep , '.sdf']; %%create an array telling you what you 're ...

looking at.

96

97 Answer = GetDataSDF(path);

98 data1 = Answer.Electric_Field.Ex.data; %Electric Field Data.

99 data2 = Answer.Grid.Grid.y; % y position data (-0.00011 to 0.00011).

100 data3 = Answer.Grid.Grid.x; % x position data (0 to 0.00022).

101 maxEx(j) = max(max(data1)); % Use this to gage accuracy of fitting.

102 Auto_Sine_Fit2(data1 , data2 , data3 , j);

103

104

105

106 end

107 sigr = 1:simN;

108

109 %figure (1);

110 %plot(sigr , maxEx);

111

112

113 % Get rid of anomalous values before plotting.

114

115 anomalyAmp1 = find(Amplitude == 0);

116 sigr(anomalyAmp1) = [];

117 maxEx(anomalyAmp1) = [];

118 Amplitude(anomalyAmp1) = [];

119 error(anomalyAmp1) = [];

120

121 anomalyAmp2 = find(error > 0.5*Amplitude);

122 sigr(anomalyAmp2) = [];

123 maxEx(anomalyAmp2) = [];

124 Amplitude(anomalyAmp2) = [];

125 error(anomalyAmp2) =[];

126

127 % Convert units to metres

128

129 sigrUnits = sigr.*( lambdap /300);

130 % sigr3DUnits = sigr3D. *( lambdap /300);

131 % save('MATLABsigr.mat ', 'sigr '); % Use this in mathematica to compare theory ...

and sim.

132

Page 58: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 48

133 % Use data to inform Mathematica 's 'FindFit ' function (least squares fit).

134

135 if (Normalised == 'Y');

136 save('MATLABAmp.mat ', 'Amplitude ', 'error ');

137 else

138 save('UnNormMATLABAmp.mat ', 'Amplitude ', 'error ');

139 end

140

141 % If no least squares fit has been performed in Mathematica , comment out

142 % all of the below and update LeastSquaresFit.nb accordingly. If you do not

143 % wish to consider Mathematica 's least squares fit , comment out figure 3

144 % (below).

145

146 % Avoid fitting twice - also salvage data if accidentally delete!

147 % sigr = importdata('sigr.mat ')

148 % sigrUnits = sigr. *( lambdap /300);

149 % if (Normalised == 'Y');

150 % AmpData = importdata('MATLABAmp.mat ');

151 % Amplitude = AmpData.Amplitude;

152 % end

153 %

154 % if (Normalised == 'N');

155 % AmpData = importdata('UnNormMATLABAmp.mat ');

156 % Amplitude = AmpData.Amplitude;

157 % error = AmpData.Amplitude;

158 % end

159

160 % Look at the difference between the fitted amplitude and the raw maximum

161 % electric field returned by EPOCH. Gives a rough estimate of the

162 % sine -fitting 's accuracy.

163

164 figure (10);

165 fitDifference = maxEx - Amplitude;

166 mean(fitDifference)

167 RelfitDifference = fitDifference ./ maxEx;

168 mean(RelfitDifference)

169 plot(sigrUnits , RelfitDifference);

170 xlabel('Rms Beam Width , \sigma_r [m]');

171 ylabel('Relative Difference Between Fit and Amplitude [V/m]');

172 figsave (10, 'fitDifference.pdf ', 'screen ','enhance ');

173

174 % Plot the fitted amplitude and theoretical amplitude (W.Lu) vs. beam

175 % radius.

176

177 figure (1);

178 p0 = errorbar(sigrUnits , Amplitude , error);

179 hold on

180

181 if (Normalised == 'Y')

182 p1 = plot(mathematicaRUnits , mathematicaTheoryEz);

183 hold on

184 p3D = plot(sigr3DUnits , data3D)

185 title('E_z Amplitude vs. RMS Beam Width ');

186 else

187 p1 = plot(mathematicaRUnits , UnNormTheoryEz);

Page 59: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 49

188 title('E_z Amplitude vs. RMS Beam Width (Variable Charge)');

189 end

190

191 set(p1 , 'color ', 'r')

192 %set(p3D , 'color ', [0.75 , 0.25 , 0.75])

193 xlim([ sigrUnits (1)-sigrUnits (1) sigrUnits(end)+sigrUnits (1)])

194 xlabel('Rms Beam Width , \sigma_r [m]');

195 ylabel('Maximum Electric Field [V/m]');

196 legend('EPOCH 2D', 'W.Lu et al.', 'EPOCH 3D', 'location ', 'best')

197 filename1 = 'RadiusScan150 ';

198 save(filename1 , 'sigr', 'Amplitude ', 'error ')

199

200 if (Normalised == 'Y')

201 figsave(1, 'AmpSim1Norm.pdf ', 'screen ','enhance ');

202 else

203 figsave(1, 'AmpSim1UnNorm.pdf ', 'screen ', 'enhance ');

204 end

205

206 hold off

207

208 % For the normalised case , plot the natural log of the Amplitude against

209 % beam radius for easier comparison.

210

211 if (Normalised == 'Y')

212 figure (2);

213

214 logAmp = log(Amplitude);

215 errorlogAmp = error ./ Amplitude;

216 errorbar(sigrUnits , logAmp , errorlogAmp);

217 xlim([ sigrUnits (1)-sigrUnits (1) sigrUnits(end)+sigrUnits (1)])

218 hold on

219

220 p2 = plot(mathematicaRUnits , mathematicaLogEz);

221 set(p2 , 'color ', 'r');

222 xlabel('Rms Beam Width , \sigma_r [m]');

223 ylabel('Log(Amplitude) [V/m]');

224 title('Log(Amplitude) vs. RMS Beam Width ');

225

226 %set(gca , 'XTick ', [0:25:150]);

227 %p3D2 = plot(sigr3DUnits , log(data3D));

228 %set(p3D2 , 'color ', [0.75 , 0.25 , 0.75]);

229 legend('EPOCH 2D', 'W.Lu et al.', 'EPOCH 3D','location ', 'best');

230 figsave(2, 'AmpSim1Log.pdf ', 'screen ', 'enhance ');

231 hold off

232 end

233

234 % Look at Mathematica 's attempt to minimise the difference between the

235 % theory and the data via least squares. Uncomment this at will.

236

237 figure (3);

238 p5 = errorbar(sigrUnits , Amplitude , error);

239 set(p5 , 'color ', 'b');

240 hold on

241

242 if (Normalised == 'Y')

Page 60: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 50

243 p6 = plot(mathematicaRUnits , mathematicaTheoryEz);

244 hold on

245 p7 = plot(mathematicaRUnits , mathematicaFitNorm);

246 title('Least Squares Fit to W.Lu et al.');

247 hold off

248 hold off

249 else

250 p6 = plot(mathematicaRUnits , UnNormTheoryEz);

251 hold on

252 p7 = plot(mathematicaRUnits , UnNormfittedMathematica);

253 title('Least Squares Fit to W.Lu et al. (Variable Charge)');

254 hold off

255 hold off

256 end

257

258 set(p6 , 'color ', 'r');

259 set(p7 , 'color ', 'g');

260 xlabel('Rms Beam Width , \sigma_r [m]');

261 ylabel('Electric Field Amplitude [V/m]');

262 title('Least Squares Fit to W.Lu et al.');

263 legend('EPOCH ', 'W.Lu et al.','LSQ Fit', 'location ', 'best');

264 xlim([ sigrUnits (1)-sigrUnits (1) sigrUnits(end)+sigrUnits (1)]);

265 ylim ([0 max(Amplitude)]);

266

267 if (Normalised == 'Y')

268 figsave(3, 'AmpFit.pdf ', 'screen ', 'enhance ');

269 else

270 figsave(3, 'AmpUnNormFit.pdf ', 'screen ', 'enhance ');

271 end

272

273 % Import data from the simulations that included temperature and compare

274 % against T = 0 K data.

275

276 if(Normalised == 'Y')

277

278 figure (6)

279

280 p0 = errorbar(sigrUnits , Amplitude , error);

281 hold on

282 p1 = plot(mathematicaRUnits , mathematicaTheoryEz , 'color ', 'red');

283 hold on

284 emitData = importdata('TimeMax25.mat ');

285 beamR = emitData.beamR;

286 tAverageE = emitData.tAverageE;

287 tAverageEerror = emitData.tAverageEerror;

288 beamRUnits = beamR. *( lambdap /300);

289 pEmit = errorbar(beamRUnits , tAverageE , tAverageEerror , 'color ', 'black ');

290 xlabel('Rms Beam Width , \sigma_r [m]');

291 xlim([ beamRUnits (1)-beamRUnits (1) beamRUnits(end)+beamRUnits (1)])

292 ylabel('Maximum Electric Field (V/m)');

293 title('Maximum Electric Field vs. RMS Beam Width ');

294 legend('EPOCH (T = 0 K)', 'W.Lu et. al (T = 0 K)', 'Emittance = 1 mm mrad')

295 figsave(6, 'TempCompare.pdf ', 'screen ', 'enhance ');

296 hold off

297 hold off

Page 61: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 51

298

299 % Same as above but log(Amplitude).

300

301 figure (7)

302

303 errorbar(sigrUnits , logAmp , errorlogAmp);

304 hold on

305 p2 = plot(mathematicaRUnits , mathematicaLogEz , 'color ', 'red');

306 hold on

307 logEmit = log(tAverageE);

308 logerrorEmit = tAverageEerror ./ tAverageE;

309 plog = errorbar(beamRUnits , logEmit , logerrorEmit , 'color ', 'black ');

310 legend('EPOCH (T = 0 K)', 'W.Lu et. al (T = 0 K)', 'Emittance = 1 mm mrad');

311 xlabel('Rms Beam Width , \sigma_r [m]');

312 xlim([ beamRUnits (1) beamRUnits(end)])

313 ylabel('Log(Amplitude) [V/m]');

314 title('Log(Amplitude) vs. RMS Beam Width ')

315 figsave(7, 'TempCompare.pdf ', 'screen ', 'enhance ');

316 hold off

317 hold off

318

319 end

320

321 % Look at the absolute difference & relative difference.

322

323 figure (4);

324

325 if (Normalised == 'Y')

326 mathematicaTheoryEz(anomalyAmp1) =[];

327 mathematicaTheoryEz(anomalyAmp2) =[];

328 MathematicaEz = transpose(mathematicaTheoryEz);

329 difference = abs(MathematicaEz - Amplitude);

330 relDifference = abs(( MathematicaEz - Amplitude) ./ (MathematicaEz));

331 else

332 UnNormTheoryEz(anomalyAmp1) =[];

333 UnNormTheoryEz(anomalyAmp2) =[];

334 UnNormEz = transpose(UnNormTheoryEz);

335 difference = abs(UnNormEz - Amplitude);

336 relDifference = abs(( UnNormEz - Amplitude) ./ (UnNormEz));

337 end

338

339 p4 = plot(sigrUnits , difference);

340 set(p4 , 'color ', 'g');

341 xlim([ sigrUnits (1)-sigrUnits (1) sigrUnits(end)+sigrUnits (1)]);

342 xlabel('Rms Beam Width , \sigma_r [m]');

343 ylabel('Absolute Difference [V/m]');

344

345 % Attempt Pearson 's chi -squared test to test goodness of fit of theory to

346 % sim results. Print to screen to check results.

347

348 if (Normalised == 'Y')

349 title('Absolute Difference Between EPOCH and W.Lu et al.');

350 figsave(4, 'AmpNormDifference.pdf ', 'screen ', 'enhance ');

351 chiSquared = sum((( Amplitude - MathematicaEz).^2) ./ (( error).^2))

352 dof = length(Amplitude) - 4

Page 62: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 52

353 pval = 1 - chi2cdf(chiSquared , dof)

354 else

355 title('Absolute Difference Between EPOCH and W.Lu et al. (Variable Charge)');

356 figsave(4, 'AmpUnNormDifference.pdf ', 'screen ', 'enhance ');

357 chiSquared = sum((( Amplitude - UnNormEz).^2) ./ ((error).^2))

358 UnNormfittedMathematica(anomalyAmp1) =[];

359 UnNormfittedMathematica(anomalyAmp2) =[];

360 %chiSquaredFit = sum((( UnNormfittedMathematica - UnNormEz).^2) ./ UnNormEz)

361 dof = length(Amplitude) - 4

362 pval = 1 - chi2cdf(chiSquared , dof)

363 %pvalFit = 1 - chi2cdf(chiSquaredFit , dof)

364 end

365

366

367 % Relative difference plot.

368

369 figure (8)

370

371 relDiffp = plot(sigrUnits , relDifference);

372 xlim([ sigrUnits (1)-sigrUnits (1) sigrUnits(end)+sigrUnits (1)]);

373 xlabel('Rms Beam Width , \sigma_r [m]');

374 ylabel('Relative Difference: Abs(( Theory - Sim) / Theory)');

375

376 if(Normalised == 'Y')

377 title('Relative Difference Between EPOCH and W.Lu et al.')

378 figsave(8, 'RelativeDiffNorm.pdf ', 'screen ', 'enhance ');

379 else

380 title('Relative Difference Between EPOCH and W.Lu et al. (Variable ...

Charge)');

381 figsave(8, 'RelativeDiffUnNorm.pdf ', 'screen ', 'enhance ');

382 end

383

384

385 % Fit polynomial to truncated absolute difference - may wish to comment

386 % out.

387

388 if (Normalised == 'N')

389 figure (5);

390 startSigr = find(difference == max(difference));

391 sigr(sigr < startSigr) = []; % works

392 %sigrUnits = sigr.*( lambdap /300)

393 difference (1: startSigr -1) = [];

394 error (1: startSigr -1) = [];

395 errorbar(sigr , difference , error , '.k');

396 hold on

397 xlabel('Beam Radius , \sigma_r [300/\ lambda_p]');

398 ylabel('Absolute Difference [V/m]');

399 title('Fit to Absolute Difference Between W.Lu et al. and EPOCH');

400 xlim([startSigr -1 sigr(end)+1]);

401 p = polyfit(sigr , difference ,2);

402 f = polyval(p, [sigr]);

403 plot(sigr , f);

404 n1 = num2str(p(1) ,4);

405 n0 = num2str(p(2) ,4);

406 n2 = num2str(p(3), 4);

Page 63: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 53

407 lineEquation = strcat('Fit = ', n2, '\sigma_r ^2 + ', n1 ,' \sigma_r + ', n0);

408 legend('Absolute Difference ', lineEquation , 'location ', 'best');

409 legend boxoff

410 hold off

411 figsave(5, 'LinearFit.pdf ', 'screen ', 'enhance ');

412 end

‘TimeAverageEmit.m’

This is essentially the same as ‘AutoCropResUpExtended.m’ except that time is looped over

as well as σr. ‘DidItRun.sh’ and ‘success.sh’ are called on to inform ‘Auto Sine Fit2.m’

which simulations to look at. For the emittance simulations it proved difficult to acquire

the same number of time steps for each σr and obtaining data for smaller increments of σr

would have been an ineffective use of time. The inclusion of ‘DidItRun.sh’ and ‘success.sh’

therefore averts the laborious task of checking whether each individual simulation returned

the desired amount of data.

1

2 % Begin by looking at 'results.txt ' to see which simulations have run to

3 % completion

4 global Amplitude;

5 global error;

6 global LimitE;

7

8

9 startdir = '/unix/pdpwa/slucas/EmitScanScaled/results.txt '; %Look to see if ...

simulations ran

10 results1 = importdata(startdir , ' '); %Import the 1s and 0s from 'DidItRun.sh '

11 vals1 = results1.data; %Get the 1s and 0s

12 completed = find(vals1 == 1); %Find indices that correspond to '1'

13 completedRange = length(completed);

14

15 me = 9.11e -31;

16 c = 3e8;

17 e = 1.6e -19;

18 perm = 8.85e -12;

19

20 particleN = input('Enter the number of particles in the beam: ');

21 plasmaDen = input('Enter the plasma density: ');

22 simN = input('Enter the last simulation number: ');

23 omegap = (( plasmaDen*e*e)/(me*perm))^0.5;

24 kp = omegap/c;

25 sigmaz = sqrt (2)/kp;

26 lambdap = 2*pi / kp;

27 sigmar = (lambdap /300)*simN;

28 LimitE = ...

(1/4*pi)*((me*c*c)/e)*( particleN/plasmaDen)*kp^4* exp(-0.5*kp^2* sigmaz ^2)*exp(0.5*kp^2* sigmar ^2);

29

30 for i = 1: length(completed);

Page 64: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 54

31 k = completed(i);

32

33 Beam = k %Show what sim you 're on

34

35

36 tic %Start timing

37

38

39 % Import the success.txt files to avoid missing timesteps

40

41 dir = strcat (['/unix/pdpwa/slucas/EmitScanScaled/RadiusTest ' int2str(k) ...

'/RadiusVacuumTest/']);

42

43 % Note: You need to run success.sh first before running this script

44

45 timedir = strcat (['/unix/pdpwa/slucas/EmitScanScaled/RadiusTest ' ...

int2str(k) '/RadiusVacuumTest/success.txt ']);

46 results2 = importdata(timedir , ' ');

47 vals2 = results2.data;

48 goodtime = find(vals2 == 1);

49

50

51 for j=1:( length(goodtime) -1) % -1 because success.txt start froms the ...

zeroth timestep

52 if goodtime(j) > 9; % Only consider 0009 .sdf and upwards to allow ...

beam to fully enter plasma

53 m = goodtime(j);

54

55 if m > 9 && m < 100;

56 timestep= strcat (['00' int2str(m)]);

57 end

58

59 if m ≥ 100

60 timestep= strcat (['0' int2str(m)]);

61 end

62

63

64 path = [dir , timestep , '.sdf'];

65

66

67 Answer = GetDataSDF(path);

68 data1 = Answer.Electric_Field.Ex.data; % Electric Field Data

69 data2 = Answer.Grid.Grid.y; % y position data (-0.00011 to ...

0.00011)

70 data3 = Answer.Grid.Grid.x; % x position data (0 to 0.00022)

71

72

73 Sim = k

74 Timestep = m

75

76 Auto_Sine_Fit2(data1 , data2 , data3 , m);

77

78 end

79

80 end

Page 65: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 55

81

82

83 Loaded = (k/(120))

84

85

86 % Plot Electric Field against time - check the trend

87

88 %figure (5);

89 %timeStep = m;

90 %plot(timeStep , Amplitude);

91 %xlim ([9 100])

92 %title(['Examp vs sigma_r ', timestep ]);

93 %ylabel('Electric Field (V/m) ');

94 %xlabel('Time (330 fs per time step ');

95

96 % Time -average amplitude

97 tAverageE(k) = mean(Amplitude);

98 tAverageEerror(k) = sqrt(sum(error. ^2))./ length(completed); % Standard ...

error propagation

99

100

101

102 end

103

104

105

106 % Get rid of anomalous values before plotting

107

108 anomalyE= find(tAverageE == 0);

109 %Need to get rid of the beam radii and errors associated with these

110 %so we can plot sigr against tAverageE (arrays of same length)

111

112 beamR = transpose(completed);

113

114 % beamR(anomalyE) = [];

115 tAverageE(anomalyE) = [];

116 tAverageEerror(anomalyE) = [];

117

118 % tAverageE = tAverageE(¬isnan(tAverageE));119 % tAverageEerror(tAverageEerror == 0) =[];

120

121 % Plot time -averaged electric field vs. beam radius

122 filename1 = 'TimeMax25.mat ';

123 save(filename1 ,'beamR ', 'tAverageE ', 'tAverageEerror ')

124 beamRunits = beamR. *( lambdap /300);

125 figure (6)

126 errorbar(beamRUnits , tAverageE , tAverageEerror ,'color ', 'black ');

127 xlim([ beamRunits (1)-beamRunits (1) beamRunits(end)+beamRunits (1)])

128 xlabel('RMS Beam Width , \sigma_r [m]');

129 ylabel('Time Averaged Electric Field [V/m]');

130 title('Time Averaged Electric Field vs. Beam Radius (\ epsilon = 1 mm mrad)');

131 figsave(6, 'TimeAv25.pdf ', 'screen ', 'enhance ');

‘DidItRun.sh’

Page 66: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 56

The following script (courtesy of James Holloway) is used in ‘TimeAverageEmit.m’ to inform

the ‘Auto Sine Fit2.m’ function which σr values to consider. If the data returned by EPOCH

contains the specified timestep then a 1 is placed next to its folder name in the ‘results.txt’

output file and the simulation is deemed successful.

1 #!/bin/bash

2 # Script for checking if 0001. sdf has appeared

3 rm results.txt

4 for i in {1..120}

5 do

6 concat="RadiusTest$i"/RadiusVacuumTest/

7 cd $concat

8 if [ -e 0100. sdf ]

9 then

10 # echo win

11 cd ..

12 cd ..

13 echo "RadiusTest$i 1" >> results.txt

14 else

15 # echo fail

16 cd ..

17 cd ..

18 echo "RadiusTest$i 0" >> results.txt

19 fi

20 done

‘success.sh’

This is essentially a modified version of ‘DidItRun.sh’ which looks at whether successive time

steps were successful.

1 #!/bin/bash

2

3 # Script for checking that all timesteps have run

4

5 for (( j=1; j≤120; j++))

6 do

7 concat="RadiusTest$j"

Page 67: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 57

8 cd $concat/RadiusVacuumTest/

9 rm success.txt

10

11 for i in {0..9}

12 do

13 if [ -e 000$i.sdf ]

14 then

15

16 # echo win

17 echo "Timestep$i 1" >> success.txt

18

19 else

20 # echo fail

21 echo "Timestep$i 0" >> success.txt

22

23 fi

24 done

25

26 for i in {10..25}

27 do

28 if [ -e 00$i.sdf ]

29 then

30 # echo win

31 echo "Timestep$i 1" >> success.txt

32

33 else

34 # echo fail

35 echo "Timestep$i 0" >> success.txt

36

37 fi

38 done

39 cd ..

40 cd ..

41 done

‘LeastSquares.nb’

The following script was written in mathemtica to generate the theoretical predictions for

Ez0 and to generate the constants C1, C2 and C3 discussed in chapter 3. This was necessary

Page 68: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 58

due to the unusual nature of MATLAB’s incomplete gamma function.

1 (∗Below in SI units∗)

2 me = 9.11∗10ˆ−31; (∗electron mass∗)

3 np = 1.118∗10ˆ23; (∗plasma electron density∗)

4 Ne = 10ˆ6; (∗no. of electrons in beam∗)

5 c = 3∗10ˆ8; (∗speed of light ∗)

6 e = 1.6∗10ˆ−19; (∗electronic charge∗)

7 perm = 8.85∗10ˆ−12; (∗permitivity of free space∗)

8 \[Omega]p = ((np∗e∗e) / (me∗perm))ˆ0.5; (∗plasma frequency∗)

9 kp = \[Omega]p / c;

10 \[Lambda]p = (2∗Pi∗c) / \[Omega]p;

11 \[Sigma]z = Sqrt[2] / kp; (∗beam length∗)

12 nbUnNorm = 10ˆ20; (∗variable beam density∗)

13 TheoryEz0 = (1 / 4∗Pi)∗((me∗c∗c) / e)∗(Ne / np)∗kpˆ4∗

14 Exp[−0.5∗kpˆ2∗\[Sigma]zˆ2]∗Exp[0.5∗kpˆ2∗\[Sigma]rˆ2]∗

15 Gamma[0, 0.5∗kpˆ2∗\[Sigma]rˆ2]

16 plotTheory = Plot[TheoryEz0, {\[Sigma]r, 3∗10ˆ−7, 1.5∗10ˆ−4}];17

18 TheoryEz0UnNorm =

19 0.5∗Sqrt[2∗Pi ]∗((me∗c∗c)/e)∗(nbUnNorm/np)∗

20 kpˆ4∗\[Sigma]z∗\[Sigma]rˆ2∗Exp[−0.5∗kpˆ2∗\[Sigma]zˆ2]∗

21 Exp[0.5∗kpˆ2∗\[Sigma]rˆ2]∗Gamma[0, 0.5∗kpˆ2∗\[Sigma]rˆ2];

22 plotTheoryUnNorm =

23 Plot [TheoryEz0UnNorm, {\[Sigma]r, 3∗10ˆ−7, 1.5∗10ˆ−5}];24 AmpFit = Import[”MATLABAmp.mat”];

25 UnNormAmpFit = Import[”UnNormMATLABAmp.mat”];

26

27 AmpFitEdit = {1.8156137781169075`∗ˆ8, 8.9504112148482`∗ˆ7,

28 5.888292363249442`∗ˆ7, 4.377021679329005`∗ˆ7,

29 3.456672809808327`∗ˆ7, 2.8450927639931723`∗ˆ7,

30 2.412019519934397`∗ˆ7, 2.0612633436369695`∗ˆ7,

31 1.8324182426422212`∗ˆ7, 1.6398277248054251`∗ˆ7,

32 1.4688917225785293`∗ˆ7, 1.332621701759511`∗ˆ7,

33 1.2192152991556201`∗ˆ7, 1.118904916705834`∗ˆ7,

34 1.0302437325524375`∗ˆ7, 9.588996696140077`∗ˆ6,

35 8.896155904390484`∗ˆ6, 8.318451152846534`∗ˆ6,

36 7.821844060100991`∗ˆ6, 7.37312557290805`∗ˆ6, 6.925565697328872`∗ˆ6,

37 6.524721097095661`∗ˆ6, 6.184125195525191`∗ˆ6,

38 5.8626693237522775`∗ˆ6, 5.559500601484605`∗ˆ6,

39 5.296993864401216`∗ˆ6, 5.074764124041888`∗ˆ6,

40 4.857979779379857`∗ˆ6, 4.630011901391709`∗ˆ6,

41 4.423537664476567`∗ˆ6, 4.233604509939859`∗ˆ6,

42 4.0813873088342627`∗ˆ6, 3.9116923775763074`∗ˆ6,

43 2.28538602906766`∗ˆ6, 2.210524306698686`∗ˆ6,

44 2.1657499073009673`∗ˆ6, 2.0982521020655544`∗ˆ6,

45 2.033391663016603`∗ˆ6, 1.9928435407739067`∗ˆ6,

Page 69: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 59

46 1.9259947685727654`∗ˆ6, 1.8662293340256473`∗ˆ6,

47 1.8228804256083297`∗ˆ6, 1.7887929049550053`∗ˆ6,

48 1.7362340257258536`∗ˆ6, 1.6948998461529303`∗ˆ6,

49 1.6608336845138057`∗ˆ6, 1.6147821585664945`∗ˆ6,

50 1.5843486488579393`∗ˆ6, 1.5338265395236888`∗ˆ6,

51 1.5003452402131977`∗ˆ6, 1.4662352087020928`∗ˆ6,

52 1.4302464979662905`∗ˆ6, 1.4064216407164342`∗ˆ6,

53 1.3630271616370778`∗ˆ6, 1.3442293056156202`∗ˆ6,

54 1.315342979567869`∗ˆ6, 1.2793997144133742`∗ˆ6,

55 1.263164273844494`∗ˆ6, 1.2368648460162957`∗ˆ6,

56 1.190967604603275`∗ˆ6, 1.1852338202289212`∗ˆ6,

57 1.1613100549634863`∗ˆ6, 1.1385861293415108`∗ˆ6,

58 1.1161307580743046`∗ˆ6, 1.0897827735966037`∗ˆ6,

59 1.064106874924646`∗ˆ6, 1.0437391520165601`∗ˆ6,

60 1.0228224454519151`∗ˆ6, 1.0035105482187449`∗ˆ6, 981797.0006425156`,

61 963657.7093296688`, 952518.3741134584`, 935166.3307200548`,

62 913937.2272488904`, 897652.8125570209`, 881790.5682281085`,

63 871559.1556374752`, 856337.7647622894`, 836180.5842088738`,

64 821890.4653799346`, 807954.7751268395`, 796469.5846710636`,

65 783117.8286604802`, 767744.4015164252`, 755137.1285253982`,

66 742829.5413609294`, 736481.9506737404`, 724604.6105383423`,

67 713004.8630177882`, 701437.6714018947`, 690433.0802177244`,

68 679677.96217231`, 662498.1261525202`, 652269.2334761595`,

69 642268.4807094975`, 633222.3463960708`, 623691.6884755557`,

70 614367.7488379009`, 605244.6513965697`, 600884.7750242427`,

71 592042.3744066119`, 583387.596255828`, 574915.2215011027`,

72 561417.0288587873`, 553425.4057117793`, 545597.5381090422`,

73 537929.057839243`, 533489.5620018346`, 526059.5279944928`,

74 518778.4546427205`, 511642.433568108`, 498673.6859657401`,

75 491930.79039987625`, 485319.0486796447`, 478835.13208717614`,

76 475995.8734037061`, 469692.0772002755`, 463508.40403915936`,

77 457441.8840858042`, 451489.6432238838`, 443195.1379042129`,

78 437511.3941495959`, 431932.6648944555`, 426456.43826998014`,

79 421080.2760938019`, 415801.812008571`, 413926.4886666328`,

80 408782.9042734909`, 403731.4537169299`, 398769.98068505205`,

81 393896.41815070686`, 387024.368975636`, 382382.4725075649`,

82 377820.7094327196`, 373337.25408411294`, 371684.38954904047`,

83 367265.12518427236`, 362921.9835697994`, 358653.2639046351`,

84 354457.3093194327`, 350332.5110297636`, 346277.30079945154`,

85 342290.1558735648`, 338369.5913762784`, 334514.1655689131`,

86 330722.4742350971`, 326993.1489069996`, 323324.85974986496`,

87 319716.3101622062`, 316166.234330079`, 312673.4058955813`,

88 309236.6258836985`, 305854.72713728045`, 302526.5721127206`,

89 299251.05274345627`, 296027.08842877205`, 292853.6257452705`,

90 289729.6384183282`, 286654.12495559227`, 283626.11523354525`,

91 280644.64419540175`, 277708.78925198544`, 274817.64482924563`,

92 271970.3280188538`, 269165.9759566126`, 266403.7457619236`,

93 263682.81689360604`, 261002.38610907417`, 258361.670202591`,

Page 70: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 60

94 255759.90589740092`, 253196.3463556322`, 250670.2630644909`,

95 248180.94383239417`, 245727.69387603662`, 243309.83376719154`,

96 240926.70018145174`, 238577.64482510494`, 236262.03438189873`,

97 233979.2490733618`, 231728.683741466`, 229509.7499811085`,

98 227321.8662467933`, 225164.46854168107`, 223037.00434330985`,

99 220938.93328948808`, 218869.72708270955`, 216828.86893885373`,

100 214815.85343450026`, 212830.18617790405`, 210871.38341444312`,

101 208938.9720361694`, 207032.4883193772`, 205151.48184365145`,

102 203295.50630852793`, 201464.1288117391`, 199656.9247052742`,

103 197873.47826849407`, 196113.3823875072`, 194376.2387990612`,

104 192661.65730524264`, 190969.25573197953`, 189298.65971464777`,

105 187649.50449190778`, 186021.4301284131`, 184414.08470197764`,

106 182827.12426376747`, 181260.21150515243`, 179713.0162556178`,

107 178185.2144397212`, 176676.48894555488`, 175186.52872297307`,

108 173715.0291035587`, 172261.69175157236`, 170826.22332708977`,

109 169408.3373235623`, 168007.75240144823`, 166624.19265152985`,

110 165257.38781504426`, 163907.07275776064`, 162572.98741541724`,

111 161254.876812606`, 159952.49093338466`, 158665.58452476`,

112 157393.9170669052`, 156137.25252401122`, 154895.3593742142`,

113 153668.01057670556`, 152454.98325817115`, 151256.05881663848`,

114 150071.02265510938`, 148899.6641751599`, 147741.77694317224`,

115 146597.15799274642`, 145465.60832632473`, 144346.93253286378`,

116 143240.93891322287`, 142147.43907508915`, 141066.24820137562`,

117 139997.18472356233`, 138940.07260684785`, 137894.73299071568`,

118 136860.99541329942`, 135838.69141381994`, 134827.65529193231`,

119 133827.72425717153`, 132838.73840166227`, 131860.54064502244`,

120 130892.97663655548`, 129935.89479754308`, 128989.14621961422`,

121 128052.58454355`, 127126.06594979567`, 126209.44916430472`,

122 125302.59535045367`, 124405.36806408636`, 123517.63310740332`,

123 122639.25874196397`, 121770.1153962978`, 120910.07569561113`,

124 120059.0144484773`, 119216.80849680243`, 118383.33644898277`,

125 117558.48106543641`, 116742.123574924`, 115934.14941156769`,

126 115134.44560543103`, 114342.90088125748`, 113559.4058887508`,

127 112783.85306187169`, 112016.1365677404`, 111256.15236774107`,

128 110503.79806166502`, 109758.97241798544`, 109021.57811287716`,

129 108291.51590749143`, 107568.69052138153`, 106853.00760711484`,

130 106144.3743745874`, 105442.69946411086`, 104747.8929930046`,

131 104059.86655561064`, 103378.53308206296`, 102703.80692106186`,

132 102035.60374506564`, 101373.84052153902`, 100718.43576616382`,

133 100069.30885317986`, 99426.38070872161`, 98789.57345106274`,

134 98158.81030190767`, 97534.01576881544`, 96915.115470274`,

135 96302.03621510962`, 95694.7058803117`, 95093.05349430552`,

136 94497.00912452422`, 93906.50394245253`, 93321.47009314275`,

137 92741.84085260134`, 92167.5503963573`, 91598.53397980379`,

138 91034.72773535489`, 90476.06883091199`, 89922.49531723639`,

139 89373.94621592935`, 88830.36140484545`, 88291.68167436012`,

140 87757.84865260524`, 87228.80489790901`, 86704.49374064161`,

141 86184.85935631317`, 85669.84675536431`, 85159.40173445722`,

Page 71: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 61

142 84653.47084907981`, 84152.00149123954`, 83654.94173942484`,

143 83162.24048759838`, 82673.84728908789`, 82189.71246633699`,

144 81709.7870561461`, 81234.02274426473`, 80762.3719700765`,

145 80294.78776244093`, 79831.22390709599`, 79371.6347528328`,

146 78915.9753388374`, 78464.20132217584`, 78016.26896540094`,

147 77572.13516121`, 77131.75739930295`, 76695.0937419688`,

148 76262.1028267013`, 75832.74389390796`, 75406.97669795176`,

149 74984.76160766577`, 74566.05945680356`, 74150.83166600736`,

150 73739.04018203885`, 73330.64746403313`, 72925.6163273969`,

151 72523.91038573578`, 72125.49352612984`, 71730.33019539142`,

152 71338.38529284442`, 70949.62417702645`, 70564.01269244858`,

153 70181.51714582837`, 69802.10425675125`, 69425.7411795823`,

154 69052.39556273306`, 68682.03541776011`, 68314.62921171903`,

155 67950.14578397121`, 67588.55443765648`, 67229.82481075663`,

156 66873.92701833659`, 66520.83147960708`, 66170.50903388651`,

157 65822.9309094958`, 65478.068680706194`, 65135.89600726547`,

158 64796.38177283234`, 64459.50032584305`, 64125.22470345042`,

159 63793.527330322555`, 63464.383714636024`, 63137.76697140105`,

160 62813.65144617583`, 62492.01182311159`, 62172.82306922724`,

161 61856.06051808411`, 61541.69975054208`, 61229.716704517785`,

162 60920.08756700683`, 60612.78887081742`, 60307.79739569714`,

163 60005.09024910745`, 59704.6447757692`, 59406.438651013705`,

164 59110.44977563526`, 58816.65633830164`, 58525.036796872766`,

165 58235.56987712295`, 57948.234557754564`, 57663.01007622867`,

166 57379.8759141355`, 57098.811854976295`, 56819.797906701795`,

167 56542.81390342304`, 56267.84015123256`, 55994.85809422909`,

168 55723.848402026924`, 55454.79214337234`, 55187.67066059055`,

169 54922.46552273769`, 54659.15855434587`, 54397.73175518113`,

170 54138.167363988825`, 53880.44780355785`, 53624.55573050446`,

171 53370.473991043014`, 53118.185617951014`, 52867.67386377821`,

172 52618.92216009272`, 52371.91412129689`, 52126.633579615125`,

173 51883.06454931114`, 51641.19118230938`, 51400.9978764126`,

174 51162.46916791214`, 50925.589779478054`, 50690.3446047704`,

175 50456.71872786705`, 50224.6973766643`, 49994.265962252146`,

176 49765.410039377566`, 49538.115353789595`, 49312.36780184496`,

177 49088.15342287092`, 48865.45844759267`, 48644.26920551806`,

178 48424.57222701534`, 48206.35418780316`, 47989.60188218531`,

179 47774.30225376566`, 47560.44244116354`, 47348.009668649414`,

180 47136.99132827136`, 46927.37491810753`, 46719.148124305626`,

181 46512.298725121494`, 46306.81466161059`, 46102.683988143624`,

182 45899.894887818686`, 45881.26295455172`};183 Length[AmpFitEdit];

184 UnNormAmpFitEdit = {711998.1061380543`, 1.4071292084367548`∗ˆ6,

185 2.0911522266092952`∗ˆ6, 2.7500820612974213`∗ˆ6,

186 3.399024993434098`∗ˆ6, 4.047527109251959`∗ˆ6,

187 4.664076660571954`∗ˆ6, 5.262943230704308`∗ˆ6,

188 5.853830230047773`∗ˆ6, 6.448183992474621`∗ˆ6,

189 7.015776624115893`∗ˆ6, 7.566485818875191`∗ˆ6,

Page 72: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 62

190 8.087514414325391`∗ˆ6, 8.635972874178715`∗ˆ6,

191 9.113995731011154`∗ˆ6, 9.668120324853115`∗ˆ6,

192 1.0129586801888464`∗ˆ7, 1.0616300017900664`∗ˆ7,

193 1.1102051784877589`∗ˆ7, 1.1568509612218883`∗ˆ7,

194 1.2078806372710036`∗ˆ7, 1.2447239537032098`∗ˆ7,

195 1.2928067607850827`∗ˆ7, 1.331041779016758`∗ˆ7,

196 1.3764072981898682`∗ˆ7, 1.417168593833856`∗ˆ7,

197 1.4544014804068206`∗ˆ7, 1.495236663703295`∗ˆ7,

198 1.5298726154720174`∗ˆ7, 1.5686552150876233`∗ˆ7,

199 1.5989264901805883`∗ˆ7, 1.6358273720392317`∗ˆ7,

200 1.6713861023438364`∗ˆ7, 2.1312577356161725`∗ˆ7,

201 2.1628208586899873`∗ˆ7, 2.176927230240295`∗ˆ7,

202 2.2105362026663225`∗ˆ7, 2.2244130974685155`∗ˆ7,

203 2.2482324432287317`∗ˆ7, 2.2842279509971157`∗ˆ7,

204 2.300250992229844`∗ˆ7, 2.30581012293065`∗ˆ7, 2.330397979596751`∗ˆ7,

205 2.3603840982780583`∗ˆ7, 2.381254354797361`∗ˆ7,

206 2.4042611091638938`∗ˆ7, 2.4350530403321955`∗ˆ7,

207 2.446149579482638`∗ˆ7, 2.477597387875763`∗ˆ7,

208 2.475421009372233`∗ˆ7, 2.4971307984871462`∗ˆ7,

209 2.5220314135970756`∗ˆ7, 2.5276416046165083`∗ˆ7,

210 2.5624089120359283`∗ˆ7, 2.556865636925587`∗ˆ7,

211 2.5793599995654177`∗ˆ7, 2.5979849611556888`∗ˆ7,

212 2.6133512120865457`∗ˆ7, 2.6523451023305733`∗ˆ7,

213 2.6689698799638666`∗ˆ7, 2.6395266392010283`∗ˆ7,

214 2.6972857568451677`∗ˆ7, 2.71417166533068`∗ˆ7,

215 2.7294726033507608`∗ˆ7, 2.7446978431046065`∗ˆ7,

216 2.7251652828703918`∗ˆ7, 2.7590210078036852`∗ˆ7,

217 2.8222831777994577`∗ˆ7, 2.7767061314569283`∗ˆ7,

218 2.7942064852571625`∗ˆ7, 2.7990754974939775`∗ˆ7,

219 2.80838457330855`∗ˆ7, 2.849218236150063`∗ˆ7, 2.854850251384898`∗ˆ7,

220 2.852607829679507`∗ˆ7, 2.9875287976363257`∗ˆ7,

221 2.8769630264931604`∗ˆ7, 2.8865667004825573`∗ˆ7,

222 2.9017175189393144`∗ˆ7, 2.9112705338350695`∗ˆ7,

223 2.922599443194399`∗ˆ7, 2.934126512535134`∗ˆ7,

224 2.953032463496107`∗ˆ7, 2.954671859118737`∗ˆ7,

225 3.0472158319438115`∗ˆ7, 3.0647258814077184`∗ˆ7,

226 3.0758162688981634`∗ˆ7, 2.926241505890868`∗ˆ7,

227 2.951332599472822`∗ˆ7, 2.9412955865309346`∗ˆ7,

228 3.04723425361455`∗ˆ7, 3.0568438587169565`∗ˆ7,

229 3.0667047625926442`∗ˆ7, 3.04566804619204`∗ˆ7,

230 3.0536459698646568`∗ˆ7, 3.062364602464043`∗ˆ7,

231 3.0745505431047957`∗ˆ7, 3.0828048611281615`∗ˆ7,

232 3.0912857551055737`∗ˆ7, 3.099108898073854`∗ˆ7,

233 3.131586690134135`∗ˆ7, 3.1531061878781877`∗ˆ7,

234 3.1580262970169187`∗ˆ7, 3.1654090810572788`∗ˆ7,

235 3.1339475635194466`∗ˆ7, 3.140314755648671`∗ˆ7,

236 3.1477280325032417`∗ˆ7, 3.1526361729903277`∗ˆ7,

237 3.082084996016761`∗ˆ7, 3.099881746112812`∗ˆ7,

Page 73: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 63

238 3.1075358794234175`∗ˆ7, 3.112444642401246`∗ˆ7,

239 3.1696274477657285`∗ˆ7, 3.1115633087910797`∗ˆ7,

240 3.1509973870008916`∗ˆ7, 3.189032074907934`∗ˆ7,

241 3.217303763569336`∗ˆ7, 3.2239648327387027`∗ˆ7,

242 3.2299939458686482`∗ˆ7, 3.2368196422843646`∗ˆ7,

243 3.2438585001998186`∗ˆ7, 3.2219190314536694`∗ˆ7,

244 3.235407439857956`∗ˆ7, 3.2415527963219833`∗ˆ7,

245 3.2468431146682046`∗ˆ7, 3.252007035136091`∗ˆ7,

246 3.2575475713635623`∗ˆ7, 3.2530078284389`∗ˆ7, 3.294062115957755`∗ˆ7,

247 3.2591389051060934`∗ˆ7, 3.262258255765568`∗ˆ7,

248 3.3127309569958273`∗ˆ7, 3.2956140395840764`∗ˆ7,

249 3.3002655397389293`∗ˆ7, 3.3052239401477385`∗ˆ7,

250 3.310008816143646`∗ˆ7, 3.3396809899066333`∗ˆ7,

251 3.343833388371186`∗ˆ7, 3.347913549571325`∗ˆ7,

252 3.351926235233375`∗ˆ7, 3.3547799058964424`∗ˆ7,

253 3.3567127977058716`∗ˆ7, 3.363509895194042`∗ˆ7,

254 3.3681382953184396`∗ˆ7, 3.37104114296758`∗ˆ7,

255 3.373879703250956`∗ˆ7, 3.3782703307228744`∗ˆ7,

256 3.383659224131315`∗ˆ7, 3.385253130203139`∗ˆ7, 3.38869573281133`∗ˆ7,

257 3.392060795375993`∗ˆ7, 3.395662549579678`∗ˆ7,

258 3.399388452652673`∗ˆ7, 3.401835450760964`∗ˆ7,

259 3.364601865324506`∗ˆ7, 3.40946531647347`∗ˆ7, 3.410800940180676`∗ˆ7,

260 3.41443412985624`∗ˆ7, 3.416811640984181`∗ˆ7,

261 3.419218142710519`∗ˆ7, 3.423129764584466`∗ˆ7,

262 3.4254797899163485`∗ˆ7, 3.428817361621103`∗ˆ7,

263 3.431934637848346`∗ˆ7, 3.43445697476821`∗ˆ7,

264 3.4373640586884305`∗ˆ7, 3.4399029742325366`∗ˆ7,

265 3.442094556275156`∗ˆ7, 3.44574241891075`∗ˆ7, 3.448233844001635`∗ˆ7,

266 3.449718931317393`∗ˆ7, 3.452775763160919`∗ˆ7,

267 3.454696842500431`∗ˆ7, 3.4572123956791446`∗ˆ7,

268 3.456896373719993`∗ˆ7, 3.461682890282972`∗ˆ7,

269 3.464037498174583`∗ˆ7, 3.466324401684643`∗ˆ7,

270 3.4680835573348515`∗ˆ7, 3.470263189321709`∗ˆ7,

271 3.472281146842699`∗ˆ7, 3.474520246945685`∗ˆ7, 3.47701431593816`∗ˆ7,

272 3.479188213864009`∗ˆ7, 3.484513736419865`∗ˆ7,

273 3.482976921389012`∗ˆ7, 3.484346196287004`∗ˆ7,

274 3.4875225143236905`∗ˆ7, 3.489028186355957`∗ˆ7,

275 3.494215659087465`∗ˆ7, 3.4926290477941915`∗ˆ7,

276 3.492006761576806`∗ˆ7, 3.49638189821579`∗ˆ7,

277 3.4973036210953176`∗ˆ7, 3.500044989824262`∗ˆ7,

278 3.501293043413903`∗ˆ7, 3.502893985933771`∗ˆ7,

279 3.504592997240373`∗ˆ7, 3.508570552188338`∗ˆ7,

280 3.509115325603284`∗ˆ7, 3.509537187652295`∗ˆ7,

281 3.526169306421231`∗ˆ7, 3.513944856778998`∗ˆ7,

282 3.5142998775572576`∗ˆ7, 3.517447684088435`∗ˆ7,

283 3.517396855774264`∗ˆ7, 3.524500399383778`∗ˆ7,

284 3.517211657352018`∗ˆ7, 3.523301730701956`∗ˆ7,

285 3.5248560661119476`∗ˆ7, 3.52636035159923`∗ˆ7,

Page 74: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 64

286 3.527054721508985`∗ˆ7, 3.5294859065769754`∗ˆ7,

287 3.531569723100058`∗ˆ7, 3.530217242127248`∗ˆ7,

288 3.533318201638661`∗ˆ7, 3.534707984849963`∗ˆ7,

289 3.534385966352373`∗ˆ7, 3.537400437474928`∗ˆ7,

290 3.5327662918167986`∗ˆ7, 3.539123326914999`∗ˆ7,

291 3.5390700545851916`∗ˆ7, 3.5428302241541564`∗ˆ7,

292 3.544463823261435`∗ˆ7, 3.5458680431561396`∗ˆ7,

293 3.546780081466495`∗ˆ7, 3.545356104323474`∗ˆ7, 3.54257474760113`∗ˆ7,

294 3.547662384231733`∗ˆ7, 3.5495496676334515`∗ˆ7,

295 3.55205637281927`∗ˆ7, 3.55296930659847`∗ˆ7, 3.5540414013394654`∗ˆ7,

296 3.55314079571951`∗ˆ7, 3.5541493063479386`∗ˆ7,

297 3.554590928565438`∗ˆ7, 3.556213107450957`∗ˆ7,

298 3.557363935615716`∗ˆ7, 3.558281331167933`∗ˆ7,

299 3.558890585516415`∗ˆ7, 3.5618294735486686`∗ˆ7,

300 3.5627457993127935`∗ˆ7, 3.562226588683355`∗ˆ7,

301 3.563161253305371`∗ˆ7, 3.5634457000657625`∗ˆ7,

302 3.564510158502439`∗ˆ7, 3.565848437292916`∗ˆ7,

303 3.566714635634089`∗ˆ7, 3.570543224028679`∗ˆ7,

304 3.568322566227615`∗ˆ7, 3.56924692132819`∗ˆ7, 3.573356655219372`∗ˆ7,

305 3.573172728900554`∗ˆ7, 3.572176245779433`∗ˆ7,

306 3.5727679219214946`∗ˆ7, 3.573856170240927`∗ˆ7,

307 3.574216750218845`∗ˆ7, 3.5776213635170735`∗ˆ7,

308 3.5778947374579854`∗ˆ7, 3.5797716685503416`∗ˆ7,

309 3.580563474885994`∗ˆ7, 3.573795469674724`∗ˆ7,

310 3.574692894950148`∗ˆ7, 3.58027497619716`∗ˆ7, 3.580286980820219`∗ˆ7,

311 3.584700619159869`∗ˆ7, 3.585480569418211`∗ˆ7,

312 3.586146263416751`∗ˆ7, 3.5868654910331555`∗ˆ7,

313 3.5873984558600985`∗ˆ7, 3.588089746637212`∗ˆ7,

314 3.589004651517114`∗ˆ7, 3.589050741506243`∗ˆ7,

315 3.590606327839587`∗ˆ7, 3.591120568176104`∗ˆ7,

316 3.5915864655638926`∗ˆ7, 3.589574638802372`∗ˆ7,

317 3.59286085778527`∗ˆ7, 3.593979319235211`∗ˆ7,

318 3.5912060192572586`∗ˆ7, 3.5934974082472935`∗ˆ7,

319 3.596129363380332`∗ˆ7, 3.593418553229814`∗ˆ7,

320 3.5979855859169066`∗ˆ7, 3.595437839950595`∗ˆ7,

321 3.598955937607151`∗ˆ7, 3.596623175932776`∗ˆ7,

322 3.597420195315982`∗ˆ7, 3.597507370002377`∗ˆ7,

323 3.6030354711757034`∗ˆ7, 3.6038536489024445`∗ˆ7,

324 3.604259933537843`∗ˆ7, 3.600375177200503`∗ˆ7,

325 3.600188120925881`∗ˆ7, 3.600385367951858`∗ˆ7,

326 3.607677329266106`∗ˆ7, 3.602201720784025`∗ˆ7,

327 3.5998661147350684`∗ˆ7, 3.6055674717523165`∗ˆ7,

328 3.60378856368085`∗ˆ7, 3.603854750270618`∗ˆ7, 3.604380668322531`∗ˆ7,

329 3.6125868786134034`∗ˆ7, 3.6099193890799046`∗ˆ7,

330 3.604631613349864`∗ˆ7, 3.605116806390164`∗ˆ7,

331 3.6063174151443005`∗ˆ7, 3.615918889100062`∗ˆ7,

332 3.600958153154237`∗ˆ7, 3.617750062574519`∗ˆ7, 3.61573409653971`∗ˆ7,

333 3.618242894352034`∗ˆ7, 3.6190033980079375`∗ˆ7,

Page 75: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 65

334 3.61153838730959`∗ˆ7, 3.657598564083128`∗ˆ7, 3.611232515730977`∗ˆ7,

335 3.680165495890196`∗ˆ7, 3.612468298197922`∗ˆ7,

336 3.613049094430329`∗ˆ7, 3.6970019202786475`∗ˆ7,

337 3.700340978532929`∗ˆ7, 3.697401745357579`∗ˆ7,

338 3.614483770615547`∗ˆ7, 3.7005250452935174`∗ˆ7,

339 3.6270668395930156`∗ˆ7, 3.7054519057355955`∗ˆ7,

340 3.7064629957016245`∗ˆ7, 3.603453074089158`∗ˆ7,

341 3.629850942519427`∗ˆ7, 3.709474025902022`∗ˆ7,

342 3.704989475406276`∗ˆ7, 3.707539207349471`∗ˆ7,

343 3.7118193433423154`∗ˆ7, 3.713428152848448`∗ˆ7, 3.6736087200537`∗ˆ7,

344 3.715383146202129`∗ˆ7, 3.716354984362763`∗ˆ7,

345 3.695129519202226`∗ˆ7, 3.709838119480581`∗ˆ7,

346 3.716912152172828`∗ˆ7, 3.676723767459667`∗ˆ7,

347 3.721154127947514`∗ˆ7, 3.7221025737028144`∗ˆ7,

348 3.7086012506016955`∗ˆ7, 3.610833135222532`∗ˆ7,

349 3.7249231295320675`∗ˆ7, 3.71826715706604`∗ˆ7,

350 3.624121034571484`∗ˆ7, 3.62886216735341`∗ˆ7, 3.728651869274396`∗ˆ7,

351 3.626263776558308`∗ˆ7, 3.623519847783201`∗ˆ7,

352 3.614779444120477`∗ˆ7, 3.728347240919258`∗ˆ7,

353 3.555699713516581`∗ˆ7, 3.734083902315686`∗ˆ7,

354 3.675267941597162`∗ˆ7, 3.644961235178088`∗ˆ7,

355 3.721252072937599`∗ˆ7, 3.646959652808229`∗ˆ7,

356 3.728102716863928`∗ˆ7, 3.73229889847829`∗ˆ7, 3.740245859253084`∗ˆ7,

357 3.6384403694792815`∗ˆ7, 3.6593691814687`∗ˆ7,

358 3.7428315274277404`∗ˆ7, 3.628779604512672`∗ˆ7,

359 3.7445377871311046`∗ˆ7, 3.605872246560239`∗ˆ7,

360 3.733303630819242`∗ˆ7, 3.747068635727646`∗ˆ7,

361 3.6353961699780196`∗ˆ7, 3.652218965356052`∗ˆ7,

362 3.749564833872513`∗ˆ7, 3.650790334377097`∗ˆ7,

363 3.622209950225949`∗ˆ7, 3.6545160348470084`∗ˆ7,

364 3.654810290876345`∗ˆ7, 3.654959086875174`∗ˆ7,

365 3.634169543419516`∗ˆ7, 3.6513345194095366`∗ˆ7,

366 3.6239692286036834`∗ˆ7, 3.7053320721651435`∗ˆ7,

367 3.657790369455916`∗ˆ7, 3.655661509743958`∗ˆ7,

368 3.635610860699956`∗ˆ7, 3.635862784014759`∗ˆ7,

369 3.756068206895886`∗ˆ7, 3.626203049835705`∗ˆ7,

370 3.640866252311009`∗ˆ7, 3.6370290396723524`∗ˆ7,

371 3.748284767544069`∗ˆ7, 3.661043265881692`∗ˆ7,

372 3.765367796130501`∗ˆ7, 3.766136425955495`∗ˆ7,

373 3.663030311967848`∗ˆ7, 3.638392741857269`∗ˆ7,

374 3.652997175050009`∗ˆ7, 3.769103131761779`∗ˆ7,

375 3.768182709926732`∗ˆ7, 3.7705567672563136`∗ˆ7,

376 3.77128336795722`∗ˆ7, 3.664812346097976`∗ˆ7,

377 3.6399929591272205`∗ˆ7, 3.773456302611113`∗ˆ7,

378 3.633012351295576`∗ˆ7, 3.6428139780757815`∗ˆ7,

379 3.6408936000272684`∗ˆ7, 3.654858271235964`∗ˆ7,

380 3.776984975529311`∗ˆ7, 3.63391215472948`∗ˆ7, 3.66573957219634`∗ˆ7,

381 3.779027171258829`∗ˆ7, 3.640472887363617`∗ˆ7,

Page 76: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 66

382 3.642410179989176`∗ˆ7, 3.634203029182987`∗ˆ7,

383 3.666936745322568`∗ˆ7, 3.778415495789242`∗ˆ7,

384 3.6709169370615974`∗ˆ7, 3.645564945134825`∗ˆ7,

385 3.643652665212932`∗ˆ7, 3.635186164941954`∗ˆ7,

386 3.642195582602521`∗ˆ7, 3.64533637614181`∗ˆ7,

387 3.6613998731539175`∗ˆ7, 3.647400055936142`∗ˆ7,

388 3.649301040517885`∗ˆ7, 3.6354587135693714`∗ˆ7,

389 3.6510227938527346`∗ˆ7, 3.645423935037754`∗ˆ7,

390 3.6362288351518966`∗ˆ7, 3.6403752404320344`∗ˆ7,

391 3.645991074981351`∗ˆ7, 3.6402238078152`∗ˆ7, 3.6467547507592455`∗ˆ7,

392 3.637861661432194`∗ˆ7};393 Length[UnNormAmpFitEdit];

394 index = Import[”MATLABsigr.mat”];

395 indexEdit = {1.`, 2.`, 3.`, 4.`, 5.`, 6.`, 7.`, 8.`, 9.`, 10.`, 11.`,

396 12.`, 13.`, 14.`, 15.`, 16.`, 17.`, 18.`, 19.`, 20.`, 21.`, 22.`,

397 23.`, 24.`, 25.`, 26.`, 27.`, 28.`, 29.`, 30.`, 31.`, 32.`, 33.`,

398 49.`, 50.`, 51.`, 52.`, 53.`, 54.`, 55.`, 56.`, 57.`, 58.`, 59.`,

399 60.`, 61.`, 62.`, 63.`, 64.`, 65.`, 66.`, 67.`, 68.`, 69.`, 70.`,

400 71.`, 72.`, 73.`, 74.`, 75.`, 76.`, 77.`, 78.`, 79.`, 80.`, 81.`,

401 82.`, 83.`, 84.`, 85.`, 86.`, 87.`, 88.`, 89.`, 90.`, 91.`, 92.`,

402 93.`, 94.`, 95.`, 96.`, 97.`, 98.`, 99.`, 100.`, 101.`, 102.`,

403 103.`, 104.`, 105.`, 106.`, 107.`, 108.`, 109.`, 110.`, 111.`,

404 112.`, 113.`, 114.`, 115.`, 116.`, 117.`, 118.`, 119.`, 120.`,

405 121.`, 122.`, 123.`, 124.`, 125.`, 126.`, 127.`, 128.`, 129.`,

406 130.`, 131.`, 132.`, 133.`, 134.`, 135.`, 136.`, 137.`, 138.`,

407 139.`, 140.`, 141.`, 142.`, 143.`, 144.`, 145.`, 146.`, 147.`,

408 148.`, 149.`, 150.`, 151.`, 152.`, 153.`, 154.`, 155.`, 156.`,

409 157.`, 158.`, 159.`, 160.`, 161.`, 162.`, 163.`, 164.`, 165.`,

410 166.`, 167.`, 168.`, 169.`, 170.`, 171.`, 172.`, 173.`, 174.`,

411 175.`, 176.`, 177.`, 178.`, 179.`, 180.`, 181.`, 182.`, 183.`,

412 184.`, 185.`, 186.`, 187.`, 188.`, 189.`, 190.`, 191.`, 192.`,

413 193.`, 194.`, 195.`, 196.`, 197.`, 198.`, 199.`, 200.`, 201.`,

414 202.`, 203.`, 204.`, 205.`, 206.`, 207.`, 208.`, 209.`, 210.`,

415 211.`, 212.`, 213.`, 214.`, 215.`, 216.`, 217.`, 218.`, 219.`,

416 220.`, 221.`, 222.`, 223.`, 224.`, 225.`, 226.`, 227.`, 228.`,

417 229.`, 230.`, 231.`, 232.`, 233.`, 234.`, 235.`, 236.`, 237.`,

418 238.`, 239.`, 240.`, 241.`, 242.`, 243.`, 244.`, 245.`, 246.`,

419 247.`, 248.`, 249.`, 250.`, 251.`, 252.`, 253.`, 254.`, 255.`,

420 256.`, 257.`, 258.`, 259.`, 260.`, 261.`, 262.`, 263.`, 264.`,

421 265.`, 266.`, 267.`, 268.`, 269.`, 270.`, 271.`, 272.`, 273.`,

422 274.`, 275.`, 276.`, 277.`, 278.`, 279.`, 280.`, 281.`, 282.`,

423 283.`, 284.`, 285.`, 286.`, 287.`, 288.`, 289.`, 290.`, 291.`,

424 292.`, 293.`, 294.`, 295.`, 296.`, 297.`, 298.`, 299.`, 300.`,

425 301.`, 302.`, 303.`, 304.`, 305.`, 306.`, 307.`, 308.`, 309.`,

426 310.`, 311.`, 312.`, 313.`, 314.`, 315.`, 316.`, 317.`, 318.`,

427 319.`, 320.`, 321.`, 322.`, 323.`, 324.`, 325.`, 326.`, 327.`,

428 328.`, 329.`, 330.`, 331.`, 332.`, 333.`, 334.`, 335.`, 336.`,

429 337.`, 338.`, 339.`, 340.`, 341.`, 342.`, 343.`, 344.`, 345.`,

Page 77: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 67

430 346.`, 347.`, 348.`, 349.`, 350.`, 351.`, 352.`, 353.`, 354.`,

431 355.`, 356.`, 357.`, 358.`, 359.`, 360.`, 361.`, 362.`, 363.`,

432 364.`, 365.`, 366.`, 367.`, 368.`, 369.`, 370.`, 371.`, 372.`,

433 373.`, 374.`, 375.`, 376.`, 377.`, 378.`, 379.`, 380.`, 381.`,

434 382.`, 383.`, 384.`, 385.`, 386.`, 387.`, 388.`, 389.`, 390.`,

435 391.`, 392.`, 393.`, 394.`, 395.`, 396.`, 397.`, 398.`, 399.`,

436 400.`, 401.`, 402.`, 403.`, 404.`, 405.`, 406.`, 407.`, 408.`,

437 409.`, 410.`, 411.`, 412.`, 413.`, 414.`, 415.`, 416.`, 417.`,

438 418.`, 419.`, 420.`, 421.`, 422.`, 423.`, 424.`, 425.`, 426.`,

439 427.`, 428.`, 429.`, 430.`, 431.`, 432.`, 433.`, 434.`, 435.`,

440 436.`, 437.`, 438.`, 439.`, 440.`, 441.`, 442.`, 443.`, 444.`,

441 445.`, 446.`, 447.`, 448.`, 449.`, 450.`};442 \[Sigma]rGenerate = (\[Lambda]p / 300)∗indexEdit;

443 Length[indexEdit ];

444 table1 = Table[{\[Sigma]rGenerate[[ i ]], AmpFitEdit[[i ]]}, { i , 1,

445 Length[AmpFitEdit]}] ;

446 plotData =

447 ListPlot [ table1 , PlotStyle −> Red,

448 AxesLabel −> {”\[Sigma]r”, ”Ez0”}];449 Length[UnNormAmpFitEdit];

450 table2 = Table[{\[Sigma]rGenerate[[ i ]], UnNormAmpFitEdit[[i]]}, {i ,451 1, 435}] ;

452

453 plotDataUnNorm =

454 ListPlot [ table2 , PlotStyle −> Purple,

455 AxesLabel −> {”\[Sigma]r”, ”Ez0”}];456

457 model = c1∗((me∗c∗c) / e)∗(Ne / np)∗kpˆ4∗

458 Exp[c2∗kpˆ2∗(\[Sigma]rˆ2 − \[Sigma]zˆ2)]∗

459 Gamma[0, 0.5∗kpˆ2∗\[Sigma]rˆ2] + c3;

460

461 UnNormModel =

462 c1U∗((me∗c∗c) / e)∗(nbUnNorm / np)∗kpˆ4∗\[Sigma]z∗\[Sigma]rˆ2∗

463 Exp[c2U∗kpˆ2∗(\[Sigma]rˆ2 − \[Sigma]zˆ2)]∗

464 Gamma[0, 0.5∗kpˆ2∗\[Sigma]rˆ2] + c3U;

465 NormFit = FindFit[table1, model, {c1, c2, c3}, \[Sigma]r ];

466 UnNormFit = FindFit[table2, UnNormModel, {c1U, c2U, c3U}, \[Sigma]r];

467 Show[plotTheory, plotData ];

468 Show[plotTheoryUnNorm, plotDataUnNorm];

469 c1 = −0.000198839;

470 c2 = 0.620339;

471 c3 = 2.125357∗10ˆ6;

472 plotFit =

473 Plot [model, {\[Sigma]r, 3∗10ˆ−7, 1.5∗10ˆ−4},474 AxesLabel −> {Style[

475 ”\!\(\∗SubscriptBox[\”\[Sigma]\”, \”r\”]\) [m]”, Medium,

476 Bold], Style [

477 ”\!\(\∗SubscriptBox[SubscriptBox[\”E\”, \”z\”], \” \”]\) [V/m]”,

Page 78: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 68

478 Medium, Bold]}, TicksStyle −> Directive[14],

479 PlotStyle −> Green];

480 ScientificTicks [ plotFit , True, True ];

481 Show[plotFit , plotData, plotTheory ];

482 c1U = 1.12416;

483 c2U = 0.499654;

484 c3U = 4.62001∗10ˆ6;

485 UnNormPlotFit =

486 Plot [UnNormModel, {\[Sigma]r, 3∗10ˆ−7, 1.5∗10ˆ−4},487 AxesLabel −> {Style[

488 ”\!\(\∗SubscriptBox[\”\[Sigma]\”, \”r\”]\) [m]”, Medium,

489 Bold], Style [

490 ”\!\(\∗SubscriptBox[SubscriptBox[\”E\”, \”z\”], \” \”]\) [V/m]”,

491 Medium, Bold]}, TicksStyle −> Directive[14],

492 PlotStyle −> Orange];

493 ScientificTicks [UnNormPlotFit, True, True];

494 Show[UnNormPlotFit, plotTheoryUnNorm, plotDataUnNorm];

495 (∗Generate continuous data for the theory and the fit and put back \496 into MATLAB − easier to edit figures this way∗)

497 continuousIndex = Range[1, 450, 1];

498 \[Sigma]r2 = (\[Lambda]p/300)∗continuousIndex;

499 continuousTheory = (1 / 4∗Pi)∗((me∗c∗c) / e)∗(Ne / np)∗kpˆ4∗

500 Exp[−0.5∗kpˆ2∗\[Sigma]zˆ2]∗Exp[0.5∗kpˆ2∗\[Sigma]r2ˆ2]∗

501 Gamma[0, 0.5∗kpˆ2∗\[Sigma]r2ˆ2] ;

502 Export[”TheoryEzMathematica.mat”, continuousTheory];

503 table3 = Table[{\[Sigma]r2[[ i ]], continuousTheory[[ i ]]}, { i , 1, 450}] ;

504 UnNormcontinuousTheory =

505 0.5∗Sqrt[2∗Pi ]∗((me∗c∗c)/e)∗(nbUnNorm/np)∗

506 kpˆ4∗\[Sigma]z∗\[Sigma]r2ˆ2∗Exp[−0.5∗kpˆ2∗\[Sigma]zˆ2]∗

507 Exp[0.5∗kpˆ2∗\[Sigma]r2ˆ2]∗Gamma[0, 0.5∗kpˆ2∗\[Sigma]r2ˆ2];

508 Export[”UnNormTheoryEz.mat”, UnNormcontinuousTheory];

509 TheoryData =

510 ListPlot [ table3 , PlotStyle −> Brown,

511 AxesLabel −> {”\[Sigma]r”, ”Ez0”}];512 Show[plotData, TheoryData, plotTheory];

513 fittedData =

514 c1∗((me∗c∗c) / e)∗(Ne / np)∗kpˆ4∗

515 Exp[c2∗kpˆ2∗(\[Sigma]r2ˆ2 − \[Sigma]zˆ2)]∗

516 Gamma[0, 0.5∗kpˆ2∗\[Sigma]r2ˆ2] + c3;

517 tableFit = Table[{\[Sigma]r2[[ i ]], fittedData [[ i ]]}, { i , 1, 450}] ;

518 TestFit =

519 ListPlot [ tableFit , PlotStyle −> Magenta,

520 AxesLabel −> {”\[Sigma]r”, ”Ez0”}];521 Export[”fittedMathetmatica.mat”, fittedData ];

522 UnNormfittedData =

523 c1U∗((me∗c∗c) / e)∗(nbUnNorm / np)∗kpˆ4∗\[Sigma]z∗\[Sigma]r2ˆ2∗

524 Exp[c2U∗kpˆ2∗(\[Sigma]r2ˆ2 − \[Sigma]zˆ2)]∗

525 Gamma[0, 0.5∗kpˆ2∗\[Sigma]r2ˆ2] + c3U;

Page 79: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

Appendix B - MATLAB, Shell and Mathematica Scripts 69

526 tableUnNormTest =

527 Table[{\[Sigma]r2[[ i ]], UnNormcontinuousTheory[[i]]}, { i , 1, 450}] ;

528 generatedDataU =

529 ListPlot [tableUnNormTest, PlotStyle −> Black,

530 AxesLabel −> {”\[Sigma]r”, ”Ez0”}];531 Show[generatedDataU, UnNormPlotFit, plotTheoryUnNorm, plotDataUnNorm];

532 Export[”UnNormfittedMathematica.mat”, UnNormfittedData];

533

Page 80: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

References

[1] Chandrashekhar Joshi and Thomas Katsouleas. Plasma accelerators at the energy

frontier and on tabletops. Physics Today, 56(6):47–52, June 2003. URL http:

//dx.doi.org/10.1063/1.1595054.

[2] Japan in pole position to host particle smasher. Nature, December 2012. URL www.

nature.com/news/japan-in-pole-position-to-host-particle-smasher-1.12047.

[3] Ask an expert - the large hadron collider in general. CERN, 2007. URL askanexpert.

web.cern.ch/AskAnExpert/en/Accelerators/LHCgeneral-en.html#3.

[4] T. J. M.Boyd and J. J. Sanderson. Plasma dynamics. 1969.

[5] W. P. Leemans et al. Gev electron beams from a centimetre-scale accelerator. Na-

ture Physics, 2(10):696–699, September 2006. URL http://dx.doi.org/10.1038/

nphys418.

[6] Ian Blumenfeld et al. Energy doubling of 42 gev electrons in a metre-scale plasma

wakefield accelerator. Nature Physics, 445(7129):741–744, February 2009. URL http:

//dx.doi.org/10.1038/nature05538.

[7] J. R. Marques, J. P. Geindre, F. Amiranoff, P. Audebert, J. C. Gauthier, A. Antonetti,

and G. Grillon. Temporal and spatial measurements of the electron density perturbation

produced in the wake of an ultrashort laser pulse. Phys. Rev. Lett., 76:3566–3569, May

1996. URL http://link.aps.org/doi/10.1103/PhysRevLett.76.3566.

[8] Allen Caldwell, Konstantin Lotov, Alexander Pukhov, and Frank Simon. Proton driven

plasma wakefield acceleration. Nature Physics, 5(5):363–367, April 2009. URL http:

//dx.doi.org/10.1038/nphys1248.

[9] RJ England, J Frederico, MJ Hogan, C Joshi, W An, W Lu, W Mori, and P Muggli. A

high transformer ratio plasma wakefield accelerator scheme for facet.

[10] Guoxing Xia, Allen Caldwell, Konstantin Lotov, Alexander Pukhov, Ralph Assmann,

et al. A Proposed experiment on the proton driven plasma wakefield acceleration.

Conf.Proc., C100523:THPD050, 2010.

70

Page 81: Beam Radius Optimisation for Electron Driven Plasma Wakefield Acceleration

References 71

[11] T. Katsouleas, S. Wilks, P. Chen, M. Dawson, and J. J.Su. Beam loading in plasma

accelerators. Particle Acceelerators, 22:81–98, April 1986. URL http://dx.doi.org/

10.1063/1.1595054.

[12] Edwin Langmann. Introduction to green’s functions: Lecture notes. pages 5 – 8, October

2006. URL courses.theoryphys.kth.se/5A1305/Green.pdf.

[13] W. Lu, C. Huang, M. M. Zhou, W. B. Mori, and T. Katsouleas. Limits of linear plasma

wakefield theory for electron or positron beams. Physics of Plasmas, 12:1–8, November

2005. URL pop.aip.org/resource/1/phpaen/v12/i6/p063101_s1.

[14] M.Steck. Beam cooling. CERN Accelerator School, pages 1–6, October 2009. URL

cas.web.cern.ch/cas/Germany2009/Lectures/PDF-Web/Steck.pdf.

[15] Allen Caldwell and Konstantin Lotov. Plasma Wakefield Acceleration with a Modulated

Proton Bunch. Phys.Plasmas, 18:103101, 2011. doi: 10.1063/1.3641973.

[16] E Adli, W An, R Assmann, R Bingham, A Caldwell, S Chattopadhyay, N Delerue, F M

Dias, I Efthymiopoulos, E Elsen, S Fartoukh, C M Ferreira, R A Fonseca, G Geschonke,

B Goddard, O Gruelke, C Hessler, S Hillenbrand, J Holloway, C Huang, D Jarozinsky,

S Jolly, C Joshi, N Kumar, W Lu, N Lopes, M Kaur, K Lotov, V Malka, M Meddahi,

O Mete, W B Mori, A Mueller, P Muggli, Z Najmudin, P Norreys, J Osterhoff, J Poz-

imski, A Pukhov, O Reimann, S Roesler, H Ruhl, H Schlarb, B Schmidt, H v d Schmitt,

A Schoening, A Seryi, F Simon, L O Silva, T Tajima, R Trines, T Tueckmantel, A Upad-

hyay, J Vieira, O Willi, M Wing, G Xia, V Yakimenko, X Yan, and F Zimmermann.

Letter of intent for a demonstration experiment in proton-driven plasma wakefield ac-

celeration. Technical Report CERN-SPSC-2011-020. SPSC-I-240, CERN, Geneva, Jun

2011.

[17] James Holloway. Email correspondance. March 2013.

[18] Wenchuang Walter Hu, Koshala Sarveswaran, Marya Lieberman, and Gary H Bernstein.

Sub-10 nm electron beam lithography using cold development of poly (methylmethacry-

late). Journal of Vacuum Science & Technology B: Microelectronics and Nanometer

Structures, 22(4):1711–1716, 2004.