YouTube-simulations/README.md

146 lines
6.6 KiB
Markdown
Raw Permalink 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
2023-10-29 15:53:09 +01:00
There are four groups of 8 files, 19 files, 5 files and 4 files.
2021-10-24 15:32:53 +02:00
In addition the following files handling color schemes have been included:
1. `hsluv.c`and `hsluv.h` from https://github.com/adammaj1/hsluv-color-gradient
2. `turbo_colormap.c` from https://gist.github.com/mikhailov-work/6a308c20e494d9e0ccc29036b28faa7a
3. `colormaps.c` containing look-up tables from https://github.com/yuki-koyama/tinycolormap
2021-07-19 14:31:34 +02:00
2022-10-18 23:35:20 +02:00
The following file (beta version) provides support for creating mazes:
4. `sub_maze.c`
2023-10-29 15:53:09 +01:00
The files
2023-09-02 11:45:45 +02:00
2023-10-29 15:53:09 +01:00
5. `*.ppm.gz`
2023-09-02 11:45:45 +02:00
2024-06-01 19:13:57 +02:00
are required by `wave_sphere.c` and `rde.c` and should be unzipped before compiling.
2023-09-02 11:45:45 +02:00
2021-07-19 14:31:34 +02:00
### Simulations of classical particles in billiards.
2022-05-14 21:03:32 +02:00
1. *particle_billiard.c*: simulation of a collection of non-interacting particles in a billiard
2. *drop_billiard.c*: simulation of an expanding front of particles
2023-10-29 15:53:09 +01:00
3. *particle_pinball.c*: variant of `particle_billiard` with some extra statistics plots
4. *billiard_phasespace.c*: variant of `particle_billiard` for phase portraits (only works for certain shapes)
5. *global_particles.c*: global variables and parameters
6. *sub_part_billiard.c*: drawing/computation routines common to `particle_billiard` and `drop_billiard`
7. *sub_part_pinball.c*: additional drawing/computation routines for `particle_pinball`
8. *sub_billiard_phasespace.c*: additional drawing/computation routines for `billiard_phasespace`
2022-05-14 21:03:32 +02:00
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
2023-09-03 10:17:25 +02:00
- Compile with `make particle_billiard`, `make_drop_billiard`, etc, or
2021-07-19 14:31:34 +02:00
2023-10-29 15:53:09 +01:00
`gcc -o particle_billiard particle_billiard.c-O3 -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lglut`
2021-07-19 14:32:50 +02:00
2023-10-29 15:53:09 +01:00
`gcc -o drop_billiard drop_billiard.c-O3 -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 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
2022-05-14 21:13:57 +02:00
### Simulations of wave equation and reaction-diffusion equations, including the Schrodinger equation.
2021-07-19 14:31:34 +02:00
2022-05-14 21:03:32 +02:00
1. *wave_billiard.c*: simulation of the (linear) wave equation
2. *wave_3d.c*: 3d rendering of wave equation
2023-09-04 10:59:21 +02:00
3. *wave_sphere.c*: wave equation on a sphere (3d and 2d render)
2023-09-02 11:45:45 +02:00
4. *wave_comparison.c*: comparison of the wave equation in two different domains
5. *wave_energy.c*: a version of `wave_billiard` plotting the energy profile of the wave
6. *mangrove.c*: a version of `wave_billiard` with additional features to animate mangroves
7. *heat.c*: simulation of the heat equation, with optional drawing of gradient field lines
2023-09-04 10:59:21 +02:00
8. *rde.c*: simulation of reaction-diffusion equations, plots in 2d and 3d (including Schrödinger equation,
2023-09-02 11:45:45 +02:00
Euler equation, and shallow water equation)
2023-09-04 10:59:21 +02:00
9. *schrodinger.c*: simulation of the Schrodinger equation in 2d (old version)
2023-09-02 11:45:45 +02:00
10. *global_pdes.c*: global variables and parameters
11. *global_3d.c*: additional global variables for 3d version
12. *sub_wave.c*: drawing/computation routines common to `wave_billiard`, `heat` and `schrodinger`
13. *sub_wave_comp.c*: some modified functions needed by `wave_comparison`
14. *sub_wave_3d.c*: additional functions for 3d version
15. *common_wave.c*: common functions of `wave_billiard` and `wave_comparison`
16. *colors_waves.c*: colormaps used by wave simulations
17. *sub_rde.c*: additional routines for rde.c
18. *sub_wave_rde_3d.c*: additional 3d drawing routines for rde.c
19. *sub_sphere.c*: additional routines for wave_sphere.c
2021-07-19 14:31:34 +02:00
2022-05-15 07:41:35 +02:00
- Create subfolders `tif_wave`, `tif_heat`, `tif_bz`, `tif_schrod`
2021-07-19 14:36:59 +02:00
- Customize constants at beginning of .c file
2023-09-03 10:16:46 +02:00
- Compile with `make wave_billiard`, etc, or
2021-07-19 14:31:34 +02:00
2023-10-29 15:53:09 +01:00
`gcc -o wave_billiard wave_billiard.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lglut -O3 -fopenmp`
2021-07-19 14:32:50 +02:00
2023-10-29 15:53:09 +01:00
`gcc -o wave_comparison wave_comparison.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lglut -O3 -fopenmp`
2021-08-15 11:54:36 +02:00
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
2023-10-29 15:53:09 +01:00
`gcc -o schrodinger schrodinger.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -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-12-28 18:05:16 +01:00
### Molecular dynamics simulations.
2021-12-28 15:52:05 +01:00
2022-05-14 21:03:32 +02:00
1. *lennardjones.c*: simulation of molecular dynamics
2. *global_ljones.c*: global variables and parameters
3. *sub_lj.c*: drawing and initialization routines
4. *sub_hashgrid.c*: hashgrid manipulation routines
2023-01-22 16:55:14 +01:00
5. *lj_movie.c*: render movie with precomputed particle positions
(requires files lj_time_series.dat and lj_final_positions.dat generated by lennardjones)
2021-12-28 15:52:05 +01:00
2021-12-28 18:05:47 +01:00
- Create subfolder `tif_ljones`
2021-12-28 15:52:05 +01:00
- Customize constants at beginning of .c file
2023-09-03 10:16:46 +02:00
- Compile with `make lennardjones` or
2021-12-28 15:52:05 +01:00
2023-10-29 15:53:09 +01:00
`gcc -o lennardjones lennardjones.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lglut -O3 -fopenmp`
2021-12-28 15:52:05 +01:00
- Generate movie with
`ffmpeg -i lennardjones.%05d.tif -vcodec libx264 lennardjones.mp4`
2022-08-01 22:34:03 +02:00
### Percolation simulations.
1. *percolation.c*: simulation of Bernoulli percolation
2. *global_perc.c*: global variables and parameters
3. *sub_perco.c*: drawing and cluster finding routines
2022-11-20 23:27:33 +01:00
4. *sub_perco_3d.c*: 3D drawing routines
2022-08-01 22:34:03 +02:00
- Create subfolder `tif_perc`
- Customize constants at beginning of .c file
2023-09-03 10:16:46 +02:00
- Compile with `make percolation` or
2022-08-01 22:34:03 +02:00
2023-10-29 15:53:09 +01:00
`gcc -o percolation percolation.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lglut -O3 -fopenmp`
2022-08-01 22:34:03 +02:00
- Generate movie with
`ffmpeg -i percolation.%05d.tif -vcodec libx264 percolation.mp4`
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-12-28 15:52:05 +01:00
- Thermostat algorithm: https://doi.org/10.1007/s10955-009-9734-0
2021-12-28 15:52:48 +01:00
or http://www.maths.warwick.ac.uk/~theil/HL12-3-2009.pdf
2021-08-01 16:02:08 +02:00