[BLANK_AUDIO] Welcome to Sports and Building Aerodynamics in the week on Computational Fluid Dynamics. In this module we'll focus on some aspects of discretization. Let's start again with the module question. Considering the total time that a user of a CFD code spends on his or her simulation and applying best practice, which of these three statements is then correct? A, grid generation is the most time-consuming part. B, turbulence modeling is the most time-consuming part. Or C, postprocessing is the most time-consuming part. Hang on to your answer and we'll come back to this question later on. At the end of this module you will understand some basic aspects of the finite difference method, the control volume method, and the finite element method. You will understand the importance of high-quality grid generation, you will understand how discretization errors can be estimated, and you can understand how grid-convergence studies can be reported. This is a list of references that are definitely recommended reading material. It's not complete but these are definitely four references worthwhile, and I've placed them here in reverse chronological order. There are two types of discretization that we can distinguish. Space discretization and equation discretization. In space discretization, we're going to replace the spatial continuum by a finite number of points or cells, which is called a grid, where the numerical values of the variables will be determined. In equation discretization, we're going to transform the differential or the integral equations, as the case may be, into discrete algebraic equations, that involve the unknowns at the grid points. In terms of space discretization, we distinguish between a structured grid and an unstructured grid. The simple definition is that a structured grid is a grid with a regular topology, where the neighborhood relation between all points is given by a one, two or three dimensional array. And an unstructured grid is the opposite, it's a grid with an irregular topology. And you see a structured and an unstructured grid given here at the bottom of the slide. Then we distinguish between uniform and non-uniform grids. A uniform grid is a grid with an equal spacing between all grid points, which is very uncommon, certainly in Sports and Building Aerodynamics. A non-uniform grid is again the opposite, it's a grid with an unequal spacing between the grid points. And the two examples of grids you see here, are both non-uniform grids. And these are also two practical applications, cycling aerodynamics and building aerodynamics. And again, two non-uniform unstructured grids. High-quality grid generation is very time consuming indeed, but is also very important. And I would like to mention this quote by Hirsch here, stating that grid generation and grid quality are essential elements of the whole discretization process. Not only is grid generation today a most critical element in the cost of running CFD simulations, but more importantly, the accuracy of the obtained numerical results is critically dependent on mesh quality. The accuracy actually is related not only to the size of the mesh, but also the form of the mesh. And of course, as the grid size goes to zero, in the limit of an infinite number of grid cells, well also the discretization error will go to zero. And the pace of this variation, the trend towards zero is given by the so-called order of the numerical discretization. There are different discretization methods that can be distinguished and I'll focus only on three of those here. The finite difference method, the finite volume method, and the finite element method. In the finite difference method, actually the discretization is based on points as you can see here in this simple drawing. The main numerical values are indeed local values at these grid points. The finite difference method is the most traditional, also the oldest method and in practice only applicable to structured grids. The finite volume method, on the other hand, discretizes the continuum space in volumes, sometimes also called cells. It is based on cell-averaged values. This is the most widely applied method in CFD. It actually discretizes the integral form of the equations, and it's a very suitable, and very flexible method for working with an arbitrary mesh. So with complex geometries, as we have in Sports and Building Aerodynamics. The finite element method then, originates actually from the work of structural mechanics. As the finite volume method, it also discretizes the continuous space in elements. But here the main numerical variables are local values at mesh points. It also discretizes the integral form of the equations, and it is also a very suitable, very flexible method for working with an arbitrary mesh. Let's very briefly look at the finite difference method. We can write the first derivative as indicated here. This actually the definition of the first derivative. And if we then focus on this part, we could call this a finite difference approximation of this derivative. We could also obtain that by a Taylor series expansion, as given here. So an expansion of u of x plus delta x, around u of x. It can be rewritten as follows, where you see on the left-hand side the finite difference approximation. On the right-hand side, you see the truncation error indicated, and then indeed this part indicated here, is the approximation to the first derivative of u in x. We can write that also as follows, and then you see that we have actually a truncation error, that is on the order of delta x and therefore, we call this approximation "first order in delta x". Let's assume this horizontal axis where the points are indicated with an index. Going from i minus 2 up to i plus 2, then we can also write this finite difference as follows, so we take the point i and the value at i plus 1. And then the approximation can be given as indicated on the slide, and this is what we call the first order forward difference. As you can see here, this is indeed a first order accuracy. We can also take a backward difference, so we use point i and point i minus 1. It is also first order accuracy. And if we use point i minus 1 and i plus 1 we can derive the formula for the central difference. Which can be shown as here to be second order accuracy. Actually, this procedure can be done for all other derivatives. It can also be done in 2D and 3D based on much more points than the one we have used before. And therefore, very different expressions for finite differences can be derived. An excellent overview of the finite difference method including also the extension to the finite volume method, can be found in this book. What is important is that difference formulae can easily lose at least one order of accuracy and sometimes even two on general non-uniform grids. And therefore guidelines for non-uniform grids are very important. And these grids should actually be smoothly varying grids, with the size variation between consecutive cells that is in the second order of the grid size. We have to avoid discontinuities in grid size of adjacent cells. We should preferably use laws for grid-size variation that are given by analytical, continuous functions of the associated coordinate and we should give particular attention to grid smoothness and density in the regions of the flow where we have strong flow gradients. Let's briefly focus on grid convergence, on the discretization error, and on Richardson extrapolation. Actually what we do with the grid-convergence study, is systematically refining or coarsening the mesh, the grid, by a constant factor, which can be factor of 2, or a factor of square root of 2. And the goal actually in doing this is to obtain a so-called grid-independent solution. This is very schematically indicated here, where you see in the horizontal axis the number of control volumes, if you use the control volume method, or number of cells, and the value of a given variable on the vertical axis. And what we do when refining the mesh is actually getting slightly different, hopefully slightly different values of this variable, that at some point level off or reach an asymptote and actually this asymptote is a so-called grid-independent solution. There is actually a nice approach to estimate a so-called grid-independent solution. And this derivation here is taken from the book by Ferziger and Peric. I will explain it to you from the viewpoint of finite difference analysis but it equally well applies to the control volume method. So let's now assume that capital phi, the Greek letter, is the exact solution of the differential and integral equations, and these are indicated by capital lambda. And let's assume that the small letter phi subscript h is the exact solution of the discretized equations, for a grid with a reference spacing h. And these equations are indicated by the capital letter L with the subscript h. Then we can write, of course, that this exact solution satisfies the differential or integral equations. And that if we use the discretized equations, that if we use the exact solution there that we find a truncation error, indicated by the Greek letter tau with subscript h. And of course, if our numerical solution is exact of these discretized equations, that indeed the solution phi subscript h is a solution of these discretized equations. The difference between the exact solution and the solution that we found, is the so-called discretization error, epsilon. And that's the one that we want to determine. Let's put these three equations at the top of the slide here. Then based on Taylor series expansions we can show that for sufficiently fine grids, the truncation error, and therefore also the discretization error, at any point in the grid, is proportional to the leading term in the Taylor series and that is indicated here. And in this equation the Greek letter zeta actually depends on the derivatives of the variable phi, so the gradients in the flow and this is very important, but it's independent of the grid spacing h. Then you'll also see the grid spacing h in this equation, you see phi, the order of the discretization scheme and h the higher order terms. So let's focus a bit more on this equation. It actually says that when our grid spacing is very small so, h is small, that that is needed when the gradients in the flow, zeta, are large. And vice-versa when the flow gradients are small it is allowed to have a larger grid spacing. So this also means, quite logically, that we need higher grid resolution in areas of large flow gradients. Let's focus on three consecutively coarsened grids as indicated here. And we focus on one point, indicated by the blue dot here, where we have solutions phi_h on the first grid, phi_2h on the second grid, and phi_4h on the fourth grid. And, because indeed, we apply a coarsening factor 2 in both directions. Then we can write that the exact solution is indicated by our approximate solution plus, indeed, the discretization error. But we can write that not only for the first grid, but also for the second one, where we use then 2h. And for the fourth one, for the third one, sorry, where we'll use 4h. And with a little bit of algebra we can actually determine p, the order of the scheme, which is not necessarily the formal order, but this is the real order that we can determine here, which also is a function of the grid spacing, and the discretization error then can be determined as given by this actually very simple equation. There are some important comments to be made here. First of all is that when we know the discretization error, and we sum that up with our approximate solution, then we find the exact solution of this variable, in this particular point. And this is called Richardson extrapolation, because indeed, what we are doing is actually extrapolating towards the asymptote. Three important comments should be made here. First of all, in this derivation we used a coarsening factor two, this coarsening factor can be different, well, in that case, we need to replace this 2 in these equations encircled here by the other value, by the actual coarsening factor. It is important to mention again that the exponent p is the correct order of the scheme, and not the formal order of the scheme. And as you can see from the equation of p, the logarithm means that you can only calculate p when the grid convergence is so-called monotonic. Otherwise you take the logarithm of a negative value which is not possible, so therefore the grids need to be sufficiently fine, and sometimes this is quite demanding. It's also important to uniformly report grid-convergence studies. And this is a paper in which a methodology has been proposed to apply uniform reporting of grid-convergence studies. And I'll very briefly explain what this is about. Well the estimates that we discussed on the previous slides, well they're not really bounds on the discretization error. So what Roache suggested is to use so called a Grid Convergence Indicator to really quantify the discretization error in a CFD simulation. And you see here that is this indicated by the absolute value of the discretization error, multiplied with a safety factor which is 3 for studies with only two grids. So if you refine or coarsen one time, but it can be reduced to 1.25 for, and I quote, scrupulously performed grid-convergence studies with three or more grid solutions to determine the observed order of convergence p. Just as an example this is a paper that reports Computational Fluid Dynamics simulations for cross-ventilation in building aerodynamics that were performed by Rubina Ramponi. And here you see the three grids of the simple generic building model, so, systematically refined. And, then, actually the results were presented with two graphs. On the left side you see the solution of the wind speed ratio inside the cross-ventilated building, and along the center line, you see that for the three grids. But you can also report that with a so-called error band. And this is actually done by using the grid convergence index by Roache. Let's turn back now to the module question. Considering the total time that a user of a CFD code spends on his or her simulation, and applying best practice, which statement is correct? Well, definitely grid generation is the most time-consuming part. In this module, we've learned about some basic aspects of the finite difference method, the control volume method, and the finite element method. We've learned about the importance of high-quality grid generation. How discretization errors can be estimated and how grid convergence studies can be uniformly reported. In the next module, we'll focus on how the complexity of near-wall flow can be taken into account in CFD simulations. On the differences between wall functions and low-Reynolds number modeling, and about the advantages and disadvantages of both approaches. Thank you for watching and we hope to see you again in the next module. [BLANK_AUDIO]