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!




Based on Wyatt Flanders' GLS shader research
(Use Chrome to activate Shaders)

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:




Thursday, November 28, 2019

3 Phases

The medium filled with tiny waves (oscillations) organises itself in 3 phase of matter. Based on a combination of density, frequency, velocity and alignment-angle: linearly, chaotic or radially.


These phases give rise to a dynamic-foam structure (Voronoi), in which circuits can form and knots can emerge.

Grid (Gradient / Shader)


-

Inspired by Prof. Dirk Brockmann's 'Complexity Explorables':

Monday, November 25, 2019

Reaction Diffusion & Fluid Grid

The intention of my 800 project is to test an old-school Vortex-Knot-Atoms theory of everything, 


... and my approach is that of a dynamic-foam,


... wherein Torus-, Trefoil- and fig. 8-knots can self-emerge and interact.


-

I've been focusing on a Triangle-Mesh & Fluid-Grid combination; but now I’ve realised that such a setup is too complicated to begin with. A  Reaction-Diffusion & Fluid-Grid combination might be the best way to go. 

-

Here's a summery that outlines the idea of a dynamic foam which has 3 phases of matter:

Solid volumes : A, B, C, D, ...
Gas between those volumes that forms a circuit : ac, bc, cd, ...
Phase-transitioning from Solid < > Gas : acAD, bcAB, cdBD, …


Pressure and tension in the pathways, and between the bubbles organise the flow. Currents can block each other or merge. The temperature in the network makes some volumes heat-up and expand; while others cool-down and shrink. 


To take it to the next level the above particle model could be replaced by a Reaction Diffusion grid, boosted with a CFD-fluid and a couple of extras.

-

The idea for using a grid came from this circle-drawing article:


... and Robert Munafo’s Reaction Diffusion 'Gray-Scott Explorer':


A first extra tool would be a Voronoi-fields generator like in this example:

• A Poisson distribution of Volumes.
• Gradually expand the temperature of the Volumes.


• Where the circular volumes clash/overlap there is a pressure change -> gas creation and cell formation.
• At a tipping point all gas-canals connect and currents can start to flow around and form circuits.


Gas forms where the changing temperatures in the medium clash:


The second part is your fluid dynamics model for the current network between the volumes.


In general we get 3 zones:
Solid cell-Volumes with internal temperature like RD models.
• Fee moving Gas can form fast currents between the Volumes and carry heat, like CFD.
Phase-transition (RD): Cells can vaporise and Gas can condensate.


Sliders will be needed to fine-tune the phase-change, and the properties of the Cells and Gas.


With ultimately as goal to create steady fluctuations within the foam, where the heated circuits make some cells expand and others cool down and shrink.


Similar to Game of Life where cells live or die, forming pulsating ‘organisms'.


-

The goal is now to combine two models:

Reaction-Diffusion
Such as Gray-Scott Explorer, that uses uses only two chemicals described by the two partial differential equations (PDEs):


Fluid
Such as Jos Stams' Real-Time Fluid Dynamics based on the Navier-Stokes Equations:

The Navier-Stokes Equations for the velocity in a compact vector notation (top) and the equation for a density moving through the velocity field (bottom).

Jos Stam's fluid model uses 'classical' Brownian Motion diffusion: