Simulation of fluid flow using Euler equation

I have been looking on Euler's equations for a while and can't grasp one thing.

Suppose we have initial system state with volumes of fluid "hanging" in air (time is frozen and equal to zero), each of them has its initial (x, y) coordinates and velocity vector (Vx, Vy). The space is divided in stationary volumes in which measurement takes place (Euler measurement model). As I understand Euler's equations impose mutual restrictions between functions of velocity ( u(x, y, t) ), mass density ( m(x, y, t) ), and pressure ( p(x, y, t) ) at any instance of time for stationary volume of space with coordinates (x, y) that contains volume of fluid (in that instance).

So why each function has time parameter when equations must be solved for any instance of time (iteration process) ? We must have new set of these functions for any moment of time that satisfy equations. And it's unclear whether volume of space contains volume of fluid or not, how do we take this in consideration ?

And the second question is how state of each volume of fluid (its coordinates and velocity vector) is related to these functions ? I need a system that has some initial state (array of fluid volumes with their coordinates and velocities) and uses Euler's equations to compute next state, which becomes initial for next iteration and so on. Something like this: I don't need math details, I just want to grasp basic idea in context of computer simulation (how method of simulation can be bounded to standard analytic equations). Most papers are very complicated, with additional physical factors and user interaction, and they don't cover this "link". I want to consider the easiest case and how to start iteration process (just idea and how it is usually done). Sorry if some things sound ridiculous, please adjust my statements if they are wrong. If my model of understanding is completely wrong just point me in right direction, thanks.

• Have a look at this for some info on how to input nicely formatted equations in your posts. Sorry it's a bit of a wall of text, but after figuring out a couple of simple equations, it's really fairly intuitive. – Kyle Oman Jul 16 '14 at 21:47
• I would always recommend that you start learning a topic by finding a text book. Journal papers are very hard to learn a brand new topic from -- they are supposed to be communicating an advanced topic to experts in the field. Text books are meant to educate somebody to become an expert. – tpg2114 Jul 16 '14 at 22:02
• I second tpg's notion of getting a book. I highly recommend Randall LeVeque's excellent text on hyperbolic conservation laws. – Kyle Kanos Jul 16 '14 at 22:56

Regarding the first half of your question: your broad understanding seems to be correct. To answer your question about how to tell if there is fluid in a given cell, consider what the mass density $m(x,y,t)$ is in an empty cell. It's just zero. This is seamlessly handled by your system of equations already.

Regarding the second half of your question, this is a very broad topic. Simulating fluids is, as a rule, difficult, and there are many methods that are appropriate in different situations (for instance, of the two algorithms I'm most familiar with, one is very good at resolving shocks, but not so good at modelling certain instabilities like Rayleigh-Taylor, while the second is good at instabilities but bad for resolving shocks). Instead of trying to give you a huge introduction to the topic, for which you should probably just try to find a good book, I'll show you one concept that I hope will help get you started in the fascinating world of numerical methods.

The classic starting point for numerical solutions to differential equations is the heat equation in one dimension, because it is simple and relatively easy to solve:

$$\frac{\partial u}{\partial t}-\alpha\frac{\partial^2 u}{\partial x^2} = 0$$

Consider the time derivative. One mathematical definition of the derivative is:

$$\frac{\partial u}{\partial t} = \lim_{\Delta t\rightarrow0}\frac{u(x,t+\Delta t)-u(x,t)}{\Delta t}$$

One possible approximation of this derivative is to take not the limit as $\Delta t\rightarrow0$, but simply to choose a small value for $\Delta t$, giving:

$$\frac{\partial u}{\partial t}\approx\frac{u(x,t+\Delta t)-u(x,t)}{\Delta t}$$

A similar approach can be used on the spatial derivative to arrive at (one of several possible approximations):

$$\frac{\partial^2 u}{\partial x^2}\approx\frac{u(x+\Delta x,t)-2u(x,t)+u(x-\Delta x,t)}{\Delta x^2}$$

Putting all this together in the heat equation and re-arranging a bit gives:

$$u(x,t+\Delta t) = u(x,t) + \frac{\alpha\Delta t}{\Delta x^2}\left[u(x+\Delta x,t)-2u(x,t)+u(x-\Delta x,t)\right]$$

Notice that the next state of the system (at $t+\Delta t$, on the left hand side) is expressed entirely in terms of the current state of the system (at $t$) on the right hand side. So you can code this up on a computer and repeatedly evaluate new states with appropriately small choices for $\Delta x$ and $\Delta t$ to get the evolution of the system.

Conceptually you're going to want to do the same sort of thing with your system of Euler equations, but of course the equations are more complicated (they have more terms and more fields to keep track of). Keep in mind that with a numerical solution you are ALWAYS constructing an approximation, so there is by definition an error in your solution. Now the game is to (1) understand how accurate your approximation is, when it is valid, converged and so on and (2) try to keep your errors as small as possible while paying a reasonable cost in computation resources. The example I gave is easy to understand and gives a roughly correct answer for some simple scenarios, but is generally notoriously poorly converged and has large errors. But once you understand this basic example, reading up on more complicated solution schemes will be much easier.