<feed xmlns='http://www.w3.org/2005/Atom'>
<title>compustream/src/buffer, branch master</title>
<subtitle>Hacky D2Q9 BGK LBM using compute shaders</subtitle>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/'/>
<entry>
<title>Experimental visualization of the velocity curl</title>
<updated>2019-04-28T12:22:15+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2019-04-28T10:53:27+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=ecaf665a05bdfcd10937152c378cfaec7cdf1836'/>
<id>ecaf665a05bdfcd10937152c378cfaec7cdf1836</id>
<content type='text'>
Calculating the curl of our simulated velocity field requires an additional
compute shader step. Handling of buffer and shader switching depending on
the display mode is implemented rudimentarily for now.
Most of this commit is scaffolding, the actual computation is more or less
trivial:

```
const float dxvy = (getFluidVelocity(x+1,y).y - getFluidVelocity(x-1,y).y)
                 / (2*convLength);
const float dyvx = (getFluidVelocity(x,y+1).x - getFluidVelocity(x,y-1).x)
                 / (2*convLength);

setFluidExtra(x, y, dxvy - dyvx);
```

This implements the following discretization of the 2d curl operator:

Let $V : \mathbb{N}^2 \to \mathbb{R}^2$ be the simulated velocity field at
discrete lattice points spaced by $\Delta x \in \mathbb{R}_{\gt 0}$.
We want to approximate the $z$-component of the curl for visualization:
$$\omega := \partial_x F_y - \partial_y F_x$$

As we do not possess the actual function $F$ but only its values at a
set of discrete points we approximate the two partial derivatives using
a second order central difference scheme:
$$\overline{\omega}(i,j) := \frac{F_y(i+1,j) - F_y(i-1,j)}{2 \Delta x} - \frac{F_x(i,j+1) - F_x(i,j-1)}{2 \Delta x}$$

Note that the scene shader does some further rescaling of the curl to better
fit the color palette. One issue that irks me is the emergence of some
artefacts near boundaries as well as isolated "single-cell-vortices".
This might be caused by running the simulation too close to divergence
but as I am currently mostly interested in building an interactive fluid
playground it could be worth it to try running an additional smoothening
shader pass to straighten things out.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Calculating the curl of our simulated velocity field requires an additional
compute shader step. Handling of buffer and shader switching depending on
the display mode is implemented rudimentarily for now.
Most of this commit is scaffolding, the actual computation is more or less
trivial:

```
const float dxvy = (getFluidVelocity(x+1,y).y - getFluidVelocity(x-1,y).y)
                 / (2*convLength);
const float dyvx = (getFluidVelocity(x,y+1).x - getFluidVelocity(x,y-1).x)
                 / (2*convLength);

setFluidExtra(x, y, dxvy - dyvx);
```

This implements the following discretization of the 2d curl operator:

Let $V : \mathbb{N}^2 \to \mathbb{R}^2$ be the simulated velocity field at
discrete lattice points spaced by $\Delta x \in \mathbb{R}_{\gt 0}$.
We want to approximate the $z$-component of the curl for visualization:
$$\omega := \partial_x F_y - \partial_y F_x$$

As we do not possess the actual function $F$ but only its values at a
set of discrete points we approximate the two partial derivatives using
a second order central difference scheme:
$$\overline{\omega}(i,j) := \frac{F_y(i+1,j) - F_y(i-1,j)}{2 \Delta x} - \frac{F_x(i,j+1) - F_x(i,j-1)}{2 \Delta x}$$

