Numerical Methods for Thermal Physics: educational manual 9786010405653

The Educational manual is devoted to the application of numerical methods in Thermal Physics, it describes the methods o

247 44 623KB

English Pages [80] Year 2014

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Numerical Methods for Thermal Physics: educational manual
 9786010405653

Citation preview

AL-FARABI KAZAKH NATIONAL UNIVERSITY

A.S. Askarova, S.A. Bolegenova, S.B. Gumarova, L.E. Strautman, V.I. Maximov, A. Bekmukhamet

NUMERICAL METHODS IN THERMAL PHYSICS Educational manual

Almaty «Kazakh university Press» 2014

UDC 532(075.8) LBK 22.253я73 N 92 Recommended for publication by the Scientific Council of the physical and technical faculty and RISO of Al-Farabi Kazakh National University

Reviewers: doctor of technical sciences, Professor A.A. Tuiakbaev doctor of Physics and Mathematics, Professor M.E. Abishev

N 92

Numerical Methods for Thermal Physics: Educational manual / A.S. Askarova, S.A. Bolegenova, S.B. Gumarova, L.E. Strautman, V.I. Maximov, A. Bekmukhamet. – Almaty: Kazakh university Press, 2014. – 80 p. ISBN 978-601-04-0565-3 The Educational manual is devoted to the application of numerical methods in Thermal Physics, it describes the methods of obtaining of different finite-difference schemes used for the numerical solution of differential equations describing hydroaero-dynamic and thermal processes and phenomena. The Educational manual is mainly intended for the undergraduate students of thermal physics department of the technical physics faculty, but it can be also useful for the students of other departments, post-graduate and PhD students.

UDC 532(075.8) LBK 22.253я73 ISBN 978-601-04-0565-3

© Askarova A.S. et all, 2014 © KazNU al-Farabi, 2014

CONTENT 1 INTRODUCTION 1.1 The subject of computational thermophysics ......................................... 5 1.2 A historical overview of the development of numerical methods..................................................................................... 7 1.3 Classification of differential equations .................................................... 15 2 PRINCIPLES OF CONSTRUCTION OF DIFFERENCE SCHEMES 2.1 The basic concepts and notations of the difference schemes theory ............................................................................................... 19 2.2 Methods of representation of differential equations in finite-differences........................................................................ 21 2.2.1 Taylor series expansion method ............................................... 21 2.2.2 The method of polynomial approximation............................... 27 2.2.3 The method of integration method over the reference volume .......................................................................... 29 3 STABILITY OF FINITE DIFFERENCE SCHEMES 3.1 Concepts of approximation, stability and convergence of finite-difference schemes ........................................................................... 33 3.2 Description of instability......................................................................... 35 3.3. Methods of studying stability of finite-difference schemes ........................................................................... 39 3.3.1 The method of discrete perturbations ....................................... 39 3.3.2 Von Neumann’s method ........................................................... 43 3.3.3 The method of practical stability .............................................. 45 4. EXPLICIT AND IMPLICIT FINITE-DIFFERENCE SCHEMES 4.1 Explicit schemes....................................................................................... 47 4.1.1 A computational algorithm based on the explicit scheme........................................................................ 49 4.1.2 The explicit "leapfrog" scheme ................................................ 50 4.1.3 The scheme "explicit corner" for the convective transfer equation ................................................................................. 51 4.2 Implicit schemes....................................................................................... 54 4.2.1 A computational algorithm based on the implicit scheme ....................................................................... 55 4.2.2 Stability analysis of an implicit scheme ................................... 56 3 

 

4.2.3 Other implicit schemes ............................................................. 58 4.2.4 Disadvantages of implicit schemes .......................................... 59 4.3 Splitting principle ..................................................................................... 59 4.4 The combined scheme ............................................................................. 60 5 SPALDING’S METHOD 5.1 Transformation of equations .................................................................. 66 5.2 The finite - difference scheme ................................................................ 69 5.3 The algorithm of the solution................................................................... 74 5.3.1 Implementation of the sweep method ...................................... 74 References ..................................................................................................... 77

1 INTRODUCTION

1.1 The subject of computational thermophysics In the past, in thermophysics as well as in other physical sciences, there were two basic methods of research: theoretical and experimental. Let us ask a question: what is the relation between these methods and the computational methods? It is possible to answer that computational methods are special new methods of research, though they have some features of theoretical and experimental methods, and they rather complete than replace them. Computational thermal physics is not purely a theoretical science (if such really exists), it is closer to the experimental methods. The currently used mathematical theory of numerical solutions of nonlinear partial differential equations is still inadequate: it does not have rigorous stability analysis, rigorous error estimates and proof of convergence. Some success was reached in the proofs of existence and uniqueness of solutions, but it is not sufficient to give an unambiguous answer to some special important questions. Therefore, the computational thermophysics mainly relies on a rigorous mathematical investigation of simplified linearized problems, to some extent related to the given problem, as well as on heuristic substantiations, physical intuition, results of purging in wind tunnels and on the procedure of trial and error. A specialist in applied mathematics Bio made some remarks on applied mathematics, which seem today especially suitable for computational thermophysics. Having cited Bateman, who called an applied mathematician as a “mathematician without mathematical conscientiousness”, Bio discussed the relations between applied scientists and pure mathematicians: “One can understand the feelings of the artist, who in the process of creation would be constantly reminded of the need of strict following of the laws of physics and psychology, though the science of color combinations is certainly useful for him”. Those who begin to study computational thermophysics are to remember that this area requires as much art as science. Numerical simulation of thermal problems is closer to experimental 5 

 

than to theoretical thermal physics. The process of calculation using a computer is very similar to the physical experiment. The researcher “switches on” the equations, and then watches what happens, the same is done by the experimenter. The calculations enable scientists to discover new physical phenomena, for example, Campbell and Mueller [1968] found a case of subsonic separation in numerical simulations, and only later discovered it in the experiments in wind tunnels. The researcher making a numerical experiment has some advantages. He can arbitrary set such properties of a liquid as density, viscosity, etc., and exclude perturbations in determining the values of hydrodynamic quantities of the flow. The scientist making computations can make a purely twodimensional experiment, which is not realizable in the laboratory conditions. He is not limited in a choice of flow parameters, i.e. he can choose the initial thickness of the boundary layer and the velocity profile regardless of the Reynolds number per unit of length and Mach number, which is impossible in the experiment in wind tunnels. Probably, the most important thing is that the experimenter-calculator can do what cannot be done by either the theorist or the experimenter-physicist. He can check how the given physical phenomenon is affected separately by each of independent simplifying physical assumptions, such as constancy of viscosity, neglect Archimedean’s force, Prandtl number equal to unit, as well as assumptions of the boundary layer, etc. (Let us remind an old anecdote about a newbie who for the experiments in the wind tunnel ordered a railway tank with nonconducting nonviscous perfect gas). The experimenter-calculator can also verify the validity of basic equations, for example, in case of a new non-Newtonian liquid model. However, the numerical experiment can never replace either physical experiment or theoretical analysis. One of the obvious reasons is that the equations of state for the continuous medium cannot be considered exact, and the other reason is that the experimentercalculator doesn't work with the differential equations of movement of the continuous medium. Thus, it is not important that in the limiting case of a fine mesh the discretized equations are exactly transformed into the initial differential equations, as this limit is never reached. The process of discretization of equations often changes not only the quantitative accuracy but also the qualitative behavior of solutions. 6 

 

Thus, some types of discrete analogues bring a kind of viscous effects, even if the researcher wants to deal with the equations for a nonviscous fluid. Another important limitation is the inability of the numerical experiment to properly take into account turbulence and even such physical phenomena (turbulence, slip lines, vortices breaking from sharp edges) that have too little scale to be resolved with sufficient accuracy in the finite-difference mesh, and at the same time can have a significant impact on large-scale flow properties. An example of this phenomenon is the effect of turbulence in the boundary layer in the position of the separation point. There are also examples of currents represented as two-dimensional, but not being such in practice, for example, the flow beyond the line of rejoining of the separated flow and a flat plane flow over a cavity. In such cases, the apparent advantage of the exact twodimensional numerical simulation can be deceiving. Finally, it should be noted that the numerical experiment is limited in the same sense as the physical one, namely, it gives discrete information for some particular combination of parameters. It cannot establish any functional dependencies in addition to those obtained from the basic equations using dimensional analysis, and, hence, it does not replace even the simplest theory. So, computational thermal physics is a separate discipline, different from the experimental and theoretical thermal physics and supplementing them. It has its own methods, its own difficulties and its own sphere of application, opening new perspectives for the study of physical processes. 1.2 A historical overview of the development of numerical methods In 1910, L. Richardson presented to the Royal society a fifty-page article that must be recognized as a corner-stone of the numerical analysis of differential equations in partial derivatives. Even before Richardson, Shepherd had carried out fundamental work on finitedifference operators, but Richardson's contribution outweighed all previous works. Richardson developed iterative methods used to solve the Laplace equation, the biharmonic equation and other equations. He established the difference between stationary problems depending on 7 

 

whether “it was possible or impossible to continue solution starting from some part on the boundary”, i.e. in modern terminology he distinguished hyperbolic and elliptic problems. Richardson carefully studied the numerical setting of boundary conditions, including boundary conditions in an angular point and at infinity. He obtained error estimations, developed the method of extrapolation of obtained results for the mesh step tending to zero, suggested checking of numerical solutions by comparing them with exact solutions for the simple-shape bodies, for example, the cylinder. Finally, he was the first to apply numerical methods to such large-scale practical problems as calculation of stresses in the stone dyke. Richardson developed iterative methods used to solve the Laplace equation, the biharmonic equation and other equations. He established the difference between stationary problems depending on whether “it was possible or impossible to continue solution starting from some part on the boundary”, i.e. in modern terminology he distinguished hyperbolic and elliptic problems. Richardson carefully studied the numerical setting of boundary conditions, including boundary conditions in an angular point and at infinity. He obtained error estimations, developed the method of extrapolation of obtained results for the mesh step tending to zero, suggested checking of numerical solutions by comparing them with exact solutions for the simple-shape bodies, for example, the cylinder. Finally, he was the first to apply numerical methods to such large-scale practical problems as calculation of stresses in the stone dyke. In Richardson's iterative method for elliptic equations, in the n-th iteration in each node of the mesh, one after another, the finite difference equation, containing the “old” values of the (n-1)-th iteration in neighboring nodes, is satisfied. In 1918, Liebman showed that it is possible to increase the speed of onvergence simply by using the “new” values in the nodes as soon as they are calculated. In this scheme of “continuous replacements” each n-th iteration uses some number of old values from the (n-1)-th iteration and some number of new values from the n-th iteration in the neighboring nodes. In each cycle of Liebman’s iterative method the largest errors decrease in the same way as in two cycles of Richardson's iterative method (Frankel [1950]). This comparison is an example of a specific numerical analysis of partial differential equations. It turns out that a small change in the 8 

 

