====== Advanced Simulation in the Natural Sciences ====== {{combined.jpg?800x100|}} **ESC203:** Spring 2023: Monday **Lecture:** 10:15-11:00 in Y27-H-35/36 with Joachim, **Exercises:** 11:15-12:00 in Y27-H-35/36 with Sebastian **TA:** Sebastian Schulz ====== Lectures ====== 20. Feb. 2023: - {{ :spin:esc203.1.pdf | Simulating light - First Steps to Ray Tracing}} - {{ :spin:introduction-to-ray-tracing.pdf | Introduction to ray tracing book}} 27. Feb. 2023 - {{ :spin:esc203.2.pdf | Ray Tracing - Material Properties}} 6. Mar. 2023: - {{ :spin:esc203.3.pdf | Ray Tracing - Triangulations}} - {{ :spin:teapot.zip | The famous UTAH Teapot triangultion (source: Stanford media lab)}} 13. Mar. 2023: - {{ :spin:esc203.4.pdf | Fast Fourier Transform}} 20. Mar. 2023: - {{ :spin:esc203.5.pdf | Fast Fourier Transform, part 2}} 27. Mar. 2023: - {{ :spin:esc203.6.pdf | Solving PDEs, different methods compared}} 3. Apr. 2023: - {{ :spin:esc203.7.pdf | Multigrid Method}} 17. Apr. 2023: - {{ :spin:week7_maccormack_sebastian.pdf | MacCormack's Method}} ====== Assignments ====== Assignments should be **individual** and should be in python and, if you are using non-standard python libraries, **provide a correct virtual environment!** 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]]. You should email 3 things to Sebastian (**sebastian.schulz@uzh.ch**): - The working **python source code** - The **requirements.txt** file for your 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 ====== Raytracing: - Write a basic ray tracing algorithm for spheres illuminated by a single light source **(hand in by Monday, February 27th, 2023)**. - Implement the Phong model described in the lecture. Once you are done, you can implement reflection and refraction for transmissive materials (glasses, coatings) into your model. Optional: try out the approximations that make the code run faster (Blinn-Phong model, Schlick's approximation, replacing the power alpha with gamma, assuming beta is small) **(hand in by Monday, March 6th 2023)**. - Ray trace the triangulated Utah tea pot. You can start by implementing the bounding volume hierarchy treewalk algorithm to quickly find the intersection points on the triangles. You can then interpolate the surface normals using the barycentric coordinate system on the triangle **(hand in by Monday, March 13th, 2023)**. Fourier transforms: - Implement the Cooley-Tuckey method for the FFT algorithm by splitting the W matrix into even and odd parts iteratively until you reach W_2 **(hand in by Monday, March 20th, 2023)**. - Use the 2D-FFT to calculate the potential of a particle distribution on a 2D grid. Start by assigning the masses of the particles to the cells using a mass-assignment scheme of your choice (i.e. nearest grid point, cloud in cell, etc.), which will give you a density grid. Then you can Fourier transform the density grid in two dimensions, from which you can easily calculate the potential in Fourier space, according to the Poisson equation written in the lecture notes. You can then get the real-space potential by inverse Fourier transformation of the Fourier space potential **(hand in by Monday, April 3rd, 2023)**. Muligrid method: - Implement a 1-step v-cycle of the multi-grid approach and compare the result to SOR. After this, you can try out different cycles, e.g. the deep v-cycle, or the w-cycle **(hand in by Monday, April 17th, 2023)**. MacCormack's method: - Otional bonus task: Implement MacCormack's method for solving the 1D-Burgers' Equation and compare to the results obtained using the Lax-Wendroff method.