Applied Computational Fluid Dynamics 2003

Document Sample
Applied Computational Fluid Dynamics 2003 Powered By Docstoc
					                          Applied Computational Fluid Dynamics
FACE8 – Applied CFD




                                         2003



                                  Institute of Energy Technology
                                         Aalborg University




                      1
                                                   Course objectives



                      • To give an introduction to the possibilities of Computational Fluid Dynamics
                      • To provide an appreciation for the complexity of fluid mechanics and CFD methods
                      • To introduce important aspects related to the quality and trust in CFD
FACE8 – Applied CFD




                      • To give an idea about the potential of CFD in fluid mechanics




                      2
                                                   Course outline
                          ∙   1 MM
                              ▫ Introduction to applied CFD
                              ▫ Review of the finite volume method
                              ▫ Geometry creation and CAD import
                          ∙   2 MM
FACE8 – Applied CFD




                              ▫   Grid generation
                              ▫   Grid quality
                              ▫   Grid adaption – static and dynamic
                              ▫   Boundary conditions
                          ∙   3 MM
                              ▫ Solution methods
                              ▫ Solution quality
                          ∙   4 MM
                              ▫ Advanced physical models
                          ∙   5 MM
                              ▫ Post-processing
                              ▫ Validation

                      3
                                             Hands – on (room 5)


                          ∙   Available software (Win2K or Win-XP platforms)
                              ▫ FLUENT currently ver. 6.1
                                  ◦ Gambit
                              ▫ FIDAP
FACE8 – Applied CFD




                                  ◦ Gambit
                              ▫ FIELDVIEW 7
                              ▫ CFX4
                                  ◦ CFX-Build
                                  ◦ CFX-Analyse
                              ▫ CFX5
                                  ◦ CFX-Visualize
                          ∙   Simple problems
                          ∙   CFD in projects




                      4
                                           Exercise 1

                                symmetry

                          =1
FACE8 – Applied CFD




                                                    Outflow


                          =0


                                symmetry

                                                              Outflow
                                             =1




                                              =0
                                                              Outflow

                      5
                           Useful homepages
FACE8 – Applied CFD




                          Course homepage

                          www.cfd-online.com

                           www.qnet-cfd.net

                           www.fluent.com



                      6
                                                             What is CFD (the history)?




                           ∙       Colorful fluid dynamics, colors for directors, ... or?
FACE8 – Applied CFD




                                                                                                                                 LES and DNS simulation
                                                                                                                                        Explosions
                                                                                                                                      Multiphase flow
                                                             Single phase                                                       Disperse multiphase flow
                                                             Combustion                                                         Multiple frame of reference
                                                                models                              GUI                            Fluid-solid interaction
                                                                                                                                  Optimization algorithms
                                                                                                                               Process coupling techniques
                            1960’s –
                        aircraft industry                                                                 Unstructured codes
                          Flow around                                                                        CAD import
                                               2D structured, single
                      aerodynamic profiles                                  3D structured, single
                                                    block codes
                                                                                block codes
                                             1-2 eq. turbulence models
                                                                             Multi-block codes




                                                                                                                                                              Timeline


                      7
                                                      Why use CFD?


                                   Pure/classical                      Experimental
                                   fluid dynamics                     fluid dynamics
FACE8 – Applied CFD




                            Limited knowledge                                              Expensive
                      Unsolvable sets of equations

                            Few industrial type
                                                              ?                Pre-prototype testing
                                                                                         Timeconsuming
                                                                                Difficult to isolate subproblems
                          problems solvable even                                Virtual prototyping
                          through approximations                                  Prohibitive to perform
                                                                             Reduced time-to-market
                                                                                       full-scale tests
                                                                                Subproblem testing
                                                                                   Impossible to measure in
                                                                                    Agressive environments
                                                                            Full-scale testing expensive

                                                                                Sensitivity analysis
                                                     Computational
                                                                             Agressive environments
                                                     fluid dynamics              Complex physics

                                                                                         ...




                      8
                                                 CFD application areas
                                           Power generation
                                           Aerodynamics (cars, aeroplanes etc.)
                                           Air conditioning
                                           Electronics
