SC07 Education Program - CFD desktop to cluster by wuyunqing

VIEWS: 4 PAGES: 48

									SC08 Engineering Track: Introducing
Modeling Skills – CFD
Jim Giuliani
Client and Technology Support Manager
jimg@osc.edu
Agenda
    The CFD Process
       •Solid Modeling
       •Mesh Generation
       •Physical Properties
       •Initial and Boundary Conditions
       •Numerical Solution
       •Data Visualization

    Computational to Fluid Dynamics
      •Partial Differential Equations
      •Governing Equations
      •Discretization
      •Numerical Solutions


                       2
 Computational Fluid Dynamics (CFD)
• In CFD the equations that govern a process of interest are
  solved numerically
• Once we have classified our problem, we can derive
  equations that describe the fluid system
• Approximations can be made that allow the governing
  equations to be reduced in
  complexity
• For complex flows or
  geometries we can
  approximate the
  governing equations in a
  form that can be solved
  numerically.
• CFD encompasses the
  entire process of solving
  the governing equations
  numerically
                           3
The CFD Process

        Solid Modeling
        Mesh Generation
        Physical Properties
        Initial and Boundary Conditions
        Numerical Solution
        Data Visualization




                      4
The CFD Process
• Based on the classification of the problem to be analyzed,
  select the appropriate solver
   – Based on flow classification, simplifications are made to the
     governing equations
   – Simplified governing equations need to be solved using different
     numerical techniques
• Describe the physical problem
   – Geometry
   – Physical properties
• Set solution and solver settings
• Start the solution and monitor progress
   – Solution parameters, residuals, Courant number, are monitored to
     determine if the solution is converging




                              5
Solid Modeling
The first step in creating a numerical model is to describe the
 geometry of the problem to be analyzed

• Most grid
generation software
have basic solid
modeling capabilities

• Parts/geometries
can be imported from
CAD/CAM software
packages




                           6
Mesh Generation
The physical domain defined by the
  solid model is discretized into small
  elemental surfaces/volumes
A solution to the governing equations
  can now be approximated




                                 7
Grid/Mesh Limitations



• Overall flowfield model is on order of hundreds of feet
• Only 1.5 inch gap between belly and ground
• To properly represent flow through any gap, should have at least 5
  cells between wall surfaces
• Turbulence modeling required first layer of cells on road and body to
  be ~0.5”
    – This leaves only ~0.5” for remaining 3 layers; results in very high
      aspect ratio cells and misrepresented ground/vehicle boundary
      layer interaction
                                             Boundary layer cells   0.5”
                                                                           1.5”
                                             Boundary layer cells   0.5”




                               8
Physical Properties
Temperature
Pressure
Density
Viscosity is a measure of the
 resistance of a fluid which is being
 deformed.
   – Dynamic
   – Kinematic (dynamic viscosity/density)




                         9
Initial and Boundary Conditions
For the solution to be well posed
   – A solution must exist
   – The solution must be unique
   – The solution must depend on initial or boundary
     conditions
There are 3 types of Boundary Conditions
   – Dirchelt                   u  f (x)

   – Neumann                    u
                                    g (x)
                                n
   – Robins or mixed                            u
                                a( x)u b( x)       h( x )
                                                n


                           10
Initial and Boundary Conditions
 Initial Conditions
 Specify properties at the beginning of the analysis
    – Properties may change during simulation
    – Choice of initial conditions can shorten solution time
 Boundary Conditions
 Describe how the simulation will behave at the edges
  of the computational domain
    – Properties often are constant throughout simulation
 Common properties that are specified
    – Velocity, Pressure and Temperature
 Special types of boundaries
    – Symmetry, Extrapolated


                              11
 Boundary Conditions
   For the example of simulating the flow around the
    body of a car (U > 200 m.p.h.), boundary conditions
    must be specified on all surfaces and edges of the
    computational domain
                                       Symmetry on top and sides


Solution driven by fixed inlet
 velocities



                                                  Flow exits domain through
                                                    pressure outlet
                                         Zero velocity (no slip) at car surface
                      Solid, moving boundary for ground (speed equal to
                       free stream velocity)
                                 12
Numerical Solution
•Solution to the discretization equations are approximated
numerically
•Choose solver settings (relaxation factor, tolerances)
•Set solution control parameters (start time, end time, time step)

Residuals
•Errors of the
discretized equations
•Monitored as a
means to determine
when solution has
converged


                            13
Data Visualization
Grids that contain millions of
 elements can provide very high
 resolution information on flow field
Colorized contour plots, particle
 traces and time lapse animations
 allow subtle flow patterns and
 overall flow characteristics to be
 examined
User must specify at what interval
 data is written out
More steps = more data
 (gigabytes per simulation)
 (terabytes per design problem)
Solutions can be run remotely, but
 visualizations perform best locally

                           14
Exercise – 2D Heat Conduction




• Cooling_channel_descripton.doc contains a detailed description of the
  problem
• We have used Java applet to solve for a solution, but adiabatic
  boundary condition was not able to be modeled accurately
• Open Heat_transfer_CFD_portal.doc for instructions on how to solve
  this problem with the OpenFOAM CFD solver
• Compare results to solution obtained with Java Applet


                               15
Steady / Unsteady Flow
Steady flow denotes a system where the flow does
 not change with time
When the fundamental equations are discussed, we
 will see that steady flow denotes that all time
 derivatives are zero
When the stability of a numerical solution is
 discussed, we will see that selection of B.C. for
 unstable flow strongly impacts stability




                       16
Fluid Flow Streamlines
Streamlines
  – A moving fluid element is seen to trace out a fixed path
    in space
  – A streamline is this fixed path




                         17
Classification of Fluid Mechanics
Continuum Fluid Mechanics
• Inviscid
• Viscous
   – Laminar
   – Turbulent
• Compressible/Incompressible




                     18
 Classification of Flows
Compressible/Incompressible
Inviscid
Viscous
• Laminar
   – Flow where the streamlines
     are smooth and regular and a
     fluid element moves smoothly
     along a streamline
• Turbulent                          Turbulent Flow
   – Flow where the streamlines
     break up and a fluid element    Laminar Flow
     moves in a random, irregular,
     and tortuous fashion



                               19
Exercise – Flow Past a Circular Cylinder

Model low speed
 flow around a
 cylinder



• Assumptions/Simplifications
   – Incompressible: all density derivatives are zero
   – Inviscid: neglect viscous forces
• Possible Objectives
   – Practical application of the fundamental flow equations
   – Examine assumptions and simplifications that can reduce complex
     partial differential equations to simple analytic equations

                              20
 Exercise – Flow Past a Circular Cylinder
• Possible Objectives (cont)
   – Understand when higher
     fidelity tools are needed
     to examine complex flow
     phenomena
• Top image: - ideal flow
  solution
• Bottom image:
  Landsat 7 image
  of
  Juan Fernandez
  islands off of the
  coast of Chili


                                 21
 Exercise – Flow Past a Circular Cylinder

 Model low speed
  flow around a
  cylinder



• To study the ideal flow model, open Cylinder_ideal_flow.doc to see the
  assignment
• Open Cylinder_CFD_portal.doc to see the assignment for the viscous,
  CFD solution
• For the CFD assignment, follow steps through page 6 and stop after
  SUBMIT button has been pressed and job is submitted
• Simulation takes about 45 minutes and results should be available
  towards the end of the workshop
                                 22
Computational Fluid Dynamics
      Partial Differential Equations
         •Physical Classification
         •Numerical Classification
      Governing Equations
         •Continuity
         •Momentum
         •Turbulence
      Discretization
         •Finite Difference
         •Laplace’s Equation
         •Finite Volume
      Numerical Solutions


                 23
Partial Differential Equations
Partial Differential Equations (PDEs)
  – Many important physical processes are governed by
    PDEs
  – We will look at some PDEs commonly encountered in
    fluid dynamics
Physical Classification
  – Equilibrium Problems
  – Marching Problems
Numerical Classification
  – Elliptic
  – Parabolic
  – Hyperbolic

                          24
PDEs – Physical Classification
Equilibrium Problems
  – Solution desired in a closed domain
  – Boundary value problem
  – Governed by elliptic PDEs


Examples
  – Steady state temperature distribution
  – Incompressible, inviscid flow




                        25
PDEs – Physical Classification
Marching Problems
  – Transient
  – Prescribed set of initial conditions in addition to
    boundary conditions
  – Solution computed by marching from the initial
    conditions, constrained by boundary conditions
  – Governed by parabolic or hyperbolic PDEs
Examples
  – Unsteady, inviscid flow
  – Steady supersonic inviscid flow
  – Boundary layer flow



                          26
PDEs – Numerical Classification
Hyperbolic
   – Fundamental property
     is the limited domain of
     dependence
   – Solution at point P
     depends
     only on information in the
     domain of dependence
   – Any disturbance that
     occurs
     outside this interval can
     never influence the
     solution at point P
                            2 y     2 y
Example: Wave Equation            a2 2
                            t 2     x
                            27
PDEs – Numerical Classification
Parabolic
   – Unlike hyperbolic
     equations,
     solution at some time tn
     depends upon the entire
     physical domain at earlier
     times, including side
     boundary conditions
   – Start at some initial data
     plane and march forward
   – Diffusion processes
                                     u    2u
Example: 1D heat transfer equation       2
                                     t   x


                             28
PDEs – Numerical Classification
Elliptic
    – Boundary value problem
    – Subject to a prescribed set
       of boundary conditions on
       a closed domain
    – Solution at any point
       depends upon the specified
       conditions at all points on
       the boundary
Example: Laplace’s Equation

              2u  2u
                   2 0
             x 2
                   y

                           29
Conservation Laws
Mass conservation
  – Matter may neither be created
    or destroyed
Conservation of momentum
  – Newton’s 2nd law of motion
Conservation of energy
  – First law of thermodynamics




                        30
Continuity Equation
 For a given control volumn

           dm
               in m  out m
                            
           dt
 The rate increase of mass within the control
 volume is equal to the net rate at which mass
 enters the control volume




                      31
Continuity Equation
 The partial differential form of the continuity
 equation in cartesian coordinates is

              D     u v w 
                    
                     x y z   0
                               
              Dt              
      where

              D               
                     u    v    w
              Dt   t    x    y    z



                       32
Conservation of Momentum
 Newton’s 2nd law
                    F   x
                               m  ax
                                         (in 2 dimensions)
                    F   y
                              m  ay


              Body forces
                 •Gravity
                 •Centrifugal
                 •Corolis
                 •Electromagnetic
              Surface forces
                 •Normal stress
                 •Tangential stress
                         33
Conservation of Momentum
Combining forces yields


        Du  xx  yx  zx
                           Fx
        Dt   x   y    z

                Surface forces   Body forces




                          34
Navier-Stokes Equations
Replacing stress terms with stress-strain relationship
Du        1 p   2  u v w     u v     w u 
    gx               x y z   y   y  x   z   x  z 
                 2                            
Dt         x x  3                                             
  Dv         p    v u    2  v u w     v w 
                     x y  y 3  y x z   z   z  y 
      g y           2                             
  Dt         y x                                        
    Dw         p    w u     v w    2  w u v 
       g z                      z y   z  3   2 z  x  y 
                                                                    
    Dt         z x   x z  y                                    




Assumptions/simplifications can reduce complexity



                                    35
Navier-Stokes for Incompressible Flow
For an incompressible, constant viscosity flow, the viscous
 terms simplify significantly (more applicable to gasses
 than fluids)
                 u    u    u    1 P    2u  2u
                    u    v           2  2
                 t    x    y     x   x   y
                  v   v  v    1 P    2v  2v
                     u v           2  2
                  t   x  y     y   x   y

          acceleration   advection        Pressure   diffusion
                                          gradient

  How much detail was skipped?
  1st year graduate course in continuum mechanics in 5 slides

                                     36
Turbulence Models
Turbulence depends on the ratio of the inertia force to viscous force
Laminar flows can be described by the continuity and momentum
  equations
Rotational flow structure have a wide range of length and velocity scales,
 called turbulent scales
Several popular techniques for accounting for turbulence are:
• Direct Numerical Simulation (DNS)
• Large Eddie Simulation (LES)
• K-epsilon




                                37
Large Eddy Simulation (LES)
Large scale motions are generally much more energetic and
 transport most of the conserved properties
• Large eddies are modeled exactly
• Small eddies are approximated
Smaller universal scales, called sub-grid scales, are modeled
 using a sub-grid scale (SGS) model




                          38
K-epsilon Model
Time averaged governing equations yield the Reynolds-
  averaged Navier-Stokes equations (RANS)
   – Point velocities are considered to be comprised of two
     components
       • Steady mean value
       • Fluctuating component
Additional unknowns due to turbulent fluctuations can be
 handled with transport equations
Two important turbulent quantities in these transport
 equations:
   k – turbulent kinetic energy
   epsilon – dissipation of turbulent kinetic energy




                               39
Discretization
Conversion of the governing equations into a
 system of algebraic equations
Two popular discretization techniques in CFD are
  – Finite difference method
  – Finite volume method




                        40
Finite Difference Method
First order derivatives                                                  x
• Fordward difference
        u ui , j 1  ui , j
                              O(x)
        x         x
                                                                          ui,j+1
• Backward difference
                                             y
        u ui , j  ui , j 1                                   Ui-1,j          Ui+1,j
                              O(x)                                    ui,j
        x        x
                                                                         ui,j-1
• Central difference
       u ui , j 1  ui , j 1
                                O(x 2 )
       x         2x
                                                  y(j)



                                                         x(i)


                                    41
Finite Difference Approximations
Second order derivative
                                                                                 x
• Central difference
  2u ui 1, j  2ui , j  ui 1, j
                                    O (( x) 2 )
 x 2           ( x ) 2
                                                                                  ui,j+1

                                                     y                 Ui-1,j          Ui+1,j
For time derivatives
                                                                                 ui,j

                                                                                 ui,j-1
 u u n 1i , j  u n i , j
                            O(t )
 t           t                                          y(j)



                                                                 x(i)


                                          42
Finite Volume Method
Unstructured mesh offers more flexibility
Control volumes are defined by the surfaces of the elements
Control volume integrals can be converted to discretized
 equations base on face area and flow across boundaries




                          43
Numerical Solution
Discretization results in a system of linear or non-
 linear equations
Numerical methods are applied to solve these
 equations
   – Direct methods
   – Iterative methods




                         44
Convergence
With iterative methods, as progress proceeds
 towards a solution, the equations are determined
 to have converged to a solution when certain
 values do not change between iterations by a
 specified tolerance
Additional characteristics
   – Numerical solution does not change with additional
     iterations
   – Mass, momentum and energy balances are obtained




                        45
Residuals
Residuals are the errors of the discretized equations
Residuals are calculated for each equation
 (Ux, Uy, P, …)
Residuals should
 diminish as the
 numerical process
 progresses
They are often used
 to monitor the
 behavior of the
 numerical process

                       46
Exercise – Flow Past a Circular Cylinder
• Open Cylinder_CFD_portal.doc
• Continue where you left off (~page 6 after initial simulation submitted)




                                 47
Exercise – Turbulent Flow over a Backward Facing
Step




• Open Backward_step.doc for instructions on how to solve this problem
  with the OpenFOAM CFD solver
• Examine the model assumptions and setup
• Run the model in its current form
• Includes turbulence modeling




                               48

								
To top