aeqdsk#

Note

This documentation is incomplete. If you have information that could be added, please get in touch or a raise a pull request!

Warning

Sources do not agree on which values are stored in an A-EQDSK file, and in which order they are written. This implementation is based on A-EQDSK readers from FreeGS and eq_tools, but may not be appropriate for all A-EQDSK files.

If you have information that could help us alleviate this issue, please get in touch. A primary source recording which fields are included would be extremely helpful.

A-EQDSK files contain a wide variety of diagnostic data. It begins with a specially formatted header over the first 4 lines which contains:

  • header: First row of the file

  • shot: int, The shot number

  • time: int, The time in milliseconds

  • jflag: int, 0 if error

  • iflag: int, >0 if error

  • limloc: str, IN/OUT/TOP/BOT: limiter inside/outside/top/bot SNT/SNB: single null top/bottom DN: double null.

  • mco2v: int, number of vertical CO2 laser chords. Should match length of arrays rco2v and dco2v.

  • mco2r: int, number of radial CO2 laser chords. Should match length of arrays rco2r and dco2r.

  • qmflag, str: axial q(0) flag, FIX if constrained and CLC for float

This is followed by a collection of variables expressed as floats, written 4 per line with a space at the beginning following the Fortran format (e17.9,3e16.9):

Initial block#

Name

Default Value

Description

tsaisq

0.0

total chi2 from magnetic probes, flux loops, Rogowski and external coils

rcencm

100.0

major radius in cm for vacuum field BCENTR

bcentr

1.0

vacuum toroidal magnetic field in Tesla at RCENCM

pasmat

1000000.0

measured plasma toroidal current in Ampere

cpasma

1000000.0

fitted plasma toroidal current in Ampere-turn

rout

100.0

major radius of geometric center in cm

zout

0.0

Z of geometric center in cm

aout

50.0

plasma minor radius in cm

eout

1.0

Plasma boundary elongation

doutu

1.0

upper triangularity

doutl

1.0

lower triangularity

vout

1000.0

plasma volume in cm3

rcurrt

100.0

major radius in cm of current centroid

zcurrt

0.0

Z in cm at current centroid

qsta

5.0

equivalent safety factor q*

betat

1.0

toroidal beta in %

betap

1.0

poloidal beta with normalization average poloidal magnetic BPOLAV defined through Ampere’s law

ali

0.0

li with normalization average poloidal magnetic defined through Ampere’s law

oleft

10.0

plasma inner gap in cm

oright

10.0

plasma outer gap in cm

otop

10.0

plasma top gap in cm

obott

10.0

plasma bottom gap in cm

qpsib

5.0

q at 95% of poloidal flux

vertn

1.0

vacuum field (index? seems to be float) at current centroid

The next data block describes data related to CO2 lasers in the form of 4 1D arrays. These are similarly expressed 4-floats-per-line, with blank spaces on the last line if the array length is not a multiple of 4:

CO2 lasers#

Name

Default Value

Description

rco2v

mco2v * [0.0]

1D array : path length in cm of vertical CO2 density chord

dco2v

mco2v * [0.0]

line average electron density in cm3 from vertical CO2 chord

rco2r

mco2r * [0.0]

path length in cm of radial CO2 density chord

dco2r

mco2r * [0.0]

line average electron density in cm3 from radial CO2 chord

This is followed by another general data block:

Second general block#

Name

Default Value

Description

shearb

0.0

bpolav

1.0

average poloidal magnetic field in Tesla defined through Ampere’s law

s1

0.0

Shafranov boundary line integrals

s2

0.0

Shafranov boundary line integrals

s3

0.0

Shafranov boundary line integrals

qout

0.0

q at plasma boundary

olefs

0.0

orighs

0.0

outer gap of external second separatrix in cm

otops

0.0

top gap of external second separatrix in cm

sibdry

1.0

areao

100.0

cross sectional area in cm2

wplasm

0.0

terror

0.0

equilibrium convergence error

elongm

0.0

elongation at magnetic axis

qqmagx

0.0

axial safety factor q(0)

cdflux

0.0

computed diamagnetic flux in Volt-sec

alpha

0.0

Shafranov boundary line integral parameter

rttt

0.0

Shafranov boundary line integral parameter

psiref

1.0

reference poloidal flux in VS/rad

xndnt

