XGC Preprocessor Macros

Here is a list of preprocessor macros in XGC.

ACTIVE_TE_SEP_CONTROL Interactive control of heating and cooling power with and input file (XGCa only)

ALIGN_SIMD Option to align variables to the SIMD. Useful for wide-vector optimizations.


CCE_DEBUG Debug flag for core edge coupling

CHARGEE_SCATTER_UNIT_READ Current method for unit testing scatter

CHARGEI_SCATTER_UNIT_READ Current method for unit testing scatter

CHARGE_SCATTER_USE_ATOMIC Option for using OMP atomics instead of array replication

COL_CONSERV_TEST Runs collision operator test (conservation of Maxwellian distribution function)

COL_F_NAN_CHECK Activates checks for NaNs in the input distribution function of the collision operator

COL_F_POSITIVITY_OPT Activates an optimization that removes negative values of the distribution function after the collision operation by conserving relaxation to a Maxwellian. This works only if the velocity grid sizes (f0_nmu+1) and (2*f0_nvp+1) are not prime numbers!


COL_RELAX_FLOW Runs collision operator test (Parallel flow relaxation)

COL_RELAX_TEST Runs collision operator test (Relaxation of anisotropic temperature Maxwellian)

CONVERT_GRID2 Advanced grid infrastructure (flux-surface average, straight field-line poloidal angle, Fourier filter, etc.)

CYLINDRICAL Use cylindrical geometry. B-field calculation (both poloidal and toroidal B-field) ignores R variation. Also volume elements ignores R variation.

DELTAF_CONV Use this flag for classical delta-f simulation excluding the neoclassical terms in the gyrokinetic equation


DIAG_F0_REAL4 Write out f0 in real4 to reduce data size

DIAG_NOISE Computes noise diagnostics in velocity space


DO_PARTICLE_CHECK Do particle check against reference data

EFIELD2 Alternative calculation of the parallel electric field (XGC1 only)

EXTENDED_SHEATH_LOGIC Some stuff I used to play with the logical sheath boundary condition

EXTRA_DWDT (probably related to DELTAF_CONV)

F0_NODE_TEMP (Use temperature on vertex for particle-mesh velocity space interpolation)

F0_TOR_LINEAR If defined, linear toroidal interpolation (with some caveats) is used for interpolation between 5D grid and particles instead of nearest neighbor interpolation (if unsure, ask R. Hager or S. Ku for more information)

FIELD_ALIGNED_INITIAL Initialize with a magnetic field-aligned perturbation for linear mode studies


F_USE_MARKER_DEN Using marker density to get density instead of sum(w)/V. It uses marker density g

F_USE_MARKER_DEN2 variation version – Both F_USE_MARKER_DEN and F_USE_MARKER_DEN2 requires tests for noise reduction and verification.

GAM_TEST In load.F90 - load particles to test GAMs?


GEOM_SORT Alternative sorting algorithm in sort_particles.F90. Not sure which is better when


HEAT_TORQUE_MAXWELL Compute delta-f from heating/torque based on Maxwellian - this code has some bug, but it could be useful for small size particle simulation.

HEAT_TORQUE_POLYNOMIAL Compute delta-f from heating/torque with polynomial scaling of f instead of shifting phase space density with linear interpolation


INIT_GENE_PERT Load particles with initial perturbation generated from any equilibrium data. Used for benchmark and coupled simulations with GENE or GEM.

ITER_GRID Use more space for flux average matrix – needs update. Use two stage method. 1st stage - get matrix off-diagonal size, 2nd stage - calculate actual matrix elements. Ultimately, matrix data structure needs to be imporved to reduce memory usage. (This is applies only if CONVERT_GRID2 is not defined)

MAXWELL_V_DIST_ORG Use original maxwellian particle loading routine.

MAX_DDEN Used in poisson.F90, impose a max on something?

NAN_CHECK_PUSHE_VEC Does a NaN check after search and sort in the pushe kernel

NEOCLASSICAL_TEST Activates some of the optimizations for axisymmetric plasma used in XGCa. For verification of neoclassical physics in XGC1.

NEWGYROMATRIX Flag to compile with adaptive gyroaveraging matrices. (Use a thermal grid instead of a fixed grid and projects weight when preserving mu)

NEW_FLX_AIF Use new format of flx.aif file (required for CONVERT_GRID2 with RPI meshes generated after ~12/2018)

NO_FLUSH In the past, there have been compilers that did not support the flush command in fortran. However, flush is very important on some systems, e.g. Summit, to be able to monitor job progress by examining standard out. This was a compromise to support both types of systems.

NO_PETSC Bypasses PETSc related code for the stand-alone push kernel

NO_SEARCH_TR_CHECK DON’T check the current triangle before doing particle search

PILL_SUB_ELLIP Sizable piece of code in collisionsf2.F90, unclear what it does or who wrote it

PLANE_MAJOR The 1D process ordering is mapped to the 2D virtual process grid used to define the parallel decompostion so that either consecutive processes are in different planes (INTERPLANE_MAJOR), the default, or in the same plane (PLANE_MAJOR). Which is most efficient has been system-specific (and perhaps problem case specific).

POL_MODE In load.F90 - subset of GAM_TEST

PTB_3DB_RZ_GRID Use (R,Z) grid for interpolation of the perturbed magnetic field instead of linear interpolation on the triangular mesh)

PURE_RK2 Do pure RK2 timestep

PURE_RK4 Do pure RK4 timestep rather than hybrid. Needed for GENE coupling

PUSHE_KERNEL Compile stand-alone pushe kernel

PUSHE_UNIT_READ Current method for unit testing push


SOLVERLU Use LU decomposition for matrix solver in collision routine

SOLVER_TEST Run test of Poisson solver, then exit

TITAN titan does not support atomic — disable omp threads


UNIT_TEST Run a unit test


USE_BICUB_MOD Use Ed’s inhouse cubic interpolation instead of pspline. pspline is required for initial setup. The code is much faster with this flag.

USE_CPP_COLLISIONS Use the kokkos collision module instead of the fortran openacc module

USE_EXPLICIT Looks to be very niche, just used in interpolation.F90, looks deletable

USE_INQUIRE_DIRECTORY Required for determining where to put timing data. Intel fortran compiler requires this to be defined. All other compilers (?) require that this not be defined.

USE_OLD_READ_INPUT For performance efficiency, the default is for one process to read the input file as a string, broadcast this, then each process reads the namelist input from this string. This requires a 2003 Fortran compliant compiler. If USE_OLD_READ_INPUT is defined, then every process reads the input file for every namelist (so multiple times).

USE_ONE_D_I_CUB_MOD Flag to use in-house code for interpolation of I(psi) and bypasses a pspline interpolation call. Performance unknown.

USE_VEC Use the vectorized CPU electron push

VALIDATION Re-initialize seed for randomization in XGCa setup

V_PERP Using V_PERP for f0 grid. If not defined, sqrt(mu) is used. The essential difference is normalized constant of v_perp grid. With V_PERP, grid spacing in v_perp grid is equally spaced in velocity space in certain flux surface. Without V_PERP, grid spacing in v_perp grid is equally spaced in sqrt(mu) or v_perp/sqrt(B) in certain flux surface.

WRITE_PARTICLE_CHECK Write particle check reference data

XGC1 Compile XGC1

XGC1_EM ???



XGCA Compile XGCa

XGC_COUPLING_CORE_EDGE compile with core-edge coupling communicaitons

XGC_DEBUG1 Output matrix during setup_grid

XGC_FLAT_B Use axis B field in poisson solver. Poisson eq has 1/B^2 factor in front of grad operator.