Introduction to SPH/FLIP Fluid Systems in Go: Part I
--
This is an introduction to some of the core concepts of SPH fluids and the first part of a series on making a fluid FLIP/PIC simulation in Go. DIY fluids lets go.
For some reason since I can remember I’ve been interested in this area of research. If had to pick a reason it might be a sort of an aesthetic appeal. But mostly I think I associate fluids with a sort of visual tactile play, like its just interesting and I’m a damn child. So, I spent many hours, looking at the Navier-Stokes equations and trying to unlock its magic that probably any engineering student would know by heart. As it turns out while it’s great to understand Navier-Stokes (NS), it’s sometimes better to just get your hands dirty, knowing you can come back to NS as your guide. We won’t be doing any esoteric derivations here from Newtonian Mechanics. But here it is. Let your eyes feast.
This momentum equation really only has two key ingredients and its simple enough. A gradient pressure term and a 2nd order laplacian for viscosity. Plus the external forces. Simple enough for now although we will dive back in later chapters.
There are some other questions to ask. Like why Go? And this has been done before just search GitHub? Surely some university SIMD BLAS implementation exists. But it’s fun to make something new. And plus there weren’t any Go implementations so I figured this would be a great opportunity to add an API out to the open source world and get familiar with Go. This project is where I discovered part of why Go is so awesome actually. Although that’s maybe for another article.
Computational Methods
In the world of computational fluid dynamics there are really two approaches, the Eulerian & Langrangian methods. I would say if you really want to learn the breadth of CFD, write a fluid solver with Grid methods and one with SPH methods. The goal for us is how to make a Hybrid solver. So we will need to cover both.