finite-difference approximations, iterative schemes or interpretation of the boundary conditions can give a big advantage. On the contrary, plausible and at first sight exact numerical schemes can lead to a catastrophe. A classic historical example is Richardson's explicit scheme for the parabolic equation of heat conductivity in which central differences were used for finite-difference approximations of derivatives in both spatial and time variables. O’Brien with co-authors [1950] showed that this scheme is undoubtedly unstable. Before the appearance of computers the main attention was given to the elliptic equations. The first strict mathematical proof of convergence and error estimate of Liebman’s iterative method for the solution of elliptic equations was given by Phillips and Wiener [1923]. In 1928 the classical work of Kuran, Fredriks and Levy was published. These authors were mainly interested in using finite-difference methods as a tool of research in pure mathematics. Discretizing differential equations, proving the convergence of discrete systems to differential systems, and, finally, establishing the existence of discrete system solution by algebraic methods they proved the existence and uniqueness theorems for elliptic, hyperbolic and parabolic systems of the differential equations. This work paved the way to the finite-difference solutions in the next few years. In the USSR, the finite-difference method for the partial differential equations started to be systematically developed in the 1930. Among the first research works in this area it is necessary to mention works of S.A. Gershgorin [1930], L.A. Lyusternik [1934], D.Yu. Panov [1932-1933], I.G. Petrovskii [1941] and others. The first numerical solution of the partial differential equations for viscous fluid dynamics problems was given by Tom in 1933. In 1938 Shortly and Weller developed a method which was actually a more difficult variant of Liebman’s method. They offered a method of block relaxation, a method of the trial function, a method of error relaxation, methods of diminishing of the mesh size and error extrapolation. They were also the first who precisely determined and studied the rate of convergence. Southwell [1946] developed a more efficient relaxation method for the numerical solution of elliptic equations. In his method of the residual relaxation the calculations are not made in each mesh, but the entire mesh is scanned to find the nodes with maximum discrepancies, and in 9 

 

these nodes new values are calculated. (In case of the stationary equation of thermal conductivity the discrepancy is proportional to the rate of energy storage in the mesh cell, hence, the steady state is reached, when all discrepancies are equal to zero). Fox [1948] developed more complicated variants of Southwell’s relaxation method by introducing schemes of upper and lower relaxation (where the discrepancy is not supposed to be exactly equal to zero), the method of mesh choice where relaxation occurs, and the scheme of block relaxation. In 1955 Allen and Sausvell applied Sausvella’s relaxation method to the manual calculation of the flow of a viscous incompressible liquid about the cylinder. In some respects it was a pioneer work in numerical hydrodynamics. To represent a circular boundary on a regular rectangular mesh, they used a conformal transformation. They obtained numerically stable solutions for the Reynolds number equal to 1000, which exceeds the physical limit of stability. When carrying out calculations, the authors faced a clearly expressed tendency to instability at Reynolds's equal 100, and connected the number with the tendency of physical instability of flow, thus, having anticipated the modern concept of numerical simulation. Their work can be also considered as an example of financing of scientific research: the research was sponsored by a tailor firm that allocated big funds to the London imperial college in 1945. It is not easy to adapt Sausvella’s method to the computer. The researcher-calculator manually looked through the matrix in search for maximum discrepancy much faster, than it was made by arithmetic operations. For the computer the speed of matrix scanning is not much higher than the speed of arithmetic operations, and consequently in the computer it is more efficient to make relaxation successively in all mesh nodes by reducing the discrepancy to zero, which is identical to the Liebman method. Thus, the wide use of computers created the basis for further development of the Liebman-type methods with the use of advantages of Sausvella’s upper relaxation. In 1950 Frankel (and independently Young in 1954) developed a new method, which he called the extrapolating Liebman method and which later became known as the method of successive over-relaxation (Young [1954]) or optimalrelaxation. Frankel noticed the analogy between the iterative solution of elliptic equations and the method of time steps used to solve parabolic equations, which had important consequences. 10 

 

