pyrokinetics.equilibrium.gacode.EquilibriumReaderGACODE#

class pyrokinetics.equilibrium.gacode.EquilibriumReaderGACODE[source]#

Bases: FileReader

Class that can read input.gacode files. Rather than creating instances of this class directly, users are recommended to use the function read_equilibrium.

See also

Equilibrium

Class representing a global tokamak equilibrium.

read_equilibrium

Read an equilibrium file, return an Equilibrium.

__init__()#

Methods

__init__()

read_from_file(filename[, nR, nZ, ...])

Read in input.gacode file and creates Equilibrium object.

verify_file_type(filename)

Quickly verify that we're looking at a GACODE file without processing

Attributes

file_type: ClassVar[str] = 'GACODE'#
read_from_file(filename, nR=None, nZ=None, clockwise_phi=True, cocos=1, neighbors=64)[source]#

Read in input.gacode file and creates Equilibrium object.

GACODE makes use of radial grids, and these are interpolated onto a Cartesian RZ grid. Additional keyword-only arguments may be provided to control the resolution of the Cartesian grid, and to choose the time at which the equilibrium is taken.

Parameters:
  • filename (PathLike) – Path to the input.gacode file.

  • nR (Optional[int]) – The number of grid points in the major radius direction. By default, this is set to the number of radial grid points in the input.gacode file.

  • nZ (Optional[int]) – The number of grid points in the vertical direction. By default, this is set to the number of radial grid points in the input.gacode file.

  • clockwise_phi (bool, default False) – Determines whether the \(\phi\) grid increases clockwise or anti-clockwise when viewed from above. Used to determine COCOS convention of the inputs.

  • cocos (Optional[int]) – If set, asserts that the GEQDSK file follows that COCOS convention, and neither clockwise_phi nor the file contents will be used to identify the actual convention in use. The resulting Equilibrium is always converted to COCOS 11. BY default this is 1

  • neighbors (Optional[int]) – Sets number of nearest neighbours to use when performing the interpolation to flux surfaces to R,Z. By default, this is 64

Raises:

ValueError – If filename is not a valid file or if nr or nz are negative.

Return type:

Equilibrium

verify_file_type(filename)[source]#

Quickly verify that we’re looking at a GACODE file without processing

Return type:

None

Parameters:

filename (PathLike | str)