Repository navigation
v1.0.0 - Initial Release
This is the first official release of the Navier-Stokes Turbulence Simulation, a high-performance, real-time fluid dynamics framework designed for the web. This project leverages C++ and WebAssembly (WASM) to solve the Lattice Boltzmann Method (LBM) equations with SIMD optimization and multithreaded execution.
Core Architecture
High-Performance Backend
- Lattice Boltzmann Solver: Implements a D2Q9 model for two-dimensional fluid flow.
- WebAssembly Core: The simulation engine is written in C++ and compiled to WASM for near-native performance.
- SIMD Optimization: Utilizes 128-bit SIMD instructions (wasm_simd128.h) for parallel processing of fluid cells.
- Multi-threading: Integrated worker pool using Pthreads/Web Workers, allowing for efficient CPU utilization across multiple cores.
Physics Features
- Sub-grid Scale Modeling: Large Eddy Simulation (LES) via the Smagorinsky-Lilly model for capturing turbulent eddies.
- Thermal Dynamics: Support for Boussinesq buoyancy, thermal expansion, and temperature-dependent viscosity.
- Non-Newtonian Rheology: Implementation of the Power-law fluid model for simulating shear-thinning and shear-thickening fluids.
- Surface Tension: Multi-phase interaction modeling using the Shan-Chen (pseudopotential) method.
- Vorticity Confinement: Algorithm to prevent numerical dissipation and maintain sharp vortical structures.
- Porous Media: Drag-based porosity modeling for simulating flow through permeable structures.
- Comprehensive Boundaries: Support for Periodic, No-slip, Free-slip, Moving Wall, Inflow, and Outflow (Sponge Zone) conditions.
Visualization and Rendering
GPGPU Rendering Pipeline
- WebGL2 Implementation: Hardware-accelerated rendering of fluid fields directly from GPU textures.
- Field Visualizations: Real-time rendering of Vorticity (including Bipolar maps), Velocity, Density, Temperature, and Pressure fields.
- Scientific Colormaps: Integrated support for perceptually uniform palettes including Turbo, Inferno, Magma, Plasma, Viridis, and Cividis.
Particle System
- Massive Particle Advection: Supports the real-time simulation of up to 1,000,000 particles using Transform Feedback.
- Dynamic Respawn: Particles automatically respawn based on obstacle collisions and random distribution to maintain flow visibility.
Interaction and Tools
Dynamic Brush System
- Multi-mode Brushes: Specialized interaction modes for Velocity, Density, Temperature, Vortex creation, Expansion/Contraction, and Noise injection.
- Geometry Control: Adjustable brush shapes (Circle, Square, Diamond) with configurable aspect ratios, rotation, and falloff profiles (Smooth or Gaussian).
- Obstacle & Porosity Painting: Real-time editing of the simulation environment through obstacle placement and porous media adjustment.
Preset Management
- Integrated Presets: Includes pre-configured scenarios such as Tap Water, Molten Gold, and Superfluid Helium.
- State Control: Real-time adjustment of all physical constants, including viscosity, gravity, and simulation time steps.
Developer Environment
- Automated Build Pipeline: Includes a Makefile and a Windows-based batch script (launch.bat) for automated compilation and local server deployment.
- WASM Bindings: Uses Embind for seamless communication between the C++ engine and the JavaScript frontend.
- COOP/COEP Support: Includes a Python-based server script to handle the cross-origin headers required for shared memory and multi-threading in modern browsers.
Licence
This project is licensed under the MIT Licence.