With the development of computes more attention was paid to the parabolic equations, as it became possible to solve non-stationary problems. In the first Rihtmajer’s monograph [1957], which made great contribution to the development of one-dimensional non-stationary hydrodynamics, more than ten numerical schemes were given. In the multidimensional case, the first implicit scheme was the method of Crank-Nicholson, published in 1947. And that method required iterations in each time layer. This is one of the most popular methods, and it forms the basis of widely used computational method of not automodel solutions of the boundary layer equations (Blottner [1970]). It is impossible to determine precisely when the idea of the asymptotic method of establishing in time was first suggested. According to this idea in order to obtain the stationary solution it is necessary to integrate equations of non-stationary flow. It is unlikely that such an idea could be considered seriously before the invention of computers. Many pioneer works in Computational Hydrodynamics were carried out in Los-Alamos laboratory. It was in Los Alamos where Von Neumann developed his criterion of stability of parabolic finitedifference equations and suggested the method of studying linearized systems. A brief report on his work appeared in the open literature only in 1950 (Charni et al.; [1950]). That important paper was the first paper that presented calculations of large-scale meteorological problems which included nonlinear equations describing vorteces. The authors found that in terms of stability, vortex equations have more advantages than the traditional equations for the elementary physical variables (speed and pressure), and made heuristic substantiations of the treatment of the non-stationary problem as a problem with mathematically incomplete conditions at input and output boundaries. Though as early as in 1950 Neumann stated the necessity of introduction of the concept of stability of finite-difference schemes, the explicit formulation of the concept of stability as an analogue of correctness of differential equations and the theorem that their stability and approximation is followed by convergence, were first given by Soviet mathematicians V.S. Ryaben-Kim [1952] and A.F. Filippov [1955]. In the mid-1950s the papers of Pismena and Rakforda [1955], and Douglas and Rakforda [1956] suggested efficient implicit methods for 11 

 

solution of parabolic equations, which can be used for large time steps. As implicit schemes of the method of alternating directions they were used for solving elliptic problems using Frankel [1950] analogy between the advance in solution in time in parabolic problems and the advance in solution in iterations in elliptic problems. The implicit schemes of alternating directions are most often used in solutions of problems of incompressible liquid flows using the vortex transport equation. In 1953 Dyufort and Frankel published the scheme “leapfrog” for the parabolic equations, which like implicit schemes of the method of alternating directions, can be used for any large steps in time (if convection terms are absent), but preserves all advantages of purely explicit schemes. This scheme was used by Harlow and Fromm [1963] in derivation of their well-known numerical solution for a nonstationary vortex trajectory. The requirement of uniformity and homogeneity of the computational algorithm for this class of problems led to the concept of homogeneous difference schemes formulated by A.N. Tikhonov and A.A. Samarsky [1950-1964]. To obtain the schemes of end-to-end calculations of discontinuous solutions in gas dynamics, S.K.Godunov [1958] used conservation laws. An important role in solution of hydrodynamic and thermophysical problems played the method of integral relations suggested by A. Dorodnitsyn and further developed by O.M. Belotserkovsky and P.I. Chushkin. This method used partial difference approximation of equations written in the divergent form on the basis of the straight lines method. The above methods played an important role in the formation of the general approach to the construction of difference schemes for quasilinear equations. The article of Harlow and Fromm [1965], published in the Scientific Amerіcan, drew attention of the scientific community of the United States to the possibilities of computational hydrodynamics. Almost at the same time the French magazine “La Houіlle Blanche” Makano published a similar article [1965]. Those articles were the first that correctly formulated the concepts of numerical simulation and numerical experiment. The dates when the articles were published can be considered as the date of appearance of Computational Thermal Physics as a discipline. The computational stability of all mentioned above time-dependent 12 

 

solutions was limited from the above by the Reynolds number (in principal, this limit is defined by the Reynolds net number, i.e. the number obtained by the step of the finite-difference mesh). In 1966 Thoman and Shevchik seemed to achieve an unlimited computational stability using the upstream differences for the representation of convective members and paying special attention to boundary conditions. Their calculations of the flow about the cylinder went up to the Reynolds number equal to one million; they could even “rotate” the cylinder and obtained the Magnus lift force without any computational instability. Though their scheme had only the first order of accuracy, a rather good agreement between their results and the experimental data urged scientists to revaluate the importance of the formal order of approximation errors in the finite-difference representation of differential equations in partial derivatives. An important contribution to the solution of the problem was made by the work of Chena [1968], which established essential influence of numerical values of boundary conditions. Direct (noniterative) Fourier methods were used for numerical solution of the Piosson elliptic equation (see, for example, the monograph of Vazov and Forsyte [1960]), but were not applied to the hydrodynamics problems. In 1965 Hokni developed a similar but faster method which allowed to solve big boundary problems for the Poisson equation more effectively. After publication of this work direct methods for the Poisson equation began to develop more intensively. The methods described above are suitable for calculation of subsonic compressible fluid flows. Supersonic problems differ from subsonic flows in several important aspects, the main of which is possibility of arising of shock waves in the supersonic flow (i.e. discontinuities in solutions). The fundamental work for numerical calculation of the hyperbolic equations was the article of Courant, Friedriks and Levy, published in 1928 It discussed characteristic properties of equations and general features of the method of characteristics were formulated. In this work the authors obtained the well-known necessary condition of stability of Courant - Fridriks-Levy, which states that if the calculation mesh does not coincide with the characteristic mesh, the region of influence of difference equations must, at least, include the region of influence of differential equations. This CFL condition of stability (which in modern 13 

 

terminology simply states that the Courant number must be smaller than one) is valid for the equations of hydrodynamics both in Lagrangian and in Euler variables. Lagrangian methods, with the presence of “particles” were brought to the high degree of perfection in Los Alamos National Laboratory (Fromm [1961]). Generally speaking, the Euler method is more preferable for the two-dimensional problems, however, they make calculation of shock waves more difficult. If the size of the cell of the mesh is not less, than the thickness of the shock wave, it causes appearance of oscillations reducing accuracy. These oscillations on a discrete mesh have physical meaning (Rihtmayer [1957]). The kinetic energy released due to loss of speed when passing through the shock wave, turns into internal energy of random collisions of molecules; in the calculations the role of molecules is played by the cells of the finite-difference mesh. The most common framework for the calculation of shock waves in Euler’s mesh is “smearing” of the jump over several cells of the mesh by explicit or implicit introduction of artificial viscosity, which does not affect the solution at some distance from shock waves. In 1950 Von Neumann and Rihtmayer proposed a scheme of artificial viscosity in which “the coefficient of viscosity” was proportional to the square of the speed gradient. Ladford, Polyachek and Seeger [1953] simply took large values of physical viscosity in the equations of viscous fluid in the Lagrangian mesh, but their method requireв unrealistically high values of viscosity. For smearing of the jump instead of obvious introduction of artificial viscosity it is possible to use implicit viscosity occurring in the finite-difference approximations. It was realized in the well-known method of particles in the cell framework (RІS method), developed by Evans and Harlow at Los Alamos, as well as in the Lax method (Lax [1954]) and other methods. In the Lax method published in 1954 the numerical scheme itself is much less important than the form of differential equations - the conservative form. Lax showed that transformation of ordinary hydrodynamics equations, where the dependent variables are velocity, density intensity and temperature, can give a system of equations, in which the dependent variables are the momentum, density and specific internal inhibition energy. This new system of equations reflects the 14 

 

