Water surface simulation. Energy conservation
Run the Huy_wave.m to start the GUI.
Video description: https://www.youtube.com/watch?v=AaQqAlul0xY
I'm a matlab newbie and this is the first GUI that I've built so the code is far from perfect. In fact, some of you might think it's ugly written. It's not the best documented project either but I tried the best I that could.
Under function newH=Wave (located at the end of the code) I try to explain the so-called Finite Difference Method which I use to simulate the water surface. If you have any question, please feel free to ask.
And if you can improve the code for me, please do. I really appreciate it. Thank you.
DAMPED WAVE EQUATION:
d^2/dt^2*h + K*(dh/dt) = C^2*(d^2*h/dx^2 + d^2*h/dy^2)
where
h := height
K := Damping Constant
C := Wave Speed
The right side of the equation is the potential (height of one element regarding its neighbours).
The wave equation implies that acceleration (d^2*h/dt^2) and velocity (dh/dt) of each element are produced through its potential.
PS: Damping means energy loss. Set damping value to 0 for full energy conservation.
Citar como
Huy (2024). Water surface simulation. Energy conservation (https://www.mathworks.com/matlabcentral/fileexchange/46579-water-surface-simulation-energy-conservation), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
- Sciences > Earth, Ocean, and Atmospheric Sciences > Oceanography and Hydrology >
- MATLAB > Graphics > 2-D and 3-D Plots > Animation > Waves >
Etiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.13.0.0 | Added a video description.
|
||
1.12.0.0 | Corrected algorithm for Connected Boundaries mode. Energy is now fully conserved. |
||
1.11.0.0 | Added a Pause/Resume button. Users can add more drops to the surface in Pause mode. |
||
1.10.0.0 | Added a Clear Plot button. |
||
1.9.0.0 | Connected Boundaries Mode improved. |
||
1.8.0.0 | Energy Flow now works with boundary conditions. |
||
1.7.0.0 | Bugs fixed. |
||
1.6.0.0 | Minor changes. Added a message box. Unhide edges in fixed boundaries . |
||
1.5.0.0 | Code corrected.
|
||
1.4.0.0 | Conservation of Energy, potential and kinetic. Explanation in function newH=Wave() updated. |
||
1.3.0.0 | Decrease facealpha (transparency) value to 0.95. A value of 1 makes everything much slower. Future update: energy conservation. |
||
1.2.0.0 | Add the default color mode that uses no rendering at all. This could improve performance on low-spec PCs. |
||
1.1.0.0 | Description updated. |
||
1.0.0.0 |