0.0

vertical stability parameter, vacuum field index normalized to critical index value

rseps1

1.0

major radius of x point in cm

zseps1

-1.0

rseps2

1.0

major radius of x point in cm

zseps2

1.0

sepexp

0.0

separatrix radial expansion in cm

obots

0.0

bottom gap of external second separatrix in cm

btaxp

1.0

toroidal magnetic field at magnetic axis in Tesla

btaxv

1.0

vacuum toroidal magnetic field at magnetic axis in Tesla

aaq1

100.0

minor radius of q=1 surface in cm, 100 if not found

aaq2

100.0

minor radius of q=2 surface in cm, 100 if not found

aaq3

100.0

minor radius of q=3 surface in cm, 100 if not found

seplim

0.0

> 0 for minimum gap in cm in divertor configurations, < 0 absolute value for minimum distance to external separatrix in limiter configurations

rmagx

100.0

major radius in cm at magnetic axis

zmagx

0.0

simagx

0.0

Poloidal flux at the magnetic axis

taumhd

0.0

energy confinement time in ms

betapd

0.0

diamagnetic poloidal b

betatd

0.0

diamagnetic toroidal b in %

wplasmd

0.0

diamagnetic plasma stored energy in Joule

diamag

0.0

measured diamagnetic flux in Volt-sec

vloopt

0.0

measured loop voltage in volt

taudia

0.0

diamagnetic energy confinement time in ms

qmerci

0.0

Mercier stability criterion on axial q(0), q(0) > QMERCI for stability

tavem

0.0

average time in ms for magnetic and MSE data

The following parts of an A-EQDSK file are not present in old versions of the file. The next line describes the lengths of 4 further arrays using 4 ints in the Fortran format ‘(i6,3i5)’:

Extended section sizes#

Name

Default Value

Description

nsilop

len(csilop)

Number of flux loop signals, len(csilop)

magpri

len(cmpr2)

Number of flux loop signals, len(cmpr2) (added to nsilop)

nfcoil

len(ccbrsp)

Number of calculated external coil currents, len(ccbrsp)

nesum

len(eccurt)

Number of measured E-coil currents

The next two arrays are stored in a concatenated fashion, so there is no newline between them if the length of the first array is not a multiple of four:

Extended arrays 1#

Name

Default Value

Description

csilop

nsilop * [0.0]

computed flux loop signals in Weber

cmpr2

magpri * [0.0]

The following two arrays are stored similarly to the laser data:

Extended arrays 2#

Name

Default Value

Description

ccbrsp

nfcoil * [0.0]

computed external coil currents in Ampere

eccurt

nesum * [0.0]

measured E-coil current in Ampere

The rest of the file consists of a further general data block. The total amount of variables depends on the exact A-EQDSK version:

Extended general block#

Name

Default Value

Description

pbinj

0.0

neutral beam injection power in Watts

rvsin

0.0

major radius of vessel inner hit spot in cm

zvsin

0.0

Z of vessel inner hit spot in cm

rvsout

0.0

major radius of vessel outer hit spot in cm

zvsout

0.0

Z of vessel outer hit spot in cm

vsurfa

0.0

plasma surface loop voltage in volt, E EQDSK only

wpdot

0.0

time derivative of plasma stored energy in Watt, E EQDSK only

wbdot

0.0

time derivative of poloidal magnetic energy in Watt, E EQDSK only

slantu

0.0

slantl

0.0

zuperts

0.0

chipre

0.0

total chi2 pressure

cjor95

0.0

pp95

0.0

normalized P’(y) at 95% normalized poloidal flux

ssep

0.0

yyy2

0.0

Shafranov Y2 current moment

xnnc

0.0

cprof

0.0

current profile parametrization parameter

oring

0.0

not used

cjor0

0.0

normalized flux surface average current density at 99% of normalized poloidal flux

fexpan

0.0

flux expansion at x point

qqmin

0.0

minimum safety factor qmin

chigamt

0.0

total chi2 MSE

ssi01

0.0

magnetic shear at 1% of normalized poloidal flux

fexpvs

0.0

flux expansion at outer lower vessel hit spot

sepnose

0.0

radial distance in cm between x point and external field line at ZNOSE

ssi95

0.0

magnetic shear at 95% of normalized poloidal flux

rqqmin

0.0