essence of physical conservation laws and allows to preserve integrated flow characteristics in the finite-difference scheme. Such a system of equations is now widely used for the calculation of distribution of shock waves irrespective of used finite-difference schemes, as the speed of any plane shock wave is calculated exactly by any steady scheme (Longley [1960] and Gary [1964]). Some other methods also use smearing of the shock wave using the implicit viscosity. At present the scheme of Laks-Vend-Roff [1960] and its two-step variants, for example the scheme of Rihtmayer ( see Rihtmayer [1963]) are widely applied. In the PIC method and in its modification ЕІС (the explosion in cells), developed by Mader in 1964, the smearing of jumps is achieved by introducing a finite number of calculated particles. This technique also enables scientists to consider the interface in the liquid (see Harlow and Welch [1965, 1966] and Daly [1967]). In the RIS method as well as in the earlier method of CourantIsaacson-Rees [1952] the one-sided differences for the first spatial derivatives are used, they introduce some kind of circuit viscosity, but preserve characteristic properties of the differential equations. Although all these methods use implicitly dissipative terms smearing shock waves, to provide their stability of them in some special cases it is necessary to introduce additional terms with explicitly artificial viscosity. For the equations and systems of hyperbolic type in rectangular areas different economical schemes were developed and studied by E.G. Dyakonov [1963], A.N. Konovalov [1964], A.A. Samarskii [1965]. For the numerical solution of systems of equations for reacting flows the economical numerical methods were developed and realized by L.A.Chudov, N.N. Janenko, B.G. Kuznetsov, D.B. Spoldingom, Oran, and other scientists. 1.3 Classification of differential equations For the calculator it is very important to be able to classify the differential equations, as the choice of a numerical method of solution depends on it. Differential equations can be classified according to several factors. We will consider the most important of them.  Ordinary differential equations and partial differential

equations

15 

 

Ordinary differential equations: A differential equation which involves only one independent variable is called an ordinary differential equation. Partial differential equations: A differential equation which involves one or more partial differential coefficients of the dependent variable is called a partial differential equation. Examples. The stationary one-dimensional fluid flow in a pipe is described by the ordinary differential equation:

u

u 2 du dp   , dx dx 2d

(1.1)

as unknown function u(x) depends only on one variable х. The stationary two-dimensional fluid flow in a pipe is described by in the partial differential equations:

u

u u p  2u  v    2 . x y x y

(1.2)

Here the unknown function u(x,y) depends on two variables: х and y. The order of the differential equation: The order of the differential equation is the order of the highest differential coefficient in it. The equation (1) is first order equation, the equation (2) is the second order equation. The general form of the second order differential equation can be written as:

A

f f 2 f 2 f 2 f C B  Ff  G . (1.3) E D   2 2 y x y xy x

