Université du Québec à Montréal, Montreal, Quebec, Canada
November 18-21, 2017
Fluid mechanics is the study of fluids (obvious examples are air and water). This could involve anything from studying how to reduce drag over the latest commercial airliners to the ideal design of a water turbine for extracting energy in dams.
Worried that you’ve never studied fluid mechanics before? Come and join us to hear how we’ve been using Python in science. Don’t worry, we’ll explain everything!
On the experimental side of fluid mechanics these problems are studied by constructing experiments that represent the problem being studies (one common example of this that might pop into your head is that of a car inside a wind tunnel with a streak of smoke flowing over its surface). To analyze these experiments, various techniques are used (such as the smoke visualization mentioned earlier, or colored dye in water based studies). One of the most powerful of these techniques is Particle Image Velocimetry (or PIV).
PIV involves 3 key things: 1. Dispersing many small particles throughout a fluid flow 2. High intensity illumination (usually lasers) to illuminate the particles 3. High-speed cameras to record the motion of the particles
The end result of this technique is a series of images, each of which looks like a field of small bright speckles (each speckle being a illuminated particle). By correlating these images across time, PIV analysis software can determine the velocity at regularly spaced points in the image.
After obtaining these vector fields, the real science comes in analyzing them. For example one might be interested in what the pressure distribution over an airfoil is. This could be done by reconstructing the pressure field from the vector field. Another example is determining what the average turbulence level is in a jet of air. Now this is where Python comes in!
To facilitate analysis of PIV data we have developed a package that can perform many of these analysis tasks and further provides awesome visualization tools that aid in the PIV analysis workflow.
The package provides 4 main functionalities: 1. A PIV data set object that contains analysis functions for analyzing its data 2. Utilities for loading PIV vector data sets from PIV processing software file formats 3. Visualization tools
Typically the actual processing of images into vector fields is done by specialized PIV software such as DaVis (by LaVision). We use the package ReadIM by user fleming79 (https://github.com/fleming79/readim) to accomplish this. In the future other file formats from different PIV software providers would be supported too.
Analysis functions include calculation of turbulence quantities such as: turbulent kinetic energy production, and turbulent kinetic energy.
Functions for calculating mean quantities in the flow also exist, such as calculation of the Reynold's number and mean velocity.
Typically these functions are all implemented of the core scientific programming packages for Python: Numpy and Scipy.
In the talk we will visually demonstrate a workflow showing what these functions actually produce (and what they even mean, if you're not familiar with fluid mechanics!).
One of the biggest problems in working with PIV data is in visualizing the data.
In many cases, just to check if the analysis did what you thought it should, one must write several lines of code just to display a figure. This can make the data analysis workflow extremely cumbersome.
Included in our package are functions that easily show researchers the data they want to see without having to write several lines of code to do it.
These are implemented with Bokeh and HoloViews.
Part of the motivation for developing such a package is the fact that many of these analysis functions are routinely used by researchers all over the world. However due to lack of collaboration, different researchers implement their own version of essentially the same function. Furthermore new-comers into the field often have to re-write their functions from scratch, or if lucky, inherit them from there close predecessors.
An open source package would make the codes used for PIV analysis available to all. This means that results produced from the code can be scrutinized in depth. Furthermore this would contribute to the reproducibility of results. For example, one researcher's average velocity code may return a different result from another's'. If researchers shared the code they used, reproducibility would be much easier.
By creating this package, we hope to initiate collaboration such that we can produce better science than we could individually.
We are a group of 4 graduate students researching fluid mechanics at the University of Waterloo. Jonathan Deng will be presenting the topic.
Jonathan "Jon" Deng MASc student studying vocal fold dynamics.
Amitvikram "Amit" Dutta PhD student studying aero-acoustics. Avid open-source software user.
Jia Cheng "Winston" Hu PhD student studying vortex dynamics. Amateur Hearthstone player.
Xueqing "Caddie" Zhang PhD student studying droplet dynamics in air jets. Recently converted from Matlab to Python .