Advanced Fluid Mechanics Coding Assignment - 1
1. Problem Defnition To To solve the partial dierential dierential euation !or the "lasius "lasius #uation ' ' '
f
1
( η ) + f '' ( η ) f ( ( η )= 0 2
This is the governing euation !or a laminar $o% past a semi&infnite $at plate %hich is derived !rom the continuit' euation and mass momentum euation b' introducing single composite dimensionless variable (. )n this assignment* the approach is to solve "lasius euation numericall' using +unge-,utta Method and e%ton +aphson Method.
. /overning #uation "lasiu "lasius s !ound !ound a class classica icall appro approach ach to fnd the sel!&s sel!&sim imila ilarr soluti solution on o! Prandtl0s problem arising !rom laminar $o% past a semi&infnite $at plate leads leads to a one&pa one¶ ramet meter er !amil' !amil' o! probl problem ems s involv involving ing a third third order order nonlinear ordinar' dierential euation on the semi-infnite domain .
Fig.1 Boundary layer formation on flat plate For laminar $o% past the $at plate* the boundar' la'er euations given belo% can be solved eactl' !or u and v being velocities in and ' ais direction* assuming that the !ree-stream velocit' 2 is constant 3d24d 567.
∂u ∂x
+
∂v ∂y
=0
Continuit' #uation u
∂u ∂ x
+v
∂u ∂ y
=−
1 dp ρ dx
∂ u 2
+v
∂ y
2
Mass Momentum #uation The solution %as given b' "lasius. 8ith an ingenious coordinate trans!ormation* "lasius sho%ed that the dimensionless velocit' profle u42 is a !unction onl' o! the single composite dimensionless variable (. The value o! ( is given b'* %here 9 being :inematic viscosit'.
( )
U η= y γx
1 2
u = f ' ( η ) U
The substitution o! the above t%o euations in governing euation and b' simplifcation* the euation becomes as belo% !or a $o% past $at plate. ' ' '
f
( η ) + 1 f '' ( η ) f ( η )= 0 2
This euation is a third order partial dierential euation %ith t%o initial conditions and one boundar' conditions. The initial and boundar' conditions are At y =0, f ( 0 ) =f ( 0 )=0 ,
,
At y = ϖ , f
( ϖ , )=1.0
As the above euation has onl' t%o initial conditions and one boundar' value* the euation can be converted into three linear single degree partial dierential euation and solved numericall' using +unge-,utta Method and e%ton +aphson Method. e%ton +aphson method is used !or predicting the value o! !00367. The governing euation can be %ritten as three ordinar' dierential euation ' ' '
f
( η ) + 1 f '' ( η ) f ( η )= 0 2
;et us assume*
'
g ( η )= f ( η ) h ( η )= g ( η )= f ( η ) '
' '
'
h ( η )=
so*
−1 2
× f ( η ) × h ( η )
a. Runge-Kutta Method
The +unge&,utta method is an important !amil' o! implicit and eplicit iterative methods* %hich are used in temporal discreti
and :? are constants o! that are being evaluated !or the fnding the solution o! the above three euations. k 1= f ( x n , y n )
(
2
(
2
k 1 h k 2= f x n + , y n + h 2
) )
k 2 h k 3 =f x n + , y n + h 2
k 4= f ( xn + h , y n + k 3 h ) h y n+1= y n+ × ( k 1+ 2 × k 2 + 2 × k 3 + k 4 ) 6
b. Newton Raphson Method
e%ton@s method is a method !or fnding successivel' better approimations to the roots 3or
f ( x ) '
f ( x )
For the fnding o! the initial value o! h367* the above method is utilised.
>. )nitial Conditions This is a third order partial dierential euation %ith t%o initial conditions and one boundar' conditions. The boundar' and initial conditions are
At y =0, f ( 0 ) =f ( 0 )=0 ,
,
At y = ϖ , f
( ϖ , )=1.0
?. Mathematical Formulation "lasius #uation !or a $o% past a $at plate is given b' ' ' '
f
1
( η ) + f '' ( η ) f ( η )= 0 2
'
g ( η )= f ( η )
;et us assume* h ( η )= g ( η )= f ( η ) '
' '
=ence* the above third order euation can be converted into the !ollo%ing three linear ordinar' single order dierential euations. f ( η )= g ( η ) '
g ( η )=h ( η ) '
'
h ( η )=
−1 2
× f ( η ) × h ( η )
The above three linear ordinar' dierential euation can be solved b' +,? method b' having the initial conditions as f ( 0 )=0 f ( 0 )= g ( 0 )=0 '
,
f
( ϖ )= g ( ϖ )=1.0
As there is no initial valve !or third euation* the initial value !or h is evaluated using e%ton +aphson method !or the root o! the euation g ( ϖ ) −1.0 =0
The epression !or e%ton +aphson is given b'
10
¿ 10
¿ ¿ 10
¿ g¿ ¿ (h ( 10 )i−h ( 10 )i− ) g (¿¿ i − 1 ) × ¿ h ( 10 )i+ = h ( 10 )i−¿ 1
1
h ( 0 )= h ( 10 )i+1
. Flo% Chart
B. +esults The code !or solving the "lasius #uation is %ritten in MAT;A" verison 61b. The code is eecuted and the result is given belo%. The value !or h367 is !ound to be 6.>>6 using e%ton +aphson Method.
-------------------------------------------------------------Advanced Fluid Mechanics - Code:AM5531 Coding Assignment Name: Dhiwakar V M oll No: AM15M!15 "rogram to solve #lasius e$uation using unge%utta Method&%'( -------------------------------------------------------------eta ) g h !*!!!!!! !*!!!!!! !*!!!!!! !*33+!5, !*1!!!!! !*!!1! !*!33+! !*33+!'. !*+!!!!! !*!!'1 !*!'!. !*331/.' !*3!!!!! !*!1'/'1 !*!//5// !*331.!/ !*'!!!!! !*!+5! !*13+,' !*331',! !*5!!!!! !*!'1'/3 !*15..5 !*33!/11 !*!!!!! !*!5/,35 !*1/./3, !*33!!,/ !*,!!!!! !*!.1+,, !*+31./! !*3+./++ !*.!!!!! !*1!1!. !*+',!/ !*3+,3./ !*/!!!!! !*13'+13 !*+/,35' !*3+5'33 1*!!!!!! !*155,+ !*3+/,.! !*3+3!!, 1*1!!!!! !*+!!1! !*31/3. !*3+!!,+ 1*+!!!!! !*+3,/'/ !*3/3,, !*315./ 1*3!!!!! !*+,./!3 !*'+5+3, !*31+5+/ 1*'!!!!! !*3++/.+ !*'5++ !*3!,.5 1*5!!!!! !*3,!13/ !*'.,./ !*3!+5.1 1*!!!!! !*'+!3+1 !*51,5, !*+/3 1*,!!!!! !*',3'/ !*5'1!1 !*+/!11+ 1*.!!!!! !*5+/51. !*5,',5. !*+.+/31 1*/!!!!! !*5..3/ !*!+, !*+,513 +*!!!!!! !*5!!+' !*+/, !*+,5+ +*1!!!!! !*,1'3+! !*55//. !*+5,.!/ +*+!!!!! !*,.11/3 !*.131! !*+'.351 +*3!!!!! !*.5!55! !*,!553 !*+3.'+ +*'!!!!! !*/+++/! !*,+./.+ !*++.!/+ +*5!!!!! !*//311 !*,51+! !*+1,'1+ +*!!!!! 1*!,+5! !*,,+'55 !*+!'55 +*,!!!!! 1*15!,5 !*,/+5'' !*1/5+/' +*.!!!!! 1*+3!/,, !*.1151! !*1.'!!, +*/!!!!! 1*313!3! !*.+/3'3 !*1,+/ 3*!!!!!! 1*3/.!. !*.'!'' !*113! 3*1!!!!! 1*'.++!1 !*.11/ !*15!155 3*+!!!!! 1*5/!/5 !*.,!.1 !*13/1+. 3*3!!!!! 1*5,3.1 !*../'53 !*1+.3', 3*'!!!!! 1*,'/5! !*/!1,1 !*11,., 3*5!!!!! 1*.3,// !*/13!'! !*1!,,,3 3*!!!!! 1*/+/5+5 !*/+333! !*!/.!. 3*,!!!!! +*!++333 !*/3+,3 !*!...5/ 3*.!!!!! +*11!3! !*/'111. !*!.!1+ 3*/!!!!! +*+1!5+. !*/'.,15 !*!,1/1+ '*!!!!!! +*3!5,', !*/5551. !*!'+3' '*1!!!!! +*'!1!, !*/15.! !*!5,1!3 '*+!!!!! +*'/.!'! !*//5, !*!5!5+! '*3!!!!! +*5/'/,. !*/,1,!3 !*!'''.!
'*'!!!!! '*5!!!!! '*!!!!! '*,!!!!! '*.!!!!! '*/!!!!! 5*!!!!!! 5*1!!!!! 5*+!!!!! 5*3!!!!! 5*'!!!!! 5*5!!!!! 5*!!!!! 5*,!!!!! 5*.!!!!! 5*/!!!!! *!!!!!! *1!!!!! *+!!!!! *3!!!!! *'!!!!! *5!!!!! *!!!!! *,!!!!! *.!!!!! */!!!!! ,*!!!!!! ,*1!!!!! ,*+!!!!! ,*3!!!!! ,*'!!!!! ,*5!!!!! ,*!!!!! ,*,!!!!! ,*.!!!!! ,*/!!!!! .*!!!!!! .*1!!!!! .*+!!!!! .*3!!!!! .*'!!!!! .*5!!!!! .*!!!!! .*,!!!!! .*.!!!!! .*/!!!!! /*!!!!!! /*1!!!!! /*+!!!!! /*3!!!!! /*'!!!!!
+*/+31 +*,/!13' +*...+'. +*/.5, 3*!.53+1 3*1.'+!' 3*+.3+,' 3*3.+5!3 3*'.1.. 3*5.13' 3*.!/1/ 3*,.!5,+ 3*..!+/1 3*/.!!' '*!,/..+ '*1,/,3, '*+,/+1 '*3,/53! '*',/'5, '*5,/'!1 '*,/35, '*,,/3++ '*.,/+/ '*/,/+, 5*!,/+! 5*1,/+'. 5*+,/+3/ 5*3,/+3+ 5*',/++, 5*5,/++3 5*,/++! 5*,,/+1. 5*.,/+1, 5*/,/+15 *!,/+15 *1,/+1' *+,/+1' *3,/+13 *',/+13 *5,/+13 *,/+13 *,,/+13 *.,/+13 */,/+13 ,*!,/+13 ,*1,/+13 ,*+,/+13 ,*3,/+1+ ,*',/+1+ ,*5,/+1+ ,*,/+1+
!*/,5.,1 !*/,/51' !*/.+.3 !*/.5'+, !*/.,,./ !*/./.15 !*//15'+ !*//3!!. !*//'+'5 !*//5+. !*//155 !*//.,/ !*//,',. !*//,/,1 !*//.3,5 !*//.,!5 !*//./,3 !*///1./ !*///33 !*///5!1 !*///1+ !*///// !*///,. !*///.++ !*///.' !*///./ !*////++ !*////'1 !*////5 !*////, !*////,5 !*////.+ !*////., !*/////! !*/////3 !*/////5 !*///// !*/////, !*/////. !*////// !*////// !*////// 1*!!!!!! 1*!!!!!! 1*!!!!!! 1*!!!!!! 1*!!!!!! 1*!!!!!! 1*!!!!!! 1*!!!!!! 1*!!!!!!
!*!3./,3 !*!33/.1 !*!+/'.' !*!+5'5, !*!+1.,1 !*!1./. !*!15/!, !*!13'5 !*!113'+ !*!!/5! !*!!,/+. !*!!5,/ !*!!5'3+ !*!!''3 !*!!3'. !*!!+/. !*!!+'!+ !*!!1/35 !*!!155! !*!!1+3 !*!!!/.1 !*!!!,,' !*!!!!. !*!!!',5 !*!!!3,! !*!!!+. !*!!!++! !*!!!1/ !*!!!1+/ !*!!!!/. !*!!!!,' !*!!!!55 !*!!!!'1 !*!!!!31 !*!!!!+3 !*!!!!1, !*!!!!1+ !*!!!!!/ !*!!!!! !*!!!!!5 !*!!!!!3 !*!!!!!+ !*!!!!!+ !*!!!!!1 !*!!!!!1 !*!!!!!1 !*!!!!!! !*!!!!!! !*!!!!!! !*!!!!!! !*!!!!!!
/*5!!!!! /*!!!!! /*,!!!!! /*.!!!!! /*/!!!!! 1!*!!!!!!
,*,,/+1+ ,*.,/+1+ ,*/,/+1+ .*!,/+1+ .*1,/+1+ .*+,/+1+
1*!!!!!! 1*!!!!!! 1*!!!!!! 1*!!!!!! 1*!!!!!! 1*!!!!!!
!*!!!!!! !*!!!!!! !*!!!!!! !*!!!!!! !*!!!!!! !*!!!!!!
. Appendi 3MAT;A" Code7 The matlab code appended belo% has a subroutine +,? %hich calculates the epected value at ( 516 clear all0 clc0 dis&2-----------------------------------------------------2 (0 dis&2Advanced Fluid Mechanics - Code:AM55312(0 dis&2Coding Assignment 2(0 dis&2Name: Dhiwakar V M oll No: AM15M!152(0 dis&2"rogram to solve #lasius e$uation using unge%utta Method&%'(2(0 dis&2-----------------------------------------------------2 (0 err1!0 h1!*10 h+!*+0 ci%'&h14!(0 c)%'&h+4!(0 while &as&err(6*!!!!!1( h)h+-&c)-1(7&h+-h1(8&c)-ci(0 errc)-10 h1h+0 h+h)0
cic)0 c)%'&h)4!(0 end dis&srint)&2 eta ) g dis&srint)&291!) 91!) 91!) 91!)24!4!4!4h)((0 disla&%'&h)41((0
h2((0
ubroutine !or +ung-,utta Method3+,?7 is given belo% and has to saved in the name +,?.m in the same !older o! the main program. )unction C %'&;4"( an&1(!0 a)&1(!0 ag&1(!0 ah&1(;0 d)g0 dgh0 dh-!*57)7h0 i10 hh!*10 )or co!:hh:1! k)1ag&i(0 kg1ah&i(0 kh1-!*57a)&i(7ah&i(0
k)+&ag&i(
k)3&ag&i(
k)'&ag&i(
an&i<1(an&i(
ii<10 i)&"1( dis&srint)&291!) 91!) 91!) 91!)24an&i(4a)&i(4ag&i(4 ah&i(((0 end end C ag&i(0 i)&"1(
lot&an4a)422(0 hold on lot&an4ag42r2(0 lot&an4ah42g2(0 title&2=olution )or #lasius >$uation )or a Flat "late2 ( ?lael&2eta2( lael&2)2( end