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: