pyrokinetics.equilibrium.geqdsk.EquilibriumReaderGEQDSK#
- class pyrokinetics.equilibrium.geqdsk.EquilibriumReaderGEQDSK[source]#
Bases:
FileReaderClass that can read G-EQDSK equilibrium files and return
Equilibriumobjects. Users are not recommended to instantiate this class directly, and should instead use the functionsread_equilibriumorEquilibrium.from_file. Keyword arguments passed to those functions will be forwarded to this class.Here we assume the convention COCOS 1 [Sauter & Medvedev, 2013]. However, EFIT uses COCOS 3, and other codes may follow other standards.
Some G-EQDSK files may not read correctly, as it is not possible to fit a closed contour on the Last Closed Flux Surface (LCFS). In these cases, the user may provide the argument
psi_n_lcfs=0.99(or something similarly close to 1) which adjusts the \(\psi\) grid so that only values in the range \([\psi_\text{axis},\psi_\text{axis}+0.99(\psi_\text{LCFS}-\psi_\text{axis})]\) are included.It is not possible to determine the coordinate system used by a G-EQDSK file from its own data alone. By default, we assume that the toroidal angle \(\phi\) increases in an anti-clockwise direction when the tokamak is viewed from above. If the G-EQDSK file originates from a code that uses the opposite convention, the user should set
clockwise_phitoTrue. Alternatively, if the COCOS convention of the G-EQDSK file is known, this should be supplied to the optionalcocosargument.See also
EquilibriumClass representing a global tokamak equilibrium.
read_equilibriumRead an equilibrium file, return an
Equilibrium.
- __init__()#
Methods
__init__()read_from_file(filename[, psi_n_lcfs, ...])Read in G-EQDSK file and populate Equilibrium object.
verify_file_type(filename)Quickly verify that we're looking at a GEQDSK file without processing
Attributes
- file_type: ClassVar[str] = 'GEQDSK'#
- read_from_file(filename, psi_n_lcfs=1.0, clockwise_phi=False, cocos=None, a_minor_tolerance=0.05)[source]#
Read in G-EQDSK file and populate Equilibrium object. Should not be invoked directly; users should instead use
read_equilibrium.- Parameters:
filename (
PathLike) – Location of the G-EQDSK file on disk.psi_n_lcfs (
float, default1.0) – Adjust which flux surface we consider to be the last closed flux surface (LCFS). Should take a value between 0.0 and 1.0 inclusive.clockwise_phi (
bool, defaultFalse) – Determines whether the \(\phi\) grid increases clockwise or anti-clockwise when the tokamak is viewed from above.cocos (
Optional[int]) – If set, asserts that the GEQDSK file follows that COCOS convention, and neitherclockwise_phinor the file contents will be used to identify the actual convention in use. The resulting Equilibrium is always converted to COCOS 11.a_minor_tolerance (
Optional[float]) – Maximum allowed relative tolerance on calculated a minor and the extrapolated a minor from inner surfaces to catch cases where divertor legs are in the contour fit for the LCFS
- Return type:
Equilibrium