Note that the scene shader does some further rescaling of the curl to better
fit the color palette. One issue that irks me is the emergence of some
artefacts near boundaries as well as isolated "single-cell-vortices".
This might be caused by running the simulation too close to divergence
but as I am currently mostly interested in building an interactive fluid
playground it could be worth it to try running an additional smoothening
shader pass to straighten things out.
</pre>
</div>
</content>
</entry>
<entry>
<title>Bind key to reset lattice buffers</title>
<updated>2019-04-18T20:15:39+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2019-04-18T20:15:39+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=34566b28a82869cbf004d91c6d658ba71d40ed97'/>
<id>34566b28a82869cbf004d91c6d658ba71d40ed97</id>
<content type='text'>
i.e. restarting the simulation without clearing the geometry
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
i.e. restarting the simulation without clearing the geometry
</pre>
</div>
</content>
</entry>
<entry>
<title>Store material in fluid buffer and improve visualization</title>
<updated>2019-02-23T15:10:08+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2019-02-23T15:10:08+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=389da8159978571e8156ff7692bc595d957e846e'/>
<id>389da8159978571e8156ff7692bc595d957e846e</id>
<content type='text'>
Replaces the density value which is actually not that useful for visualization.

Encoding integer values as floats by casting and comparing them using
exact floating point comparison is not very safe but works out for now.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replaces the density value which is actually not that useful for visualization.

Encoding integer values as floats by casting and comparing them using
exact floating point comparison is not very safe but works out for now.
</pre>
</div>
</content>
</entry>
<entry>
<title>Tidy up wall drawing and geometry initialization</title>
<updated>2019-02-22T21:24:30+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2019-02-22T21:24:30+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=9779fd7484f7af6d10ae28ca3763c6d938c341e3'/>
<id>9779fd7484f7af6d10ae28ca3763c6d938c341e3</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Improvise interactive wall drawing</title>
<updated>2019-02-22T20:49:07+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2019-02-22T20:49:07+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=f0b536ac93b3a9a49dfff8a7637f09b153a3b955'/>
<id>f0b536ac93b3a9a49dfff8a7637f09b153a3b955</id>
<content type='text'>
Internal wall cells need to be disabled to prevent delayed propagation
of the reflected populations.

This is just quickly thrown together - both the visual drawing and the backend's
material handling remain to be improved.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Internal wall cells need to be disabled to prevent delayed propagation
of the reflected populations.

This is just quickly thrown together - both the visual drawing and the backend's
material handling remain to be improved.
</pre>
</div>
</content>
</entry>
<entry>
<title>Initialize cells using their equilibrium distribution</title>
<updated>2019-02-20T22:52:02+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2019-02-20T22:52:02+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=409ca238ec8f4f405443931947b2a85c03754bc9'/>
<id>409ca238ec8f4f405443931947b2a85c03754bc9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Hacky mouse-based fluid interaction</title>
<updated>2018-12-18T20:08:20+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2018-12-18T20:08:20+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf'/>
<id>6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Try out velocity norm color mapping</title>
<updated>2018-12-17T18:09:25+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2018-12-17T18:09:25+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=ede5386d53a453cb56c9b1c80de0a80322ddc6f1'/>
<id>ede5386d53a453cb56c9b1c80de0a80322ddc6f1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix glDrawArray call</title>
<updated>2018-12-17T18:08:50+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2018-12-17T18:08:50+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=85ad73153d1193e51e77ca825416df3794443fa4'/>
<id>85ad73153d1193e51e77ca825416df3794443fa4</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Parametrize lattice resolution</title>
<updated>2018-12-16T12:58:20+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2018-12-16T12:58:20+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=2eb7f9925315989735b4fb746cbd7bda6c9bd5bb'/>
<id>2eb7f9925315989735b4fb746cbd7bda6c9bd5bb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Hacky D2Q9 BGK LBM on GPU using GLSL compute shaders</title>
<updated>2018-12-15T22:09:32+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2018-12-15T22:09:32+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/compustream/commit/?id=44f5ac32a68a617f93704d44c4339f7db13b323e'/>
<id>44f5ac32a68a617f93704d44c4339f7db13b323e</id>
<content type='text'>
Improvised on top of computicles's scaffolding.

Works in a world where _works_ is defined as "displays stuff on screen that invokes thoughts of fluid movement".
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Improvised on top of computicles's scaffolding.

Works in a world where _works_ is defined as "displays stuff on screen that invokes thoughts of fluid movement".
</pre>
</div>
</content>
</entry>
</feed>
