Computational Fluid Dynamics on the Incredible Raspberry Pi

Raspberry Pi is a $35 microcomputer that is incredibly versatile and powerful. I have been using it to develop Internet of Things (IoT) applications that use sensors to monitor the environment of a system, communicate the data to a cloud program, and then drive actuators to respond to certain environmental changes.

Just out of my curiosity, I test-ran Energy2D, a simple computational fluid dynamics (CFD) that I wrote in pure Java. As Raspbian — a main operating system of Raspberry Pi — bundles the Java Standard Edition in the disk image, any pure Java program like Energy2D works just out of the box (Figure 1).

Fig. 1: Raspberry Pi easily powers two Energy2D simulations at the same time.

Traditionally, CFD simulations are considered compute-intensive applications that run only on high-power machines. It is quite impressive that a $35 computer can also run them now (of course, it runs more slowly on Raspberry Pi than a personal computer, but it is not unbearably slow).

With some low-cost peripherals, one can easily create a tiny desktop computer and start learning and exploring (Figure 2). What a great service that the Raspberry community has done for those who are interested in computing and tinkering but are less privileged!

Fig. 2: A small HDMI monitor can be placed on top of the Raspberry Pi case to make a tiny desktop computer.

In a way, the General Purpose Input and Output (GPIO) pins on board of Raspberry Pi even make this humble computer more useful than a standard personal computer that does not have them. For example, by connecting a GPIO input from a temperature sensor to a virtual heat source in Energy2D, we can use thermal objects in the real world as variable inputs to drive a simulation, creating an illusion as if heat could transfer from the physical world into the virtual world. Conversely, by connecting a GPIO output from a virtual anemometer to a micro servo in the real world, we can use a virtual fluid flow to drive the rotation of a servo arm, creating an illusion as if wind could blow from the virtual world into the physical world to turn the servo arm. Using these connections available on the Raspberry Pi, we can easily combine sensors, actuators, and simulations to create interesting cyber-physical systems. This was actually the main mission of the mixed-reality labs, one of my previous NSF projects back in 2011. I wish we had known Raspberry Pi back then.

A YouTube video that shows Energy2D simulations on Raspberry Pi.

Computational Scientist, Physicist, & Inventor at the Institute for Future Intelligence

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store