%VERSION:2 23 142 0:ATOMRD 2258:CNTRB 3313:COLRATRD 3834:CONVL 4351:COOL_PLOT 4975:COOL_SUM 5408:DEFAULT 5923:DLAMB 6335:DOUBLE 6904:GACALC 7266:INTEP 8154:INTFLUX 8740:MULRD 9291:NIITRD 9901:NYCLOSE 10245:NYRD 12258:OPCPLOT 12956:OPCRD 13395:PLANCK 13781:PLOTCNTRB 14307:RATES 14875:TRADB 15249:TRAPEZ ;+ PROJECT: HAOS-DIAPER NAME: atomrd PURPOSE: Reads atomic data in standard MULTI format from file file, including collisional data and header information EXPLANATION: CALLING SEQUENCE: atomrd,file,coldata,head INPUTS: OPTIONAL INPUTS: None. OUTPUTS: Data are stored in common block catom (accessed via @catom) OPTIONAL OUTPUTS: coldata: structure containing collisional parameters head: structure containing header information KEYWORD PARAMETERS: /help. Will call doc_library and list header, and return plot=plot make a term diagram info=info lists header info make=make make the file if it does not exist with ground + next ion stage only /describe will describe variables in the file CALLS: None. COMMON BLOCKS: None. RESTRICTIONS: None. SIDE EFFECTS: None. CATEGORY: PREVIOUS HISTORY: Written November 23, 1994, by Phil &, High Altitude Observatory/NCAR, Boulder CO MODIFICATION HISTORY: M. Carlsson circa 1988: original coding P. Judge circa 1990: double precision variables used P. Judge 21-Jan-1993: collisional file is read if coldata in arg list P. Judge 29-Jul-1993: Bug corrected (TRAD=TRAD2 was commented out earlier) P. Judge 14-Jun-1994: common block replaced by @catom P. Judge 05-Jul-1994: header input added, order of jrad, irad input made unimportant, SDP prolog added P. Judge 04-Aug-1994: Bug corrected (jrad, irad for photoionization continua were set to input values minus 2, caused by 05-Jul-1994 fix) P. Judge 19-Aug-1994: Search done on SDP_ATOM directories if file : does not exist in current directory, also : if no '.' exists the input filename is assumed to : consist of the extension (e.g., atomrd,'o1') P. Judge November 23, 1994: /make option added P. Judge November 30, 1994: Bug fixed so that gencolrd is called when n_params(0) ge 2 (previously nparams(0) eq 2) P. Judge May 1, 1995: Added describe option VERSION: Version 1, November 23, 1994 ;- ;+ NAME: CNTRB PURPOSE: This procedure reads contribution functions from file and places contribution function to intensity in cntrbi(k,ny,kr), to relative absorption in cntrbr(k,ny,kr) and average height of formation in xmeani(ny,kr) and xmeanr(ny,kr). CATEGORY: Multi CALLING SEQUENCE: CNTRB, File INPUTS: File: File containing contribution function data. Default file name is IDLCNT if def_ext='none', else idlcnt.def_ext OUTPUTS: in common block: cntrbi(k,ny,kr) contribution function to intensity cntrbr(k,ny,kr) contribution function to relative intensity cntrbf(k,ny,kr) contribution function to flux xmeani(ny,kr) average taulg of formation for intensity xmeanr(ny,kr) average taulg of formation for relative intensity xmeanf(ny,kr) average taulg of formation for flux to screen: 'reading contribution functions for kr=',kr COMMON BLOCKS: common_multi PROCEDURE: cntrbr as defined by Magain MODIFICATION HISTORY: Written by: Mats Carlsson. ;- ;+ NAME: COLRATRD PURPOSE: This procedure reads collisional data from file and places them in col(i,j,k). Only necessary if there are fixed transitions other than collisions (nrfix ne 0). CATEGORY: Multi CALLING SEQUENCE: COLRATRD, File INPUTS: FILE: File containing collisional data Default file name is DUMC if def_ext='none', else dumc.def_ext OUTPUTS: in common block: col(i,j,k) collisional rate coefficient MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: CONVL PURPOSE: This function converts vacuum wavelengths to air for wavelengths greater than 2000 Angstroms. CATEGORY: Multi CALLING SEQUENCE: Result = CONVL(Lambda) INPUTS: Lambda: Vacuum wavelength OUTPUTS: This function returns the air wavelength for wavelengths greater than 2000 Angstrom, else the vacuum wavelength PROCEDURE: Algorithm from Starlink program IUEDR You might not need this section for your routine. MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: COOL_PLOT PURPOSE: This procedure plots the cooling function. If line type is given, overlay plot. CATEGORY: Multi CALLING SEQUENCE: COOL_PLOT, X, Cool [,Line] INPUTS: X: Atmospheric height/depth scale to be used for x-axis Cool: Cooling function. OPTIONAL INPUTS: Line: Line type, gives overlay plot COMMON BLOCKS: CCOOL_PLOT: saving local variables for overlay plot SIDE EFFECTS: Plots in current window EXAMPLE: Typical call sequences: cool_plot,height,cool_total for kr=0,nrad-1 do cool_plot,height,cool(*,kr),kr+1 MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: COOL_SUM PURPOSE: This procedure adds up all cooling contributions and puts the sum into cool_total CATEGORY: Multi CALLING SEQUENCE: COOL_SUM, Cool, Cool_total INPUTS: Cool: Cool(k,kr) cooling function at depth k, transition kr OUTPUTS: Cool_total: Cool_total(k) total cooling function at depth k EXAMPLE: Typical call: cool_sum,cool,cool_total MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: DEFAULT PURPOSE: This procedure sets default extension for input files idl1 idlcnt idlny idlopc dumc jny extension='none' sets original upper case file names. CATEGORY: Multi CALLING SEQUENCE: DEFAULT, Extension INPUTS: Extension: File extension, 'none' to set original upper case file names OUTPUTS: in common block: def_ext file extension openfile=0 to signal reopening of files4 COMMON BLOCKS: common_multi MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: DLAMB PURPOSE: This function calculates and returns delta lambda for a given Q array. CATEGORY: Multi CALLING SEQUENCE: Result = DLAMB(QQ, Lambda) INPUTS: QQ: Frequency parameter in typical Doppler units Lambda: Central wavelength in Angstrom OUTPUTS: Delta lambda from line center in Angstrom COMMON BLOCKS: common_multi MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: DOUBLE PURPOSE: This procedure makes profile symmetric around x(0). Used for fluxes and intensities. For two-sided profiles, original profile is returned. CATEGORY: Multi CALLING SEQUENCE: DOUBLE, KR, Y, XX,YY INPUTS: KR: transition number Y: array to be made symmetric, either OUTINT or FLUX OUTPUTS: XX: delta lambda in Angstrom YY: symmetric Y values as function of wavelength COMMON BLOCKS: common_multi EXAMPLE: Typical call sequence: double,0,flux,xx,yy plot,xx,yy MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: GACALC PURPOSE: This procedure calculates ga values from line list CATEGORY: Multi CALLING SEQUENCE: GACALC INPUTS: From common OUTPUTS: In common: GA: GA(kr) Summed A values for all transitions from upper level and lower level of transition kr COMMON BLOCKS: common_multi MODIFICATION HISTORY: Written by: Mats Carlsson. ;- ;+ NAME: INTEP PURPOSE: This procedure is used for interpolation uses a Hermite spline interpolation that often avoids over-shoot found with cubic splines CATEGORY: Multi CALLING SEQUENCE: INTEP,X,Y,Xpin,Ypout [, Nowarning=Nowarning] INPUTS: X: X-array to interpolate in Y: Y-array to interpolate in Xpin: X-array where Y-values are wanted KEYWORD PARAMETERS: NOWARNING: If /NOWARNING there will be no warning messages if extrapolation occurs OUTPUTS: Ypout: Y-array with returned interpolated values OPTIONAL OUTPUTS: If extrapolation is attempted, there is a warning message RESTRICTIONS: Instead of extrapolation, the nearest end value is used PROCEDURE: ref: publications of the dominion astrophysical observatory, xvi,6,67 graham hill: intep, an effective interpolation subroutine MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: INTFLUX PURPOSE: This function calculates the integrated flux or intensity. CATEGORY: Multi CALLING SEQUENCE: Result = INTFLUX(Kr [,Mu=Mu,/Nocont]) INPUTS: Kr: The transition for which the integrated flux/intensity is calculated. KEYWORD PARAMETERS: MU: If mu-index is given, integrated intensity is returned. NOCONT: If /nocont is given, continuum flux/intensity is not subtracted. OUTPUTS: Integrated flux or intensity COMMON BLOCKS: common_multi PROCEDURE: Uses Trapez integration MODIFICATION HISTORY: Written by: Mats Carlsson. ;- ;+ NAME: MULRD PURPOSE: This procedure reads data from file. If no file name is given, the default name IDL1 is assumed. After execution of this procedure, most common block variables are accessible. CATEGORY: Multi. CALLING SEQUENCE: MULRD, File INPUTS: File: Input file containing all the multi-data. Default file name is IDL1 if def_ext='none', else idl1.def_ext OUTPUTS: Fills most common blocks COMMON BLOCKS: common_multi MODIFICATION HISTORY: Written by: Mats Carlsson, March 1988. ;- ;+ NAME: NIITRD PURPOSE: This procedure reads population densities from file (NIIT default) and places them in niit(i,k,it) where it=0 corresponds to starting approximation, it=niitmax to the densities after the last iteration. CATEGORY: Multi CALLING SEQUENCE: NIITRD, File INPUTS: File: Input file containing population densities Default file name is NIIT if def_ext='none', else niit.def_ext OUTPUTS: In common: niit(i,k,it) population density for level i, depth k, iteration it COMMON BLOCKS: common_multi MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: NYCLOSE PURPOSE: This procedure closes the idlny and jny files. CATEGORY: Multi CALLING SEQUENCE: NYCLOSE INPUTS: None OUTPUTS: In common: openfile=0 signals closed files lu2=0 signals closed files ljny=0 signals closed files COMMON BLOCKS: common_multi MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: NYRD PURPOSE: This procedure reads ny dependent variables from files file_idlny and file_jny for line kr, frequency ny. if no filename is given, the defaults IDLNY and JNY are used. Variables are: pms, iplus, iminus, p, s, tauq, dtauq, xcont, sc, scat, x, jny, sbck, rny. CATEGORY: Multi CALLING SEQUENCE: NYRD, Kr, Ny [, File_idlny, File_jny, MDEP=MDEP, /DP, /DPJNY] INPUTS: Kr: The transition number for which variables are read Ny: Frequency number for which variables are read File_idlny: idlny file name. Default file name is IDLNY if def_ext='none', else idlny.def_ext File_jny: jny file name Default file name is JNY if def_ext='none', else jny.def_ext KEYWORD PARAMETERS: MDEP: Dimension MDEP. Defaults to NDEP. If dimension is different from NDEP this keyword has to be given in order to get correct JNY DP: signals that program was compiled in double precision this means that the record length for odd values of NDEP is different than in SP which this keyword takes care of. Note that the file JNY is still assumed to be in single precision (see DPJNY keyword) DPJNY: JNY file is assumed to be in double precision. sets /DP as well OUTPUTS: In common: pms P-S iplus IPLUS iminus IMINUS p Feautrier mean intensity s Source function tauq Monochromatic optical depth dtauq dtauq(k)=tauq(k)-tauq(k-1) xcont continuum opacity relative to standard opacity sc absorption part of source function scat scattering part of source function x total opacity relative to standard opacity jny mean intensity sbck background source function, SBCK=SC+SCAT*JNY rny xcont/x COMMON BLOCKS: common_multi RESTRICTIONS: The jny file has to be converted to single precision - this is NOT taken care of by the keyword /DP - or you have to use /DPJNY MODIFICATION HISTORY: Written by: Mats Carlsson 95-11-30 DPJNY keyword added ;- ;+ NAME: OPCPLOT PURPOSE: This procedure plots opacity contributions as function of depth. CATEGORY: Multi CALLING SEQUENCE: OPCPLOT, Xscale, Il, Min_cont [, /TOTAL] INPUTS: Xscale: X scale on plot (i.e. taulg). Il: Wavelength index. Min_cont: Minimum contribution to be plotted (default 0.02) KEYWORD PARAMETERS: TOTAL: Contributions relative to total opacity and not relative to background opacity. COMMON BLOCKS: common_multi blocks, just delete this entry. SIDE EFFECTS: Plots in current window EXAMPLE: opcrd reads opacity file print,xla find wavelength number of interest opcplot,taulg,4,/total MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: OPCRD PURPOSE: This procedure reads opacity data from file. CATEGORY: Multi CALLING SEQUENCE: OPCRD, File INPUTS: File: Name of file containing opacity data. Default file name is IDLOPC if def_ext='none', else idlopc.def_ext Iwopac: The procedure asks for iwopac OUTPUTS: In common block COMMON BLOCKS: common_multi MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: PLANCK PURPOSE: This function calculates the Planck function, B_ny(lambda,t). CATEGORY: Multi CALLING SEQUENCE: Result = PLANCK(Lambda, T) INPUTS: Lambda: Wavelength in Angstroms. T: Temperature in Kelvins. either input (but not both) can be an array OUTPUTS: Returns B_ny in cgs units MODIFICATION HISTORY: Written by: Mats Carlsson, April 1988. ;- ;+ NAME: PLOTCNTRB PURPOSE: This procedure plots contribution function CATEGORY: Multi CALLING SEQUENCE: PLOTCNTRB, Kr, Xscale, Cntrb INPUTS: Kr: Transition number. Xscale: X scale on plot (i.e. taulg). Cntrb: Contribution function to be plotted. COMMON BLOCKS: common_multi SIDE EFFECTS: Plots in current window EXAMPLE: Typical calls are: plotcntrb,0,alog10(tau),cntrbi plotcntrb,0,alog10(tau),cntrbr MODIFICATION HISTORY: Written by: Mats Carlsson, March 1988. ;- ;+ NAME: RATES PURPOSE: This procedure calculates the rates pt(i,j,k) for transitions between levels 'i' and 'j' at the atmospheric depth point 'k'. pt(i,j,k) contains the total rate, pn(i,j,k)=net rate, positive=up, pn(j,i,k)=relative net rate. CATEGORY: Multi. CALLING SEQUENCE: RATES INPUTS: in common OUTPUTS: in common: pt(i,j,k): total rate between levels i and j at depth k pn(i,j,k): net rate, positive=up pn(j,i,k): relative net rate COMMON BLOCKS: common_multi MODIFICATION HISTORY: Written by: Mats Carlsson ;- ;+ NAME: TRADB PURPOSE: This function calculates trad from given (i,lambda) array. Trad is the radiation temperature. CATEGORY: Multi CALLING SEQUENCE: Result = trad(I, Lambda) INPUTS: I: Intensity I_nu in cgs units Lambda: Wavelength in Angstrom OUTPUTS: This function returns trad MODIFICATION HISTORY: Written by: Mats Carlsson, April 1988. ;- ;+ NAME: TRAPEZ PURPOSE: This function performs trapezoidal integration. CATEGORY: Multi CALLING SEQUENCE: Result = TRAPEZ(X, Y) INPUTS: X: X-array Y: Y-array OUTPUTS: This function returns the integral Y*dx MODIFICATION HISTORY: Written by: Mats Carlsson ;-