b250 b990 b1020 b1480

Source Code

CGYRO source code is available at GitHub.


CGYRO is a multi-species spectral gyrokinetic solver with sonic rotation capability. Over the last decade the fusion community has focused its modeling efforts primarily on the core region. A popular kinetic code used for this purpose was GYRO [CW03b][CW03a][CWD04][CB10]. Thousands of nonlinear simulations with GYRO have informed the fusion community’s understanding of core plasma turbulence [KWC05][KWC06][KWC07][HHW+16] and provided a transport database for the calibration of reduced transport models such as TGLF [SKW07]. GYRO was the first global electromagnetic solver, and pioneered the development of numerical algorithms for the GK equations with kinetic electrons. It is formulated in real space and like all global solvers requires ad hoc absorbing-layer boundary conditions when simulating cases with profile variation. This approach is suitable for core turbulence simulations, which cover a large radial region and are dominated by low wavenumbers. More recently, as the understanding of core transport has become increasingly complete, the cutting edge of research moved radially toward the pedestal region, where plasmas are characterized by larger collisionality and steeper pressure gradients that greatly modify the turbulent phenomena at play. This motivated the development, from scratch, of the CGYRO code [CBB16][BC17][CB18][BC18] to complement GYRO. CGYRO is an Eulerian GK solver specifically designed and optimized for collisional, electromagnetic, multiscale simulation. A key algorithmic aspect of CGYRO is the radially spectral formulation used to reduce the complicated integral gyroaveraging kernel into a multiplication in wavenumber space, but retaining the ability to treat profile variation important for edge plasmas. A new coordinate system that is more suitable for the highly collisional and shaped edge regime was adopted from the NEO code [BC08][BC12], which is the community standard for calculation of collisional transport in toroidal geometry.

Data input

The primary CGYRO input file is input.cgyro. Profile data can be optionally captured from input.gacode.

Data output, python interface, and plotting

Although there is a description of output data, it is suggested that users use the python interface to output data.


CGYRO Normalization






minor radius



deuterium mass = \(3.345\times 10^{24} g\)



electron density



electron temperature


\(c_s = \sqrt{T_e/m_\mathrm{D}}\)

deuterium sound speed



minor radius over sound speed

Running cases

Beyond the general instructions here, we also give hints for running on systems with public GACODE installs. The input files and configuration for numerous linear and nonlinear cases can be auto-generated using the -g flag. Often, it is easiest to find a template case that is close to what you would like to run, and then modify it accordingly. A list of all regression and template cases in generated by typing:

$ cgyro -g

A very simple nonlinear case is nl00. You can generate the template with:

$ cgyro -g nl00

It is strongly suggested that you first run your case in test mode using the -t flag:

$ cgyro -t nl00

On the large systems at NERSC, ORNL and elsewhere, you will need to establish an interactive queue to execute the command above. The result should be diagnostics printed to the screen plus a few output files. Pay attention to the file out.cgyro.mpi. This shows the acceptable number of MPI tasks.

Batch submission

On established platforms, the burden of writing batch script files and setting core counts is managed by the gacode_qsub script. To generate a batch.src file, you could type:

$ gacode_qsub -e nl01 -n 512 -nomp 2 -queue regular -repo atom -w 0:09:00

Additional flags are also accepted. Adding the -s flag to the above will submit the job.