me 678 assignment-11010003
TRANSCRIPT
-
8/13/2019 ME 678 Assignment-11010003
1/24
-
8/13/2019 ME 678 Assignment-11010003
2/24
-
8/13/2019 ME 678 Assignment-11010003
3/24
()*+,-. &/0/-.-1/
78( A%''%O2.B ?-,- -.? 2.2,2-' 3%.?2,2%.: %A - :8%3J ,4&( -$( B2H(.;
P 0::4)( -2$ DF Q /RS TUVBKVW X Q !"NE (H($1O8($( 2. ,8( :8%3J ,4&("
P Y$2H($ :(3,2%. '(.B,8 Q 5 )W Y$2H(. :(3,2%. '(.B,8 Q Z )"
P Y$2H(. :(3,2%. G$(::4$( G ! Q ![! J#-W Y2-G8$-B) G$(::4$( $-,2% Q \"
P 0::4)( 2.2,2-' ,()G($-,4$( Q 5[[ V (H($1O8($( 2. ,8( :8%3J ,4&("
-
8/13/2019 ME 678 Assignment-11010003
4/24
210,3/450, &*,6/4*1
F('-,2%.: &(,O((. $(B2%. ! -.? /;
O8($( I :Q+8%3J I-38 .4)&($
F('-,2%. &(,O((. $(B2%.: / -.? 5;G/ QG5 4 / Q45
F('-,2%. &(,O((. $(B2%. N -.? 5;
]:2.B $('-,2%.: A%$ (=G-.:2%. O-H( O( B(,^
L( 8-H( &((. B2H(. ! ! ! ! 2. A%$) %A ?2-G8$-B) G$(::4$( $-,2%W :% :%'H2.B ,8( -&%H( 2)G'232,
(94-,2%. O( 3-. A2.? ! ! ! ! -.? %,8($ G$%G($,2(:"L( 3-. 4:( ,8( :8%3J ,4&( 3-'34'-,%$; 8,,G;UU:2'H($".((G"O2:3"(?4U_:8%3JU,%%':UB?3-'3"8,)' L( J.%O ,8-, ! ! ! ! Q\ :% O( B(, ,8-,
! ! ! ! ! ! !!"
4 / Q5RZ"5)U:7/ Q5S` V
-
8/13/2019 ME 678 Assignment-11010003
5/24
#6.-)450, $-571486-9
78( a4'($ (94-,2%. %A A'42? )%,2%. 3-. &( O$2,,(. -:;
!"
!" !!"
!" ! !
O8($( ! !!
!"
!" !"# ! !
!"
! ! ! !!
! ! ! !" ! ! ^ 8($( aQCH7 b 4 / U/"
L( ()G'%1 ,8( A%''%O2.B .4)($23-' ,(38.294(: ,% :%'H( ,8( -&%H( (94-,2%.;
78( A%''%O2.B A'4= (94-,2%.: 2: 4:(? A%$ :%'H2.B ,8( (94-,2%.;
78( ,2)( :,(G 2: ?1.-)23-''1 3-'34'-,(? &1 4:2.B ,8( A%''%O2.B :,-&2'2,1 3$2,($2-;! ! !
! !! ! !"# ! ! !"# ! ! !
c4$,8($W ,% 8-H( - :-A(,1 %. ,82: ,2)( :,(G O( 4:(;
! ! ! !"# ! ! ! ! 4:4-''1 Cc< Qd ["\K["R
78( 3%?( 2: B2H(. -: A%''%O:;
!":%;%-----------------------------------------------% % Solving Shock tube problem using Lax's method% by Sanchay Saxena- 110100003 %-----------------------------------------------%
clear;clf;n=900; % No. of grid points l=12; % Length of tube t_final= 0.008 % Time before shock/expansion wave reaches end d=l/(n-1); % Cell size x=0:d:l; % Spatial vector t=0;row=1; % Iteration row gamma = 1.4;o=1;
& ?%$@":
-
8/13/2019 ME 678 Assignment-11010003
6/24
%----------------------------------------------% % Initial conditions in shock tube %----------------------------------------------% while o*d
-
8/13/2019 ME 678 Assignment-11010003
7/24
(
-
8/13/2019 ME 678 Assignment-11010003
8/24
-
8/13/2019 ME 678 Assignment-11010003
9/24
22" Yg0#iF0fI #Fa++]Fa F07gjL( G'%, G$(::4$( H: =K3%%$?2.-,( A%$ / H-'4(: %A ?2-G8$-B) G$(::4$( $-,2% 2"( \ -.? !\ ,%38(3J ,8( H-'2?2,1 %A ,82: )(,8%?
c%$ ?2-G8$-B) G$(::4$( $-,2%Q\
c%$ ?2-G8$-B) G$(::4$( $-,2%Q!\
78( (AA(3, %A ?2-G8$-B) G$(::4$( $-,2% 2: .%, :% G$%A%4.?"
-
8/13/2019 ME 678 Assignment-11010003
10/24
I-3C%$)-3J>: :38()( 2: -':% - ,O%K:,(G 2: - /K:,(G G$%3(?4$( ,8-, 4:(: ,8( A%''%O2.B A%$)4'-;
78( ,2)( :,(G 2: 3-'34'-,(? 2. ,8( :-)( O-1 -: : :38()(" 78( 3%?( 2: B2H(. &('%O;
!":%;%----------------------------------------------------% % Solving Shock tube problem using MacCormack method% Sanchay Saxena%----------------------------------------------------% clear;clf;n=900; % No. of grid points l=12; % Length of tube t_final= 0.008; % Time before shock/expansion wave reaches end d=l/(n-1); % Cell size x=0:d:l; % Spatial vector t=0; % Time instant row=1; % Iteration row gamma = 1.4;o=1;%time[row] = 0; % This array acts as our clock
%----------------------------------------------% % Initial conditions in shock tube %----------------------------------------------% while o*d
-
8/13/2019 ME 678 Assignment-11010003
11/24
rho(row+1,1:n)= U(1,1:n);u(row+1,1:n)= U(2,1:n)./rho(row+1,1:n);E(row+1,1:n)= U(3,1:n)./rho(row+1,1:n);p(row+1,1:n)= (gamma-1)*rho(row+1,1:n).*(E(row+1,1:n)-0.5*u(row+1,1:n).^2);i=1while i
-
8/13/2019 ME 678 Assignment-11010003
12/24
-
8/13/2019 ME 678 Assignment-11010003
13/24
+2)2'-$ ,% : :38()( $(:4',: &(3%)( 2.-334$-,( O2,8 ?(3$(-:( 2. .%" %A 3('':"
22" Yg0#iF0fI #Fa++]Fa F07gjL( G'%, G$(::4$( H: =K3%%$?2.-,( A%$ / H-'4(: %A ?2-G8$-B) G$(::4$( $-,2% 2"( \ -.? !\ ,%38(3J ,8( H-'2?2,1 %A ,82: )(,8%?
L8(. ?2-G8$-B) G$(::4$( $-,2% Q\
Y2-G8$-B) G$(::4$( $-,2% QS
Y2-G8$-B) G$(::4$( $-,2% 8-: - :2B.2A23-., 2)G-3, 2. 3-:( %A I-3C%$)-3J>: :38()("
-
8/13/2019 ME 678 Assignment-11010003
14/24
g, 2: -. cM+ :38()( ,8-, 2: ,8( A'4= H(3,%$ 2: :G'2, 4:2.B 4GO2.? :38()( A%$ - G%:2,2H( -.? -.(B-,2H( G-$, %A ,8( A'4=.
:438 ,8-, ! ! !
!"! ! !"# ! !
!
!"! ! "
78( A%''%O2.B A%$)4'- 2: 4:(?;
78( ,2)( :,(G 2: 3-'34'-,(? 4:2.B ,8( A%''%O2.B :,-&2'2,1 3$2,($2-;
! ! !
! !!"# ! !! ! ! ! ! ! !
c4$,8($ O( 8-H(W ! ! ! !"# ! ! ! ! W 4:4-''1 Cc< Qd ["\K["R
0':% O( -GG'1 - e($%KB$-?2(., &%4.?-$1 3%.?2,2%."
78( )-,'-& 3%?( 2: -: A%''%O:;
!":% ;%--------------------------------------------------------% % Solving Shock tube problem using Steger Warming method% Sanchay Saxena%--------------------------------------------------------% clear;clf;n=900; % No. of grid points l=12; % Length of tube t_final= 0.008; % Time before shock/expansion wave reaches end d=l/(n-1); % Cell size x=0:d:l; % Spatial vector t=0; % Time instant row=1; % Iteration row gamma = 1.4;o=1;
%----------------------------------------------% % Initial conditions in shock tube
&$%D%B E2B?A#D ?%$@":
-
8/13/2019 ME 678 Assignment-11010003
15/24
%----------------------------------------------% while o*d
-
8/13/2019 ME 678 Assignment-11010003
16/24
-
8/13/2019 ME 678 Assignment-11010003
17/24
c%$ .Q5[[W
78( :8%3J &(3%)(: ?2:,%$,(? O2,8 ?(3$(-:( 2. .%" %A 3('':
22" Yg0#iF0fI #Fa++]Fa F07gjL( G'%, G$(::4$( H: =K3%%$?2.-,( A%$ / H-'4(: %A ?2-G8$-B) G$(::4$( $-,2% 2"( \ -.? !\ ,%38(3J ,8( H-'2?2,1 %A ,82: )(,8%?"
Y2-G8$-B) G$(::4$( $-,2%Q\;
-
8/13/2019 ME 678 Assignment-11010003
18/24
Y2-G8$-B) G$(::4$( $-,2%Q !\;
78( B$-G8 &(3%)(: ?2:,%$,(? .(-$ ?2:3%.,2.42,2(:"
0G-$, A$%) ,82:W O( -':% :(( ,8-, ,82: :38()( 2: .%, ?2AA($(.,2-&'( -, :%.23 G%2.,: :% O( 3%)(4G O2,8 M-. : :38()("
-
8/13/2019 ME 678 Assignment-11010003
19/24
L( J.%O ,8-,! !
!"
!!
!!
!
! ! ! !" ! ! O8238 3-. -':% &( O$2,,(. -:;
0GG'12.B 4GO2.? ?2AA($(.32.BW O( -B-2. O$2,( ,8( .4)($23-' A'4= -:;
6%O W 2A I k ! O( 8-H(
A bD]EQcD]E W A KD]EQ[
gA I l K! ,8(.W
A bD]EQ[ W A KD]EQcD]E
0.? 2A K! l I l ! ,8(.W
78( ,2)( :,(G :,-&2'2,1 3$2,($2%. -.? ,8( e($%KB$-?2(., &%4.?-$1 3%.?2,2%. 2: :2)2'-$ ,% +,(B($L-$)2.B :38()("
78( 3%?( 2: -: A%''%O:;
F =
! aM
! a2
" (" M 2 + 1)
! a3 M (
1
2 M 2 +
1
" ! 1)
"
#
$$$$$$$
%
&
'''''''
F2# & ?%$@":
-
8/13/2019 ME 678 Assignment-11010003
20/24
!":% ;%----------------------------------------------------%
% Solving Shock tube problem using Van Leer method % Sanchay Saxena%----------------------------------------------------% clear;clf;
n=900; % No. of grid points l=12; % Length of tube t_final= 0.008; % Time before shock/expansion wave reaches end d=l/(n-1); % Cell size x=0:d:l; % Spatial vector t=0; % Time instant row=1; % Iteration row gamma = 1.4;o=1;%time[row] = 0; % This array acts as our clock
%----------------------------------------------% % Initial conditions in shock tube %----------------------------------------------% while o*d
-
8/13/2019 ME 678 Assignment-11010003
21/24
% Ghost cells are 1 and n+2. Setting boundary conditions p(row,1)= p(row,2); p(row,n)= p(row,n-1);rho(row,1)= rho(row,2); rho(row,n)= rho(row,n-1);u(row,1)= u(row,2); u(row,n)= u(row,n-1);T(row,1)= T(row,2); T(row,n)= T(row,n-1);E(row,1)= E(row,2);E(row,n)= E(row,n-1);
t=t+dt;%time[row]=t;
end
% Plotting primitive variables offset=0.1;subplot(221);plot(x,p(400,:), 'k' );xlabel( 'X-coordinate (m)' );ylabel( 'Pressure (Pa)' );ylim([min(p(400,:))-offset*max(p(400,:)) (1+offset)*max(p(400,:))]);subplot(222);plot(x,rho(400,:), 'k' );xlabel( 'X-coordinate (m)' );ylabel( 'Density (kg/m^3)' );ylim([min(rho(400,:))-offset*max(rho(400,:)) (1+offset)*max(rho(400,:))]);subplot(223);plot(x,u(400,:), 'k' );xlabel( 'X-coordinate (m)' );ylabel( 'Velocity (m/s)' );ylim([min(u(400,:))-offset*max(u(400,:)) (1+offset)*max(u(400,:))]);subplot(224);plot(x,T(400,:), 'k' );xlabel( 'X-coordinate (m)' );ylabel( 'Temperature (K)' );ylim([min(T(400,:))-offset*max(T(400,:)) (1+offset)*max(T(400,:))]);
%--------------------------------------END OF CODE-------------------------------------%
(
-
8/13/2019 ME 678 Assignment-11010003
22/24
-
8/13/2019 ME 678 Assignment-11010003
23/24
78( (AA(3, 2: :2)2'-$ ,% ,8-, %A +,(B($ L-$)2.B :38()("
22" Yg0#iF0fI #Fa++]Fa F07gjL( G'%, G$(::4$( H: =K3%%$?2.-,( A%$ / H-'4(: %A ?2-G8$-B) G$(::4$( $-,2% 2"( \ -.? !\ ,%38(3J ,8( H-'2?2,1 %A ,82: )(,8%?"
Y2-G8$-B) G$(::4$( $-,2%Q\
Y2-G8$-B) G$(::4$( $-,2%Q!\
].'2J( +,(B($ L-$)2.B :38()( ,8( ?2:,%$,2%. 2: .%, )438 O8(. ?2-G8$-B) G$(::4$( $-,2% 2:2.3$(-:(?"
-
8/13/2019 ME 678 Assignment-11010003
24/24
&G??2BH
78($(A%$(W O( :(( ,8-, (-38 %A ,8( )(,8%?: 8-: 2,: G$%: -.? 3%.:"
c%$ (=-)G'(W