Code Monkey home page Code Monkey logo

youtube-simulations's Introduction

Tool to create videos of particles or waves in different 2D domains.

Created by Nils Berglund and optimized by Marco Mancini

C code for videos on YouTube Channel https://www.youtube.com/c/NilsBerglund

Parameter values used in specific simulations will be gradually added to file Parameters.md, Parameters_June21.md and so on.

There are two groups of 5 files and 11 files. In addition the following files handling color schemes have been included:

  1. hsluv.cand 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

Simulations of classical particles in billiards.

  1. global_particles.c: global variables and parameters
  2. sub_part_billiard.c: drawing/computation routines common to particle_billiard and drop_billiard
  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
  5. particle_pinball.c: variant of particle_billiard with some extra statistics plots
  • Create subfolders tif_part, tif_drop
  • Customize constants at beginning of .c file
  • Compile with

gcc -o particle_billiard particle_billiard.c-O3 -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut

gcc -o drop_billiard drop_billiard.c-O3 -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut

  • Many laptops claim to have 4 cores, but two of those are virtual. OMP acceleration may be more effective after executing

export OMP_NUM_THREADS=2

in the shell before running the program

  • Generate movie with

ffmpeg -i part.%05d.tif -vcodec libx264 part.mp4

Simulations of wave equation, heat equation and Schrodinger equation.

  1. global_pdes.c: global variables and parameters
  2. sub_wave.c: drawing/computation routines common to wave_billiard, heat and schrodinger
  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. colors_waves.c: colormaps used by wave simulations
  6. wave_billiard.c: simulation of the (linear) wave equation
  7. wave_comparison.c: comparison of the wave equation in two different domains
  8. wave_energy.c: a version of wave_billiard plotting the energy profile of the wave
  9. mangrove.c: a version of wave_billiard with additional features to animate mangroves
  10. heat.c: simulation of the heat equation, with optional drawing of gradient field lines
  11. schrodinger.c: simulation of the Schrodinger equation
  • Create subfolders tif_wave, tif_heat, tif_schrod
  • Customize constants at beginning of .c file
  • Compile with

gcc -o wave_billiard wave_billiard.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut -O3 -fopenmp

gcc -o wave_comparison wave_comparison.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut -O3 -fopenmp

gcc -o heat heat.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut -O3 -fopenmp

gcc -o schrodinger schrodinger.c -L/usr/X11R6/lib -ltiff -lm -lGL -lGLU -lX11 -lXmu -lglut -O3 -fopenmp

  • Many laptops claim to have 4 cores, but two of those are virtual. OMP acceleration may be more effective after executing

export OMP_NUM_THREADS=2

in the shell before running the program

  • Generate movie with

ffmpeg -i wave.%05d.tif -vcodec libx264 wave.mp4

Some references

youtube-simulations's People

Contributors

eugenebrace avatar nilsberglund-orleans avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.