summaryrefslogtreecommitdiffstats
path: root/Smoke/report/chapter5.tex
blob: 7907667c5deae4299e41d2ba6d35f0a0ffc7416f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
\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}

The 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 simple, once you get it. For the divergence of the velocity it 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. We also
implemented the divergence of the force field with the same formula. \\

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 and low values behind it. \\

\section{Difficulties}

Although we have a good definition of what the divergence is and what the result should look like, it is rather difficult to verify it using the simulation. This is
a know difficulty. The divergence can 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. \\