Skip to content

๐Ÿ’ง Smoothed particle hydrodynamics

JavaScriptThree.js

Source

๐ŸŽฏ A somewhat more elaborate demo using the Helion library
ยฉ๏ธ Hydrodynamics based on Smoothed Particle Hydrodynamics (SPH) Fluid Simulation with WebGL


There are two coordinate frames:

  • SPH-domein: coordinates for the physics and calculations for neighbor cells.
  • Helion-world: coordinates with which Circle and camera render particles.

These coordinates need not be identical. The view translates the SPHParticle.position during synchronization.

+---------------------------------------------+
| SPHParticle |
| โ”‚ |
| Velocity, pressure, mass, density, position |
+---------------------------------------------+
โ”‚
โ”‚
โ–ผ
+-----------------------------------+
| SPHParticleView.synchronizeWith() |
| โ”‚ |
| SPH-domein โ†’ Helion-wereld |
+-----------------------------------+
โ”‚
โ”‚
โ–ผ
+---------------------------------------+
| Circle |
| โ”‚ |
| Draw particle at transformed position |
+---------------------------------------+