Water Wave Simulation

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

Water Wave Simulation

Postby Lothar Schirm » Jan 02, 2017 15:59

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

Postby greenink » Jan 03, 2017 1:02

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: 333
Joined: Sep 28, 2013 15:08
Location: Bavaria, Germany

Re: Water Wave Simulation

Postby Lothar Schirm » Jan 03, 2017 15:42

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

Re: Water Wave Simulation

Postby leopardpm » Feb 07, 2017 5:47

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!

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 38 guests