LOC - Line radiative transfer with OpenCL

LOC is a program, or rather a family of programs, aimed at the radiative transfer modelling of molecular lines. These will be made public… in near future. The main novelty is in the use of OpenCL libraries for the parallelisation of the computations so that they can be run both on multi-core CPUs and GPUs. Thus, the basic concept is the same as in the case of SOC, the radiative transfer code for calculations of dust emission and scattering.

At this moment there exist versions of LOC for 1D and regular Cartesian 3D grids. In addition to “normal” molecular line modelling, one can model spectra with hyperfine structure either by assuming local thermodynamic equilibrium between the components or by doing the full calculation, including the effects of line overlap. One of the next steps is to implement LOC for hierarchical grids.


Input files

Model cloud description

The 3D model is described by a separate binary file that defines (in the case of the cartesian grid) the model dimensions and specifies for each cell seven quantities: the number density, the kinetic temperature, the amount of microturbulence, three components of the macroscopic velocity, and the fractional abundance. The file starts with with the dimensions NX, NY, and NZ (three 4 byte integers), following by the data for the NX×NY×NZ cells, each consisting of the aforementioned seven numbers (4 byte floats; the data for a single cell being consecutive elements in the file).

The values in the file can be in physical units. For example, the density would be in units cm-3 and the microturbulence and velocities in km/s. Usually the density would be the density of H or of H2, the abundance being the abundance of the examined species relative to that density. However, the raw values read from the file may be rescaled using appropriate keywords in the parameter file. Parameter file

Initialisation file

The following list will describe briefly the keywords used in the initialisation file (ini file). This is the file that is give as a command line parameter for the LOC programme. Each line in the parameter file starts with a keywords, possibly followed by one or more parameters separated by spaces. Comment lines in inline comments are indicated with a ‘#’ character.

  • abundance float scaling of the abundance values read from the model file

  • angle float apparent size of (root) grid cell in units of arcsec

  • bandwidth float total bandwidth used in the simulations and for the output spectra, in units if km/s

  • cabfile filename optional file giving the fractional abundance of each collisional partner. The file starts with NX, NY, NZ, and the number of collisional partners (four 4 byte integers). The rest of the file lists the abundances for every model cell, the values of a given cell being consecutive (index over partners runs faster than index over cells).

  • channels int number of velocity channels (in the simulation and the output spectra)

  • cloud filename name of the model file (with the density etc. values for every model cell)

  • cooling if given, the total cooling rate of the current species is calculated and saved to a file (one value per cell)

  • density float factor by which the density values read from the model file are multiplied before calculations

  • direction float float [string] specifies the direction of the observer as angles (in degrees) from the positive Z axis and rotation from positive X towards Y. The optional third parameter is an additional string included in the name of the output files.

  • distance float specifies the distance between the model and the observer, in units of pc

  • fraction float scaling applied to the abundance values read from the model file (synonym for keyword abundance)

  • gpu if given, the main computations are run on a GPU instead of the CPU. See also keyword platform. (If gpu alone does not seem to work, try gpu 1)

  • grid float specifies the step between spectra in the output maps (~pixel size). The unit is arcsec.

  • isotropic float specifies the temperature (in degrees of Kelvin) for isotropic background radiation, assumed to have the spectrum of a blackbody.

  • iterations int specifies the number of iterations (consisting of the simulation of the radiation field and the updating of the level populations)

  • load filename at the beginning of the run, load previously saved level populations from the given binary file.

  • levels int specifies the number of lowest energy levels included in the computations (less or equal to the number of levels for which the molecule file contains data for)

  • lowmem turns on some optimisations to minimise the memory usage, at the expense of some increase in the run times

  • molecule filename specifies the name for the file containing the molecular data. The file can be in lamda format.

  • nside int specifies the angular grid for the simulated rays, which follows the healpix scheme. The total number of rays per model surface element is 12 times this value squared.

  • platform int specifies the OpenCL platform that should be used for the calculations

  • points int int specifies the dimensions of the output spectrum files (the number of spectra along horizontal and vertical directions)

  • prefix string prefix for the output files

  • save filename gives the name for a binary file where the level populations are saved at the end of a run

  • sigma float scaling to be applied to the microturbulence value read from the file for the model description

  • spectra int int … specifies the transitions for which the spectra are to be computed and saved. The values refer to the running numbering of the transitions (in the order these appear in the molecule file).

  • stop float iterations are automatically stopped when the largest relative change in level populations fall below this limit. Only levels up to the one specified with the keyword uppermost are tested.

  • temperature float scalar scaling applied to the kinetic temperature values read from the model description file.

  • transitions int int … list of transitions (using running index of the transitions) for which the excitation temperatures are to be saved

  • uppermost int specifies the uppermost energy level that is checked for level population changes (see keyword stop)

  • velocity float scaling applied to the velocity values (three components if macroscopic velocity) that are read from the model description file

Molecular parameters

LOC reads directly files in the format of the Lamda database .

Output files

Spectrum files

The spectra are saved to binary files. Currently the file names are similar to prefix.molecule.01-00.bin, where prefix is given in the ini-file, molecule is replaced by the actual name of the molecule (species), and the number give the transition (based on the 0-offset numbering of energy levels). The file contains:

  • three 4-byte integers that give the number of pixels along the two map pixels (NX, NY), and the number of velocity channels (NCHN)
  • two 4-byte floating point numbers giving the velocity of the first channel and the channel width (km/s)
  • a cube with dimensions (NX, NY, NCHN+2), consisting of 4-byte floating point numbers. Each vector of NCHN+2 elements starts with the x- and y-offsets, followed by the channel values

Excitation temperature

Excitation temperatures are saved to binary files, named combining the prefix (as given in the ini-file), the name of the molecule and the transition, and with an ending of tex. The file

  • starts with four 4-byte integers, the dimensions of the model cloud (NX, NY, NZ), and the number of excitation levels included in the calculation (LEVELS)
  • ends with a (NX, NY, NZ) cube of excitation temperature values for the chosen transition, saved as 4-byte floating point numbers

Cooling rates

The cooling rates are saved to a plain binary file that consists of one 4-byte value per cell. The values are the cooling rates in cgs units.