0% found this document useful (0 votes)
159 views34 pages

Computational Astrophysics L1

This document provides an overview of a computational astrophysics course. The course covers numerical methods for astrophysical simulations, including smoothed particle hydrodynamics (SPH). It consists of 6 lectures: 1) introduction to numerical methods, 2) the SPH formulation, 3) construction of SPH smoothing functions, 4) SPH for general dynamic flow, 5) N-body techniques, and 6) numerical implementation. Students complete 3 projects involving SPH simulations and there is a final presentation. The course aims to teach students how to model hydrodynamical flow and orbital mechanics numerically.

Uploaded by

Kivanc Sengoz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
159 views34 pages

Computational Astrophysics L1

This document provides an overview of a computational astrophysics course. The course covers numerical methods for astrophysical simulations, including smoothed particle hydrodynamics (SPH). It consists of 6 lectures: 1) introduction to numerical methods, 2) the SPH formulation, 3) construction of SPH smoothing functions, 4) SPH for general dynamic flow, 5) N-body techniques, and 6) numerical implementation. Students complete 3 projects involving SPH simulations and there is a final presentation. The course aims to teach students how to model hydrodynamical flow and orbital mechanics numerically.

Uploaded by

Kivanc Sengoz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Computational Astrophysics

Lecture 1: Introduction to numerical methods


Lecture 2: The SPH formulation
Lecture 3: Construction of SPH smoothing functions
Lecture 4: SPH for general dynamic flow
Lecture 5: N-body techniques
Lecture 6: Numerical Implementation

Project Work (5-6 weeks)

David Hobbs

Lund Observatory
ASTM22
Course Marks

Computational Astrophysics Marks


Project 1 Trojans and Integrator 20% (Due Feb 8th)
Project 2 SPH in 1-D with shock tube 30%
Project 3 SPH in 3-D with planet collisions 20%
Homework – see lectures: L1, L2, L3, and L5 15%
Presentation on projects 15%
100%

Homework is expected one week after it is given out!

Presentation will be given for 15 minutes on your chosen topic and must be closely related to
astrophysical simulations
Projects
Project 1: (See Lecture 1 – 20%)
Make a simulation to solve the N-body problem and investigate the time evolution of the
Trojan satellites of Jupiter for 300 years using an initial time step of 0.01 years. Implement a
4th order Runge Kutta numerical integrator.

Project 2: (See Lectures 2-6 – 30%)


Write your own 1D SPH simulation to solve the Navier-Stokes equations of hydrodynamics
for the shock tube problem. This is a standard test for SPH to show your code works. Use the
Runge Kutta numerical integrator developed in project 1 for time integration.

Project 3: (See Lectures 2-6 – 20%)


Do a simulation to colliding two Jupiter like planets using a 3D version of your SPH
program. Investigate different impact trajectories.
This means you generalize your 1D SPH simulation to 3D to collide the two Jupiter like
planets. Add gravitation to this simulation, note this is not trivial to get working well!
Galaxy  collision  
Authors:  Volker  Springel,  et  al.

Simula;on  Tool:  Gadget  (SPH)

The merger of two spiral galaxies, a process that leads to the inflow of gas into the
galaxy centres, causing rapid growth of the central supermassive black holes.
The energy input associated with the gas accretion eventually expels a lot of the gas in a
quasar-driven wind, terminating the black hole growth and greatly reducing residual
star formation in the formed elliptical galaxy. (Reference publication: Springel et al.)
Galaxy  cluster
Authors:  Klaus Dolag

Simula;on  Tool:  Gadget  2  (SPH)

Visualiza;on  Tool:  Splotch

Flight through a high resolution simulation of a galaxy cluster.


Visible are prominent structures within the hot plasma.
Some structures are able to maintain a self-bound atmosphere (shown in light blue).
More than a thousand of individual galaxies can be identified within the cluster, even
forming new stars in their centers (shown in dark blue).
Only a small number of them are still maintaining their own, hot, self-bound
atmosphere.

1 1
H0 = 100h [kms M pc ]
so h = 0.73 today
1 1
and H0 = 73 [kms M pc ]
Introduction to numerical methods

Introduction
Observations of astrophysical phenomena on every scale imply that
hydrodynamical flow and orbital mechanics are vital to understand the universe.

! dynamics of Saturn’s rings


! dynamics of planets around nearby stars
! supernovae explosions
! colliding galaxies, stars, planets
! the Big Bang

