This document describes a numerical simulation of boundary layer theory. It contains the code to solve the momentum and energy equations for fluid flow over a flat plate using finite difference methods. The code calculates velocity and temperature profiles for varying values of parameters like the Prandtl number (Pr) and beta. Graphs of the non-dimensional velocity and temperature are plotted against the similarity variable for different cases.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
62 views3 pages
All Short
This document describes a numerical simulation of boundary layer theory. It contains the code to solve the momentum and energy equations for fluid flow over a flat plate using finite difference methods. The code calculates velocity and temperature profiles for varying values of parameters like the Prandtl number (Pr) and beta. Graphs of the non-dimensional velocity and temperature are plotted against the similarity variable for different cases.
%****************** Boundary Layer Theory Project ******************
%Programmer: Mohammadmahdi Namazi %Student No.: 90742019 %******************************************************************* clear; clc; close all; format short; BETTA=[1.6 1 .5 .2 0 -.14 -.1988]; % Shows the values of BETTA ETHA=[1.7 1.8 2 2.2 2.5 2.8 3.1]; % Shows the maximum value of EQ_ETHA for each BETTA pr=[0.6 0.8 1 3 7 15 50 300 1000]; % Shows the values of Pr %************************** Momentum Equation ********************** for O=1:7 % In this Loop, we repeat Calculations for different BETHA EQ_ethainf=ETHA(O); % Selecting suitable EQ_ethainf based on BETHA ethainf=EQ_ethainf*sqrt(2); % calculating ethainf based on EQ_ethainf n=5000; % No. of grid points h=ethainf/n; % Is the length of each step in numerical % calculations G3=zeros(n,1); % First of all we have to full variables with zeroes G2=zeros(n,1); G1=zeros(n,1); G3(1)=0; M1=0;N1=0;K1=0; % Variables which are used for Range-Kutta method M2=0;N2=0;K2=0; % M1,M2,M3,M4--->For the first equation M3=0;N3=0;K3=0; % N1,N2,N3,N4--->For the second equation M4=0;N4=0;K4=0; % K1,K2,K3,K4--->For the third equation etha=0:h:ethainf-h; % Calculating the etha error=1; % To step in the while Loop, we have to use error=1 while(error>0.005) % While Loop for calculating f G3(1)=G3(1)+0.001; % Correcting G3 @ etha=0 for i=2:n M1=h*G2(i-1); N1=h*G3(i-1); K1=-h*(G1(i-1)*G3(i-1)); M2=h*(G2(i-1)+N1/2); N2=h*(G3(i-1)+K1/2); K2=h*(-(G1(i-1)+M1/2)*(G3(i-1)+K1/2)+BETTA(O)*((G2(i-1)+N1/2)^2-1)); M3=h*(G2(i-1)+N2/2); N3=h*(G3(i-1)+K2/2); K3=h*(-(G1(i-1)+M2/2)*(G3(i-1)+K2/2)+BETTA(O)*((G2(i-1)+N2/2)^2-1)); M4=h*(G2(i-1)+N3); N4=h*(G3(i-1)+K3); K4=h*(-(G1(i-1)+M3)*(G3(i-1)+K3)+BETTA(O)*((G2(i-1)+N3)^2-1)); G1(i)=G1(i-1)+(1/6)*(M1+2*M2+2*M3+M4); if O==5 % For O=5, betta is zero and we use it for Fig. 4-5 of book ZZ(i)=G1(i) ; end G2(i)=G2(i-1)+(1/6)*(N1+2*N2+2*N3+N4); G3(i)=G3(i-1)+(1/6)*(K1+2*K2+2*K3+K4); end error=abs(G2(n)-1); % Checking the convergence criteria end if O==5 % Ploting u/Ue vs EQ_etha for betta=0 (fig. 4-3) figure(2) plot((1/(2^(0.5)))*etha,G2) xlabel('(y/2)(Ue/(nu.x))^(0.5)'); ylabel('U/Ue'); axis([0 4 0 1]); end figure(1); hold on plot((1/(2^(0.5)))*etha,G2) % Ploting u/Ue vs EQ_etha (fig.4-4) xlabel('(y/2)(Ue/(nu.x))^(0.5)'); ylabel('U/Ue'); axis([0 2.4 0 1]); %***************** Energy Equation (Pr= 0.7 , 10) **************** f=G1; pr_2=[.7,10]; % Solving energy equation for Pr=0.7 & 10 and betta=0 for j=1:2 figure(3); R1=zeros(n,1); % Full variables with zeroes R2=zeros(n,1); while(R1(n)<1) % Checking the convergence criteria R2(1)=R2(1)+0.01; % Correcting R2 @ etha=0 for i=2:n M1=h*R2(i-1); N1=-h*f(i)*pr_2(j)*R2(i-1); M2=h*(R2(i-1)+N1/2); N2=-h*f(i)*pr_2(j)*(R2(i-1)+N1/2); M3=h*(R2(i-1)+N2/2); N3=-h*f(i)*pr_2(j)*(R2(i-1)+N2/2); M4=h*(R2(i-1)+N3); N4=-h*f(i)*pr_2(j)*(R2(i-1)+N3); R1(i)=R1(i-1)+(1/6)*(M1+2*M2+2*M3+M4); R2(i)=R2(i-1)+(1/6)*(N1+2*N2+2*N3+N4); end end plot(2^(-0.5)*etha,1-R1) % Ploting (1-tetta) vs EQ_etha (fig. 4-6) xlabel('(y/2)(Ue/(nu.x))^(0.5)'); ylabel('(T-Te)/(Tw-Te)'); axis([0 2 0 1]); hold on end end %****************** Energy Equation (betta=0) ********************* figure(4); f=ZZ; for j=1:9 % Solving energy equation for nine different Prs and betta=0 R1=zeros(n,1); % Full variables with zeroes R2=zeros(n,1); while(R1(n)<1) % Checking the convergence criteria R2(1)=R2(1)+0.01; % Correcting R2 @ etha=0 for i=2:n M1=h*R2(i-1); N1=-h*f(i)*pr(j)*R2(i-1); M2=h*(R2(i-1)+N1/2); N2=-h*f(i)*pr(j)*(R2(i-1)+N1/2); M3=h*(R2(i-1)+N2/2); N3=-h*f(i)*pr(j)*(R2(i-1)+N2/2); M4=h*(R2(i-1)+N3); N4=-h*f(i)*pr(j)*(R2(i-1)+N3); R1(i)=R1(i-1)+(1/6)*(M1+2*M2+2*M3+M4); R2(i)=R2(i-1)+(1/6)*(N1+2*N2+2*N3+N4); end end plot(2^(-0.5)*etha,1-R1) % Ploting (1-tetta) vs EQ_etha(fig. 4-5) xlabel('(y/2)(Ue/(nu.x))^(0.5)'); ylabel('(T-Te)/(Tw-Te)'); axis([0 2 0 1]); hold on end