YouTube-simulations/README.md

77 lines
3.3 KiB
Markdown
Raw Normal View History

2021-07-19 14:58:58 +02:00
### Tool to create videos of particles or waves in different 2D domains.
2021-07-19 14:31:34 +02:00
Created by **Nils Berglund** and optimized by **Marco Mancini**
C code for videos on YouTube Channel https://www.youtube.com/c/NilsBerglund
2021-07-28 18:18:51 +02:00
Parameter values used in specific simulations will be gradually added to file `Parameters.md`, `Parameters_June21.md` and so on.
2021-07-19 14:31:34 +02:00
2021-09-26 16:50:23 +02:00
There are two groups of 4 files and 9 files:
2021-07-19 14:31:34 +02:00
### Simulations of classical particles in billiards.
2021-07-19 18:06:20 +02:00
1. *global_particles.c*: global variables and parameters
2021-07-27 19:12:43 +02:00
2. *sub_part_billiard.c*: drawing/computation routines common to `particle_billiard` and `drop_billiard`
2021-07-19 18:06:20 +02:00
3. *particle_billiard.c*: simulation of a collection of non-interacting particles in a billiard
4. *drop_billiard.c*: simulation of an expanding front of particles
2021-07-19 14:31:34 +02:00
2021-07-27 19:12:43 +02:00
- Create subfolders `tif_part`, `tif_drop`
2021-07-19 14:36:59 +02:00
- Customize constants at beginning of .c file
- Compile with
2021-07-19 14:31:34 +02:00
2021-07-27 19:12:43 +02:00
`gcc -o particle_billiard particle_billiard.c-O3 -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut`
2021-07-19 14:32:50 +02:00
2021-07-27 19:12:43 +02:00
`gcc -o drop_billiard drop_billiard.c-O3 -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut`
2021-07-19 14:31:34 +02:00
2021-07-27 10:29:26 +02:00
- Many laptops claim to have 4 cores, but two of those are virtual. OMP acceleration may be more effective after executing
2021-07-27 19:12:43 +02:00
`export OMP_NUM_THREADS=2`
2021-07-27 10:29:26 +02:00
in the shell before running the program
2021-07-19 14:36:59 +02:00
- Generate movie with
2021-07-19 14:31:34 +02:00
2021-07-27 19:12:43 +02:00
`ffmpeg -i part.%05d.tif -vcodec libx264 part.mp4`
2021-07-19 14:31:34 +02:00
### Simulations of wave equation, heat equation and Schrodinger equation.
2021-07-19 18:06:20 +02:00
1. *global_pdes.c*: global variables and parameters
2021-07-27 19:12:43 +02:00
2. *sub_wave.c*: drawing/computation routines common to `wave_billiard`, `heat` and `schrodinger`
2021-08-15 11:54:36 +02:00
3. *sub_wave_comp.c*: some modified functions needed by `wave_comparison`
4. *common_wave.c*: common functions of `wave_billiard` and `wave_comparison`
5. *wave_billiard.c*: simulation of the (linear) wave equation
6. *wave_comparison.c*: comparison of the wave equation in two different domains
2021-09-26 16:50:01 +02:00
7. *mangrove.c*: a version of wave_billiard with additional features to animate mangroves
8. *heat.c*: simulation of the heat equation, with optional drawing of gradient field lines
9. *schrodinger.c*: simulation of the Schrodinger equation
2021-07-19 14:31:34 +02:00
2021-07-27 19:12:43 +02:00
- Create subfolders `tif_wave`, `tif_heat`, `tif_schrod`
2021-07-19 14:36:59 +02:00
- Customize constants at beginning of .c file
- Compile with
2021-07-19 14:31:34 +02:00
2021-07-27 19:12:43 +02:00
`gcc -o wave_billiard wave_billiard.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut -O3 -fopenmp`
2021-07-19 14:32:50 +02:00
2021-08-15 11:54:36 +02:00
`gcc -o wave_comparison wave_comparison.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut -O3 -fopenmp`
2021-07-27 19:12:43 +02:00
`gcc -o heat heat.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut -O3 -fopenmp`
2021-07-19 14:32:50 +02:00
2021-07-27 19:12:43 +02:00
`gcc -o schrodinger schrodinger.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut -O3 -fopenmp`
2021-07-19 14:31:34 +02:00
2021-07-27 10:29:26 +02:00
- Many laptops claim to have 4 cores, but two of those are virtual. OMP acceleration may be more effective after executing
2021-07-27 19:12:43 +02:00
`export OMP_NUM_THREADS=2`
2021-07-27 10:29:26 +02:00
in the shell before running the program
2021-07-19 14:36:59 +02:00
- Generate movie with
2021-07-19 14:31:34 +02:00
2021-07-27 19:12:43 +02:00
`ffmpeg -i wave.%05d.tif -vcodec libx264 wave.mp4`
2021-08-01 16:02:08 +02:00
2021-08-01 16:02:37 +02:00
#### Some references ####
2021-08-01 16:02:08 +02:00
- Discretizing the wave equation: https://hplgit.github.io/fdm-book/doc/pub/wave/pdf/wave-4print.pdf
2021-08-01 22:36:37 +02:00
- Absorbing boundary conditions: https://hal.archives-ouvertes.fr/hal-01374183
2021-08-01 16:02:08 +02:00
- Cloaking device: https://www.sciencedirect.com/science/article/pii/S0165212514001759
2021-09-04 10:35:44 +02:00
- Poisson disc sampling: https://bl.ocks.org/mbostock/dbb02448b0f93e4c82c3
2021-08-01 16:02:08 +02:00