# Fire simulation

I was playing the nice video game Ni no Kuni. To be more specific, I was playing a stage called The Mountain of Fire, about a volcano that is going to erupt (in three minutes!). In the scene there are molten rocks, lava and fire. A natural question at this point is: how does the game simulate fire?

A short answer by a mathematician is using the Navier-Stokes Equation, and the one by a ”wikipedian” is using the paper  by Jos StamHowever, this problem is far more fascinating than this. My goal here is to explain in a few simple words why. I will start exhibiting the Navier-Stokes Equation, then I will comment about how to simulate fire and I will exhibit some simulations. Finally, I will enumerate current applications and possible ones.

The Navier-Stokes Equation

The Navier-Stokes equation is a basic model for incompresible fluids, like the water. We start by considering a velocity field

\begin{aligned} u:&\mathbb R\times \mathbb R^3& \to & \mathbb R^3\\ &(t,x)&\mapsto& u(t,x)=(u_1(t,x),u_2(t,x),u_3(t,x)) \end{aligned}

and the pressure

\begin{aligned} p:&\mathbb R\times \mathbb R^3& \to & \mathbb R\\ &(t,x)&\mapsto& p(t,x) \end{aligned}

that depend on the time $t$ and position $x.$ Each fluid has a viscosity constant $\nu>0.$ The Navier-Stokes equation is given by the system of equations

\begin{aligned} &\frac{\partial}{\partial t} u+ (u \cdot\nabla)u=\nu \Delta u-\nabla p,\\ &\nabla \cdot u=0,\\ &u(0,x)=u_0(x). \end{aligned}

Given a smooth initial velocity field $u_0(x),$ a global smooth solution of the Navier-Stokes equation is a smooth velocity field $u:[0,+\infty)\times\mathbb{R}^3\to\mathbb{R}^3$ and a pressure function $p:[0,+\infty)\times\mathbb{R}^3\to\mathbb{R}$ satisfying the system of equations.

The justification of the Navier-Stokes equation will not be discussed here, a note on its more important points can be found here, for example.

A solution $u$ of the Navier-Stokes equation is said to blow up if $\sup_{x\in\mathbb{R}^3}|u(t,x)|\to +\infty$ as $t\to +\infty,$ i.e., at some time there is flow with arbitrarily high velocity. Whether is theoretically possible to always find global solutions that do not blow up is an open problem. You can read an explanation of why it is a complicated problem in Terry weblog.

How to simulate Fire

There is a well developed research field called Computational Fluid dynamics, that in particular, studies algorithms to simulate solutions of the Navier-Stokes equation. Numerical simulations using real data suggest, indeed, that there is always a global solution that do not blow up (as it is expected). If you are interested in understanding how to simulate solutions of the Navier-Stokes equation you can read this paper, for example.

Simulations

The Simulations showed here were made using some examples provided in the software Fire Dynamics Simulator (FDS) and Smokeview (SMV).

Applications

As I motivated this post, the Navier-Stokes equation can be applied to simulate fire and smoke in modern video games. However, there are many other applications. I can enumerate some natural examples:

1. Weather forecasting.
2. Chemical and Energy industries.
3. Evacuation routes and placement of fire alarms in case of smoke or fire in cities, forest, buildings, etc. See for example

[RUSHMEIER, H. 1994. Rendering Participating Media: Problems and Solutions from Application Areas. In Proceedings of the 5th Eurographics Workshop on Rendering, 35–56].

4. Ventilation design of the ocean, cities, buildings, miners, computers, etc.
5. Design of planes, trains, ships, cars, bikes, etc.  More in general, the design of any device that interact with a fluid in order to accomplish a specific function, like, high stability, high velocity, etc.
6. Design of anti-tsunami systems.
7. Mathematical Cardiology, i.e. the modelling and simulation of the circulatory system.
8. Increasing the velocity of transmission of information about certain properties that depend on fluids.

Artistic representation of fluids

The representation of fluids in arts is typical of an artistic movement called Expressionism. Expressionist artists combine together the representation of certain specific physical phenomena and the representation of daily life situations,  as a results, they create an emotional response to the viewer. Usually, the expressionism is studied from the point of view of the psychology, however, from a mathematical physic point of view we are interested in the specific physical phenomena that the artists use. We show examples of artistic representation of fluids by expressionist artists.

###### The Scream (or The Cry) 1893, Edvard Munch.

The Cry is a representation of different fluids interacting together: a human being, a river and the atmosphere.

###### The Starry Night 1889, Vincent van Gogh.

The Starry Night has been studied by many people, I will limite myself here to mention that the astronomer Charles A. Whitney studied the painting from the astronomic point of view. In particular, the brightest star is Venus and the moon was waning gibbous. From my point of view van Gogh is a step away (in physical terms) from the Navier-Stokes equation model of incompressible flows, because he is more likely representing the superfluidity of the lights. Even though, you can experimentally check (by watching here) that The Starry Night is closer related to the Navier Stokes equation than you may had thought.

# Explaining maths without using them

At the time I was finishing my thesis some non mathematician friends asked me to explain them what I was actually doing.  In this post I write the explanation I elaborated for them. In one sentence, the first problem one need to know how to solve is the following.

How do you explain a mathematical result without using maths at all?

The answer is well known to everybody teaching maths,  however, I will elaborate a bit on this. The first step is to understand the historical roots of the problem you solved, together with the main motivations that people had to need to develop maths in such a determined direction that your problems appeared naturally. Once, you have understood completely this part, you need to associate each problem you solved to something that the people you want to explain the problem to can understand well. This means to associate each result to something completely different but that behaves exactly the same. Finally, you need to somehow transport all this information and deliver it to your audience in a comprehensive way. The last part of the process is well performed by an ”artistic drawing” (whatever that means) together with an explanation of each element. The hardest part of the communication is the explanation of the proof of each result, it happened indeed, that this becomes an issue of time.

