Extending the capabilities of the DNS code Xcompact3D by incorporating Magnetohydrodynamics (MHD), for large scale turbulent flows on ARCHER2

ARCHER2-eCSE07-03


image

This work involved the development of a high-performance Magnetohydrodynamics (MHD) module integrated into the Xcompact3d framework, an open-source computational fluid dynamics (CFD) solver designed to study turbulent flows on supercomputers. MHD is the study of the dynamics of fluid flows coupled with electromagnetic fields, with applications ranging from plasma physics and nuclear fusion to astrophysics and geophysics. Accurately simulating MHD flows is a challenging task due to the complex interactions between the fluid and magnetic fields. The new MHD module in Xcompact3d provides a powerful tool for researchers to gain deeper insights into MHD phenomena, which can lead to advancements in areas like fusion reactor design, space weather modelling, and our understanding of the Earth’s magnetic field.

The eCSE project focused on integrating an MHD solver into the existing Xcompact3d framework, which uses high-order finite-difference schemes and spectral methods to efficiently simulate turbulent flows. The new MHD module leverages Xcompact3d’s existing FFT library, sixth-order compact finite-difference schemes, and a direct spectral Poisson solver to solve both the induction and electric potential-based MHD equations. This allows the MHD solver to accurately capture complex MHD phenomena while maintaining the scalability of the Xcompact3d framework on modern high-performance computing systems.

Xcompact3d is an open-source, high-order finite-difference CFD framework designed to study turbulent flows on supercomputers. It was initially developed to solve the incompressible Navier-Stokes equations and has since been expanded to include various capabilities, such as large eddy simulations and immersed boundary methods. The incorporation of the new MHD module further enhances Xcompact3d’s capabilities, making it a versatile tool for researchers investigating a wide range of fluid dynamics and MHD problems.

The development and validation of the MHD module in Xcompact3d is presented in the following publication: Fang, J., Laizet, S., & Skillen, A. (2025). A high-order finite-difference solver for direct numerical simulations of magnetohydrodynamic turbulence. Computer Physics Communications, 307, 109400. This paper describes the implementation details of the MHD module, its validation against established benchmarks, and new findings on the evolution of the Taylor-Green vortex under an external magnetic field, as shown in the following figures.

image

Flow and magnetic coherent structures of Taylor-Green vortex flow with (a,b) and without MHD (c)

Information about the code

The code is published on Github, user can access from ARCHER2 through:
git clone https://github.com/xcompact3d/Incompact3d.git

Technical Report

Jian Fang, Sylvain Laizet, Alex Skillen,
A high-order finite-difference solver for direct numerical simulations of magnetohydrodynamic turbulence,
Computer Physics Communications,
Volume 307,
2025,
109400,
ISSN 0010-4655.

DOI

10.1016/j.cpc.2024.109400