Back to library index.
Package multi (in multi.i) - multiple mesh support for drat package
Index of documented functions or symbols:
DOCUMENT multic, mf or multic, [mf1, mf2, mf3, ...] closes a MultiFile created with multif. Presented with an array of multifiles, closes them all.
DOCUMENT multif(mf) returns an ordinary file pointer for the MultiFile MF. Do not use close to close this pointer; just set it to [] when you are done. Use multic to properly close the MF.
DOCUMENT mf= multio(filename) or mf= multio(file) opens file FILENAME for use with the multi_streak function. The file MUST be subsequently closed using multic, since this function produces a hidden reference to the file. The function multif can be used to return an ordinary file pointer, given the returned MF structure. If the argument is already a stream FILE, that file will be used. The call still produces a hidden copy of FILE, so you may set your copy of the FILE variable to [], but do not close the file. The following keywords can be used to allow for variations in the variable names or units, and to specify the correspondence between the zones in this file, and the zones in the master file: zonelist=index_list -or- zonelist=zonelist_name is an index list into the (rt,zt) mesh arrays of the master file. If ireg is the region number array (having the same dimensions as rt or zt, and with its first row and column all 0), and if FILENAME contains opacity data only for zones with region numbers 1 and 2, you could open the file using: mf= multio(filename, zonelist=where(ireg==1 | ireg==2)) The zonelist should be nil only if the spatial dimensions of the opacity and emissivity in this file exactly match those of rt or zt in the master file. If zonelist is a string, it replaces the default name for the zonelist variable stored in the file (see multi_zonelist). zoneuse=index_list The zonelist specifies how the zones in this file correspond with those in the master file. The zoneuse list allows you to specify that only some of the zones actually present in the opacity and emissivity arrays of this file are to contribute to the total. This might be necessary to avoid double counting in a region covered by more than one file. Hence zoneuse is a list of indices into the spatial dimension(s) of the opacity and emissivity arrays in this file. If nil, all zones in this file will contribute. If present, and if zonelist is supplied as an array (rather than out of the file), zonelist should have the same length as zoneuse. As a special case, if zoneuse is a scalar 0, no opacity or emissivity will come from this file; this makes sense only if this is the master file. opac=oname, emiss=ename, srcf=sname specify non-default names for the opacity, emissivity, and osource function arrays. The defaults are given by the global variables mutli_opac, multi_emiss, and multi_srcf (see help). If the emissivity array is present in the file, it is preferred to the source function array, which will then be ignored. oscale=opacity_unit, escale=emissivity_unit are optional conversion factors to bring the units of the opac and emiss (or srcf) arrays into agreement among the various files which are to be used in a single run. The default value is 1.0 (i.e.- all files are expected to have the same units). gb=gbname, gav=gavname, gexist=gexistname -or- gexist=group_existence_map specify non-default names for the group boundary, group energy, and group existence arrays. The defaults are given by the global variables mutli_gb, multi_gav, and multi_gexist (see help). If the group boundary array is present in the file, it is preferred to the group energy array, which will then be ignored. The file should specify group boundaries if its opacity and emissivity are averaged over finite width bins; group energies if its opacity and emissivity are computed at points. The group existence map, if present, allows several disjoint spectral regions to exist in a single file. If the data type of gexist is not "string", it should be an array of length one less than gb, if gb is present, or gav, otherwise. By this means you can ignore spectral regions which are present in the file. gscale=photon_energy_unit is an optional conversion factor to bring the units of the gb (or gav) arrays into agreement among the various files which are to be used in a single run. The default value is 1.0 (i.e.- all files are expected to have the same units). tscale=time_unit is an optional conversion factor to bring the units of the time into agreement among the various files which are to be used in a single run. The default value is 1.0 (i.e.- all files are expected to have the same units). noextrap=1 if present and non-zero prevents the opacity and emissivity data from this file from being extrapolated as 1/hnu^3 in master bins at energies above the highest energy bin in this file. freqfirst=0 if present and non-zero means the frequency index is first for the opacity and emissivity arrays, instead of the default of frequency index last.
SEE ALSO: multic, multif, multi_streak, MultiFile, multi_opac, multi_emiss, multi_srcf, multi_gb, multi_gav, multi_zonelist
DOCUMENT multi_bav(gav) returns bin boundaries for the bin centers gav. The bin boundaries are taken at the geometric means between consecutive gav(i), with the endpoints extended slightly beyond the endpoints of gav.
DOCUMENT multi_bins(mf) The MF parameter is an array of MultiFiles, each created by multif. Automatically generates the bin structure which will be used by multi_streak (if the GB keyword is not specified).
SEE: multi_opac
SEE: multi_gb
DOCUMENT multi_gb, multi_gav, multi_gexist are the default names of the group boundary, group center, and group existence arrays in post-processing files. By default, they are "gb", "gav", and "gexist". If neither is present, drat_gb and drat_gav will also be tried. If present, gb is the photon bin boundary array, and gexist (if present) has one fewer element and is non-zero in bins which exist. Otherwise, gav is the photon energy array, and gexist (if present) has one fewer element and is zero between elements of gav which are not connected. Isolated points in gav are removed entirely. Either gb or gav must be strictly increasing, and has units of photon energy.
SEE: multi_gb
DOCUMENT gb= multi_line(nbins, hnu0, dhnu, dhnu_min) returns 2*NBINS+1 bin boundary energies for 2*NBINS bins cenetered around a spectral line at HNU0 of width DHNU. The result begins at HNU0-DHNU and ends at HNU0+DHNU. The finest two bins (nearest HNU0) has width DHNU_MIN, and the remaining bins have equal ratio widths as you move away from HNU0.
DOCUMENT multi_memory amount of memory used to determine size of spectral chunks. Default is 2000000, which keeps the memory required per chunk to under a few megabytes.
DOCUMENT xnd= multi_no_dups(x) returns its input vector X with any duplicate values removed. X must be non-decreasing and of length at least two.
DOCUMENT multi_opac, multi_emiss, multi_srcf are the default names of the opacity, emissivity, and source function arrays in post-processing files. By default, they are "opac", "emiss", and "srcf", respectively. If none of these are present, drat_akap and drat_ekap will also be tried for the opacity and source function, respectively. If emissivity is present, source function will be ignored. The units of opacity are inverse length, of emissivity power per photon energy per sterradian per volume, and source function power per photon energy per sterradian per area.
SEE: multi_opac
DOCUMENT result= multi_streak(mf, rays, slimits, gb=common_bins) like the streak function, but allows opacity to be built up from "slave files", in addition to the "master file" MF(1). The MF parameter is an array of MultiFiles, each created by multif. The master file MF(1) contains the mesh, and the master list of dump times. Only dump times which are present in this master list, and in every slave file, will be processed. The master file MF(1) need not contain any opacity or emissivity data at all; each of the slave files MF(2:0) must contain data for at least one zone. The emissivities and opacities from each file are interpolated onto a common group structure. This common group structure can be provided via the GB keyword to multi_streak. If it is not provided, GB is computed by examining the group boundary (or center) arrays from the master and every slave file, and building a group structure which is at least as fine as every component group structure, at every point in the spectrum. Example: File family "prob_p00" contains the mesh and opacities and emissivities for all zones. Family "pp_h00" contains post processed opacities and emissivities on a much finer spectral mesh, but only for zones in regions 1 and 2 of the original problem. You want to transport the emission from the inner regions 1 and 2 through the overlying material: restore, openb("prob_p00"), ireg; master= multif("prob_p00", zoneuse=where(ireg>2)); slave= multif("pp_h00", zonelist=where(ireg==1|ireg==2)); rays= ... slimits= ... drat_start= ... drat_stop= ... result= multi_streak([master,slave], rays, slimits); multic, master; multic, slave;
SEE ALSO: multio, multic, multif, MultiFile, multi_opac, multi_emiss, multi_srcf, multi_gb, multi_gav, multi_zonelist, multi_times, multi_bins
DOCUMENT multi_streak_save, outname, mf, rays, slimits, gb=common_bins or multi_streak_save, outfile, mf, rays, slimits, gb=common_bins like the streak function, but allows opacity to be built up from "slave files", in addition to the "master file" MF(1) and saves the streak in a PDB history file. The MF parameter is an array of MultiFiles, each created by multif. The master file MF(1) contains the mesh, and the master list of dump times. Only dump times which are present in this master list, and in every slave file, will be processed. The master file MF(1) need not contain any opacity or emissivity data at all; each of the slave files MF(2:0) must contain data for at least one zone. If the first argument is OUTFILE, a file variable instead of a file name, then that file is used for output. You can create OUTFILE and add static variables to it with save (but do NOT call add_record) which streak_save otherwise wouldn't know about. The output file has history records at the same times as the input file. Each record contains "time" (a double scalar), and the two arrays "transp", the transparency (between 0 and 1), and "selfem", the self emission (which has the same units as ekap in the file F). The dimensions of transp and selfem are ngroup-by-2-by-nrays (where nrays represents zero or more dimensions, copied from the RAYS input array). The RAYS and SLIMITS inputs are placed into the output file as non-record variables, and any variables in the drat_static option are copied form F to the output file. The gb and gav variables are copied from F into the output file as well. If the drat_glist option is present, that is stored in the output file also. The emissivities and opacities from each file are interpolated onto a common group structure. This common group structure can be provided via the GB keyword to multi_streak. If it is not provided, GB is computed by examining the group boundary (or center) arrays from the master and every slave file, and building a group structure which is at least as fine as every component group structure, at every point in the spectrum. Example: File family "prob_p00" contains the mesh and opacities and emissivities for all zones. Family "pp_h00" contains post processed opacities and emissivities on a much finer spectral mesh, but only for zones in regions 1 and 2 of the original problem. File "prob_strk" contains the streak history. You want to transport the emission from the inner regions 1 and 2 through the overlying material: restore, openb("prob_p00"), ireg; master= multif("prob_p00", zoneuse=where(ireg>2)); slave= multif("pp_h00", zonelist=where(ireg==1|ireg==2)); fout= openb("prob_strk"); save, fout, kmax, lmax; rays= ... slimits= ... drat_start= ... drat_stop= ... result= multi_streak_save(fout, [master,slave], rays, slimits); multic, master; multic, slave;
SEE ALSO: multio, multic, multif, MultiFile, multi_streak, multi_opac, multi_emiss, multi_srcf, multi_gb, multi_gav, multi_zonelist, multi_times, multi_bins
DOCUMENT times= multi_times(mf) returns the list of times which will be used by multi_streak. This is the subset of streak_times(mf(1)) which occur in all of the slave files. The drat_start and drat_stop times work as usual.
DOCUMENT multi_zonelist is the default name of the variable which is a list of 1-origin zone indices in the mesh of the master file.
DOCUMENT gb= _multi_bins(nfinal, gb1, gb2, ...) returns NFINAL+1 boundaries of NFINAL bins constructed by combining the input bin structures GB1, GB2, etc. Use NFINAL=0 to get at least the resolution in the finest GBi in every region of the spectrum. This is done by constructing a total bin density function (#bins/energy width), as the maximum of the bin density of each component. This total bin density function is integrated, and the integral is divided into NFINAL equal parts; the points in energy at which this division must be made are the returned bin boundaries. In the returned bin structure, the density of bins is everywhere proportional to the densest bins in any of the GBi.
DOCUMENT atten_emit= _multi_integrate(f, mesh, time, irays, slimits) is the default drat_integrate routine. On entry, file F is positioned at TIME, from which MESH has already been read. IRAYS and SLIMITS are the rays coordinates (in internal format) and integration limits. The result should be ngroup-by-2-by-raydims, where the second index is 1 for the attenuation factor, 2 for the self-emission (specific intensity due to emission along the ray). OPTIONS: drat_linear, drat_ocompute, drat_oadjust, drat_emult, drat_amult, drat_omult, drat_nomilne, drat_ekap, drat_akap, drat_glist
SEE ALSO: streak, multi_streak