Pipe Flow

This application runs only in modern browsers.
Execution
Animation speed:
Steps/sec: 0
Flow Speed: 0.090
Viscosity: 0.030
Contrast
Resolution
Obstacles
Plot Selection
Update ↓

Wow, it has been a while since I checked this out! This was a COVID project for me in undergrad where I frankly just wanted an internal flow simulator and found an app online to modify. Looking back at my writing and the project itself, I would probably give myself a C+, and that is being generous. I am keeping the writing as it is for posterity. I find it very endearing to see what I used to do and hope it serves as an example of improvement over time.

Speaking of that improvement, I have decided to make some updates to the app itself now that I am a bit more capable at what I do. I have made the calculations significantly faster by assigning float-specific arrays where applicable, reworking a couple of calls to work better together, and refining the resolution. I have also added the ability to change the resolution and included some pre-made obstacles. The obstacles should all work with the base initial conditions, so feel free to mess with them and break it. You can break it quite quickly on the forward-facing step!

Foreword ↓
A very, very, VERY special thank you to Dr. Dan Schroeder from Weber State University for doing most of the leg work for this project. While this project did not take me a long time, since it is just a restructuring of his existing program, I spent a LONG time looking through his various resources such as his workshop on how to create applications like this and his book Physics Simulations in Java. In my references and disclaimer page please go through and learn about these things yourself if you are inspired like I was.
What is happening? ↓
Developing and developed flow are characteristics of how a fluid progresses through a pipe. As a fluid enters a pipe it starts off as uniform. This is when the velocity profile is the same from the wall to the center, which means that the flow is basically the same no matter where velocity is measured. The liquid immediately goes into developing flow after the initial entry. Developing flow, something that is kind of hard to visualize, is the flow of a fluid that is experiencing the friction effects of the walls. If you can imagine the flow being split into sheets or layers, the layers closest to the wall experiences a stronger friction force, and at the wall the speed is zero! Initially, the flow is not affected by the friction very much and most of the flow is still uniform. The layer where the fluid is between the uniform and friction affected flow is called the boundary layer. The boundary layer grows closer to the center of the pipe as the flow goes through. This is a very important marker for the developing flow since as soon as the boundary layer reaches the middle the flow is considered developed. The distance and time it takes for a flow to become developed relies on things like the fluid properties (i.e. viscosity and velocity) and the pipe properties like wall roughness, design, size, etc. In short, this website shows a simplified real-time example of how internal flow develops. If you have not already, hit the start button above and watch what happens!
How was this made? ↓
This program uses JavaScript to create a D2Q9 (2 dimensions and 9 weighted quadrants) lattice Boltzmann algorithm array to simulate the rightward flow of an arbitrary fluid. Lattice Boltzmann methods create a square array in which every node is affected by all of its surrounding neighbors, including diagonals. The program solves the entire array for one iteration and then presents the new mathematical findings as a snapshot in the above canvas. It is impossible to treat the fluid as a lot of very small particles or to make the nodes infinitely small since there would be no way to quantify the effect on one node to another node. This method is a good way to discretize, or approximate, the flow. Many computational solvers work in a way similar to this, where an object is represented by a lot of smaller elements or nodes that are then calculated by the way they affect each other. Two important elements to consider here are the boundary conditions and the meshing. The boundary conditions define how we are going to start are calculations, so in this case there is a rightward flow with walls on the top and bottom. The meshing is the array or node structure that defines the equations to be solved within each node. The above nodes are put together at a fairly low resolution because I saw it as a good balance between performance and clarity. For more on this subject, and for a better explanation than I could give you, please read this Paper, Wikipedia page, and read the Disclaimer and References page.
Disclaimer ↓
Copyright 2013, Daniel V. Schroeder

                        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

                        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

                        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                        Except as contained in this notice, the name of the author shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization.
References ↓

Lastly, thank you to my professors who have given me the foundation of knowledge and interest to learn more about all of this.