Skip to content

fhshaik/hackathon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

This is an Eulerian Fluid simulator that simulates the brownian motion of particles and uses the stable fluid algorithm which I reference from a famous paper by Joe Stam "Real-Time Fluid Dynamics for Games"
I spent the first 8 hours of this project trying to digest through the vast research literature on computer graphics and fluid simulation coming from an absolute novice with no experience in it.
The stable fluid algorithm is built on Joe Stam's paper but I use python and matrices to perform differential operators. On top of this I have added simulated particles, which reuses techniques from the paper like backwards interpolation
in order to simulate a particles trajectory through space, and update its position, velocity, and acceleration. Due to being the sole person working on it as my teammate had personal circumstances to attend to,
I did use ChatGPT3.5 to research and help me write code in python graphics libraries I wasn't familiar with like tkinter. The vast, bulk of the project uses my own code and algorithms I learned in order to do this. On the topic of
Urban Design one of the topics that was mentioned briefly was related to Health and the Healthcare industry. I decided to build a Blood Simulator that tries to simulate blood cells as physical particles, and blood plasma 
as a fluid. For stable fluid algorithm, it uses a diffusion algorithm to spread quantities such as density, and even components of velocity to neighboring cells. Next it uses advection which generates the next velocity at a cell
after a time step by tracing the velocities path backwards in time, and uses bilinear interpolation to get a weighted average of the neighboring cells. Finally, we use projection in order to make the vector field divergence free.
The projection part is just a consequence of Helmholtzes Theorem. On top of this, I have added my own density renderer that took much trial and error and finally displays things in a nice pink. I added a set of randomized particles
with velocities starting out at 0. These arrays of floats get updated based on the vector field we have uniquely defined, and using Euler integration we are able to update every frame. Initially this project was too slow to render real time.
But, I found out that if you replace most for loops with vector and matrix type operations you can get it done much faster. That is how I was able to double my resolution and render it far smoother. As a person well versed in calculus,
  it was very strange seeing these equations solved using algebraic methods. Also, I discovered there exists techniques for approximating solutions when you have matrix problems called Gauss Seidel method. I implemented this using
  the paper, and learnt the linear algebra part to try to implement it. One amazing thing about the project is the number of variables we can tweak since I've been working on this non-stop fiddling around to get things right.
These variables can change things like viscosity, diffusion rate, how fast particles move through the fluid, the seperation before they collide, forces acting on particles, charges, etc. I am proud to say that I learned so much about 
Computational Fluid Dynamics having never experienced any of the tools and techniques ever in Computer Science, nor have I ever done any Fluid Dynamics in Physics. This project was designed in 2d due to processing constraints but the linear algebra extends to 3d, and I can easily imagine seeing this tool be useful in finding out how blood clots in arteries depending on the viscosity, turbulence or as a simulation tool to personalize the exact dosage of medicine given an MRI of their arteries, and how much it can spread for treatments that require very precise dosage. Currently,
I see this primarly as being an educational tool for medical students wanting to dip their feet into fluid dynamics.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages