Simulations for class rooms Yoshio Okamoto 5th May 2020 (Stay home programing Series No.4 from my FaceBook)
(COVID-19 simulations coming soon!)
Preface
From 2002 to 2008, I constructed a special
class with our students for every Saturday concerned with the "Complex
system," which were the most interesting themes for me at that
time.
In
those days, I developed many simulations for classroom use, for
example, tsunamis, seismic waves, and cell automatons.
A part of them was firstly coded by N88Basic, Japanese domestic PC languages developed by NEC.
Soon
I began to use Linux PC for developing educational tools. On Linux, the
standard programing language was C. However, to write code for
graphical programming, we had to use Xlib library on X-Window, and this
was tough work for me because the coding on Xlib was too
complicated.
Soon, I found a simple graphics library named EGGX developed by Chisato Yamauchi (now JAXA).
https://www.ir.isas.jaxa.jp/~cyamauch/eggx_procall/index.ja.html (in Japanese)
https://www.ir.isas.jaxa.jp/~cyamauch/eggx_procall/ (in English)
This worked on Linux quite easily, so I used it to make graphical simulations at that time
Since
then, it has passed for less than 20 years, I salvaged some programs
from an old HDD. These are simplified simulations for students made at
that time. However, they can not work on my present PC, some with
showing the famous error message on C "segmentation fault!"
Therefore, I decide to modify them using modern Processing language.
Here, show you some examples,
1. Wind Ripple
Wind ripples on a desert or tidal ripples on a beach show a quite beautiful rhythmical pattern. (The photo shows beautiful tidal
ripples on a beach, Ko Samet Is. Thailand.
There are many references for explaining the mechanism of wind ripples;
A useful review is here,
https://www.researchgate.net/publication/230863437_The_physics_of_wind-blown_sand_and_dust
Japanese reference;
https://repository.kulib.kyoto-u.ac.jp/…/1/KJ00004760882.pdf
Ripple marks (a general description)
https://www.researchgate.net/publication/326551193_Ripple_Marks
My simulation: basic model was started in 2002
Concept: a simple simulation explain a complicated natural phenomenon such as ripple marks in a classroom..
Methods:
Two simple rules:
1) Saltation
2) Creep
My prototype code runs with
100 x 100 grid (more extendable)
Random height initial condition
Wind blows left to right.
Algorithm:
1) Saltation process runs with stochastic order; sand in a grid is
picked up randomly and moved to a new location with proportional
distance depend on an original height.
L = L0 + A * H[i][j] L:
distance L0 = initial const. A:
coefficient of wind speed H[i][i]: each grid height
(given at randomly at the start)
2) Creep process is carried out in every 2000 steps (it means 2000 sand particles are picked up and moved to new locations)
All grids are tested and smoothed using moving averages for creeping the surface.
Parameters:
A: wind speed [grid/time step]
L0 distance constant of moving [grid]
DP: diffusion parameter; moving average weight [unit height]
Only two simple rules drive this simulation with three parameters A, L0 and DP.
Here are some screenshots and movies
A = 1.0 [grid/step] L0 = 1.0
[grid] DP = 0.8 [unit height]
after 320000 steps Movie! click here (Please use Google Chrome)
Movies only run on Google Chrome instead of FireFox (unknown problem)