QuickStart
QuickStart
Software: Copyright © 1978-2023 Gary J. Ferland and others. All rights reserved.
The software described in this documentation (C LOUDY) is subject to a FreeBSD-style software license
contained in the file license.txt in the root directory of the distributed files. The list of co-authors is
given in the file others.txt in the same directory. Use of this program is not restricted provided each
use is acknowledged upon publication. The bibliographic reference to this version of C LOUDY is “version
xx.xx of the code last described Clo.” The version number, shown here as “xx.xx”, should be given. This
version number, along with a complete citation, can be found by executing the code with the print citation
command included in the input script.
C LOUDY is an evolving code. You should confirm that you have the most recent version of the code by
checking the web site www.nublado.org. The code has a discussion board with emailing list. This will have
announcements of any updates to the code.
Portions of the documentation have been published, and are copyrighted by, the American Astronomical
Society, the Astronomical Society of the Pacific, and the Royal Astronomical Society. The remainder of the
documentation is subject to the following FreeBSD format documentation license:
Documentation: Copyright © 1978–2023 Gary J. Ferland and others. All rights reserved.
Redistribution and use of the documentation (all parts of H AZY and the Quick Start Guide) in source
(LATEX) and ‘compiled’ forms (PDF, PostScript, HTML and so forth) with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code (LATEX) must retain the above copyright notice, this list of conditions
and the following disclaimer as the first lines of the file license doc.txt in the root directory
unmodified.
2. Redistributions in compiled form (converted to PDF, PostScript, XML, HTML and other formats)
must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
This documentation is provided by the C LOUDY project “as is” and any express or implied warranties,
including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose
are disclaimed. In no event shall the C LOUDY project be liable for any direct, indirect, incidental, special,
exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or
services; loss of use, data, or profits; or business interruption) however caused and on any theory of
liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way
out of the use of this documentation, even if advised of the possibility of such damage.
Cover image: Bavarian Road Cycling Championship 2017, in Baiersdorf (Middle Franconia). Photo by
Markus Spiske on Unsplash.
CONTENTS 3
CONTENTS
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1 The web site and discussion board . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 The release version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 H AZY, the documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 What Cloudy can do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.6 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.7 Citing the use of C LOUDY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.8 Collaborations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Two very simple models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 What must be specified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Running a model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Command format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 A simple planetary nebula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 A quasar cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3 Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1 Zones and iterations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2 The geometry—intensity & luminosity cases . . . . . . . . . . . . . . . . . . . 15
3.3 Open or closed geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.4 Is the gas static or a wind? Is it turbulent? . . . . . . . . . . . . . . . . . . . . . 17
3.5 What sets the outer edge to the cloud? Why should the calculation stop? . . . . 18
3.6 What about clumping? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4 Composition and density . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.1 Chemical composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.2 What is the cloud’s density? Does it vary with depth? . . . . . . . . . . . . . . 21
4.3 Commands normally used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5 The incident radiation field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.1 Luminosity vs intensity cases . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.2 The luminosity or intensity of the incident radiation field . . . . . . . . . . . . . 22
5.3 The shape of the incident radiation field . . . . . . . . . . . . . . . . . . . . . . 23
6 Other commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.1 Radiative transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.2 The H2 model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.3 The optimize command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.4 Grids of models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.5 Miscellaneous commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7 The code’s predictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7.1 The default printout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7.2 Understand why the calculation stopped . . . . . . . . . . . . . . . . . . . . . . 29
7.3 Warnings, cautions, surprises, and notes . . . . . . . . . . . . . . . . . . . . . . 29
7.4 Observed quantities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
7.5 Save output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
7.6 Miscellaneous Helper Commands . . . . . . . . . . . . . . . . . . . . . . . . . 31
8 Example calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
8.1 The test suite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
8.2 One of the models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4 CONTENTS
1 Introduction
Numerical simulations make it possible to understand complex physical environments starting from first
principles. Cloudy is designed to do just that. It determines the physical conditions within a
non-equilibrium gas, possibly exposed to an external source of radiation, and predicts the resulting
spectrum. This makes it possible to predict many observed quantities by specifying only the properties of
the cloud and the radiation field striking it.
This is a quick-start guide to Cloudy. It begins with an introduction to the code’s web site, outlines how
to set up the code, and is followed by a description of H AZY, the code’s documentation. This document
only gives an outline of the code and the commands that drive it. Sections of H AZY that go into greater
detail are referenced and should be consulted to find out more.
Osterbrock & Ferland (2006; hereafter AGN3) give many more details about photoionized clouds. This
is an active research field. Ferland (2003) reviews recent advances and current questions.
1.4 Assumptions
The code computes the non-equilibrium ionization, thermal, and chemical state of a cloud that may (or may
not) be exposed to an external source of radiation. The usual assumption is that atomic processes have had
time to become time steady. The density of a species or level i is given by a balance equation of the form
!
∂ ni
= ∑ n j R ji + Source − ni ∑ Ri j + Sink = 0 [cm−3 s−1 ] (1)
∂t j̸=i ji
Here R ji represents the rate [s−1 ] that a species j goes to i, Source is the rate per unit volume [cm−3 s−1 ]
that new atoms appear in i, and Sink is the rate [s−1 ] they are lost. This, together with equations
representing conservation of energy, mass, and charge, fully specify the problem.
Most calculations assume that the cloud is static. The ability to do dynamical and time-dependent
calculations is now in the code although this part is not fully mature. Henney et al. (2005) and Henney et al.
(2007) present examples of dynamical calculations.
The Introduction chapter in H AZY Part 1 gives more details on the assumptions. The section The Future
on www.nublado.org outlines the directions future development will take. ALI line radiative transfer and
expansion to two and three dimensional geometries are some of the planned future development.
striking the cloud, often its only source of heat and ionization, is specified, and other sources of heat can
also be included. The code then computes the thermal, ionization, and chemical properties of the cloud, and
its observed spectrum. A general introduction to such environments is given in Chapters 1 and 2 of AGN3.
The first chapter of Part 1 of H AZY gives a more extensive overview of the code. The format of the input
script, the file that specifies the boundary conditions, is described in the chapter Introduction to Commands
of Part 1 of H AZY. Output options are described in the chapter Controlling Output of Part 1 of H AZY.
1.6 Definitions
There is a fair amount of jargon that goes along with quantitative spectroscopy and numerical simulations
of a cloud. These are summarized in the chapter Definitions of Part 1 of H AZY and in Chapters 1 through 5
of AGN3. As a minimum you should know the definitions of the two types of geometries (open and closed),
the radiation field (incident, transmitted, diffuse, and reflected), and the terms covering factor, density, and
column density. The Rydberg unit of energy is commonly used in this field. Many astronomers do not
understand the distinction between H0 and H I. Don’t be one of them! The difference is significant and is
given on the web site.
1.8 Collaborations
Some of the most useful additions to the code have been surprises donated by volunteers. There is a great
deal of work left to be done. You are welcome to help out!
• The shape and brightness of the radiation field striking the cloud.
The spectral energy distribution is a 105 K blackbody with a total luminosity of 1038 ergs−1 . The
blackbody command specifies the shape of the incident radiation field and the luminosity
command specifies its brightness. Luminosity and shape commands are described in Section 5 on
page 22. The brightness of the incident radiation field is specified as either a luminosity or
intensity as described on page 22 below.
This example specifies a luminosity so the inner radius of the cloud must also be specified. This
is the luminosity case described on page 22. A typical inner radius for the shell of a planetary
nebula is a fraction of a parsec, so let’s use 1018 cm. A typical hydrogen density, measured from
ratios of forbidden lines (AGN3 Chapter 5), is roughly 105 cm−3 . Images suggest that the gas fully
covers the star so we include the sphere command (discussed in Section 3.3.1 on page 17). A
solar chemical composition would be used if we didn’t change it. The composition of the ejected
gas has been affected by nuclear processing and dust formed during late stages of mass loss. We
use a built-in mixture of gas and dust that is specified by the abundances command described in
Section 4.1.1 starting on page 20. That uses a composition that is typical of planetary nebulae.
The input commands would be the following:
radius 18 # the log of the inner radius in cm
hden 5 # the log of the hydrogen density cm-3
sphere
abundances planetary nebula
We did not set an outer radius so the calculation will continue until the gas kinetic temperature
falls below the default lowest temperature of 4000 K. Generally this will be near the H+ –
H0 ionization front. Many other stopping criteria could have been used, see Section 3.5 on page
18, but in this simple model we are only interested in emission from the H+ region.
We will have the code create two output files in addition to its standard output. We add save
commands to specify what quantity to output and a file name. save commands are described in
Section 7.5 starting on page 30.
save overview "pn.ovr"
save continuum "pn.con" units microns
The “overview” save file makes it possible to create plots showing the temperature and ionization
structure of the cloud. The “continuum” save file will show the incident and total continuum. We
included the keywords units microns to give the spectrum as a function of the wavelength in
microns. The default would have been the photon energy in Rydbergs. Other options are available.
Use a simple editor like vi, emacs, or notepad to create a file with the commands shown in this
section. Place all of these commands into a single file with the name pn.in. The commands
should be written one after another and there should not be any blank or empty lines before the
end of the commands. The entire file will contain the following:
blackbody, T=1e5 K
luminosity total 38
radius 18
hden 5
sphere
abundances planetary nebula
10 2 TWO VERY SIMPLE MODELS
iterate
print last iteration
save overview "pn.ovr" last
save continuum "pn.con" units microns last
You will end up with three output files, the main output pn.out, and the two save files pn.ovr
and pn.con. Have a look at pn.out. The output is described further in Section 7 on page 28.
Use the two save files to create plots. The first line of a save file gives titles for the columns of
numbers which are separated by tabs. The first column of the overview file gives the distance from
the center of the central star to a point in the cloud. Another column gives the gas temperature.
Figure 1 shows the kinetic temperature as a function of radius. The first column of the continuum
file gives the wavelength in microns. Column seven gives the total emission. Make a plot showing
the emission as a function of wavelength. Both axes will probably need to be logs due to the large
dynamic range. The spectrum is shown in Figure 2.
Dust in the nebula, warmed by light from the central star, produces the large emission feature
centered at ∼ 30µm (Chapter 7 of AGN3). Recombination continua (Chapter 4 of AGN3)
produce the cliff-like features in the optical and near infrared. The emission lines are produced by
both recombination (AGN3 Section 4) and collisional excitation (AGN3 Section 3).
A number of different spectral shapes are stored in the code as look-up tables. This table
command uses a power-law continuum with a slope fν ∝ ν −1 in the visible/UV and with a roll
over in the X-rays and infrared. The intensity of the incident radiation field is given as a flux of
photons that are capable of ionizing hydrogen [cm−2 s−1 ]. A starting radius does not need to be
specified since this is the intensity case.
We still need to specify a hydrogen density and a stopping criterion1 A density of ≈ 1010 cm−3
is deduced from ratios of emission lines (AGN3 Chapter 13). Most published calculations specify
1 A planetary nebula is ionized by a hot star while the radiation field striking a BLR cloud is very energetic, extending
far into the γ-Rays. The gas temperature falls to ∼ 100K on the neutral side of the H+ –H0 ionization front in a PN
since little radiation penetrates through the front. In a BLR cloud a warm partially ionized zone, heated by X-Rays,
extends beyond the front so a stopping criterion must be specified. This is one of the major differences between a cloud
ionized by starlight and one ionized by a hard non-thermal continuum.
2.5 A quasar cloud 11
3.9
Log T (K)
3.8
3.7
3.6
0 1014 2 × 1014 3 × 1014 4 × 1014 5 × 1014
Radius (cm)
Figure 1: The gas kinetic temperature as a function of radius for a simple planetary nebula.
12 2 TWO VERY SIMPLE MODELS
Figure 2: The spectrum of a planetary nebula. The x-axis is the wavelength in microns. The y-axis
is νLν [erg s−1 ]. The large bump peaking at ∼ 30µm is due to thermal dust emission. Most of
the emission lines are hydrogen and helium recombination lines although strong forbidden lines
are also present. Several radiative recombination edges are present across the optical – IR spectral
region.
2.5 A quasar cloud 13
a total column density to define the outer edge of the cloud. Let’s stop at a total hydrogen column
density of 1022 cm−2 . This is large enough for an H+ – H0 ionization front to be present within
the cloud. Solar abundances are fine so we will not change these. The covering factor, the fraction
of 4π sr covered by gas, is small so the sphere command is not included. We have:
hden 10 # log of hydrogen density cm-3
stop column density 22 # log of hydrogen column density cm-2
Many line transfer effects are very important in the BLR. It is necessary to iterate on the solution
to converge the optical depths. But we only want to see the results from the last iteration. We do
this by including the following commands
iterate to convergence
print last iteration
We will create the same two save files but with different file names
save overview "blr.ovr" last
save continuum "blr.con" units microns last
The keyword last says to save results for the last iteration, similar to the command print last
iteration. The entire input script, which we will call blr.in, is as follows.
title BLR spectrum in Quick Start Guide
table power law # a built-in power-law continuum
phi(H) 18.5 # the log of the flux of H-ionizing photons [cm-2 s-1]
#
hden 10 # log of hydrogen density cm-3
stop column density 22 # log of hydrogen column density cm-2
#
iterate to convergence
print last iteration
#
save overview "blr.ovr" last
save continuum "blr.con" units microns last
The lines beginning with “#” are comments and are ignored. Run the code like we did before.
Examine the main output blr.out and make the same plots of the temperature structure and
emitted radiation field. The predicted radiation field is shown in Figure 3.
These are nearly the simplest models that can be calculated. The following sections go over
each of the parameters described above and point to sections of H AZY that go into more detail.
Figure 3: The spectrum of a single broad emission-line cloud in an active nucleus. The x-axis is
the wavelength in microns. The y-axis is ν fν [ erg cm−2 s−1 ].
15
3 Geometry
3.1 Zones and iterations
The code works by dividing a cloud into a large number of thin layers called zones. There is a
default limit of 1400 zones, but this can be changed with the set nend command. The code will
generate a warning if the calculation stops because the default limit to the number of zones was
reached since this probably was not intended.
By default the code will do one iteration, one complete simulation of a cloud. If line or
continuum transfer is important then more than one iteration will be necessary for a valid solution
since the optical depths must be known. The number of iterations is controlled with the iterate
command. The code will complain if too few iterations were performed for the optical depth scale
to be converged.
In the luminosity case the total luminosity of the central source of radiation is specified and the
inner radius of the cloud must be set. The luminosities of emission lines [erg s−1 ] are predicted.
The gas covering factor Ω/4π (AGN3 Section 5.9) is the fraction of 4π sr covered by gas as
seen from the central object. If the central object has a total luminosity L then the nebula
intercepts LΩ/4π of the radiation field. The covering factor will linearly affect line luminosities
but have only second-order effects on line intensities.
If the code can determine the separation [cm] between the continuum source and the cloud then
it will predict emission-line luminosities. Otherwise it will predict line intensities. This is
described further in the section “Geometry” of Part 1 of H AZY.
sphere [expanding, static] tells the code to assume a closed geometry. The shell can be either
static or expanding. By default the shell is assumed to be expanding rapidly enough that lines
escaping from the illuminated face of the shell do not interact with the gas on the far side of the
central hole. If the static keyword appears on the sphere command then lines escaping from one
side will be absorbed by gas on the far side. The expanding option does not change the intrinsic
line width, which is still assumed to be thermal. It only changes whether lines formed in opposite
sides of the shell interact.
The line width used in optical and UV astronomy is not the same as the line width used in radio
astronomy. The description of the turbulence command in Part 1 of H AZY gives more
information.
3.5 What sets the outer edge to the cloud? Why should the calculation stop?
The code starts at the illuminated face of the cloud and works its way into deeper regions. This
integration must stop for some reason. In many cases the outer edge of the simulation is not the
outer edge of the cloud but rather the region where the gas has become cold and neutral. In other
cases the column density of the cloud may be known from observations. Many different stopping
criteria can be specified and the code will stop when the first one is reached.
Cloudy was originally designed to interpret optical/UV emission lines in quasars. These lines
are produced in warm ionized gas so the default is to stop the calculation when the gas
temperature falls below 4000 K. This will often be near the hydrogen ionization front. This would
be a mistake if you want to consider cool atomic or molecular regions.
You should understand what sets the outer edge of the cloud you wish to simulate and then
confirm that the code reached that point. The introduction to the chapter Stopping Criteria of
Part 1 of H AZY goes into this in more detail.
the shielded face. This is unphysical. The physics is described further in the chapter Optical
Depths and Radiative Transfer of Part 1 of H AZY.
The grid command (see Section 6.4 on page 26) can also be used to compute large numbers of
models. Giammanco et al. (2004) show C LOUDY calculations where optically thick clumps are
present in the ISM.
Complex geometries are done by using C LOUDY to compute volume elements within a much
larger cloud. An example is the Cloudy 3D code, available from sites.google.com/site/cloudy3d
and described in Morisset (2006) and Morisset and Stasinska (2008). An image is shown in H AZY
1. The RAINY3D code is another example (Moraes and Diaz, 2009).
at the illuminated face and the field geometry. Cyclotron cooling may become important if the
temperature is high enough. All of this is discussed in the chapter Thermal Solutions of Part 1 of
H AZY. The gas and field are assumed to be well coupled so the magnetic pressure terms are
included in constant pressure models.
where the sum includes H in other molecules and H− . In nearly all cases hydrogen will be in one
of the first three forms.
Turbulent and magnetic pressure, as well as gravity, can be included in the total pressure of a
constant pressure cloud.
luminosity specifies the luminosity emitted by the central object into 4π sr [ erg s−1 ]. By default
this is the luminosity in H0 -ionizing radiation.
intensity is the intensity [erg cm−2 s−1 ] equivalent of the luminosity command. It gives the
intensity of radiation striking the cloud face. Note that this “intensity” is 4π times larger than the
true mean intensity J, which has units erg cm−2 s−1 sr−1 .
ionization parameter This sets the dimensionless ratio of densities of ionizing photons to
hydrogen, U ≡ φ (H)/cn(Htot ) (AGN3, equation 14.7, page 357). The number is the log of U.
This can sometimes be useful since clouds with the same ionization parameter have similar levels
of ionization and temperature. This is equivalent to an intensity command.
The save transmitted continuum, table read pair of commands first saves the continuum
transmitted through a first cloud, then uses the save transmitted continuum command to include
that as part of the SED in a second calculation. Examples of doing this are the simulations
func trans save.in, func trans read.in, func trans read scale.in in the
test suite.
table AGN enters the Mathews & Ferland (1987) quasar continuum.
table HM96 employs the Haardt & Madau (1996) background at a range of redshifts.
table ISM is the local ISM background.
extinguish will extinguish the incident continuum by photoelectric absorption due to a column
density of neutral hydrogen. This command is often used to remove hydrogen-ionizing radiation
in a PDR calculation. The culture in this field is to assume that an unmodeled H+ region has
extinguished much of the incident radiation field.
cosmic ray background will include galactic background cosmic rays. These are important
when the calculation extends into molecular gas. The chemistry of the cold ISM is driven by a
series of ion-molecule reactions that are initiated by cosmic-ray ionization. The required ions will
not exist if no source of ionization is present and the chemistry network may collapse. The code
will complain, but try to compute the model, if the calculation extends into cool regions without
including background cosmic rays.
6 Other commands
6.1 Radiative transfer
All line-formation processes, including line trapping, collisional deexcitation, continuum
pumping, and destruction by background opacities (see AGN3 Section 14.5), are included.
The vary keyword tells the code which parameters to vary. The grid commands specify the
lower and upper limits to the ranges over which the previous parameter is to be varied and also
give the step sizes. The parameters are varied by adding the step size to the initial value until it
exceeds the final value. By default the grid is equally spaced in log space since the values on the
6.4 Grids of models 27
Figure 4: The predicted equivalent width of C IV λ 1549Å as a function of cloud density and the
flux of ionizing photons striking the cloud. See Hamann & Ferland (1999) and Ferland (2003) for
further details.
28 7 THE CODE’S PREDICTIONS
grid command are logs. The actual value of the parameter given on the command with the vary
option is not used but must be present to satisfy the command parser.
There are several output options that are designed for use with the grid command. The no
clobber option tells the save command to write the output from each model into the same save file
rather than overwriting the file (clobbering it) with each new simulation in the grid.
The save line list command makes it possible to read in a list of lines from the file given in the
second pair of quotes and save the predicted intensity into the first file. This is how the results
shown in Figure 4 were produced. The labels in the file must include both the four character string
that is used in the output and the line wavelength. They must match exactly for the line to be
recognized.
The grid command is described in the chapter Miscellaneous commands in Part 1 of H AZY and
the save line list command is described in the chapter Controlling output of Part 1.
the file test.in contains the code’s input commands (read from stdin) and its output (written
to stdout) goes to test.out. The output is fully described in the chapter Output of Part 2 of
H AZY. The default output includes a copy of the input commands, a list of the abundances of the
chemical elements and grains, the physical conditions in the first and last zone, an explanation
why the calculation stopped, the intensity or luminosity of the stronger emission lines, and the
mean ionization, temperature, and column density of many species.
7.2 Understand why the calculation stopped 29
• Warnings start with “W-” and indicate that something is seriously wrong with the
calculation.
• Cautions start with “C-” and indicate that the code is on thin ice.
• Surprises start with “!” and indicate novel or interesting aspects of the results.
30 7 THE CODE’S PREDICTIONS
These are described further in the section Warnings, Cautions, Surprises, and Notes of Part 2 of
H AZY.
save element gives the abundance of ions and some molecules of a particular element as a
function of depth into the cloud.
save molecules gives the densities of a large number of molecular species as a function of depth
into the cloud.
save XSPEC The code can save its predictions in the FITS format used by the XSPEC X-Ray
analysis code. The first application is Porter et al. (2006) and more information is in the section of
Part 1 where the save XSPEC command is described.
8 Example calculations
This section describes the code’s test suite, a series of simulations that are used to automatically
validate the code every time it is changed, and then goes over one model in detail.
type of model; for instance, all BLR models start with “blr ”, all PDR models start with “pdr ”,
etc. The naming convention should be clear if you do a listing of all the files in the test suite
directory (type ls *.in at the command prompt).
The test suite has three parts:
• auto contains several hundred simulations and will run in about half a day on a modern
workstation. This is run every night here in Lexington.
• Slow includes simulations with the large H2 and Fe II atoms and takes several days to run.
Use the Perl script run parallel.pl to run all simulations in the auto test suite. The script
contains detailed instructions for using it in various ways. This is an important step in setting up
the code since it confirms that you have a valid version. A code as large as Cloudy is likely to
discover bugs in a compiler especially when highly optimized code is produced.
Each input file contains assert commands that check if the output gives the expected answer. If
the predictions are wrong the code will print a string saying that an asserted quantity has been
botched. Assert commands provide an automatic way to validate the code when it is installed and
revalidate it every time it is changed. The script checkall.pl confirms that all asserted
quantities have their expected value.
The file doc tsuite.htm within each directory contains a list of all the test cases along with
a summary of what they do and why they are set up the way they are. You can get an idea of how
to set up models by reviewing this file.
Run the orion hii pdr pp.in script with the command
You will end up with many save output files with names orion hii pdr pp.* and a main
output file called orion hii pdr pp.out.
Examine the file orion hii pdr pp.out. First confirm that the calculation stopped for the
intended reason. The reason is given after the last zone results, and, for this simulation, should be
because the outer radius was reached.
The simulation may have had pressure convergence failures where the cloud passed through a
thermal front. Thermal fronts, and the problems they cause, are described in the chapter Problems
of Part 2 of H AZY. Convergence problems are announced with lines that begin with the string
“PROBLEM”.
Next, identify some of the strongest emission lines in the spectrum. These are listed towards the
bottom of the output following the string Emission Line Spectrum. Two iterations were
performed to converge the optical depth scale. Make sure that you are looking at the last iteration
(similar information is printed for each iteration). The command print last would tell the code to
print only results of the last iteration but is not used in this test. The emission-line intensities are
given relative to Hα. If dust were not present the Lα / Hβ ratio would be about 34 (AGN3
Chapter 5). Actually Lα is predicted to be only about twice as strong as Hβ because Lα is
efficiently absorbed by dust. The line [O III] λ 5007Å is one of the strongest lines in the spectrum,
as expected for an H II region.
Two blocks of emission-line intensities are printed. The first block Intrinsic line
intensities gives the total emission in all directions but does not include the effects of
extinction due to the molecular cloud. This spectrum would be observed after correcting for
reddening. The second block of lines Emergent line intensities gives the spectrum
that emerges from the illuminated face of the cloud. Some fraction of each line is emitted towards
the hemisphere containing the molecular cloud. The grain albedo is used to compute the fraction
that is reflected back towards the illuminated face.
Some integrated properties of the cloud are listed towards the end of the file. Column densities
of various species are given. The line with Log10 Column density (cmˆ -2) gives
column densities of H0 , H+ , and H2 : the cloud is predominantly molecular. Mean temperatures
are also given following the line Log10 Mean Temperature (over volume). The H+
region has a mean temperature of nearly 104 K. The H0 region has a mean temperature a bit under
103 K, and the H2 region has a mean temperature of around 20 K. The output ends with a list of
the asserted quantities. These compare the predictions of your executable with its historical
predicted quantities.
The chapter Output in Part 2 of H AZY goes over the code’s output in detail. Have a look.
34 8 EXAMPLE CALCULATIONS
106
1000
Flux (erg cm-2 s-1)
10-3
Total
Incident
10-6
Figure 5: The incident (smooth) and emitted spectrum contained in the orion hii pdr pp.con
file. The x-axis is the wavelength in microns and the y-axis gives v fv [ erg cm−2 s−1 ]. This is
produced by the save continuum command.
36 8 EXAMPLE CALCULATIONS
-2.5
-5
2H2/H
HI
Log fraction
-7.5 H II
-10
-12.5
-15
-17.5 16 16 16 17 17
0 2.5 × 10 5 × 10 7.5 × 10 10 1.25 × 10
Radius (cm)
Figure 6: The hydrogen ionization structure. The x-axis is the depth in cm and the y-axis gives the
log of the fraction of H in H+ , H0 , and H2 .
8.3 Heads ups for classes of objects 37
5
10
Grains
Free Electrons
4
10
Temperature (K)
100
10 16 16 16 17
0 2.5 × 10 5 × 10 7.5 × 10 10
Radius (cm)
Figure 7: Temperatures of grains (the lower cluster of curves) and free electrons (the higher curve).
They become nearly equal deep in the molecular cloud. The y-axis is the temperature and the x-axis
is the depth into the cloud.
38 8 EXAMPLE CALCULATIONS
6
10 H0
H2g
H2+
CH
CH+
1 OH
O2
CO
Density (cm )
-3
H2O
SiO
-6 N2
10
CN
-12
10
-18
10 16 16 17 17 17
0 2.5 × 10 7.5 × 10 10 1.25 × 10 1.75 × 10
Radius (cm)
Figure 8: Densities [cm−3 ] of some of the molecules included in the calculation are shown as a
function of depth [cm] into the cloud.
8.3 Heads ups for classes of objects 39
The density is high enough for free-free absorption of low-energy radiation to be a significant
heating process. As a result the infrared continuum can have a surprising effect on the temperature
of these clouds. Extrapolating a reasonable power-law continuum into the infrared may result in
runaway free-free heating. This, and other practical aspects of BLR clouds, is discussed in Ferland
(1999a) and in the last two chapters of AGN3.
Does dust exist in the ionized gas? Depletion patterns are not clear, as discussed by Ferguson et al.
(1997). The NLR is discussed further in the last two chapters of AGN3.
It is critical that background cosmic rays, or a source of X-rays, be included if the simulation is to
extend into a molecular cloud. The chemistry of cold interstellar matter is driven by a series of
ion-molecule reactions (AGN3 Chapter 8 and Section 11.3). Chemical interactions between atoms
and ions have smaller activation barriers than interactions between neutrals so chemistry can occur
more quickly when ions are present. Ions will not exist if a source of ionization is not present and
the chemistry network may collapse. Always include the cosmic ray and background commands.
The double command should be entered if the calculation stops before the outer edge of the
molecular cloud is reached. See the discussion in Section 3.5.1 on page 18.
The culture in the PDR modeling community is to treat the PDR as an isolated phenomenon
rather than an extension of the H II region. Nature does not do this, but you can force the code to
do it by removing all hydrogen-ionizing radiation from the incident continuum. This is done with
the extinguish command (see Section 5.3.1 on page 24).
If you do extinguish the hydrogen-ionizing radiation and start a PDR at that point you will
usually find a thin layer of fairly highly-ionized hydrogen. This is caused by continuum pumping
of the Lyman lines which then populates the metastable 2s term of hydrogen. That term is then
ionized by the Balmer continuum or Lα. Continuum pumping of Lyman lines is called “Case C”
in the ionized-cloud community (Ferland, 1999b) and is described further in AGN3 Section 11.4.
Classical PDR calculations do not consider this physics although it is included in Cloudy. This
photoexcitation can be disabled by telling the code to assume that the Lyman lines are very
optically thick and so are self-shielded. This is done with the Database H-like Lyman pumping
off command. The Database H-like Lyman pumping off command should not be included in
any realistic simulation, which should start with the H+ region and extend into the PDR as was
done by Abel et al. (2005).
By default the code will stop when the gas kinetic temperature falls below 4000 K. PDRs are
generally cooler than that. Many PDR calculations assume that the cloud thickness corresponds to
a visual extinction AV of 10 mag. To do this we must tell the code not to stop when the gas
becomes code, and to use this extinction. This would be done by
stop temperature off #do not use kinetic temperature as a stopping criterion
stop Av 10 #stop when visual extinction reaches 10 magnitudes
H2 Column Densities
1011
Orion H II/PDR
N(v,J)/g(v,J)
109
104 1.5×104 2×104 2.5×104 3×104
10 10 H2 Column Densities
109
4000 K
108
107
500 K 1000 K 2000 K
106
104 1.5×104 2×104 2.5×104 3×104
Excitation energy [K]
Figure 9: Predicted H2 column densities are shown as a function of excitation energy for the Bald-
win et al. (1991) Orion H II - PDR model.
need here. The remaining lines give the column densities and excitation energies for all levels in
the ground electronic state of H2 .
Import the output of the save H2 column densities command into Veusz. In the import data
dialogue specify that the data are tab delimited and to ignore the first three rows after the header.
Import the rest of the data.
Create an x-y plot and choose column three, the excitation energy in K, as the x-axis. Choose
colden/stat wght as the y-axis. We divide by the statistic weight to avoid having the data jump up
and down on the plot by a factor of three due to the ortho/para distinction. For plot formatting,
choose no line (set line color to while) and use a symbol for the points. Make the y-axis a log but
leave x as linear.
Choose an x-axis range to suite your observations. The range 5 × 103 K − 3 × 104 K includes
most levels that can be detected in the 2 µm window.
Next we need to add lines indicating the excitation temperature. It is easiest to use a spreadsheet
to create pairs of points to define this line. Export this data into a tab delimited file so that Veusz
can read it. Import it into Veusz as a new data set.
To convert observations of H2 lines into column densities you need to divide the observed line
by a ratio of atomic constants.
REFERENCES
J. Kingdon, G. J. Ferland, and W. A. Feibelman. Grains in ionized nebulae: Spectral line diagnostics. ApJ,
439:793–799, February 1995. doi: 10.1086/175217.
M. Moraes and M. Diaz. HR Del Remnant Anatomy Using Two-Dimensional Spectral Data and
Three-Dimensional Photoionization Shell Models. AJ, 138:1541–1556, December 2009. doi:
10.1088/0004-6256/138/6/1541.
C. Morisset. Cloudy 3D, a new pseudo-3D photoionization code. In M. J. Barlow & R. H. Méndez, editor,
Planetary Nebulae in our Galaxy and Beyond, volume 234 of IAU Symposium, pages 467–468,
2006. doi: 10.1017/S1743921306003772.
C. Morisset and G. Stasinska. An atlas of synthetic line profiles of Planetary Nebulae. Revista Mexicana de
Astronomia y Astrofisica, 44:171–180, April 2008.
D. Osterbrock and E. Flather. Electron Densities in the Orion NEBULA.II. ApJ, 129:26, January 1959.
doi: 10.1086/146592.
A Veusz Cookbook
Most of the plots in this Guide were created with Jeremy Sanders’ Veusz plotting package. Veusz
is an open-source and runs on Windows, Mac OS X, and Linux. Veusz can be downloaded from
https://veusz.github.io/. What follows are a few recipes for basic Cloudy plotting
tasks that will get you started with Veusz. For more information, see the Veusz manual at
https://veusz.github.io/help-support/. This document assumes that you are
using Veusz 1.6 or later.
1. Click “Data”
2. Select “Import”
3. Choose the file that contains your data clicking “Browse” and selecting the file
6. At the bottom, you have the option to link the dataset to the original file.
7. Click “Import” and each column of your data will be saved in a dataset designated by the
column heading.
8. Click “Close”
2. Select “Add xy” : xy1 will be created in the top white box on the left (Editing Box)
3. The middle box (properties box) on the left side gives the properties of the xy1 pointset
4. In the properties box, click the blue down arrow to the right of “X data”
44 A VEUSZ COOKBOOK
2. Select “Export”
4. Click the blue down arrow to the right of the “Files of Type” (at the bottom)
2. Click the blue down arrow on the “Marker” drop down box
3. Select “none”
2. Enter the desired title for the x-axis in the “Label” textbox inside the Properties Box
2. Enter the desired title for the y-axis in the “Label” textbox inside the Properties Box
3. Enter the desired contour levels in the “Manual Levels” textbox separated by commas.
Figure 10 shows an example, taken from the grid extreme test in the slow test suite. This uses
the spectrum2 colormap and goes from red to blue as the temperature goes from low to high
values.
6
15 −1
12 −2
−3
−4
10 3 4 −5
5 −3
5
Log Hydrogen Density/cm-3
0 2n(H2)/n(H)
T(K)
−5
15
−1 −1
−5
−4
−−2
3
10 −1
−1
−2
−3
−4
−5
5
n(H+)/n(H)
0 n(H0)/n(H)
−5
0 1 2 3 4 5 60 1 2 3 4 5 6
Log Energy Density Temperature/K
Figure 10: This shows physical conditions over a very broad range of hydrogen density and energy-
density temperature. The log of the electron kinetic temperature is shown in the upper left, and
hydrogen ionization and molecular fractions in the remaining panels. The gas goes to the Compton
temperature in the upper left corner of each panel, is in the blackbody limit across the top, and is
close to LTE across the right-hand edges of the figure.
A.17 Documenting your work 49
4 0
-2.5
Electron temperature
3.5 -5
2 H2 / H
-7.5
3
-10
2.5 -12.5
-15
2 -17.5
0 2.5 5 7.5 1012.5 0 2.5 5 7.5 1012.5
Depth (1016 cm) Depth (1016 cm)
0 0
-2
-1
-4
H+ / H
H0 / H
-2
-6
-3
-8
-4 -10
0 2.5 5 7.5 1012.5 0 2.5 5 7.5 1012.5
Depth (1016 cm) Depth (1016 cm)
Figure 11: The electron kinetic temperature, and fractions of H in H2 , H0 , and H+ , are shown as a
function of depth into the Orion H II region / PDR.