Implementation of 
      
        Chapter 38. Fast Fluid Dynamics Simulation on the GPU
     
  
The following code simulates a 2D Incompressible Fluid using an:
- 
Eulerian-Grid Scheme
 - 
Semi-lagrangian Advection Method [Unconditionally Stable]
 - 
System-of-Equations Jacobi Method Solver [Very easy to implement GPGPU]
 - 
Central Difference for Approximating Calculus Operators [O(x^2) Error]
 - 
Essentially All methods here are references to the original work of Stam1999 - stable fluids
Here is a wikipedia article describing the method of solution 
The currently most-updated revision 29cleanup3/ features the following:
- Force/Dye/Force-Dye User-Simulation Interaction
 - Vorticity Confinement with variable coefficient
 - Variable Kinematic Viscosity, Delta Time & Poisson-Solver Iterations
 - Real-Time CFL/Reynolds Number Calculations (they're there to check solver correctness/stability)
 - Visualizations of Calculation Textures, in particular Velocity-Pressure/Dye/Curl/Absolute Curl/Velocity Error/Pressure Error/Velocity-X/Velocity-Y/Pressure/CFL
 - Real-Time Measurements of internal solver components - CPU & GPU Side:
- 
A GPU Timer (gl-Begin/End-Query) essentially acts as a fence,
waiting for all previous GPU commands to finish
In Short: Using GPU Timers degrades Performance by a few milliseconds - 
When GPU Timers are not used, the calculations will be deferred until glfwSwapbuffers(), which by then will be dispatched & computed, updating glMemoryBarrier
 
 - 
 
Tomorrow, Im Tired lol :)
The Underlying Project Structure uses my premake5-workspace-template repo,
You can expect the program/ folder to occupy all revisions of the fluid-solver,
culminating eventually with 29cleanup3/ as the currently best revision
Prerequisites - Instructions below work too, but you should follow premake5-workspace-template
- premake
 - Working compiler toolchain, preferably clang
- Windows: You should use llvm
 - Linux:
- installing-specific-llvm-version
 - configuring-symlinks
 - You Don't have to use LLVM, gcc works too
 
 - Define these environment variables (in your PATH):
- LLVMInstallDir
 - LLVMToolsVersion
 
 
 - Powershell / Any Standard unix-shell
 
Just Clone the repo
premake5 --os=windows --arch=x86_64 --cc=clang gmake2
premake5 --os=windows --arch=x86_64 --cc=clang vs2022
premake5 --os=linux   --arch=x86_64 --cc=gcc   gmake2
premake5 --os=linux   --arch=x86_64 --cc=clang gmake2You can also use this command to perform the whole build process,
if youre using gmake2 and a commandline:
premake5 --os=windows/linux --arch=x86_64 buildallrelDont forget to actually build using your favorite IDE/command-line utility
Static Library Builds: (premake5 gmake2, config=releaselib_amd64)
./build/bin/ReleaseLib_amd64_program/programDLL/Shared Library Builds: (premake5 gmake2, config=releasedll_amd64)
./build/bin/ReleaseDll_amd64/programVisual Studio 2022 - Just Run normally using Local Windows Debugger
- Replacing Jacobi Method with the Multigrid Method for better performance & faster fluid convergence
 - Adding Arbitrary boundaries
 - Extending to 3D
 - MAC Staggered Grid
 - Different Simulation Schemes (FVM, etc...) for better simulation accuracy
 - Extending to compressible/Turbulent Models
 
If you have a suggestion, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Distributed under the MIT License. See LICENSE file for more information.
- Kumodatsu For the initial template repo
 - Jarod42 For the Improvements branch of export-compile-commands
 - Best-README