FACE8 – Applied CFD




                                                  Safety issues
                           Purpose                Reliability
                                                  Efficiency
                                                  Forecasts
                                                                                  Velocities
                          Leading CFD codes on the market:                        Turbulence
                                                                                  Pressure
                          - CFX (CFX4, CFX5, CFX-Tascflow         Properties      Temperature
                          - Fluent (Fluent6, Fluent4, FIDAP)                      Species
                          - STAR-CD
                                                                                  Heat fluxes
                                                                                  Shear stresses
                      A minimum of time should be spent on pre-processing!
                      - CAD import, automatic grid generation                     Trajectories

                      9
                                        CFD – short and sweet




                                                                              Pre-processor
FACE8 – Applied CFD




                                                        CFD                   Solver

                                                                              Post-processor




                                         Wall boundary - ”no-slip” Udløb      Neumann condition
                      Dirichlet inlet                                          
                                                                                  0  kst 
                        condition                                              n
                             kst
                                                                              p  kst

                                                  Wall boundary - ”no-slip”
                      10
                           FLUENT program structure
FACE8 – Applied CFD




                      11
                           The CFD user must be an expert...



                                                                             Physical models
                                              Numerical methods              - Turbulence
                                              - Truncation errors            - Two-phase flow
                                              - Stability                    - Chemistry
FACE8 – Applied CFD




                                              - Class of PDE                 - Compressibility
                                              - ……………..                      - Heat transfer
                                                                             - Radiation
                                                                             - ……………
                                        Boundary conditions
                                        - Experience from similar problems
                                        - Measurements
                                        - Knowledge from “simple” cases
                                        - ……………..                                 ?
                                                                    The Engineer
                                                     - Physical insight (choice of models)
                                                     - Experience
                                                     - Review / evaluation of results
                                                     - Choice of approach (exp. or num)
                                                     - ……………..


                      12
                           FLUENT recommendations
FACE8 – Applied CFD




                      13
                                                       Quality and trust




                              Required level of detail
                               - prediction of small losses (e.g. in pumps)
FACE8 – Applied CFD




                               - Overall flow direction (recirculation zones etc.)


                              Even qualitative properties can reveal weak points in a design!



                           Limit



                      Predicted                                                                 Error bands




                      14
                                     Quality and trust cont’d



                           Model uncertainties:
                            - incomplete knowledge of underlaying physics
FACE8 – Applied CFD




                           Errors (these are the ones we can minimize):
                            - discretization error
                            - convergence error (iteration)
                            - round-off (numerical precision)
                            - user (garbage in - garbage out)
                            - coding




                      15
     FACE8 – Applied CFD




16
                           Applications
                           Applications cont’d
FACE8 – Applied CFD




                      17
                           Applications cont’d
FACE8 – Applied CFD




                      18
                           Applications cont’d
FACE8 – Applied CFD




                      19
                           Applications cont’d
FACE8 – Applied CFD




                      20
                           Applications cont’d
FACE8 – Applied CFD




                      21
                           Applications cont’d
FACE8 – Applied CFD




                      22
                           Applications cont’d
FACE8 – Applied CFD




                      23
                                                An overview
                                          the governing equations


                              Quantity/
                                                              Equation
                              property
                                                                        
                                 Mass                         0  divu  
FACE8 – Applied CFD




                                                                             t
                                                                 p             
                                                                divgradu   S Mx
                                                          Du
                             x-momentum                 
                                                          Dt     x
                                                                  p                 
                                                                 divgradu   S My
                                                          Dv
                             y-momentum                 
                                                          Dt      y
                                                                   p                 
                                                                 divgradu   S Mz
                                                          Dw
                             z-momentum                
                                                          Dt       z
                                                                   
                                                           p div u  divk grad T     Si
                                                      Di
                            Internal energy         
                                                      Dt
                             Equations of              p  p , T ,     i  i , T 
                                state                   p  RT ,         i  cvT
                           General transport                  
                                                            divu   div grad    S
                              equation                t


                                                             Diffusion coefficient
                      24
                                               Governing Equations



                           Recall the general transport equation:

                                            (  )          
FACE8 – Applied CFD




                                                     div(  u )  div(  grad )  S
                                              t

                                         rate of change   convection       diffusion   source term
                                            with time



                           Examples:


                                      Continuity:         =1       =0 S=0
                                      U-momentum:         =u        =  S = -dp/dx


                      25
                                                   Spatial discretization (1)
                                                                    diffusion



                           We are beginning with the diffusion term (not only due to a concentration gradient
                           but in general):
                                                 (  )          
                                                          div(  u )  div(  grad )  S
                                                   t
FACE8 – Applied CFD




                           As an example, consider 1-dimensional conduction of heat:

                                                              d  dT 
                                                                 k   S 0
                                                              dx  dx 


                           where:

                           k = thermal conductivity
                           T = temperature
                           S = rate of heat generation per unit volume

                      26
                                            Spatial discretization (2)
                                                             diffusion




                           Consider the 1-dimensional grid system (y and z = 1):


                                                       (x) w                 (x) e
FACE8 – Applied CFD




                                                         w                      e


                                                W                    P                 E
                                                                     x


                           We integrate the heat equation over this volume:

                                                dT   dT       e
                                               k     k     w S dx  0
                                                dx  e  dx  w


                      27
                                           Spatial discretization (3)
                                                           diffusion



                                                    dT   dT       e
                                                   k     k     w S dx  0
                                                    dx  e  dx  w
FACE8 – Applied CFD




                           We need to assume a profile to evaluate the gradient terms:




                                 W     w   P   e    E                    W     w   P     e   E

                           dT/dx NOT defined for this profile!

                      28
                                              Spatial discretization (4)
                                                              diffusion



                           If we use the linear profile assumption:

                                  dT   dT       e
                                 k     k     w S dx  0
                                  dx  e  dx  w
FACE8 – Applied CFD




                                                                                     W       w   P   e   E




                           We arrive at the following discretized equation (with uniform cells):

                                            k e (TE  TP ) k w (TP  TW )
                                                                          S V  0
                                                 (x ) e        (x ) w


                                                     (x) w                (x) e
                                                        w                    e


                                              W                   P                      E
                      29                                          x
                                               Spatial discretization (5)
                                                            diffusion



                              The discretized equation is written as:


                                               aPTP  aETE  aW TW  b   anbTnb  b
FACE8 – Applied CFD




                            where:
                                        ke                 kw
                               aE =               aW =              aP = aE + aW      b = S Dx
                                      (dx )e             (dx )w

                           In 2 dimensions, this is often illustrated as an amoeba:




                      30
                                               Spatial discretization (6)
                                                      diffusion and convection




                           We extend the discretization equation to include convection also:

                                            (  )          
FACE8 – Applied CFD




                                                     div(  u )  div(  grad )  S
                                              t


                           We look at the 1-dimensional case for simplicity:

                                                         d            d  d 
                                                            ( u )        
                                                         dx           dx  dx 




                      31
                                               Spatial discretization (7)
                                                     diffusion and convection




                           Consider again the 1-dimensional grid system (y and z = 1):
FACE8 – Applied CFD




                                                       (x) w               (x) e
                                                          w                   e


                                                W                   P                   E
                                                                    x
                           We integrate the diffusion-convection equation over this volume:

                                                                      dT   dT 
                                           (  u ) e  (  u ) w          
                                                                      dx  e  dx  w


                      32
                                                Spatial discretization (8)
                                                        diffusion and convection



                           If we use the same linear profile assumption for:


                                         (  u ) e  (  u ) w
FACE8 – Applied CFD




                                                                                      W    w   P   e   E


                           We find that (assuming P to be midways between W and E):

                                            e  ½( E   P ) and  w  ½( P  W )

                                                       (x) w             (x) e
                                                         w                     e

                                               W                   P                 E
                                                                   x
                           This approximation is termed central differencing
                           - it is termed second-order accurate since error O(x2) in terms of the Taylor series
                      33
                                                Spatial discretization (9)
                                                       diffusion and convection




                           Now inserting these discretized diffusion and convection terms yields:

                                 1                          1                         (   P ) w ( P  W )
                                   (  u ) e ( E   P )  (  u ) w ( P  W )  e E        
FACE8 – Applied CFD




                                 2                          2                           (x ) e       (x ) w

                            If we introduce:
                                                                           
                                                    F  u           D
                                                                           x
                            we can again write:

                                          aPP  aEE  aWW  b   anbnb  b

                            now with
                                                               Fe            F
                                                  a E  De       , aW  Dw  w
                                                               2              2
                      34
                                                Spatial discretization (10)
                                                          diffusion and convection



                           If we consider the case where:
                                                    De  Dw  1 and         Fe  Fw  4
FACE8 – Applied CFD




                           We can calculate the value at point P from those at points E and W:

                                           (a )  E  200 and W  100   P  50!
                                           (b)  E  100 and W  200   P  250!


                           This is clearly unrealistic!


                           Conclusion: Central differencing does not always work for the convection term
                           (specifically it can be shown that -2<F/D<2 is required => low velocity + fine grids)

                           We need another approximation!
                      35
                                               Spatial discretization (11)
                                                        diffusion and convection



                           The upwind scheme identifies flow direction:
FACE8 – Applied CFD




                                                                                     W   w   P   e   E


                           Flow from right to left (Fe< 0 and Fw< 0)

                                                    e   E       and      w  P

                           Similarly, if flow from left to right (Fe< 0 and Fw< 0)

                                                    e   P       and  w  W

                      36
                                          Spatial discretization (12)
                                                  diffusion and convection




                           For the flux across the east face, e, this scheme leads to:

                                                  Fee  P Fe ,0  E  Fe ,0
FACE8 – Applied CFD




                           Again we can write:

                                          aPP  aEE  aWW  b   anbnb  b

                           Now, for the upwind scheme the coefficient are:

                                          aE  De   Fe ,0 , aW  Dw   Fw ,0


                           The Upwind scheme is only first-order accurate hence the error O(x)

                      37
                                            Spatial discretization (13)
                                                   diffusion and convection



                      There is a large number of differencing schemes out there:

                       •the Hybrid scheme combines the Central difference and the Upwind schemes
                       •the Power law scheme approximates the exponential behavior (not exact in 2 or 3D)
FACE8 – Applied CFD




                           More advanced schemes extend the amoeba to include more neighbour cells:

                                                                                       parabola




                                                                 W    w   P   e    E


                            •second-order Upwind
                            •QUICK
                            •and many others
                      38
                                               Spatial discretization (14)
                                                            false diffusion




                            Often it is stated that the Central difference scheme is superior to the Upwind
                            scheme because it is second-order accurate whereas the Upwind scheme is
                            only first-order accurate.
FACE8 – Applied CFD




                           If we compare the Central difference and Upwind schemes:

                                                                        ux
                                                       Upwind   
                                                                        2
                            This added diffusion is considered bad, however it actually corrects the
                            solution at large Peclet number (large cells)!


                      39
                                            Spatial discretization (15)
                                                false diffusion, the proper view



                           False diffusion is a multidimensional phenomenon
FACE8 – Applied CFD




                           Consider the following case where  = 0:

                                                                         
                                                                     
                                         =0
                                                                              No false diffusion

                                         =1
                                                                              False diffusion


                           False diffusion occurs when the flow is NOT perpendicular to the grid lines!



                           We will investigate this further in the exercise

                      40
                                             Spatial discretization (16)
                                                          Quality and trust




                           The convection terms are of primary concern

                           The accuracy stated may be reduced on non-uniform grids (e.g. QUICK scheme)
FACE8 – Applied CFD




                           Halving the cell size reduces the error with a factor of:
                           - 8 for third-order schemes
                           - 2 for first-order schemes

                           Higher-order schemes more unstable (perhaps due to physially unsteady flow)


                           Guidelines:
                            - use a least second-order accurate schemes
                            - first-order schemes may be used to start the calculation
                            - use grid refinement test to estimate discretization error
                            - look at distribution of residuals


                      41
                                          Temporal discretization (1)


                           We have now discretized the spatial terms:

                                          (  )             
                                                      div(  u )  div(  grad )  S
FACE8 – Applied CFD




                                            t

                                           time        convection      diffusion 
                                        dependence




                           For simplicity we consider time-dependent heat conduction:


                                                          T     T 
                                                       c       k   
                                                          t x  x 


                      42
                                            Temporal discretization (2)

                           We integrate in time (from t to t+t) and space:

                                                    e t  t                t  t e
                                                               T                        T 
                                                  c            dt dx                k    dx dt
                                                               t                      t  x 
FACE8 – Applied CFD




                                                    w    t                    t   w


                                                               (x) w                  (x) e
                                                                 w                       e

                                                   W                     P                       E
                                                                         x


                           If we assume the value of T prevails over the entire volume:
                                                    e t  t
                                                               T
                                                  c            dt dx   cx (TP  TP0 )
                                                                                  1

                                                    w   t
                                                               t

                      43
                                             Temporal discretization (3)


                           For the diffusion term:
                                                               t  t
                                                                         k e (TE  TP ) k w (TP  TW ) 
                                      cx (TP  TP0 )                                
                                             1
                                                                         (x )               (x ) w    dt
                                                                                  e                    
FACE8 – Applied CFD




                                                                 t



                           We need an assumption for the variation of T in time (between t and t+t):

                                                     t  t

                                                      
                                                                         1
                                                                          
                                                              TP dt  f TP  (1  f ) TP0 t  
                                                       t


                           where 0 < f < 1




                      44
                                        Temporal discretization (4)


                           f =0:      Explicit scheme (first-order accurate)
                           f = 0.5:   Crank-Nicolcon (second-order accurate)
                           f = 1:     Implicit (first-order accurate)
FACE8 – Applied CFD




                                                       Explicit

                            T P0

                                                                          Crank-Nicolson



                            T P1

                                                      Implicit


                                                t                 t+dt
                      45
                                          Temporal discretization (5)
                                                           comments




                           For stability, the Explicit scheme requires (on uniform grid):


                                                                        ( x ) 2
                                                                t 
FACE8 – Applied CFD




                                                                          2

                           To give realistic results, the Crank-Nicolson scheme requires:

                                                                        ( x ) 2
                                                                t 
                                                                           

                           The Imlicit scheme is always stable (but still only first-order)!



                           Temporal and spatial discretization are strongly coupled



                      46
                                       Temporal discretization (6)
                                                        comments




                           Schemes that are higher-order accurate in time exist, e.g.:
FACE8 – Applied CFD




                                                   T   1
                                                          (3 T n 1  4 T n  T n 1 )
                                                   t 2 t




                      47
                                              Temporal discretization (7)
                                                           quality and trust




                           Physically time-dependent flows often fail to converge using steady-state methods

                           The order of the scheme and the time-step size determine the:
FACE8 – Applied CFD




                            - phase error
                            - amplitude error




                           Guidelines:


                             - second-order accuracy is recommended
                             - check the influence from temporal discretization on frequency etc.
                             - check the influence from time-step size
                             - ensure the time-step is sufficient to capture feature of interest
                             - begin with small time-steps (e.g. CFL = t v/x < 1)



                      48
                                                     CAD import




                           ∙   Be aware of
FACE8 – Applied CFD




                               ▫   Blueprints are up-to-date
                               ▫   last minute design modifications
                               ▫   imported CAD geometry is sufficiently accurate
                               ▫   tolerances e.g. in turbomachinery
                               ▫   changes in geomtry due to mechanical loading
                               ▫   changes in geometry due to wear or fouling
                               ▫   UNITS




                      49
                                                   CAD import




                           ∙   Short Gambit demo
FACE8 – Applied CFD




                      50