Project Overview

This project implements and analyzes various numerical integration methods for simulating charged particle trajectories in magnetic fields, with a focus on symplectic integrators that preserve energy and phase-space structure over long-term simulations.

We compare the performance of the Boris method, a specialized velocity-Verlet variant, against higher-order methods like Runge-Kutta 4 and a custom 9-step symmetric multistep method. The simulations include both simplified 2D magnetic fields and realistic tokamak fusion reactor geometries.

Additionally, we implement a guiding center approximation using the Adams-Bashforth-Moulton predictor-corrector method to efficiently simulate long-term particle drift by averaging out fast gyromotion.

šŸŽ¬ Tokamak Trajectory Animations

Watch charged particles follow characteristic "banana orbits" in the tokamak magnetic field configuration

Multistep Method (9th Order)

Multistep method animation
Symmetric 9-step multistep integrator showing energy-conserving trajectory evolution. The gradient trail (purple to yellow) visualizes the particle's complete path through the toroidal magnetic field. Duration: 10 seconds @ 30 fps.

Runge-Kutta 4 Method

RK4 method animation
Fourth-order Runge-Kutta integration with enhanced initial velocity (4Ɨ vā‚‚ component) demonstrating fuller banana orbit completion. Notice the increased toroidal circulation compared to the multistep method. Duration: 15 seconds @ 30 fps.

šŸ”¬ Key Physics Concepts

Lorentz Force: Charged particles experience a force \(\mathbf{F} = q(\mathbf{E} + \mathbf{v} \times \mathbf{B})\) perpendicular to their velocity in magnetic fields.

Symplectic Integration: Numerical methods that preserve the Hamiltonian structure and phase-space volume, essential for long-term accuracy.

Banana Orbits: Characteristic helical trajectories in tokamak geometry where particles drift toroidally and poloidally.

Guiding Center Theory: Approximation that separates fast cyclotron motion from slow drift, reducing 6D phase space to 4D.

Energy Conservation: Symplectic methods exhibit bounded energy errors \(O(h^p)\) over exponentially long timescales \(O(h^{-p-2})\).

āš™ļø Implemented Numerical Methods

Boris Method: A 2nd-order symplectic integrator specifically designed for charged particle motion, splitting position and velocity updates.

Runge-Kutta 4: Classical 4th-order explicit method providing high accuracy but lacking symplectic structure.

9-Step Symmetric Multistep: High-order implicit method using analytical Jacobians for \(\sim 10\times\) speedup, preserving energy remarkably well.

ABM4 Guiding Center: Adams-Bashforth-Moulton predictor-corrector for the reduced guiding center equations, enabling \(100\text{-}200\times\) larger timesteps.

šŸŽÆ Project Objectives

  • Implement Boris, RK4, and multistep integrators from scratch
  • Analyze convergence orders and energy conservation
  • Compare work-precision diagrams for efficiency
  • Simulate realistic tokamak magnetic field geometries
  • Implement guiding center approximation with ABM4
  • Visualize 3D particle trajectories and banana orbits

šŸ”§ Technical Implementation

  • Object-oriented architecture with abstract base classes
  • Automatic differentiation using autograd for Jacobians
  • Analytical Jacobian implementation for performance
  • DOP853 reference solutions for error analysis
  • Matplotlib 3D animations with gradient trails
  • Comprehensive test suite for validation

šŸ“Š Key Results

  • Boris method: 2nd order convergence, bounded energy errors
  • RK4 method: 4th order convergence, energy drift over time
  • Multistep: 4th order convergence, excellent energy conservation
  • Guiding center: Exact energy conservation in tokamak (U=0)
  • Validation of Hairer-Lubich theorem 3.2 for symmetric methods
  • Successful 3D visualization of banana orbit dynamics

šŸ‘„ Project Contributors