Professional Documents
Culture Documents
net/publication/319135704
CITATION READS
1 32,958
1 author:
SEE PROFILE
All content following this page was uploaded by Anis Zafirah Azmi on 16 August 2017.
FACULTY OF SCIENCE
UNIVERSITI TEKNOLOGI MALAYSIA
APRIL 2009
ii
“I declare that I have read through this thesis and according to my opinion this
thesis is appropriate in its scope and quality for the purpose of the certification
of Bachelor of Science (Industrial Mathematics)”.
Signature : ....................................................
I declare that this thesis entitle “Numerical Solution for Heat Equation” is a
result of my own research except as cited in the reference. The thesis has not
been accepted for any degree and is not concurrently submitted in candidature
of any other degree.
Signature : ……………………………………….
To my beloved parents
ACKNOWLEDGEMENT
ABSTRACT
ABSTRAK
Persamaan haba adalah salah satu persamaan yang penting dalam dunia sains.
Haba wujud dalam semua benda. Contohnya, suhu bagi sesuatu objek berubah
mengikut masa dan tempat bergantung kepada objek itu. Selain itu, persamaan ini
boleh digunakan untuk menyelesaikan urutan haba yang wujud dalam bidang sains
dan kejuruteraan. Bagi menyelesaikan masalah yang melibatkan persamaan haba,
kaedah berangka adalah salah satu cara penyelesaian. Ini kerana penyelesaian
menggunakan kaedah berangka mempunyai kejituan yang lebih tinggi berbanding
cara penyelesaian yang lain. Program Maple akan digunakan bagi mendapatkan graf
untuk masalah haba dan jawapan yang lebih tepat dan cepat. Model unuk masalah
haba juga akan dibincangkan di dalam kajian. Contoh bagi soalan persamaan haba
turut disertakan dan diselesaikan bagi memudahkan pemahaman pembaca.
viii
TABLE OF CONTENTS
SUPERVISOR’S DECLARATION ii
DECLARATION iii
DEDICATION iv
ACKNOWLEDGEMENT v
ABSTRACT vi
ABSTRAK vii
TABLE OF CONTENTS viii
LIST OF TABLES x
LIST OF FIGURES xi
1 INTRODUCTION 1
1.1 Introduction 1
1.2 Statement of the Problem 3
1.3 Objectives of the Study 3
1.4 Scope of the Study 4
1.5 Significance of the Study 4
2 LITERATURE REVIEW 5
2.1 General Information about the Heat Equation 5
2.2 Heat Transfer 7
2.2.1 Importance of Heat Transfer 7
2.2.2 Heat Transfer Modes 9
2.2.3 The Laws of Heat Transfer 10
ix
3 HEAT EQUATION 14
3.1 Introduction 14
3.2 History of Calculus 15
3.3 Differential and Integral Calculus 16
3.4 Model of Heat Equation 18
3.4.1 The Inhomogeneous heat Equation 22
3.4.1.1 Subscript Notation for Derivatives 23
3.4.1.2 Initial Condition 23
3.4.1.3 Types of Boundary Conditions 24
3.4.1.4 Initial/ Boundary Value Problems 25
REFERENCES 58
x
LIST OF TABLE
LIST OF FIGURES
INTRODUCTION
1.1 Introduction
Everyday people will learn and use mathematic since it is very useful in all time
and situation in our daily activities. Mathematic is a well wide subjects of itself. In
fact, engineering, physics, chemistry and other fields apply mathematic to show and
solve their problems. It shows that mathematics plays the role of producing the
model or solution for this entire field.
In primary school, students will learn the basic of differential and integration
since the subjects will be useful for the further subjects. A long time ago, the Greek
mathematicians had already known the concept of tangent to the curve and other
arcs. Unfortunately, before the 17th century there were no particular procedures to
find a tangent to the curve at a given point.
2
To solve this problem, Sir Isaac Newton (1642 – 1727) had used the same
method independently develop by Pierre de Fermat (1601 -1665). These approaches
give the definition of derivative.
Basically, this heat equation is always applied in the heat flow. Based on the
problem given, it is important to derive the problem and get the model of heat
equation with the boundary and initial conditions correctly. Then, the solution for the
equation can be done by using analytical mathematic methods such as separation of
variable, D-Alembert Method, or other. To make the solution become faster and
more accuracy, we use numerical methods which are explicit method and implicit
method or Crank – Nicolson method. In industry and real world, the problem will
consisted more than two variables. It is not easy to solve the problem using
calculation so to get the solution faster and more accurate we can use mathematical
software. In this research, I use Maple programming since the program more easily
to generate the codes.
This research is all about the heat equation that will be derive in the partial
differential equation. Then, this unsteady state equation will be solving using
numerical methods which are explicit method and implicit Crank-Nicolson method. I
will also use Maple programming to solve the heat equation.
Heat is a form of energy that exists in any material. For example, the
temperature in an object changes with time and the position within the object.
Furthermore, this equation can be applied in solving the heat flow that related in
science and engineering. The accuracy in using numerical method is more reliable
rather than using other method. We also can use the Maple programming to help us
get the answer as faster as the calculation. Besides, I also can gain more knowledge
and understand more about the heat equation and know how they get the unsteady
state equation that people use in their day life especially for those in science and
engineering fields.
5
CHAPTER 2
LITERATURE REVIEW
The heat equation is used to determine the change over time as heat spreads
throughout space. We need to determine the change in the function u over time. It
can be predicts that if a hot body is placed in a box of cold water, the temperature of
the body will decrease and after the past few time the temperature in the box will
equalize. One of the interesting properties of the heat equation is the maximum
principle which says that the maximum value of u is either earlier in time than the
region of concern or on the edge of the region of concern. This is essentially saying
that temperature comes either from some source or from earlier in time because heat
permeates but is not created from nothingness. This is a property of parabolic partial
differential equations.
For numerical method, Crank- Nicolson method can be use to solve the heat
equation. Crank-Nicolson method is invented by John Crank (1961) and Phyllis
Nicolson (1917-1968) based on numerical approximations for solutions at the point
u (x,t + ) that lies between the rows in the grid. Specifically, the approximation
, + − ,
ut (x,t + ) = + 0 (k2) .
7
For a computer hardware engineer, they are interested in knowing the cooling
requirements of circuit boards, as the miniaturization of computing devices is
advancing at a rapid rate. Chemical engineers are interested in heat transfers process
in various chemical reactions. A metallurgical engineer would be interested in
knowing the rate of heat transfer required for a particular heat treatment process, for
example, the rate of cooling in a casting process has a profound influence on the
quality of the final product. Aeronautical engineers are interested in knowing the heat
transfer rate in rocket nozzles and in heat shields used in re-entry vehicles. An
agricultural engineer would be interested in the drying of food grains, food
processing and preservation. A civil engineer would need to be aware of the thermal
stresses develop in quick-setting concrete, the effect of heat and mass transfers on
building and building materials and also the effect of heat on nuclear containment,
and more. For an environmental engineer is concerned with the effect of heat on the
dispersion of pollutants in air, diffusion of pollutants in soils, thermal pollution in
lake and seas and their impact in our life. The global, thermal changes and associated
8
problems caused by El Nino are very well known phenomena, in which energy
transfers in the form of heat exists.
The solar system and the associated energy transfers are the principal factors
for existence of life on earth. It is true to say that it is extremely difficult, often
impossible, to avoid some form of heat transfer in any process on earth.
The study of heat transfers provides economical and efficient solutions for
critical problems encountered in many engineering items of equipment. For example,
let’s consider the development of heat pipes that can transport heat at a much greater
rate than copper or silver rods of the same dimensions, even at almost isothermal
conditions. The development of present day gas turbine blades, in which the gas
temperature exceeds the melting point of the material of the blade, is possible by
provide efficient cooling systems and it is another example of the success of heat
transfer design methods.
The design of computer chips, which encounter heat flux of the order
occurring in re-entry vehicles, especially when the surface temperature of the chips is
limited to less than 1000C, is again a success story for heat transfers analysis.
Although there are many successful heat transfer designs, further developments are
still necessary in order to increase the life span and efficiency of the many devices
discussed previously, which can lead to many more new inventions. Also, if we are
to protect our environment, it is essential to understand the many heat transfer
processes involved and, if necessary, to take appropriate action.
9
All bodies emit thermal radiation at all temperatures. This is the only mode
that does not require a material medium for heat transfers to be occurring. The nature
of thermal radiation is such that a propagation of energy, carried by electromagnetic
waves, is emitted from the surface of the body. When these electromagnetic waves
strike other body surface, a part is reflected, a part is transmitted and the remaining
part is absorbed.
10
All modes of heat transfer are generally present in varying degrees in a real
physical problem. The important aspects in solving heat transfer problems are
identifying the significant modes and deciding whether the heat transferred by other
modes can be neglected.
Important to identifying the amount of energy being transferred per unit time
and for that we require the use of rate equations. For heat conduction, the rate
equation is known as Fourier’s law, which is expressed for one dimension as
qx = - k
where qx is the heat flux in the x direction (W/m2), k is the thermal conductivity
(W/mk), a property of material and dT/dx is the temperature gradient (K/m).
MATERIAL THERMAL
CONDUCTIVITY
Metals:
Pure silver 410
Pure copper 385
Pure aluminium 200
Pure iron 73
Alloys:
Stainless steel (18% Cr, 8% Ni) 16
Aluminium alloy (4.5% Cr) 168
11
Non metals:
Plastics 0.6
Wood 0.2
Liquid:
Water 0.6
Gases:
Dry air 0.025 (at atmospheric
pressure)
For convective heat transfer, the rate equation is given by Newton’s law of cooling as
q = h (Tw - Ta)
where q is the convective heat flux (W/m2), (Tw - Ta) is the temperature difference
between the wall and the fluid and h is the convection heat transfer
coefficient(W/m2K).
MATERIAL COEFFICIENT
Gases (stagnant) 15
Gases (flowing) 15-250
Liquids (stagnant) 100
Liquids (flowing) 100-2000
Boiling liquids 2000-35,000
Condensing vapors 2000-25,000
12
The maximum flux that can be emitted by radiation from a black surface is given by
the Stefan-Boltzmann Law, that is
q = σ TW4
The heat flux emitted by a real surface is less than that of a black surface and is give
by
q = Є σ TW4
where Є is the radiative property of the surface and referred as the emissivity.
The net radiant energy exchange between any two surfaces 1 and 2 is given by
Q = FЄ FG σ A1 (T14 - T14)
where FЄ is a factor that takes into account the nature of the two radiating surfaces,
FG is a factor that takes into account the geometric orientation of the two radiating
surfaces and A1 is the area of surface 1.
Q = q A1 = Є1 σ A1 (T14 - T14).
13
With respect to the laws of thermodynamics, only the first law is of interest in heat
transfer problem. The increase of energy in a system is equal to the difference
between the energy transfer by heat to the system and the energy transfer by work
done on the surrounding by the system, that is
dE = dQ - dW
where Q is the total heat entering the system and W is the work done on the
surrounding. Since we are interested in the rate of energy transfer in heat transfer
processes, we can restate the first law of thermodynamics as
“The rate of increase of the energy of the system is equal to the difference
between the rate at which energy enters the system and the rate at which the system
does work on the surrounding”, that is
𝐸 𝑄 𝑊
= −
CHAPTER 3
HEAT EQUATION
3.1 Introduction
mass, work and pressure. More advanced applications include power series and
Fourier series. Calculus is also used to gain a more precise understanding of the
nature of space, time, and motion. For centuries, mathematicians and philosophers
wrestled with paradoxes involving division by zero or sums of infinitely many
numbers. These questions arise in the study of motion and area. The ancient Greek
philosopher Zeno gave several famous examples of such paradoxes. Calculus
provides tools, especially the limit and the infinite series, which resolve the paradox.
The history of calculus falls into several distinct time periods, most in the
ancient, medieval and modern periods. The ancient period introduced some of the
ideas of integral calculus but unfortunately it not developed well in that time.
Calculating volumes and areas which is the basic function of integral calculus is
come from the Egyptian Moscow Papyrus(1800 BC), in which an Egyptian
successfully calculated the volume of a pyramid frustum.
From the school of Greek mathematics, Eudoxus(c. 408-355 BC) used the
method of exhaustion, which prefigures the concept of the limit, to calculate areas
and volumes while Archimedes(c. 287-212 BC) develop this idea further, inventing
heuristics which resemble integral calculus. In the 3rd century AD China was used
the method of exhaustion to find the area of a circle. It was also used in 5th century
AD to find the volume of sphere.
Around AD 1000, the Islamic mathematician, Ibn Al-Haytham, was the first
derived the formula of the sum of the fourth powers of an arithmetic progression,
using a method that is readily generalize to finding the formula for the sum of any
higher integral powers, which can be used to perform an integration. In the 12th
century, the Indian mathematician, Bhaskara II, develop an early derivatives
16
representing infinite change and he described an early form of Rolle’s theorem. The
Persian mathematician discovered the derivative of cubic polynomials, an important
result in differential calculus. In the 14th century, Madhava of Sangamagrama, along
with other mathematician-astronomers of the Kerala school of astronomy and
mathematics, described special cases of Taylor series.
The sum of integration is∫ , an elongated S (which stands for sum). The
definite integral is written as
∫ 𝑓
and read as “the integral from a to b of f-of-x with respect to x”. The indefinite
integral or antiderivatives is written as
∫𝑓 .
The fundamental theorem of calculus states that differentiation and integration are
inverse operations. If a function f is continuous on the interval [a,b] and if F is a
function whose derivatives is f on the interval (a,b), then
∫ 𝑓 =𝐹 − 𝐹 .
18
∫ 𝑓 =𝑓 .
Heat is a form of energy that exists in any material. Like any other form of
energy, heat is measured in joules (1 J = 1 Nm). However, it is also measured in
calories (1 cal = 4.184 J).
∆ = 𝜌 ∆𝑉 (3.1)
The new constant c is called the specific heat. It measures the amount of heat
required to raise 1 unit of mass of the material 1 degree of temperature.
Let’s consider a thin rod that is insulated along its length, as seen in Figure
3.1. If the length of the rod is L, the position along the road is given by x, where ≤
≤ 𝐿. Since the road is insulated, there is no transfer of the heat from the rod except
at its two ends.
19
Therefore, we can assume that the temperature u depends only on x and on the time t.
0 L
Consider a small section of the rod between x and x+∆ . Let S be the cross
sectional are of the rod. The volume of the section is S∆ , so (3.1) becomes
∆ = 𝜌 S∆
Therefore, the amount of heat at time t in the portion U of the rod defined by ≤
≤ is given by the integral
Q(t) = ∫ 𝜌 , . (3.2)
The heat equation models the flow of heat through the material. Using differentiation
then the time rate of change of Q is
= ∫ 𝜌
If the specific heat and the density do not vary with time, this becomes
𝑄 𝜕
= ∫ 𝜌 (3.3)
𝜕
Another way to compute the time rate of change of Q is to notice that, in the absence
of heat sources within the rod, the quantity of heat in U can change only through the
flow of heat across the boundaries of U at x = a and x = b. Let consider the section
of the rod between x = a and a+∆ .
20
Experimental study of heat conduction reveals that the flow of heat across such a
section has the following properties:
Heat flows from hot positions to cold positions at a rate proportional to the
difference in the temperatures on the two sides of the section. Thus the rate of
flow through the section is proportional to u(a+∆ , ) – u(a,t).
The rate of flow through the section is inversely proportional to ∆ , the width
of the section.
The rate of flow through the section is proportional to the area of S of the
boundary of the section.
Putting this three points together, we see that there is a constant C such that the rate
of flow of heat into U at x = a is given approximately by
+∆ , – ,
-CS (3.4)
∆
The constant C is called the thermal conductivity. It is positive since, if u(a+∆ , ) >
u(a,t), then the temperature is hotter inside U than it is outside, and the heat flows out
of U at x = a.
𝜕
-CS , (3.5)
𝜕
The same argument at x =b shows that the rate of flow of heat into U across the
boundary at x= b is approximately
𝜕
-CS , .
𝜕
21
The total time rate of change of Q is the sum of the rates at the two ends. Using the
fundamental theorem of calculus, this is
𝑄 𝜕 𝜕 𝜕 𝜕
= CS [
𝜕
, −
𝜕
, ]= ∫
𝜕
𝐶𝜕 (3.6)
𝑄 𝜕
= CS∫ (3.7)
𝜕
There are two formulas for the rate of heat of flow into U which is equation
(3.3) and (3.7). Setting them equal will get equation as below
𝜕 𝜕 𝜕 𝜕
∫ 𝜌 = C∫ or ∫ 𝜌 − = 0.
𝜕 𝜕 𝜕 𝜕
This is true for all a < b, which can be true only if the integrand is equal to 0.
Hence,
𝜕 𝜕
𝜌 − =
𝜕 𝜕
throughout the material. If we divide by c𝜌, and set k = C/ c𝜌, then the equation
becomes
𝜕 𝜕 𝜕 𝜕
− = or = . (3.8)
𝜕 𝜕 𝜕 𝜕
Equation (3.8) is called the heat equation. It models the flow of heat through
a material and is satisfied by the temperature. A similar derivation shows that the
diffusion of a substance through a liquid or a gas satisfies the same equation. In this
case it is the concentration u that satisfies the equation. For this reason equation (3.6)
is also referred to as the diffusion equation.
Equation (3.8) was derived under the assumption that there is no source of
heat within the material. If we considered the heat sources, the equation (3.8) can be
modified to accommodate them. For that, equation (3.6) must modify the right-hand
side to account for the internal sources. We will assume that the heat source is spread
throughout the material and that heat is being added at the rate of P(u,x,t) thermal
units per unit length per second.
Notice that we allow the rate of heat inflow to depend on the temperature u as
well as on x and t. An example would be a rod that is not completely insulated along
its length. Then heat would flow into or out of the rod along its length at a rate that is
proportional to the difference between the temperature in U and the ambient
temperature, so P(u,x,t) = [ − ], where T is the ambient temperature. Assuming
there is a source of heat, equation (3.6) becomes
𝑄 𝜕 𝜕
= CS [ , − , ]+=∫ , , dx.
𝜕 𝜕
23
The rest of the derivation is unchanged, and in the end we get the new equation with
variable P and make the equation become inhomogeneous heat equation which is as
follow:
𝜕 𝜕 𝜕 𝜕
𝜌 = + or = + P. (3.9)
𝜕 𝜕 𝜕 𝜕 𝜌
𝜕 𝜕 𝜕 𝜕
ux = , uy = 𝜕 , uyx = 𝜕 , and uxx = .
𝜕 𝜕 𝜕
ut = kuxx .
Boundary conditions of the form in (3.1) specifying the value of the temperature at
the boundary are called Dirichlet Conditions.
In other situation one or both ends of the rod might be insulated. This means
that there is no flow of heat into or out of the rod at these points. According to the
discussion leading to equation (3.5), this means that
𝜕
= (3.12)
𝜕
If this is true at the point x=0, then disagreeing along the same lines as we did in the
derivation of equation (1.5), we see that there is a positive number such that
𝜕
, = , − (3.13)
𝜕
25
where T is the temperature outside the insulation and u is the temperature at the
endpoint x = 0. Poor insulation at the endpoint x = L leads in the same way to a
boundary condition of the form
𝜕
𝐿, = − 𝐿, − (3.14)
𝜕
where > . Boundary conditions in (1.3) and (1.14) are called Robin conditions.
Put everything together, we can see that the temperature u(x,t) in an insulated rod
with Dirichlet boundary conditions must satisfy the heat equation together with
initial and boundary conditions. Thus, the complete function u(x,t) of the heat
equation is
The function f(x) is the initial temperature distribution. We can replaced the Dirichlet
boundary with Neumann or a Robin condition.
26
CHAPTER 4
4.1 Introduction
In this study, we will use numerical analytical to solve the parabolic partial
differential equations. Heat equation, diffusion problems are examples of parabolic
equations. There are two methods in solving these problems which are explicit
method and implicit method.
27
𝜕 𝜕 𝜕 , 𝜕 ,
𝜕
, =
𝜕
, or
𝜕
= 𝜕
.
𝜕
Using Forward Difference we can replace the original heat equation which by
𝜕
, + − ,
∆
, where , denotes the temperature in the rod at xi = x0 + i∆ and after the
𝜕 + , − , + − ,
j interval of times tj = j∆ , and replace at xi by , then the
𝜕 ∆
, + − , + , − , + − ,
=
∆ ∆
∆
and let r = ,( ∆ = , ∆ = ℎ , we get
∆
, + − , =𝑟 + , − , + − ,
or
, + =𝑟 − , + − 𝑟 , +𝑟 + ,
1 u i, j+1
k
h
r 1-2r r
u i-1,j u i, j u i+1,j
For stability of the solution equation above, r should satisfy the condition, 0 < r < .
29
A thin circular iron rod AB of 1 cm diameter, 50 cm length with insulated lateral side
is placed along the x-axis with end A (at origin) at 20oC and end B is kept at 100oC
temperature till it reaches steady state condition. Suddenly temperature at end A is
kept 300oC. Find the temperature distribution in the rod at time of intervals before it
reaches steady state condition.
Solution:
u = 300oC 100oC
A B
x=0 50 cm
Heat equation is
𝜕 𝜕
= ,
𝜕 𝜕
𝜌 ∆
∆ = = 87.89 sec.
30
x(cm) 0 5 10 15 20 25 30 35 40 45 50
u(oc) 300 28 36 44 52 60 68 76 84 92 100
𝜕 𝜕
= ,0≤x≤2,t≥0
𝜕 𝜕
and condition
u(x,0) = x(2-x)
u(0,t) = u(2,t)=0
with h = 0.5, k = 0.25 and stop the iteration at t= 0.5.
Solution:
To find for others u(x,t) we can use explicit method with given k = 0.25 and h = 0.5.
.
r= =1
.
will give us
Ui,j+1 = Ui-1,j – Ui,j + Ui+1,j.
1 u i, j+1
k=0.25
h= 0.5
1 -1 1
u i-1,j u i, j u i+1,j
For j =0,
i=1
i=2
i=3
For j =1,
i=1
i=1
i=1
𝜕 𝜕
= ,0≤x≤1,t≥0
𝜕 𝜕
and condition
u(x,0) = sin (πx)
u(0,t) = u(1,t)=0
with h = 0.2, k = 0.01 and stop the iteration at t= 0.02
> restart;
> interface( displayprecision=4);
> p_haba:=diff(u(x,t),t)=diff(u(x,t),x$2);
2
v v
p_haba := u (x, t ) = u (x, t )
vt 2
vx
> IC:=u(x,0)=sin(Pi*x);
> u_t:=(i,j)->(u[i,j+1]-u[i,j])/k;
> u_xx:=(i,j)->(u[i+1,j]-2*u[i,j]+u[i-1,j])/h^2;
35
> p_beza:=eval(
p_haba,{diff(u(x,t),t)=u_t(i,j),diff(u(x,t),x$2)=u_xx(i,j
)} );
u i, jC 1 K u i, j ui C 1, j K 2 u i, j C u i K 1, j
p_beza := =
k 2
h
> p_beza:=algsubs(k*c^2/h^2=r,k*p_beza):
> p_beza:=lhs(p_beza)-rhs(p_beza)=0;
k ( ui C 1, j K 2 u i, j C u i K 1, j )
p_beza := u i, jC 1 K u i, j K 2
= 0
h
> p_beza:=collect(p_beza,[u[i,j+1],u[i-
1,j],u[i,j],u[i+1,j]]);
k ui K 1, j æ
p_beza := u i, jC 1
K C K 1
h
2 è
2 kö k ui C 1, j
C u i, j K = 0
h ø
2 2
h
> u[i,j+1]=solve(p_beza,u[i,j+1]);
2
K k ui K 1, j K u i, j h C 2 u i, j k K k u i C 1, j
u i, jC 1
= K
2
h
k := 0.0100
t_maks := 0.0200
h := 0.2000
L := 1
r := 0.2500
> u[i,j+1]=solve(p_beza,u[i,j+1]);
u i, jC 1
= 0.2500 u i K 1, j
C 0.5000 u i, j C 0.2500 u i C 1,
M := 2
x 0 := 0.0000
x 1 := 0.2000
x 2 := 0.4000
x 3 := 0.6000
x 4 := 0.8000
x 5 := 1.0000
t 1 := 0.0100
t 2 := 0.0200
u 0, 1
:= 0.0000
u 0, 2
:= 0.0000
u 5, 1
:= 0.0000
u 5, 2
:= 0.0000
u 2, 0
:= 0.9511
u 3, 0
:= 0.9511
37
u 4, 0
:= 0.5878
> penye_[0]:=[seq([x[i],u[i,0]],i=0..N)];
penye_ 0
:= [ [ 0.0000 , 0.0000 ] , [ 0.2000 , 0.5878 ] , [ 0.4000 ,
0.9511 ] , [ 0.6000 , 0.9511 ] , [ 0.8000 , 0.5878 ] , [ 1.0000 ,
0.0000 ] ]
penye_ 2
= [ [ 0.0000 , 0.0000 ] , [ 0.2000 , 0.4809 ] , [ 0.4000 ,
0.7781 ] , [ 0.6000 , 0.7781 ] , [ 0.8000 , 0.4809 ] , [ 1.0000 ,
0.0000 ] ]
> A:=array(0..N,0..M):
> for j from 0 to M do
for i from 0 to N do
A[i,j]:=u[i,j];
od;
od;
> u:=convert(A,matrix);
> G1:=plots[matrixplot](u,axes=boxed,
orientation=[-20,55],
style=point,color=black,symbol=CIRCLE):
> G2:=plots[matrixplot](u,axes=boxed,
orientation=[-20,55], style=wireframe,color=black):
> plots[display](G1,G2);
38
39
𝜕
In implicit method second partial derivative can be expressed using
𝜕
Central Difference at xi and tj and for ,
𝜕 + , − , + − , + ,+ − ,+ + − ,+
𝜕
ij = − +
∆ ∆
, + − , ∆ + , − , + − , + , + − , + + − , +
= +
∆ ∆ ∆ ∆
or
, + − , =
𝑟
( + , − , + − , )+( + , + − , + + − , + ).
∆
For simplicity of calculation take r = = 1, then we have
∆
2( , + − , )=( + , − , + − , )+( + , + − , + +
− , + )
4 , + = + , + − , + + , + + − , +
, + = + , + − , + + , + + − , + .
40
1 h 1
u i-1,j u i+1,j
and condition
u(x,0) = x(2-x)
u(0,t) = u(2,t)=0
with h = 0.5, k = 0.25 and stop the iteration at t= 0.5.
(Take u0 = 0 and do calculation in 3 decimal places)
Solution:
1 h 1
u i-1,j u i+1,j
For j=0,
i =1
-u01 + 4u11 – u21 = u00 + u20
0 + 4u11 – u21 = 0 + 1
4u11 – u21 = 1 ………….(i)
43
i =2
-u11 + 4u21 – u31 = u10 + u30
-u11 + 4u21 – u31 = 0.75 + 0.75
-u11 + 4u21 – u31 = 1.5 ………….(ii)
i =3
-u21 + 4u31 – u41 = u20 + u40
-u21 + 4u31 – 0 = 1 + 0
-u21 + 4u31 = 1 …………..(iii)
𝑛+ 𝑛
+ + .
u21(n+1) =
𝑛+
+
u31(n+1) = .
n 𝑛 𝑛 𝑛
0 0 0 0
1 0.250 0.438 0.360
2 0.360 0.555 0.389
3 0.389 0.570 0.393
4 0.393 0.572 0.393
44
Iteration | − |= . < ε.
Then the solution for
u11 = u(0.5,0.25) = 0.393
u21 = u(1.0,0.25) = 0.572
u31 = u(1.5,0.25) = 0.393.
Meanwhile to find for u12 , u22 and u32 we can do as the calculation before,
For j=1,
i =1
-u02 + 4u12 – u22 = u01 + u21
0 + 4u12 – u22 = 0 + 0.572
4u12 – u22 = 0.572 ………….(iv)
i =2
-u12 + 4u22 – u32 = u11 + u31
-u12 + 4u22 – u32 = 0.393 + 0.393
-u12 + 4u22 – u32 = 0.786 . ………….(v)
i =3
-u22 + 4u32 – u42 = u21 + u41
-u22 + 4u32 – 0 = 0.572 + 0
-u22 + 4u32 = 0.572 …………..(vi)
A u = b
− .
[− − ][ ] =[ . ]
− .
45
𝑛+ 𝑛
(n+1)
+ + .
u22 =
𝑛+
+ .
u32 (n+1)
= .
As given u0 = 0 with calculation in 3 decimal places and ε = 0.005,
n 𝑛 𝑛 𝑛
0 0 0 0
1 0.143 0.232 0.201
2 0.201 0.297 0.217
3 0.217 0.305 0.219
4 0.219 0.306 0.220
Iteration | − |= . < ε.
Then the solution for
u12 = u(0.5,0.5) = 0.219
u22 = u(1.0,0.5) = 0.306
u32 = u(1.5,0.5) = 0.220.
46
Solve the heat equation below using Crank Nicolson method with
𝜕 𝜕
= ,0≤x≤1,t≥0
𝜕 𝜕
and condition
u(x,0) = 2 sin (2πx)
u(0,t) = u(1,t)=0
with h = 0.2, k = 0.1 and stop the iteration at t= 0.2.
> p_haba:=diff(u(x,t),t)=1/16*diff(u(x,t),x$2);
2
v 1 æv ö
p_haba := u (x, t ) = ç u ( x , t ) ÷
vt 16 è vx 2 ø
BC2 := u ( 1, t ) = 0
> IC:=u(x,0)=2*sin(2*pi*x);
> p_beza:=eval(p_haba,{diff(u(x,t),t)=(u[i,j+1]-
u[i,j])/(2*k/2),diff(u(x,t),x$2)=(1/2)*((u[i+1,j+1]-
2*u[i,j+1]+u[i-1,j+1])/h^2+(u[i+1,j]-2*u[i,j]+u[i-
1,j])/h^2)});
u i, jC 1 K u i, j
p_beza :=
k
1 ui C 1, j C 1
K 2 u i, jC 1
C ui K 1, j C 1
=
32 2
h
1 ui C 1, j
K 2 u i, j C u i K 1, j
C
32 2
h
47
> p_beza:=algsubs(c^2*k/h^2=r,expand(k*p_beza));
> p_beza:=collect(2*p_beza,[u[i-
1,j+1],u[i,j+1],u[i+1,j+1],
u[i-1,j],u[i,j],u[i+1,j]]);
1 k ui K 1, j C 1 1 k u i, jC 1
p_beza := 2 u i, jC 1
K 2 u i, j = K
16 2 8 2
h h
1 k ui C 1, j C 1 1 k ui K 1, j 1 k u i, j
C C K
16 2 16 2 8 2
h h h
1 k ui C 1, j
C
16 2
h
> p_beza:=lhs(p_beza)-rhs(p_beza)=0;
1 k ui K 1, j C 1
p_beza := 2 u i, jC 1
K 2 u i, j K
16 2
h
1 k u i, jC 1 1 k ui C 1, j C 1 1 k ui K 1, j
C K K
8 2 16 2 16 2
h h h
1 k u i, j 1 k ui C 1, j
C K = 0
8 2 16 2
h h
> p_beza:=collect(p_beza,[u[i-1,j+1],u[i,j+1],u[i+1,j+1],
u[i-1,j],u[i,j],u[i+1,j]]);
1 k ui K 1, j C 1 æ1 k
p_beza := K C
16 2 è 8 h2
h
ö 1 k ui C 1, j C 1 1 k ui K 1, j æ
C 2 u jC 1
K K C K 2
ø i, 16 h
2 16 h
2 è
1 k ö 1 k ui C 1, j
C u i, j K = 0
8 h2 ø 16 h
2
k := 0.1000
h := 0.2000
48
r := 2.5000
> p_beza:=p_beza;
p_beza := K 0.1563 u i K 1, j C 1
C 2.3125 u i, jC 1
K 0.1563 u i C 1, j C 1
K 0.1563 u i K 1, j
K 1.6875 u i, j K 0.1563 u i C 1, j
= 0
tmax := 0.2000
M := 2
x 1 := 0.2000
x 2 := 0.4000
x 3 := 0.6000
x 4 := 0.8000
x 5 := 1.0000
t 1 := 0.1000
t 2 := 0.2000
u 1, 0
:= 1.9024
u 2, 0
:= 1.1739
u 5, 0
:= 0.0051
u 0, 1
:= 0.0000
u 0, 2
:= 0.0000
u 5, 1
:= 0.0000
u 5, 2
:= 0.0000
K 0.1563 u 1, 1
C 2.3125 u 2, 1
K 0.1563 u 3, 1
K 2.0942 = 0
K 0.1563 u 2, 1
C 2.3125 u 3, 1
K 0.1563 u 4, 1
C 2.1015 = 0
50
K 2.7319 C 2.3125 u 1, 2
K 0.1563 u 2, 2
=0
K 0.1563 u 1, 2
C 2.3125 u 2, 2
K 0.1563 u 3, 2
K 1.6858 = 0
K 0.1563 u 2, 2
C 2.3125 u 3, 2
K 0.1563 u 4, 2
C 1.6918 = 0
K 0.1563 u 3, 2
C 2.3125 u 4, 2
C 2.7314 = 0
penye_ 1
:= [ [ 0.0000 , 0.0000 ] , [ 0.2000 , 1.5314 ] , [ 0.4000 ,
0.9450 ] , [ 0.6000 , K .9483 ] , [ 0.8000 , K 1.5308 ] , [ 1.0000 ,
0.0000 ] ]
penye_ 2
:= [ [ 0.0000 , 0.0000 ] , [ 0.2000 , 1.2328 ] , [ 0.4000 ,
0.7607 ] , [ 0.6000 , K .7635 ] , [ 0.8000 , K 1.2327 ] , [ 1.0000 ,
0.0000 ] ]
> A:=array(0..N,0..M):
> for j from 0 to M do
for i from 0 to N do
A[i,j]:=u[i,j];
od;
od;
> u:=convert(A,matrix);
51
> G1:=plots[matrixplot](u,axes=boxed,orientation=[-
15,70], style=point,color=black,symbol=CIRCLE):
> G2:=plots[matrixplot](u,axes=boxed,orientation=[-
15,70], style=wireframe,color=black):
> plots[display](G1,G2);
>
52
𝜕 𝜕 𝜕
= +
𝜕 𝜕 𝜕
x = i𝜕 , y = j𝜕 , t=n𝜕 ,
where i, j, n are positive integer and denote the values of u at theses mesh point by
u(i𝜕 , j𝜕 , n 𝜕 )= u i,j,n .
53
The explicit finite-difference can represent the two dimensional of heat equation as
, ,𝑛+ − , ,𝑛 − , ,𝑛 – , ,𝑛 + + , ,𝑛
= ( )+
∆ ∆
, − ,𝑛 − , ,𝑛 + , + ,𝑛
∆
in small value.
, ,𝑛+ − , ,𝑛 𝜕 𝜕 𝜕 𝜕
= { + ,, + + ,, + }
∆ 𝜕 𝜕 𝜕 𝜕
, ,𝑛+ = , ,𝑛
𝑟
+ [ + , ,𝑛+ + − , ,𝑛+ + , + ,𝑛+ + , − ,𝑛+
− , ,𝑛+ ]
+[ + , ,𝑛 + − , ,𝑛 + , + ,𝑛 + , − ,𝑛 − , ,𝑛 ]
assuming that a square grid is used so that Δx = Δy. This equation can be simplified
∆
by rearranging terms and let r = ,
∆
𝑟
− 𝑟 , ,𝑛+ − + , ,𝑛+ + − , ,𝑛+ + , + ,𝑛+ + , − ,𝑛+
𝑟
= − 𝑟 , ,𝑛 + ( + , ,𝑛 + − , ,𝑛 + , + ,𝑛 + , − ,𝑛 ).
For Crank-Nicolson numerical scheme, a low value of r is not required for stability,
however it is required for numerical accuracy.
54
CHAPTER 5
5.1 Introduction
This chapter summarizes the study that was done on the research about heat
equation and the solution using numerical methods. Recommendations are further
given for consideration for other researches to be done in the future.
5.2 Conclusion
that was discussed in this research, there are many solutions that can be used to get
the exact solution either using analytical or numerical. Separation of variables is the
oldest and most efficient solution technique for a certain class of Partial Differential
Equation (PDE) problems.
The basic idea of this method is to assume that the original function of two
variables can be written as a product of two functions, each of which is dependent
upon a single independent variable. Based on the assumed solution form, the PDE is
converted into two Ordinary Partial Equations that can be solved separately. Then,
combining the two solutions will get the solution for the corresponding PDE.
For this research, I am more interested in solving the unsteady state problem
which consider the time for heat equation using numerical methods which are the
explicit method and the implicit method (Crank Nicolson). The original heat
equation can be written as
𝜕 𝜕
=
𝜕 𝜕
𝜕 𝜕 𝜕
= + )
𝜕 𝜕 𝜕
Then, these original equation will be converted to the new equation using forward
and backward difference method that was learnt from calculus.
, + =𝑟 − , + − 𝑟 , +𝑟 + ,
, ,𝑛+ − , ,𝑛 − , ,𝑛 − , ,𝑛 + + , ,𝑛
=c ( )+
∆ ∆
, − ,𝑛 − , ,𝑛 + , + ,𝑛
( )
∆
, + = + , + − , + + , + + − , + )
𝑟
− 𝑟 , ,𝑛+ − ( + , ,𝑛+ + − , ,𝑛+ + , + ,𝑛+ + , − ,𝑛+
𝑟
= − 𝑟 , ,𝑛 + ( + , ,𝑛 + − , ,𝑛 + , + ,𝑛 + , − ,𝑛 )
Like other method, using the numerical method also has its advantages and
disadvantages that can shown in table below:
2-Dimensional
Explicit method Simplicity For stability, ∆t must be
less than a certain criterion
In this research, I also used the Maple Programming to solve the heat equation. It
will reduce your time in calculating the value of u(x,t) since the number of variables
become bigger and bigger in the real world problems. Besides, we can check the
accuracy of the solution too.
5.3 Recommendations
In order to further the research in this field, a few remarks are made in this
subtopic and the recommendations can be taken into future account.
Besides solving heat equation problem there are other equation can also be
faced by scientists or engineers in the real world problems. Wave equation is also
widely used since it is related with the vibration that usually occurs in the real world.
We can see many applications of wave equation occurring in the science and
engineering fields. Future research can also be done in the wave equation using
numerical method to solve it.
In this research, the examples given are only for one and two dimensional
problems. As we know in the real world solutions involve more than two variables. It
is advised that future research in those problems is recommended with more
examples that usually occur in real situations.
Other than that, real world problems involve more than two variables. For
future research it is encouraged to use the other mathematical software such as C
Programming, C++ Programming, and Matlab. Using these programming not only
saves time but also gives accurate solution.
58
REFERENCES
1. Che Rahim Che Teh, Kaedah Berangka (Matematik untuk Sains dan
Kejuruteraan Menggunakan Maple), Universiti Teknologi Malaysia, 2005
2. L.C. Evans, Partial Differential Equations, Grad. Stud. Math., Amer. Math.
Soc., Providence, RI, 1998
13. David, J. Logan, Applied Partial Equations, Second Edition, Springer, New
York, 2004
14. Zafar Ahsan, Differential Equations and Their Applications, Second Edition,
Prentice Hall of India, New Delhi, 2004
16. Solin, Pavel, Partial Differential Equations and the Finite Element Method,
Willey Interscience, A JOHN WILEY & SONS , INC., 2006