# Computational Plasma Physics

## EF2200 - Plasma Physics - Lectures on Computational Plasma Physics

First lecture - Single Particle Motion via Computer Simulation

Second lecture - Electrostatic Waves, Landau Damping, Two Stream Instability and the Particle-in-Cell method.

Home Assignment - Single Particle Motion

## 2Matlab/Octave Codes

The file .m are set to use Octave. When you use Matlab please comment lsode function and replace with ode23 in main code and comment the function definition and replace with Matlab definition in the function file.

### Motion in Constant and Uniform Fields

simulation experiment with given B and E fields:

- EcrossBdrift.m (main file)
- ExBfunc.m (function file for ODE solver, needed for running EcrossBdrift.m )

### Grad B drift

simulation experiment with a spatially varying magnetic field

- GradBdrift.m (main file)
- gradBfunc.m (function file for ODE solver, needed for running GradBdrift.m )

### Trajectory in Magnetic Dipole

simulation experiment of a particle trajectory in magnetic dipole (with Earth's magnetic dipole parameter)

- TrajMagneticDipole.m (main file for Newton Lorenz integration)
- Newton_Lorenz.m (function file for ODE solver, needed for running TrajMagneticDipole.m )

### Trajectory in Magnetic Dipole using the Guiding Center approximation

- GC_TrajMagneticDipole.m (main file for guiding center integration)
- Newton_LorenzGC.m (function file for ODE solver, needed for running GC_TrajMagneticDipole.m)
- getBmod.m (function file to calulate the gradient of module of B from Newton_LorenzGC.m )

### Particle in Cell code (for second lecture)

- Landau_pic.m (Octave/Matlab code to simulate Landau damping)
- pic.m (Octave/Matlab code to simulate 1D electrostatic system. The code is set to simulate the two stream instability)

### Dispersion relation solution for two stream instability (for second lecture)

- dispersion.m (Octave/Matlab code to calculate the most unstable k and growth rate of the instability)