Function adas.run_adas309

def run_adas309(adf01=None, mass=0.0, tion=[0.0], dion=[0.0], zeff=[0.0], bmag=[0.0], energy=[0.0], ref_te=0.0, ref_tion=0.0, ref_dens=0.0, ref_dion=0.0, ref_zeff=0.0, ref_bmag=0.0, ref_energy=0.0, nlower=None, nupper=None, adf12=None, elec=False, logfile=None)

Runs the adas309 adf12 bulk production code.

Parameters

adf01 : str
full name of ADAS adf01 charge exchange cross section file
mass : float, optional
atomic mass of the receiver - default taken from xxeiam.
tion : float, array
requested ion temperatures, note te is set to tion
dion : float, array
requested ion densities
zeff : float, array
for re-scaling ion densities
bmag : float, array
magnetic field (note that it is not used in model)
energy : float, array
beam energy components(eV/amu)
tion : float, array
requested ion temperatures
ref_te : float, optional
reference plasma electron temperature, defaults to the median tion value
ref_tion : float, optional
reference plasma ion temperature, defaults to the median tion value
ref_dens : float, optional
reference plasma electron density, defaults to the median dion value
ref_dion : float, optional
reference plasma ion density, defaults to the median dion value
ref_zeff : float, optional
reference plasma Zeff, defaults to the median zeff value
ref_bmag : float, optional
reference plasma magnetic field, defaults to the median bmag value
ref_energy : float, optional
reference beam energy, defaults to the median energy value
nupper : int
upper n-level for CX line transition
nlower : int
lower n-level for CX line transition
elec : boolean
if True use electron impact rather than CX to evaluate coefficient, default is False
adf12 : str
full name of ADAS adf12 output file
logfile : str
name of log file, defaults to no output file

Returns

code : int
success code

Notes

The output of the code is a file in an adf12-style layout for the CX transition nup-nlow. A complete adf12 file requires a first line with the number of data blocks and adjustment of the isel parameter in the header line for each transition included.

There are dimension limits for adf12:

    ndtem = 12  temperatures
    ndden = 24  densities
    ndein = 24  emergies
    ndzef = 12  Zeff
    ndmag = 12  magnetic field

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

References

ADAS manual description of adas309: http://www.adas.ac.uk/man/chap3-09.pdf

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

Version History

  • Martin O'Mullane, 20-07-2020
    • First version

Examples

Make an adf12 file for the 8-7 carbon CX line and examine the first 3 lines. Note that this example places a file, c6.dat, in the local directory.

>>> import adas as adas
>>> import numpy as np
>>> adf01='/home/adas/adas/adf01/qcx#h0/qcx#h0_old#c6.dat'
>>> adas.run_adas309(adf01=adf01, tion=[1e3, 5e3, 10e3],
...                  dion=np.geomspace(1e10, 1e14,4),
...                  energy=np.geomspace(50e3, 90e3, 5),
...                  zeff=[2.5], bmag=[3.0],
...                  nupper=8, nlower=7, adf12='c6.dat')
>>> with open('c6.dat') as f:
...     print(f.readline().strip())
...     print(f.readline().strip())
...     print(f.readline().strip())
ADAS309 20/07/20 D=H(1S)    R= C+6  N= 8-7  F=_old#c6 M=CX     ISEL= 1
1.49D-08                                                     QEFREF
6.71D+04  5.00D+03  4.64D+12  2.50D+00  3.00D+00             PARMREF