Advanced CFD Methods 1 Prof. Patrick Jenny, FS 2014 Date: 15.08.14, Time: 13:00, Student: Federico Danieli Summary The exam took place in Prof. Jenny s office, with his assistant taking notes on the answers. We were sit at a desk: I answered the question either writing on a sheet or verbally. The oral was divided in two parts: the first one (ca 20min) on numerical methods for solving Navier-Stokes (NE) equations, the second (ca 10min) on conservation laws We start with some initial formalities, and Prof. Jenny actually tries to make you feel at ease. Navier-Stokes PJ: In general, when we want to build a numerical scheme, we wish it to have some basic properties. What are they? FD: Usually we require the scheme to be consistent, stable and convergent. PJ: Is there any relationship between the three? FD: According to Lax theorem, stability and consistency together imply convergence. [More in detail, the theorem states that if a scheme is consistent, then it is convergent if and only if it is stable, but what I answered seemed fine for him] PJ: During the class, we used Von Neumann s analysis to check the stability of a scheme for a scalar advection equation. Assume constant advection speed a, use forward Euler for time discretization and a central difference (CD) scheme for space discretization: show me if CD is stable or not, and under which conditions. FD: I start writing down the problem equation: Its discretization looks like: u n+1 i t u + a x u = 0 u n ( i u n + a i+1 u n ) i 1 = 0 Where u n+1 i is the approximation of u(x i, t n ). Adding an error in the form ε = ε n e iωx i, and using the equation above, we get: ε n+1 ε n e iωx i + aε n e iωx i+1 e iωx i 1 = 0 εn+1 ε n Now we require that the norm of the error decreases in time: ε n+1 ε n 1 < 1 ( a e iω x e iω x) < 1 1 + a ( e iω x e iω x) = 0 1
The stability region in the complex plane is as in the figure above. [Actually at first I thought it was an horizontal line, so I said that for some ω we could actually get stability (which doesn t mean the scheme is conditionally stable, though...); he made me realize it was vertical instead, hence it is easy shown that CD is unconditionally unstable, since the line does not reside inside the circle for any value of the parameters]. PJ: What about the Upwind (UP) scheme? FD: Similar analysis shows that UP is conditionally stable, under the CFL condition. PJ: Can you write the CFL condition for both NS equation (without considering diffusion) and a conservation law? FD: In the first case, it looks like: u < x In fact for NS the advection speed is u itself. For a conservation law we require something similar, i.e. that λ < x Where λ is, more in general, the eigenvalue of the Jacobian of the flux. PJ: Can you express those eigenvalues in the case of Euler equations? FD: They are u + c, u and u c, being c the speed of sound. PJ: So now let s say you have to decide whether to use Euler or NS equations for solving a flow moving at Mach number M = 0.01. What are the maximum you could use in the two cases? FD: CFL conditions for NS and Euler requires that: NS < x u E < x u + c Here I assume the largest eigenvalue in absolute value to be u + c, so this is the one that provides the strictest condition on E. Applying the definition of Mach number, we get: NS x(u + c) < = u + u M E x(u) u 1 MSc Computational Science and Engineering, Field of Specialization = M + 1 M = 101 2
PJ: So which one would you choose? FD: Definitely NS, since it allows me to have a (much) larger time step. PJ: What are the differences between implicit and explicit time integration schemes? In particular, consider the case of NS equations. FD: The main advantage of explicit methods is that they come cheap: we can get u n+1 based on values of u n, p n, which are all already known. So, at each iteration, we just have to solve a Poisson equation for finding p and then update for getting u. On the other hand, implicit methods express u n+1 in terms of u n+1 itself, which is of course not known; we then need to solve another equation for evaluating u n+1. The cost per iteration increases, since this time we need to solve two equations. The advantage of implicit methods lies in the fact that they are more stable, and thus often allow much larger timesteps than explicit methods: the trade-off is then between choosing to do more steps that cost less, or fewer steps that cost more. Of course this depends on the problem we are facing: if CFL conditions are not too strict, then explicit schemes become very attractive. In particular, the cost related to implicit methods might explode if the equation for u n+1 is non-linear (which is the case for NS); one way to overcome this, is by linearizing the equation. In case of NS, we can do this by splitting u n+1 in u n + u. We can then neglect the term u 2 which arises from the non-linear advection term (doing this we introduce an error which is of higher order than the one related to the scheme, so it s no big deal), and thus obtain a linear equation for u n+1. This will still depend on p n+1, though, but given the linearity of the equation, we can leave that term aside at the beginning, get an intermediate solution u, use this to get a Poisson equation for p, and then update both pressure and velocity. PJ: How can we proceed instead in the case of a stationary problem? FD: The idea is to get the solution by using an iterative method: we can then conduct a similar analysis as in the transient case, but this time u will be defined as difference between iterations, and not time steps. Again, we can neglect the non-linear term, and perform some splitting for dealing with the pressure term. The way we do this splitting defines the method: for example SIMPLE, SIMPLEC, and so on. PJ: Going back to the beginning: how can we approximate advection terms in collocated meshes? What are advantages and limitations of the schemes we studied? FD: The schemes we saw were CD, UP, QUICK and MUSCLE. CD approximates the flux F AB through the surface between cells I and I + 1 as an average of the fluxes in the two cells: F AB = F (u I)+F (u I+1 ) 2 ; this provides a second order approximation but, as seen before, it is unconditionally unstable. UP instead takes the flux coming from the upstream cell, with respect to the advection speed; it is conditionally stable, but first order only, and it tends to smear out the solution (it adds numeric diffusion). QUICK tries to solve UP downsides: it uses a three-cells stencil, so to reach second order, but it tends to create oscillations in the solution; moreover, it can only be used in a cartesian grid. Last but not least, MUSCLE employs a reconstruction of u at the interface that makes use of the minmod function; it is quite hard to define its order, though: globally it should be second order, but locally it might reduce to UP scheme. This is done in order to prevent oscillations. 3
PJ: You said UP depends on the direction of the advection speed. How is that defined? and what if the problem is non-linear? Since it should vary depending on the cells, how can we get a value at the surface? FD: The advection speed is defined as the derivative of the flux with respect to u: a problem in the form t u + x F (u) = 0 can be written as t u + u F x u = 0 and u F is the advection speed. In non-linear problems, we could just interpolate its value across the cells to get it at the surface. Conservation Laws methods? PJ: Now let s switch to the second part. What can you tell me about Godunov FD: Again, the main issue is to find a way to evaluate the value of the flux at cells interface. Godunov methods take that as F (u m ), where u m is the value of u at the interface. It is found by assuming the solution u piecewise constant inside a cell, and by solving a Riemann problem. Since this method is just first order, the effort of solving this problem exactly is futile, so usually an approximate Riemann solver is chosen. PJ: I now want to choose an all-shock solution for the Riemann problem: how do I proceed? (assume a 2D problem in one dimension) FD: I start drawing the points u l and u r on the phase plane, and the two shock curves passing from each of them. The point where they intersect gives the u m we need. PJ: But they intersect in two different points: how do you know which one is the correct u m? FD: We place ourselves at u l : we know that the two shock curves leaving from there are tangent to the eigenvetors evaluated at u l. These two eigenvectors correspond to two different eigenvalues: we have to ride first the curve that is tangent to the eigenvector that corresponds to the smaller eigenvalue. [We argue a bit about this, I don t know if there s been a misundestanding somewhere, or if I missed something, but he just lets go after a while]. PJ: Do you always care about evaluating u m? FD: Not really: depending on the value of the eigenvalues (which defines the inclination of the characteristics), we can divide the space-time plane in three different regions, where the solution has value u l, u m or u r respectively. If the time axis lies on the u m -region, then we have to evaluate that. PJ: And what if you find out that one of the shock is non-entropic? FD: Then in the phase place we have to ride a Rarefaction curve instead; that is defined as the curve that is tangent in each point to the eigenvector (that s why it s also called integral curve). PJ: [Realizing 35 minutes had passed already] Ok, that s enough 4
Final Remarks It looks like he really cares about the maths we did throughout the course, so I suggest double-checking proofs and definitions. Also, Prof. Jenny usually holds a strange cold gaze during the whole exam, so you never know whether your answer suits him or not. Hence, don t worry if he shows no signs of approval when you answer: if something is amiss, he just tells you. Expected mark: 5.75 Received mark: 6.0 5