When analyzing fluid systems, it is generally useful to use computers because the math needed to analyze the system gets pretty involved, so much so that it is nearly impossible to do by hand. When I took Compressible Flow and Propulsion my senior year, we were introduced to using computers to analyze these systems. As a part of the course requirements, we got the opportunity to write CFD (Computational Fluid Dynamics) software which I thought was very cool. While these software were very basic, the math being done could easily be done by hand, it was a good way to learn the material. Plus, once the software was written, it made doing assignment MUCH easier. This project was our first foray into writing CFD software, and I choose Python as my language. This was a daring choice, our Professor had provided us with the calculator scripts that we could use, but it was all written in Matlab. While I could have just used Matlab, I just like and know Python better. So after a bit of transcribing, I ended up writing one of the scripts I am most proud of.
Project Goals: The goal of this project was to apply the concepts taught in class regarding supersonic flow over a double wedge airfoil in order to write software that can calculate the lift and drag of the wedge. This project was done in tandem to the material being taught in the course at the time, which included understanding shocks, expansions, and isotropic properties.
Learning Goals: Completion of this project utilized the concepts that were taught in class as well as skills that were acquired in previous classes:
|
The Theory
As an object, in this case the double wedge airfoil, passes through a supersonic flow, the flow is affected by the object as it travels along and interacts with the surface. Depending on how the flow enters a surface on the double wedge, an oblique shock or an expansion wave can occur. When this happens, the flow will change pressures and temperatures based on how the flow's Mach number changes. This change is dependent on the angle of the flow's turn. In order to fully analyze the double wedge, the following needs to be known:
As an object, in this case the double wedge airfoil, passes through a supersonic flow, the flow is affected by the object as it travels along and interacts with the surface. Depending on how the flow enters a surface on the double wedge, an oblique shock or an expansion wave can occur. When this happens, the flow will change pressures and temperatures based on how the flow's Mach number changes. This change is dependent on the angle of the flow's turn. In order to fully analyze the double wedge, the following needs to be known:
- the angle of attack of the wedge
- the geometry of the wedge (i.e. the forward and aft-ward half angles of the wedge)
- the upstream flow properties (Mach number and static pressure).
The Code
The code that I wrote had three main aspects to it:
|
The next major part of the code was the plotter. For this code, I said that the ground frame was the coordinate system where the x-axis was along the length of the wedge. The axes for the plot were in units of the chord length of the wedge (the chord length is a normalized unit where 1 chord is the length of the object. This is commonly used when describing an airfoil.). Using the forward and rearward half angle inputs, the program computed the shape of the wedge. Starting at the 0 and 1 chord, the script drew a line forwards and backward at the forward and rearward angles with respect to the x-axis respectively. These lines intersected at a point that was computed and terminate the lines at this point. The entire plot was mirrored over the x-axis, thus completing the wedge. With this plot, I was able to determine the length, start and end points of each surface of the wedge. In addition, I had the script plot an arrow at the front of the wedge to signify the direction of the flow given the angle of attack.
The final part of the code was the calculator. The code I wrote for this had various functions that worked together in order to run the calculations. Each surface was stored in array that I iterated over. As the iteration was being performed, it went through the following steps:
- It determined how the flow was entering the surface. Based on the geometry of the wedge and the angle of attack of the flow, it determined if the flow was being turned into itself, away from itself or not at all. This was important for the front half of the wedge, but for the back half of the wedge the flow would always turn away from itself due to the no-slip condition.
- Based on how the flow was being turned, the type of math could be determined. If the flow was being turned into itself, an oblique shock was occurring and therefore the pressure was calculated using the related math. If it was being turned away, an expansion wave was occurring. If it was running parallel to the surface, nothing was happening so the pressure would be the same as the upstream pressure.
- Once the pressure for each surface was calculated, the force on each surface was calculated knowing the length of the surface. As such this force was in units of N/m because this is being done in 2D. The force vectors were pointing into the surface.
- All of the forces were added up in order to find the force in the x and y direction. These overall forces were with respect to the ground frame.
- To find the lift and drag, the coordinate frame was rotated such that the x-axis was in the direction of the flow. Once this was done, the vector perpendicular to the flow was the 2D lift and the parallel to the flow was the 2D drag.
- Finally, the coefficients of lift and drag were calculated using all of the previously calculated metrics.
Double Wedge Project Files | |
File Size: | 1177 kb |
File Type: | rar |