Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

40
Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics John ZuHone NASA/Goddard Space Flight Center NASA Postdoctoral Program DOE CSGF Alumnus

description

This is a talk I gave at to the "Computational Research in Boston and Beyond" (http://math.mit.edu/crib/) group in October 2013 at MIT.

Transcript of Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Page 1: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

John ZuHoneNASA/Goddard Space Flight CenterNASA Postdoctoral ProgramDOE CSGF Alumnus

Page 2: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Outline

• Numerical simulations in astrophysics

• yt: a framework for analysis of astrophysical* data

• An application: cold fronts in galaxy clusters

Page 3: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Numerical Simulations in Astrophysics

Page 4: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Astrophysical Modeling

• Astrophysical modeling basically boils down to three things (at the risk of oversimplification):

• Fluids: hydrodynamics, equations of state, material properties, etc.

• Fields: gravity, electromagnetism, dark energy, etc.

• Particles: collisionless plasmas, dark matter, cosmic rays, stars(!), etc.

• In reality, the distinctions between these things are fluid (no pun intended), but in practice they are amenable to very different simulation techniques and approximations

• The most versatile codes combine the simulation of many effects in a single framework

Page 5: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Varieties of Simulations

• Stellar explosions

• Galaxy cluster mergers

• Cosmological structure formation

• Accretion disks

• Star/planet formation

• Black hole feedback

• ...

Page 6: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Physics of Simulations

• Hydrodynamics/Magnetohydrodynamics: conservation equations for the fluid density, temperature, pressure, and magnetic field

• Equations of State: ideal gases, degenerate matter, radiation pressure

• Source terms: nuclear burning, heating, radiative cooling

• Diffusive processes: viscosity, thermal conductivity, resistivity

• N-body: stars, collisionless plasmas, dark matter particles

• Gravity

Page 7: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Astrophysical Simulation Codes

FLASH Enzo Gadget

Athena Arepo(Davis et al 2010)

(Di Matteo et al 2005)(Jordan et al 2008) (Skillman et al 2013)

(Springel 2010)

Page 8: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Challenges for Astrophysical Simulation Codes

• Coupling of diverse physical processes

• Coupling between particle and grid-based fields

• Particle-mesh method (Hockney & Eastwood 1988)

• Mapping particle quantities to mesh (e.g., mass) and mesh quantities to particles (e.g., forces)

• Particularly important for cosmological simulations since the dominant mass component is collisionless dark matter

• Coupling between conservation equations and source terms

• Conservation equations: Mass, momentum, energy, etc.

• Source terms: Heating, cooling, stirring, etc.

• Rely heavily on operator splitting

• Often places severe constraints on the timestep

Page 9: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Particle-mesh/hydrodynamics simulation of merging galaxy clusters (ZuHone 2011)

Gas Dark Matter

Page 10: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Challenges for Astrophysical Simulation Codes

• Handling large dynamic ranges

• Need to resolve small scales within large domains

• Shocks, contact discontinuities, regions of high density, turbulent cascades...

• Adaptive/Static Mesh Refinement (AMR/SMR) allows us to do this without incurring a severe computational cost and exorbitant memory footprint Enzo Cosmological Simulation with AMR

Page 11: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Challenges for Astrophysical Simulation Codes

• What does a method do well and where does it break down?

• Grid-based hydrodynamics codes:

• What they do well:

• Resolve shocks and contact discontinuities

• Resolve fluid instabilities and turbulence, mixing of gases at the cell level

• Well-defined discretizations of conservation equations, including complex derivative terms

• What they struggle with:

• Coupling with Lagrangian representations of the fluid (passive tracer particles) is often inconsistent ()

• High memory footprint even with adaptive meshes

• Not strictly Galilean invariant x → x− vt

Page 12: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Challenges for Astrophysical Simulation Codes

• What does a method do well and where does it break down?

• Particle-based hydrodynamics codes:

• What they do well:

• Capable of following “Lagrangian” mass elements of the fluid, allowing one to determine the evolution of a particular mass of gas over time

• Typically have light memory footprints

• Galilean invariant

• What they struggle with:

• Require artificial viscosity to resolve shocks, which often has to be finely tuned

• Resolving fluid instabilities and turbulent cascades

• Difficulty implementing particular equations and constraints, e.g. ∇ ·B = 0

Page 13: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Agertz et al 2007, “Fundamental Differences Between SPH and Grid Methods”, Monthly Notices of the Royal Astronomical

Society

grid-based codes

particle-based codes

Page 14: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Moving On to Analysis...

• There are many simulation codes, but there’s only one sky.

• The codes have different data structures, methods, assumptions, IO formats, units, variable names...

• For some analysis toolkits, access is given to the data structures of the output files, but after that you’re on your own.

• But we want answers to physical, not computational questions.

• A computational question: “What is the sum of the variable “density” times the cell volume within these cells on these grids on this level of refinement?”

• A physical question: “What is the total mass within a sphere of radius 300 kpc centered at (0,0,0)?”

Page 15: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

yt: A Framework for the Analysis of Astrophysical Data

Page 16: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Thinking Different

• Much of programming for analysis tasks in astrophysics is still procedural--object-oriented programming hasn’t caught on very fast (e.g., widespread use of Fortran, C, and IDL).

• Widespread adoption of Python is changing that.

• A vast scientific software landscape has emerged in Python in recent years: NumPy, SciPy, AstroPy, IPython, etc.

• yt is an important addition to this landscape for simulation data. s

Page 17: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

The Philosophy of yt

• Address physical, not computational questions.

• Heavily reliant on objects:

• “Data container” objects

• “Field” objects

• “Quantity” objects

Page 18: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Data Container Objects

Orthogonal Rays Non-orthogonal Rays

Slices Oblique Slices Projections

Spheres Rectangular Prisms Disks/Cylinders Boolean Regions Ellipsoids

1D

2D

3D

Page 19: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Field Objects: Democratizing Fields

• Traditionally, the “fields” of a simulation have been the variables stored on disk.

• In my experience, procedural coding led to piecemeal routines that gather the field data from files and perform specific tasks (e.g., one script to compute entropy within a spherical volume, another script to sum up the kinetic energy over the entire domain, etc.)

• yt expands the concept of a “field” by including “derived” fields within this definition

• Fields include grid and particle-based, scalar and vector, and even “helper” fields

Page 20: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Quantity Objects

• Quantities are reductions of data within data containers

• Sums, weighted averages, center of mass, bulk velocity, etc.

• Derived quantities can be created just like derived fields

Page 21: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Demonstration Interlude using the IPython Notebook

Page 22: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Other Analysis

• Streamlines

• Particle Trajectories

• Time Series Analysis

• Light Cones

• Object Finding (halos, clumps)

• Isosurfaces

• Loading Arbitrary Data

• Synthetic observations

Page 23: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

The yt Community

The Website: http://yt-project.org

Page 24: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

The yt Community

Twitter: @yt_astro

Google+: yt Project

Page 25: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Outside Astrophysics

Earthquake Simulations Nuclear Reactorshttp://yt-project.org

Page 26: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

An Application: Cold Fronts in Galaxy Clusters

Page 27: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Galaxy Clusters

• Fascinating objects!• Galaxies: star formation,

supernovae, active galactic nuclei

• Intracluster medium: diffuse (n ~ 10–4-10-1 cm-3), hot (T ~ 107-108

K), magnetized (B ~ 0.1-10 μG), plasma emits X-rays

• Dark matter: collisionless particles that interact only by gravity comprise vast majority of the mass in clusters

Page 28: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Observations of Cold Fronts

X-Ray Surface Brightness Temperature

Dupke + 2007

Chandra

Ghizzardi+ 2013

Abell 496

Page 29: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Observations of Cold Fronts

X-Ray Surface Brightness Temperature

Ghizzardi+ 2013

LX ∝ neniΛ(T, Z)

Page 30: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Observations of Cold Fronts

Page 31: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

• Nearly all of the fronts are smooth and sharp, but in the simple fluid picture this shouldn’t be the case:

• The fronts should be susceptible to the effects of fluid instabilities (e.g. Kelvin-Helmholtz, Rayleigh-Taylor)

• Thermal conduction, if present, should smooth out the temperature gradient

• This implies that cold fronts potentially serve as a powerful probe of the microphysical properties of the cluster plasma

Why Are the Fronts Smooth and Sharp?

Page 32: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

The Effect of Magnetic Fields

• In the cluster plasma, the electrons and ions are essentially forced to travel only along field lines

• Even slowly moving gas can reorient magnetic fields and produce tangential “draping layers”

• These layers can suppress instabilities and diffusion across the front surfaces Dursi and Pfrommer 2007

Page 33: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

The Effect of Magnetic Fields

Temperature Magnetic Field

Page 34: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

The Effect of Magnetic Fields

No Fields With Fields

Page 35: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

The Effect of Viscosity

Inviscid Viscous

Page 36: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Simulated Observations

• In the simulation, we have God-like qualities: we can just grab the density, temperature, etc. anywhere we want

• In the real thing it’s not so... we’re limited by:

• Projection effects

• Background

• Modeling limitations

• A more direct comparison to the real data is facilitated by constructing mock observations

Page 37: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Simulated Observations

• Basic procedure:

1. For each cell, compute an energy spectrum based on the density, temperature, and material properties of the gas in the cell

2. Use the spectrum as a CDF from which to draw random photon samples

3. Choose a line of sight, and project photon positions onto the plane. Apply cosmological and Doppler shifting to the photon energies. Apply absorption due to neutral hydrogen in our galaxy.

4. Convolve the resulting photon distribution with instrument responses.

Page 38: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Viscosity

Inviscid Anisotropic Viscosity

Isotropic Viscosity

Page 39: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Conduction

Page 40: Applications of Advanced Numerical Simulations and Analysis in Theoretical Astrophysics

Summary

• Numerical astrophysics is a wide-open field driven by state-of-the art simulation codes and techniques empowered by high-performance computing platforms

• New analysis tools such as yt are making analyzing large and/or complicated simulations easier and with greater capabilities than ever before

• A key aspect of the way forward involves the comparison of mock observations generated from simulated data to observations of real astrophysical objects