A GPU-Accelerated 2D FRC MHD Solver
A lightweight, research-grade simulation framework for studying Field-Reversed Configuration (FRC) dynamics, built for plasma physics education, algorithm development, and fusion interview preparation (Helion Energy, CFS, General Fusion, etc.).
OpenFRC is a 2D Magnetohydrodynamics (MHD) solver implementing:
- Helion-style FRC magnetic topology
- Strong axial magnetic field reversal
- Poloidal flux function initialization
- FFT-based ∇·B cleaning (projection method)
- Hybrid NumPy/CuPy backend for GPU acceleration
- Multiple physics modes:
✓ FRC formation
✓ Magnetic reconnection
✓ Alfvén wave propagation - Visualization + MP4 animation exports
The solver is intentionally compact, readable, and modular — ideal for:
- learning plasma & MHD theory
- testing numerical algorithms
- fusion interview preparation
- use as a starting point for Hall-MHD or 2-fluid extensions
FRCs are among the most compact and promising fusion configurations.
Helion Energy uses Merging-FRC (MIF) to achieve fusion-relevant conditions.
This project recreates core FRC physics in a clean 2D MHD framework:
- Axisymmetric flux rings
- Strong field reversal
- Current sheet formation
- Magnetic reconnection
- Plasmoid structures
- Outward magnetic pressure balance
- Lorentz-force-driven acceleration
This is conceptually aligned with the physics in Helion’s formation region.
The solver integrates the ideal MHD equations with resistive diffusion:
We enforce:
using FFT-based Poisson projection:
This method is:
- fast
- GPU-accelerated
- stable
- common in modern MHD codes (Athena++, Dedner schemes)
We initialize a long, slender FRC, similar to Helion's confinement geometry.
Flux function:
Poloidal magnetic field:
Axial field reversal:
This produces:
- a magnetic null line along the axis
- a strongly reversed core
- closed poloidal flux surfaces
- current sheet regions
OpenFRC/
│── backend.py # NumPy/CuPy backend (hybrid GPU/CPU)
│── config.py # Grid parameters, timestep, resistivity
│── initial_conditions.py # Alfven, Reconnection, FRC setups
│── solver.py # MHD evolution + FFT divergence cleaning
│── visualize.py # Frame generation + MP4 animation
│── main.py # CLI interface
│── README.md
│── LICENSE
│── requirements.txt
│── environment.yml
│── .gitignore
│── media/ # Logo and favicon
│── frames/ # Auto-generated output (ignored by git)
│── animation.mp4 # Optional animation output
git clone https://github.com/Huq2090/OpenFRC.git
cd OpenFRC
pip install -r requirements.txt
pip install cupy-cuda12x
python3 main.py --mode frc --cleaning projection --animate
python3 main.py --mode frc --gpu --animate
python3 main.py --mode reconnection --animate
python3 main.py --mode alfven --animate
Animations will appear in:
frames/
animation.mp4
(Add images/GIFs after running the simulation)
Example placeholders:
- FRC poloidal field loops
- Axial field reversal
- Magnetic island formation
- Current sheet thinning
- Reconnection dynamics
- ☐ Hall-MHD (whistler waves + FRC tilt physics)
- ☐ Two-fluid / gyrofluid extensions
- ☐ Cylindrical (r-z) geometry
- ☐ Shock-capturing Riemann solvers (HLL/HLLD)
- ☐ Dedner hyperbolic divergence cleaning
- ☐ Sphinx documentation
- ☐ Unit tests (pytest)
- ☐ GitHub Actions CI
- ☐ Docker image
- ☐ Jupyter notebook demos
If you use this project:
@software{OpenFRC2025,
author = {Md Fazlul Huq},
title = {OpenFRC: A GPU-Accelerated 2D FRC MHD Solver},
year = {2025},
url = {https://github.com/Huq2090/OpenFRC}
}
Developed by Md Fazlul Huq
As part of self learning of Computational plasma physics of Field-Reversed Configuration (FRC) in MHD.
Special thanks to open-source plasma physics projects and the wider fusion community.