The second-order differential equations are classified as follows: a) if В2-4АС=0 , the equation (1.3) is a parabolic equation; b) if В2-4АС0 , the equation (1.3) is a hyperbolic equation. The second-rder equation (1.2) is a parabolic equation (you can check it by reducing it to the form (1.3) and finding the value of the expression В2-4АС). An example of the elliptic equation is the Poisson equation q(x,y), which describes stationary distribution of temperature transfer from a thermal source (if q (x, y)> 0, in the point (x, y) heat is emitted, and if q (x, y) 0, this scheme is numerically unstable, i.e. it gives chaotic solutions having nothing in common with the solution of the original differential equation (2.1). The problem is solved if in the non-stationary term we use “forward” differences in time instead of central differences. In this case we obtain the following finite difference scheme:

or

f i n1  f i n f n  f i n1 f n  f i n1  2 f i n  u i 1  a i 1 2 x t x 2

f i n1  f i n   26 

 

(2.9)

u t n  fi1  fin1   2 x

a t n  fi1  fin1  2 fi n . 2 x

(2.10)

Further we will see that this scheme is stable, at least, for some conditions for t and х. However, this scheme is less precise than (2.8): it has the first-order accuracy in time and the second order accuracy in spatial variable. From the template it is seen (Figure 4) that it is a two-layer four-point scheme.

n+1

i

i -1

2.2.2 The method of polynomial n+1 n approximation The finite-difference expressions can Figure 4. A two-layer be also obtained based on the four-point scheme approximating analytical function with free parameters, which is constructed using the values of mesh nodes and analytically differentiated. It is a usual method of finding the derivatives based on the experimental data. Ideally, the type of the approximating function must be defined by the approximate analytical solution, however, usually polynomials are used as approximating functions. We will demonstrate the present method on the example of the parabolic approximation. Let us assume that the values of the function f are given in the points i-1, i and i + 1, and make a parabolic approximation of the function f(x):

f(x)=a+bx+cx2+dx3+…

(2.11)

Let us find the first and the second derivatives:

df  b  2cx  3dx 2  ... dx d2 f dx 2

 2c  6dx  ...

(2.12)

(2.13)

For convenience, we will take point i as the origin of coordinates (х = 0). Then the equation (2.11) written for points і-1, і and і +1 will give: 27 

 

fі-1  a-bx+cx2-dx, fі  a, fі+1  a+bx+cx2+dx3.

(2.14) (2.15) (2.16)

Combining the equations (2.14) and (2.16), we obtain: fі-1+ fі+1  2a+2cx2. Taking into account (2.15), we will find c: c

f i1  f i1  2 f i 2x 2

From (2.16) we will determine b:

b

f i1  f i1 2x

In the point i (x= 0) the value of the first derivative of (2.12) is:

f  f i 1 df  b  i 1 . dx i 2x

(2.17)

From (2.13) the value of the second derivative in the point i is:

f  f i1  2 f i d2 f  2c  i 1 . 2 dx i x 2

(2.18)

Formulas (2.17) and (2.18) exactly coincide with formulas (2.6) and (2.7 obtained by the expansion into Taylor series. If we assume that f is the first-order polynomial, i.e.: f(x)=a+bx+…, then depending on the values used for the determination of a and b, 28 

 

values of fі and f і + 1 or fі and fі-1 , for the first derivative we get formulas with differences "forward" or "backward", respectively. It is obvious that in the linear approximation of f it is impossible to obtain the second derivative. For the higher-order derivatives the difference formulas were obtained using the higher-order polynomials. The expressions obtained with the higher-order polynomials are not identical to the expressions obtained by the expansions in Taylor series, and in each case, the approximation error must be checked by Taylor expansion. In computational thermophysics the method of polynomial approximation is used only to calculate the values of derivatives near the boundaries. The disadvantage of polynomial approximations is that at higher order of approximations, they become sensitive to the "noise", i.e. to more or less randomly distributed small data errors. 2.2.3 The method of integration over the reference volume Let us consider the equation (2.1). In order to represent it in the finite-difference form, we will integrate all terms of this equation in time from tn to tn+1 (or in our notations from n to n +1) and in spatial from xі - to xі +1/2 (or from i-1/2 to i+1/2). As variables t and x are independent, the order of integration is not important, therefore we will choose it so that it will be possible to make one exact integration: i 1 2 n 1

 

i 1 2 n

n 1 f dtdx   t n

i 1 2

n 1 f u dxdt    x i 1 2 n

i 1 2



i 1 2

a

2 f dxdt x 2

Figure-5

29 

 

The first integration gives: i 1 2

f

n 1

i 1 2

n 1

 f dx  u   f i 1 2  f i 1 2 dt  n

n

 df a   n  dx n 1

 i 1 2

df dx

 dt  i 1 2 

Let us use the well- known theorem “about the average”: z k 1

 f ( z )dz  f ( z )z 

zk

where: z = zk+1 - zk, z*[zk, zk+1]. Taking in the calculation of integrals, xі as the mid-point in coordinate and the leftmost point tn as the mean point in time, we get:

f

n 1 i

 f i n x  u  f i n1 2  f i n1 2 t 

 df  a  dx 

n

df  dx i 1 2

 t  i 1 2  n

(2.19)

The finite – difference ratios for derivatives in the right part of this equation will be found as follows. df Let us integrate over x: dx i 1

n

df n n i dx dx  fi 1  fi .

30 

 

(2.20)

On the other hand, if x і + 1/2 is taken as the mid-point of the interval [x і, x і + 1], then by the theorem “about the average” the approximate value of the integral is equal to: n

i 1

df df i dx dx  dx

n

x .

(2.21)

i 1 2

Having equated the right parts of equations (2.20) and (2.21), we obtain: n

df x  fi n1  fi n , dx i 1 2 where:

df dx

n

i 1 2

f i n1  f i n .  x

(2.22)

We can similarly obtain the expression for the derivative in the node xі-1/2: n

df f n  f in1  i . dx i1 2 x

(2.23)

Let us replace the values of f і+1/2 and fі-1/2 by the mean arithmetic f values in the neighboring nodes: fіҒ1/2 = (fіҒ1 + fі )/2.

(2.24)

Substituting (2.22) - (2.24) into the equation (2.19), we obtain:

31 

 

f

n 1 i

  a 

 f i n x 

u n  fi1  f in1 t  2 n n f i1  f i f n  f in1   t ,  i x x 

(2.25)

whence, dividing the equation, term-by-term, by the product xt and reducing the like terms, we finally have the following finite difference equation:

f i n1  f i n fn  fn f n  f in1  2 f i n  u i 1 i 1  a i1 , 2x t x 2

(2.26)

which exactly coincides with the equation (2.9). We have achieved such a coincidence, choosing the appropriate limits of integration. In general, the integral method as well as the expansion into Taylor series, has a high degree of arbitrariness in the derivation of the finitedifference equations, caused by the choice of the control volume for integration. The difference between the integral method and Taylor series expansion is most clearly seen in the nonrectangular coordinate system. Thus, all three methods can lead to the same finite-difference expressions. It encourages scientists and lends credibility to all the methods. However, each of them has a certain freedom of choice. In fact, there are many plausible finite-difference analogues of the same differential equation, but not all of them work.

3 STABILITY OF FINITE DIFFERENCE SCHEMES

3.1 Concepts of approximation, stability and convergence of finite-difference schemes A convergent finite difference scheme is mathematically defined as a scheme giving a finite-difference solution which tends to the solution of the differential equation when the mesh step tends to zero. This concept is less explicit than it seems at first sight. It is not just a paraphrase of the definition of the derivative, because as the subject it uses the limit of solution of the differential equation but not of some of its terms (derivatives). This property is called an approximation. For example, the finite-difference analogue of the differential equation may be composed of finite differences, each of which approximates the corresponding term of the differential equation, but, as a whole, the analogue may be not converging. The difference between the finite-difference scheme and the original differential problem is estimated by the value of discrepancy obtained by substituting of the exact solution into the equation and boundary conditions of the finite-difference problem. Let us denote a set of equations describing the problem (the main differential equation and the boundary and initial conditions) by the following operator:

L(f )=0,

(3.1)

where f is the exact solution of the differential equation (3.1). Similarly, the corresponding finite-difference problem in the operator form can be written as: L (f )=0,

(3.2)

where f is a mesh function which is the solution of the finite-difference problem (3.2). 33 

 

The finite-difference function =L(f) is called an approximation error (or discrepancy) of the finite-difference scheme (3.2) for the exact solution of (3.1). The scheme is called approximation on the exact solution if the approximation error tends to zero as the mesh size tends to zero. For the one-dimensional case, this definition can be written as follows:

x 0 where ,0

(3.3)

In the two-dimensional case, the step t is, as a rule, connected with the step x, and x 0 for t0, so (3.3) is also valid for the twodimensional problem. It is obvious that for the approximating scheme the error of approximation decreases with the decrease in the step of approximation x. For the two-dimensional problem it is also important that the rate of decrease in the time step corresponds to the rate of decrease in the spatial variable. x  const the scheme may be For example, for the condition t x 2  const , it may be diverging for the exact solution, while for t converging. Besides errors of approximation, numerical calculations also have rounding errors, which, on the contrary, increase with the decrease in the mesh size (when the number of steps increases). A schemat ic growth of the approximation and rounding errors is shown in Figure 4.

Figure 4. A schematic growth of approximation and rounding errors

34 

 

From this figure it is seen that when 0 the rounding errors can increase considerably, and therefore the finite-difference scheme can be approximating but diverging. It is necessary to distinguish the concepts of approximating and convergent schemes. The convergence condition can be written as follows: x0 when f f , and the condition of approximation is expressed by (3.3). The difference f -f can be considered as a perturbation of the solution of the mesh problem caused by a small perturbation  in the right-hand side of equation (3.2). In order the convergence (i.e. convergence of f -f to zero) follow from the approximation property (i.e. tending of  to zero), it is sufficient to introduce an additional requirement that the scheme must be stable with respect to small perturbations. 3.2 Description of instability

Let us consider the model equation (2.1):

2 f f f a 2 . u x x t The finite-difference scheme with forward differences in time and central differences in the spatial variable is written as:

f i n 1  f i n f i n1  f i n1 f i n1  f i n1  2 f i n u a t 2x x 2 Further we will use u instead of the uіn. We will rewrite this equation as follows:

f i n1  f i n  

ut n  fi1  fin1   2x

at  2  f in1  f in1  2 f i n  . x

(3.4) 35 

 

Let us introduce the following designations: ut C is the Courant number, x at d  2 is the diffusion number. x After that, the equation (3.4) is written as:

f i n 1  f i n 



 



C n f i 1  f i n1  d f i n1  f i n1  2 f i n . 2

(3.5)

Let the nth layer of time have a small perturbation uіn as presented in Figure 7,a.

Figure 7. Finite difference schemes

36 

 

іn increases from point to point and has different signs in the

neighboring nodes. Such perturbations can be generated by either rounding errors, or transverse motion in the real two-dimensional problem. The perturbation, which arose in the n-th layer, will necessarily manifest itself in the (n +1)-th layer. If the absolute value of the perturbation decreases in the following time layers, the finitedifference scheme is stable. Thus, the stability condition in this case can be written as follows:

 in 1



 in

or :

 in 1  1.  in

(3.6)

Let us trace the evolution of the perturbation. For this purpose we will rewrite the equation (3.5) taking into account the perturbation in the n-th layer:





C  f in1   in1    f in1  in1   2 n n n  d  f i 1   i 1    f i 1   in1   2 f i n   in  f i n1   in1  f i n   in 





Let us subtract the "unperturbed" equation (3.5) from the equation with perturbations (3.7):

 in1   in 

C n   i1   in1   d  in1   in1  2 in  2

We will find the increment of the perturbations in the (n +1)-th layer:

 i   in1   in  

C n i1  in1   d in1  in1  2in  . 2

(3.8)

Let us consider this equation only with one diffusive term, i.e. we will assume that С=0: 37 

 

 i  d  in1   in1  2 in  .

(3.9)

Let us analyze this equation in the point i:  i  d  in1   in1  2 in   0 ,

as nі+2 0. The increment of the perturbation in the point i: 38 

 

 i  

C n i1  in1   0 . 2

as nі+1>0, nі-1>0, and the amplitude  grows with the growth of і, that is nі+1>nі-1, hence, the expression in the brackets is positive. Thus, the increment і caused by convection increases the perturbation іn. This means that the error increases monotonically (Figure 7 g). The appearance of such a growing error is called static instability, which cannot be eliminated by using a smaller time step and can only be eliminated by passing to another finite-difference scheme. Thus, the equation (3.5) with C = 0 is relatively stable, and for d=0 it is absolutely unstable. If at the same time C ≠ 0 and d ≠ 0, the convective and diffusive terms will interact with each other, and the equation (3.5) can be either stable or unstable. To answer the question of stability of the equation (3.5), it is necessary to analyze its stability by one of the methods that will be discussed below. 3.3 Methods of studying stability of finite-difference schemes 3.3.1 Method of discrete perturbations The idea of the method of discrete perturbations is that a discrete perturbation  is introduced in each point of the equation in turn, and the influence of this perturbation is studied in the following time-layers. The finite-difference scheme is stable if the perturbation does not increase, i.e. the condition (3.6) is satisfied. Let us consider the finite-difference equation (3.5). We introduce a perturbation  in the point (i, n):

f i n 1   n 1   f i n   n  



C n  fi 1  fi n1   2

.

 d f i n1  fi n1  2 f i n   n 

Subtracting the "unperturbed" equation (3.5) from the equation with the perturbation, we obtain the equation for the perturbations: 39 

 

 n1   n  2d n .

Then :

 n1 n

 1  2d  1 ,

It is necessary to resolve the obtained inequality with respect to d: -1≤1-2d≤1. We will consider the right and left side of this inequality separately: а) 1-2d≤1  d≥0 — This condition is always satisfied. b) -1≤1-2d  d≤1 — The finite-difference scheme (3.5) is stable if this condition is satisfiedd. In order to avoid oscillations, it is necessary to introduce the requirement that n+1 and n must have the same signs, i.e. the condition:

 n1 n

