pyrokinetics.gk_code.tglf.GKInputTGLF#

class pyrokinetics.gk_code.tglf.GKInputTGLF(filename=None)[source]#

Bases: GKInput, FileReader

Reader for TGLF input files

Parameters:

filename (PathLike | str | None)

__init__(filename=None)#
Parameters:

filename (PathLike | str | None)

Methods

__init__([filename])

add_flags(flags)

Add extra flags to TGLF input file

from_file(path[, file_type])

Read a file from disk, returning an instance of this class.

from_str(input_string)

get_local_geometry()

Returns local geometry.

get_local_geometry_miller()

Load Miller object from TGLF file

get_local_geometry_mxh()

Load mxh object from TGLF file

get_local_species()

Load LocalSpecies object from TGLF file

get_ne_te_normalisation()

get_numerics()

Gather numerical info (grid spacing, time steps, etc)

get_reference_values(local_norm)

Reads in reference values from input file

is_linear()

is_nonlinear()

Return true if the GKCode is nonlinear, otherwise return False

parse_tglf(lines)

Given lines of a tglf file or a string split by '/n', return a dict of TGLF input data

pyro_TGLF_species([iSp])

read_dict(input_dict[, detect_norm])

Reads TGLF input file given as dict Uses default read_dict, which assumes input is a dict

read_from_file(filename[, detect_norm])

Reads TGLF input file into a dictionary

read_str(input_string[, detect_norm])

Reads TGLF input file given as string

set(local_geometry, local_species, numerics)

Set self.data using LocalGeometry, LocalSpecies, and Numerics.

supported_file_types()

Returns a list of all registered file types.

verify_expected_keys(filename, keys)

Checks that the expected keys are present at the top level of self.data.

verify_file_type(filename)

Ensure this file is a valid TGLF input file, and that it contains sufficient info for Pyrokinetics to work with

write(filename[, float_format, local_norm, ...])

Write input file for TGLF

Attributes

add_flags(flags)[source]#

Add extra flags to TGLF input file

Return type:

None

code_name = 'TGLF'#
default_file_name = 'input.TGLF'#
file_type: ClassVar[str] = 'TGLF'#
get_local_geometry()[source]#

Returns local geometry. Delegates to more specific functions

Return type:

LocalGeometry

get_local_geometry_miller()[source]#

Load Miller object from TGLF file

Return type:

LocalGeometryMiller

get_local_geometry_mxh()[source]#

Load mxh object from TGLF file

Return type:

LocalGeometryMXH

get_local_species()[source]#

Load LocalSpecies object from TGLF file

get_ne_te_normalisation()[source]#
get_numerics()[source]#

Gather numerical info (grid spacing, time steps, etc)

Return type:

Numerics

get_reference_values(local_norm)[source]#

Reads in reference values from input file

Return type:

Dict[str, Any]

Parameters:

local_norm (SimulationNormalisation)

is_nonlinear()[source]#

Return true if the GKCode is nonlinear, otherwise return False

Return type:

bool

norm_convention: str = 'cgyro'#

Convention used for normalising this code’s quantities

static parse_tglf(lines)[source]#

Given lines of a tglf file or a string split by ‘/n’, return a dict of TGLF input data

static pyro_TGLF_species(iSp=1)[source]#
pyro_tglf_miller = {'Rmaj': 'rmaj_loc', 'delta': 'delta_loc', 'kappa': 'kappa_loc', 'q': 'q_loc', 'rho': 'rmin_loc', 's_kappa': 's_kappa_loc', 'shift': 'drmajdx_loc'}#
pyro_tglf_miller_defaults = {'Rmaj': 3.0, 'delta': 0.0, 'kappa': 1.0, 'q': 2.0, 'rho': 0.5, 's_kappa': 0.0, 'shift': 0.0}#
pyro_tglf_mxh = {'Rmaj': 'rmaj_loc', 'Z0': 'zmaj_loc', 'cn0': 'shape_cos0', 'cn1': 'shape_cos1', 'cn2': 'shape_cos2', 'cn3': 'shape_cos3', 'cn4': 'shape_cos4', 'cn5': 'shape_cos5', 'cn6': 'shape_cos6', 'dZ0dr': 'dzmajdx_loc', 'dcndr0': 'shape_s_cos0', 'dcndr1': 'shape_s_cos1', 'dcndr2': 'shape_s_cos2', 'dcndr3': 'shape_s_cos3', 'dcndr4': 'shape_s_cos4', 'dcndr5': 'shape_s_cos5', 'dcndr6': 'shape_s_cos6', 'delta': 'delta_loc', 'dsndr3': 'shape_s_sin3', 'dsndr4': 'shape_s_sin4', 'dsndr5': 'shape_s_sin5', 'dsndr6': 'shape_s_sin6', 'kappa': 'kappa_loc', 'q': 'q_loc', 'rho': 'rmin_loc', 's_delta': 's_delta_loc', 's_kappa': 's_kappa_loc', 's_zeta': 's_zeta_loc', 'shift': 'drmajdx_loc', 'sn3': 'shape_sin3', 'sn4': 'shape_sin4', 'sn5': 'shape_sin5', 'sn6': 'shape_sin6', 'zeta': 'zeta_loc'}#
pyro_tglf_mxh_defaults = {'Rmaj': 3.0, 'Z0': 0.0, 'cn0': 0.0, 'cn1': 0.0, 'cn2': 0.0, 'cn3': 0.0, 'cn4': 0.0, 'cn5': 0.0, 'cn6': 0.0, 'dZ0dr': 0.0, 'dcndr0': 0.0, 'dcndr1': 0.0, 'dcndr2': 0.0, 'dcndr3': 0.0, 'dcndr4': 0.0, 'dcndr5': 0.0, 'dcndr6': 0.0, 'delta': 0.0, 'dsndr3': 0.0, 'dsndr4': 0.0, 'dsndr5': 0.0, 'dsndr6': 0.0, 'kappa': 1.0, 'q': 2.0, 'rho': 0.5, 's_delta': 0.0, 's_kappa': 0.0, 's_zeta': 0.0, 'shat': 1.0, 'shift': 0.0, 'sn3': 0.0, 'sn4': 0.0, 'sn5': 0.0, 'sn6': 0.0, 'zeta': 0.0}#
read_dict(input_dict, detect_norm=True)[source]#

Reads TGLF input file given as dict Uses default read_dict, which assumes input is a dict

Return type:

Dict[str, Any]

Parameters:
read_from_file(filename, detect_norm=True)[source]#

Reads TGLF input file into a dictionary

Return type:

Dict[str, Any]

Parameters:
read_str(input_string, detect_norm=True)[source]#

Reads TGLF input file given as string

Return type:

Dict[str, Any]

Parameters:
  • input_string (str)

  • detect_norm (bool)

set(local_geometry, local_species, numerics, local_norm=None, template_file=None, code_normalisation=None, **kwargs)[source]#

Set self.data using LocalGeometry, LocalSpecies, and Numerics. These may be obtained via another GKInput file, or from Equilibrium/Kinetics objects.

Parameters:
tglf_max_ntheta = 32#
verify_file_type(filename)[source]#

Ensure this file is a valid TGLF input file, and that it contains sufficient info for Pyrokinetics to work with

Parameters:

filename (PathLike | str)

write(filename, float_format='', local_norm=None, code_normalisation=None)[source]#

Write input file for TGLF

Parameters: