Hokitlab / OceanSimulator

A quick gui for wave simulation in matlab
MIT License
3 stars 0 forks source link

wave amplitude in the z-direction #1

Open Mar1885 opened 1 month ago

Mar1885 commented 1 month ago

微信截图_20240517092814 If the unit of the wave amplitude in the z-direction is meters, then is the wave amplitude in the z-direction too small, with a magnitude of e^-5?

Hokitlab commented 1 month ago

Hello, I am not the original author of the code relating to the wave calculations. I merely optimised it for MATLAB and wrote a GUI around it. I only played with it for artistic effects, but never tried to do or calculate real physics with it. So to answer your question about units, I do not know exactly which units all the parameters are, in input or in output.

I wrote this in response to a Stack Overflow question Matlab/CUDA: ocean wave simulation. And you can see in the comment of my code that I was questionning some of the units already but the original poster did not clarify.

You may find more information in the original paper describing the methodology (used to generate this code): Simulating Ocean Water, by Jerry Tessendorf, 2004

This methodology has been extensively used in movie CGI and in video games, so there are probably even better codes around using this methodology. For example, FFT-Ocean uses this methodology for Unity. It also has a video describing the math in an (almost) simple way.

Mar1885 commented 1 month ago

Hello, thank you very much for your answer, it has benefited me a lot. However, there is one thing I still don't understand. Regarding the parameter settings in presetModes:'Calm', 'Windy lake', 'Swell', 'T-Storm', 'Tsunami', 'Custom' you provided in your code, what is the basis for these settings? Can you provide relevant literature?

Hokitlab commented 1 month ago

As you can see in the code each of these setting is associated with a preset value for "windir", "patchsize" and "meshsize". But these are just shortcut to these preset values, you can still modify the values if you want to experiment. I got these preset values by fiddling manually with the settings until I found a combination of parameters I liked (in terms of artistic rendering) and then gave it a name I though was relevant. These names only comes from my imagination, and the values associated with it don't come from literature I'm afraid, just from my trial and error...

If you look at my answer on stackoverflow, you will see visual examples of these settings (and a bit more explanation about the code as well).