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:

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

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:

Saturday, November 23, 2019

Primal-Dual Mesh

The past couple of months I have been looking for a CFD/mesh expert to help convert my simplistic Processing-model into a ...

... Primal-Dual Mesh/Graph-system.

The idea is that the 1st mesh constructs the volumetric bubble-lattice (A, B, D, ...); the 2nd mesh is a triangulated-grid that distributes the fluid-currents between the bubbles (ac, bc, cd, ...); and those two are interconnected (acAD), exchanging energy, where the solid volumes can phase-change into gas and visa-versa.

The primal-dual mesh would be like this stress-ball,

one where hot currents make the bubbles expand, and cold currents make them shrink. 

Similar to Game of Life where cells live or die, forming pulsating ‘organisms'; but with currents running through the edges between the cells.

On/off, heating and cooling the bubbles.


I. The Primal-Dual-mesh

The 1st mesh is for the volumes: circles/spheres
The 2nd mesh is for the gas in between: edges

Here's a cool reference for a dual-mesh: 

Barycenter (centroid) dual-mesh:

Barycenter is important, because the dual-mesh needs to cross correctly, flow runing between the volumes, it also looks more natural and foamy:

In 3D we get a volumetric Tetrahedron-mesh.


II. Three key elements for building this model

A. Spring-damping-mesh

The 1st mesh with the Delaunay-triangulations needs to be a spring-damping-mesh, to calculate and store the tension between the volumes.

Toxiclibs-library can be used that applies Verlet integration:
or Position Based Dynamics (PBD):

B. Fluid-Grid

The 2nd mesh with the Voronoi-diagrams represent the current-network between the volumes and needs to be a kind of fluid-grid to calculate the flow, such as:

• Flow fields (Eulerian):
For example Jos Stam's 'Fluid Method for Games'

• Lattice Gas Automata with scattering rules:

• Ore something in the trend of an Electrical-grid ...

C.  Spring-damping-mesh with Connect Fluid-Grid

The final key element is connecting the spring-damping-mesh with the fluid-grid, and make them interactive, both parts regulating each-other.

• Volumes (A)(B)(C)(D), with between them paths: (ac)(bc)(cd) 
• When flow in (ac) increases, then volume (A) contracts -> (ac) is a variable of (A)
• And visa versa the tension between (AD) regulates the current (ac) -> (AD) is a variable of (ac)

Like Ohm's Law: 
Current = Tension / Resistor


III. References

The action should go in the direction of this dual-mesh sim by RedBlobGames:

Amit form RedBlobGames has also a post where he creates islands with rivers on the half-edges of a dual-mesh:


A dry-foam simulator by Kenny Erleben:

Shimmy, a fun in-browser simulation of a dynamic mesh: 


Finite Volume Method (FVM) by Darren Engwirda using a Primal-Dual Mesh: 

Wednesday, May 29, 2019

Dynamic LBM (Lattice Boltzmann Method)

Previously the idea was to use PBD (Position Based Dynamics), a cloth simulator, to set up a grid/network to replace the dynamic particle simulator made in Processing (link), but ... 

Anyways, I got charmed by the LBM (Lattice Boltzmann Method)  that might be more interesting seeing how it handles and takes into account multiple surrounding inputs. 

I got the help from a LBM developer who did some tests, and set up a dynamic LBM-grid.


His starting point was hexagonal grid, unfortunately his time was limited, so ...
This raised the idea of replacing the hexagonal grid by a triangular one.