Numerical Methods HW 2
Numerical Methods HW 2
GROUP 45
METHOD
For the analysis we have used the following equations provided by the problem:
Where:
𝑉∞
𝜂=√ 𝑦
2𝜈𝑥
Beta Function:
1
𝛽(𝑥) = 3 𝐶𝑓 √𝑅𝑒𝑃𝑟
22
Reynold’s Number:
𝐿𝑉∞
𝑅𝑒 =
𝜈
𝐶𝑓 = 0.664√𝑅𝑒𝑥
𝑇 = 𝑇𝑤 𝑎𝑡 𝜂 = 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.
The equations are then transformed into the format shown below:
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.
𝑦𝑖 ′ = 𝑓(𝑥𝑖 , 𝑦𝑖 )
𝜑 = 𝑎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
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:
𝑑2𝑇 𝑑𝑇 𝑉∞
2
+ 𝛽𝜂2 = 0 𝑎𝑛𝑑 𝜂 = √ 𝑦
𝑑𝜂 𝑑𝜂 2𝜈𝑥
1
𝑦= 𝜂
√ 𝑉∞
2𝜈𝑥
Then define :
1
𝐴= 𝑎𝑛𝑑 𝑦 = 𝐴 𝜂
√ 𝑉∞
2𝜈𝑥
As a result:
𝑑𝑦
=𝐴
𝑑𝜂
𝑑𝑇 𝑑𝑇 𝑑𝑦 𝑑𝑇
= = 𝐴
𝑑𝜂 𝑑𝑦 𝑑𝜂 𝑑𝑦
𝑑2𝑇 𝑑 𝑑𝑇 𝑑 𝑑𝑇 2
𝑑2𝑇
= ( ) = 𝐴 ( ) = 𝐴
𝑑𝜂2 𝑑𝜂 𝑑𝜂 𝑑𝜂 𝑑𝑦 𝑑𝑦 2
Final 2. order differential equation becomes:
2𝜈𝑥 𝑑2 𝑇 𝑉∞ 2 𝑑𝑇
+ 𝛽 √ 𝑦 =0
𝑉∞ 𝑑𝑦 2 2𝜈𝑥 𝑑𝑦
𝑑2 𝑇 𝑉∞ 2 𝑑𝑇 𝑉∞
2
= −𝛽√ 𝑦
𝑑𝑦 2𝜈𝑥 𝑑𝑦 2𝜈𝑥
𝑉∞ 𝑉∞
𝑓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.