So it has taken nearly three months for me to actually write something on this blog, mainly because I was really busy with my uni work. Whatever blogging I managed to do, was for my travel blog and not this. I'm back in Sri Lanka now for the Christmas holidays, and thought of kick-starting this page, for real. :)
I'm really into tech stuff, specially into programming. In fact, I even wrote my first Windows 8 app two days ago. I have been developing for Android for over a year now, so I thought of writing about one of my Android apps as a start. Streamline's the name.
Streamline can be said to be an educational app, although it was intended to be just for fun. It allows you to simulate the flow of a liquid around any object that is drawn on the screen. The app can produce a plot of the velocity field or even better, it can show an animation of a set of particles that move with the flow.
Although the image on the right shows just one object, you can actually draw more than one object, and the particles will flow between them. Once the simulation is on, you can tap anywhere on the screen to add a "blob" of particles at that point, and then you can watch the blob get carried away with the flow.
Particles will always be generated at certain edges of the screen depending on the incidence angle of the incoming flow. So for an angle of attack of 0 degrees, particles will be created at the left edge of the screen and flow to the right, and for an angle of 45, particles will be created at the left and bottom edges, and they would flow to the top-right of the screen. There is also the option of generating particles at the surface of the object you draw, but these particles will be slightly different in colour to the ones generated at the edges of the screen. This was done to easily distinguish the particles coming from the object surface and those in the main flow.
The app also has a "Streamline" mode, where the actual streamlines in the flow are displayed, instead of moving particles. As additional features, you could change the colour of the incoming particles and the rate at which they are generated.
Streamline can also produce a colour contour plot of pressure in the flow, where low pressure regions are coloured in blue and high pressure regions in red. The pressure is calculated using Bernoulli's principle, where the fast moving regions of the flow have a lower pressure and vice versa.
Speaking of the history of the app and the details of the code, I was inspired by one of the lectures given for the 16.100 Aerodynamics course at MIT. Streamline is actually a practical implementation of the Vortex Panel Method which was taught to us in class. However, this is only a very basic type of fluid simulation because the Vortex Panel Method computes an ideal flow. Being more specific, it computes an incompressible Potential flow, where the effects of compressibility and viscosity have been ignored. So don't expect to see any boundary layer separations or anything of the sort.
You'll probably notice that as the number of vertices in the object you draw increases, the time taken for the app to solve the flow also increases, specially when you have more than about 200 points. This is because the Vortex Panel Method requires the inversion of an NxN matrix, for a problem with N vertices in the geometry drawn. And the inversion of a 200x200 matrix isn't the type of problem that an ARM processor, or any processor for that matter, particularly prefers. Getting the numbers into the matrix that was required to be inverted was probably the hardest part of this project. Actually, it was getting the numbers into the right locations in the matrix. The rest of the work was mainly to render the user interface and animations as smooth as possible.
I guess this would do for my first post on this blog. Hope to see you soon with some other project of mine. :)

