240 likes | 502 Views
The Finite-Difference Method. Taylor Series Expansion. Suppose we have a continuous function f ( x ), its value in the vicinity of can be approximately expressed using a Taylor series as. (2.1). Using (2.1), we have derive the discrete expression for the first order derivative as.
E N D
The Finite-Difference Method Taylor Series Expansion Suppose we have a continuous function f(x), its value in the vicinity of can be approximately expressed using a Taylor series as (2.1) Using (2.1), we have derive the discrete expression for the first order derivative as (2.2)
Backward f(x) Replacing x by xi+1 or xi-1, in (2.2) or substracting Taylor expansion equation for xi-1 from xi+1, we can get Central Forward x i-2 i-1 ii+1 i+2 ; we obtain Expressing
The order of the higher-order terms that are deleted from the right-hand sides of the discrete equation. In numerical method, they are called “truncation errors”. General forms: FDS: The first order accurate BDS: The first order accurate CDS: The second order accurate Exercise: Derive CDS and determine its truncation error
For the second order derivative, we also can use the same approach. Use the uniform grid Example: (2.3) (2.4) Eq. (2.3) + Eq. (2.4) Then, we have Centered Difference Scheme (CDS) with second order accuracy
X: i=1, 2, 3….N Y: j=1,2,3…...M i,j+1 i-1,j i,j i+1,j i,j-1 Fig. 2.2: Uniform rectangular grids. Example of constructing the difference equation Select the CDS The basic idea for the finite-difference method is to replace the derivatives using the discrete approximation and convert the differential equation to a set of algebraic equations.
The time derivatives FDS n-1 BDS n n+1 CDS
g C x Fig. 2.3: Schematic of a propagation of a blob. 2.2. Numerical Schemes Explicitscheme: Anumerical scheme in which the numerical value at time step (n+1) is calculated directly from its previous value at the time step n. This means that once the values at the time step n are known, we can “predict” a new value at the time step (n+1) by a direct time integration. Implicit scheme: A numerical scheme in which the numerical value at the time step (n+1) is not explicitly obtained from its previous value at the time step n. This value must be solved from an algebraic equation formed at the time step n+1. Example: It is solvable, with a general form
a) Leapfrog Scheme (2.5) Truncation error: for time derivative for space derivative Then, the difference equation is
First-order accurate Second-order accurate b). Forward Time/Central Space Scheme (Euler Scheme) Truncation error: .
First-order accurate First-order accurate c). Forward Time/Backward Space Scheme Truncation errors: Sometime, it is also called the upwind scheme for the case C > 0.
First-order accurate Second-order accurate d). Forward Time/Implicit Central Space Scheme This is a fully-implicit scheme!
First-order accurate Second-order accurate e). Crank-Nicolson Scheme—Semi-implicit Scheme Truncation errors:
t f). Lax-Wendroff Scheme n+1 n+1/2 n x Then i-1 i+1/2 i-1/2 i i+1 Fig. 2.5: The space-time stencil used to construct the Lax-Wendroff scheme Truncation errors:
QS: How could we know which scheme is better? Or How do we evaluate these schemes? Next ! Note: The next Wed is the exercise class to work on modeling project #1 Dr. Huang will be supervisor for that in-class lab work.