Also the theory of radiation flow, which links our instruments to these events, is a
third important element in the interpretation of physical phenomena.
Objectives
This first lecture focuses on the basic concepts of numerical hydrodynamics.
This introductory lecture will discuss:
• General numerical simulations
• Grid based methods
• Eulerian approach
• Lagrangian approach
• Meshfree methods
• Meshfree particle methods
• Smoothed Particle Hydrodynamics
Subsequent lectures will discuss numerical details of SPH and N-body
techniques, with a focus on numerical implementation and examples.
General numerical simulations
In general, numerical simulations follow a basic procedure as illustrated below.

From the observed physical phenomena, simplified


mathematical models constructed.

The models generally have governing equations with


boundary conditions and/or initial conditions.

To solve them, the geometry of the problem domain


needs to be divided into discrete components.

Numerical discretization means changing the


integral or derivative operations in continuous form
to discrete form.

Coding and implementation need to account for


computer language, speed and storage requirements.

When all these factors are combined in a suitable


system, together with the conservations laws the
simulation can be carried out.
FDM uses expressions of the
Fundamental Frames form f(x + b) − f(x + a). If a
finite difference is divided by b
There are two fundamental frames for describing the physical governing equations − a, one gets a difference
quotient which gives an
• the Eulerian is a spatial description, typically used in finite difference approximate numerical solution
of differential equations
methods (FDM).
• the Lagrangian is a material description, typically used in the finite element
methods (FEM).
FEM is used for finding
If viscosity, heat conduction and external forces are neglected, the conservations approximate solutions of
equations in PDE form in the two methods are very different: PDE’s and integral equations.
The solution approach is to
eliminate the differential
equation completely

The mass conservation law is


also known as the continuity
equation.

In the equations p, ρ, e, v and x are pressure, density, internal energy, velocity and position vectors respectively.

The Greek subscripts α and β are the coordinate directions (e.g. x,y,z) and summation is implied over repeated indices.
Eulerian versus Lagrangian
The conservation equations are derived using conservation of mass, momentum and energy in the
Boltzmann transport equation (BTE).
BTE describes the statistical flow through position and velocity phase space, subject to forces.
• The Euler equations describe the evolution of the state of the medium at a fixed location in
space.
✴ We have V0 at t=0 and X → Vt at t=t and x.
• The Lagrangian equations employ a co-moving spatial coordinate of a fluid element and the
property of the particle is traced as a function of time. D/Dt describes changes within the
element such as its state and location.
✴ At t=0 we have V0 and X → at t=t we have Vt and x.

The derivation of both sets of equations can be found in ref. [1] and [4].
Significance of the time derivatives
The differences between the two sets of equations comes from the definition of the total time
derivative which consists of a local and a convective derivative:

• D/Dt is the total time derivative (substantial, material or global derivative) and is
physically the time rate of change following a moving Lagrangian fluid element.
• ∂/∂t is the local derivative that is the time rate of change at a fixed point.
• vα∂/∂vα is the convective derivative: physical change due to the movement of the fluid
element from one location to another.
Leonhard Paul Euler Joseph-Louis Lagrange,
(15 April 1707 – 18 September 1783) (25 January 1736 – 10 April 1813)
was a pioneering Swiss mathematician and was an Italian/French mathematician and
physicist who spent most of his life in Russia and astronomer, making significant contributions to
Germany. He is renowned for his work in many fields. On the recommendation of Euler and
mathematics, mechanics, fluid dynamics optics D'Alembert, in 1766 he succeeded Euler as the
and astronomy. director of mathematics at the Prussian Academy.
Grid-based methods
The two fundamental frames in grid methods
• the Eulerian description is a spatial description
• the Lagrangian description is a material description

Lagrangian grid Eulerian grid


Is attached to the material The object moves
and moves with it. across the fixed
Results in expansion, grid.
compression and The grid is also
deformation of mesh. fixed in time.
Mass, momentum and The flux of mass,
energy are transported momentum and
with mesh cells. energy across the
Mass is fixed so no mass cell boundaries
crosses cell boundaries. must be simulated
A comparison

By combining the complementary features of both methods, the advantages can be maximized.
Done in Coupled Eulerian Lagrangian (CEL) and Arbitrary Eulerian Lagrangian (AEL) methods.
They can be more stable but also require complicated mapping between the two types of mesh.
Mesh generation is a problem

Grid-based methods are widely used but have inherent difficulties which limit their
application.
• In Eulerian grid methods constructing regular grids for irregular geometry is complex
and time consuming.
• In Lagrangian grid methods computing the mesh for the object is time consuming.
• Treating large deformations usually requires rezoning techniques, which are tedious,
error prone and time consuming.

Example of Lagrangian Monte Carlo particles on Unstructured


