Back to Blog - Home

Fluid Simulations and Engine Simulations

Welcome back! Being this is my first post, I really don't know what to put. So I am going to talk a bit about a project I am working on, because I kind of want to take a step away from it for a moment.

I want to recreate Engine Simulator by Ange the Great. The idea always tickled my mind and that video I put really lit my mind on fire. Also I thought it would be a fun challenge considering the heavy level of math it generally required.

So I am going to break down not only the math, but the code as well. NOTE: I am still working on this project and there are a lot of errors. So there is no guarantee that this will work or that the math is correct, but this is more of just a how I understand everything as of the moment. So take everything is a grain of salt.

Also all credit goes to Ange the Great for the original ideas and even where I found reference alsmost all of the math and code in this post.

Introduction

So lets start off by answering what is is we are trying to solve.



Today we are going to be solving the first problem, fluid simulations.

If you have every dabbled in fluid simulations before you most likely have heard of the Navier Stokes equations: \documentclass{article} \begin{document} $$ \frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \mathbf{v}) = 0 $$ \end{document} Also nice LaTeX right :)
This can also be written another way which is more helpful for us known as the Euler equations: \documentclass{article} \begin{document} $$ \partial_t \begin {bmatrix} \rho \\ \rho \mathbf{v} \\ E \end {bmatrix} + \nabla \cdot \begin {bmatrix} \rho \mathbf{v} \\ \rho \mathbf{v}^2 + p \\ \mathbf{v} (E + p) \end {bmatrix} = 0 $$ where $\nabla = \partial_x$ because we are in 1D \end{document} Now I know this looks kinda crazy, but we can acutally break this down into a few parts.