I am trying to design a solution for simulating gaseous fluids in confined areas, I am using naiver-stokes equations for fluid dynamics but since it only covers incompressible fluids like liquid, i needed to find a way to simulate compressionRecently, I came up with the solution which is, creating a field storing pressure data for each volumetric partition and I thought it would be a good idea to construct this field as a composition of cubes where each cube has homogeneous pressure value within itself. I tried to inflate a cube from a point and create other cubes from its surfaces recursively minding the collision with surfaces inside that scene, but this algorithm fails because there are lots of detailed cases involving complex holes and notches on the object. Is there a better way to construct this field?
Filling a scene with cubes
graphics