Finite difference methods for the Navier-Stokes equations Magnus Svärd School of Mathematics University of Edinburgh NAIS Centre for Numerical Algorithms & Intelligent Software A challenging flow problem [SR-71, shock diamonds] I I I Shocks Turbulence Sound propagation NAIS Centre for Numerical Algorithms & Intelligent Software The Navier-Stokes equations Conservation form: ∂ρ ∂ρuj + =0 Mass ∂t ∂xj ∂ρui uj ∂ρui ∂p 1 ∂τij + + = Momentum ∂t ∂xj ∂xi Re ∂xj ∂ρ(E + p)uj ∂qj ∂ρE 1 ∂uj τij + = + Energy ∂t ∂xj Re ∂xj ∂xj Equation of state: E = I I Re-Reynolds number Ma-Mach number T 1 + uj2 γ(γ − 1) 2 NAIS Centre for Numerical Algorithms & Intelligent Software Objectives Make a robust and accurate predictive tool for aerodynamics... Multiblock high-order finite difference method. I Linear stability for initial-boundary value problem. (Done) I Non-linear stability and shock capturing. (In progress...) NAIS Centre for Numerical Algorithms & Intelligent Software A linear model problem ∂u ∂u + = 0, t ≥ 0, ∂t ∂x u(0, t) = g (t) 0≤x ≤1 u(x, 0) = f (x) Energy method: Z 1 Z 1 ∂u dx = ∂x 0 0 u(0, t)2 − u(1, t)2 = g (t)2 − u(1, t)2 kuk2t =2 uut = −2 u Bounded growth. NAIS Centre for Numerical Algorithms & Intelligent Software Well-posedness A bound on the solution is the key to prove well-posedness: I Uniqueness I Existence I Stable to perturbations NAIS Centre for Numerical Algorithms & Intelligent Software Summation by parts (SBP) (Kreiss&Scherer -74) Idea: Mimic the continuous energy estimate. (FEM) Grid: ih, i = 0...N, h is the grid size. Semi-discretization: v T = (v0 (t), v1 (t), ...vN (t)). Derivative approximation: Dv = vx + O(hp ). I D = P −1 Qv I Q + Q T = diag (−1, 0, ..., 0, 1). I kv k2P = v T Pv , P diagonal positive definite. Truncation errors are 2p in the interior and p near the boundary. Convergence rate: p + 1. NAIS Centre for Numerical Algorithms & Intelligent Software Energy estimate Semi-discretization of PDE: vt + P −1 Qv = 0 Energy estimate (kv k2P )t = v T Pvt + vtT Pv = −v T Qv − v T Q T v = v02 − vN2 How do we impose the boundary condition? NAIS Centre for Numerical Algorithms & Intelligent Software Weak imposition of boundary conditions (Carpenter et al -94) Simultaneous Approximation Term - SAT - Penalty Term E0 = diag (1, 0, ...., 0)T vt + P −1 Qv = σP −1 E0 (v − g ) P −1 ∼ 1/h. Dirac mass enforces the boundary condition. Energy method: (kv k2P )t = v02 − vN2 + 2σv0 (v0 − g (t)) Stable if σ ≤ −1/2. stable + accurate ⇒ convergent approximation NAIS Centre for Numerical Algorithms & Intelligent Software 1-D Navier-Stokes equations In 1-D the system takes the form: ut + (F I − 1 V F )x = 0, Re 0≤x ≤1 with 3 independent variables. Linearize, symmetrize and freeze coefficients: wt + Awx = 1 Bwxx , Re 0≤x ≤1 (1) where A, B are symmetric. B does not have full rank. If (1) is well-posed, then the non-linear problem is well-posed for small perturbations to smooth solutions. NAIS Centre for Numerical Algorithms & Intelligent Software Energy estimate Ignoring the right boundary... Z 1 Z 1 1 2 wBwxx dx kw kt + 2 wAwx dx =2 0 0 Re Z 1 1 T 2 2 kw kt + 2 wx Bwx dx =w0T (Aw0 − B(wx )0 ) Re 0 Re With standard assumption on the Lame’ coefficients B is positive semi-definite and the quadratic term is dissipation. NAIS Centre for Numerical Algorithms & Intelligent Software Energy stability for... I SBP-SAT finite difference up to order 5. I Multi-D. I Curvilinear grids I Multi-block grids I Wall, far-field, pressure outflow boundary conditions. I SBP artificial diffusion. NAIS Centre for Numerical Algorithms & Intelligent Software Flow around circular cylinder y 20 0 -20 -20 0 20 40 x (b) Ma = 0.1, Re = 100, 5th-order scheme Correct prediction of: I Lift I Drag I Strouhal (shedding frequency) I Separation angle. NAIS Centre for Numerical Algorithms & Intelligent Software Delicate benchmark case (Re=5000,Ma=0.5, 3rd-order scheme) y 0.05 0 -0.05 0.85 Separated but steady flow. 0.9 0.95 1 x 1.05 1.1 1.15 NAIS Centre for Numerical Algorithms & Intelligent Software Further benchmarking... Linear theory is reasonably complete but turbulence computations have not been done. (Apart from a low-order FV code.) I Turbulence in a box. I Cylinder Re = 3900 I Backward facing step/Cavity at high Reynolds numbers. High-order finite difference schemes are, by some, considered ill-suited for turbulence computations. NAIS Centre for Numerical Algorithms & Intelligent Software HPC challenges. I I I Turbulence computations are very, very large. Explicit time stepping scheme are easiliy parallelized and gives good load balance. Effective enough? Scalability on a large number of processors? Future developments: I Add openMP to existing MPI code. Easier to construct grids. I Dynamic load balancing, or at least automated split onto processors during initialization. I GPUs? I I I Relatively easy (?) to port the main interior computations to CUDA. Much logic in the boundary treatment that must be handled by CPU. Load balance?? Will the CUDA routines run independently or will there be a lot of communication between GPU and CPU? NAIS Centre for Numerical Algorithms & Intelligent Software Non-linear stability theory and boundary conditions. I Linear stability gives a robust scheme for smooth flows. I When shocks develop the theory breaks down and solution usually explodes. (It is not the discontinuity per se that is the problem. Contact discontinuities may be stable.) I Linear schemes have an inherent ambiguity in the enforcement of boundary conditions. NAIS Centre for Numerical Algorithms & Intelligent Software Conservation Laws and Weak Solutions A system of conservation laws in multi-D. ut + d X fi (u)xi = 0, u(x, 0) = u0 (x) i=1 A weak solution u satisfies: Z Z Z uϕt + f (u)ϕx dxdt + u0 (x)ϕ(x, 0)dx = 0, R+ R R for all ϕ ∈ Co∞ (R × R+ ) (Scalar, 1-D) NAIS Centre for Numerical Algorithms & Intelligent Software Entropy pairs and uniqueness I Entropy pair: (U, Q) such that Q 0 = U 0 f 0 and U is strictly convex. I u ∈ L1loc (R × R+ ) is the unique entropy solution if: Z Z U(u)ϕt + Q(u)ϕx dxdt ≥ 0. R+ R for all 0 ≥ ϕ ∈ Co∞ (R × R+ ) for all (U, Q) NAIS Centre for Numerical Algorithms & Intelligent Software Entropy stability 1. Cell entropy inequality. 2. A priori bound on global entropy. I For linear problems, entropy and energy stability are the same. I For scalar conservation laws, entropy stability implies convergence to weak entropy solution. For systems, entropy stability is not sufficient for stability. I I I For Navier-Stokes, positivity (of density and pressure) is required. Stability does not imply convergence to entropy solution. (Indeed, the solution has not been proven to exist.) NAIS Centre for Numerical Algorithms & Intelligent Software Boundary conditions (mathematical results) Scalar conservation law in 1-D with entropy pair (U,Q).: ut + fi (u)x = 0, u(x, 0) = u 0 (x), u(0, t) = g (t) (”if inflow ”) (Du Bois and Lefloch) With convenient stability assumptions: Q(u) − Q(g ) − Uu (g )(f (u) − f (g )) ≤ 0. Entropy inequality: Ut + Qx ≤ 0. Integrate in space: Z ∞ Ut dx = Q(0, t) 0 I I I I U bounded if Q(0, t) bounded by data. No boundary condition for Q(0, t). Requires a strong coupling between flux and entropy flux. Generally not the case. Does entropy stability imply boundary inequality? NAIS Centre for Numerical Algorithms & Intelligent Software Conclusions I SBP-SAT schemes have been successfully used to compute linear problems with low Reynolds number I Turbulent benchmarks are up next...Challenging from HPC and grid generation perspective. With entropy stability. I I Boundary conditions clearly defined for conservation laws. Benchmarking I I Strong shocks. High-speed flow past cylinder. Shock-turbulence interaction. NAIS Centre for Numerical Algorithms & Intelligent Software