In what follows I will answer a more specific question.

Problem:

Explain your thesis to your friends with time constrains conditions.

My thesis can be coded by the following drawing.

The drawing has 5 main elements: a black disk at the top left, a black disconnected curve at the top and bottom, a red apple shape at the left, a blue swirl at the bottom and a green tree shape in the centre and right of the drawing. I will explain each of the five element in what follows.

1. Black disk: If one goes back in time from the questions I faced in my thesis, we arrive to the three body problem. This is represented by the three white bodies inside the black disk. I can suggest you some nice reference to read about, like [Wikipedia, Celestial Encounters by F. Diacu and P. Holmes]. In a few words:  The n-body problem consists in determining the position of $n$ planet at any time $t$, given the initial conditions of known position and velocity at time $t=0.$ For $n=2$ the problem can be easily solved, one can prove indeed, that the trajectory of one planet with respect to the other always lies along a conic section. The problem for $n=3$ was addressed by Henri Poincaré and literally he found the chaos in it. He was not able to find a solution, but instead, introduces qualitative methods to understand the solution, like, periodic solutions, recurrence theorem, non existence of uniform integrals, asymptotic solutions, dependence of the solutions with respect to a parameter, homoclinic orbits, first return map, invariant curves and homoclinic tangles. These qualitative methods are still our tools to understand dynamic systems that are too complicated to be understand in a deterministic way, i.e. those dynamical systems which equations can be  solved.
2. Black disconnected curve:  This curve represents the continuous trajectory of a particle that moves because of some physical laws acting on it. We suppose that there is a finite measure on the drawn system, we assume further that it is invariant under the physical laws. Under these assumptions,  by the Poincare recurrence theorem, almost every particle will enter in a finite amount of time into a set $A,$ providing the measure of this set is strictly positive. The set $A$ in the picture corresponds to the black disk, and the black disconnected curve eventually enters $A$ after some (unknown) finite amount of time. The question that we face is how can we estimate the time that takes the particle to enter for first time $A.$ We solved this problem under very strong hypothesis on the physical laws. Estimations for this problem under our hypothesis are known, however, we refined the existing bound.
3. Blue swirl: This represents chaos in the classic sense of the diagram of phase of ODE´s (Ordinary differential equation). Recall that when we have an ODE $x'=Ax$ in $\mathbb{R}^2,$ the diagram of phase corresponds to the plot of the vectors $(y_1,y_2)$ in the $(x_1,x_2)$-plane, where we draw at the point $x= (x_1,x_2)$ the vector $(y_1,y_2)=Ax.$ This represent the velocity field of the solutions of the ODE.  We assume $A$ is not singular, so that the equilibrium is $x=0.$  The diagram of phase will be determined by the eigenvalues and eigenvectors $\lambda_1,\lambda_2$ of the matrix $A.$ There are 7 cases for the equilibrium state. The equilibrium state is:
1. Stable if $\lambda_1<\lambda_2<0.$
2. Unstable if $0<\lambda_1<\lambda_2.$
3. Saddle if $\lambda_1<0<\lambda_2.$
4. Degenerate if $\lambda_1=\lambda_2\in \mathbb{R}.$
5. Center if $\lambda_1=i \beta, \beta\in\mathbb{R}\setminus \{0\}.$
6. Stable spiral if $\lambda_1=\alpha+i \beta, \alpha<0, \beta\in\mathbb{R}\setminus \{0\}.$
7. Unstable spiral if $\lambda_1=\alpha+i \beta, \alpha>0, \beta\in\mathbb{R}\setminus \{0\}.$ In the drawing we represented this case.
4. Red apple shape: This represents a seed that gives birth to a tree after a process that allows to ”build” a complex structure from iterations of a simpler one. This is analogous to the system build by a simple iterated function scheme that consists of two disjoint contractions on the unit interval, these contractions have associated a unique non-empty closed invariant set. This sets comes from a structure similar to the one of a tree, where one branch divided into to smaller, and each smaller one into two smaller and so on.
5. Green tree shape: The green structure represent a tree that we consider analogous to the invariant set of an iterated function system. The problem that we face in the last chapter is: What happens if we perturb a little bit the seed of the tree, how different is going to be our tree? The analogy with this is: perturbing a little bit both maps of our iterative function and study how smoothly that affect the invariant set. A mathematical way to do this is by considering the for example the ”measure” (called Hausdorff dimension) of the invariant set.

# Pythagoras Theorem

These two pictures prove Pythagoras Theorem:

The 4 coloured triangles (with catheti $a,b$ and hypotenuse $c$) in each picture are equal. At the background, a square of soft colour (with edges $a+b$). In the picture at the left the area of the big square corresponds to $(a+b)^2=4 \frac{ab}{2} +c^2,$ meanwhile, in the rightmost picture, the area of the big square corresponds to  $(a+b)^2=4 \frac{ab}{2} +a^2+b^2,$ therefore, $a^2+b^2=c^2.$

Estás dos fotos demuestran el teorema de Pitágoras:

Los 4 triángulos de colores (con catetos $a,b$ e hipotenusa $c$) en cada foto son iguales. De fondo, un cuadrado de colores claros (con lados $a+b$). Mientras que en la foto de la izquierda el área del cuadrado grande corresponde a $(a+b)^2=4 \frac{ab}{2} +c^2,$ en la foto de la derecha el área del cuadrado grande corresponde a $(a+b)^2=4 \frac{ab}{2} +a^2+b^2,$ por lo tanto $a^2+b^2=c^2.$

References: