General Information

XGC is a global gyrokinetic particle-in-cell code, which specializes in the simulation of the edge region of magnetically confined thermonuclear fusion plasma.

Target Domain

The simulation domain can include the magnetic separatrix, magnetic axis and the biased material wall.

Basic Modes of Operation

In its full-featured operation, XGC can model electromagnetic turbulence with toroidal resolution \(N_\varphi \leq 512\). It utilizes a phase space grid in addition to particles in order to handle the non-Maxwellian particle distribution function in the tokamak edge. There are also simplified, less computationally demanding modes of operation.

XGC currently features three basic modes of operation, corresponding to different targets that can be built from the main code base.

  1. Electromagnetic mode

  • Full-featured mode of operation for simulating whole volume electromagnetic turbulence with gyrokinetic ions and drift kinetic electrons.

  • Employs the mixed-variable/pullback method to mitigate the Ampère cancellation problem.

  • Corresponding targets: xgc-eem-cpp (CPU version) and xgc-eem-cpp-gpu (GPU version).

  1. Electrostatic mode

  • Simulates electrostatic turbulence with gyrokinetic ions and drift kinetic electrons.

  • Less challenging algorithmically compared to the electromagnetic mode, resulting in lower computational resource demands. E.g. allows for a larger timestep size and less stringent mode filtering requirements.

  • Corresponding targets: xgc-es-cpp (CPU version) and xgc-es-cpp-gpu (GPU version).

  1. Axisymmetric mode

  • Solves the same equations as the electrostatic mode with the exception that the Poisson solver retains only the axisymmetric part of the electrostatic potential.

  • Allows economical studies of neoclassical transport compared to full turbulent electrostatic simulations.

  • Corresponding targets: xgca-cpp (CPU version) and xgca-cpp-gpu (GPU version).

Reduced delta-f

The electromagnetic and electrostatic modes can be configured to run in either reduced delta-f (no phase space grid) or total-f mode. While reduced delta-f mode is more economical, requiring fewer marker particles, it comes at the expense of neglecting certain neoclassical effects and may not be suitable for situations involving large departures from a Maxwellian particle distribution.

Stellarator Geometry (XGC-S)

Additionally, stellarator geometry features are available in XGC-S. While presently using a separate code base, integration into the main XGC code base is actively underway. XGC-S can simulate turbulence in non-axisymmetric stellarators. Currently XGC-S supports electrostatic simulations with delta-f gyrokinetic ions and adiabatic electrons.

Selected Physics Features

  • Impurities modeling with an arbitrary number of ion species

  • Each ion species can be run in a drift-kinetic or gyrokinetic mode. Electrons can be adiabatic, drift-kinetic, or gyrokinetic.

  • Neutral particles with atomic cross-sections

  • Heat sources

  • Nonlinear Fokker-Planck-Landau collisions

  • Anomalous diffusion model

Selected Numerical Features

  • Particle resampling

  • Core-edge coupling with GENE, GEM, and XGC itself.

  • In-situ analysis via code coupling

Features Under Development

As a flexible state-of-the-art code, XGC is under constant development to add features. Users should work closely with the core development team if they wish to add features. Most existing features are mutually compatible. Some are not, due to fundamental incompatibilities, while others could be made compatible if there is user interest.

Implementation

XGC is written in C++, with several Fortran 90 components. It achieves high performance across all leading GPU and many-core architectures and HPC systems by utilizing: * MPI * OpenMP * CUDA, HIP, and SYCL, mostly via Kokkos * Cabana Weak scaling is roughly linear to the maximal number of compute nodes of leading HPC systems in the US.

The following pages describe the XGC repository structure and workflow, coding policies, and how to compile and run XGC.

Citing XGC

For citing XGC in your publications, please always use at least reference [1] from the list below. For the tokamak simulation capability, use references [2] and [3] in addition to reference [1]. For the stellarator simulation capability, cite references [4] and [5] in addition to reference [1].

References

[1] S. Ku, R. Hager, A. Scheinberg et al., XGC, DOE Code, U.S. Department of Energy Office of Scientific and Technical Information, https://doi.org/10.11578/dc.20180627.11

[2] S. Ku, C.S. Chang, R. Hager et al., Physics of Plasmas 25, 056107 (2018), https://doi.org/10.1063/1.5020792

[3] R. Hager, S. Ku, A. Y. Sharma et al., Physics of Plasmas 29, 112308 (2022), https://doi.org/10.1063/5.0097855

[4] T. Moritaka, R. Hager, M. D. J. Cole et al., Plasma 2, 179-200 (2019), https://doi.org/10.3390/plasma2020014

[5] M. D. J. Cole, T. Moritaka, R. Hager et al., Physics of Plasmas 27, 044501 (2020), https://doi.org/10.1063/1.5140232

[6] C.S. Chang, S. Ku, H. Weitzner, Physics of Plasmas 11, 2649-2667 (2004), https://doi.org/10.1063/1.1707024

[7] S. Ku, C.S. Chang, P. H. Diamond, Nuclear Fusion 49, 115021 (2009), https://doi.org/10.1088/0029-5515/49/11/115021

[8] S. Ku, R. Hager, C.S. Chang et al., Journal of Computational Physics, 315, 467 (2016), https://doi.org/10.1016/j.jcp.2016.03.062

[9] R. Hager, E.S. Yoon, S. Ku et al., Journal of Computational Physics, 315, 644 (2016), https://doi.org/10.1016/j.jcp.2016.03.064

[10] R. Hager, J. Lang et al., Physics of Plasmas 24, 054508 (2017), http://dx.doi.org/10.1063/1.4983320