Function adas.run_adas208

def run_adas208(adf04=None, adf18=None, te=[0.0], tion=[0.0], th=[0.0], unit_te='ev', dens=[0.0], dion=[0.0], denh=[0.0], unit_dens='cm-3', zeff=0.0, ratio_p1=None, meta=[1], nonorm=False, wmin=[0.01], wmax=[9000.0], amin=[100.0], tr_upper=[0], tr_lower=[0], pass_dir='./', logfile=None, ion=False, rec=False, cx=False, gcr=False, pec=False, sxb=False)

Runs the adas208 population and GCR production code.

Parameters

adf04 : str
full name of ADAS adf04 specific ion file
adf18 : str
full name of ADAS adf18 projection mapping file
te : float, array
requested electron temperatures
tion : float, array
requested ion temperatures
th : float, array
requested neutral hydrogen temperatures
unit_te : str
'ev', 'kelvin' or 'red', default to eV
dens : float, array
requested electron densities
dion : float, array
requested ion densities
denh : float, array
requested hydrogen densities
unit_dens : str
'cm-3' or 'red', defaults to cm-3
zeff : float
for scaling ion collisions if dion set
ratio_p1 : float, array
ratio of recombining stage for each metastable for the requested electron densities, defaults to 1.0 for ground of N(z+1)
meta : int, array
indices of metastable levels (start at 1), default is [1]
nonorm : boolean
if set to True do not normalise population to the ground for the single metastable case, default is False (ie normalize)
wmin : float, array
lower wavelength(A) for PEC/SXB output files, defaults to 0.01A
wmax : float, array
upper wavelength(A) for PEC/SXB output files, defaults to 9000.0A
amin : float, array
minimum A value for PEC/SXB output files, defaults to 100.0 s-1
tr_upper : int, array
upper indices for transitions in PEC/SXB output file, this over-rides wmin/wmax/amin choice.
tr_lower : int, array
lower indices for transitions in PEC/SXB output file, this over-rides wmin/wmax/amin choice.
pass_dir : str
passing file directory for gcr output files, defaults to the current directory ('./')
logfile : str
name of log file, defaults to no output file
ion : boolean
if True include ionisation from excited levels (S-lines), defaults to not including process
rec : boolean
if True use recombination data (R-lines), defaults to not including process
cx : boolean
if True use cx data (H-lines), defaults to not including process
gcr : boolean
if True output GCR set of file to pass_dir, default is not to output files
pec : boolean
if True output pec data to pass_dir as pec.pass, default is not to output file
sxb : boolean
if True output sxb data to pass_dir as sxb.pass, default is not to output file

Returns

pop : dict
results of the population model
    'numlev'      : number of ordinary levels
    'nummet'      : number of metastables
    'levels'      : identifier (configuration + quantum numbers)
                    of ordinary levels
    'metastables' : identifier (configuration + quantum numbers) of metastables
    'dependence'  : population dependence on metastables,
                    array of dimentsions (nord, nmet, nte, ndens)

Notes

adas208 is the generalized collisional-radiative (GCR) population model.

If gcr=True partial adf10 file for source and radiation coefficients are produced. These have fixed names: acd208.pass, scd208.pass, ccd208.pass, qcd208.pass, xcd208.pass, plt208.pass, prb208.pass, prc208.pass and met208.pass.

PEC (adf15) and S/XB (adf13) files are produced depending on pec and sxb settings. The transitions included by default are the top 50 contributing to the total power. However data for specific transitions can be produced by setting tr_upper and tr_lower or by bracketing in wavelength by setting wmin and wmax.

The ratio of stage populations of the recombining stage, ratio_p1, may be set for each metastable. This only affects the returned population and not the GCR, PEC or SXB data.

Calls a fortran executable code and communicates via a bi-directional pipe connected to stdout.

References

ADAS manual description of adas208: http://www.adas.ac.uk/man/chap2-08.pdf

Version History

  • Martin O'Mullane, 23-06-2017

    • First version
  • Martin O'Mullane, 16-07-2018

    • Zeff was passed to fortran incorrectly when it was 0.0.
    • Return levels and metastables as strings.
  • Martin O'Mullane, 03-08-2018

    • Allow up to 13 metastables.
  • Martin O'Mullane, 27-09-2018

    • Allow user to directly specify which transitions are to be included in adf15 file.
    • Set imetr back to int (problem fixed in adas_write_pipe).
  • Martin O'Mullane, 19-11-2019

    • nonorm logic was inverted.
  • Martin O'Mullane, 19-03-2024

    • Add ratio_p1, the ratio of the recombining stage.
    • Re-position the dimension check.

Examples

Calculate population of He-like oxygen including projection in metastable resolution. Show dependence of the 1s 2p 1P excited level on the 1s 2s 3S metastable.

>>> import adas as adas
>>> adf04='/home/adas/adas/adf04/adas#8/cop98#8_ls#o6.dat'
>>> adf18='/home/adas/adas/adf18/a17_p208/exp96#he/exp96#he_o6ls.dat'
>>> te=[30.0, 50.0, 100.0, 300.0]
>>> dens=[1e8, 1e14]
>>> pop=adas.run_adas208(adf04=adf04, adf18=adf18,
...                      meta=[1,2], te=te, dens=dens)
>>> pop['levels'][2]
'1S1 2P1     (1)P( 1.0)'
>>> pop['dependence'][2,1,:,:]
array([[2.70099696e-16, 2.76017570e-10],
       [7.61792581e-16, 7.74141140e-10],
       [1.36418690e-15, 1.37558775e-09],
       [1.16373211e-15, 1.15758336e-09]])