Analyzing AMR output
Analyzing the output from an amr simulation is more difficult because of
the complicated grid structures; however a number of tools have been developed
to help. First, as pointed out in the section on the output format, since
each grid is it's own self-contained HDF file, each grid can be analyzed
by itself with any tool that reads HDF (IDL, Transform, etc.). Unfortunately,
for simulations with hundreds or thousands of grids this is of little assistance.
More practically, here are some other analysis methods, most of which assume
that you are doing a 3D simulation (and often that it is a cosmological
simulation).
-
2D projections - The code has the
built-in ability to make two-dimensional projections, at a specified resolution,
of a number of quantities (tailored for cosmology) along any axis of a
given three-dimensional region. The resulting 2D HDF SDS's can then be
imaged with a number of tools, including IDL.
-
Extractions - A region (generally 3D,
but this option also works for 1 and 2-dimensions) can be extracted with
a uniform resolution and saved as a single grid. This is useful for other
packages developed for single-grid codes. This option is also built into
the amr code.
-
Peakfinder - In the analysis package (amr_mpi/anyl),
there is a routine which can find peaks in the baryon or dark-matter distribution,
subject to a number of qualifications (such as minimum separation).
[Note: enzohop is recommended for most peak finding].
-
Hop halo finder - Also in the analysis
package is a version of Eisenstein & Hut's hop halo finder, as applied
to the dark matter.
-
Profiles - Radial profile of density and
many other quantities can be generated with another analysis routine, given
an object's position.
-
Particle representation -
The code also has the ability to convert the grid into a set of particle
positions and densities, temperatures, etc. This can then be read into
a particle-analysis code.
(Note: in this section we drop the "mpirun -np 1" that is required
to run mpi programs. Note also that all analysis programs only function
with one processor -- they are not parallelized. Finally, the square
brackets [] used below imply an optional argument and are not meant to
be typed.)
2D projections
The projection is done with the amr code itself and is of the following
format:
enzo -p dim [-l level] [-m] [-b point1] [-f
point2]
amr_filename
an example might be:
enzo -p 1 -l 6 -b 0.4 0.4 0.4 -f 0.6 0.6 0.6 data0015
The -p option, which specifies the dimension along which the projection
is to occur, and the amr output_filename are the only arguments required.
The projection dimension (dim) is an integer from 0 to 2, and indicates
along which dimension the projection occurs. For example, a projection
along axis-0 produces an image with y-z axis.
The -l option specifies the resolution of the image, by indicating a
level at which the projection will occur. The integer value level is
zero-based so -l 0 produces an image with the same resolution
as the root grid. Levels larger than the maximum in the output_filename
may be used. The default value is 0.
The -m option smooths the image by doing a linear interpolation between
coarse-grid points. If this option is not invoked, the result will be pixelated
in regions in which the pixels are smaller than the grid cells (although
this may be useful information). This option takes somewhat longer. The
default is no smoothing.
Finally, there are two ways to specify the three-dimensional region
in which the projection is to occur, one of which is shown in the commend-line
above. This uses the -b and -f (begin and finish) flags. These flags each
take a triplet (in 3D) of floats which specify the the two corners of the
projection volume. The units are those of the problem (set by DomainLeftEdge
and DomainRightEdge). For cosmology problems, this means numbers that range
from 0 to 1. The default is the entire domain.
The other mechanism for specifying the projection volume is to specify
coordinate indexes. This is done with the -s and -e flags, each of which
take a triplet of integers. The integers refer to index positions (zero-based)
within that level. This means the numbers should range between 0 and n*r^l-1
where n is the size of the top grid, r is the refinement factor and l is
the level. The advantage of this method is that the size of the region
can be precisely set, the disadvantage is the calculation is a bit more
difficult. Although these two methods can be mixed (by specifying one corner
with one method and the other corner with the other method), it is undefined
to specify one corner twice. Finally, the error checking on these values
is not great, and specifying a region with negative volume or one that
goes off the edge may result in a core dump rather than an error message.
The result is placed in the file amr.project and consists of 2D scientific
data sets (HDF format) of the following quantities (subject to change):
-
baryon density (M(solar)/Mpc^3)
-
a field proportional to the bolometric free-free emission (but see below)
-
dark matter density (M(solar)/Mpc^3)
-
temperature (K, weighted by free-free emission)
-
maximum level along projection
-
the y-parameter of thermal SZ effect
-
the DT/T value of the kinematic SZ effect
-
The mean density-weighted fractional metallicity of the gas along the line
of sight
-
The star particle density (M(solar)/Mpc^3)
If there is a file called "ProjectionParameters" in the same directory,
then this file is opened and searched for parameters relating to the generation
of the X-ray emission field. The following parameters (specified
with the usual conventions: Parameter = ...) are recognized: XrayLowerCutoffkeV,
XrayUpperCutoffkeV
and XrayTableFileName. The first two specify the X-ray band
(observed at z=0) to be used, and the last gives the name of an ascii file
that contains the X-ray spectral information. A gzipped version of
this file good for bands within the 0.1 - 20 keV range is available in
amr_mpi/exe/lookup_metal0.3.data.gz. If these parameters are specified,
then the second field is replaced with integrated emissivity along the
long of sight in units of 10^-23 erg/cm^2/s. Also, see below in the
profiling section.
Extractions
The command-line for an extraction is very similar to a projection:
enzo -x [-l level] [-b point1] [-f
point2]
amr_filename
The meaning of the level (-l) and region (-b, -f) flags are the
same as for the projection (see above).
The output is a standard grid file and so consists of an HDF file with
a number of scientific data sets. The scientific data sets are named
and have dimensional axis. The units are code units with the exception
of temperature, with is in degrees K. See the file CosmologyGetUnits.C
for a definition of code units, or look in the ascii output file (search
for lines which start DataCGSConversionFactor = ...).
Peakfinder
The peakfinder is part of the amr_mpi/anyl package (see the downloading
instructions),
and can be compiled (once the MACHINE_NAME macro in the Makefile
is set and enzo itself is compiled) with:
make findpeaks
And should produce the executable amr/anyl/findpeaks.
It is run with the command-line:
findpeaks [-n number] [-m min_density] [-s separation]
amr_filename
peak_filename
The algorithm reads in the amr output file amr_filename and looks
for peaks (a density larger than it's 26 neighbours) in the baryon density
distribution. The result is output as a series of locations (float
triplets between 0 and 1) to the file peak_filename, sorted by the
peak density.
The -n option takes an integer argument and returns the number
largest peaks. Default: 1
The flag -m tells the algorithm to only check peaks width densities
larger than the float value min_density which, for cosmology, is
in units of the mean density of non-relativistic mass (at the redshift
at which the output occurred). This option is mostly useful for speeding
up the algorithm, since a large value for the minimum density can drastically
cut down the number of cells that need to be checked. Default: 1
The last option, -s, specified the minimum separation between
peaks (the lower density peak is discarded), and the float value separation
should be in terms of comoving Mpc/h. Default: 0
This peakfinder really does just find local peaks -- a halo finder (see
below) is probably what you're looking for.
Halofinder
The halo finder is part of the amr_mpi/anyl package. It
uses the hop algorithm (and source code) developed by Daniel Eisenstein
and Wayne Hu (astro-ph/9712200)
-- thanks to them for making the code available. The compilation
is currently a bit convoluted because hop assumes 4 byte floats.
This means that you must compile everything in single precision; change
the PRECISION = r8 macro to PRECISION = r4 (in both amr_mpi/src/Makefile
and amr_mpi/anyl/Makefile). Then compile enzo (make clean first if
previously compiled with PRECISION = r8), and then compile enzohop: "cd
amr_mpi/anyl; make enzohop". Run with:
enzohop [-b #] [-f #] [-t #] [-g] [-d] amr_filename
The only required argument, amr_filename, is the name of an amr
output file.
The optional flags that specify a region to work on (-b for begin and
-f for finish) are as described in the projection section. Default:
the whole region
The next flag (-t) takes a float and specifies the most important threshold
used in hop (the outer density definition). Default: 160
The -g flag indicates that baryon grid points should be converted to
particles and passed into hop (along with the dark matter). This
is not recommended. Finally, the -d flag is the usual debugging flag.
The output is placed into a number of files, only one of which is described
here (see hop for the others). HopAnalysis.out contains a list of
the results groups, their particle number, mass and the location of the
densest particle.
Profiler
It is often useful to compute azimuthally-averaged radial profiles.
The utility amr_mpi/anyl/enzo_anyl can be used for this.
Compile it the same way as findpeaks (make enzo_anyl), and run
with the command-line:
enzo_anyl amr_filename anyl_parameter_file
The first argument, amr_filename, is the name of an amr output
file, and the second argument is the name of an ascii file which contains
some parameters for the analysis routine. An example
of
this file should be in amr_mpi/anyl/AnalyzeClusterParameterFile.
The format of the parameters is the same as for the enzo code itself.
The parameters are:
-
Rinner - The inner edge of the profile in comoving Mpc. Default:
0.0001 of the ComovingBoxSize
-
Router - The outer edge of the profile in comoving Mpc. This
should be well outside the expected virial radius of the object.
Default: 0.1 of the ComovingBoxSize
-
CenterPosition - A triplet of floats from 0 to 1 specifying the
location of the center. This parameter is ignored if CenterListName
is set. Default: if left unspecified, the location of the maximum
density in the volume is used.
-
NumberOfPoints - An integer: the number of points in the profile.
The radial shells are spaced in equal logarithmic intervals in radius (except
for the first point) Default: 16
-
VirialDensity - This float indicates the overdensity, relative to
the critical (not mean) density, that is to be used to define the virial
radius. Default: 200
-
CenterListName - The name of a file containing a list of center
positions (each line should contain a triplet of floats, between 0 and
1). Up to 1000 positions may be specified. If not set, then
the parameter CenterPosition is used to define a single center. Default:
NULL
-
MeanVelocityVirialFraction - This is the fraction of the virial
radius which is used to determine the mass-weighted mean velocity of the
object. It can be useful to set this significantly less than the
1.0 (i.e. the virial radius) if the center of the object is moving relative
to the center-of-motion of the entire object. Default: 1.0
-
XrayLowerCutoffkeV - If this and the next three parameters are specified,
then an accurate calculation of the X-ray emissivity is made. This
parameter and the next indicate the X-ray band (in keV at z=0) that is
to be used in the calculation. Default: none
-
XrayUpperCutoffkeV - The high energy end of the X-ray band in keV.
Default: none
-
XrayTableFileName - The name of the ascii file which contains the
spectral lookup table. There is a version computed with a Raymond-Smith
code for a low density hot gas with a metallicity of 0.3 relative to solar
in the file amr_mpi/exe/lookup_metal0.3.data.gz.
-
ComputeDiskInformation - This toggle flag (1 is on, 0 off) controls
whether a disk profile and image is generated. If yes, then the angular
momentum vector of the dense gas (see below) is used to define a disk.
Default: 0
-
DiskImageSize - The number of pixels on a side in the three disk
images (face, and two sides) which are computed if the above flag is turned
on. Default: 100
-
DiskRadius - This is the fraction of the virial radius which the
disk image comprises (i.e. each pixel is of size r_virial*DiskRadius/DiskImageSize).
Default: 0.2
-
LowerDensityCutoff - This is lower density cutoff (in Msolar/Mpc^3)
for material to be counted as dense for the calculation of the "dense"
angular momentum gas, the cold fraction and the dense fraction. Default:
1e14
-
UpperDensityCutoff - The maximum density (in Msolar/Mpc^3) for gas
to be counted in the "dense" angular momentum. Default: 1e35
-
ColdTemperatureCutoff - The highest temperature (in K) for gas to
be considered cold. Used in the calculation of the "dense" angular
momentum gas and in the cold fraction. Can be over-written by the
following parameter. Default: 15000
-
ColdTemperatureCutoffVirialFraction - If set, this parameter sets
ColdTemperatureCutoff (for each cluster) to this value times the predicted
virial temperature (see below). Default: none
-
VirialTemperatureNormalize - The normalization of the predicted
virial temperature relation (mass - temperature - redshift relation), relative
to that in Bryan & Norman (1998). If the virial mass is > 1e8
solar masses then mu (the mean mass per particle) is set to 0.6, otherwise
mu=1.22.
The output is a set of files starting with AnalyzeCluster.
If the CenterListName was set, then they are numbered with a three digit
identifier (AnalyzeCluster000, etc.). Each profile produces
for (or more) files, the first contains general information as well as
the baryon profile and has no suffix. Then there are three more which
have the suffixes .DarkMatter, .Species and .Inertial,
which contain profile relating to the particles, the multiple species (if
used) and the inertial tensors of the gas and particles. Finally,
two other disk profiles may be generated if requested (see parameters above).
Each file consists of description information with the pound symbol
(i.e. a comment) at the start of the line, and then the profile itself.
The first column is the center of the bin, while the second column is the
right edge of the bin, in terms of Mpc (note: not comoving Mpc/h).
Virial information is also included in AnalyzeCluster, (mass,
radius, mean velocity within, etc.), and each file contains a line which
gives the mean of the profile quantities within the virial radius.
Particle Representation
To turn the grid points into particles, use the command-line:
enzo -o amr_filename
This will create two HDF files, one called amr.particles.gas and the
other amr.particles.dm which contain one-dimension scientific data sets
of the "particle" positions, velocities, radii, density, temperature, etc.
This description will be lengthened if interest is expressed in this
format. Note that there is a version which outputs ascii files called
dumpgrids (in amr_mpi/anyl). Again, this is under development and
is intended for conversion to other analysis/visualization programs.
last modified: March, 2000