Computatonal Flud Dynamcs II Eercse 2 1. Gven s the PDE: u tt a 2 ou Formulate the CFL-condton for two possble eplct schemes. 2. The Euler equatons for 1-dmensonal, unsteady flows s dscretsed n the followng form: U n+1 U n + Fn +1 Fn, U = ρ ρu ρe For whch veloctes does ths scheme fulfll the CFL-condton? 3. Formulate for the lnear model equaton the followng soluton schemes: (a) eplct scheme, central dfferences (b) La-Wendroff scheme (c) Mac-Cormack scheme u t +au, F n = F(U n ) Determne the stablty condtons and truncaton errors. Show that the Mac-Cormack scheme and the La-Wendroff scheme are equvalent for ths lnear model equaton. 4. Check the consstency, stablty and convergence of an mplct method wth backward dfference n tme and central dfferences n space for the followng PDE: u t +au Specfy the soluton algorthm for that scheme, wth use of the boundary condtons u(=0)=u and u =L=0. 4
Computatonal Flud Dynamcs II Eercse 2 (soluton) 1. CFL condton: the numercal doman of nfluence has to enclose the physcal one. The characterstc lnes defne the physcal doman of nfluence, the dfference stencl defnes the numercal doman of nfluence. eplct scheme 1: 2u n +un 1 2 a 2 u n +1 2un +un 1 0 2 physcal doman of nfluence: dt d C = ± 1 a 0 t,n 1/a 0 1/a 0, eplct scheme 2: numercal nfluence area physcal nfluence area numercal doman of nfluence: dt d = ± N CFL-condton: 1 a 0 2u n +un 1 2 a 2 u+1 n 1 2un 1 +u 1 n 1 0 2 physcal doman of nfluence: dt d C = ± 1 a 0 t,n, 1/a 0 1/a 0 numercal nfluence area physcal nfluence area numercal doman of nfluence: CFL-condton: dt d N = ±2 1 2 a 0 5
2. 1D-Euler equatons: ρ t +(ρu) (ρu) t +(ρu 2 +p) (ρe) t +(u(ρe +p)) wth the equaton of state for deal gases: p = (κ 1)(ρE ρ 2 u2 ) and a 2 = κrt Dfferentate and convert n non-conservatve form: ρ t +uρ +ρu uρ t +ρu t +u(ρu) +ρuu +p (ρe) t +(uρe) +(up) Insert the contnuty equaton nto the momentum equaton and the contnuty, momentum, and equaton of state nto the energy equaton. After smplfcaton the followng form can be obtaned: ρ t +uρ +ρu u t +uu + 1 ρ p p t +up +ρa 2 u Characterstc lnes: Ω t +uω ρω 0 1 0 Ω t +uω ρ Ω 0 ρa 2 Ω Ω t +uω (Ω t +uω ) 3 Ω 2 a 2 (Ω t +uω ) Ω t = d 1 dt = u Ω t = d 1 2,3 dt = u±a 2,3 CFL-condton: all characterstc lnes have to le n the numercal doman of nfluence: Ω Ω condton (sde ): u+a 0 n+1 condton (sde +1): t n u a t u+a u +1 u a.e.: a u a 6
3. Lnear model equaton u t +au (a) Eplct, central dfferences wth u n +a un +1 un 1 2 u n = u+u t + 2 2 u tt + 3 6 u ttt +... = u u n +1 = u+ u + 2 2 u + 3 6 u +... u n 1 = u u + 2 2 u 3 6 u +... follows Truncaton error u t + 2 2 u tt + 3 6 u ttt +a 2 u +2 3 6 u 2 u t + 2 u tt + 2 6 u ttt +a(u + 2 6 u ) von Neumann analyss: u t +au = 2 u tt 2 6 u ttt a 2 6 u = O(, 2 ) Approach for the error functonǫ: ǫ n = φ=π φ=0 n (Φ)e ΦI, Φ = 2π λ, t = n, I = 1 apply the approach n the model equaton wth e ΦI n e ΦI +a n e (+1)ΦI n e ( 1)ΦI 2 1 n +a eφi e ΦI 2 e ΦI = cos(φ)+isn(φ) e ΦI = cos(φ) Isn(Φ) 7
follows G = 1 n +a 2Isn(Φ) 2 n = 1 a Isn(Φ) G 2 = 1+ n 1+a Isn(Φ) ( a sn(φ) ) 2 for a stable dfference scheme t s requred that G 2 1 scheme s unstable! (b) La-Wendroff scheme u n +a un +1 un 1 2 wth,u n,un +1 andun 1 (see (a)) follows u+u t + 2 2 u tt + 3 6 u ttt u + a 2 un +1 2un +un 1 2 2 a (u+ u + 2 2 u + 3 6 u ) (u u + 2 2 u 3 6 u ) 2 a 2 (u+ u + 2 2 u + 3 6 u ) (2u)+(u u + 2 2 u 3 6 u ) 2 2 u+u t + 2 2 u tt + 3 6 u ttt u +a 2 u +2 3 6 u 2 u t + 2 u tt + 2 6 u ttt +au +a 2 6 u a 2 2 u Truncaton error a 2 2 2 2 u 2 2 u t +au = 2 u tt 2 6 u ttt a 2 6 u +a 2 2 u wth u tt = a 2 u von Neumann analyss: = a 2 2 u 2 6 u ttt a 2 6 u +a 2 2 u = 2 6 u ttt a 2 6 u = O( 2, 2 ) e ΦI n e ΦI 1 n +a eφi e ΦI 2 G = +a n e (+1)ΦI n e ( 1)ΦI 2 a 2 eφi 2+e ΦI 2 2 = n = 1 aisn(φ) a 2 n e (+1)ΦI 2 n e ΦI + n e ( 1)ΦI 2 2 1 n +a 2Isn(Φ) a 2 2cos(Φ) 2 2 2 2 +a 2 2cos(Φ) 1 2 wth k = a 8
G 2 = (1+k 2 (cos(φ) 1)) 2 +( ksn(φ)) 2 = 1+2k 2 (cos(φ) 1)+k 4 (cos(φ) 1) 2 +k 2 sn 2 (Φ) = k 4 (1 cos(φ)) 2 +k 2 (sn 2 (Φ) 2+2cos(Φ))+1 = k 4 (1 cos(φ)) 2 +k 2 ( 1+2cos(Φ) cos 2 (Φ))+1 = k 4 (1 cos(φ)) 2 k 2 (1 2cos(Φ)+cos 2 (Φ))+1 = k 4 (1 cos(φ)) 2 k 2 (1 cos(φ)) 2 +1 = (k 4 k 2 )(1 cos(φ)) 2 +1 1 (for stablty) stable f G 2 1 = (k 4 k 2 )(1 cos(φ)) 2 0 } {{ } 0 k 2 (k 2 1) 0 k 2 1 a 1 (c) Mac-Cormack scheme Step 1 Step 2 ũ = u n a (un u n 1) wth follows = 1 2 (un +ũ ) 1 2 a (ũ +1 ũ ) ũ = u a ( u 2 2 u + 3 6 u ) ũ +1 = u+ u + 2 2 u + 3 6 u a ( u + 2 2 u + 3 6 u ) = 1 2 u+u a ( u 2 2 u + 3 6 u ) 1 2 a u+ u + 2 2 u + 3 6 u a ( u + 2 2 u + 3 6 u ) 1 2 a (u a ( u 2 2 u + 3 6 u )) = 1 2u a 2 ( u 2 2 u + 3 6 u ) + 1 2 a u u 2 2 u 3 6 u +a ( u + 2 2 u + 3 6 u ) + 1 2 a u+a ( u + 2 2 u 3 6 u ) 9
wth = 1 2 2u a ( u 2 2 u + 3 6 u ) + 1 2 a u 2 2 u 3 6 u +a 2 u = u+ 1 2 a u + 2 2 u 3 6 u + 1 2 a u 2 2 u 3 6 u +a 2 u = u+ 1 2 a 2 u 2 3 u +a 6 2 u = u+u t + 2 2 u tt + 3 6 u ttt u+u t + 2 2 u tt + 3 6 u ttt = u+ 1 2 a and u tt = a 2 u follows u t + 2 2 a2 u + 3 6 u ttt = 1 2 a Truncaton error 2 u 2 3 u +a 6 2 u 2 u 2 3 u +a 6 2 u u t +a 2 2 u + 2 6 u ttt = au a 2 6 u +a 2 2 u Alternatve: nsert step 1 nto step 2: 2 2 u t +au = 2 6 u ttt a 2 6 u = O( 2, 2 ) = 1 2 (un +u n a (un u n 1)) 1 2 a (un +1 a (un +1 u n ) u n +a (un u n 1)) = 2u n a (un u n 1) a (un +1 a (un +1 u n ) u n +a (un u n 1)) = 2u n a (un u n 1 +u n +1 u n )+a 2 2 2(un +1 u n u n +u n 1) 2 2u n +a (un +1 u n 1) a 2 2 2(un 1 2u n +u n +1) u n +a un +1 un 1 2 a 2 un 1 2un +un +1 2 2 Truncaton error and stablty equvalent to that of the La-Wendroff scheme. 10
4. u t +au Implct scheme wth backward deducton n tme, central dfferences n space: wth u n +a un+1 +1 un+1 1 2 u n = t + 2 2 un+1 tt +... ±1 = ± + 2 2 un+1 ± 3 6 un+1 +... Consstency: lm L(u) L (u) = lm τ(u), 0, 0 L (u) = un+1 + t ( = t 2 un+1 tt +a L(u) = t +a Stablty: lm τ(u) = lm, 0 2 2 un+1 tt, 0 + 2 6 un+1 +a 2 un+1 ) 2 un+1 tt 2 6 un+1 +2 3 6 un+1 2 +O( 3, 2 ) +O( 3, 3 ) +O( 3, 2 ) scheme s consstent u n +a un+1 +1 un+1 1 2 von Neumann analyss e IΦ n e IΦ +a e IΦ(+1) e IΦ( 1) 2 = 1 n = n +a 2IsnΦ 2 = 1 n +a (e IΦ e IΦ ) 2 n+1 +a snφi n 1 G = = 1+a snφi ( 1 G 2 = 1+ a ) 2 sn 2 Φ G 2 1 = ( 1+ a ) 2 1 stable sn 2 Φ } {{ } 0 11
La s theorem: consstency + stablty convergence The trdagonal equaton system, wth the unknownu a u 1 +b u +c u +1 = R = 2,...,m 1 has the followng form a 2 b 2 c 2 a 3 b 3 c 3......... u 1 u 2. = R 2 R 3. a m 1 b m 1 c m 1 u m R m 1 (m 2) equatons wth m unknown varables two boundary condtons have to be gven. Ths trdagonal system of equatons can be solved wth the followng recursve soluton approach (Thomas algorthm): wth E = u = E u +1 +F c a E 1 +b and F = R a F 1 a E 1 +b The ntal values fore 1 andf 1 follow from e.g. a Neumann boundary condton foruat = 1 u 1 = r 1 u 2 +s 1 = E 1 u 2 +F 1 E 1 = r 1 F 1 = s 1 After all coeffcentse,f are computed, the soluton foru s obtaned by back substtuton: u = E u +1 +F 12