0

must be fulfilled. In this case, this condition means that the following inequality is fulfilled: 1-2d≥0  d≤1/2. We have obtained a more stringent limitation than in b) as it includes the condition d  1 . For fixed х and a, this condition imposes a restriction on the time step : 1 x 2 t  . 2 a This restriction is strict in the sense of time consumption for computer calculations. For example, suppose that the calculation is carried out with a spatial step х1. The maximum possible time step is 40 

 

1 x1 . If you need to use a half-step х2=х1/2, then the time 2 a 1 x22 1 1 x12 1 step is t 2     t1 , i.e. the time step must be 2 a 4 2 a 4 reduced 4-fold, and expenditures of computer time will increase 8-fold. In the two-dimensional problem the two-fold reduction in the steps х and y increases the time consumption by 16 times, and in the threedimensional problem the time consumption will increase 32 times! Let us now introduce a perturbation  in the point (i +1, n):

t1 

C n  fi 1   n  fi n1   2 n n n  d  f i  1    f i 1  2 f i n  . f i n  1   n 1  f i n 

Subtracting the "unperturbed" equation (3.5) from the equation with the perturbation, we obtain a new equation for the perturbations:  n1  

С n   d n 2

Hence, the stability condition has the form:  1  

а) 

c  d 1 2



c  d 1 2

at ut   1, x 2 2x t 

1 a u  2 x 2 x

(3.11)

We have obtained one more condition for stability, which a u   0 as the step in time cannot be is satisfied only when x 2 2x negative. 41 

 

ux 2. a The expression on the left represents the net Pekkle number: ux Pec  . The last inequality can be rewritten as: Pec