Function adas.xxdata_12

def xxdata_12(file=None)

Reads an adf12 charge exchange enmissivity (QEF) file and returns all of its contents in a dictionary.

Parameters

file : str
full name of ADAS adf12 file

Returns

fulldata : dict
contents of the adf12 file
    'file'     :  adf12 filename
    'nbsel'    :  number of transitions in file
    'csymb'    :  element symbol
                    string array(nbsel)
    'czion'    :  emitting ion charge
                    string array(nbsel)
    'cwavel'   :  wavelength (A)
                    string array(nbsel)
    'cdonor'   :  donor neutral atom
                    string array(nbsel)
    'crecvr'   :  receiver nucleus
                    string array(nbsel)
    'ctrans'   :  transition
                    string array(nbsel)
    'cfile'    :  specific ion file source
                    string array(nbsel)
    'ctype'    :  type of emissivity
                    string array(nbsel)
    'cindm'    :  emissivity index
                    string array(nbsel)
    'qefref'   :  reference value of rate coefficient
                     float array(nbsel)
    'enref'    :  reference value of energy
                     float array(nbsel)
    'teref'    :  reference value of temperature
                     float array(nbsel)
    'deref'    :  reference value of density
                     float array(nbsel)
    'zeref'    :  reference value of effective z
                     float array(nbsel)
    'bmref'    :  reference value of magnetic field
                     float array(nbsel)
    'nenera'   :  number of energies
                     float array(nbsel)
    'ntempa'   :  number of temperatures
                     float array(nbsel)
    'ndensa'   :  number of densities
                     float array(nbsel)
    'nzeffa'   :  number of effective z
                     float array(nbsel)
    'nbmaga'   :  number of magnetic field values
                     float array(nbsel)
    'enera'    :  energies
                     float array(ndein, nbsel)
    'tempa'    :  temperatures
                     float array(ndtem, nbsel)
    'densa'    :  densities
                     float array(ndden, nbsel)
    'zeffa'    :  effective z
                     float array(ndzef, nbsel)
    'bmaga'    :  magnetic field
                     float array(ndmag, nbsel)
    'qenera'   :  rate coefficients for energy value
                     float array(ndein, nbsel)
    'qtempa'   :  rate coefficients for temperatures
                     float array(ndtem, nbsel)
    'qdensa'   :  rate coefficients for densities
                     float array(ndden, nbsel)
    'qzeffa'   :  rate coefficients for effective z
                     float array(ndzef, nbsel)
    'qbmaga'   :  rate coefficients for magnetic fields
                     float array(ndmag, nbsel)

Notes

The dimension of the quantities in the dictionary are currently,

ndtem = 12 ndden = 24 ndein = 24 ndzef = 12 ndmag = 12 nstore = 1000 iunit = 67

Calls a fortran based shared object file - not pure python.

References

ADAS manual description of adf12: http://www.adas.ac.uk/man/appxa-12.pdf

Version History

  • Martin O'Mullane, 16-12-2012

    • First version
  • Martin O'Mullane, 03-01-2020

    • Arrays in fulldata were too short by one element.
    • Decode string arrays in fulldata.
  • Martin O'Mullane, 16-01-2020

    • Allow 1000 blocks in adf12 file which can be needed for adas316 produced data.
  • Martin O'Mullane, 26-02-2021

    • Replace nulls with empty strings if no data is present.
    • Capitalize csymb and set to uppercase cdonor, crecvr and ctype.
    • Extracting the element (csymb) from older style adf12 files is problematic so parse crecvr for these files.

Example

C6+ 8-7 transition is block 5.

>>> import adas as adas
>>> file='/home/adas/adas/adf12/qef93#h/qef93#h_c6.dat'
>>> fulldata = adas.xxdata_02(file)
>>> fulldata['ctrans'][4]
'8-7'
>>> fulldata['enera'][0:fulldata['nenera'][4], 4]
array([  1000.,   1500.,   2000.,   3000.,   5000.,   7000.,  10000.,
        15000.,  20000.,  30000.,  40000.,  50000.,  60000.,  70000.,
        80000., 100000., 150000., 200000., 300000.])
>>> fulldata['qenera'][0:fulldata['nenera'][4], 4]
array([1.19e-11, 1.90e-11, 2.54e-11, 3.52e-11, 6.93e-11, 1.38e-10,
       2.84e-10, 6.77e-10, 1.50e-09, 4.81e-09, 9.91e-09, 1.24e-08,
       1.23e-08, 1.16e-08, 1.03e-08, 7.26e-09, 2.53e-09, 1.05e-09,
       2.35e-10])