Post on 13-Jun-2020
Introduction to Introduction to Numerical Differential Numerical Differential
EquationsEquations
Partial Differential EquationsPartial Differential Equations• A relation involving an unknown
function of several independent variables and its partial derivativeswith respect to those variables
• Formulate and solve problems that involve unknown functions of several variables in real world
• Completely distinct physical problems may have identical mathematical formulations
ODE and PDEODE and PDE• Ordinary differential equation (ODE)
• Partial differential equation (PDE)
Types of Types of PDEsPDEs• Hyperbolic equation (Wave Equation)
– Describe propagation of waves– The most simple example:
)(),()()0,(
),(
,0
atxtxuconditioninitialxxu
txUuxua
tu
−Φ=Φ=
=
=∂∂
+∂∂
Types of Types of PDEsPDEs• Parabolic equation (Diffusion Equation)
– Describe energy conservation– The most simple example:
conditioninitialxxutxUuxu
tu
)()0,(),(
,2
2
Φ==
∂∂
=∂∂ γ
Types of Types of PDEsPDEs• Elliptic equation (Equilibrium Equation)
– Describe steady state of heat diffusion– The most simple example:2D Laplacian
Equation
conditioninitialyxyxutyxUu
yu
xu
),()0,,(),,(
,02
2
2
2
Φ==
=∂∂
+∂∂
Differentiation and IntegrationDifferentiation and Integration
dvdt
v
ta
tdtdva =
v
t
∫=b
avdty
y
DifferentiationDifferentiation IntegrationIntegration
Numerical Operations Numerical Operations • Compute derivatives on discretized
domain: discrete points, 2D grid, 3D grid, unstructured mesh…
• ODE ordinary differential equation• PDE partial differential equation• Approximate continuous derivatives
with numerical differential operators–Use Taylor expansion …
Taylor expansionTaylor expansion• Taylor series expansion
• Assume that the discrete points are distributed equally
( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) K
K
!3!2
!3!2
0
30i
0
20i
00i0i
0i
xx3
33
xx2
22
xx0i
000
+′′′−+′′−
+′−+=
−=Δ
+Δ
+Δ
+Δ+====
xfxxxfxxxfxxxfxf
xxx
dxfdx
dxfdx
dxdfxxfxf
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) [ ]
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) [ ]3 !3
!2
1 !3
!2
i
3
i
2
ii1-i
i
3
i
2
ii1i
K
K
xfxxfxxfxxfxf
xfxxfxxfxxfxf
′′′Δ−′′Δ
+′Δ−=
+′′′Δ+′′Δ
+′Δ+=+
Forward difference schemeForward difference scheme• From the Taylor expansion
• Forward Differentiation
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) !3
!2 i
3
i
2
ii1i K+′′′Δ+′′Δ
+′Δ=−+ xfxxfxxfxxfxf
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) !3
!2 i
3
i
2
i1ii K+′′′Δ−′′Δ
−−=′Δ + xfxxfxxfxfxfx
( ) ( ) ( ) ( ) ( ) ( ) ( ) !3
!2 i
2
ii1i
i K+′′′Δ−′′Δ
−⎟⎠⎞
⎜⎝⎛
Δ−
=′ + xfxxfxx
xfxfxf
( ) ( ) ( )⎟⎠⎞
⎜⎝⎛
Δ−
≈′ +
xxfxfxf i1i
i
( ) ( ) ( ) ( ) !3
!2
Error ion Approximat i
2
i K+′′′Δ+′′Δ
= xfxxfx
Backward difference schemeBackward difference scheme
( ) ( ) ( ) 1-iii ⎟
⎠⎞
⎜⎝⎛
Δ−
≈′x
xfxfxf
( ) ( ) ( ) ( ) !3
!2
Error ion Approximat i
2
i K+′′′Δ+′′Δ
= xfxxfx
Central difference schemeCentral difference scheme• By averaging FD and BD, central difference
scheme can provide reduced approximation error
• the errors of the forward and backward 1st derivative of the equations have an error of the order of O(Δx) and the central differentiation has an error of order O(Δx2). The central difference has better accuracy and lower error that the others
( ) ( ) ( ) 2
1-i1ii ⎟
⎠⎞
⎜⎝⎛
Δ−
≈′ +
xxfxfxf
( ) ( ) !3
Error ion Approximat i
2
K+′′′Δ= xfx
Second order derivativeSecond order derivative
It will require three terms to get a central 2nd derivative of discrete set of data.
This is central difference scheme, more schemes can be applied to approximate second order derivatives…
( ) ( ) ( ) ( ) ( )[ ] xOE 2 22
1-ii1ii Δ+⎟
⎠⎞
⎜⎝⎛
Δ+−
=′′ +
xxfxfxfxf
Use finite difference operationUse finite difference operationto solve PDEto solve PDE
• For simple wave function
• Use time and space differences, we can derive a recursive equation
0=∂∂
+∂∂
xua
tu
)(
0
11
11
nk
nk
nk
nk
nk
nk
nk
nk
uuxtauu
xuua
tuu
−+
−+
−ΔΔ
−=
≈Δ−
+Δ−
Initial and boundary conditionsInitial and boundary conditions• To solve the recursive equation, we
need to know the function that describe the values of u at time 0
• We also have to know the values on the boundary x=0 at any time
)()0,( xxu Φ=
)(),0( xtu Θ=
Truncation ErrorTruncation Error• By using finite operators, we represent
partial derivatives by discrete approximations
• For example, if using Forward Difference– We know in Taylor expansion of x
– In general, the FD() results differs from exact solution D() by a truncation error in the first order of delta_x and delta_t
( ) ( ) ( ) ( ) !3
!2
Error ion Approximat i
2
i K+′′′Δ+′′Δ
= xfxxfx
),O( )()(F txuDuD nk ΔΔ=−
Truncation ErrorsTruncation Errors• Use other scheme, we may achieve
other orders of Δx and Δt• In general
• l and m are the order of truncation errors
),T( )()( mlnk txuLuL ΔΔ=−
ConsistencyConsistency• Then we define “Consistency” of an finite
difference scheme
0),T( )()(00
→ΔΔ=−
→Δ→Δ
mlnk txuLuLtx
StabilityStability• Definition:
– Suppose un+1 is a solution at time n+1, u0 is initial condition, a numerical scheme is stable if
– Here || || defines the error of numerical scheme and k, beta are constants
– This should be satisfied for any
01 ukeu tn β≤+
t≤0
Lax TheoremLax Theorem• Convergence: a difference scheme
approximates the PDE is convergent scheme if for any x and t, numerical solution u(n,k) converges to exact solution v(x,t) when Δx 0 and Δt 0
• Lax Theorem: If a consistency two level scheme for a linear PDE is table, then the scheme is convergence
Boundary ConditionsBoundary Conditions• Periodic boundary
• Dirichlet boundary: constant boundary values
• Neumann boundary: first derivative known
),(),0( tnVtV =
)(),( xftxV =
cdx
txdV=
),(
Explicit and Implicit SchemesExplicit and Implicit Schemes• Two different strategy to solve
differential equations• An simple example, to solve
• We could use Euler method and Backward Euler method FD scheme to compute
Euler MethodEuler Method• Very straightforward method, from
• We yields
• This is the most simple explicit scheme
• Explicit means that the new value are defined in terms of things that already known in the previous step
Backward Euler MethodBackward Euler Method• Instead of Euler method, we use
• Then, we get
• This is an implicit scheme• Implicit means that the new value is
defined in terms of things in the same step
Explicit Scheme LimitationExplicit Scheme Limitation• If f(t,y) is simply defined as f = –ay• Then for Euler method:
• The truncate error from 0 to n should not be amplified, this is the requirement for the stability of the explicit scheme
• In order to implement this, we need to satisfy that
01
1
21
)1()1(
)1()1(
yahyah
yahyahahyyynn
nnnnn+
+
−=−==
−=−=−=
L
11 <− ah
CFL ConditionCFL Condition• This is a simple case of Courant–
Friedrichs–Lewy condition (CFL condition)
• Explicit solver is conditionally stable• Explicit scheme is simple to compute• Explicit scheme requires small time
step. Therefore, require lots of steps to achieve satisfied results
Implicit SchemeImplicit Scheme• For backward Euler method,
• It is easy to find the for any h>0, this implicit scheme is stable
• Implicit scheme is generally unconditionally stable
• We can choose large h to achieve satisfied results in a small number of steps
10
1
11
)1(1 ++
++
+==
+=
−=
nn
n
nnn
ahy
ahyy
ahyyy
L
Numerical methodsNumerical methods• Many methods exist and are
improved for solving PDEs• How to choose:
–particular applications–Accuracy requirement–performance requirement–Computational resources–…