Eulerian grid points.
National Center for Hypersonic Combined Cycle Propulsion
Limitations of grid-based methods

Grid based methods are not so suitable for simulating explosions, high velocity impacts
because of the large deformations, inhomogeneities, moving material interfaces, etc.
Grid based methods are not suitable for discrete physical particles, e.g.
• the interaction of stars in astrophysics
• movement of millions of atoms
• dynamical behavior of molecules
Hence, there is a strong interest in the equivalent meshfree methods.

Eulerian Contact for Versatile


Collision Processing

François Faure, Jérémie Allard,


Matthieu Nesme
Meshfree methods

The key idea is to provide accurate and stable numerical solutions to PDE's or integral
equations with all kinds of possible boundary conditions
-using a set of arbitrarily distributed particles (or nodes) without any mesh.
Early work modified the internal structure of the grid-based methods to make them more
adaptive, versatile and robust.

Droplet impact and splashing


Simulation of a splash performed by Pascal Ray.
Basic types of meshfree methods
• Strong form formulation - simple, efficient and completely meshfree. But they have
proved numerically unstable and less accurate.
• Weak form formulation - not 'truly' mesh free as they require a background mesh to
describe interactions. However, the results were very stable and accurate.
• Particle methods - a finite number of particles represent the state of the system and
to record the movement of the system.
SPH is a meshfree particle method and was one of the earliest to be developed.

SPH simulation of flow over a cylinder with vortex shedding


Mesh-free computational fluid dynamics, NUI Galway.
Meshfree particle methods (MPM)
Each particle is either directly associated with one physical object or represents part of the
continuum problem domain.
Particles can range in sizes from nano- to micro- to meso- to macro- to astronomical-scales.
Depending on the problem the particles posses a set of field variables such as velocity,
momentum, energy, position, etc.
Evolution of the system depends on conservation of mass, momentum and energy

Spiral Galaxy Formation


T. Ize and E. D’Onghia
Most meshfree particle methods are inherently Lagrangian methods in which the particles
represent the physical system moving in the Lagrangian frame according to internal
interactions and external forces (e.g. gravity).
Advantages:
Discretized with particles with no fixed connectivity (good for large deformations)
Complex geometry is simple
Easy to obtain large scale features by tracing the motion of the particles
The time history of all particles is available

M. Kelager, Department of Computer Science, University of Copenhagen, DIKU


