Tuesday, April 7, 2020

Shadertoy / Dynamic Voronoi Mesh

Since I have been looking (again) at Reaction-Diffusion and Grid simulations, I was pointed to the www.shadertoy.com community with its incredible WebGL simulations.

The first simulation on the ShaderToy platform that really struck me was this 'Cool Accident' sim by the CS-artist Wyatt, which has the 'dynamic foam' vibe that I have in mind. (But with no currents between the bubbles.)

If you aren't familiar with Shadertoy, you should definitely check them out. You can run them yourself in your browser, best in Google's Chrome and you need to activate WebGL.


An other amazing computer-scientist on the Shadertoy platform is Michael Moroz who made this dynamic 'Pilot Wave System' Voronoi simulation, that comes close to my Dynamic Foam.


I reached out to them and asked to add a Half-Edge structure to his sim, that distributes the currents between the cells, transporting energy; so the dynamics of pressure going from left to right, that you see in the animated gif and which are done manually, would all happen automatically.


Note, Half-Edges are way to add graphs to the edges of a Mesh.


Now Michael has made some additions to his simulations, that are a big leap forward!




Jamming

Respecting the ’shape index’ would make the foam rigid and structured when the cells jam:


Dry Foam

The Dynamic Foam needs to be a ‘dry-foam' rather than a ‘wet-foam'. Tightly packed is key, otherwise we won’t get a self-organising flow circuit. There would be too much leeway. So thin edges and enough pressure from the volumes

Flow Switch


Depending on the angles flow can easily be split up ...



… or be blocked when the corners are too sharp for a ‘fluent’ passage.


A bit like this example of an aortic valve in a pig's heart that opens and shuts depending on the angles:


———

Continuous flow.



When the angle reaches 90°'s the flow is blocked and pressure drops at the center.



The flow stops, inverses and moves in the opposite direction.


Think of the Bernoulli Principle where fast flow generates lower pressure and suction.  When the angle of the pipes are larger than 90° then the air would be blown directly into the tank.


Changes in the dynamic foam will happen percentage wise. Smaller cooler bubbles have less intense surrounding flows. Relatively the interaction stay the same.


-------

For the intensity of the currents you could think of siphoning where flow can move uphill, thanks to the pressure differences further down the line.


Or how flow can close a valve, something that isn’t possible with heat-transfer.


All in all it might like the crazy M.C. Escher’s waterfall design : )

Energy Exchange / Flow regulation

The underlying mechanism of my approach is that of a Dynamic-foam wherein knots can self-emerge. The uniqueness of this foam is that there are currents running between the bubbles. These currents are very energetic and self-organising like in Conway’s Game of Life: flows can block, merge or split. The second key element is that these currents transport heat around making some bubbles cool down and shrink, while others heat up and expand.


So I have been looking for a way to transforming my Bubbling mockup model into a mesh model, but with an energy exchange between the ‘temperature' of the Nodes and that of the surrounding Cells. A second feature would be a flow system where the temperature moves between the nodes from warm to cold.

Basics:

• Mesh with Cells and Nodes
• Each Cell has a temperature based on its size
• The global temperature of each Node is based on the sum of its surrounding Cells
• Heat is diffused between the Nodes; from hot- to cold Nodes, along the Half-edges
• The new temperatures at the Nodes is updated after diffusion and fed back to the surrounding Cells.

Extras:

• Flow vectors have a force value
• Connection angles at the Nodes have a regulating factor


Angles:

• Currents form a circuit that affects the sizes of the Volumes
• Angles of the connected edges can change and flows can be cut off -> Red
• This gives the flow circuit some Logic-Circuit-like properties.


Think of how angles play a role in a Tesla Valve:


Origins of the Dynamic Foam

Some thoughts on the underlying mechanisms of the dynamic foam:

A. It began with a medium filled with tiny oscillations [white: gas-phase]; herein ‘hotspots' appear where oscillations harmonise [red: solid-phase]; these hot-spots expand and increase the overall temperature in the gas, now bounded between these hotspots. At the sharp edges where these expanding hotspots collide, there the squeezed gas starts to flow [blue: fluid-phase]. 


It is comparable to the crystallisation of water into ice. Ice has a lower density, which increases the global water pressure within a closed system. When the expanding ice-volumes spread out and clash into a Voronoi-pattern, the pressurised water between the ice-blocks can no longer freeze. Think of how pressure makes ice-skating possible.


B. When freezing happens randomly throughout the medium we get a Voronoi-network of connected canals.


C. The novelty to this model is that these fluid-edges can form a circuit of currents and rules, similar to those of Game of Life, emerge. Currents can block each other and cells die; or currents can merge and cells grow. Heat is transported through the network making some volumes expand while others shrink ->  the foam becomes dynamic:


D. Finally rolling waves emerge. For instance we can focus on the one red cell bottom right, that fluctuates in size but keeps its position, while it looks as if the ensemble of cells rotates. What is rotating is the change in size, not the bubbles themselves. What is being transported around, is the heat within the edges.  


The mechanics are similar to normal waves, drive, by external forces; but in dynamic foam model the drive comes from the energy that runs internally through the circuit/edges between the bubbles, heating up some bubbles and making them expand while others cool down and shrink.

Ginzburg-Landau / Kuramoto-Sivashinsky Equation

Two models that have a dynamic foam vibe, but there is no flow running through their edges:

Ginzburg-Landau Theory:


Kuramoto-Sivashinsky Equation: