Function adas.adas4xx_ionbal_files

def adas4xx_ionbal_files(elem, year, uid='adas', defyear=None, filter=None, partial=False, files=None)

Construct a list of adf11 filenames for use in ionization balance calculations.

Parameters

elem : str
symbol of element
year : int
year of adf11 data
uid : str, optional
username of adf11 location. Defaults to 'adas' for central ADAS data.
defyear : int, optional
default year of adf11 data if an adf11 file with year does not exist, defaults to 89 if not set
filter : str, optional
filter extension for power files, default is None
partial : boolean, optional
if True the adf11 files, and the calculation, will be metastable-resolved, default is false
files : dict, optional
replace the adf11 files constructed from uid/year/defyear/elem/partial with fully specified filenames - not all file names are required - just those for replacement.
  'acd' : recombination rates
  'scd' : ionization rates
  'ccd' : charge exchange recombination rates
  'qcd' : metastable cross coupling rates, if partial is True
  'xcd' : parent cross coupling rates, if partial is True
  'prb' : recombination power coefficients
  'prc' : CX recombination power coefficients
  'plt' : line power coefficients

Returns

filenames : list
full adf11 filenames given in order as acd, scd, ccd, prb, prc, qcd, xcd and plt.
available : list
a 1 indicates if file exists, 0 if it is not present, same order as filenames
defavailable : list
a 1 indicates if the default file exists, 0 if it is not present, same order as filenames
info : dict
information extracted from acd file
 'elem'    : element symbol
 'iz0'     : atomic number
 'num_meta': the number of metastables present
 'stage'   : list identifting the satge/metastable
 'year'    : year of adf11 data
 'defyear' : default year

Notes

The required adf11 files can be very succinctly specified by a year token and element name. For metastable resolved calculations and those with thermal CX with H0 as a recombination process, more information is required. Complete flexibility in supplying the adf11 files is via the files dictionary.

The routine checks whether each file, either generated from element, year etc., or specified in the input files dictionary exists. The existence of the default file is also checked.

If the acd file exists information on the number of of metastables and a stage/metastable identified (as in adas405 ouptut) is determined. The fall back value is -1 for the number of metastables and "n/a" for their identifier.

This routine is used by run_adas405, run_adas406 and adas4xx_ionbal_tau to generate the required adf11 file.

References

The adas402 code describes the adf11 files and how the year description method works.

ADAS manual description of adas402: http://www.adas.ac.uk/man/chap4-02.pdf

Version History

  • Martin O'Mullane, 07-11-2019

    • First version
  • Martin O'Mullane, 11-10-2022

    • Process bundled files correctly.
    • Add number of stages (iz0 or number of bundles) as appropriate.

Examples

File for Be stage-stage and C metastable resolved calculations.

>>> import adas as adas
>>> fn, av, da, info = adas.adas4xx_ionbal_files('be', 96)
>>> fn
['/home/adas/adas/adf11/acd96/acd96_be.dat',
 '/home/adas/adas/adf11/scd96/scd96_be.dat',
 '/home/adas/adas/adf11/ccd89/ccd89_be.dat',
 '/home/adas/adas/adf11/prb96/prb96_be.dat',
 '/home/adas/adas/adf11/prc89/prc89_be.dat',
 '',
 '',
 '/home/adas/adas/adf11/plt96/plt96_be.dat']
>>> info['num_meta']
5
>>> fn, av, da, info = adas.adas4xx_ionbal_files('c', 96, partial=True)
>>> fn
['/home/adas/adas/adf11/acd96r/acd96r_c.dat',
 '/home/adas/adas/adf11/scd96r/scd96r_c.dat',
 '/home/adas/adas/adf11/ccd96r/ccd96r_c.dat',
 '/home/adas/adas/adf11/prb96r/prb96r_c.dat',
 '/home/adas/adas/adf11/prc96r/prc96r_c.dat',
 '/home/adas/adas/adf11/qcd96r/qcd96r_c.dat',
 '/home/adas/adas/adf11/xcd96r/xcd96r_c.dat',
 '/home/adas/adas/adf11/plt96r/plt96r_c.dat']
>>> info['num_meta']
13