https://github.com/hawkgs/wasm-fluid
🌊 Browser-based fluid simulation (Müller et al SPH method)
https://github.com/hawkgs/wasm-fluid
canvas cfd fluid-dynamics fluid-simulation golang javascript simluation webassembly
Last synced: 5 months ago
JSON representation
🌊 Browser-based fluid simulation (Müller et al SPH method)
- Host: GitHub
- URL: https://github.com/hawkgs/wasm-fluid
- Owner: hawkgs
- License: mit
- Created: 2024-04-03T09:35:48.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-05T08:07:49.000Z (about 2 years ago)
- Last Synced: 2025-03-21T10:02:14.162Z (about 1 year ago)
- Topics: canvas, cfd, fluid-dynamics, fluid-simulation, golang, javascript, simluation, webassembly
- Language: Go
- Homepage:
- Size: 15.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wasm-fluid
_**Under development**_
🌊 Browser-based fluid simulation (Müller et al SPH method).
Calculations: WebAssembly (Go); Visualization: HTML Canvas

Müller et al SPH method: https://matthias-research.github.io/pages/publications/sca03.pdf
### Issues
As stated above, the simulation is based on smoothed-particle hydrodynamics method by M. Müller and others. It incorporates density, pressure and viscosity calculations, plus external forces – gravity in our case. Surface tension is not implemented. Since the paper focuses on 3D SPH, the used smoothing kernels for this implementation – or more precisely, their normalization scaling factors – are adapted for 2D. Anyway, there are still things that require attention/fixes, some of which are probably a matter of proper parameter tuning:
- Achieve stability
- ~~The fluid acts as a highly viscous liquid.~~
- ~~Particles that go outside of the particle stack and then get reintroduced at the edge of the smoothing radus of another particle, produce a critically low density. When the forces are divided by the density, the product acceleration has a very large magnitude which ejects the particle from the stack. There is a temporary fix for this.~~
- ~~There is an instability at the edge of the fluid sometimes. This is, again, most likely a result of low densities producing high acceleration (but not enough to eject the particle out of the fluid).~~