# GTC-P

## Description

The Princeton Gyrokinetic Toroidal Code (GTC-P) simulates plasma turbulence within Tokamak fusion devices. The Tokamak device generates a magnetic field that confines a plasma within a toroidal (i.e. donut-shaped) cavity and accelerates the plasma particles (whether ions or electrons) around the torus. Particles also interact with each other via Coulomb forces. The Coulomb interactions are highly dynamical and give rise to instabilities of the plasma structure that must be understood and controlled in order to create an efficient fusion energy source.

GTC-P simulates the motion of ions through the Tokamak by solving a Vlassov-Poisson equation using a particle-in-cell (PIC) algorithm. During each PIC time-step, the charge distribution of the particles is interpolated onto a grid, Poisson's equation is solved on the grid, the electric fields are interpolated from the grid to the particles, and the phase-space coordinates of the particles are updated according the electric field.

Within GTC, the external magnetic field provided by the Tokamak causes ions to move along a gyrokinetic (i.e. helical) path. The roughly circular motion of an ion around this helix is much faster than it's motion along the guiding center, so the ion's motion can be approximated by a ring of charge travelling on a mean trajectory. This gyrokinetic approximation increases the efficiency of GTC by allowing much larger time steps than could be used otherwise.

The memory access patterns charge deposition and interpolation steps are challenging for most memory subsystems.

Like most PIC codes, the unordered nature of the particles in GTC gives rise to nonlinear sequences of grid points to be accessed. Indirect addressing of the grid elements and gyro-averaging further increase complexity of GTC's memory access pattern.

## Required Problem Sets

Problems can be found in the ./run directory. For GTC, small, large and grand challenge problem sets have been defined. Small is an "size-A" grid and uses 30 particles per cell. The reference (large) problem is "size-E" and uses 200 particles per cell. The grand challenge problem is "size-E" with 400 particles per cell and is used in the calculation of SSI.

## Source Distribution

Source and problem sets can be downloaded here.

## How to Build, Run and Verify

Refer to the README.APEX file in the source distribution.

## Authorship

GTC-P comes from Princeton University and Princeton Plasma Physics Laboratory. The primary developers are Bei Wang (Princeton University), Stephane Ethier (PPPL), Kamesh Madduri (Penn State University, formerly LBL) and Khaled Ibrahim (LBL)

## Change Log

03/28/216 | Updated source distribution: -- Run diagnostic functions (needed for validation test) only at last step, not every step. -- Fixed overflow error when in initializing mi_local for grand challenge problem. -- Fixed x2_l definition when initializing particle coordinates. -- Fixed race condition in shifti_radial_a2a. -- Updated reference values for validation test ( necessitated by the changes listed above) -- Changed communicator from MPI_COMM_WORLD to appropriate subdomain in shifti_radial and shifti_toroidal. |

03/16/2016 | Updated source distribution: -- added logic to check for a valid result independent of the problem size and decomposition -- Fixed integer overflow that occurs for the grand challenge problem -- Removed artificial restriction on the number of threads used by the shift routines -- Small corrections to the memory estimates in README.APEX -- Fixed logic error in ghost cell setup -- Many whitespace changes in shifti.c (indent) |

11/9/2015 | Source distribution link created |

10/30/2015 | Initial release |