Prabhu Ramachandran
Department of Aerospace Engineering IIT Bombay
1, May 2006
Fluid mechanics
CFD CEP 06
1 / 69
Outline
1
Fluid mechanics Basics Governing equations Gory details Numerics An introduction Numerical uid mechanics Method of solution Errors and moded equations Alternative methods Particle methods: vortex methods
Fluid mechanics
CFD CEP 06
2 / 69
Outline
1
Fluid mechanics Basics Governing equations Gory details Numerics An introduction Numerical uid mechanics Method of solution Errors and moded equations Alternative methods Particle methods: vortex methods
Fluid mechanics
CFD CEP 06
3 / 69
Fluids
What is a uid? Why is a uid different from a solid? Why is uid mechanics so different from solid mechanics? Depends on behavior of medium when a force is applied Does the medium have a particular preferred shape? Everything depends on context: conditions, timescale etc.
Fluid mechanics
CFD CEP 06
4 / 69
Fluid ow as a continuum
Simulating every molecule in a normal uid ow is impossible today (and also a colossal waste!) NA = 6.023 1023 and this is for one mole of a gas (22.4L at 273.15 K and 1 atm) Continuum hypothesis: an idealization to ease analysis Knudsen number: crude indicator of applicability of the continuum hypothesis Kn = Kn
L
: mean free path of molecules, L: length scale of uid motion 1 suggests continuum is valid The entire course focusses on this regime
Fluid mechanics
CFD CEP 06
5 / 69
Basic unknowns
Fluid mechanics
CFD CEP 06
6 / 69
Physical principles
Conservation of mass Conservation of linear momentum Conservation of Energy (First law of thermodynamics) Equation of state Second law of thermodynamics Frame indifference: constitutive laws should not depend on observer
Fluid mechanics
CFD CEP 06
7 / 69
Eulerian:
focus on a xed point in space study change of property at the particular location notion of control volume is Eulerian space and time coordinates are independent
Eulerian derivative:
t (
)
D Dt
Lagrangian derivative:
t (
Fluid mechanics
CFD CEP 06
8 / 69
Thermodynamics primer
Misnomer? Thermostatics? Zeroth law: equivalence of temperature Ideal uid: equation of state f (p, v , T ) = 0 Two properties (say p, v ) are sufcient to describe the state First law: E = Q + W Sign convention is such that: E = Q p v E is the internal energy of uid (function of the state of uid) W is work done on uid (anything which may be reduced to lifting a weight) Q is the energy transfer to the uid (due to a temperature difference) Heat is always a transfer, not a property! Adiabatic: no heat transfer Isothermal: no change in temperature (and internal energy)
Prabhu Ramachandran (IIT Bombay) Fluid mechanics CFD CEP 06 9 / 69
Specic heat: Q = T = cp = cv = =
cp cv E p T p Q T Q T v v
Q T
p + p + =
v + p v v +p
v T p
p =0
E = T v v =0 p p v adiabatic / v
isothermal
Fluid mechanics
CFD CEP 06
10 / 69
Entropy
Consider process (in a p v diagram) that is adiabatic and reversible Entropy, S : property which is constant along such processes Entropy for ideal gas is a function of two other state variables Consider: reversible transition from one equilibrium state to another T S = Q Second law: Adiabatic, irreversible change, S > 0 Reversible adiabatic process: isentropic Reversible: T S = E + p v
Fluid mechanics
CFD CEP 06
11 / 69
Fluid mechanics
CFD CEP 06
12 / 69
Maxwells relations
E v E S p S v S v T p T = p
S
=T
v
=
v
=
p
T v T p S S p S v
=
p
=
v
Fluid mechanics
CFD CEP 06
13 / 69
Ideal gas
Equation of state pv = RT , R is the universal gas constant Cp , Cv are constants Cp Cv = R Cp /Cv = Cp , Cv intimately related to kinetic theory of gasses
Fluid mechanics
CFD CEP 06
14 / 69
Transport equations
Transport of a material property Consider a control volume Determine: rate of change of property inside volume Contribution due to ux Source terms These are related through physics
Fluid mechanics
CFD CEP 06
15 / 69
Fluid mechanics
CFD CEP 06
16 / 69
Stress, i = ij nj , where nj is the surface normal It can be shown that the ij = ji Pressure: isotropic part of ij
Fluid mechanics
CFD CEP 06
17 / 69
Constitutive relations
Velocity gradient: L =
V x
= grad(V)
For a Navier-Stokes uid it is common to dene: = C This is called a constitutive equation More precisely: = p()I + div(D) + 2D , are the bulk and shear viscosities Frame indifference of a quantity: ensures consistency across reference frames Linearized strain as against D is not frame indifferent! Formulating constitutive relations requires great care Stokes formulation is frame indifferent
Fluid mechanics
CFD CEP 06
18 / 69
Outline
1
Fluid mechanics Basics Governing equations Gory details Numerics An introduction Numerical uid mechanics Method of solution Errors and moded equations Alternative methods Particle methods: vortex methods
Fluid mechanics
CFD CEP 06
19 / 69
V d S = 0
Fluid mechanics
CFD CEP 06
20 / 69
+ div(V) = 0
Conservation of linear momentum: (Vi ) + div(ui V + p) = div(div(D) + 2D) + source terms t Conservation of energy: (eT ) + div((eT + p)V) = heat ux + viscous terms + . . . t Equation of state: p = RT Second law of thermodynamics
Fluid mechanics
CFD CEP 06
21 / 69
1D conserved quantites can be written as, u = [, u , eT ]T Flux term: f = [u , u 2 + p, (eT + p)u ]T Conservation form of equations: u f + =0 t x Primitive variables: w = [, u , p]T Equations:
w t w + C x = 0
Fluid mechanics
CFD CEP 06
22 / 69
Classication of PDEs
Consider:
u t u u + A x + B x 2 = S (x , t , u )
2
Elliptic equations are also important (though not discussed at length here)
Characteristics are imaginary/complex Information propagates everywhere
Fluid mechanics
CFD CEP 06
23 / 69
Boundary conditions
Velocity BC
Velocity at innity (V ) No penetration on boundary No slip on boundary
, p , T Depending on nature of equations (parabolic, hyperbolic etc.) different conditions are needed
Fluid mechanics
CFD CEP 06
24 / 69
Outline
1
Fluid mechanics Basics Governing equations Gory details Numerics An introduction Numerical uid mechanics Method of solution Errors and moded equations Alternative methods Particle methods: vortex methods
Fluid mechanics
CFD CEP 06
25 / 69
Non-dimensional numbers
Reynolds number: Ratio of inertial to viscous forces: Re = Mach number: M =
V a, UL
a is speed of sound
Nusselt number: Nu =
= Gr Pr
Fluid mechanics
CFD CEP 06
26 / 69
Classication of uid ow
Steady:
X t
is neglected/negligible
Incompressible: is not (p) Inviscid: Viscous forces are neglected, Re is large Irrotational: Vorticity, = curlV is negligible Based on M :
Subsonic: M < 1 Transonic: M 1 Supersonic: M > 1 Hypersonic: M 1
Fluid mechanics
CFD CEP 06
27 / 69
Pathline: path of a particle starting at some point Streamline: an instantaneous curve, the tangent to which is the direction of V Streakline: curve traced by a collection of particles injected at a particular point For a steady ow all the three are the same
Fluid mechanics
CFD CEP 06
28 / 69
Incompressible Potential ow
Inviscid, incompressible and irrotational ow grad = V Governed by: 2 = 0 (from incompressibility) Elliptic equations Dene streamfunction in 2D such that (u , v ) =
y , x
Potential lines and streamfunction are conjugate to each other In 2D complex analysis can be used to elegantly analyze and study potential ows
Fluid mechanics
CFD CEP 06
29 / 69
Stress tensor and viscous forces depend on the constitutive model As an example consider a Navier-Stokes uid Governing equations: divV = 0 V 1 + V grad(V) = grad(p) + 2 V t Initial condition for V BC: no-slip and no-penetration on solid walls
Fluid mechanics
CFD CEP 06
30 / 69
Boundary layer:
Fluid sticks to the surface of boundary Viscosity impedes motion of nearby uid layers The boundary layer involves rotational ow and = 0
Shear layer
Sharp gradient of velocity between two adjacent layers Viscosity tends to equalize the layers Shear layer evolution: essentially the viscous evolution of a vortex sheet Always unsteady!
Fluid mechanics
CFD CEP 06
31 / 69
Compressible ow
Incompressible ow:
mass and momentum equations are somewhat decoupled information travels instantaneously only gradient of pressure: absolute pressure values are meaningless
Compressible ow: fundamentally different from incompressible ow Introduces a communication time scale Equations are hyperbolic in nature Information travels as waves along characteristics Zone of dependence, silence and action Leads to creation of shocks
Fluid mechanics
CFD CEP 06
32 / 69
Mach cone
Mach cone Zone of silence M>1 Zone of action Small perturbations sin = 1/M Influence of disturbance
Fluid mechanics
CFD CEP 06
33 / 69
Oblique Shock
Oblique shock Zone of silence Particle path M>1 > Influence of disturbance Zone of action wedge Small perturbations
Fluid mechanics
CFD CEP 06
34 / 69
Bow Shock
Mach angle
Bow shock
Fluid mechanics
CFD CEP 06
35 / 69
Why CFD?
Equations are non-linear PDEs No analytical solution for general case Complexities due to:
geometry boundary conditions physics
Experiments are costly and not always possible Necessitates numerical approach Numerics are non-trivial
Fluid mechanics
CFD CEP 06
36 / 69
Outline
1
Fluid mechanics Basics Governing equations Gory details Numerics An introduction Numerical uid mechanics Method of solution Errors and moded equations Alternative methods Particle methods: vortex methods
Fluid mechanics
CFD CEP 06
37 / 69
Fluid mechanics
CFD CEP 06
38 / 69
Taylors series 1D: f (x ) = f (x0 ) + f (x0 )(x x0 ) + Taylors series in two variables: f (x , y ) = f (x0 , y0 ) +
j
f (x0 )(x x0 )2 2!
+ ...
1 j!
+ y x y
f (x , y )
Fluid mechanics
CFD CEP 06
39 / 69
Root nding
Fluid mechanics
CFD CEP 06
40 / 69
Polynomial Interpolation
Unique interpolating polynomial y = Pn (x ) = a0 + a1 x + a2 x 2 . . . + an x n Given (xi , yi ): solve linear system of equations Results in Vandermonde matrix which is singular Lagrange interpolating polynomial:
Dene:li (x ) = Then: pn (x ) =
x xj n i =j ;j =0 xi xj j
f (xj )lj (x ).
Newton form: pk +1 (x ) = pk (x ) + c (x x0 )(x x1 ) . . . (x xk ) Coefcients can be found efciently using divided differences
( ) Error: f (x ) Pn (x ) = (x x0 ) . . . (x xn ) f(n+1 )!
n +1
Fluid mechanics
CFD CEP 06
41 / 69
Quadrature
f (x )dx
f (a)+f (b) (b 2
a)
f (b ) 2
Simpsons rule:
a+2h a
Gaussian quadrature
Fluid mechanics
CFD CEP 06
42 / 69
Least squares
Best ts of a curve with linear coefcients p-norm of a vector: lp = ( l or max norm = max(xi ) Idea is to minimize error of the best tting curve Least squares: convenient to use l2 norm since it is easiest to minimize Weighted least squares: weight the different points suitably
i
|xi |p )1/p
Example
Straight line error =
n 1 i =0 (axi
+ b yi )2
Minimize by setting rst partial derivatives to zero: i 2xi (axi + b yi ) = 0 i 2(axi + b yi ) = 0 Simplifying results in the normal equations
Prabhu Ramachandran (IIT Bombay) Fluid mechanics CFD CEP 06 43 / 69
ODEs
dx dt
= x = f (x , t )
1 2 2! t x
Taylor series: x (t + t ) = x (t ) + t x (t ) +
(t ) + . . . +
1 m (m) (t ) m! t x
+ ...
Euler method: x (t + t ) x (t ) + t x (t ) = x (t ) + t f (x , t ) Euler is only rst order accurate Runge-Kutta second order method:
k1 = t f (x , t ) ; k2 = t f (x + k1 , t + t ) x (t + h) = x (t ) + (k1 + k2 )/2
Adams-Bashforth/Adams-Moulton methods use past values: t x (t + t ) = x (t ) + 24 (55f (t ) 59f (t t ) + 37f (t 2 t ) 9f (t 3 t )) Stiff systems of equations: disparate time scales: implicit schemes
Fluid mechanics
CFD CEP 06
44 / 69
Matrix multiplication with vector: a linear combination of the columns Matrix-matrix product: cij = aik bkj A composition of linear transformations Ax = b has unique solution if one of following holds:
A1 exists no non-zero y s.t. Ay = 0 As rows and columns are independent det (A) = 0
Fluid mechanics
CFD CEP 06
45 / 69
Gaussian elimination: systematic reduction to upper triangular form Intimately related to LU decomposition Small pivots relative to other elements in row: trouble! Scaled partial pivoting works for the most part Triangular/banded matrices: Simplied Gaussian elimination Diagonally dominant banded matrices are guaranteed to be well behaved
Fluid mechanics
CFD CEP 06
46 / 69
Ill-conditioned matrices
||Ax || ||x ||
Ill-conditioned matrix is one where the equations are almost linearly dependent
Fluid mechanics
CFD CEP 06
47 / 69
Difference formulae
Forward difference: f (x + x ) f (x ) = + O ( x ) x x Backward difference: f (x ) f (x x ) = + O ( x ) x x Central difference: f (x + x ) f (x x ) = + O ( x 2 ) x 2 x
Fluid mechanics
CFD CEP 06
48 / 69
Outline
1
Fluid mechanics Basics Governing equations Gory details Numerics An introduction Numerical uid mechanics Method of solution Errors and moded equations Alternative methods Particle methods: vortex methods
Fluid mechanics
CFD CEP 06
49 / 69
PDEs to FDEs
Discretize the domain (grid) Represent (discretize) the eld properties on the grid Use the difference formulae to obtain derivatives at grid points Results in a system of algebraic equations Formulation can be implicit Non-trivial geometry requires non-cartesian grids Transformation from a cartesian computational domain to the non-cartesian physical domain is needed Must worry about stability Advantage: very general and applicable to any PDE
Fluid mechanics
CFD CEP 06
50 / 69
PDEs to FVEs
Fundamentally tied to conservation laws Satises the integral equations Discretize the domain into volume elements (cells) Satisfy conservation laws on each volume element Flux exchanged from sides of volume/cell Always satises conservation laws Captures discontinuities
Fluid mechanics
CFD CEP 06
51 / 69
Outline
1
Fluid mechanics Basics Governing equations Gory details Numerics An introduction Numerical uid mechanics Method of solution Errors and moded equations Alternative methods Particle methods: vortex methods
Fluid mechanics
CFD CEP 06
52 / 69
Truncation error arises from nite difference approximation and Taylor series
x ) f (x ) Forward difference: f (x ) = f (x + + x If FDE uses a forward difference: x 2 f
(x ) + . . .
x 2 f
actual equation being solved has additional this is the modied equation
(x ) term
Fluid mechanics
CFD CEP 06
53 / 69
Outline
1
Fluid mechanics Basics Governing equations Gory details Numerics An introduction Numerical uid mechanics Method of solution Errors and moded equations Alternative methods Particle methods: vortex methods
Fluid mechanics
CFD CEP 06
54 / 69
DV Dt
divV = 0 2 = 1 gradp + V
V (r ) = 0 Boundary B
VB
n e
s e
n = VB e n. No-penetration: V e s = VB e s No-slip:V e
Fluid mechanics
CFD CEP 06
55 / 69
Fluid mechanics
CFD CEP 06
56 / 69
Fluid mechanics
CFD CEP 06
56 / 69
Fluid mechanics
CFD CEP 06
56 / 69
Vortex methods
Vorticity is the curl of the velocity eld Represent the ow in terms of vorticity Discretize the vorticity into vortex particles Track the resulting particles of vorticity as per a GDE
Fluid mechanics
CFD CEP 06
57 / 69
Vortex methods
Vorticity is the curl of the velocity eld Represent the ow in terms of vorticity Discretize the vorticity into vortex particles Track the resulting particles of vorticity as per a GDE
Fluid mechanics
CFD CEP 06
57 / 69
D Dt
divV = 0 = 2
=0
(r ) = 0
n e
VB
s e
n = VB e n. No-penetration: V e s = VB e s No-slip:V e
Fluid mechanics
CFD CEP 06
58 / 69
Disadvantages
Complexities associated with interacting particles Implementation for general ows is non-trivial Techniques for compressible, multi-phase, non-Newtonian uids not well established 3D ows are not simple extensions of the 2D case
Fluid mechanics
CFD CEP 06
59 / 69
Disadvantages
Complexities associated with interacting particles Implementation for general ows is non-trivial Techniques for compressible, multi-phase, non-Newtonian uids not well established 3D ows are not simple extensions of the 2D case
Fluid mechanics
CFD CEP 06
59 / 69
Numerical Solution
Solve using a particle based scheme Discretize vorticity into Vortex Blobs Two-step scheme
Advection: D =0 Dt = 2 t
Diffusion:
Fluid mechanics
CFD CEP 06
60 / 69
Discretization of
Discretize the vorticity into Vortex Blobs (r , t ) =
i
(r ri (t ))i
2 j
Circulation i = i h2 (r ) is called a smoothing or cutoff function is an approximate Dirac distribution is the core radius
Fluid mechanics
CFD CEP 06
61 / 69
Advection
Vorticity is convected along with the ow BC: No-penetration on solid walls Requires determination of the velocity eld V (r , t ) = V + grad is found such that BC is satised
Fluid mechanics
CFD CEP 06
62 / 69
Diffusion
= 2
Fluid mechanics
CFD CEP 06
63 / 69
Slip Velocity
Blobs
2 3 4 5
Add vortex sheets to offset the slip Convect existing sheets and blobs Diffuse all the sheets and blobs Repeat from step 1
Sheets
3,4
Fluid mechanics
CFD CEP 06
64 / 69
Re = 3000: Cd vs T
Fluid mechanics
CFD CEP 06
65 / 69
Fluid mechanics
CFD CEP 06
66 / 69
Fluid mechanics
CFD CEP 06
67 / 69
Fluid mechanics
CFD CEP 06
68 / 69
Fluid mechanics
CFD CEP 06
68 / 69
Fluid mechanics
CFD CEP 06
68 / 69
Fluid mechanics
CFD CEP 06
68 / 69
Fluid mechanics
CFD CEP 06
68 / 69
Fluid mechanics
CFD CEP 06
68 / 69
Summary
Summary
Review of basic physics, thermodynamics for uid mechanics Overview of uid mechanics and equations Elementary numerical methods Introduction to numerical solution techniques for uid mechanics
Fluid mechanics
CFD CEP 06
69 / 69