summaryrefslogtreecommitdiffstats
path: root/Smoke/report/chapter5.tex
blob: 03aab98cc3ecfe611a01a029ef103c78f7fdf150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
\chapter{Divergence}

After implementing the glyphs it was time for the divergence. This is a value which can be calculated using the already known value at each vertex and that of its neighbors. \\

\section{Description}

Divergence shows the amount of mass which is compressed or expanded. If mass enters the field at some point, called a source point, then that point will have a positive divergence value. If mass exits the field at some point, called a sink point, then that point will have a negative divergence value. \\

\section{Implementation}

The calculation of the divergence is rather trivial. For the divergence of the velocity this looks like:

$$ \nabla \cdot v = \frac{\partial v}{\partial x} + \frac{\partial v}{\partial y} = $$
$$ \frac{v_x(i + 1, j) - v_x(i, j)}{cell_x} + \frac{v_y(i + 1, j) - v_y(i, j)}{cell_y}$$

Where $ v_x(i, j) $ is the x-value at the gridpoint (i, j) and similar for the y-value. The $ cell_x $ and $ cell_y $ are the width and height of the cell. The same method is used for the force field. \\

The definition of the divergence says high values should appear where matter is injected and low values where matter exits the field. This means high values should appear in front of the mouse while dragging with low values behind it. \\

\section{Difficulties}

Although divergence is clearly defined, it is rather difficult to verify it using the simulation. This is a know difficulty. Divergence can however be verified by setting up a test environment where the outcome of the divergence should be obvious. For instance create one source and one sink point. \\