Itroductio Itroductio What is Computatioal Fluid Dyamics CFD? Fiite Differece or Fiite Volume Grid Itroductio Itroductio Usig CFD to solve a problem: Grid must be sufficietly fie to resolve the flow Preparig the data preprocessig: Settig up the problem, determiig flow parameters ad material data ad geeratig a grid. Solvig the problem Aalyzig the results postprocessig: Visualizig the data ad estimatig accuracy. Computig forces ad other quatities of iterest. Itroductio CFD is a iterdiscipliary topic Numerical Aalysis CFD Computer Sciece Fluid Mechaics Itroductio May website cotai iformatio about fluid dyamics ad computatioal fluid dyamics specifically. Those iclude NASA site with CFD images http://www.as.asa.gov/sc8/images.html CFD Olie: A extesive collectio of iformatio but ot always very iformative http://www.cfd-olie.com/ efluids.com is a moitored site with a large umber of fluid mechaics material http://www.e-fluids.com/
Begiig of CFD CFD at Los Alamos Begiig of CFD The MANIAC at Los Alamos had already stimulated cosiderable iterest i umerical solutios at the Laboratory. However, CFD i the moder sese started with the formatio of the T3 group. Early developmet i the Group focused o: Compressible flows: Particles i Cells 19: Eularia Lagragia method where particles move through a fixed grid Low-speed icompressible flows Vorticity streamfuctio for homogeeous mostly 2D flows 1963 Marker ad Cell for free surface ad Multiphase flows i primitive variables 196 All-speed flows ICE 1968, 1971 Arbitrary Lagragia Euleria ALE methods Begiig of CFD Icompressible flows Vorticity-Streamfuctio Method Begiig of CFD Icompressible flows the MAC Method Primitive variables velocity ad pressure o a staggered grid p i-1,j+1 u i-1/2,j+1 p i,j+1 u i+1/2,j+1 p i+1,j+1 v i-1,j+1/2 v i,j+1/2 v i+1,j+1/2 The velocity is updated usig splittig where we first igore pressure ad the solve a pressure equatio with the divergece of the predicted velocity as a source term u i-1/2,j u i+1/2,j p i-1,j p i,j p i+1,j v i-1,j-1/2 v i,j-1/2 v i+1,j-1/2 u i-1/2,j-1 u i+1/2,j-1 p i-1,j-1 p i,j-1 p i+1,j-1 Computatios of the developmet of a vo Karma vortex street behid a blut body by the method developed by J. Fromm. Time goes from left to right showig the wake becomig ustable. From: J. E. Fromm ad F. H. HarIow, Numerical Solutio of the Problem of Vortex Street Developmet: Phys. Fluids 6 1963, 97. Marker particles used to track the differet fluids The dam breakig problem simulated by the MAC method, assumig a free surface. From F. H. Harlow fig1.pdf ad J. E. Welch. Numerical calculatio of timedepedet viscous icompressible flow of fluid with a free surface. Phys. Fluid, 8: 2182 2189, 196. Begiig of CFD Early Publicity: Sciece Magazie F.H. Harlow, J.P. Shao, Distortio of a splashig liquid drop, Sciece 17 August 1967 47. F.H. Harlow, J.P. Shao, J.E. Welch, Liquid waves by computer, Sciece 149 September 196 192 193. Begiig of CFD
Begiig of CFD While most of the scietific ad techological world maitaied a disdaiful distaste or at best a amused curiosity for computig, the power of the stored-program computers came rapidly ito its ow at Los Alamos durig the decade after the War. From: Computig & Computers: Weapos Simulatio Leads to the Computer Era, by Fracis H. Harlow ad N. Metropolis Aother type of oppositio occurred i our iteractios with editors of professioal jourals, ad with scietists ad egieers at various uiversities ad idustrial laboratories. Oe of the thigs we discovered i the 19s ad early 196s was that there was a lot of suspicio about umerical techiques. Computers ad the solutios you could calculate were said to be the playthigs of rich laboratories. You could t lear very much uless you did studies aalytically. From: Joural of Computatioal Physics 19 24 414 433 Review: Fluid dyamics i Group T-3 Los Alamos Natioal Laboratory LA-UR-3-382, by Fracis H. Harlow Begiig of CFD Begiig of CFD CFD goes maistream Early studies usig the MAC method: R. K.-C. Cha ad R. L. Street. A computer study of fiite-amplitude water waves. J. Comput. Phys., 6:68 94, 197. G. B. Foote. A umerical method for studyig liquid drop behavior: simple oscillatios. J. Comput. Phys., 11:7 3, 1973. G. B. Foote. The water drop reboud problem: dyamics of collisio. J. Atmos. Sci., 32:39 42, 197. R. B. Chapma ad M. S. Plesset. Noliear effects i the collapse of a early spherical cavity i a liquid. Tras. ASME, J. Basic Eg., 94:142, 1972. T. M. Mitchell ad F. H. Hammitt. Asymmetric cavitatio bubble collapse. Tras ASME, J. Fluids Eg., 9:29, 1973. Begiig of commercial CFD Imperial College Spaldig Computatios i the Aerospace Idustry Jameso ad others Ad others Begiig of CFD Although the methods developed at Los Alamos were put to use i solvig practical problems ad picked up by researchers outside the Laboratory, cosiderable developmet took place that does appear to be oly idirectly motivated by it. Those developmet iclude: Pael methods for aerodyamic computatios Hess ad Smith, 1966 Specialized techiques for free surface potetial ad stokes flows 1976 ad vortex methods The developmet of computer fluid dyamics has bee closely associated with the evolutio of large high-speed computers. At first the pricipal icetive was to produce umerical techiques for solvig problems related to atioal defese. Soo, however, it was recogized that umerous additioal scietific ad egieerig applicatios could be accomplished by meas of modified techiques that exteded cosiderably the capabilities of the early procedures. This paper describes some of this work at The Los Alamos Natioal Laboratory, where may types of problems were solved for the first time with the ewly emergig sequece of umerical capabilities. The discussios focus pricipally o those with which the author has bee directly ivolved. Commercial Codes Spectral methods for DNS of turbulet flows late 7 s, 8 s Mootoic advectio schemes for compressible flows late 7 s, 8 s Steady state solutios SIMPLE, aeroautical applicatios, etc Commercial CFD However, with outside iterest i Multifluid simulatios improved VOF, level sets, frot trackig aroud 199, the legacy became obvious Commercial Codes CHAM Cocetratio Heat Ad Mometum fouded i 1974 by Prof. Bria Spaldig was the first provider of geeralpurpose CFD software. The origial PHOENICS appeared i 1981. The first versio of the FLUENT code was lauched i October 1983 by Creare Ic. Fluet Ic. was established i 1988. STAR-CDs roots go back to the foudatio of Computatioal Dyamics i 1987 by Prof. David Gosma, The origial codes were relatively primitive, hard to use, ad ot very accurate.
Commercial Codes What to expect ad whe to use commercial package: The curret geeratio of CFD packages geerally is capable of producig accurate solutios of simple flows. The codes are, however, desiged to be able to hadle very complex geometries ad complex idustrial problems. Whe used with care by a kowledgeable user CFD codes are a eormously valuable desig tool. Commercial CFD codes are rarely useful for state-of-theart research due to accuracy limitatios, the limited access that the user has to the solutio methodology, ad the limited opportuities to chage the code if eeded Commercial Codes Major curret players iclude Asys Fluet ad other codes http://www.fluet.com/ http://www.asys.com/ adapco: starcd http://www.cd-adapco.com/ Others CHAM: CFD2: http://www.cham.co.uk/ http://www.adaptive-research.com/ http://www.d.edu/~gtryggva/cfd-course/ The vorticity/streamfuctio equatios: A Fiite Differece Code for the Navier-Stokes Equatios i Vorticity/ Streamfuctio Form u t + u u x + v u y = " p x + 1 # 2 u Re x + 2 u & " $ 2 y 2 "y x v t + u v x + v v y = " p y + 1 Re # 2 v x + 2 v & $ 2 y 2 " + u " t x + v " y = 1 # 2 " + 2 " & Re $ x 2 y 2 where = "v "x # "u " y Objectives Defiig the streamfuctio by u = " y ; v = #" x Ad substitutig ito the defiitio of the vorticity = "v "x # "u "y gives 2 " x + 2 " 2 y = #$ 2 The vorticity/streamfuctio equatios: The system to be solved is the Navier-Stokes equatios i vorticity-stream fuctio form are: Advectio/diffusio equatio " t Elliptic equatio = # $ " y x + $ " x 2 " x 2 + 2 " y 2 = #$ where u = " y ; v = #" x y + 1 2 " Re x + 2 " & 2 y 2
Fiite Differece Approximatios Fiite Differece Approximatios Notatio: the locatio of variables o a structured grid x, y j+1 j j-1 f i1, j f +1 f f i+1, j f 1 i -1 i i+1 f = f x, y f i+1, j = f x + h, y f i1, j = f x h, y f +1 = f x, y + h f 1 = f x, y h The we replace the equatios at each grid poit by a fiite differece approximatio " # t $ = & " # y x $ 2 " # x 2 $ + & x " # y + 2 " # y 2 $ $ + 1 2 " Re x + 2 "# 2 y 2 $ = & Fiite Differece Approximatios Fiite Differece Approximatios Fiite differece approximatios f x x = 2 f x x 2 = f t t = f x + h " f x " h 2h f x + h " 2 f x + f x " h f t + "t # f t "t " 3 f x x 3 12 + " 4 f x x 4 xx + # 2 f t t 2 "t 2 + Laplacia 2 f x + 2 f 2 y = 2 f i +1, j 2 f + f i1,j + f +1 2 f + f i, j 1 = f i +1, j + f i 1,j + f +1 + f i, j 1 4 f i, j " t The advectio equatio is: Fiite Differece Approximatios = # $ " y x + $ " x y + 1 2 " Re x + 2 " & 2 y 2 +1 " = #t " $ " $ +1 "1 " i+1, j i"1, j + $ " $ i+1, j i"1, j " +1 "1 & 2h & 2h & 2h & 2h + 1 Re & i+1, j + i"1, j + +1 + "1 " 4 +1 = Fiite Differece Approximatios The vorticity at the ew time is give by: + + "t # $ +1 - & 2h, - + $ i+1, j & 2h + 1 Re & i+1, j # $ #1 # $ i#1, j + i#1, j & i+1, j # i#1, j 2h +1 & 2h + +1 # #1 + #1 # 4. /
Fiite Differece Approximatios The Drive Cavity Problem The elliptic equatio is: i+1, j + i"1, j 2 " x + 2 " 2 y = #$ 2 + +1 + "1 " 4 = "# The Drive Cavity Problem We will ow use this approach to solve for the flow i a drive cavity. The drive cavity is a square domai with a movig wall at the top ad statioary side ad bottom walls. The simple geometry ad the absece of i ad outflow makes this a particularly simple ad popular test problem. Statioary wall Movig wall Statioary wall Statioary wall Sice the boudaries meet, the costat must be the same o all boudaries = Costat Boudary Coditios for the Streamfuctio Discretizig the Domai To compute a approximate solutio umerically, we start by layig dow a discrete grid: j=ny ad " i, j Grid stored at each grid poit boudaries coicide with domai boudaries j=2 j=1 i=1 i=2 i=nx Fiite Differece Approximatios These equatios allow us to obtai the solutio at iterior poits j=y = o the boudary Boudary Coditios for the Streamfuctio To update the vorticity i the iterior of the domai, we eed the vorticity at the wall. Oce the streamfuctio ad thus the velocity everywhere has bee foud, this ca be doe. At the bottom wall: j=2 j=1 i=1 i=2 i=x Need vorticity o the boudary = "v " x "u " y = "u " y Sice the ormal velocity is zero Where the velocity ca be foud from the streamfuctio u = " y
j=3 j=2 j=1 i -1 i i+1 Discrete Boudary Coditio Cosider the bottom wall j=1: Need to fid wall = =1 U wall Similar expressios ca be foud for the other walls The velocity at j=3/2 ca be foud by cetered differeces: ui, 3 = " " i,2 $ " i,1 # 2 y h The vorticity is the foud by oe-sided differeces i,1 = " #u # y $ ui, 3 " ui,1 2 h / 2 = "2 h & i,2 " i,1 h " U wall + The elliptic equatio: i +1, j Rewrite as Solvig the elliptic equatio + i "1, j +1 =.2 i +1, j + i"1,j Solve by SOR " +1 " = #.2 i +1, j " + 1$# + +1 + "1 " 4 = "# + +1 + "1 + # " + +1 " i$1, j + +1 " + +1 $1 + Solutio Strategy Solutio Strategy Limitatios o the time step "t # 1 4 u + v t " # 2 Iitial vorticity give Solve for the stream fuctio Fid vorticity o boudary Fid RHS of vorticity equatio Update vorticity i iterior t=t+dt Iitial vorticity give Solve for the stream fuctio Fid vorticity o boudary Fid RHS of vorticity equatio Update vorticity i iterior t=t+ t For l=1:maxiteratios for i=2:x-1; for j=2:y-1 si,j=sor for the stream fuctio ed; ed ed vi,j= for i=2:x-1; for j=2:y-1 rhsi,j=advectio+diffusio ed; ed vi,j=vi,j+dtrhsi,j The Code Results: 1 clf;x=9; y=9; MaxStep=6; Visc=.1; dt=.2; resolutio & goverig parameters 2 MaxIt=1; Beta=1.; MaxErr=.1; parameters for SOR iteratio 3 sf=zerosx,y; vt=zerosx,y; w=zerosx,y; h=1./x-1; t=.; 4 for istep=1:maxstep, start the time itegratio for iter=1:maxit, solve for the streamfuctio 6 w=sf; by SOR iteratio 7 for i=2:x-1; for j=2:y-1 8 sfi,j=.2betasfi+1,j+sfi-1,j... 9 +sfi,j+1+sfi,j-1+hhvti,j+1.-betasfi,j; 1 ed; ed; 11 Err=.; for i=1:x; for j=1:y, Err=Err+abswi,j-sfi,j; ed; ed; 12 if Err <= MaxErr, break, ed stop if iteratio has coverged 13 ed; 14 vt2:x-1,1=-2.sf2:x-1,2/hh; vorticity o bottom wall 1 vt2:x-1,y=-2.sf2:x-1,y-1/hh-2./h; vorticity o top wall 16 vt1,2:y-1=-2.sf2,2:y-1/hh; vorticity o right wall 17 vtx,2:y-1=-2.sfx-1,2:y-1/hh; vorticity o left wall 18 for i=2:x-1; for j=2:y-1 compute 19 wi,j=-.2sfi,j+1-sfi,j-1vti+1,j-vti-1,j... the RHS 2 -sfi+1,j-sfi-1,jvti,j+1-vti,j-1/hh... of the 21 +Viscvti+1,j+vti-1,j+vti,j+1+vti,j-1-4.vti,j/hh; vorticity 22 ed; equatio ed; 23 vt2:x-1,2:y-1=vt2:x-1,2:y-1+dtw2:x-1,2:y-1; update the vorticity 24 t=t+dt prit out t 2 subplot121, cotourrot9fliplrvt, axissquare; plot vorticity 26 subplot122, cotourrot9fliplrsf, axissquare;pause.1 streamfuctio 27 ed; 17 by 17 Dt=.1 D=.1
Results: Results: 2 Vorticity.1 Streamfuctio 17 by 17 Dt=.1 D=.1 2 1 1 - -1 2 1 1 1 1.8.6.4.2 2 2 1 1 1 1 2 u = " y # " $" +1 $1 2h v = $ " x # $" i+1, j $" i$1, j 2h Results: IN/OUT FLOW 9 by 9 grid 17 by 17 grid Vorticity Streamfuctio The drive cavity problem is particularly simple sice there is o i or out flow. I the streamfuctio-vorticity form of the Navier-Stokes equatios it is, however, relatively easy to iclude specified i ad outflow. A iflow through the right horizotal wall, for example, ca be imposed by icreasig the streamfuctio betwee each grid poit by: " = uy For icompressible flow the iflow must matched by outflow ad if we specify the outflow velocity the the streamfuctio must be decreased by the same amout elsewhere o the boudary