pyrokinetics.gk_code.gx.GKInputGX#
- class pyrokinetics.gk_code.gx.GKInputGX(filename=None)[source]#
Bases:
GKInput,FileReaderClass that can read GX input files, and produce Numerics, LocalSpecies, and LocalGeometry objects
Methods
__init__([filename])add_flags(flags)Add extra flags to GX 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 Basic Miller object from GX file
Load LocalSpecies object from GX file
Gather 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 GX input file given as dict Uses default read_dict, which assumes input is a dict
read_from_file(filename[, detect_norm])Reads GX input file into a dictionary
read_str(input_string[, detect_norm])Reads GX input file given as string Uses default read_str, which assumes input_string 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 gx 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- code_name = 'GX'#
- default_file_name = 'input.in'#
- file_type: ClassVar[str] = 'GX'#
- 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 = 'gx'#
Conventionused for normalising this code’s quantities
- pyro_gx_miller = {'Rmaj': ['Geometry', 'Rmaj'], 'beta_prime': ['Geometry', 'betaprim'], 'kappa': ['Geometry', 'akappa'], 'q': ['Geometry', 'qinp'], 'rho': ['Geometry', 'rhoc'], 'shat': ['Geometry', 'shat'], 'shift': ['Geometry', 'shift']}#
- pyro_gx_miller_defaults = {'Rmaj': 1.0, 'beta_prime': 0.0, 'kappa': 1.0, 'q': 1.4, 'rho': 0.5, 'shat': 0.8, 'shift': 0.0}#
- pyro_gx_species = {'dens': 'dens', 'inverse_ln': 'fprim', 'inverse_lt': 'tprim', 'mass': 'mass', 'nu': 'vnewk', 'temp': 'temp', 'z': 'z'}#
- read_dict(input_dict, detect_norm=True)[source]#
Reads GX input file given as dict Uses default read_dict, which assumes input is a dict
- read_str(input_string, detect_norm=True)[source]#
Reads GX input file given as string Uses default read_str, which assumes input_string is a Fortran90 namelist
- set(local_geometry, local_species, numerics, local_norm=None, template_file=None, code_normalisation=None, gpu_optimised_grid=False, **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)
gpu_optimised_grid (bool)