pyrokinetics.gk_code.gene.GKInputGENE#
- class pyrokinetics.gk_code.gene.GKInputGENE(filename=None)[source]#
Bases:
GKInput,FileReaderClass that can read GENE input files, and produce Numerics, LocalSpecies, and LocalGeometry objects
Methods
__init__([filename])add_flags(flags)Add extra flags to GENE input file Uses default, which assumes a Fortan90 namelist
from_file(path[, file_type])Read a file from disk, returning an instance of this class.
from_str(input_string)Returns local geometry.
Load LocalSpecies object from GENE file
Returns a list of the local species names :returns: names -- List of local species names :rtype:
ArrayGather numerical info (grid spacing, time steps, etc)
get_reference_values(local_norm)Reads in reference values from input file
is_linear()Return true if the GKCode is nonlinear, otherwise return False
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 GENE input file into a dictionary Uses default read, which assumes input is a Fortran90 namelist
read_str(input_string[, detect_norm])Reads GENE input file given as string Uses default read_str, which assumes input is a Fortran90 namelist
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 gene input file, and that it contains sufficient info for Pyrokinetics to work with
write(filename[, float_format, local_norm, ...])Write self.data to a gyrokinetics input file.
Attributes
Conventionused for normalising this code's quantities- add_flags(flags)[source]#
Add extra flags to GENE input file Uses default, which assumes a Fortan90 namelist
- Return type:
- code_name = 'GENE'#
- default_file_name = 'input.gene'#
- file_type: ClassVar[str] = 'GENE'#
- get_local_geometry()[source]#
Returns local geometry. Delegates to more specific functions
- Return type:
- get_local_species_names()[source]#
Returns a list of the local species names :returns: names – List of local species names :rtype:
Array
- get_reference_values(local_norm)[source]#
Reads in reference values from input file
- Return type:
- Parameters:
local_norm (SimulationNormalisation)
- norm_convention: str = 'gene'#
Conventionused for normalising this code’s quantities
- pyro_gene_circular = {'bt_ccw': ['geometry', 'sign_bt_cw'], 'ip_ccw': ['geometry', 'sign_ip_cw'], 'q': ['geometry', 'q0'], 'shat': ['geometry', 'shat']}#
- pyro_gene_circular_default = {'bt_ccw': -1, 'ip_ccw': -1, 'q': None, 'shat': 0.0}#
- pyro_gene_fourier = {'bt_ccw': ['geometry', 'sign_ip_cw'], 'cN': ['geometry', 'cn_m'], 'dcNdr': ['geometry', 'cndr_m'], 'dsNdr': ['geometry', 'sndr_m'], 'ip_ccw': ['geometry', 'sign_ip_cw'], 'q': ['geometry', 'q0'], 'sN': ['geometry', 'sn_m'], 'shat': ['geometry', 'shat']}#
- pyro_gene_fourier_default = {'bt_ccw': -1, 'cN': [0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'dcNdr': [0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'dsNdr': [0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'ip_ccw': -1, 'q': None, 'sN': [0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'shat': 0.0}#
- pyro_gene_miller = {'bt_ccw': ['geometry', 'sign_bt_cw'], 'dZ0dr': ['geometry', 'drz'], 'delta': ['geometry', 'delta'], 'ip_ccw': ['geometry', 'sign_ip_cw'], 'kappa': ['geometry', 'kappa'], 'q': ['geometry', 'q0'], 's_delta': ['geometry', 's_delta'], 's_kappa': ['geometry', 's_kappa'], 'shat': ['geometry', 'shat'], 'shift': ['geometry', 'drr']}#
- pyro_gene_miller_default = {'bt_ccw': -1, 'dZ0dr': 0.0, 'delta': 0.0, 'ip_ccw': -1, 'kappa': 1.0, 'q': None, 's_delta': 0.0, 's_kappa': 0.0, 'shat': 0.0, 'shift': 0.0}#
- pyro_gene_miller_turnbull = {'bt_ccw': ['geometry', 'sign_bt_cw'], 'dZ0dr': ['geometry', 'drz'], 'delta': ['geometry', 'delta'], 'ip_ccw': ['geometry', 'sign_ip_cw'], 'kappa': ['geometry', 'kappa'], 'q': ['geometry', 'q0'], 's_delta': ['geometry', 's_delta'], 's_kappa': ['geometry', 's_kappa'], 's_zeta': ['geometry', 's_zeta'], 'shat': ['geometry', 'shat'], 'shift': ['geometry', 'drr'], 'zeta': ['geometry', 'zeta']}#
- pyro_gene_miller_turnbull_default = {'bt_ccw': -1, 'dZ0dr': 0.0, 'delta': 0.0, 'ip_ccw': -1, 'kappa': 1.0, 'q': None, 's_delta': 0.0, 's_kappa': 0.0, 's_zeta': 0.0, 'shat': 0.0, 'shift': 0.0, 'zeta': 0.0}#
- pyro_gene_mxh = {'bt_ccw': ['geometry', 'sign_bt_cw'], 'cn': ['geometry', 'cN_m'], 'dZ0dr': ['geometry', 'drz'], 'dcndr': ['geometry', 'cNdr_m'], 'dsndr': ['geometry', 'sNdr_m'], 'ip_ccw': ['geometry', 'sign_ip_cw'], 'kappa': ['geometry', 'kappa'], 'q': ['geometry', 'q0'], 's_kappa': ['geometry', 's_kappa'], 'shat': ['geometry', 'shat'], 'shift': ['geometry', 'drr'], 'sn': ['geometry', 'sN_m']}#
- pyro_gene_mxh_default = {'bt_ccw': -1, 'cn': [0.0, 0.0, 0.0, 0.0], 'dZ0dr': 0.0, 'dcndr': [0.0, 0.0, 0.0, 0.0], 'dsndr': [0.0, 0.0, 0.0, 0.0], 'ip_ccw': -1, 'kappa': 1.0, 'q': None, 's_kappa': 0.0, 'shat': 0.0, 'shift': 0.0, 'sn': [0.0, 0.0, 0.0, 0.0]}#
- pyro_gene_species = {'dens': 'dens', 'inverse_ln': 'omn', 'inverse_lt': 'omt', 'mass': 'mass', 'temp': 'temp', 'z': 'charge'}#
- 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
- read_from_file(filename, detect_norm=True)[source]#
Reads GENE input file into a dictionary Uses default read, which assumes input is a Fortran90 namelist
- read_str(input_string, detect_norm=True)[source]#
Reads GENE input file given as string Uses default read_str, which assumes input is a Fortran90 namelist
- 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)
- verify_file_type(filename)[source]#
Ensure this file is a valid gene input file, and that it contains sufficient info for Pyrokinetics to work with
- write(filename, float_format='', local_norm=None, code_normalisation=None)[source]#
Write self.data to a gyrokinetics input file. Uses default write, which writes to a Fortan90 namelist
- Parameters:
float_format (str)
local_norm (SimulationNormalisation | None)
code_normalisation (str | None)