Acceleration of Free-boundary Grad-Shafranov codes using advanced numerical methods

August 1, 2023
In Progress
Share this project


Controlled fusion reactions hold great promise for sustainable energy production. By mimicking the processes that power the sun, fusion could provide a nearly limitless, clean, and safe energy source with minimal greenhouse gas emissions and significantly less radioactive waste compared to traditional nuclear fission. However, despite its potential, fusion energy is not yet commercially viable, and significant research is still needed.

To support the complex computational needs of fusion development, the European Consortium for the Development of Fusion Energy (EUROfusion) has selected EPFL as one of their Advanced Computing Hubs. Led by the Swiss Plasma Center (SPC), this hub integrates expertise from EPFL’s Institute of Mathematics, SCITAS (a high-performance scientific computing platform), the Swiss Data Science Center (SDSC), and the Laboratory for Experimental Museology (eM+). This collaborative effort will enhance the computational capacity required for cutting-edge fusion simulations, driving forward the quest for sustainable and secure energy solutions.

Within this context, the SDSC and the SPC are teaming up for a first collaboration to implement and accelerate free-boundary Grad-Shafranov codes (FGS/FGE) using advanced numerical methods, including machine learning. These codes, integrated within the MEQ code collection, solves the Grad-Shafranov equation (axisymmetric ideal Magnetohydrodynamics force balance, see Figure 1) and are a key component of workflows for tokamak modeling, having applications in integrated modeling, discharge pre-simulation and preparation, magnetic control design and validation.



SDSC Team:
Alessandro Mari
Guillaume Obozinski

PI | Partners:

EPFL, Swiss Plasma Center:

  • Dr. Antoine Merle
  • Dr. Federico Felici
  • Ph.D. Cosmas Heiss

More info



Acceleration of these Free-boundary Grad-Shafranov codes is of particular importance for so-called tokamak ‘flight simulators’ that are being developed to test a tokamak discharge before it is run. Such simulators should be able to simulate the entire discharge from the coil magnetization until termination and is expected to be a key component of future tokamak operations including ITER and DEMO. Ideally, these flight simulators should operate at speeds exceeding real-time to allow testing of the plasma control system in a realistic setting. Furthermore, faster-than-real-time Grad-Shafranov solvers enable routine use of optimization methods to improve tokamak operations, e.g., by optimizing poloidal field coil current evolution to maximize discharge duration or minimize structural forces.

Proposed Approach / Solution

Formulating the solution to the Grad-Shafranov equation involves solving a set of nonlinear equations in a high-dimensional space. The current method, a Newton schema called Jacobian-Free Newton Krylov (JFNK), addresses the challenge of Jacobian inversion costs by employing a Krylov iterative method (GMRES) and substituting Jacobian-vector products with finite differences. However, the effectiveness of this approach relies on finding good preconditioners to diminish the search dimension in the Krylov space.

We proposed an improvement of the vanilla Broyden method that leverages on the structure of the Grad-Shafranov equations, particularly the spatial localization of the plasma, resulting in sparse Jacobian. While the vanilla Broyden method constructs and maintains an approximation of the inverse Jacobian, thereby avoiding inversion costs and the necessity for effective preconditioners, its complexity remains comparable to the JFNK method. However, we achieved a reduction in computational, by maintaining a low-rank approximation of a structured decomposition of the inverse Jacobian to speed up matrix-vector products.


The code employing the Broyden method, which has been released in the MEQ suite, offers more than two-fold speed up in comparison to the JFNK solver (Figure 2), while keeping the convergence properties of the latter. The complexity is further reduced to linear due to the low rank approximation, which is a step towards real-time simulations and accelerates other code relying on FGS/FGE as subroutine.

Figure 1: View of the plasma location (red) on the poloidal plane (a sectional view of the torus). Black lines represent the magnetic field generated by the coils, which are represented by squares, as well as the plasma itself. The gray circles represent the boundary of the torus.
Figure 2: Total time per solver call as a function of the dimension of the computation grid, where dashed lines show reference linear and quadratic growth curves. The Broyden method scales linearly, opposed to the Jacobian-Free Newton Krylov (JFNK) method, which exhibits a quadratic growth.



Additional resources


  1. Carpanese, F. (2021). Development of free-boundary equilibrium and transport solvers for simulation and real-time interpretation of tokamak experiments. 238. doi:10.5075/epfl-thesis-7914
  2. Knoll, D. A., & Keyes, D. E. (2004). Jacobian-free Newton–Krylov methods: a survey of approaches and applications. Journal of Computational Physics, 193(2), 357-397.
  3. Fang, H. R., & Saad, Y. (2009). Two classes of multisecant methods for nonlinear acceleration. Numerical linear algebra with applications, 16(3), 197-221.


Related Pages

More projects


In Progress
Interpretable and Robust Machine Learning for Mobility Analysis
No items found.


In Progress
Feature Learning for Bayesian Inference
No items found.


In Progress
Personalized epidural electrical stimulation of the lumbar spinal cord for clinically applicable therapy to restore mobility after paralyzing spinal cord injury
No items found.


In Progress
Directed Imitation During Vocal Learning
No items found.


Latest news

Smartair | An active learning algorithm for real-time acquisition and regression of flow field data
May 1, 2024

Smartair | An active learning algorithm for real-time acquisition and regression of flow field data

Smartair | An active learning algorithm for real-time acquisition and regression of flow field data

We’ve developed a smart solution for wind tunnel testing that learns as it works, providing accurate results faster. It provides an accurate mean flow field and turbulence field reconstruction while shortening the sampling time.
The Promise of AI in Pharmaceutical Manufacturing
April 22, 2024

The Promise of AI in Pharmaceutical Manufacturing

The Promise of AI in Pharmaceutical Manufacturing

Innovation in pharmaceutical manufacturing raises key questions: How will AI change our operations? What does this mean for the skills of our workforce? How will it reshape our collaborative efforts? And crucially, how can we fully leverage these changes?
Efficient and scalable graph generation through iterative local expansion
March 20, 2024

Efficient and scalable graph generation through iterative local expansion

Efficient and scalable graph generation through iterative local expansion

Have you ever considered the complexity of generating large-scale, intricate graphs akin to those that represent the vast relational structures of our world? Our research introduces a pioneering approach to graph generation that tackles the scalability and complexity of creating such expansive, real-world graphs.

Contact us

Let’s talk Data Science

Do you need our services or expertise?
Contact us for your next Data Science project!