pyrokinetics.gk_code.cgyro.GKInputCGYRO#
- class pyrokinetics.gk_code.cgyro.GKInputCGYRO(filename=None)[source]#
Bases:
GKInput,FileReaderClass that can read CGYRO input files, and produce Numerics, LocalSpecies, and LocalGeometry objects
Methods
__init__([filename])add_flags(flags)Add extra flags to CGYRO input file
from_file(path[, file_type])Read a file from disk, returning an instance of this class.
from_str(input_string)Returns local geometry.
Load Fourier object from CGYRO file
Load Miller object from CGYRO file
Load MXH object from CGYRO file
Load LocalSpecies object from CGYRO file
Gather numerical info (grid spacing, time steps, etc)
get_pyro_cgyro_species([iSp])get_reference_values(local_norm)Reads in reference values from input file
is_linear()Return true if the GKCode is nonlinear, otherwise return False
parse_cgyro(lines)Given lines of a cgyro file or a string split by '/n', return a dict of CGYRO 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 CGYRO input file into a dictionary
read_str(input_string[, detect_norm])Reads CGYRO input file given as string
set(local_geometry, local_species, numerics)Set self.data using LocalGeometry, LocalSpecies, and Numerics.
set_legacy_cgyro(flag)Set dictionay flags used to access namelist to legacy values or not
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 cgyro 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
Conventionused for normalising this code's quantities- cgyro_eq_types = {1: 'SAlpha', 2: 'MXH', 3: 'Fourier'}#
- code_name = 'CGYRO'#
- default_file_name = 'input.cgyro'#
- file_type: ClassVar[str] = 'CGYRO'#
- get_local_geometry()[source]#
Returns local geometry. Delegates to more specific functions
- Return type:
- get_reference_values(local_norm)[source]#
Reads in reference values from input file
- Return type:
- Parameters:
local_norm (SimulationNormalisation)
- norm_convention: str = 'cgyro'#
Conventionused for normalising this code’s quantities
- static parse_cgyro(lines)[source]#
Given lines of a cgyro file or a string split by ‘/n’, return a dict of CGYRO input data
- pyro_cgyro_fourier = {'Rmaj': 'RMAJ', 'Z0': 'ZMAG', 'bt_ccw': 'BTCCW', 'dZ0dr': 'DZMAG', 'delta': 'DELTA', 'ip_ccw': 'IPCCW', 'kappa': 'KAPPA', 'q': 'Q', 'rho': 'RMIN', 's_delta': 'S_DELTA', 's_kappa': 'S_KAPPA', 'shat': 'S', 'shift': 'SHIFT'}#
- pyro_cgyro_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_cgyro_miller = {'Rmaj': 'RMAJ', 'Z0': 'ZMAG', 'bt_ccw': 'BTCCW', 'dZ0dr': 'DZMAG', 'delta': 'DELTA', 'ip_ccw': 'IPCCW', 'kappa': 'KAPPA', 'q': 'Q', 'rho': 'RMIN', 's_delta': 'S_DELTA', 's_kappa': 'S_KAPPA', 'shat': 'S', 'shift': 'SHIFT'}#
- pyro_cgyro_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_cgyro_mxh = {'Rmaj': 'RMAJ', 'Z0': 'ZMAG', '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': 'DZMAG', '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', 's_delta': 'S_DELTA', 's_kappa': 'S_KAPPA', 's_zeta': 'S_ZETA', 'shat': 'S', 'shift': 'SHIFT', 'sn3': 'SHAPE_SIN3', 'sn4': 'SHAPE_SIN4', 'sn5': 'SHAPE_SIN5', 'sn6': 'SHAPE_SIN6', 'zeta': 'ZETA'}#
- pyro_cgyro_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
- 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:
local_geometry (LocalGeometry)
local_species (LocalSpecies)
numerics (Numerics)
local_norm (SimulationNormalisation | None)
code_normalisation (str | None)
- set_legacy_cgyro(flag)[source]#
Set dictionay flags used to access namelist to legacy values or not
- Parameters:
flag (bool)