normalized radius of qmin , square root of normalized volume

cjor99

0.0

cj1ave

0.0

normalized average current density in plasma outer 5% normalized poloidal flux region

rmidin

0.0

inner major radius in m at Z=0.0

rmidout

0.0

outer major radius in m at Z=0.0

psurfa

0.0

plasma boundary surface area, m^2

peak

0.0

peak to average plasma pressure

dminux

0.0

distance between limiter and upper x-point

dminlx

0.0

distance between limiter and lower x-point

dolubaf

0.0

distance from outer leg to upper baffle

dolubafm

0.0

distance at outboard midplane between last closed flux surface and the flux surface interesecting the upper baffle

diludom

0.0

distance from inner leg to upper dome

diludomm

0.0

distance at inner midplane between the last closed flux surface and the flux surface intersecting the upper dome

ratsol

0.0

ratio of flux expansion at inner midplane vs outer midplane

rvsiu

0.0

major radius of inner upper strikepoint

zvsiu

0.0

Z of inner upper strikepoint

rvsid

0.0

major radius of inner lower strikepoint

zvsid

0.0

Z of inner lower strikepoint

rvsou

0.0

major radius of outer upper strikepoint

zvsou

0.0

Z of outer upper strike point

rvsod

0.0

major radius of outer lower strike point

zvsod

0.0

Z of outer lower strike point

condno

0.0

condition number from least-squares fitting routine

dollbaf

0.0

distance from outer leg to lower baffle

dollbafm

0.0

distance from outer midplane last closed flux surface to the flux surface intersecting the lower baffle

dilldom

0.0

distance from inner leg to lower dome

dilldomm

0.0

distance from inner midplane last closed flux surface and the flux surface intersecting the lower dome

dummy_1

0.0

Purpose unknown

dummy_2

0.0

Purpose unknown

freeqdsk.aeqdsk.read(fh, data_fmt=None, extended_sizes_fmt=None)#

Read an A-EQDSK file, returning a dictionary of data.

Parameters:
  • fh (TextIO) – File handle to write to. Should be opened in a text read mode, i.e. open(filename, "r").

  • data_fmt (Optional[str] (default: None)) – Fortran IO format for A-EQDSK data. If not provided, uses (e17.9,3e16.9).

  • extended_sizes_fmt (Optional[str] (default: None)) – Fortran IO format for the line specifying array lengths in the extended portion of the A-EQDSK file. If not provided, uses (i6,3i5).

Return type:

Dict[str, Union[int, float, ndarray]]

freeqdsk.aeqdsk.write(data, fh, data_fmt=None, extended_sizes_fmt=None, time_fmt=None)#

Write a dict of A-EQDSK data to a file.

Parameters:
  • data (Dict[str, Union[float, int, _SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]]) – The A-EQDSK data to write to disk. It may also include header information.

  • fh (TextIO) – File handle. Should be in a text write mode, i.e.``open(filename, “w”)``.

  • data_fmt (Optional[str] (default: None)) – Fortran IO format for A-EQDSK data. If not provided, uses (e17.9,3e16.9).

  • extended_sizes_fmt (Optional[str] (default: None)) – Fortran IO format for the line specifying array lengths in the extended portion of the A-EQDSK file. If not provided, uses (i6,3i5).

  • time_fmt (Optional[str] (default: None)) – Fortran IO format for time stamps. If not provided, uses (e17.9).

Return type:

None

class freeqdsk.aeqdsk.Field(name, description='', default=None, has_length=None, length_of=None)#

Helper dataclass for defining each entry in a A-EQDSK file.

default: Optional[float] = None#

Default value to be assigned to missing fields when writing out an A-EQDSK dict. If set to None, the attributes has_length and length_of are used to determine a default

description: str = ''#

Description of the field.

has_length: Optional[str] = None#

If default is None and has_length is not None, the default value is determined by looking up the key assigned to has_length, and creating a list of 0.0 with that length. If this key does not exist, sets the value to [].

length_of: Optional[str] = None#

If default is None and length_of is not None, the default value is determined by looking up the key assigned to length_of, and returning the length of the result. If this key does not exist, sets the value to 0.

name: str#

Name of the field used in the resulting dict.

freeqdsk.aeqdsk.fields()#

Returns full list of all Fields.

Return type:

Dict[str, Field]