MAE403 / MAE5027 Computational Fluid Dynamics
计算流体⼒学
Course syllabus
Benefits of the course
Two simple coding examples
Introduction to computational fluid dynamics
Computation as a third pillar for scientific discovery
Lian-Ping Wang (王连平教授)
Department of Mechanics and Aerospace Engineering, SUSTech,
wanglp@[Link]
1
A course QQ group: 2020S MAE403/MAE5027 CFD
(Hosted by your TA CHEN Hao)
A course Sakai website
[Link]
MAE403&MAE5005 2020S
Course syllabus
First 2 sets of lecture notes
Reference textbook
One slide about myself, [Link]
1965 – 1980 Lived in hometown, Landao, Linhai, Zhejiang, China
1980 – 1986 Studied at Zhejiang University, Hangzhou, China
1986 –1990 Ph.D. student with D.E. Stock and C.T. Crowe, WSU, Pullman, Washington, USA
1990 –1992, 1st Postdoc with Martin Maxey, Brown University, USA
1992 –1994, 2nd Postdoc with Jim Brasseur & John Wyngaard, Penn State, USA
1994 – , Professor of Mechanical Engineering, University of Delaware, USA
2018 – , Chair Professor of SUSTech, China
Never left university campus!
Students (YOU)
Ability / knowledge / skills
Sophomores (1)
Juniors (17) Fluid mechanics
Seniors (5)
Masters (7)
Numerical methods
Ph.D students (6)
Fortran programming
35 students Unix OS experience
Lian-Ping Wang
Hao Chen (TA)
Xiaozheng Zhao (Department system administrator)
4
Benefits of the course (1)
What is computational fluid dynamics?
1. Physical assumptions & governing principles:
mass conservation, momentum conservation
1st law of thermodynamics, 2nd law of thermodynamic
equation of state
2. Mathematical models:
continuum mechanics, boundary /initial conditions
3. Numerical algorithms:
finite difference, finite element, spectral, lattice-Boltzmann
……
4. Realization of computation:
coding: Fortran, C, matlab, …., code optimization
implementation: computers, OS, parallelization
5. Verification and Validation
6. Use and interpretation of the computer solution
5
An example: development of a transient laminar flow in a channel
1. Physical assumptions & governing principles:
² Unidirectional laminar flow of incompressible fluid in a channel
² Initial velocity =0
²The flow is driven by a body force (or constant pressure gradient) starting at t=0
²Governing equations:
y
mass conservation – continuity equation x
2L
momentum equation – Navier-Stokes equations
Physical parameters
² Boundary conditions: zero velocity on the walls
6
An example: development of a transient laminar flow in a channel
2. Mathematical model
y
2L x
Long-time solution implies
This problem can be solved analytically by the method of separation of variables
& numerically by CFD
7
Analytical solution (the method of separation of variables)
Exact solution
u " y2 % ∞ 4(−1)k ( (k + 0.5)2 π 2ν t + ( y+
= $1− 2 ' − ∑ exp *− - cos *(k + 0.5)π -
u0 # L & k=0 [π (k + 0.5)]3 ) L2 , ) L,
Note the format of solution
u "y t %
= f$ , 2 '
u0 # L L /ν &
Clearly, the time scale in the problem is
L2 / ν
3. Numerical algorithm: finite-difference method (one of many choices)
Distribution of lattice nodes & Implementation of boundary conditions
PDE has been converted into algebraic equations
4. Realization of computation: a computer code
Transient_Laminar_Flow_FD_Codes/Channel_FD_onwall0_class.f90 10
5. Verification and validation
Will update
11
6. Use and interpretation of the computer solution
Make detailed physical observations
How long does it take for the flow the reach steady state?
What is the key physical parameter for this problem?
Will the solution converge to the analytical solution?
What is the truncation error?
Numerical stability?
Code optimization?
12
CFD is an interdisciplinary topic
Numerica Fluid
l analysis Mechanic
s
CFD
Computer
Science
13
Benefits of the course (2)
How are different methods and variants related to one another?
How to categorize various methods?
Finite difference
Finite volume
Spectral ….
……
Lattice Boltzmann
Gas kinetic scheme
……
14
Benefits of the course (3)
How to borrow ideas from another method and use it to
improve the method you are working on?
Migration of ideas from one method to another
Convergence of the different methodologies
Hybrid method (Lattice Boltzmann Immersed boundary
method)
Hands-on experience
15
Why do we need a computer and programming?
A very simple example
The MAE department computer: [Link]
ssh –Y username@[Link]
your password
Step 1: compile the Fortran code
gfortran -O3 code1.f
Step 2: run the code
./[Link]
Some basic commands for Unix OS
17
A simple example
If a coin is tossed 1,000 times, what is the probability of having the head
exactly 500 times?
1000
C500 1000 ⋅ 999 ⋅ 998 ⋅ ....⋅ 503⋅ 502 ⋅ 501
Mathematical expession p = =
1000
2 500 ⋅ 499 ⋅ 498 ⋅ ....⋅ 3⋅ 2 ⋅1⋅ 4500
Code 1 Code 2 Code 3
double precision y y = 1.0
y=1.0 y=1.0 DO i=1,250
DO i=1,500 DO i=1,500 y=y*(1001.-i )/4./(501.-i)
y=y*(1001-i )/4./(501.-i) y=y*(1001-i )/4./(501.-i) y=y*(500.0+i)/REAL(i)/4.
END DO END DO END DO
write (*,*) y write (*,*) y write (*,*) y
stop stop stop
end end end
1.42297268E+11 2.5225018178360818E-002 2.52250321E-02
Details matter!
18
Graphically, see the cumulative result
19
Necessary computer skills
Unix: [Link]
Introduction to Unix / Linux, a handout you should read
Fortran, compiler, library, parallelization
Introduction to Fortran, a handout you should read.
Learning Fortran by using it (hands-on learning)
Computer platform: processor, cache, nodes, memory, etc.
20
The devil is in the details
Small things in plans and schemes that are often
overlooked can cause serious problems later on
21
Introduction to
Computation / Computational fluid dynamics
22
Computation has always been helpful for routine tasks:
…… when we cannot solve things analytically.
Examples:
Roots of a nonlinear equation
Numerical differentiation
Numerical integration
Interpolation
Curve fitting / regression
Optimization
Solution of an ordinary differential equation
Solution of a system of partial differential equations (fluid
mechanics)
……
23
Historical notes on computational methods for fluid flows
First digital computers:
1937 – 1943 (John Vincent Atanasoff and graduate student Cliff Berry)
1943-1946: ENIAC invented by J. Presper Eckert and John Mauchly, U.
Pennsylvania
Finite difference / finite volume (since 1928)
Finite element (since 1941)
Finite volume (since 1950s, become more popular in 1980s)
Spectral / pseudo-spectral (Steve Orszag, 1969)
Boundary element
Vorticity based methods
Lattice Boltzmann method (since 1988, evolved from lattice gas automata)
Dissipative particle dynamics (Since 1992, evolved from lattice gas automata)
Smoothed particle hydrodynamics (since 1977)
Last 20 years, many new algorithms for multiphase flows!
24
Some review papers on the history of CFD
MG Hall (1981) Computational Fluid Dynamics: A revolutionary force in
aerodynamics, AIAA Paper 81-1014, Palo Alto, CA.
E. Krauss (1985) Computational Fluid Dynamics: Its present status and
future direction, Comput. & Fluids 13: 239-269.
SG Rubin and JC Tannehill (1992) Parabolized / reduced Navier-Stokes
computational techniques. Annu. Rev. Fluid Mech. 24: 117-144.
RW MacCormack (1993) A perspective on a quarter century of CFD
research. AIAA Paper 93-3291-CP, Honolulu, HI.
FT Johnson, EN Tinoco, NJ Yu (2005), Thirty years of development and
application of CFD at Boeing Commercial Airplanes, Seattle. Comput. &
Fluids 34: 1115-1151.
Finite difference method
• Historically, the oldest of the three (finite difference, finite element, finite
volume).
• Techniques published as early as 1910 by L. F. Richardson.
• Seminal paper by Courant, Friedrichs and Lewy (1928) derived stability
criteria for explicit time stepping. CFL number.
• First ever numerical solution: flow over a circular cylinder by Thom
(1933).
• Scientific American article by Harlow and Fromm (1965) clearly and
publicly expresses the idea of “computer experiments” for the first time
and CFD is born!!
• Advantage: easy to implement.
• Disadvantages: restricted to simple grids and does not conserve
momentum, energy, and mass on coarse grids.
26
Finite volume method (FVM)
• First well-documented use was by Evans and Harlow (1957) at Los
Alamos and Gentry, Martin and Daley (1966).
• Was attractive because while variables may not be continuously
differentiable across shocks and other discontinuities mass, momentum
and energy are always conserved.
• FVM enjoys an advantage in memory use and speed for very large
problems, higher speed flows, turbulent flows, and source term
dominated flows (like combustion).
• Late 70’s, early 80’s saw development of body-fitted grids. By early
90’s,
unstructured grid methods had appeared.
• Advantages: basic FV control volume balance does not limit cell shape;
mass, momentum, energy conserved even on coarse grids; efficient,
iterative solvers well developed.
• Disadvantages: false diffusion when simple numerics are used.
Computer simulation:
A third pillar for scientific discoverty
What is it?
Why?
28
Computer simulation:
A third pillar for scientific discovery
Theory, experiment, and computer simulation
Why?
Better computers
New methods and algorithms
29
Historical note
Current technology: transistors on integrated circuit
1943-1969, The early days - First computers / supercomputers
1970-1990, The vector computing years
1991- now, The parallel computing years, clusters, scalable, up to
100,000 processors
The future is not known:
Grid computing, distributed computing, or cloud computing, …
Alternate technologies?
Optical
Biological / Molecular
Quantum
Speed of computer – FLOPS
Floating-point operations per second
106 FLOPS à mega FLOPS [reach around 1965]
109 FLOPS à giga FLOPS [reach around 1990]
1012 FLOPS à tera FLOPS [reach around 1997]
1015 FLOPS à peta FLOPS [reached around 2008]
1018 FLOPS à exa Flops [near future goal]
Evolution
HPCofand
computational power and turbulence simulation
DNS evolution
Vector à parallel
Exascale 1018 CFD
16
10
Rλ ≈ 100.042∗year −82
Jaguar (ORNL)
15
Petascale 10 15 Roadrunner (DOE)
10 Ranger (TACC) Kraken XT5 (NICS)
14 Franklin XT4 (NERSC)
10 BlueGene/W (IBM)
Earth Simulator
13 Seaborg (NERSC) DataStar (SDSC)
10 Cray XT3 (PSC)
12
Terascale 10 12 BlueGene/L (SDSC)
10
Operations per second
11
10 Cray T3D Origin 2000
10 CM−5
10 Intel Delta, CM−200, etc
10
4
9
Gigascale 10 9 Intel Gamma, CM−2, etc J−90 series
10 CM−1,etc
8 Easy−commercial Cray Y−MP
10 Cray−1 Cray X−MP
7 Ours (TACC/NICS)
10 KIYIU
3
Megascale 106 10
6 CDC 7600
CDC 6600
10
5 IBM 7030 Ours
R
10 CDKS
YZ
GFN λ
4 IBM 704
10 MANIAC JWSR 2
10
3 K
VM 10
SEAC
2 OP
10 0.042×( year−1937)
10
1
Electro−mechanical
λ
R ≈ 10 1
0
10 10
1940 1950 1960 1970 1980 1990 2000 2010 2020
Year
Hello
The graph (modified after D.A. D.A.
Donzis
Donzis 2010) shows
Towards Petascale howandthe
Turbulence increasing
Turbulent Mixing 9/20
computational power over the years enables simulation of turbulent flow at
increasing flow Taylor-microscale Reynolds number.
The cost of performing a given calculation was
reduced by approximately a factor of 10 every 8
years up through 1995.
After 1995, the world’s best computer is 10 times
faster approximately every 3.3 years.
à Speed up in 10 years is a factor of about 1000
à A problem that requires a year of computing
time to solve 10 years ago can now be solved
overnight [365/1000 ~ 0.365 days ~ 9 hours ]
Why computation?
n Traditional science and engineering:
² Do theory or paper design
² Perform experiments or build system
n Limitations:
Ø Too difficult − build large wind tunnels
Ø Too expensive − build a throw-away airplane
Ø Too slow − wait for climate or galactic evolution
Ø Too dangerous − weapons, drug design, climate experiments
Ø Too challenging or impossible to measure − instrumentation not ready
n Solution: Use high performance computer systems to simulate the
phenomenon and obtain quantitative understanding − first-principle
simulation and numerical experiment
The cost of computation is decreasing, but the cost of performing experimentation is increasing!
NSF Cyberinfrastructure Framework for 21st Century Science and Engineering (CF21):
Computation is accepted as the third pillar supporting innovation and discovery ...
Computer modeling or computer simulation??
Computer modeling: Reproducing known physics
Examples: Turbulence modeling in engineering, General
circulation models,….
Computer simulation: generating original data for unknown
physics. Also known as computer experiment, direct numerical
simulation, …..
Most computational studies sit in between ……
35
Modeling
Typically based on coarse-grained “averaged equations”
Many unresolved physical issues are “parameterized” (as
transport coefficients)
Closures
Parameterizations
Models (e.g., subgrid scale models)
36
Simulations
Typically based on original valid equations
Parameterizations (i.e., subgrid-scale models, particle
equation of motion), if there are, have high fidelity
Limited to simple setting or subset of the whole problem
37
Hybrid Direct Numerical Simulation
! (α ) ! (α ) ! (α ) ! ! (α )
dV (t)
=−
V (t)[− (U(Y (t),t) + u ]
(Y ,t) !
−g
dt τ (pα )
!
dY (α ) (t) ! (α )
= V (t)
dt
€ Beyond “point particles”:
Droplet-droplet aerodynamic
interactions are considered
Wang et al., Turbulent collision of inertial particles: Point-particle based, hybrid
simulations and beyond. Int. J. Multiphase flow, 35 (2009) 854–867.
In this course, we will stress direct numerical
simulations of viscous flows, turbulence and
multiphase flows
39
Simulations can lead to discovery
40
Particle distribution and settling in isotropic turbulence
Wang & Maxey, J. Fluid Mechanics, 256, 27-68, 1993.
Point-particle based
One-way coupling
41
Experimental validations came later …
Kolmogorov scaling of Enhanced settling
preferential concentration rate
Fessler, Kulick &
Eaton (1994)
Wang & Maxey
Wang & (1993)
Maxey Aliseda et al. (2002)
(1993)
Simulations lead to discovery:
The 2013 Nobel prize in chemistry
Martin Karplus, Harvard U., Cambridge, MA, USA
Michael Levitt, Stanford U., Stanford, CA, USA
Arieh Warshel, U. Southern Ca., Los Angeles, CA, USA
The Nobel Prize in Chemistry 2013 was awarded jointly to
Martin Karplus, Michael Levitt and Arieh Warshel “for the
development of multiscale models for complex chemical
systems”
Interactions between atoms à the structure of proteins
43
The capability of a method is realized only when physical
phenomena can be simulated accurately
Verification: The process of evaluating a product to determine
whether it meets the initial requirements and design
specifications.
Quality Control. Are you building the method right?
Validation: The process of evaluating a product during or at
the end of the development process to determine whether it
satisfies specified requirements.
Quality Assurance: Are you building the right method?
Applications: Use the method to solve problems at conditions
that have not been solved before.
Physics comes first!
44
The devil is in the details
Small things in plans and schemes that are often overlooked
can cause serious problems later on
45
Comparison of approaches
Approach Advantages Disadvantages
Experimental most realistic 1. equipment required
2. scaling problems
3. tunnel corrections
4. measurement difficulties
5. high operating costs
Theoretical clean, general 1. restricted to simple geometry
& physics
2. usually for linear problems
Computational OK for nonlinear probs 1. truncation errors
OK for complex physics 2. boundary condition problems
OK for transient probs 3. computer costs
4. coding errors
5. limited domain size
Summary
Computational fluid dynamics is an interdisciplinary topic
physical problem (you may bring your own problem)
multiphase physics
numerical methods, algorithms
analysis and interpretation
computer science
Computer simulation and computer modeling
Both are needed, for different reasons
Computer simulation is a new tool for discovery
Verification versus validation
What does this mean?
How does this impact the society?
Fortran programming, Unix OS
47