Function adas.run_adas406
def run_adas406(uid='adas', year=None, elem=None, defyear=89, filter=None, partial=False, mh=1.0, mz=1.0, files=None, meta=None, tint=None, te=[0.0], dens=[0.0], unit_te='ev', all=False, tion=[0.0], denh=[0.0], cx=False, logfile=None)
-
Runs the adas406 time dependent ionization balance code.
Parameters
uid
:str
- username of adf11 location. Defaults to 'adas' for central ADAS data.
year
:int
- year of adf11 data
elem
:str
- symbol of element
defyear
:int
- default year of adf11 data if an adf11 file with year does not exist, defaults to 89 if not set
filter
:str
- filter extension for power files, default is None
partial
:boolean
- if True the adf11 files, and the calculation, will be metastable-resolved, default is false
mh
:float
- hydrogen isotope mass, needed for CX
mz
:float
- element isotope mass, needed for CX
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
meta
:float, array
, optional- initial fractional abundances at t=0sec, defaults to all being in the ground stage/metastable.
tint
:float
- integration time (sec)
te
:float, array
- requested temperatures (eV)
dens
:float, array
- requested densities (cm-3)
unit_te
:str
, optional- units, eV or K, for temperature, default is 'ev'
all
:boolean
- if True evaluate as 2D (te,dens), default is False
tion
:float, array
, optional- requested ion temperatures (eV), needed for CX
denh
:float, array
, optional- requested densities (cm-3), needed for CX
cx
:boolean
- if True include thermal CX as a recombination process, default is False
logfile
:str
- name of log file, defaults to no output file
Returns
frac
:dict
- fractional abundances
'stage' : labels of ion/metastable descriptors 'ion' : equilibrium abundances
energy
:dict
- excess or defecit of energy over equilibrium
up to tint and its components
'stage' : labels of ion/metastable descriptors 'ion' : stage contribution to energy surfeit/defecit 'elt' : line energy surfeit/defecit 'erb' : continuum energy surfeit/defecit (recombination + bremsstrahlung) 'erc' : CX energy surfeit/defecit 'total' : total energy surfeit/defecit
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.
In the returned frac and energy dictionaries the dimensions are (nte, nstage) where nte is the number of Te/dens pairs or (ndens, nte, nstage) when 2D is requested (ie all=True). Note that nstage includes the fully stripped species (nstage-Z0+1).
To calculate the power at tint combine the fractional abundances and coefficients from plt, prb and prc adf11 files.
Calls a fortran executable code and communicates via a bi-directional pipe connected to stdout.
References
ADAS manual description of adas406: http://www.adas.ac.uk/man/chap4-06.pdf
Version History
-
Martin O'Mullane, 08-09-2019
- First version
-
Martin O'Mullane, 15-09-2019
- Fix the check for meta because there was an attribute problem when the (optional) array was not supplied.
-
Martin O'Mullane, 08-11-2019
- Move construction and checking of filenames to a separate routine.
- Fix reshaping of fractional abundances for 2D (all=True).
Examples
Ionization balance of nitrogen using ADAS 96 data (recommended GCR coefficients) as a function of temperature in a fixed density after 100ms when starting feom N4+.
>>> import adas as adas >>> import numpy as np >>> te=np.geomspace(5, 100.0, 4) >>> dens=np.zeros(4)+1e13 >>> meta=np.zeros(7+1) >>> meta[4]=1.0 >>> frac, energy=adas.run_adas406(elem='n', year=96, te=te, dens=dens, ... meta=meta, tint=100e-3) >>> print('N2+ abundance : ', frac['ion'][:,2]) N2+ abundance : [8.21142793e-01 9.61761107e-04 7.31133065e-09 1.30912677e-11]