====== Simulations in the Natural Sciences I ====== {{:spin:combined.jpg?800x100|}} **ESC201:**Fall 2022: Monday Lecture: 13:00-14:00 Exercises: 14:00-17:00 in Y17-J-05 **TAs**: Stefan Schafroth, Sebastian Schulz (**sebastian.schulz@uzh.ch**), Thomas Meier (**thomas.meier5@uzh.ch**) ====== Lectures ====== 19. Sep. 2022: {{ :spin:hs2022_week1.pdf |First Lecture}} 26. Sep. 2022: {{ :spin:hs2022_week2.pdf |Newton's Method and Kepler's Equation}} 03. Oct. 2022: {{ :spin:hs2022_week3.pdf |Population Growth, Chaos and Fractals}} 10. Oct. 2022: {{ :spin:hs2022_week4.pdf |Fractals using Complex Numbers}} 17. Oct. 2022: {{ :spin:hs2022_week5.pdf |Ordinary Differential Equations}} 24. Oct. 2022: {{ :spin:hs2022_week6.pdf |Symplectic Integrators for ODEs}} 31. Oct. 2022: {{ :spin:hs2022_week7.pdf |N-body Problem, Simulating the Solar System}} 7. Nov. 2022: {{ :spin:hs2022_week8.pdf |(separable Hamiltonians), Partial Differential Equations}} 14. Nov. 2022: {{ :spin:hs2022_week9.pdf | Bi-linear Interpolation: Electron Beams}} 21. Nov. 2022: {{ :spin:hs2022_week10.pdf |Diffusion Equation and Numerical Stability}} 28. Nov. 2022: {{ :spin:hs2022_week11.pdf |Hyperbolic PDEs}} 5. Dec. 2022: {{ :spin:hs2022_week12.pdf |Fintite Volume Method and 2-D Advection}} 12. Dec. 2022: {{ :spin:hs2022_week13.pdf |Hydrodynamics in 1-D}} ====== Assignments ====== Your solutions should be handed in 7 days after each assignment has been given, i.e. **Monday night by 21:00** one week after the Monday lecture. Assignments should be **individual** and should be in python and **provide a correct virtual environment!** (if you stick to standard libraries like numpy, matplotlib, scipy... **you can also just submit your python source code together with the output** of your program) For help getting started with virtual environments, please read carefully [[https://towardsdatascience.com/all-you-need-to-know-about-python-virtual-environments-9b4aae690f97|Python Virtual Environments for Pip]] and [[https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/|Python Virtual Environments for Conda]]. Please hand in the following in Teams: - The working **python source code** - The **requirements.txt** file for your virtual environment (if you used a virtual environment) - A **.pdf** or **.png** image or animation of the output of your program Template: {{template.zip}} ** Instructions: ** Please add the names of the people you work together (if you do) to the comment section of your python scripts. Create a virtual environment using Pip - run **virtualenv yourenv_name** to create a virtual environment - run **source yourenv_name/bin/activate** to activate yourenv_name - install necessary libraries that you want using **pip install package_name** - work in that directory, get your outputs (*.pdf, *.png, *jpeg, *.mp4, etc...) - run **pip freeze > requirements.txt** to get your list of libraries Conda - run **conda create -n yourenvname python=x.x anaconda** to create a virtual environment - run **source activate yourenvname** to activate yourenv_name - install necessary libraries that you want using **conda install -n yourenv_name package_name** - work in that directory, get your outputs (*.pdf, *.png, *jpeg, *.mp4, etc...) - run **conda list --export > requirements.txt** to get your list of libraries ====== List of assignments ====== - Implement the bisection root finding method presented in the first lecture for a function f of your choice (e.g. xx - 100 = 0 or the quadratic function f(x) = ax² + bx + c, for which you can compare to the analytical result)! (**to submit by 26 September 2022, 9pm**) - Plot (and/or animate) the elliptical orbit of a planet around the sun by repeatedly solving Kepler's equation with Newton's method (or the bisection method), as explained in the lecture! (**to submit by 3 October 2022, 9pm**) - Draw a Feigenbaum diagram that results from solving the logistic equation (**to submit by 10 October, 2022, 9pm**). (Optional: Implement a function that allows you to zoom into the Feigenbaum diagram) - Fractals: Draw some Julia sets with various constants c (you can start with the Mandelbrot set as it was explained in the lecture and the exercise class)! (**to submit by 17 October, 2022, 9pm**) - Ordinary Differential Equations: Solve the Lotka-Volterra equation using the Euler method and the midpoint Runge-Kutta method (optional: 4th order Runge Kutta method) and compare the results. Make two plots: the time dependence of both populations (mice and foxes), and the phase diagram, using different initial conditions (**to submit by 24 October, 2021, 9pm**). - Symplectic Integrators: Use the Leap-Frog method to make a phase plot (p vs q) of the harmonic oscillator for different total energies. Compare the results with what you get using the Forward Euler method and the midpoint Runge-Kutta method. Make the same plot for a simple pendulum (**to submit by 31 October, 2022, 9pm**). - Make a solar system orrery following the steps outlined in the lecture. Also plot the path of the solar system center of mass. (**to submit by 7 November, 2022, 9pm**)! - Elliptical partial differential equations: Solve the Poisson equation for the electromagnetic potential using the SOR method described in the lecture, with boundary conditions given by a 1000 Volt stick in the center of a 0 Volt box (as depicted in the lecture notes). Plot the contours of the resulting potential (**to submit by 14 November, 2022, 9pm**). - Interpolation, Part 1: Trace the movement of electrons in an electromagnetic potential (e.g. the one from the last exercise) with Leapfrog or Runge-Kutta. Use bilinear or bicubic interpolation for the potential. (**not graded, to submit by 21 November, 2022, 9pm**). - Interpolation, Part 2 (**WIN A PRIZE**): Design an optimal electron detector (specifics in lecture materials) (**to submit by 28 November, 2022, 9pm**). - Hyperbolic PDEs: Solve the linear advection equation by evolving an initial waveform in a periodic grid. See how the waveform behaves after passing through the grid multiple times and compare the results you get when using various methods introduced in the lecture (e.g. the LAX method, upwind scheme, LAX-Wendroff method...) (**to submit by 5 December, 2022, 9pm**). - 2D advection: Solve the 2D advection problem using two methods introduced in the lecture (CIR and CTU) and compare if and how your solution diffuses numerically (**to submit by 12 December, 2022, 9pm**). - **Optional (grade for this exercise can replace your worst grade so far):** 1D Hydrodynamics: Solve the “shock tube” problem and the Sedov-Taylor blast wave using the three methods provided in the lecture (detailed assignment can be found in the lecture notes) (**to submit by 31 December, 2022, 9pm **).