GX

Contents

In this guide, we will walk you through setting up and running GX simulations using the Inductiva API.

We will cover an example code to help you get started with simulations.

GX#

GX is a GPU-native model for solving the nonlinear gyrokinetic system for low-frequency turbulence in magnetized plasmas, in particular tokamaks and stellarators, using Fourier-Hermite-Laguerre spectral methods.

This software has proven ideal for fusion reactor design and optimization, as well as for general physics research.

We currently have the following GX version available:

  • v11-2024 : This represents the source code from the GX repository as of November 2024.

Note: The GX simulator only runs on VM’s with a GPU available (e.g., g2-standard-4).

Example Code#

In this example, we set up a linear ion-temperature-gradient (ITG) instability calculation using W7-X stellarator geometry and adiabatic electrons. This use case is presented in the official GX documentation, which you can visit for more details on the simulator’s features and configurations.

"""Gx example."""
import inductiva

# Instantiate machine group
gpu_machine_group = inductiva.resources.MachineGroup("g2-standard-4")

input_dir = inductiva.utils.download_from_url(
    "https://storage.googleapis.com/inductiva-api-demo-files/"
    "gromacs-input-example.zip",
    unzip=True)

gx = inductiva.simulators.GX()

task = gx.run(input_dir=input_dir,
              sim_config_filename="itg_w7x_adiabatic_electrons.in",
              on=gpu_machine_group)

task.wait()
gpu_machine_group.terminate()

task.download_outputs()

task.print_summary()

The current example is divided into four steps:

  • Configure the Machine Type: In this step, we define the machine type.

  • Download Input Files: In this step, we retrieve the input files from the Inductiva bucket.

  • Pick the Simulator: We select the simulator we want to use. In this case, GX.

  • Run the Simulation: In the final step, we run the simulation using the run method, specifying simulation configuration file.

The last three lines handle post-simulation tasks: waiting for the simulation to finish, terminating the machine, and downloading the outputs, in that order.