 |  |
Astron. Astrophys. 362, 697-710 (2000)
Appendix A: the code
Our code is applicable to a wide range of astrophysical problems
involving (sub) millimetre and infrared
( µm)
spectral-line and continuum observations. The one-dimensional
(spherically symmetrical) version of our code is publicly available
for all interested researchers via
http://astro.berkeley.edu/~michiel
. The two-dimensional (cylindrically symmetric) code is available on a
collaborative basis through the authors (see the same website for
contact information). This appendix gives a concise description of the
implementation of the accelerated Monte Carlo method.
Fig. A.1 gives an overview of the structure of our code, which
consists of two parts. The first runs the Monte Carlo simulation
solving the radiative transfer and molecular excitation. The second
part uses this solution to calculate the emission that would be
observed from this source above the atmosphere and with perfect
spatial and velocity resolution, given a source distance and, for
cylindrically symmetric models, inclination. This latter part can also
be used to calculate the continuum radiation emitted by the source.
Its output format is that used by the MIRIAD package [Multichannel
Image Reconstruction, Image Analysis, and Display; Sault et al.
(1995)]. This package, designed to analyse interferometric spectral
line data, includes many processing options such as convolution with a
single-dish beam and modeling of aperture-synthesis visibilities, as
well as a wide variety of imaging capabilities. MIRIAD also allows
easy conversion to the ubiquitous FITS format and portability to other
software packages.
![[FIGURE]](img179.gif) |
Fig. A.1. Schematic outline of steps involved in our Monte Carlo calculations.
|
Both parts of the code are controlled by UNIX C-shell scripts that
extract information from the provided input and compile an executable
code. In this way, the size of several arrays containing the source
model, the collisional rate coefficients, etc., can be adjusted to the
required size, minimizing memory requirements. The source code is
written in FORTRAN-77.
Following the flow chart of Fig. A.1, the following steps
describe the Monte Carlo part of the code in more detail.
-
The code starts by reading a list of keywords, detailing the
required signal-to-noise ratio on the level populations, the initial
number of photons in each cell ( ),
and pointers to the source model, the systematic velocity field (if
any), the description of the dust emissivity, and the molecular energy
levels and collisional rate coefficients. The velocity field can be
defined simply through the source model with each grid cell moving at
a constant speed, or it can be a constantly varying function over each
cell. The source model can be a series of concentric shells covering a
region from the origin to a maximum radius, or a series of stacked
cylinders fully covering a region out to a maximum radius and
height.
Collisional rate coefficients are available for many
astrophysically interesting species and common collision partners such
as H2 in the and in the
levels, e-, and He. Our
code currently allows for two simultaneous collision partners, e.g.,
H2 and e-, each with its own density and
temperature. For molecular ions such as HCO+, excitation
due to collisions with electrons can be significant compared to
collisions with H2 at fractional ionization
( ). Often, listed rate coefficients
are equivalent rates per H2 molecule including
contributions from He at cosmic abundance. The results of our code,
and any non-LTE calculation, sensitively depend on the quality of the
rate coefficients. Recently, Black (2000) discussed the need for good
rate coefficients and the effects of other implicit assumptions of
radiative transfer codes.
-
In the first stage of the calculation, the radiation field is based
on rays per cell, each starting at a
random position equally distributed over the cell volume, pointing in
a random direction, and at a random frequency within 4.3 times the
local line width around the local systematic velocity vector. The
value of 4.3 corresponds to the width where the line profile has
dropped to less than 1% of its peak. In this stage, in each iteration
the same series of random numbers is used, so that there are no
random fluctuations in the coverage of the radiation field.
-
For each ray, the distance ds from the ray's origin to the
nearest boundary of the cell along its randomly chosen direction is
calculated. The incident radiation
along the ray then follows from integrating Eq. (2) in a stepwise
manner from cell edge to cell edge, attenuating the contribution from
each cell by all intervening cells, with the cosmic microwave
background as a boundary condition. The only quantity that changes
when stepping through a cell is the direction, and possibly the
magnitude, of the systematic velocity vector, which enters Eq. 2
through the line profile function .
Changes of within cells are tracked
by subdividing the integration into small steps as needed.
-
Armed with the set of for each
ray, the radiation field in the cell
follows from Eq. (14). A consistent solution of this equation and
the level populations (Eq. 10) quickly follows from iteration to
a relative accuracy of in the
populations. Limitations on masering are discussed in
Sect. 3.4.
-
The first stage of the code repeats items 2-4 until the largest
relative fractional difference between the populations in all cells of
three subsequent solutions is ten times better than ultimately
required. Since the angular sampling is the same in each iteration,
these differences are free of random noise but might not adequately
sample all directions and frequencies.
-
The second stage of the code proceeds along similar lines as the
first stage, but with a different set of random numbers in each
iteration. The only other difference is, that each time the maximum
fractional error in the populations in a cell exceeds the requested
accuracy, the number of rays in that cell is doubled. This stage lasts
until all cells comply with the required accuracy, after which the
solutions are written out to a file.
The second part of the program calculates the emission distribution
on the sky for a given source distance and inclination by simple ray
tracing. The output from the Monte Carlo code forms the input for this
ray-tracing code. Since it uses much of the same code as the Monte
Carlo part, geometry and radiative transfer being the same, it is not
further discussed here.
Appendix B: comparison with other codes
This section describes two cases to test our code against
well-documented calculations with Monte Carlo codes from the
literature. For further tests, we refer the reader to the web-page
collecting a number of standard test cases, which has resulted from
the 1999 workshop on Radiative Transfer in Molecular Lines at the
Lorentz Center of Leiden University
(http://www.strw.leidenuniv.nl/~radtrans
).
B.1. Bernes' CO cloud
In his seminal paper on Monte Carlo methods for radiative transfer
and molecular excitation, Bernes (1979) presents a constant-density,
constant-temperature, optically thick cloud model. The density of the
cloud, cm-3, is
below the critical density of the CO transitions, and the excitation
is dominated by radiative trapping. The excitation temperatures of the
CO transitions drop off rapidly in the outer regions of the cloud.
This necessitates fine sampling of these regions. Fig. B.1 shows
that our code reproduces the original results within the accuracy of
our and Bernes' calculations. This simple model forms a critical test
for the code's ability to correctly handle excitation by radiative
trapping. The total run time for the model was approximately 5 minutes
on a UltraSparc 10 workstation, using the same collisional rate
coefficients as Bernes (Table 1).
![[FIGURE]](img191.gif) |
Fig. B.1. Excitation temperature of CO and as a function of radius, and integrated line profiles. Open symbols are results by Bernes (1979), the solid lines are our calculations.
|
B.2. Model for B 335 by Choi et al.
Another critical element of any radiative transfer code is its
ability to correctly deal with systematic velocity fields. The
inside-out collapse model as outlined in Sect. 2 is well suited
for such a test, because of its wide range in velocities from zero to
many times the turbulent line width combined with significant optical
depth. As a test case, we calculate the populations and the emergent
spectrum of several CS and H2CO lines, following the model
for the young stellar object B 335 of Choi et al. (1995). This
model is similar to that of Sect. 2, with
km s-1 and
yr. The turbulent line width
is 0.12 km s-1. Only the temperature structure is
different from Sect. 2: Choi et al. use continuum observations to
constrain the temperature distribution, which we follow as closely as
possible from their Fig. 3.
Fig. B.2 compares the resulting excitation temperature
distribution with the results of Choi et al. The agreement is very
good for CS, where we used the same collisional rate coefficients
(Table 1). For H2CO the agreement is less favourable,
but we were unable to use the exact same rate coefficients. Simple
tests show that the deviation is comparable to what can be expected
from the difference in the molecular data. This variation corresponds
to a 10% difference in the emergent line profiles.
![[FIGURE]](img195.gif) |
Fig. B.2. Excitation temperature of selected CS and H2CO lines versus radius. Open symbols are results by Choi et al. (1995), the thin solid lines are the results from our spherically symmetric code. The thick solid lines show the results from our cylindrically symmetric code.
|
Fig. B.2 also plots the excitation temperatures obtained for
the same model but using the cylindrically symmetric code. Both codes
clearly give consistent answers; the small `wiggles' in the excitation
temperatures as function of radius in the output of the cylindrically
symmetric calculation can be attributed to geometrical defects when
trying to fit a sphere in a series of stacked cylinders.
© European Southern Observatory (ESO) 2000
Online publication: October 24, 2000
helpdesk.link@springer.de  |