to_palabos(im, filename, solid=0)[source]

Converts an ndarray image to a text file that Palabos can read in as a geometry for Lattice Boltzmann simulations. Uses a Euclidean distance transform to identify solid voxels neighboring fluid voxels and labels them as the interface.

  • im (ndarray) – The image of the porous material

  • filename (string) – Path to output file

  • solid (int) – The value of the solid voxels in the image used to convert image to binary with all other voxels assumed to be fluid.


File produced contains 3 values: 2 = Solid, 1 = Interface, 0 = Pore Palabos will run the simulation applying the specified pressure drop from x = 0 to x = -1.


Click here to view online example.