Function adas.write_adf37
def write_adf37(file=None, fulldata=None, comments=None)
-
Write an adf37 electron energy distribution file from a user supplied fulldata dictionary.
Parameters
file
:str
- full name of adf37 file.
fulldata
:dict
- contents of the adf37 file
'title' : header for file 'icateg' : category of file 1 => superposition 2 => numerical 'ieunit' : energy units of distribution function 1 => kelvin 2 => eV 'nenerg' : type 1 => number of distribution families 2 => number of energy points 'nblock' : type 1 => number of members in output family 2 => number of effective temperatures 'nform1' : type of threshold behaviour 1 => cutoff 2 => energy^param1 'nform2' : type of high-energy behaviour 1 => cutoff 2 => energy^(-param2[0]) 3 => exp(-param2[0]*energy) 4 => exp(-param2[0]*energy^param2[1]) 'param1' : parameter of threshold form 'param2' : parameter of high-energy form 'ea' : energy points of tabulation array(nblock,nenergy) 'fa' : distribution function tabulation array(nblock,nenergy)
comments
:list
- comments for the end of the file as a list of strings.
Notes
'ea' and 'fa' should be numpy arrays of floats. If only one nblock is present the shallow dimension need not be given. A 1D array of nenerg is sufficient. 'mode_eng', 'median_eng' and 'teff' are not required to write an adf37 file.
Version History
-
Martin O'Mullane, 23-07-2018
- First version
-
Martin O'Mullane, 26-07-2018
- Allow ea and fa to be 1D vectors.
-
Martin O'Mullane, 13-11-2019
- Use adas writefile function to write the file.
-
Martin O'Mullane, 28-11-2021
- Adjust format statements due to change in array2strlist.
Example
EEDF for a Maxellian with Te=15eV.
>>> import adas as adas >>> import numpy as np >>> te=15.0 >>> energy=np.geomspace(0.1,50,100) >>> eedf=2*np.sqrt(energy/np.pi)*(1/te)**1/5*np.exp(-energy/te) >>> fulldata={'title' : "test Maxwellian", 'icateg' : 2, 'ieunit': 2, ... 'nenerg': 100, 'nblock': 1, 'nform1': 1, 'nform2': 3, 'param2': 1.0, ... 'ea' : energy, 'fa' : eedf} >>> my_file='/tmp/test_write_adf37.dat' >>> adas.write_adf37(file=my_file, fulldata=fulldata, ... comments=['Testing write_adf37', 'By me, today'])