This action might not be possible to undo. Are you sure you want to continue?
5 Numerical Methods
This chapter is a general introduction to numerical methods. It explains the main features of the different approaches and defines the important terms and concepts. This should also give a basis for the correct choice and the proper use of commercial software.
Due to the rapid developments in the field of computer technology, computing capacities are available to the user today, which just a few years ago were possible only on a super computer. This computing capacity allows us to use numerical solutions, where in the past estimates obtained via simplified approaches had to be used. In the field of flow calculations, the term "Computational Fluid Dynamics" (CFD) is often used. CFD deals with the numerical solution of partial differential equations (PDG) in the area of fluid mechanics, i.e. with the Navier Stokes-, Reynolds- or shallow water equations, among other things. For the solution of these differential equations, mainly three different methods are used: the Finite Differences method (FD), the Finite Volumes method (FV) and the Finite Elements method (FE).
To allow for the numerical solution of the PDGs, in a first step the computational domain in space and time has to be divided into smaller subdomains. This procedure is called discretization. It is necessary to reduce the infinite number of degrees of freedom of continuous equations to a finite number, which can be handled by the computer. The finer the discretization into smaller domains, the smaller is the approximation error. There are different ways to discretize the computational domain. Not necessarily, but often the choice of the discretization method depends on the computational method. The aim of the following paragraphs is not so much to explain the discretization methods in detail, but rather to present the different approaches and outline their advantages and disadvantages. We start with the spatial discretization. We distinguish between structured and unstructured grids. 5.2.1 Structured grids
Structured grids are the simplest grids that can be used for the discretization of a rectangular domain. They can be characterized by the fact that the number of subdivisions in one direction, independently of the number of subdivision in another direction, is always constant, i.e. a 2D grid has a certain amount of cells nx and ny in x and y direction. Therefore, each cell in the computational grid or every calculation node can be identified unambiguously using two indices (for a 2D grid). Structured grids can be further subdivided into: • Regular grids, where the cell length in each direction is always constant • Orthogonal grids, where the grid lines in the different directions are normal to each other and • Curvilinear grids, where the grid lines can be arbitrary curves in space
5-1: Different types of structured grids. and especially regular structured grids are very suitable for the FD-method. The main disadvantage of structured grids is that they are not flexible enough to discretize complex domains.3 Unstructured grids Unstructured grids are the most complex to generate. the passage from one block to the next requires special treatment. This is also of advantage for computation times. 5. On each individual block of a multiblock grid the computation is done exactly as it is done on a structured grid. curvilinear grid (C) and orthogonal.5-2 Lecture Notes Numerical Hydraulics Fig. the nodes . Thanks to the properties of this type of grid.2. However. 5-2: Multiblock grid consisting of 2 blocks. curvilinear grid (D). Therefore it is no more possible to identify a cell using two (2D) or three (3D) indices only. the derivatives in all spatial directions can be determined well. Hence they combine the advantages of structured grids and avoid their rigid flexibility constraints. but on the other hand they offer the highest flexibility. regular and orthogonal grids (A and B). since the nodes of a cell and its neighbours are straightforwardly determined using their indices. Fig.2 Multiblock grids Multiblock grids are a combination of many blocks. Structured.2. without a need for coordinate transformations. A great advantage of the structured grids lies in the small storage requirements. On an unstructured grid the number of neighbours of a cell is variable. where each individual block is structured. Moreover. The laborious calculation of contributions to a node from neighbouring cells is not necessary and the structure of the solution matrix is known in advance. 5.
After that. maximize the cell area. For more complex domains with a large number of cells this would be too time consuming. An unstructured grid must contain at least two types of information: All nodes and their coordinates. Unstructured grids have the disadvantage of requiring significantly higher computation time.. the advantage that they can be refined locally. Algebraic grid generators create cells by using algebraic relations. because they influence the solution at the boundary and . however. e.g. Alternatively there are grid generators. Unstructured grids are mostly used in conjunction with the finite elements method. the initial conditions have to be specified. which require only a small number of cells. etc. The numerical solution of the problem is significantly influenced by boundary and initial conditions. i.4 Grid generation For simple domains. Such a tool is called grid generator.2. as explained above. 5-3: Unstructured grid. a PDG is solved over the domain with the use of a numerical method. They have. Therefore tools are used.3 Boundary and initial conditions To allow for a numerical treatment. for a given domain contour automatically subdivide the domain into cells. angle criteria. 5. the grid generation can eventually also be done by hand. Even the best numerical algorithm will not help much. Hereby they take different criteria into account. which solve PDGs to subdivide the domain. Partly they are also employed in the FV method. also boundary conditions in time. Depending on the type of PDG used. which. For an unsteady problem.Lecture Notes Numerical Hydraulics 5-3 forming a cell are not known a priori. and all cells and the related information. which nodes constitute each individual cell. An unambiguous solution of the PDG is only possible provided that boundary conditions are specified. Fig.g. but they have to be identified. where the boundary coordinates of the new domain are the boundary conditions of the PDG. e. 5. in addition to the boundary conditions. the grid generators are denominated accordingly. elliptic grid generators use an elliptic PDF like the Poisson equation. when boundary conditions are not specified appropriately. The procedure is that a simple initial grid is transformed over the complex domain by solving a PDG.e. respectively. first of all the domain has to be discretized.
Φ(x=0) = Φ(x=1) = 0. The algebraic expressions are derived assuming a distribution between the unknown node-variables. Without outlining this for now in detail. namely the Poisson Equation (e. Often it is then meaningful to start from a known initial condition.g. Since the assumed distributions are typically simple expressions. typically very different correspondence with reality was achieved. This approach is known as discretization. Since the focus is on variables to be determined at a finite number of nodes. In addition we assume homogeneous boundary conditions on both sides. numerical techniques prescribe a discrete number of grid points for the unknowns and solve the algebraic equations using a numerical algorithm. respectively. because only a final steady situation is of interest. However. In so-called blind tests. which can for example be a flow at rest. so that this constraint does not imply any limitation as far as practical questions are concerned.2 above. to illustrate the application of the different discretization methods and related equations. groundwater flows). it can be mentioned that for the finite differences method the differential form of the PDGs is used. as explained in Section 5. their number can be chosen arbitrarily high. What this means more precisely will be explained in the following on the basis of a concrete example. whereas the finite volumes method uses the integral form and the finite elements method uses the weak integral form. . one-dimensional problem. Obviously. i. As mentioned. Often. In both cases only a limited number of flow quantities can be measured or calculated. the initial condition is of secondary importance. As for the initial conditions. However. Such a subdomain is termed element and the subdivision that leads to such elements is called space discretization. their validity is obviously restricted to a small subdomain. where primary unknowns are measured via probes in a limited number of points. In this case it is important to set physically meaningful initial conditions. especially when the temporal evolution of the flow has to be correct from the beginning.4. Different from experimental investigations. the type of equations used for the approximation of the distribution of the variables within the elements depends on the discretization method. The type of distribution depends on the discretization method. especially for the case of nonlinear flow problems. a discontinuous distribution of variables replaces the continuous one. using the same program.1 Basic principles Numerical methods for the calculation of flows can be compared to experimental investigations.g. 5.2 Example We use a simple. Up to now we have treated the discretization method in a rather general way. 5.4. e. the situation is somewhat different. the velocity potential.5-4 Lecture Notes Numerical Hydraulics often even deep into the computational domain.e. The Poisson equation has the following form: − ∂ 2Φ = f ∂x 2 (5-1) where Φ represents. which are contests where numerical modellers calculate flow problems without knowledge of the measured data. the flow “forgets” the initial condition after some time. depending on the ability of the modeller to set the boundary conditions adequately. they have to be specified correctly.4 Numerical methods 5. so that the solution does converge.
e. 5-4. higher order terms are neglected. By doing so.3 Finite Differenzes method 5-5 The finite differences method uses the differential form of the equations. the first diagonal below this. For the FD these equations are approximated by a Taylor expansion.. in other words. where point two lies between points 1 and 3.. Depending on the accuracy requirements. one can infer that the estimate of the error arising from the space discretization to be on the order of O(Δx2). Generalizing the formulation for a generic node i. i. it has nonzero elements only in the main diagonal.Lecture Notes Numerical Hydraulics 5.. ⎜ ∂x ⎟ ⎝ ∂x ⎠ 2 2 ⎝ ⎠2 (5-2) (5-3) Truncating after the third term and subtracting/adding Eq. (5-2) from/to Eq. (5-3). Eq. ⎜ ∂x ⎟ ⎝ ∂x ⎠ 2 2 ⎝ ⎠2 2 ⎛ ∂Φ ⎞ 1 2 ⎛ ∂ Φ ⎞ Φ 3 = Φ 2 + Δx ⎜ ⎟ + Δx ⎜ 2 ⎟ + . we can apply the following Taylor expansion: Fig. which has a tridiagonal form. we get: ⎛ ∂Φ ⎞ ⎛ Φ 3 − Φ 1 ⎞ ⎟ and ⎟ =⎜ ⎜ ⎝ ∂x ⎠ 2 ⎝ 2Δx ⎠ ⎛ ∂ 2 Φ ⎞ ⎛ Φ 1 + Φ 3 − 2Φ 2 ⎞ ⎜ 2 ⎟ =⎜ ⎟ ⎜ ∂x ⎟ Δx 2 ⎠ ⎝ ⎠2 ⎝ Hence.. the accuracy of the applied discretization is second order in space. 2 ⎛ ∂Φ ⎞ 1 2 ⎛ ∂ Φ ⎞ Φ 1 = Φ 2 − Δx⎜ ⎟ + Δx ⎜ 2 ⎟ − . 5-4: Discretization in the finite differences method. Starting from the discretization in Fig. and the first diagonal above the main diagonal: . and assuming that all the points are separated by the same distance.4.n-1 Δx 2 ⎝ ⎠ (5-7) This relation can be formulated for all nodes of the computational domain... in the finite-differences formulation the Poisson-Equation becomes: ⎛ Φ + Φ 3 − 2Φ 2 ⎞ f 2 = −⎜ 1 ⎟ Δx 2 ⎝ ⎠ (5-4) (5-5) (5-6) Since the Taylor series was expanded only up to the quadratic terms. (5-6) is written as: ⎛ Φ + Φ i +1 − 2Φ i ⎞ f i = −⎜ i −1 ⎟ for i = 2. we obtain a matrix.... as mentioned in (5-1). or.
.Φn] and the right-hand-side of the equation as bT = [f1.4. In addition. f2. the matrix equation (5-9) can be solved using a standard equation solver. 0⎥ 2 ⎢ Δx ⎢0 . −1 2 −1 0 ⎥ ⎢ ⎥ 0 ... Note that the derivatives at the nodes w (west) and e (east) lie between the discretization nodes. Eq. − 1 2 − 1⎥ ⎢0 ⎢0 0 0 0 0 −1 2 ⎥ ⎣ ⎦ (5-8) If we denote the solution vector as xT = [Φ1. Two important advantages of the finite volumes method have not been mentioned so far: With the use of the integral form (5-11) the conservation of mass. The example showed that the finite differences method transforms the PDG into a system of algebraic equations. We write: − ∂ ⎛ ∂Φ ⎞ ⎜ ⎟= f ∂x ⎝ ∂x ⎠ (5-10) Taking the definitions of Fig. Φ2.. (5-11) is discretized as: ⎛ Φ − Φ P ⎞ ⎛ Φ P − ΦW ⎟+⎜ −⎜ E ⎜ Δx ⎟ ⎜ Δx e w ⎝ ⎠ ⎝ ⎞ ⎟ = fΔx ⎟ ⎠ (5-12) where f is the average of f over the control volume. Eq. in the finite volumes method the derivatives are approximated by difference quotients.e. because an explicit balance between inflow. The balance of these fluxes is in principle independent of the form of the elements. fn]. 0 0⎥ ⎢ ⎥ .. . Φ3. . 1 ⎢ ⎥ A= 0 0 −1 2 −1 . (5-10) is integrated over the control volume.n-1 (5-9) Including the two boundary conditions at x=0 and x=1. Using the values at the nodes. momentum or energy is guaranteed in the respective transport equations. outflow and storage is required for all elements.. which is Δx long and extends from the western point w to the eastern point e. i.5-6 Lecture Notes Numerical Hydraulics 0 0 0 0⎤ ⎡ 2 −1 0 ⎢− 1 2 − 1 0 . 5. 0⎥ ⎢ 0 −1 2 −1 . it can be shown that the approximate solution converges towards the real one. the finite volume method is much more flexible compared to the finite differences method.4 Finite Volumes method For the finite volume method. . . 5-5 into account.. Eq. The integration yields: ⎛ ∂Φ ⎞ ⎛ ∂Φ ⎞ −⎜ ⎟ = ∫ f dx = 0 ⎟ +⎜ ⎝ ∂x ⎠ e ⎝ ∂x ⎠ w w e (5-11) Similar to the finite differences method before. (5-1) is recast in a somewhat different form. we obtain a matrix equation: A ⋅ x = b für i = 2.. f3. when the number of discretization points goes to infinity.
The basis function at a given node of an element must be equal to one at the node itself and must vanish at all remaining nodes of the element.: ⎛ ⎛ ∂ 2Φ ⎞ ⎞ W ⎜ ⎜ 2 ⎟ + f ⎟dx = 0 for i=2. i. we will not use either differential or integral form. i. (5-16).e. (5-15) written in matrix form and inserting for α we obtain: Φ = [1 x ]K −1Φ e (5-15) (5-16) In Eq.Lecture Notes Numerical Hydraulics 5-7 Fig. we note that the value of the variable Φ at the location x in element 1 can be obtained by summing the values at the nodes at both nodes of this element. We can write: ⎧ Φ ⎫ ⎡1 x1 ⎤ ⎧α1 ⎫ Φe = ⎨ 1 ⎬ = ⎢ ⎥ ⎨ ⎬ = Kα ⎩Φ 2 ⎭ ⎣1 x 2 ⎦ ⎩α 2 ⎭ With Eq. With reference to the definition on Fig.e. when integrating over the domain.. 5. the variation of a variable over an element is related to the discrete values of the variables at the nodes. i. For each discretization an error is introduced. However. i.4. The procedure is to apply the method of weighted residuals to the initial Eq.e.e. 5-5: Finite Volumes discretization of the model problem. . different from the other two methods. multiplied by the respective basis function. but instead we use the so-called weak integral form. i.5 Finite Elements method We start once more from Eq. The quantity: N i = [1 x ]K −1 (5-17) is termed basis function. the solution of the discrete system is different from the solution of the initial equation. with the use of this assumption. (5-1). 5-6. the values α1 and α2 can be expressed by using the values of the variables at the nodes.e. they can be written as functions of Φ1 and Φ2.. In the simplest case this will be a linear interpolation funcitn. The method of weighted residuals requires that the error associated with the initial equation multiplied with a weighting function vanish. in the finite elements (FE) method it is assumed that the variation of a variable over a space element can be approximated using a polynomial function. for the variable Φ we assume: Φ = α1 + α 2 x (5-14) Now.n ∫ ⎜ ⎜ ∂x ⎟ ⎟ ⎠ xi − 1 ⎝⎝ ⎠ xi (5-13) Moreover. (5-1) and use the same spatial discretization employed previously for the other two methods (FD and FV).
for too large time intervals the solution becomes instable. The tentative solution is inserted into the integral (5-1). This means that the values of each variable at the nodes at the new time depend only on known values at the previous time step.5-8 Lecture Notes Numerical Hydraulics Φ x = N 1x Φ 1 + N 2 x Φ 2 (5-18) Fig.5 Time discretization The discretizations in time and space are typically well separated from each other. i. but rather outline the basic possibilities at hand. Fist of all. one distinguishes between explicit and implicit methods for time discretization. where the boundary of the computational domain varies in time (free water surface. In this method. 5-6: Finite Elements diskretisation of the model problem. A good choice for the weighting function W is the basis function itself (Galerkin method). the fully implicit method is strictly stable.e. the big advantage of explicit methods. Exceptions are space/time elements in the FE-method. This is also the case for so-called semiimplicit methods. In contrast. movable boundaries. 5. where the variable at the new time depends both on the old and new time step. a system of coupled equations must be set up and solved. In the explicit time discretization. which is that equation solvers are not required. etc. For now we will not discuss the different time discretization in major detail.). Since the basis function chosen here is not differentiable twice. is lost completely. variables at the new time instance depend only on values at the old time step. . in the differentiation one derivative is removed through partial integration and carried over to the weighting function W. One can improve the accuracy of the time discretization using semi-implicit methods. the values at the new time depend on its neighbouring values at the new time. In this way no equation solver is necessary and the solution is straightforward and easy to program. however. the boundary conditions of the problem have to be specified. The resulting system of linear equations for the unknown functions at the nodes must be solved using an equation solver. Such elements are successfully used for problems. However. At the nodes at the boundaries.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.