Wave Generator

by Tuğrul Yazar | April 17, 2024 14:24

Here is a wave generator code I developed using Grasshopper[1] and Python[2]. While searching for a solution to the realistic water simulations, I came up with the Gerstner Waves[3]. I tried to implement it. However, I came up with this final result, which is not a Gerstner Wave generator, but a much simpler one. It combines many user-fed wave components and calculates the resulting single wave. I played with this code for hours with different components. So, it is worth trying and maybe developing more. For example, a steepness parameter might be a very good addition to make it closer to a trochoidal wave (such as the Gerstner wave). For now, this works as expected.

wave generator

This Grasshopper and Grasshopper Python implementation generates custom waves. It has several user inputs such as the size and the time value (for animation). Most importantly a user can define and input many waves using a Panel component. The amplitude, wavelength, direction, frequency, and phase shift of these waves are the inputs. The output of the Grasshopper definition is a grid of points. You can use these points to create NURBS or mesh surfaces and animate them through the t Number slider. The code is using native Grasshopper components. So, you don’t need to install any add-ons. However, Weaverbird might be a good addition if you want to make the resulting meshes smoother.

wave generator

This definition includes on GhPython component that calculates the coordinates of the point outputs. If you liked this content and want to support my website by downloading this Grasshopper file; would you consider being my Patreon? Here is the link to my Patreon page[4] including the working file for the Wave Generator and more.

wave generator
Endnotes:
  1. Grasshopper: https://www.designcoding.net/category/tools-and-languages/grasshopper/
  2. Python: https://www.designcoding.net/category/tools-and-languages/rhino-python/
  3. Gerstner Waves: https://en.wikipedia.org/wiki/Trochoidal_wave
  4. Here is the link to my Patreon page: https://www.patreon.com/Designcoding

Source URL: https://www.designcoding.net/wave-generator/