Water Wave Simulation

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Post Reply
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Water Wave Simulation

Post by Lothar Schirm »

A water wave consists of particles moving on vertical circles. The phase angle for each particle increases along the direction of the wave's motion. I found this description in "Gerthsen: Physik" which is a very well known book about physisc used in german universities. I tried a small simulation here:

Code: Select all

Dim As Double x0, y0, r, phi, dt, t
Dim As Integer k

ScreenRes 1000, 100, 32
WindowTitle "Water Wave"

dt = 0.02
y0 = 50
r = 30
t = 0
Do
	t = t + dt
	Cls
	ScreenLock
	For k = 0 To 40
		x0 = 25 * k
		Circle (x0, y0), r, &HAAAAFF	'circle for each particle
		phi = 0.5 * k
		Circle (x0 + r * Sin(t - phi), y0 - r * Cos(t - phi)), 0.1 * r, &H00FFFF,,,, F	'particle
	Next
	ScreenUnlock
	Sleep 10
Loop Until Inkey = Chr(255, 107)

End
greenink
Posts: 200
Joined: Jan 28, 2016 15:45

Re: Water Wave Simulation

Post by greenink »

German universities are number 1. Unfortunately somewhat starved of cash. The US universities are funded by 1 trillion dollars of student debt, giving them plenty of money for research.
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: Water Wave Simulation

Post by Lothar Schirm »

A description in English of such waves can also be found in the Wikipedia https://en.wikipedia.org/wiki/Trochoidal_wave.
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: Water Wave Simulation

Post by leopardpm »

that is a really nice example, makes it look very easy and leads folks to envisioning how to use it in their projects... very nice!
Post Reply