Computational Fluid Dynamics! http://www.nd.edu/~gtryggva/CFD-Course/! Grétar Tryggvason! Spring 2011! 4! Computational Fluid Dynamics! Motivation and Goals! Cavitation! Computational Fluid Dynamics! Outline! Motivation! ! Governing Equations! ! The One-Fluid Approach! ! Numerical approach! ! Advecting the Marker Function! !VOF; LS; FT; Other; Tests! ! Surface Tension! Methods to Track Moving Fluid Interfaces! 3! 2! Microstructure! Bubbly Flow! Computational Fluid Dynamics! Motivation and Goals! The goal is to simulate accurately the smallest continuum scales for multiphase systems that are sufficiently large so that meaningful averages can be obtained and the results used to help generate insight and closure models for engineering tools Example: The two-fluid model Equations for the average motion of each constituent ! " p # p + $ % (" p # p u p ) = m˙ p !t ! (" p # pu p ) + $ % (" p # pu pu p ) = &" p$pp !t +$ % (" p µ p D p ) + " p # p g + $ % (" p # p < uu >) + Fint Atomization! 5! Splash! Reynolds stresses School of fish! Computational Fluid Dynamics! Numerical Method! 6! interfacial forces Computational Fluid Dynamics! CFD of Multiphase Flows—one slide history! BC: Birkhoff and boundary integral methods ! for the Rayleigh-Taylor Instability! ! 65 Harlow and colleagues at Los Alamos: ! The MAC method! ! From: B. Daly (1969)! 75 Boundary integral methods for Stokes flow and potential flow ! ! 85 Alternative approaches (body fitted, unstructured, etc.)! ! 95 Beginning of DNS of multiphase flow. Return of the one-fluid approach and development of other techniques! Governing Equations 1 7! 8! Computational Fluid Dynamics! Governing Equations! Conservation of mass : !" + # $ ( "u) = 0 !t Sharply stratified flows D! + !" # u = 0 Dt The conservation equations for mass and momentum apply to any flow situation, including flows of multiple immiscible fluids. Incompressible flows: D! =0 Dt Computational Fluid Dynamics! Governing Equations! Each fluid generally has properties that are different from the other constituents and the location of each fluid must therefore be tracked. !"u=0 Navier-Stokes equations (conservation of momentum) We usually also have additional physics that must be accounted for at the interface, such as surface tension. !"u + # $ "uu = " f + # $ T !t ! "u + !u#u = $#p + ! f b + # % µ(#u + # T u ) "t 9! The regular conservation equations can be extended to handle these situations by using generalized functions 10! Computational Fluid Dynamics! H (x, y,t) = !H = The One-Fluid approach! $ A Computational Fluid Dynamics! Governing Equations! # A(t ) s ! (x " x ')! (y " y')da ' ![" (x # x ')" ( y # y ')]da ' = # $ !'[" (x # x ')" ( y # y ')]da ' A! S! x S !H + u "#H = 0 !t S S Using:! = #" (n)n 12! Computational Fluid Dynamics! Governing Equations! Conservation of Momentum! ! !"u =0 Singular interface term! Equation of State:! D! Dµ = 0; =0 Dt Dt # "V Incompressible flow! ! Oscillating drop: pressure! The conservation equations are solved on a regular fixed grid and the front is tracked by connected marker points. ! The one fluid formulation of the conservation equations is the starting point for several numerical methods, including MAC, VOF, level sets, and front tracking.! Computational Fluid Dynamics! Governing Equations! Du dv = $ #"V %pdv + Dt =0! Constant properties! ! (x " x')! (y " y') = ! (s)! (n) The one-fluid formulation implicitly contains the proper interface jump conditions. Integrating each term across a small control volume centered at the interface:! "u + !# $ uu = %#p + f + # $ µ(# u + # T u ) + ' F &( n) ( x % x f ) da "t Conservation of Mass! H=0! A = # $ " (x # x ')" ( y # y ')nds' 11! H=1! y = #! $ " (x # x ')" ( y # y ')nds' = # $ " (s)" (n)nds' n [ p]n # "V fdv + =0! # "V % & µ(% u + % T u ) dv + # "V [µ(! u + ! u )]n T '( n" ( n ) dv !" n Jump Condition:! [! p + µ(" u + " u )]n = !#$n T 2 13! 14! Computational Fluid Dynamics! Governing Equations! Computational Fluid Dynamics! We can also show that the one-fluid formulation contains the equations written separately for each fluid and the jump conditions: Numerical Solutions u = H1u1 + H 2u 2 P = H1 p1 + H 2 p2 ! = H1!1 + H 2 ! 2 Write: Substitute into the momentum equation H1 (………) + H 2 (………) + ! ( x f )(………) = 0 =0 Momentum equation in phase 1 15! =0 Momentum equation in phase 2 =0 Interface conditions 16! Computational Fluid Dynamics! Discretization in time Summary of discrete vector equations Work with the finite volume approximation ! "u dv + !# "u(u $ n)ds = !t # Evolution of the velocity—first order explicit in time: # " f dv + !# µ (%u + % u) n ds + # T V &' n( ( n ) dv Discretize each term 1 u= V Ac = Dc = ! h "u V 1 1 ! " ( uu ) dV = ! u ( u " n ) ds V V# V #S ) ( ) 18! Computational Fluid Dynamics! Discretization in time The momentum equation is solved in two steps n utmp 1 i, j ! u i, j = !A ni, j + fbn + n (Dni, j + f$n ) "t # and n +1 ui, j ! utmp 1 i, j = ! n $ h pi, j "t # Projection Method To derive an equation for the pressure we take the divergence of the second equation and use ! h "u ni ,+1 . The result is: j =0 0 &1 ) tmp ! h " uni, +1 j = ! h " u i, j # $t ! h " ( n ! h pi, j + '% * $1 ' 1 ! h " & n ! h pi, j ) = ! h " utmp i, j %# ( *t n +1 i,j =0 No explicit equation for the pressure! 1 1 ! " µ ! hu+!Th u dV = ! µ ! hu+!Th u n ds V V# V #S 17! n uni, +1 1 j ! u i, j = !A ni, j ! n ($ h p + Dni, j + f%n ) + fbn "t # Constraint on velocity ! udV ( Computational Fluid Dynamics! Discretization in time u= 1 V ! udV V 1 Ac = V Dc = 1 V = 1 # ! " (uu )dV = V # u (u " n)ds V S # ! " µ(! u + ! u )dV T h h V 1 V # µ(! u + ! u )nds h T h S Computational Fluid Dynamics! Discretization in time 1. Find a temporary velocity using the advection and the diffusion terms only: % n ( 1 n n utmp (Dni, j + f$n )*) i, j = u i, j + !t' "A i, j + fb + #n & 2. Find the pressure needed to make the velocity field incompressible $1 ' 1 ! h " & n ! h pi, j ) = ! h " utmp i, j %# ( *t 3. Correct the velocity by adding the pressure gradient: "t $ h pi, j #n 4. Update the marker function to find new density and viscosity tmp uni, +1 j = u i, j ! 3 19! 20! Computational Fluid Dynamics! Computational Fluid Dynamics! Governing Equations! Identify each fluid by a marker function H Advecting the marker function! ! 1 in fluid 1 H =" #0 Otherwise The marker moves with the fluid and is updated by integrating the following advection equation in time !H + u " #H = 0 !t 21! 22! Computational Fluid Dynamics! Advecting the Marker Function The sharp marker function H can be approximated in several different ways for computational purposes. Below we show a smoothed marker function, I, the volume of fluid approximation, C, and a level set representation, Φ. ! Updating H—in spite of its apparent simplicity—is one of the hard problems in CFD! Computational Fluid Dynamics! Advecting the Marker Function In 1D, using upwind and LW.! The solution quickly deteriorates.! Modern advection methods help, but not completely.! 23! 24! Computational Fluid Dynamics! Advecting the Marker Function Volume of Fluid! Computational Fluid Dynamics! Advecting the Marker Function To advect a discontinuous marker function, first consider 1D advection. Using simple upwind leads to excessive diffusion due to averaging the function over each cell, before finding the fluxes! Upwind 4 25! 26! Computational Fluid Dynamics! Advecting the Marker Function Since the marker function only takes on two values, 0 and 1, the advection can be made much more accurate by reconstructing the function in each cell before finding the fluxes, integrated over time:! Computational Fluid Dynamics! While VOF works extremely well in one-dimension, there are considerable difficulties extending the approach to higher dimensions. The basic problem is the reconstruction of the interface in each cell, given the volume fraction in neighboring cells. ! ! In the SLIC method the interface was taken to be perpendicular to the advection direction.! ! One-dimensional Volume-Of-Fluid! In the Hirt/Nichols method the interface was taken to be parallel to one axis. ! ! In PLIC the interface is a line with arbitrary orientation.! ! Once the interface has been reconstructed, the marker function is advected by geometric considerations! 27! 28! Computational Fluid Dynamics! Original! Computational Fluid Dynamics! Level Set Methods! SLIC! Hirt/Nichols VOF! 29! PLIC! Computational Fluid Dynamics! Identify the interface as a level-set of a smooth function! Advect the level set function by! use! to get! 30! Computational Fluid Dynamics! The level set function can be arbitrarily smooth. To identify each fluid it is necessary to construct a marker function with a narrow transition zone! I (! ) The marker function can be generated by (for example):! ! The delta function is generated as the derivative of the marker function ! 5 31! 32! Computational Fluid Dynamics! Computational Fluid Dynamics! For most applications, the shape of the level set functions must remain the same close to the interface! The level set function for two circles, as a distance function! To keep the interface shape the same, it is necessary to reinitialize the level set function. This is usually done by making it a distance function.! 33! 34! Computational Fluid Dynamics! At each time step, solve:! Computational Fluid Dynamics! Numerical Method! Front Tracking (Unverdi & Tryggvason, 1992) ! Fixed grid used for the solution of the Navier-Stokes equations. Relatively standard explicit finite volume fluid solver! Front-Tracking Methods! Tracked front to advect the fluid interface and find surface tension! The method has been used to simulate many problems and extensively tested and validated.! See also Tryggvason et al. (2002) for details, tests and applications! 35! 36! Computational Fluid Dynamics! Interpolating from grid! The velocities are interpolated from the grid:! ! l = " ! ijk w ijk Computational Fluid Dynamics! Numerical Method! Finite Difference Grid! Tracked Front! The front values are distributed onto the grid by! !ijk = " !l wijk #sl h3 On the front: per length! On the grid: per volume! the weights wijk can be selected in several different ways! 6 37! Computational Fluid Dynamics! 38! Computational Fluid Dynamics! The phase field Method (Jacqmin)! Phase Field Methods! Solve modified Navier-Stokes equations, developed by thermodynamic considerations at the microscale! and! The energy function can take several different forms, for example, if:! and! Then it can be shown that surface tension and interface thickness are:! and 39! Computational Fluid Dynamics! Advecting the Marker Function 40! Several other methods have been developed to improve the performance of those described here, including hybrid methods, such as Particle Level Set and VOF-LS, as well as methods that capture the interface more sharply, such as the Ghost Fluid Method and the Immersed Interface Method. Computational Fluid Dynamics! Standard Tests for advection! Similar approach has also been used to capture rigid and elastic boundaries, both moving and stationary. 41! Computational Fluid Dynamics! Advecting the Marker Function 42! Computational Fluid Dynamics! Advecting the Marker Function From W. J. Rider and D.B. Kothe. Reconstructing volume tracking. Los Alamos National Laboratory Report la-ur-96-2375. Technical report, 1996! Zalasak s test: A notched circular blob is advected by a solid body rotation, measuring how the blob deteriorates! Markers! High order advection (PPM)! Level Set! PLIC! 7 43! 44! Computational Fluid Dynamics! Surface Tension Computational Fluid Dynamics! Surface Tension In addition to advect the marker function accurately, we must often account for physics unique to the interface. The most common example is surface tension. x ( u,v ) = ( x ( u,v ), y ( u,v ),z( u,v )) Tangent vectors xu = 46! Computational Fluid Dynamics! Singular interface forces are approximated by a smoothed delta function that becomes more singular as the smoothing is reduced !H + u " #H = 0 !t ! A"0 !# m ds Stationary drop! Weak parasitic ! currents! ! h p + f"n = 0 48! fij = (!" ) ij #Iij Curvature and normal vector computed directly on the fixed grid—marker function! fij = (!" ) ij #Iijf Curvature and normal vector computed on the front, distributed to the fixed grid —our original approach! fij = (!" ) ij #Iij Curvature computed on the front, distributed to the fixed grid. Normal vector computed on the grid! The last approach seems to combine the accuracy of tracking with the possibility of balancing pressure exactly! Computational Fluid Dynamics! Numerical Method—Surface Tension! For the solution of the Navier-Stokes equations, we need the net force on each front segment:! Surface tension can be added in several ways:! f kn = lim Computational Fluid Dynamics! Numerical Method—Surface Tension! Parasitic Currents! ! The regular grid induces a small anisotropy. These currents are typically small in immersed boundary methods.! Computational Fluid Dynamics! Numerical Method—Surface Tension! f and m At steady state the pressure gradient should be balanced by surface tension! k = !" # n 47! t v const. It can be shown that: k = !" # n 45! n xv xu ! xv xu ! xv n= xu u const. !x !x ; xv = !u !v Normal to the surface Definition of a surface s 1! -s2! !n = n! "s "s s! m=s x n! !ff = !ff = % ( " (s & s ) 2D 2 1 * "# n ds = ) $S " s ' n ds 3D * ! %S + The force can be distributed directly to the fixed grid. Or, we can distribute only the magnitude and find the normal on the grid ! %$S "# n ds & "# n$s the grid using! (!" )ij = Distribute to $ (± # f p front )w p ij $ %s w p p ij front 8 49! Computational Fluid Dynamics! Although methods based on the one fluid formulation have been used successfully for many problems, several challenges remain. These are slowly being eliminated • High Reynolds numbers: high order advection methods and non-conservative form of the advection terms • Continuity of the viscous stresses: interpolation using the harmonic mean • Solution of the pressure equation/slow convergence at high density ratios: More advanced fast solver • Parasitic currents: increased smoothing helps—or separate computations of the curvature and the normal 9