520 likes | 640 Views
Chapter 4. Theoretical Background. 4.1 Convergence. QUESTIONS? Under what conditions the numerical solution will coincide with the exact solution? What guarantee the numerical solution will be close to the exact solution of the PDE?
E N D
Chapter 4 Theoretical Background
4.1 Convergence QUESTIONS? • Under what conditions the numerical solution will coincide with the exact solution? • What guarantee the numerical solution will be close to the exact solution of the PDE? • Consistency – discretization solution process can be reversed, through a Taylor series expansion, to recover the original PDEs • Stability – solution algorithm must be stable • Convergence– solution of the discretization equations (approximate solution) approaches the exact solution for the original PDE when x 0 and t 0(grid refinement)
Numerical Convergence • Convergence -- Numerical solution approaches the exact solution of PDE for each value of the independent variable • Solution error --truncationand round-off errors • Numerical Convergence -- Numerical solution converges to a unique solution with grid refinement (very expensive to prove) • The converged solution may not be the exact solution unless the numerical scheme is also consistent
Numerical Convergence • FTCS Scheme tmax = 5000 Grid refinement is a very expensive process (especially for unsteady 3D problems)
Numerical Convergence • FTCS Scheme
Lax Equivalence Theorem • The necessary and sufficient condition for convergence of a properly posed linear initial value problem -- Satisfies the consistency condition -- The algorithm is stable • Applicable to any discretization procedure (not only finite-differences) that leads to nodal unknowns • For nonlinear boundary value problems or mixed initial /boundary value problems, Lax equivalence theorem cannot be rigorously applied. It may be considered as a necessary, but not always sufficient condition Consistency + Stability = Convergence
Convergence • Discretization– Replace (approximate) the PDE by algebraic equations • Consistency – Recover (x, t 0) PDE from algebraic equations
Convergence Discretization System of algebraic equations Partial differential equations (PDE) Consistency Exact solution Stability Approximate solution Exact solution Convergence
4.2 Consistency • The discretization (algebraic) equation is consistent with the original PDE if the two are equivalent at each grid point as x, y, z, t 0 • But the exact or converged solutions are unknown! • Consistency is a necessary, but not sufficient condition • The algorithm must also be STABLE to achieve CONVERGENCE
Numerical Consistency • Use Taylor series expansion and examine the remainder • Substitute the exact solution into the discretization equation, and compare with the original PDE • The numerical solution satisfies the discretization equation exactly (assuming no round-off error), but not the original PDE Truncation error analysis Modified equation approach
4.2.1 FTCS Scheme Parabolic • Include both marching and equilibrium behaviors n + 1 1 s s 12s n j 1 j j + 1
FTCS Scheme • Taylor series expansion
FTCS Scheme • Taylor series expansion • Consistency • Recovers the original PDE! • Convergence?
Numerical Accuracy • Time- and spatial-derivatives are not independent • We need to know the accuracy of the discretization equation, not just individual terms in the equation • Use the PDE to relate time- and spatial-derivatives
FTCS Scheme • Convert to pure time-derivative or pure spatial-derivative
FTCS Scheme • s = t /x2 is dimensionless Time derivative Spatialderivative Error Cancellation !
4.2.2 Fully Implicit Scheme Level n+1 Level n n s s 1+2s 1 n - 1 j 1 j j + 1
Fully Implicit Scheme • Taylor series expansion
Fully Implicit Scheme • Convert to pure time- or spatial-derivative • Unconditionally stable; but only second-order
Richardson Scheme • Centered-Time, Centered Space (CTCS) • Second-order in space and time • Unconditionally unstable! 1 n + 1 4s n 2s 2s n1 1 j 1 j j + 1
DuFort-Frankel Scheme • Replace in Richardson scheme • Second-order in space and time • Unconditionally stable! 1+2s n + 1 2s 2s n 1 2s n1 j 1 j + 1 j
Finite Difference Methods FTCS Fully-Implicit s s 12s 4s 2s 2s 1 DuFort-Frankel Richardson
Truncation Errors • Time spatial Time spatial
4.3 Stability • Stability is concerned with the growth, or decay, of errors introduced at any stage of the computation • Round-off errors - machine dependent • Intermediate solution for an iterative scheme • For propagation problems, a given method is stable if the accumulated round-off errors are negligible • For equilibrium problems: • Direct inversion -- round off errors only • Iterative methods – round-off and iteration errors
Numerical Stability • T numerical solution without round-off errors • T* numerical solution including round-off errors • Error bound -- assume the worst possible combinations of individual errors
Numerical Stability • FTCS Scheme, s ½ for stability s = 0.6
Round-Off Errors • Neutral stability – round-off error introduced at each time step may accumulate (although cancellation often occurs), but never grow in time • Division of small numbers 1/2 may introduce significant round-off errors
Stability of FTCS Scheme • If there is no round-off error and j = 0 on all boundaries, then jn = 0 stable • In practice, for all j at step n(max is machine dependent) Stability limit: s 1/2
Stability - Matrix Method • Eigenvalue of a tridiagonal matrix J = 4 (j = 1,2) J = 5 (j = 1,2,3) J = 6 (j=1,2,3,4) In general ……
4.3.1 Matrix Method: FTCS Scheme j = 1 2 3 4 ……….. J2 J1 J (B.C.) Eigenvalues (B.C.)
Matrix Method: FTCS Scheme • The magnitude of all eigenvalues are less than 1
Matrix Method: Fully-Implicit Scheme • Diagonally-dominant for all s Unconditionally stable Pick minimum j (negative sign) so that j = 1/ j is maximum
4.3.2 Matrix Method: General Two-Level Scheme • Linear combination of FTCS and fully-implicit schemes n+1 = 0, FTCS scheme = 1, Fully-Implicit = ½, Crank-Nicolson n 1 j1 j j+1
General Two-Level Scheme • Matrix Method
Matrix Method: General Two-Level Scheme • Eigenvalues • Pick “+” sign for numerator and “” sign for denominator for “worst possible” conditions • Stability criterion
Numerical Stability:General Two-Level Scheme • Stability criterion = 0, FTCS scheme: s 1/2 = 1, Fully-Implicit:unconditionally stable = ½, Crank-Nicolson:unconditionally (neutrally) stable, but oscillatory solution may still occur
4.3.3 Matrix Method: Derivative Boundary Conditions • Modify A and B matrices to account for Neumann BCs T2 To Error in textbook Table 4.2 indicates slight reduction of stability for Neumann conditions
Numerical Stability • Generalized two-level scheme
Von Neumann Method • Fourier stability method • Most commonly used, easy to apply, straightforward and dependable • Can only be used for linear, initial value problem (propagation problem) with constant coefficients • for nonlinear problems with variable coefficients, the method may still be applied “locally” to provide necessary, but not sufficient stability criterion • may also provide heuristic information about the influence at the boundary
4.3.4 Von Neumann Method: FTCS Scheme • Expand the error as a Fourier series • For linear problems (superposition implied), it is sufficient to consider just one term
4.3.5 Von Neumann Method: General Two-Level Scheme • For linear problems
Von Neumann Method • For more complex equations, it may be necessary to evaluate the amplification factor G(s,, ) numerically for a range of s,, and values • For three time level schemes, need to solve a quadratic equation in G • For a system of equations of several variables (i.e., u, v, w, p), need to solve the eigenvalues for amplification matrix and require |m| 1 • This section deals with numerical instability, but not the physical instability (transition to turbulence)
Stability and Consistency • FTCS scheme--s 1/2 • Fully Implicit scheme-- unconditionally stable • Richardson scheme-- unconditionally unstable • DuFort-Frankel scheme-- unconditionally stable, but inconsistent!! DuFort-Frankel scheme is consistent with ahyperbolic wave equation!
4.4 Numerical Accuracy • Convergence, Consistency, and stability: establish limiting behavior for discretization scheme as x, t 0 • Asymptotic rate of convergence: x, t 0 • Accuracy: deals with practical approximate solution on a finite grid • Higher-order scheme may not be more accurate than lower-order ones if the grid is not fine enough • Higher-order scheme has faster rate of convergence, but the absolute error for a given x (coarse grid) may still be larger than low-order schemes • Accuracy is problem-dependent, superiority for a simple model problem may not necessarily imply the same superiority for more complex problems
Numerical Accuracy • How to determine accuracy when the exact solution is not available? 1. Grid-refinement study: very expensive to obtain grid-independent solutions 2. Comparison with experimental data 3. Comparison with analytic solutions / theory log E Higher-order Lower-order log x coarse fine
Numerical Accuracy • How to improve numerical accuracy? (1) Different choices of independent variables – Cartesian, cylindrical, orthogonal curvilinear, general curvilinear (2) Different choices of dependent variables – vorticity/stream-function or primitive variables? (3) Adaptive grid – fine grid in high-gradient regions (4) Grid refinement together with Richardson extrapolation
4.4.1 Richardson Extrapolation • Numerical accuracy may be established through successive grid refinements • For a sufficiently fine grid, the solution error reduces like the leading term of truncation error • Richardson extrapolation: cancel the leading term of truncation error for two numerical solutions with different grid resolutions to achieve higher-order accuracy • Assume that the leading term dominate the truncation error, valid only if x is sufficiently fine • More economical than using higher-order scheme directly
Richardson Extrapolation E • Consider two different grids xa and xb m = 2 m = 4 x Construct a composite solutionTc = a Ta + (1 a)Tbto eliminate thetruncation error leading term
Richardson Extrapolation • Example: FTCS Scheme (for fixed s)