Project No. 02: Submitted By: Khalil Ahmad
Project No. 02: Submitted By: Khalil Ahmad
Project No. 02: Submitted By: Khalil Ahmad
02
Project Title:
Submitted By: Khalil Ahmad
Submitted To: Dr. Khalid Pervaiz
Dated: 1!0"!201#
$%&titute o' &(ace Tech%olo)y $&lamabad* Pa+i&ta%
Conservative FDE Scheme
The% the (artial di''ere%tial e,uatio% become& 'or co%&ervative &cheme
u
t
k
u
x
=
2
2
-here u.x* t/ i& the tem(erature at time t a di&ta%ce x alo%) the -ire. 0e-riti%) the (artial di''ere%tial
e,uatio% i% term& o' 'i%ite di''ere%ce a((ro1imatio%& to the derivative&* -e )et
u u
t
k
u u u
x
j
n
j
n
j
n
j
n
j
n +
+
=
+
1
1 1
2
2
.
Thu& i' 'or a (articular n* -e +%o- the value& o' u
j
n
'or all j* -e ca% &olve the e,uatio% above to 'i%d
u
j
n+1
'or each j:
( ) ( )
( ) u u
k t
x
u u u s u u s u
j
n
j
n
j
n
j
n
j
n
j
n
j
n
j
n +
+ +
= + + = + +
1
2 1 1 1 1
2 1 2
-here s 2 kt3.x/
2
. $% other -ord&* thi& e,uatio% tell& u& ho- to 'i%d the tem(erature di&tributio% at
time &te( n41 )ive% the tem(erature di&tributio% at time &te( n. .At the e%d(oi%t& j 2 0 a%d j 2 J* thi&
e,uatio% re'er& to tem(erature& out&ide the (re&cribed ra%)e 'or x* but at the&e (oi%t& -e -ill i)%ore the
e,uatio% above a%d a((ly the bou%dary co%ditio%& i%&tead./ 5e ca% i%ter(ret thi& e,uatio% a& &ayi%)
that the tem(erature at a )ive% locatio% at the %e1t time &te( i& a -ei)hted avera)e o' it& tem(erature
a%d the tem(erature& o' it& %ei)hbor& at the curre%t time &te(. $% other -ord&* i% time t* a )ive%
&ectio% o' the -ire o' le%)th x tra%&'er& to each o' it& %ei)hbor& a (ortio% s o' it& heat e%er)y a%d
+ee(& the remai%i%) (ortio% 12s o' it& heat e%er)y. Thu& %umerical im(leme%tatio% o' the heat
e,uatio% i& a di&cretized ver&io% o' the micro&co(ic de&cri(tio% o' di''u&io% )ave i%itially* that heat
e%er)y &(read& due to ra%dom i%teractio%& bet-ee% %earby (article&.
The 'ollo-i%) 6!'ile* -hich -e have %amed cnstantk.m* iterate& the (rocedure de&cribed above.
Matlab Program:
function [ output_args ] = constantk( input_args )
%UNTITLED Summary of tis function go!s !r!
% D!tai"!# !$p"anation go!s !r!
% D!tai"!# !$p"anation go!s !r!
$ = "inspac!(%&'&'())*
t = "inspac!(+','-))*
. = "!ngt($)*
N = "!ngt(t)*
#$ = m!an(#iff($))*
#t = m!an(#iff(t))*
k) = )*
k( = /*
k = (k)0k()1( *
s = k2#t1#$3(*
u = 4!ros(N'.)*
u()'5) = sign(pi2$)* %init*
for n = )5N%)
u(n0)' (5.%)) = s2(u(n' /5.) 0 u(n' )5.%()) 0 () % (2s)2u(n' (5.%))*
u(n0)' )) = +* %6#ry())*
u(n0)' .) = )*% 6#ry(()*
!n#
figur!())
u7a"s = (' t' $' u()'5)' [+ )]*
surf($' t' u)
tit"!(8T!mp!ratur! in 9 an# t using cons!r7ati7! sc!m!8)
$"a6!" 8$ in m!t!rs8* y"a6!" 8tim! in s!c8* 4"a6!" 8u in :;8
figur!(()
p"ot($'u)
tit"!(8T!mp!ratur! in 9 using cons!r7ati7! sc!m!8)
$"a6!"(89 in m!t!rs8)
y"a6!"(8T!mp!ratur! in :; 8)
!n#
Matlab Plots:
Result Discussion:
Thi& loo+& much better7 A& time i%crea&e&* the tem(erature di&tributio% &eem& to a((roach a li%ear
'u%ctio% o' x. $%deed u.x* t/ i& the limiti%) 8&teady &tate8 'or thi& (roblem9 it &ati&'ie& the bou%dary
co%ditio%& a%d it yield& 0 o% both &ide& o' the (artial di''ere%tial e,uatio%.
:e%erally &(ea+i%)* it i& be&t to u%der&ta%d &ome o' the theory o' (artial di''ere%tial e,uatio%& be'ore
attem(ti%) a %umerical &olutio% li+e -e have do%e here. ;o-ever 'or thi& (articular ca&e at lea&t* the
&im(le rule o' thumb o' +ee(i%) the coe''icie%t& o' the iteratio% (o&itive yield& reali&tic re&ult&. A
theoretical e1ami%atio% o' the &tability o' thi& 'i%ite di''ere%ce &cheme 'or the o%e!dime%&io%al heat
e,uatio% &ho-& that i%deed a%y value o' s bet-ee% 0 a%d 0.< -ill -or+* a%d &u))e&t& that the be&t
value o' t to u&e 'or a )ive% x i& the o%e that ma+e& s 2 0.2<. Notice that -hile -e ca% )et more
accurate re&ult& i% thi& ca&e by reduci%) x* i' -e reduce it by a 'actor o' 10 -e mu&t reduce t by a
'actor o' 100 to com(e%&ate* ma+i%) the com(utatio% ta+e 1000 time& a& lo%) a%d u&e 1000 time& the
memory7
Conservative FDE Scheme
=o%&ider the %o%!co%&ervative o%e!dime%&io%al heat e,uatio% -ith a varyi%) thermal co%ductivity
k.x/*
u
t x
k x
u
x
k x
u
x
k x
u
x
=
= + . / . / . /
2
2
.
>or the 'ir&t derivative& o% the ri)ht!ha%d &ide* -e u&e a &ymmetric 'i%ite di''ere%ce a((ro1imatio%* &o
that our di&crete a((ro1imatio% to the (artial di''ere%tial e,uatio%& become&
u u
t
k
u u u
x
k k
x
u u
x
j
n
j
n
j
j
n
j
n
j
n
j j j
n
j
n +
+ + +
=
+
+
1
1 1
2
1 1 1 1
2
2 2
*
-here
k
j 2 k.a 4 jx/. The% the time iteratio% 'or thi& method i&
( ) ( ) ( )( )
u s u u s u s s u u
j
n
j j
n
j
n
j j
n
j j j
n
j
n +
+ + +
= + + +
1
1 1 1 1 1 1
1 2 02< .
*
5here
s
j 2
k
j t3.x/
2
. $% the 'ollo-i%) 6!'ile* heat_variablek.m* modi'y (reviou& 6!'ile
to i%cor(orate thi& iteratio%.
Notice that k i& %o- a&&umed to be a vector -ith the &ame le%)th a& x* a%d that a& a re&ult &o i& s. Thi&
i% tur% re,uire& that -e u&e vectorized multi(licatio% i% the mai% iteratio%* -hich -e have %o- &(lit
i%to three li%e&.
Matlab Program:
%% <!at !=uation u_t=u_$$ % !$p"icit finit! #iff!r!nc! sc!m!
function !at_7aria6"!>
% D!tai"!# !$p"anation go!s !r!
$ = "inspac!(%&'&'())*
t = "inspac!(+','-))*
. = "!ngt($)*
N = "!ngt(t)*
#$ = m!an(#iff($))*
#t = m!an(#iff(t))*
k = () 0 ($1&)?3() *
s = k2#t1#$3(*
u = 4!ros(N'.)*
u()'5) = sign(pi2$)* %init*
for n = )5N%)
u(n0)' (5.%)) = s((5.%))?2(u(n' /5.) 0 u(n' )5.%()) 0 ???
() % (2s((5.%)))?2u(n'(5.%)) 0 ???
+?(&2(s(/5.) % s()5.%())?2(u(n' /5.) % u(n' )5.%())*
u(n0)' )) = +* %6#ry())*
u(n0)' .) = )*% 6#ry(()*
!n#
figur!())
u7a"s = k' t' $' u()'5)' [+ )]*
surf($' t' u)
tit"!(8T!mp!ratur! 7ariation @it t an# 9 using Non ;ons!r7ati7! Sc!m!8)
$"a6!" 8$ in m!t!rs8* y"a6!" 8tim! in s!c8* 4"a6!" 8u in :;8
figur!(()
p"ot($'u)
tit"!(8T!mp!ratur! 7ariation in 9 using Non ;ons!r7ati7! Sc!m!8)
$"a6!"(89 in m!t!rs8)
y"a6!"(8T!mp!ratur! in :; 8)
!n#
Matlab Plots:
Result Discussion:
$% thi& ca&e the limiti%) tem(erature di&tributio% i& %ot li%ear9 it ha& a &tee(er tem(erature )radie%t i%
the middle* -here the thermal co%ductivity i& lo-er.