pyrokinetics.gk_code.neo.GKInputNEO#

class pyrokinetics.gk_code.neo.GKInputNEO(filename=None)[source]#

Bases: GKInput, FileReader

Class that can read NEO input files, and produce Numerics, LocalSpecies, and LocalGeometry objects

Parameters:

filename (PathLike | str | None)

__init__(filename=None)#
Parameters:

filename (PathLike | str | None)

Methods

__init__([filename])

add_flags(flags)

Add extra flags to NEO 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_fourier()

Load Fourier object from NEO file

get_local_geometry_miller()

Load Miller object from NEO file

get_local_geometry_mxh()

Load MXH object from NEO file

get_local_species()

Load LocalSpecies object from NEO file

get_ne_te_normalisation()

get_numerics()

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

get_pyro_neo_species([iSp])

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_neo(lines)

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

read_dict(input_dict[, detect_norm])

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

read_from_file(filename[, detect_norm])

Reads NEO input file into a dictionary

read_str(input_string[, detect_norm])

Reads NEO 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 neo input file, and that it contains sufficient info for Pyrokinetics to work with

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

Writes self.data to an input file

Attributes

add_flags(flags)[source]#

Add extra flags to NEO input file

Return type:

None

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

Returns local geometry. Delegates to more specific functions

Return type:

LocalGeometry

get_local_geometry_fourier()[source]#

Load Fourier object from NEO file

Return type:

LocalGeometryFourierCGYRO

get_local_geometry_miller()[source]#

Load Miller object from NEO file

Return type:

LocalGeometryMiller

get_local_geometry_mxh()[source]#

Load MXH object from NEO file

Return type:

LocalGeometryMXH

get_local_species()[source]#

Load LocalSpecies object from NEO file

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

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

Return type:

Numerics

static get_pyro_neo_species(iSp=1)[source]#
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

neo_eq_types = {1: 'SAlpha', 2: 'MXH', 3: 'Fourier'}#
norm_convention: str = 'neo'#

Convention used for normalising this code’s quantities

static parse_neo(lines)[source]#

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

pyro_neo_fourier = {'Rmaj': 'RMAJ_OVER_A', 'Z0': 'ZMAG_OVER_A', 'beta_prime': 'BETA_STAR', 'bt_ccw': 'BTCCW', 'dZ0dr': 'S_ZMAG', 'delta': 'DELTA', 'ip_ccw': 'IPCCW', 'kappa': 'KAPPA', 'q': 'Q', 'rho': 'RMIN_OVER_A', 's_delta': 'S_DELTA', 's_kappa': 'S_KAPPA', 'shat': 'SHEAR', 'shift': 'SHIFT'}#
pyro_neo_fourier_defaults = {'Rmaj': 3.0, 'Z0': 0.0, 'bt_ccw': -1.0, 'dZ0dr': 0.0, 'delta': 0.0, 'ip_ccw': -1.0, 'kappa': 1.0, 'q': 2.0, 'rho': 0.5, 's_delta': 0.0, 's_kappa': 0.0, 'shat': 1.0, 'shift': 0.0}#
pyro_neo_miller = {'Rmaj': 'RMAJ_OVER_A', 'Z0': 'ZMAG_OVER_A', 'beta_prime': 'BETA_STAR', 'bt_ccw': 'BTCCW', 'dZ0dr': 'S_ZMAG', 'delta': 'DELTA', 'ip_ccw': 'IPCCW', 'kappa': 'KAPPA', 'q': 'Q', 'rho': 'RMIN_OVER_A', 's_delta': 'S_DELTA', 's_kappa': 'S_KAPPA', 'shat': 'SHEAR', 'shift': 'SHIFT'}#
pyro_neo_miller_defaults = {'Rmaj': 3.0, 'Z0': 0.0, 'bt_ccw': -1.0, 'dZ0dr': 0.0, 'delta': 0.0, 'ip_ccw': -1.0, 'kappa': 1.0, 'q': 2.0, 'rho': 0.5, 's_delta': 0.0, 's_kappa': 0.0, 'shat': 1.0, 'shift': 0.0}#
pyro_neo_mxh = {'Rmaj': 'RMAJ_OVER_A', 'Z0': 'ZMAG_OVER_A', 'beta_prime': 'BETA_STAR', 'bt_ccw': 'BTCCW', 'cn0': 'SHAPE_COS0', 'cn1': 'SHAPE_COS1', 'cn2': 'SHAPE_COS2', 'cn3': 'SHAPE_COS3', 'cn4': 'SHAPE_COS4', 'cn5': 'SHAPE_COS5', 'cn6': 'SHAPE_COS6', 'dZ0dr': 'S_ZMAG', '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', 'dsndr3': 'SHAPE_S_SIN3', 'dsndr4': 'SHAPE_S_SIN4', 'dsndr5': 'SHAPE_S_SIN5', 'dsndr6': 'SHAPE_S_SIN6', 'ip_ccw': 'IPCCW', 'kappa': 'KAPPA', 'q': 'Q', 'rho': 'RMIN_OVER_A', 's_delta': 'S_DELTA', 's_kappa': 'S_KAPPA', 's_zeta': 'S_ZETA', 'shat': 'SHEAR', 'shift': 'SHIFT', 'sn3': 'SHAPE_SIN3', 'sn4': 'SHAPE_SIN4', 'sn5': 'SHAPE_SIN5', 'sn6': 'SHAPE_SIN6', 'zeta': 'ZETA'}#
pyro_neo_mxh_defaults = {'Rmaj': 3.0, 'Z0': 0.0, 'bt_ccw': -1.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, 'ip_ccw': -1.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 GENE 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 NEO input file into a dictionary

Return type:

Dict[str, Any]

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

Reads NEO 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:
verify_file_type(filename)[source]#

Ensure this file is a valid neo 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]#

Writes self.data to an input file

Default version assumes a Fortran90 namelist

Parameters: