pyrokinetics.diagnostics.Diagnostics#

class pyrokinetics.diagnostics.Diagnostics(pyro)[source]#

Bases: object

Contains all the diagnistics that can be applied to simulation output data.

Currently, this class contains only the function to generate a Poincare map, but new diagnostics will be available in future.

Please call “load_gk_output” before attempting to use any diagnostic

Parameters:

pyro (Pyro object containing simulation output data (and geometry))

__init__(pyro)[source]#
Parameters:

pyro (Pyro)

Methods

__init__(pyro)

gs2_geometry_terms([ntheta_multiplier])

ideal_ballooning_solver([theta0])

Adapted from ideal-ballooning-solver rahulgaur104/ideal-ballooning-solver

poincare(xarray, yarray, nturns, time, rhostar)

Generates a poincare map.

gs2_geometry_terms(ntheta_multiplier=10)[source]#
Parameters:

ntheta_multiplier (int)

ideal_ballooning_solver(theta0=0.0)[source]#

Adapted from ideal-ballooning-solver rahulgaur104/ideal-ballooning-solver

Parameters:

theta0 (float) – Ballooning angle

Returns:

gamma – Ideal ballooning growth rate

Return type:

Float

poincare(xarray, yarray, nturns, time, rhostar, use_invfft=False)[source]#

Generates a poincare map. It returns the (x, y) coordinates of the Poincare Map.

This routine may take a while depending on nturns and on the number of magnetic field lines. The parameter rhostar is required by the flux-tube boundary condition. Available for CGYRO, GENE and GS2 nonlinear simulations

You need to load the output files of a simulation berore calling this function.

Parameters:
  • xarray (numpy.ndarray, array containing x coordinate of initial) – field line positions

  • yarray (numpy.ndarray, array containing y coordinate of initial) – field line positions

  • nturns (int, number of intersection points)

  • time (float, time reference)

  • rhostar (float, rhostar is needed to set the boundary condition) – on the magnetic field line

  • use_invfft (bool, if True, the inverse Fourier transform is computed) – every (x, y) points along the magnetic field line. It is much more accurate but very slow.

Returns:

coordinates – containing the x and y coordinates shaped according to the initial field line position. See example_poincare.py for a simple example.

Return type:

numpy.ndarray, 4D array of shape (2, nturns, len(yarray), len(xarray))

Raises: