Wednesday, 21 February 2018

Solve ODEs using MATLAB (Code)

I have decided to teach myself some CFD coding using my own intuition and some free online tutorials. This is a post about code I wrote to solve a first order ordinary differential equation. The method employed is called the finite difference method. I will start by coding equations using this method and will slowly move to finite volume method. I hope this code helps you in learning something.

The equation in question is mentioned below.
dy/dx = x+4 and y(0)=3

A uniform grid was employed, as I have not yet figured out how to make non uniform grid. When I figure it out, I will update it here, which will be soon.

The code, mentioned below, starts with a variable called Nx, which represents the total number of grid points in which the domain is divided in to. A rule of thumb, the more points in the domain, more accurate the solution becomes at the cost of computation resources, mainly CPU time and RAM and storage.

x and y are the vectors in which the known and the unknown values are stored. x has the known values, like the length of a pipe through which a fluid flow or a rod through which heat flows etc. y stores the unknown values like temperature of the rod or velocity of the fluid etc. The values are stored at nodes.

y(1) means first value in the vector y. which also happens to be our boundary condition. y is the value of the function at x=0. x=0 is the first value in in the x vector, written as x(1).

x(Nx-1) represents the domain size. Minimum domain size is usually zero e.g. starting point of a rod or a pipe and maximum can be any real number.

To calculate the grid spacing, represented by dx, the domain size was divided by the number of elements. In this example, we have four nodes, two at corners and two in-between, forming a total of three elements.

First order finite difference method was used to discretize the given equation. And a for loop was used for the solution. Using 4 grid points, the solution has an accuracy of 2.22% against the analytical solution of the equation which can be verified by hand calculations. Thank you for reading.

%solution to dy/dx=x+4 y(0)=3
%uniform grid
clear; clc;
Nx=4; %number of grid points
x=zeros(Nx,1); %x vector, known, goes from some known value to maximum value of the domain
y=zeros(Nx,1); %y vector, one value known due to boundary condition rest unknown
y(1)=3; %boundary condition
x(Nx-1)=1; %domain size
dx=x(Nx-1)/(Nx-1); %grid spacing
for i=1:Nx-1
    x(i+1)=(i)*dx;
    y(i+1)=(dx.*(x(i)+4))+y(i); %discretized differential equation
end

Monday, 12 February 2018

Wing with Leading Edge Tubercles: Update 01


Tubercles (bumps) added to the leading edge of the aeronautic wings are a class of vortex generators. As shown in the Figure 1.
Figure 1, Modified wing geometry

Figure 2, Baseline wing geometry

The wing's cross section is NACA 0012. The dimensions used for this analysis were as used by [Chen, J. H., S. S. Li, and V. T. Nguyen. "The effect of leading edge protuberances on the performance of small aspect ratio foils." 15th International Symposium on Flow Visualization. 2012]. The flow conditions were reproduced from the research paper mentioned. In the wing with the leading edge tubercles, the tubercle wavelength was kept at two-thirds of the wing span. The tubercle amplitude was kept at half of the wing chord.

Computational fluid dynamics analysis was conducted to analyze the effect of the leading edge tubercles on wing performance. For validation of the numerical methodology, the lift and drag produced by the wing was compared to the experiments conducted for the mentioned research paper at 25 degree angle of attack. The forces calculated using computational fluid dynamics were within 7.3 % and 1.4 % of the experimental values, respectively.

The addition of tubercles at the leading edge of a wing creates a non-uniform pressure distribution on the wing’s surface, as shown in Figure 3. This non uniform pressure distribution and the changed wing geometry is responsible for the creation of a counter rotating chord-wise vortex pair behind each tubercle trough, as shown in Figure 4. To read more about non uniform pressure distribution, refer to Non Uniform Pressure Distribution.

Figure 3, Non-uniform pressure distribution. L-R; Modified Wing, Baseline Wing

Figure 4, Counter-rotating chord-wise vortex formation. L-R; modified wing, baseline wing. Notice the absence of vortex structures, represented by circles in the modified wing, in the baseline wing.

These vortices re-energize the boundary layer between them by carrying high momentum flow close to the wing surface, as shown by the dynamic pressure distribution in Figure 5, which leads to a delay in stall for the wing with leading edge tubercles, as shown in Figure 6. It can be seen clearly from both Figure 5-6 that the flow is attached behind the tubercle crest in the wing with leading edge tubercles while the baseline wing had stalled completely. To read more, refer to Counter Rotating Chord-wise Vortex Formation and Reduction in the Blade Tip Vortices, Delayed Stall and Reduction in the Span-wise Flow.

Figure 5, Dynamic pressure distribution around the wings. Top; modified wing. L-R; tubercle crest, tubercle trough. Bottom; baseline wing, same span-wise locations where the tubercle crest and trough is for the modified wing.

Figure 6, Streamlines around the wings. L-R baseline wing, modified wing.

Another effect of adding the leading edge tubercles to the wing is reduced span-wise flow and wing-tip vortices. The reason for this is that the counter rotating chord-wise vortices generated as a result of adding tubercles to the wing geometry act as a barrier to any span-wise flow, as shown in Figure 7-8.

Figure 7, Velocity flow trajectories. L-R modified wing, baseline wing. Notice the reduced size and strength of the tip vortex for the modified wing in comparison with the baseline wing.

Figure 8, Streamlines on the surface of the wings. L-R; modified wing, baseline wing. Reduced span-wise flow, (T-B of the screen), is clearly visible in the modified wing.

Thank you for reading. I hope this post added to your knowledge about tubercles. Next up will be the results of the counter-rotating configuration for the NREL Phase VI wind turbine. For verification and validation of the said wind turbine numerical simulations, refer to Verification and Validation.

Some of the reviewed literature:

[1] Watts, P., and Fish, F. E., “The Influence of Passive, Leading Edge Tubercles on Wing Performance,” Proceedings of the Unmanned Untethered Submersible Technology (UUST01), 2001.
[2] Fernandes, Irelyn, Yogesh Sapkota, Tania Mammen, Atif Rasheed, Calvin Rebello, and Young H. Kim, "Theoretical and Experimental Investigation of Leading Edge Tubercles on the Wing Performance," Proceedings of the Aviation Technology, Integration, and Operations Conference, Los Angeles, CA, 2013.
doi.org/10.2514/6.2013-4300
[3] Frank E. Fish, Paul W. Weber, Mark M. Murray, Laurens E. Howle, “The Tubercles on Humpback Whales' Flippers: Application of Bio-Inspired Technology,” Integrative and Comparative Biology, Vol. 51, No. 1, 2011, pp. 203–213.
doi.org/10.1093/icb/icr016
[4] Pedro, H. T. C., and Kobayashi, M. H., “Numerical Study of Stall Delay on Humpback Whale Flippers,” 46th AIAA Aerospace Sciences Meeting and Exhibit, AIAA Paper 2008-0584, Reno, NV, 2008.
doi.org/10.2514/6.2008-584
[5] Fish, F. E., and Lauder, G. V., “Passive and Active Flow Control by Swimming Fishes and Mammals,” Annual Review of Fluid Mechanics, Vol. 38, 2006, pp. 193–224.
doi.org/10.1146/annurev.fluid.38.050304.092201
[6] Weber, P. W., Howle, L. E., Murray, M. M., & Miklosovic, D. S., “Computational Evaluation of the Performance of Lifting Surfaces with Leading-Edge Protuberances,” Journal of Aircraft, Vol. 48, No. 2, 2011, pp. 591-600.
doi.org/10.2514/1.C031163
[7] Miklosovic, D. S., Howle, L. E., Murray, M. M., & Frank E. Fish, “Leading-edge tubercles delay stall on humpback whale (Megaptera novaeangliae) flippers,” Physics of Fluids, Vol. 16, No. 5, 2004.
dx.doi.org/10.1063/1.1688341
[8] N. Rostamzadeh, K. L. Hansen, R. M. Kelso & B. B. Dally, “The formation mechanism and impact of streamwise vortices on NACA 0021 airfoil's performance with undulating leading edge modification,” Physics of Fluids, Vol. 26, No. 10, 2014.
dx.doi.org/10.1063/1.4896748
[9] K. L. Hansen, R. M. Kelso & B. B. Dally, “Performance Variations of Leading-Edge Tubercles for Distinct Airfoil Profiles,” AIAA Journal, Vol. 49, No. 1, 2011.
doi.org/10.2514/1.J050631
[10] Ernst A. van Nierop, Silas Alben, and Michael P. Brenner, “How Bumps on Whale Flippers Delay Stall: An Aerodynamic Model,” Physical Review Letters, Vol. 100, No. 5, 2008.
doi.org/10.1103/PhysRevLett.100.054502
[11] K.L. Hansen, R.M. Kelso, B.B. Dally, E.R. Hassan, “Analysis of the Streamwise Vortices Generated Between Leading Edge Tubercles,” Proceedings of 6th Australian Conference on Laser Diagnostics in Fluid Mechanics and Combustion, Canberra, 2011
[12] Shi, Weichao, Mehmet Atlar, Rosemary Norman, Batuhan Aktas, and Serkan Turkmen, "Numerical optimization and experimental validation for a tidal turbine blade with leading-edge tubercles," Renewable Energy, Vol. 96, Part A, 2016, pp. 42-55.
doi.org/10.1016/j.renene.2016.04.064
[13] Ri-Kui Zhang and Jie-Zhi Wu, “Aerodynamic characteristics of wind turbine blades with a sinusoidal leading edge,” Wind Energy, Vol. 15, No. 3, 2012, pp 407-424.
doi.org/10.1002/we.479
[14] Ibrahim, I. H., and T. H. New, "A numerical study on the effects of leading-edge modifications upon propeller flow characteristics," Proceedings of Ninth International Symposium on Turbulence and Shear Flow Phenomena. Melbourne, 2015.
[15] Moore, K., and A. Ning, "Aerodynamic Performance Characterization of Leading Edge Protrusions," 54th AIAA Aerospace Sciences Meeting, AIAA Paper 2016-1786, San Diego, CA, 2016.
doi.org/10.2514/6.2016-1786
[16] Ning, Zhe, and Hui Hu, "An Experimental Study on the Aerodynamics and Aeroacoustic Characteristics of Small Propellers of UAV," 54th AIAA Aerospace Sciences Meeting, AIAA Paper 2016-1785, San Diego, CA, 2016.
doi.org/10.2514/6.2016-1785

Update 01


Following are my publications relating to the subject of this post.

Butt, F.R., and Talha, T., "A Numerical Investigation of the Effect of Leading-Edge Tubercles on Propeller Performance," Journal of Aircraft. Vol. 56, No. 2 or No. 3, 2019, pp. XX. (Issue/page number(s) to assigned soon. Active DOI: https://arc.aiaa.org/doi/10.2514/1.C034845)

Butt, F.R., and Talha, T., "A Parametric Study of the Effect of the Leading-Edge Tubercles Geometry on the Performance of Aeronautic Propeller using Computational Fluid Dynamics (CFD)," Proceedings of the World Congress on Engineering, Vol. 2, Newswood Limited, Hong Kong, 2018, pp. 586-595, (active link: http://www.iaeng.org/publication/WCE2018/WCE2018_pp586-595.pdf).

Butt, F.R., and Talha, T., "Optimization of the Geometry and the Span-wise Positioning of the Leading-Edge Tubercles on a Helical Vertical-Axis Marine Turbine Blade ," AIAA Science and Technology Forum and Exposition 2019, Turbomachinery and Energy Systems, accepted for publication.