2017-08-24 Advanced Methods for Numerical Fluid Dynamics and Heat Transfer (MVKN70) 1
Lectures and course plans Week 1, 2: RY: Dr. Rixin Yu: tel: 222 3814; e-mail: rixin.yu@energy.lth.se Week 3; BS: Prof. Bengt Sundén: tel: 2228605, email; Bengt.Sunden@energy.lth.se Week 4,5,: JR: Prof. Johan Revstedt tel: 222 4302; e-mail: Johan.Revstedt@energy.lth.se Two guest lectures, Theory test 2
Course contents Previous CFD course Low speed(incompressible), flow problem with simple physics Basic numerical methods, mainly using finite volume methods This advanced course Flow problems with complex physics High speed, compressible flow (weak 1, 4-5) Shock-wave, discontinuity Multi-physics flow problems Reacting flow (weak 2) Advanced heat transfer : thermal radiation problem (weak 3) Other branches of multi-physics flow problem (not cover in detail )» Multiphase flows» Magnetohydrodynamics (MHD)» Micro-fluid, non-newtonian.. 3
Lecture 1.a An overview of computation methods applicable to fluid-related problems 4
General overview of CFD methods Different frameworks of computational methods (able to deal with the fluidmechanics problems in a whole) Classic methods (P.D.E. (NS) discretization onto a grid approximation ) Finite volume/finite difference Discretization on a grid (mesh) with known connectivity» Numerical Schemes to turn the problems of solving a system of P.D.E.s into solve an approximated set of algebraic equations.» Basic tools: Taylor expansion, interpolation/extarpolation.» Concepts: Order of accuracy (truncation error), Von Nueman stability analysis, boundary conditions treatments, The nature way towards extension to handle complex problem» (Adaptive) mesh refinement / Finite element, (pseudo) spectral methods (X) Other methods Meshfree methods (Smooth particle hydrodynamics, X) Lattice Boltzmann Methods (X) 5
Spectral methods (Discrete Fourier transform) f x න መf k e ikx signal Finite Difference Finite Volume. Finite element? Spectral method 6
Spectral method The basis functions ψ k x : = e ikx form an orthogonal basis, ψ k x ψ k x dx = e ikx e ik x dx = δ kk Calculate Fourier coeff. መf k = න f x e ikx Discrete fast-fourier-transform, computationally-efficient, reducing operation counts from O(N 2 ) to O( N log(n) ), where N is grid count. - The simplest version is Cooley-Tukey algorithm for N=2 m, other advanced FFT algorithm version can handle N as prime number. - FFTW (free software, parallel implementation available) For each basis function, it is easy to handle derivative x eikx = i k e ikx 2 x 2 eikx = i k 2 e ikx = k 2 e ikx 7
Spectral method: example A simple linear partial differential equation (Poisson eq.) 2 x 2 + 2 u x, y = g x, y, y2 Write u and g on Fourier basis Given g x, y = g x + 2π, y = g(x, y + 2π) with x, y [0,2π] u x, y : = j k u j,k e i(jx+ky) and g x, y : = j k g j,k e i(jx+ky) l. h. s = 2 x 2 + 2 y 2 r. h. s. = g(x, y) u x, y : = u j,k (j 2 + k 2 )e i(jx+ky) j k = e i(jx+ky) j k g j,k For each (j,k), it become a simple algebraic relation. u j,k = g j,k (j 2 + k 2 ) 8
Spectral methods for PDE with nonlinear terms As a simplification to the incompressible NS t u + u u = p + ν 2 u; u = 0 The nonlinear viscous burger s eq. t u + 1 2 xu 2 = xx u, for x 0,2π, t > 0 u x, t : = k u k (t)e ikx t u k + ik 2 u p u q + k 2 u k = 0 k p+q=k For each k, it now relates to other (many) p and q 9
Pseudo-spectral methods for nonlinear PDE nonlinear burger s eq t u + 1 2 xu 2 = xx u Go to x space for x 0,2π, t > 0 u x, t k u k (t)e ikx u u = U(x, t) back to k space k U k (t)e ikx t u k + 1 2 ik U k (t) + k 2 u k = 0 k Time advancement u k t n+1 u k t n t n+1 t n 10
Spectral method Spectral methods and Finite Element Method are closely related Spectral methods use a global basis functions that are nonzero over whole domain. Excellent error properties of exponential convergence FEM can be viewed as using a local basis functions that are non-zero only on small subdomain. Spectral methods works better with simple-geometry(e.g. periodic) having smooth solutions, it can be less expensive. Spectral methods are not good discontinuous problem, (no known 3D spectral shock capture results), link to Gibbs phenomenon. Functional approximation of square wave using 5 harmonics 25 harmonics 125 harmonics 11
General overview of CFD methods Different frameworks of computational methods (able to deal with the fluid-mechanics problems in a whole) Classic methods (P.D.E. (NS) discretization onto a grid approximation ) Finite volume/finite difference Finite element, (pseudo) spectral methods (X) Other methods Meshfree methods (Smooth particle hydrodynamics, X) Lattice Boltzmann Methods (X) 12
Meshfree methods Smooth particle hydrodynamics (SPH) SPH of dam break from youtube Useful refernce: wikipedia M.B. Liu, G.R. Liu, Smoothed Particle Hydrodynamics (SPH): an Overview and Recent Developments, Arch Comput. Methods Eng, 2010, 17:25 DOI 10.1007/s11831-010-9040-7 http://www.ita.uni-heidelberg.de/~dullemond/lectures/num_fluid_2011/chapter_12.pdf http://www2.mpia-hd.mpg.de/~dullemon/lectures/fluiddynamics08/chap_10_sph.pdf 13
SPH It is a mesh-free lagrangian methods to simulate continuum media. Initially developed in 1977 for astrophysical problems, then is extended to many fields, volcanology and oceanography... Ideals: The gas cloud is represents by a set of discrete blob of gas, these particles interacts with neighboring particles through a repelling force(pressure), but otherwise like normal moving particle. 14
SPH methods SPH Dividing fluid into a set of discrete particles elements. These elements have a spatial length over which their properties are smoothed by a kernel function. Physical properties at a certain location receive contributions from nearby particles, the contribution of each particle are weighted according to their distance from the particle interests. Spatial derivative of a quantile can be easily obtained. Only solve equation of motion for all particles, which is a set of ODE equations. Easy mass and energy conservation, particles themselves represent mass. No negative density can happen. Pressure can be evaluated directly from weighted contribution of neighboring particles, instead of solving the (Poisson) equations. as in grid-based technique. 15
SPH Divergence-Free SPH for Incompressible and Viscous Fluids, from youtube 16
SPH Benefits over traditional grid/based technique. Versatile, easy to deal with problems of free surface, deformable boundary and moving interface. SPH can do real-time simulation water/air simulations(for games) For problems with complicate geometry setting or problems with large deformation, SPH can self-adapt its resolution (computing power is automatically focused to there where mass is). Analogous to grid-based methods, it become an automatic version of adaptive mesh refinements (AMR) without technique complexity. Simple and robust method, easier for numerical implementation: Challenges and problems To quickly find the nearest neighboring particles Connectivity information is not available as grid-based method Require large number of particles, less accurate, Noise due to discrete approximation of kernel interpolants, large numerical shear viscosity Tends to smear out shocks and contact discontinuity 17
General overview of CFD methods Different frameworks of computational methods (able to deal with the fluid-mechanics problems in a whole) Classic methods (P.D.E. (NS) discretization onto a grid approximation ) Finite volume/finite difference Finite element, (pseudo) spectral methods (X) Other methods Meshfree methods (Smooth particle hydronamics, X) Lattice Boltzmann Methods (X) 18
Lattice Boltzmann Method 19 Slide taken from Steven Orzag s presentation
LBM Cellular Automaton, conway s game of life(1970) Very simple set of rules: Any live cell with fewer than two live neighbours dies, as if caused by underpopulation. Any live cell with two or three live neighbours lives on to the next generation. Any live cell with more than three live neighbours dies, as if by overpopulation. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. creates complex life-like patterns! 20
Lattice Boltzmann methods(lbm) Different levels of observations(microscopic<mesoscopic<macroscopic) Macroscopic behavior of a system may not dependent on the details of the microscopic interactions. In the middle mesoscopic level, keep some part of the particle concept, allow those particles only staying in the lattice points, therefore only finite number of discrete velocity values 21
LBM Cell automaton rules for modeling gas dynamics: Particle only live in nodes of a given Lattice. A finite number of allowed states for each node, n i r, t Two stage evolutions 1: Stream n i r + λc i, t + Δt = n i r, t 2: collide n i r + λc i, t + Δt n i r, t = Ω i n r, t Lattice Boltzmann Method Use a probability function: f i (t, x, V) Similar to Boltzmann eq. for gas dynamics Average the probity to compute Fluid quantities. Model the collision term Relax toward equilibrium state 22
Lattice Boltzmann methods(lbm) Advantages Fundamental research tool Theoretically appealing: the knowledge of interaction between molecules can directly incorporate physical terms Success in wide range of applications Complex, multiphase/multicomponent flows. Coupled flow with heat transfer and chemical reactions. Multiphase flow with small droplet and bubbles, flow through porous media. Run efficiently on massively parallel architectures, LBM algorithm is local (cell interacts with only neighbors) and explicit in time. computer cluster, GPU, even FPGA(mobile chips). Parallel post-processing LBM algorithm is 1 st order PDE, much simple for programming than Naiver-stokes equation based solver. Easy boundary conditions treatment 23
Lattice Boltzmann methods(lbm) Limitations: Only limited number of commercial software is available. The method is relatively new! Numerical instability can develop when viscosity become small. High Mach number flows in aerodynamics is still difficult for LBM. Shock-discontinuity, strong gradients. 24
Lecture 1.b Review 1D hyperbolic equations Emphasis on physical perspective, not rigorous math. Analytical treatment of discontinuity The Riemann problem 25
Book Reference book chapter and online materials for lectures of week 1 Computational fluid mechanics and heat transfer, by J.C. Tannehill, D. A. Anderson and R. H. Pletcher Chapter 4.4: Introduction, 4.4.1-4.4.3 4.4.8-4.4.9 4.4.11-4.4.12. Online lecture notes for Numerical Fluid Dynamics by C.P.Dullemond, University of Heidelberg, 2008 http://www2.mpia-hd.mpg.de/~dullemon/lectures/fluiddynamics08/ Chapter 2: Hyperbolic equations Chapter 4: Numerical schemes for advection (II) Chapter 6: Numerical hydrodynamics: Riemann solvers (I) 26
Classification of PDEs Elliptic, Parabolic, Hyperbolic 27
Simplest advection equation Consider the simplest advection equation: t q(x, t) + u q(x, t) = 0, x given initial conditions q x, t = 0. If u is constant in space x and time t The solutions become a propagating wave: q(x, t) = q(x u t, 0) 28
Hyperbolic equation Simplest advection equation, with constant u LHS = t q(x, t) + u q(x, t) = 0, x Introduce a new coordinate x 0, t (x, t), x x 0, t = x 0 + u t t x 0, t = t D q Dt t q x0, t = t q t t + x q t x = q 1 t =0 + q u x q holds constant for different t, along the entire trajectory x x 0, t starting at x 0. D q Dt is analogy to the concept of material derivative used in fluid mechanics 3Δt u 2Δt Δt t = 0 x 0 x = x 0 + ut x (x, t) plane 29
Advection equation with space dependent u(x) t q(x, t) + u(x) q(x, t) = 0, x New coordinate x, t x 0, t x x 0, t = x 0 + 0 t u x x 0, t dt t(x 0, t ) = t D q Dt t q x0, t = t q t t + x q t x = 0 x = u(x) t 3Δt 2Δt Δt t = 0 x 0 x 30
Advection equation of conservative quantity with space dependent velocity u(x) t q(x, t) + x Integrate for x a < x < x b Rewrite u x q x, t = 0 x b t න q dx + u x b q x b, t u x a q x a, t = 0, x a t q x, t + u x x q x, t = q(x, t) u x x D Dt q = q(x, t) u x x 3Δt 2Δt Δt t = 0 x 0 x A general form t q(x, t) + f(q, x) = 0 x 31
General Flux-form of conservation equation t q(x, t) + F(q, x) = 0 x F q + t q ቚ F q = x=const x x ቚ q=const Example 1 F q, x u x q Example 2 Linear Previous eq. t q(x, t) + x F q ቚ x=const = u(x) F x ቚ = q(x, t) u x q=const x Jacobian u x q x, t = 0 Inviscid burge s eq. F q, x 1 2 q2 t q + x (1 2 q2 ) = 0 t q + q x q = 0 F(q, x) has no x-dependency Nonlinear 32
What about a set of equations Q q 1 q m Conservative (flux) form t Q + F(Q, x) = 0 x t q 1 q m + x F 1 (q 1,, q m ; x) F m (q 1,, q m ; x) = 0 Non-conservative form F Q + t Q ቚ F Q = x,cons x x ቚ Q,cons t q 1 q m + F 1 F 1 q 1 q m F m F m q 1 q m x q 1 q m = x F 1 F m t Q + J x Q = x F J F Q is m m matrix 33
A set of equations Simple (linearly) decoupled example with Jacobian already in the diagonal form t Q q 1 q 2, m = 2 q 1 q 2 + u 1 0 0 u 2 x q 1 q 2 = 0 t q 1 + u 1 x q 1 = 0 t q 2 + u 2 x q 2 = 0 q 1 q 2 u 1 u 2 space 34
A set of equations When Jacobian is not in diagonal form Eigenvalues/eigenvectors: J m m e m 1 = λ e m 1 Q + J Q = rhs=0 t x J e (1) ; ; e (m) = e (1) ; ; e (m) 0.. 0 λ 1 0 0 0 0 λ m J m m E m m = E m m Λ m m J = EΛE 1 E 1 t Q + E 1 EΛE 1 x Q = 0 t Q + (EΛE 1 ) x Q = 0 t (E 1 Q) + λ 1 0 0 0.. 0 0 0 λ x (E 1 Q) = 0 m Q E 1 Q t Q + Λ x Q = 0 35
Inviscid burgers equation Nonlinear hyperbolic equation Inviscid burge s eq. t q + x (1 2 q2 ) = 0 D Dt q t q + q x (q) = 0 q Note: Before discontinuity develops, q along along any characteristic line should be constant, therefore the slope(the trajectory advection velocity) of characteristic lines remain constant. 36 space
The Riemann problem for inviscid-burgers equation The Riemann problem: Initial value problem composed of a conservation equation together with piecewise constant data having a single discontinuity shockwave Expansion q R q L?? q L q R space?? space 37
The Riemann problem Analytic solution for inviscid-burgers equation shockwave Expansion, Rarefaction waves q R q L q L q R space space Wave diagram from solving Riemann problem for inviscid burges equation 38
Solution of Riemann problem for inviscid burgers equation q l > > q r q r t 2 q l t 2 t 0 t 1 t 0 t 1 shockwave Expansion wave space c = q l+q r 2, it is the speed of the middle value point An observation: for the shockwave solution which is a simple translation of discontinuity, it seems can be modelled by a linear advection equation,with c as the advection speed. 39
Exact (Analytic) solutions: Solution of Riemann problem for inviscid burgers equation 1) Galilean invariance (q = q c; x = x + ct; t = t ) t q + 1 2 x q 2 = 0 2) Self-similarity: Given initial condition: q x > 0 +, t = 0 = u r ; q x < 0 +, t = 0 = u l q x, t = φ x t ; for t > 0 t q + 1 2 x q2 = 0 a +a a a space x a, x > 0+ q x, t = ቊ a, x < 0 q x, t = ቐ t, a < x t < a a, outside above 40
The Riemann problem Solve for a simple (linear, decoupled) set of equations t q 1 q 2 + u 1 0 0 u 2 x q 1 q 2 = 0 Characteristics lines for q 1 and q 2 41
The Riemann problem for the nonlinear Euler equations (three coupled equations) The classic shock tube problem: quite complex. p(x, t 0 ) ρ x, t 0 v(x, t 0 ) t 0 1) Self similar ( x x 0 ) t 2) 5 regime due to 3 wave characters (note Euler eq. are for 3 variables p, v, ρ) a) Rarefaction fan b) contact discontinuity c) Shock (Rankine-Hugoniot relation) p(x, t 1 ) ρ(x, t 1 ) v(x, t 1 ) t 1 42