ME469A Numrical Mthods for Fluid Mchanics Handout #5 Gianluca Iaccarino Finit Volum Mthods Last tim w introducd th FV mthod as a discrtization tchniqu applid to th intgral form of th govrning quations d ρφdv + dt Ω i f ρφ v nˆ f ds = S f f Γ φ nˆ f ds + Q φ dv S f Ω i Nd to us two lvls of approximation: 1. th intgral is approximatd in trms of valus dfind at on or mor points on th cll facs 2. th fac valus ar approximatd in trms of th cll cntr valus 1
Finit Volum Mthods Various intgration and intrpolation schms can b usd; to achiv accurat rsults thy hav to b synchronizd Intgration: midpoint rul is typically usd Intrpolation: linar or quadratic typically usd W startd from th stady form of th consrvation q. + f ρφ v nˆ f ds = S f f Γ φ nˆ f ds + S f Finit Volum Mthods Consrvation quation Sf ρφ v nˆ f ds = Γ φ nˆ f ds + S f W w P E Convctiv trm S f ρφ v ñds = F F w = ρvφ A ρvφ w A Diffusiv trm S f µ φ x ds = D D w = µ Discrt consrvation ( ) φ A + µ x F + D + F w + D w =0 ( ) φ A x w 2
Linar Intrpolation Assum uniform grid φ w = φ i + φ i 1 2 φ = φ i+1 + φ i 2 ( ) φ x ( ) φ x w = φ i φ i 1 x = φ i+1 φ i x W w P E Discrt consrvation bcoms F + D + F w + D w =0 ρv φ i+1 + φ i 2 A µ φ i+1 φ i x A ρv φ i + φ i 1 2 A + µ φ i φ i 1 A =0 x Collcting ( ρv 2 µ ) φ i 1 +2 µ ( ρv x x φ i + 2 x) µ φ i+1 =0 Linar Intrpolation Discrt Algbraic Systm A W φ i 1 + A P φ i + A E φ i+1 =0 W w P E A W A P A E φ i = 0 0 0 Tridiagonal systm: how to solv it? What to do at th boundaris? 3
Boundary Volums Each CV is associatd to on quation (on unknown) For clls on th boundaris th fluxs hav to b xprssd involving only th data (boundary valus) and intrnal valus (on sidd xtrapolation) W w P Not: th convctiv flux can b xprssd dirctly with φ = φ BC whil th diffusiv flux rquirs an hypothsis for th gradint of th solution A W A P A E A W Ã P φ i = 0 0 0 Ã E φ BC Exact Solution This (atypical) problm has an xact solution is Dirichlt conditions ar applid to x=0 (φ 0 ) and x=l (φ L ) Th Pclt numbr is 4
Computational grid: 11 qual volums P = 50 Linar intrpolation () Upwind intrpolation (UDS) Computational grid: 41 qual volums P = 50 Linar intrpolation () Upwind intrpolation (UDS) 5
Computational grid: 11 non-uniform volums (clustrd at x=1) P = 50 Linar intrpolation () Upwind intrpolation (UDS) Obsrvations Upwind diffrncing introducs considrabl amount of artificial diffusion vn on coars of non-uniform mshs Cntral diffrncing introducs oscillation in th solution (th solution is not boundd by th boundary valus) upwind diffrncing dos NOT Th oscillations in th disappar on fin grids on on non-uniform grids 6
Error distribution in th domain (P=50) Uniform grid (N=11) Non uniform grid (N=11) Convrgnc of th truncation rror ɛ = 1 N φ xact i φ i i UDS Uniform grid (Δx=1/N) Non uniform grid 7
In spit of th oscillatory natur of th rror, th schm yilds scond ordr rsults, whil th UDS only first ordr as xpctd (vrification) Why is th solution oscillatory? What changs with grid rfinmnt? Bounds on th solutions Th consrvation principl govrning this problm implis that th solution is boundd φ 0 <φ<φ L This is important bcaus oscillations might caus unphysical bhavior: if φ rprsnts th concntration of a pollutant (or th tmpratur) Bounddnss is vry difficult to guarant, som rsults ar availabl for first ordr discrtization schms. High ordr schms tnd to gnrat wiggls in th rgion whr th solution gradints ar high 8
Bounds on th solutions A condition for bounddnss can b drivd from th systm of quations A W φ i 1 + A P φ i + A E φ i+1 =0 If A E and A W hav th sam sign (and givn A P =-A E -A W ) th solution is boundd Givn th assumption in th prvious xampl: A W = A E = ( ρv 2 µ ) 0 x ( ρv 2 x) µ 0 if ρv x µ = P x 2 Th solution is only boundd if th cll Pclt < 2 Exrcis: Vrify that th UDS schm is ALWAYS boundd! Bounds on th solutions This limitr is th basis for th hybrid schm, which uss /UDS discrtization according to cll Pclt numbr Hybrid 9
Convrgnc of th truncation rror UDS Hybrid Uniform grid (Δx=1/N) Convrgnc of th truncation rror UDS Uniform grid (Δx=1/N) Non uniform grid 10
Convrgnc of th truncation rror UDS Uniform grid (Δx=1/N) Non uniform grid Non-uniform grids gnratd with UDS DX=(XMAX-XMIN)*(1.-EX)/ (1.-EX**(N-1)) X(1)=XMIN DO I=2,N X(I)=X(I-1)+DX DX=DX*EX END DO Non uniform grid squnc Δx N 1/N 1 0.08398057 0.1111111 2 0.02527204 0.0588235 3 0.00399518 0.0303030 4 0.00010743 0.0153846 5 1.51316E-7 0.0077519 6 2.1460E-13 0.0038910 11
Finit Diffrnc Mthod Diffrntial quation i-1 i i+1 ρv φ x = φ Γ 2 x 2 W P E Us cntral diffrncing ρv φ i+1 φ i 1 2 x = Γ φ i 1 2φ i + φ i+1 x 2 Collcting A W φ i 1 + A P φ i + A E φ i+1 =0 W obtain xactly th FV systm, Rmarks: xtnsions to multi-dimnsions and variabl cofficint ar not quivalnt Exponntial Intrpolation Schm Th xact solution can b usd to dvlop an intrpolation schm φ(x) intrpolatd valu φ P P φ E E φ φ P = xp [P x /(x E x P )] 1 φ E φ P xp(p)-1 12
Exponntial Intrpolation Schm Th ast fluxs ar W P E φ = φ i (1 λ )+φ i+1 λ ( ) φ x = φ i+1 φ i λ P x w with λ = xp(p /2) 1 xp(p) 1 Exp Similarly for th wst fluxs Should b VERY accurat Exponntial Intrpolation Schm Why this is not a usful schm? Physics-basd but rlatd to a vry atypical situation (balanc of convction and diffusion in stramwis dirction) Exact solution ONLY valid in 1D, stady with no sourc trms! Rconstruction dpnds on th local Pclt numbr: 1. Convction flux dpnds on th diffusion cofficint 2. Diffusion flux dpnds on th convction vlocity Expnsiv to comput EXP functions 13
So far Confirmd convrgnc rat for UDS and schms UDS introducs fals / artificial dissipation but it is boundd is mor accurat but not boundd A bounddnss condition can b drivd basd on th local Pclt numbr. As a consqunc a hybrid schm can b drivd Exact schms for 1D stady convction/diffusion quation can b drivd Non-asymptotic convrgnc MUST b xplaind Extnsion to Multi-Dimnsions d dt Ω ρφdv + S ρφ v ˆndS = S Γ φ ˆndS + Ω Q φ dv Assum th vlocity fild y inflow (1,1) wall outflow (0,0) symmtry x 14
Extnsion to Multi-Dimnsions d dt Ω ρφdv + S ρφ v ˆndS = S Γ φ ˆndS + Ω Q φ dv y φ=0 (1,1) Spcify th boundary conditions for th scalar φ as a mix of Dirichlt and Numann wall φ x =0 φ (0,0) φ y =0 x Extnsion to Multi-Dimnsions Nd to considr now 8 flux contributions pr cll (4 convctiv + 4 diffusiv) 4 ρφ v nˆ f ds = S f f=1 4 Γ φ nˆ f ds S f f=1 W n N P E Diffusiv fluxs ar asy S Linar intrpolation involving th fac-nighbors lads to scond ordr accuracy 15
Extnsion to Multi-Dimnsions Convctiv fluxs ar mor difficult N Nd th convction vlocity n ( v nˆ f ) = u W P E ( v nˆ f ) n = v x in this cas is not th S stramwis dirction, so how do w dfin upwinding? It is not a combination of 1D problms! Multi-D Convction Schms QUICKEST - Quadratic Upstram Intrpolation for Convctiv Kinmatics with Estimatd Straming Trms AQUATIC - Adjustd Quadratic Upstram Algorithm for Transint Incomprssibl Convction ULTRA-SHARP : Univrsal Limitr for Thight Rsolution and Accuracy in combination with th Simpl High-Accuracy Rsolution Program (also ULTRA-QUICK) UTOPIA - Uniformly Third Ordr Polynomial Intrpolation Algorithm NIRVANA - Non-oscilatory Intgrally Rconstructd Volum-Avaragd Numrical Advction schm ENIGMATIC - Extndd Numrical Intgration for Gnuinly Multidimnsional Advctiv Transport Insuring Consrvation6 MACHO : Multidimnsional Advctiv - Consrvativ Hybrid Oprator COSMIC : Consrvativ Oprator Splitting for Multidimnsions with Intrnal Constancy EXQUISITE - Exponntial or Quadratic Upstram Intrpolation for Solution of th Incomprssibl Transport Equation LODA - Local Oscillation-Damping Algorithm MSOU - Monotonic Scond Ordr Upwind Diffrncing Schm http://www.cfd-onlin.com/wiki/approximation_schms_for_convctiv_trm 16
Extnsion to Multi-Dimnsions Using linar rconstruction w obtain a 5-point schm A S φ i,j 1 + A W φ i 1,j + A P φ i,j + A E φ i+1,j + A N φ i,j+1 =0 NI x NJ NJ Error Analysis As in th 1D cas, w would lik to vrify th accuracy of th discrtization schms Do not hav an EXACT solution! Solv on a squnc of uniform mshs (using psc.f) and us th finst grid as a rfrnc 17
Isolins of φ Upwind - Γ=0.01 20x20 40x40 80x80 160x160 320x320 640x640 Isolins of φ Cntral - Γ=0.1 20x20 40x40 80x80 160x160 320x320 640x640 18
Monitor Grid Convrgnc Flux of φ at x=0 Γ=0.1 Γ=0.01 UDS UDS Computing Errors Flux of φ at x=0 - Using Fin Grid Solution as Rfrnc Γ=0.1 Γ=0.01 UDS UDS 19
Computing Errors Isolins of Error in φ - - Γ = 0.1 20x20 40x40 80x80 160x160 320x320 640x640 Computing Errors Isolins of Error in φ - UDS - Γ = 0.01 20x20 40x40 80x80 160x160 320x320 640x640 20
Computational Cost 21