This application was written as a final project for Advanced Fluids in 2011, a graduate course at UMass Lowell. The application was modeled on a similar application written in Matlab and used in class. My version added the ability edit the model being rendered with drawing tools.
This application rendered stream functions to show how stream-lines would look flowing around an object. This demo highlights the different tools added to draw primitives, and the mathematical foundation behind each.
Written using C++, Qt and OpenGL, this application was compiled on both Linux and Windows operating systems. The remainder of this page is based on a paper I submitted describing the application.
Introduction
Computers were built to solve complex problems. The increasing power of computers enables powerful computational methods to be done quickly. Programs have been created to explore fluid flow problems, and streamlines is one such example.
If you have ever seen smoke streaming over a car in a commercial, the path that the smoke travels is a streamline. For the path along the streamline, the volumetric flow rate, flux, is constant and its change is zero along the streamline. This results in the smoke traveling, rather cleanly, around an object. A variety of mathematical functions have been created that enable the simulation of physical bodies in a flow.
The stream function returns a value for a given x,y coordinate. Due to superposition the values from multiple functions can be combined to form more complicated shapes. The mathematics are not very complicated, however they require many computations and would be tedious when computed by hand. Computers can do all the computations in a matter of seconds and give almost instantaneous results.
Stream functions result in a gradient that can be contoured to create the lines that show where smoke would flow. The following demo highlights the effects of the stream functions alone and in combination to form objects in a flow.
Discussion
Potential and streamlines are two related properties. The potential flow and the streamlines are perpendicular to each other when plotted as contour lines. The potential, \(\Phi\), is based on the conservation of mass for an in-compressible irrotational flow. The stream function is represented by \(\Psi\).
\(\nabla^2\Phi=0\)
\(\nabla^2\Psi=0\)
The change in the stream functions and potential functions are also zero.
\(d\Phi=u\ {dx} + y\ {dy}\)
\(d\Psi=u\ {dy} - y\ {dx}\)
As these two equations show, the slopes of these two equations are negative compliments of each other reinforcing the idea that the results are perpendicular to each other.
From a programming perspective, computing the values for \(\Phi\) and \(\Psi\), then drawing the a contour map of these values creates potential lines and stream lines. We need to be able to compute these values at specific locations using stream functions, \(\Psi(x,y)\), and potential functions, \(\Phi(x,y)\).
From this point on we will only look at stream functions since these functions are needed to generate the stream lines. There are multiple stream functions, these include: free streams, vortexes, Rankin oval, doublet, and vortex panel. There is a different equation for each, and due to superposition their effects at a particular location can be added forming a combined effect.