Solution strategy of meshfree particle methods (MPM's)

Approximate the functions - derivatives and integrals -


Smoothing function in support domain
using the information from neighboring particles in an
area of influence within the support domain.
E.g. the velocity v of a particle at r is:
N
X
v(r) = vi (r)W (r)
i=1
Where N is the number of particles, vi is the velocity at
particle i, Wi is a smoothing function at the i-th
particle.
Velocity, v, is a weighted sum over neighboring
particles.
Mesh-free computational fluid dynamics, NUI Galway.
Smoothed particle hydrodynamics (SPH)

SPH, as a meshfree, Lagrangian, particle method has certain characteristics.


Advantages include:
• Adaptive nature - achieved at an early stage at each time step, based on the current
local set of arbitrarily distributed particles. Natural way to handle large deformations.
• No predefined mesh to provide connectivity between particles
• Particle approximations – material is free to move due to external forces and internal
interactions.

Some astrophysical applications of SPH have included (see ref. [3]):


• Binary stars or planetary collisions
• Supernova Type II
• Formation of galaxies
• Coalescence of black holes with neutron stars
• Single and multiple detonation of white dwarfs
• Evolution of the Universe
In the coming lectures we will delve into the detailed formalism of standard SPH required
before one can begin implementing the method in computer code.
Problems: Numerical methods
1. Explain the Boltzmann transport equation
2. How are the conservation equations derived in Lagrangian form
3. Write a short discussion on Eulerian and Lagrangian methods, comparing them in
terms of application and respective advantages
4. Discuss grid based and mesh free methods

Note: These exercises are designed to make your think about this first lecture, only a
paragraph or two is required on each (although longer responses are welcome too) and feel
free to use the internet and the reference books to find extra information.
References
[1] Bodenheimer P., Laughlin G.P., Rozczka M. and Yorke H.W., Numerical Methods in
Astrophysics, Taylor & Francis, (2007).
[2] Aarseth S., Tout C. and Mardling R, The Cambridge N-Body Lectures (Lecture Notes in
Physics)
[3] Liu G.R. and Liu M.B., Smoothed Particle Hydrodynamics: a meshfree particle method,
World Scientific, (2007)
[4] Shu f., The Physics of Astrophysics, vol. I & II, Mill Valley, CA: University Science
Books, (1991 & 1992)
[5] Monaghan J.J., Smoothed Particle Hydrodynamics, Annual Review of Astronomy and
Astrophysics, 30:543-574, (1992)
[6] Benz W., Smoothed Particle Hydrodynamics: a review, NATO workshop, Les; Arcs,
France, (1989)
[7] Lucy L.B., Numerical approach to testing the fission hypothesis, Astronomical Journal,
82:1013-1024, (1977)
[8] P. Cossins, Chapter 3, Smoothed Particle Hydrodynamics, Ph.D. Thesis, Leicester (2010)
Computational Astrophysics
Lecture 1: Introduction to N-body techniques

David Hobbs

Lund Observatory
ASTM22
N-body techniques
The classical astrophysical N-body problem consists of each member of an aggregate of N
(i=1,…,N) point masses, having masses mi, experiencing an acceleration from the
gravitational attractions of all the other bodies in the system.

(1)

The description of the problem is completed by specifying the initial positions (xi at t = 0)
and velocities (vi at t=0) for the N particles.
Solutions of this problem range from the orbit of the moon to the structure of the
Kirkwood gaps in the asteroid belt and countless other phenomena.
This richness arises from strong nonlinearity in the equation as a slight change in
initial conditions can lead to very different outcomes – chaos.
The N-body problem involves calculating
1. the force on each particle at a given time
2. determining the new position of the particle at a future time
Solving second order differential equations
Solving second order differential equations like equation (1) is done by reformulating the N
second-order equations as a set of 2N coupled first-order equations.
Any ordinary second-order differential equation of the form

can be rewritten as a pair of first-order differential equations.

If wi = [xi, vi] represents the 6-D phase space


coordinates of particle i, then the state of the N-
body system is described by a 6N vector

Using this equation (1) becomes Evolution of the system in (2) takes the form

(2) where the 6N functions gl are given by the right


hand sides of (2). When the equations are in
this form a single integration routine can be
used to solve the system.
Numerical Integration
Differential equations like those shown in equation (1) describe a continuous sequence of
changes in response to an independent variable, t.
We need to specify 6N conditions (x and v) to solve our initial value problem.
The simplest solution to the N-body problem comes from specifying a finite difference of the
differential equation over an interval

as

where the update variables, Wln+1, are calculated from information available at tn.
By repeatedly applying this formula the position and velocity of the particles can be
propagated into the future in time steps of h. This is know as Euler’s method.
In practice this is not sufficiently stable for long integrations so more sophisticated methods are
used but this simple form illustrates the basic principle well.
The error in Euler’s method
Euler’s method is not good because of error accumulation.
The exact equation is given by a Taylor series expansion.

Euler’s method is just the first two terms – it’s a first order method.
The rest of the terms sum to give the total error.
Euler’s method is asymmetry as the increment is based on the value of W at the beginning
of the interval h.

Any non-linearity in g will result in inaccuracy in the updated values.


The key to improving Euler’s method is to realize that g can be computed at any trial values
(t, W) so more refined estimates over h can be made.
One can construct weighted sums with k estimates of g and tuning the weights provides
cancellation of error terms in the Taylor series up to order k+1.
Implementations such as this are known as Runge-Kutta methods.
The Runge-Kutta method
The simplest Runge-Kutta scheme uses the Euler method to estimate values W(tn+h/2) at the
halfway point.

The values Wb provide a more accurate estimate of the slope in the interval h.
A 4th order Runge-Kutta method is commonly used:
A single iteration evaluates
•the initial slope at the start
•two midpoint slopes
•the slope at the end
The four slopes are then
combined with weights

to produce a weighted average


slope which accurately spans the
interval h.

2nd order
Project 1
Make a simulation to solve the N-body problem and investigate the time evolution of the
Trojan satellites of Jupiter for 300 years using an initial time step of 0.01 years. Implement
the 4th order Runge Kutta numerical integrator. Plot and/or show video of the results
relative to the common centre of gravity of the system. Consider the use of adaptive time
steps to minimize numerical error drift and extend the basic simulation to generate
interesting results for your report.

Detailed input: Initial parameters for Jupiter Trojans


Hints

Keep the Sun at the origin by subtracting


from every body the forces exerted by all
other bodies on the Sun. Use units of
solar mass and AU and 1 year for time so
velocity is in AU year-1. Then the
gravitational constant G=4π2

The diagram shows the geometry.


ST = R
and
SC=MJR/(MJ+MS)

E.g. If α=30° SCT = 120-30=90°


or
180°=60°+α+120°-α

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy