0% found this document useful (0 votes)
18 views15 pages

Numerical Methods HW 2

The document discusses solving a heat transfer equation using numerical methods to analyze temperature distribution in a laminar boundary layer over a flat plate. Shooting method and Runge-Kutta method are used to solve the given second order ODE with boundary conditions. A FORTRAN code is written to implement the shooting method and results are plotted in MATLAB.
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
18 views15 pages

Numerical Methods HW 2

The document discusses solving a heat transfer equation using numerical methods to analyze temperature distribution in a laminar boundary layer over a flat plate. Shooting method and Runge-Kutta method are used to solve the given second order ODE with boundary conditions. A FORTRAN code is written to implement the shooting method and results are plotted in MATLAB.
Copyright
© © All Rights Reserved
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
You are on page 1/ 15

MIDDLE EAST TECHNICAL UNIVERSITY

DEPARTMENT OF AEROSPACE ENGINEERING

AE305 – NUMERICAL METHODS


HOMEWORK I I
REPORT

GROUP 45

Eda BÜLBÜL 2449288


Deniz Can ÇETİNEL 2449353
İdil CEYLAN 2449304
INTRODUCTION
In the given problem, we are asked to analyze the temperature distribution in a laminar
boundary layer over a flat plane. For the analysis we were given a 2nd order ODE heat transfer
equation and we used “Shooting Method” and “Runge Kutta Method” to solve the equation
using given boundary conditions. By using these methods, we are able to find the
temperatures in different coordinates and for different fluids. To solve this problem, a
FORTRAN code (based on the code provided) is written, and all graphs are plotted in
MATLAB to observe and compare the results.

METHOD

For the analysis we have used the following equations provided by the problem:

Temperature Distribution in a Laminar Boundary Layer Over a Flat Plate

2nd Order ODE:


𝑑2𝑇 2
𝑑𝑇
+ 𝛽𝜂 =0
𝑑𝜂2 𝑑𝜂

Where:

Similarity Transformation Variable:

𝑉∞
𝜂=√ 𝑦
2𝜈𝑥

Beta Function:
1
𝛽(𝑥) = 3 𝐶𝑓 √𝑅𝑒𝑃𝑟
22
Reynold’s Number:
𝐿𝑉∞
𝑅𝑒 =
𝜈

Local Friction Coefficient:

𝐶𝑓 = 0.664√𝑅𝑒𝑥

Local Reynold’s Number:


𝑥𝑉∞
𝑅𝑒𝑥 =
𝜈
Prandtl Number:
𝜈
𝑃𝑟 =
𝛼

L: Length of the plate (m)


𝜈: Kinematic viscosity of the fluid
𝛼: Thermal diffusivity

The Boundary Conditions

𝑇 = 𝑇𝑤 𝑎𝑡 𝜂 = 0

𝑇 → 𝑇∞ 𝑎𝑠 𝜂 → ∞
Parameters:
L = 1m
𝑉∞ = 20 𝑚/𝑠
𝑇∞ = 300𝐾
𝑇𝑤 = 500𝐾
𝜈𝑎𝑖𝑟 = 5.2 × 10−5 𝑚2 /𝑠
𝑃𝑟𝑎𝑖𝑟 = 0.72

Shooting Method
This method is based on changing the boundary-value problem into an equivalent initial-value
problem by assuming the problem's unspecified initial value.To solve the equivalent initial-
value problem we use trial and error approach.Firstly a trial solution is obtained.Then end
boundary condition is compared with the computed one. Another trial solution is created if the
computed value and the initial condition are not in agreement. All boundary conditions must be
satisfied within a tolerance before the iterative solution is complete.This method is usually
applied only to the solution of problems with one missing condition.

High-Order ODE’s for Initial Value Problems


To solve an ODE of order n it has to be transformed into an equivalent system of n first-order
ODEs.For the ODE’s of the form:
𝑑𝑛 𝑦
= 𝑓(𝑥, 𝑦, 𝑦 ′ , 𝑦 ′′ , … , 𝑦 𝑛−1 )
𝑑𝑥 𝑛
With initial conditions:
𝑦(𝑥𝑜 )
𝑦′(𝑥0 )

𝑦 𝑛−1 (𝑥0 )
Then it is transformed to an equivalent system of n first-order ODE’s:
𝑦 ′ = 𝑦1
𝑦 ′′ = 𝑦2 = 𝑦1 ′
… = ⋯.
𝑦 𝑛−1 = 𝑦𝑛−1 = 𝑦′𝑛−2

The equations are then transformed into the format shown below:

𝑦 ′ = 𝑦1 (𝑥) 𝐼𝐶: 𝑦(𝑥0 ) = 𝑦0


𝑦1′ = 𝑦2 (𝑥) 𝐼𝐶: 𝑦1 (𝑥0 ) = 𝑦′(𝑥0 )
…=…
𝑑𝑛 𝑦
𝑛
= 𝑦′𝑛−1 = 𝑓(𝑥, 𝑦, 𝑦1 … … 𝑦𝑛−1 ); 𝐼𝐶: 𝑦𝑛−1 (𝑥0 ) = 𝑦 𝑛−1 (𝑥0 )
𝑑𝑥

After obtaining the system of equations the selected method is applied to each equation
separately but simultaneously. For this problem we used 4th order Runge Kutta Method.

4th Order Runge-Kutta Method


The general form of the 4th Order Runge-Kutta Method is as follows:

𝑦𝑖 ′ = 𝑓(𝑥𝑖 , 𝑦𝑖 )

𝑦𝑖+1 = 𝑦𝑖 + ∆𝑥𝜑(𝑥𝑖 , 𝑦𝑖 , ∆𝑥)

𝜑 = 𝑎1 𝑘1 + 𝑎2 𝑘2+ 𝑎3 𝑘3+ 𝑎4 𝑘4
The function 𝜑(𝑥𝑖 , 𝑦𝑖 , ∆𝑥) is called the increment function and gives the average slope across
the interval. The classical 4th-order Runge-Kutta Method is represented as:

1
𝜑 = (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
6

𝑘1 = 𝑓(𝑥𝑖 , 𝑦𝑖 )
∆𝑥 1
𝑘2 = 𝑓 (𝑥𝑖 + , 𝑦𝑖 + 𝑘1 ∆𝑥)
2 2
∆𝑥 1
𝑘3 = 𝑓 (𝑥𝑖 + , 𝑦𝑖 + 𝑘2 ∆𝑥)
2 2
𝑘4 = 𝑓(𝑥𝑖 + ∆𝑥, 𝑦𝑖 + 𝑘2 ∆𝑥)

1
𝑦𝑖+1 = 𝑦𝑖 + (𝑘 + 2𝑘2 + 2𝑘3 + 𝑘4 ) ∆𝑥
6 1

The steps for using this method are as follows:


1.Find the slope at the beginning ( 𝑘1 )
2. Find the slope at the midpoint using the first slope (𝑘2 )
3.Use the midpoint slope to correct the y value at the midpoint and find the corrected
slope.(𝑘3 )
4. The corrected slope is used to compute the t value and its slope at the end of the interval.
(𝑘4 )
5.Finally combine the four slopes to yield an average slope to make a final prediction.
RESULTS

Question 1
In this question we were asked to solve ODE at x=0.1 using the Shooting Method with a
FORTRAN code. We first converted the second order ODE into a system of first order
equations:

𝑑2𝑇 2
𝑑𝑇
+ 𝛽𝜂 =0
𝑑𝜂2 𝑑𝜂

𝑑2𝑇 𝑑𝑇
2
= −𝛽𝜂2
𝑑𝜂 𝑑𝜂
Define the first order ODE’s:
𝑑𝑇
𝑓1 =
𝑑𝜂

𝑓2 = 𝑓1 ′ = −𝛽𝜂2 𝑓1

After defining the ODE’s we have implemented the shooting method into a FORTRAN code
as follows:
Step size (deta) is arranged as 0.001.
Maximum 𝜂 (eta_max) is arranged as 5.
Initial conditions of first derivative of temperature are predicted as –4000 and –4500.
According to these predictions shooting method is applied to find the exact initial condition,
𝑑𝑇
(0).
𝑑𝜂

𝑑𝑇1 𝑑𝑇2
𝑑𝑇0 𝑑𝑇2 𝑑𝜂 − 𝑑𝜂
= + (𝑇0 − 𝑇2 )
𝑑𝜂 𝑑𝜂 𝑇1 − 𝑇2

𝑑𝑇1 𝑑𝑇2
Where 𝑑𝜂
is the first predicted initial condition, 𝑑𝜂
is the second predicted initial condition. 𝑇1
and 𝑇2 are the results of these predicted initial conditions. 𝑇0 is the exact temperature.
𝑑𝑇0
According to this solution method we find 𝑑𝜂
(0) as -4254.108
𝑑𝑇
Now, since we have two initial conditions, which are T(0)=500 and 𝑑𝜂 (0) = −4254.108, we
can solve the ODE system with Runge-Kutta Method.

Question 2

In this question we are asked obtain solutions as a function of y, T(y) at various x values and
then plot them together. We converted the ODE into a function of y and T(y) as follows:

We were already given:

𝑑2𝑇 𝑑𝑇 𝑉∞
2
+ 𝛽𝜂2 = 0 𝑎𝑛𝑑 𝜂 = √ 𝑦
𝑑𝜂 𝑑𝜂 2𝜈𝑥

Then we converted the equations as follows:

1
𝑦= 𝜂
√ 𝑉∞
2𝜈𝑥
Then define :
1
𝐴= 𝑎𝑛𝑑 𝑦 = 𝐴 𝜂
√ 𝑉∞
2𝜈𝑥
As a result:
𝑑𝑦
=𝐴
𝑑𝜂

Then we do manipulations to the equation:

𝑑𝑇 𝑑𝑇 𝑑𝑦 𝑑𝑇
= = 𝐴
𝑑𝜂 𝑑𝑦 𝑑𝜂 𝑑𝑦

𝑑2𝑇 𝑑 𝑑𝑇 𝑑 𝑑𝑇 2
𝑑2𝑇
= ( ) = 𝐴 ( ) = 𝐴
𝑑𝜂2 𝑑𝜂 𝑑𝜂 𝑑𝜂 𝑑𝑦 𝑑𝑦 2
Final 2. order differential equation becomes:

2𝜈𝑥 𝑑2 𝑇 𝑉∞ 2 𝑑𝑇
+ 𝛽 √ 𝑦 =0
𝑉∞ 𝑑𝑦 2 2𝜈𝑥 𝑑𝑦

After that we followed similar steps as Question 1:

𝑑2 𝑇 𝑉∞ 2 𝑑𝑇 𝑉∞
2
= −𝛽√ 𝑦
𝑑𝑦 2𝜈𝑥 𝑑𝑦 2𝜈𝑥

Define the first order ODE’s:


𝑑𝑇
𝑓1 =
𝑑𝑦

𝑉∞ 𝑉∞
𝑓2 = 𝑓1 ′ = −𝛽√ 𝑦2 𝑓1
2𝜈𝑥 2𝜈𝑥

According to this, new 2nd order ODE where y is changed with, we renew the FORTRAN
code. To obtain the exact solution (300K), step size (dy) is arranged as 7e-07, the maximum
value of y (ymax) is arranged as 0.0003 and then applying shooting method and RK4
𝑑𝑇
algorithms we found the other initial condition 𝑑𝑦 (0) as -0.5899392e+07. Using these two
𝑑𝑇
initial conditions, T(0)=500, (0) = −0.5899392𝑒 + 07, we solved the ODE system with
𝑑𝑦
RK4 algorithm.
These steps are repeated for various x values: x = 0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 1.0.
Then the results are plotted in MATLAB as follows.
The x value directly affects the local Reynold number. The local Reynolds number also
directly affects the local friction coefficient. And Beta, which is one of the variables in the
ODE is a function that depends on the local friction coefficient , that is, depends on x.
1
𝛽(𝑥) = 3 𝐶𝑓 √𝑅𝑒𝑃𝑟
22
Since solution of the ODE’s depends on Beta, changes in x-station also change the results. At
this point, we can consider Beta as a factor affecting the rate of temperature change.
The graph clearly shows that increasing x values decreases the rate of temperature change.
We can deduct from this that the increase in the local Reynold number decreases the
temperature change rate of the fluid.
Question 3
In this question we are asked to plot the variation of the thermal boundary layer thickness in y
along x. For laminar flow over a flat plate, the thermal boundary layer thickness is given by:

𝛿𝑇 = 𝛿𝜈 𝑃𝑟 −1/3

𝜈𝑥 1
𝛿𝑇 = 5.0√ 𝑃𝑟 −3
𝜐0

Where:
Pr: Prandtl number
𝛿𝜈 :thickness of the velocity boundary layer thickness
𝑢0 :freestream velocity
x: distance downstream from the start of the boundary layer
𝜈:kinematic viscosity

According to this equation thermal boundary layer thickness is recalculated for each 0.001
increment in MATLAB. The graph and the MATLAB code is as follows.
clc;clear;
close all;
x = 0:0.001:1;
tbl = 5 .* sqrt(5.2*10^-5 .* x / 20) .* (0.72 .^ (1/3));
plot(x,tbl,"LineWidth",2)
hold on
grid on
title('Thermal Boundary Layer',FontSize=25)
xlabel('x(m)',FontSize=20)
ylabel('δ(m)',FontSize=20)
Question 4
In this question, we compared the results obtained for different wall temperatures. Using the
Fortran code that we implement to solve the first question, we solved the ODE system for
different initial condition, T(0), which are 450 K, 500 K, 550 K. We only changed the
parameter of wall temperature in the code and found the necessary data and plot them on
MATLAB.

Since the wall temperature has not direct effect on temperature distribution function, it only
changes the initial condition. For each Tw value, the temperature distribution function
converges the 300 K.
Question 5
For this question we have compared the fluids Water, Carbon dioxide ,and Mercury with the
results we got for air. Water’s Prandtl number is 6.9 and Carbon dioxide’s Prandtl number is
2.36 which are higher than air and Mercury’s Prandtl number is 0.03 which is lower than air.
Moreover, their kinematic viscosity values are different.
To get the results we used the FORTRAN code that we implement for first question. We only
change the parameter of Prandtl number for different fluid and find necessary data and plot
them on MATLAB.

The Prandtl number and kinematic viscosity value directly affects Beta Function.
1
𝛽(𝑥) = 3 𝐶𝑓 √𝑅𝑒𝑃𝑟
22
Since solution of the ODE’s depends on Beta, changes in Prandtl number and kinematic
viscosity also change the results. At this point, we can consider Beta as a factor affecting the
rate of temperature change.
The graph clearly shows that lower Prandtl number and higher kinematic viscosity values
increases the rate of temperature change.
𝜈
𝛼=
𝑃𝑟
The rate of temperature change of a fluid is related to its thermal diffusivity. Therefore, we
can deduct that increasing the kinematic viscosity and decreasing Prandtl number increases
the thermal diffusivity of the fluids.
CONCLUSION

In conclusion, our purpose in this assignment is solving boundary value problem for higher
order differential equation with numerical method. We used both shooting method and
Runge-Kutta method algorithms. Firstly, we change the second order differential equation to
first order differential equation system. To solve this ODE system, we need two initial
conditions. The first initial condition is given in the question. To find other initial condition,
we use shooting method algorithm. After finding other initial condition, we solve this ODE
system with 4th order Runge-Kutta algorithm. Furthermore , in this assignment, we analyzed
the effects of changes on the results by changing some of the parameters given to us. Lastly,
using the parameters that are given to us in the question, we calculate and plot variation of the
thermal boundary layer thickness.

You might also like