14
Computational Astrophysics AS 3013 Computational Astrophysics AS 3013 Computational Astrophysics AS 3013 Schedule: Mon & Thu 14:00-17:30, 15 credits, 3 assessed exercises 11 weeks, 150 hours (150 – 11 x 2 x 3.5 = 73 hours for additional programming, reading: 6.5 hours/week) Outline: week 1-3: lectures and simple F90 exercises (input and output, loops, vectors, root-finding) week 4-6: Interstellar Mass Function (numerical integration) week 7-11: orbits of stars and planets (differential equations) Skills: UNIX, programming in a high-performance, compiled computer language (FORTRAN-90), PYTHON for plots, numerical algorithms and standard methods, scientific writing Dr. Peter Woitke, Dr. Christiane Helling, Dr. Martin Dominik Format: Small Online Groups with 4-5 students, lecturer + 2 demonstrators

Dr. Peter Woitke, Dr. Christiane Helling, Dr. Martin Dominik

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Computational Astrophysics AS 3013

Computational Astrophysics AS 3013Computational Astrophysics AS 3013

Schedule:• Mon & Thu 14:00-17:30, 15 credits, 3 assessed exercises

• 11 weeks, 150 hours (150 – 11 x 2 x 3.5 = 73 hours for additional programming, reading: 6.5 hours/week)

Outline:• week 1-3: lectures and simple F90 exercises

(input and output, loops, vectors, root-finding)

• week 4-6: Interstellar Mass Function (numerical integration)

• week 7-11: orbits of stars and planets (differential equations)

Skills: UNIX, programming in a high-performance, compiled computer language (FORTRAN-90), PYTHON for plots, numerical algorithms and standard methods, scientific writing

Dr. Peter Woitke, Dr. Christiane Helling, Dr. Martin Dominik

Format:• Small Online Groups with 4-5 students, lecturer + 2 demonstrators

Computational Astrophysics AS 3013

(20%)

(30%)

(50%)

Computational Astrophysics AS 3013

ResourcesResources

https://moody.st-andrews.ac.uk/moodle/course/view.php?id=11529

– schedule, deadlines, online groups– reading material: UNIX, Fortran-90, python (plotting)

– links to online tutorials and references: details of Fortran-90, python

– exercise sheets 1, 2, 3, marking criteria, and submission tools

– lectures 1, 2, 3, 4, 5, 6

– code examples, and subroutines to work with

– instructions how to install gfortran and python, orto make a remote connection to a University computer

Computational Astrophysics AS 3013

Why use computers?Why use computers?

• Cons:

• Pros: – fast: can do many calculations quickly

– keep track of large amounts of data

– too complex for analytical solutions

Computational Astrophysics AS 3013

Why FORTRAN?Why FORTRAN?

Solving an N-body problem (Portegies Zwart, 2020, Nature Astronomy, 4, p. 819-822)

– compiled code runs

~ 100x faster

– learn the real thing!

– think like a computervariable types, dependencies, memory, efficient algorithms ...

– very popular in academics

– similar to C/C++

– ideal for numerical simulations

– environmentally friendly!

Computational Astrophysics AS 3013

ExamplesExamples● Hydrodynamics:

− 3D time-dependent simulations of fluid flows● no analytical solutions for turbulent flows● grid resolution crucial

● Stellar structure and evolution:− explore the inner of stars, their evolution and destiny

● no probe can go there● matter under extreme conditions● inaccessible spatial scales, timescales (103 - 109) years● progress through theoretical computation of material properties

(→ opacities, eq.of state, nuclear burning rates, ...)

● Data Reduction:− robotic search for planets

● find the important events, quickly, in Terrabytes of data

Computational Astrophysics AS 3013

Hydrodynamical Simulations

Computational Astrophysics AS 3013

Computational Astrophysics AS 3013

Computational Astrophysics AS 3013

example F90 programexample F90 program

program MYPROG

implicit none real :: pi1 real*8 :: pi2 real*16 :: pi3

pi1 = ACOS(-1.0) pi2 = ACOS(-1.D0) pi3 = ACOS(-1.Q0) print*,pi1 print*,pi2 print*,pi3 print*, precision(pi3),range(pi3) print*, tiny(pi3),huge(pi3)

end program MYPROG

executablestatements

variabledeclaration

unit starts ...

… unit ends

Computational Astrophysics AS 3013

How to program in F90, step-by-stepHow to program in F90, step-by-step

1. open a terminal window, and create a folder> mkdir CompAstro> cd CompAstro> mkdir ex1> cd ex1

2. edit your program > gedit myprog.f90 & or emacs myprog.f90 &… and press “Save” → stores myprog.f90 in a file

3. compile your program> gfortran myprog.f90 → stores a.out as executable file

4. run your program> ./a.out

Computational Astrophysics AS 3013

Communication in MS Teams groupsCommunication in MS Teams groups

1. find your group here

2. find Ex#1 script

3. raise-hand tool → call for demonstrator, e.g. share screen

4. group chat → post questions & screenshots

5. General chat → inter-group communication

6. feel free to use splinter groups for private meetings, any time

7. your attendance will be monitored

Computational Astrophysics AS 3013

Exercise #1Exercise #1● learning-by-doing● Tasks 1-6 during weeks 1 and

2 (non-assessed)● Task 6a: challenge

(voluntary, non-assessed)● Task 7: assessed

Computational Astrophysics AS 3013

What to do, and what not to do in classroomWhat to do, and what not to do in classroom

1. discuss algorithms with us/fellow students

2. make us/fellow students write your program

3. ask questions about exercises, and submission

4. call a demonstrator to introduce the exercise sheet

5. compare numerical output with other students

6. ask us for technical help

7. exchange of program parts

8. ask us about meaning of compiler errors