User Tools

Site Tools


Sidebar

spin:esc202_fs2021

Simulations in the Natural Sciences II

ESC202:Spring 2021: Monday Zoom Lecture: 13:00-14:00 Exercises: 14:00-17:00 in MS-Teams

TAs: Stefan Schafroth and Sebastian Schulz

Corona Virus Measures

Dear Students, Communication will take place via this web-site, including assignments. Video lectures are provided below and the pdf of the lecture notes can be found here. The lectures will use Zoom and the assignments session will use MS-Teams as in the last semester. Many thanks!

Joachim Stadel


Video Lectures

Videos for the lectures can be found here (they are too large for my Wiki):

ESC202 Video downloads

Appologies: due to an error there was no sound in the recording of 29. Mar. As such it was of little use and I didn't bother uploading the video.

Lectures

22. Feb. 2021: Tree Structures and Dimensional Searching

01. Mar. 2021: Nearest Neighbor Searching

08. Mar. 2021: k-Nearest Neighbor Searching and SPH intro

15. Mar. 2021: SPH METHOD: Equations and kernels

22. Mar. 2021: SPH METHOD: part 2 Artificial Viscosity formula corrected!

29. Mar. 2021: Kernels and a "Wind Tunnel"

12. Apr. 2021: Howto: inflow/outflow BCs and followed by the 2-D Ising Model

26. Apr. 2021: Travelling Salesperson Problem

Assignments

In order to qualify for the final semester project and a passing grade you will need to hand in 80% satisfactory assignments (to the satisfaction of the TAs). Assignments should be individual and should be in python and provide a correct virtual environment!

For help getting started with virtual environments, please read carefully Python Virtual Environments for Pip and Python Virtual Environments for Conda.

You should email 3 things to Sebastian (sebastian.schulz@uzh.ch):

  1. The working python source code
  2. The requirements.txt file for your virtual environment
  3. 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

1. Build a binary tree of cells using the partitioning of particles function we introduced in class. The hard part is making sure your partition function is really bomb proof, check all “edge cases” (e.g., no particles in the cell, all particles on one side or other of the partition, already partitioned data, particles in the inverted order of the partition, etc…). Once you have this, then recursively partition the partitions and build cells linked into a tree as you go. Partition alternately in x and y dimensions, or simply partition the longest dimension of the given cell.

2. For each particle find (count) all the neighbor particles within some ball radius (small compared to the root cell size). How long does it take? How does it scale as you increase the number of particles, N, in the domain? Explain which method of intersection tests you used in your implementation.

3. For each particle calculate the “top-hat” density from the 32 nearest neighbors and plot it using a colormap. Use first a linear search priority queue to get things working and then substitute a heap algorithm to implement “replace” and “max” functions. We will need the density to implement SPH so it needs to be well tested. Also, make sure it can work with periodic boundary conditions!

4. Now, calculate the density using the Monaghan kernel defined in the lecture. Plot and compare to the density you get from the “top-hat” kernel (the Monaghan result should be a little smoother).

5. Using the SPH method, simulate the movement of a fluid through a “wind tunnel” that contains an overdensity in the middle as it was described in the lecture (due between April 12th and April 19th)!

6. 2D Ising Model: Using the Metropolis algorithm, plot the mean magnetization of a N by N grid of spins (+1 and -1) depending on the temperature. Visualise the spin state of the grid at different temperatures (due April 26th)!

7. Metropolis algorithm II: Implement the traveling merchant problem (due May 3rd)!

spin/esc202_fs2021.txt · Last modified: 2021/04/26 14:21 by stadel