
































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Difference operators, LTE, Stability of the schemes, three upwind schemes for Advection equation, Lax-Wendrof, Leap-Frog and crank-Nicholson, and their Matlab codes
Typology: Lab Reports
1 / 40
This page cannot be seen from the preview
Don't miss anything!

































We considered few of the finite difference methods including the three Upwind Schemes, Lax-
Wendorff Scheme and Crank-Nicholson Scheme for the numerical solution of the hyperbolic
equations. We first implemented the methods in MATLAB and did experiments to compare the
results obtained using these methods for two different initial-boundary value problems for the
advection equation. We have also provided the stability analysis and error analysis of these
methods and verified it through numerical results for different values of the corresponding
Courant number.
CHAPTER 1
INTRODUCTION
Mathematics arises in different kinds of problems. Problems were found in commerce, land
measurement, architecture and astronomy. Today, all sciences suggest problems studied by
mathematicians, and many problems arise within mathematics itself. For example,
the physicist Richard Feynman derived the path integral formulations of quantum mechanics
using a combination of mathematical reasoning and physical insight, and today's string theory, a
still-developing scientific theory which attempts to unify the four fundamental forces of nature,
continues to inspire new mathematics [1].
Mathematics is relevant only in the area that inspired it and is applied to solve further problems
in that area. But often mathematics inspired by one area proves useful in many areas and joins
the general stock of mathematical concepts. A distinction is often made between pure
mathematics and applied mathematics[2]. However pure mathematics topics often turn out to
have applications, e.g. number theory in cryptography. This remarkable fact, that even the
"purest" mathematics often turns out to have practical applications, is what Eugene Wigner has
called "the unreasonable effectiveness of mathematics" And applied mathematics topics often
turn out to have application, e.g. differential equation in physics. Historically, applied
mathematics consisted principally of applied analysis, most notably differential equations.
1.1 Differential Equation:
A differential equation is an equation that relates the function with its derivatives. In applications,
the functions usually represent physical quantities, the derivatives represent their rates of
change and the equation defines a relationship between the two. Because such relations are
extremely common differential equations play a prominent role in many disciplines
including engineering, physics, economics and biology.
For example, in classical mechanics, the motion of a body is described by its position and
velocity as the time value varies. Newton's laws allow these variables to be expressed
dynamically (given the position, velocity, acceleration and various forces acting on the body) as
a differential equation for the unknown position of the body as a function of time. Differential
equations first came into existence with the invention of calculus by Newton and Leibniz.
Isaac Newton listed three kinds of differential equations:
Differential equations can be divided into several types. Apart from describing the properties of
the equation itself, these classes of differential equations can help in choosing the approach to
find a solution. Commonly used distinctions include whether the equation is: ordinary or partial_._
An ordinary differential equation (ODE) is an equation containing an unknown function of one
real or complex variable 𝑥, its derivatives, and some given functions of 𝑥. The unknown function
is generally represented by variable(often denoted 𝑦 ) ,which, therefore, depends on 𝑥. Thus 𝑥 is
often called the independent variable of the equation.
A partial differential equation(PDE) is a differential equation that contains unknown multivariable
functions and their partial derivatives. (This is in contrast to ordinary differential equations, which
deal with functions of a single variable and their derivatives.) PDEs are used to formulate
problems involving functions of several variables.
PDEs can be used to describe a wide variety of phenomena such as sound, heat, diffusion,
electrostatics, electrodynamics, fluid dynamics, quantum mechanics. These seemingly distinct
physical phenomena can be formalised similarly in terms of PDEs. Just as ordinary differential
equations often model one dimensional dynamical systems, partial differential equations often
model multidimensional systems. PDEs find their generalisation in stochastic partial differential
equations.
Let we have a partial differential equation (PDE) for the function 𝑢(𝑥, 𝑦) in the form
This relation implies that the function 𝑢(𝑥, 𝑦) is independent of 𝑥. However, the equation gives
no information on the function's dependence on the variable 𝑦. Hence the general solution of
this equation is
The most general case of second-order linear Partial Differential Equation (PDE) in two
independent variables is given by
𝜕 ² 𝑢
𝜕𝑥 ²
𝜕 ² 𝑢
𝜕𝑥𝜕𝑦
𝜕 ² 𝑢
𝜕𝑥 ²
𝜕𝑢
𝜕𝑥
𝜕𝑢
𝜕𝑦
where the coefficients A, B and C are functions of 𝑥 and 𝑦 and do not vanish simultaneously,
because in that case the second-order PDE degenerates to one of first order. Further, the
coefficients D, E and F are also assumed to be functions of 𝑥 and 𝑦. We shall assume that the
function 𝑢
and the coefficients are twice continuously differentiable in some domain 𝛺. The
classification of second-order PDE depends on the form of the leading part of the equation
consisting of the second order terms. So, for simplicity of notation, we combine the lower order
terms and rewrite the above equation in the following form
The three most widely used numerical methods to solve PDEs are the Finite Element
Method (FEM), Finite Volume Methods (FVM) and Finite Difference Methods (FDM).
Finite-difference methods are numerical methods for approximating the solutions of differential
equations using finite difference approximations to approximate derivatives.
The finite difference methods work by replacing the region, over which the independent
variables in the PDE are define, by a finite grid (or mesh) of points at which the different
variables is approximated. The partial derivatives in the PDE at each grid point are
approximated from neighbouring values by using Taylor series.
The Finite Element Method (FEM) (its practical application often known as Finite Element
Analysis (FEA) is a numerical technique for finding approximate solutions of Partial Differential
Equations (PDE) as well as of integral equations. The solution approach is based either on
eliminating the differential equation completely (steady state problems), or rendering the PDE
into an approximating system of ordinary differential equations, which are then numerically
integrated using standard techniques such as Euler's method, Runge–Kutta etc[3].
Similar to the finite difference method or finite element method, values are calculated at discrete
places on a meshed geometry. "Finite volume" refers to the small volume surrounding each
node point on a mesh. In the finite volume method, surface integrals in a partial differential
equation that contain a divergence term are converted to volume integrals, using the divergence
theorem. These terms are then evaluated as fluxes at the surfaces of each finite volume.
Because the flux entering a given volume is identical to that leaving the adjacent volume, these
methods conserve mass by design[4].
There are many applications of numerical analysis in many different fields. Some applications
are mentioned here.
physical system.
algebra, sometimes differential equations are solved.
finite element methods.
simulation with finite elements)
using numerical analysis.
ODEs and PDEs
1.5 History of Numerical Analysis:
Modern numerical analysis can be credibly said to begin with the 1947 paper by John von
Neumann and Herman Goldstein, "Numerical Inverting of Matrices of Higher Order" (Bulletin of
the AMS, Nov. 1947). It is one of the first papers to study rounding error and include discussion
of what today is called scientific computing. Although numerical analysis has a longer and
richer history, "modern" numerical analysis, as used here, is characterized by the synergy of the
programmable electronic computer, mathematical analysis, and the opportunity and need to
solve large and complex problems in applications. The need for advances in applications, such
as ballistics prediction, neutron transport, and nonsteady, multidimensional fluid dynamics drove
the development of the computer and depended strongly on advances in numerical analysis and
mathematical modelling.
Modern numerical analysis and scientific computing developed quickly and on many fronts. Our
current focus is on numerical linear algebra, numerical methods for differential and integral
equations, methods of approximation of functions, and the impact of these developments on
science and technology. Of particular current interest is the impact of mathematical software
packages[6].
𝜕 ²
𝜕𝑦 ²
“time” variable (usually 𝑡).
intersections of gridlines (node points) For example, node points for 𝑢(𝑥, 𝑡) are shown in
separation between successive horizontal or vertical node points is the same, but ∆𝑥 ≠ ∆ t in
general).
𝑗
0
𝑛
0
0
0
function 𝑢
𝑗
𝑛
𝑗
𝑛
subscripts, and the time variable by a superscript. So
𝑗
𝑛
𝑗
𝑛
𝑗,𝑘
𝑛
𝑗
𝑘
𝑛
𝑗,𝑘,𝑙
𝑛
𝑗
𝑘
𝑙
𝑛
The definition of a derivative:
𝑓
′
(𝑥) = 𝑙𝑖𝑚
ℎ→ 0
{
𝑓(𝑥+ℎ)−𝑓(𝑥)
ℎ
}
If we instead make ℎ > 0 a “small” fixed number, then
′
𝑓
( 𝑥+ℎ
) −𝑓
( 𝑥
)
ℎ
𝐹 𝑓
( 𝑥
)
ℎ
Where F denotes the forward diff erence operator with grid size ℎ:
𝑗
𝑗
𝑗
𝑗
𝑗+ 1
𝑗
Equation (2.2) is our first finite diff erence approximation — we can also use backward and
central diff erence operators to approximate derivatives, and the most common of these are
defined below. Note that if the function we want to diff erence depends on more than one
variable then we need to specify which variable the diff erence is applied to. This is done by
adding an appropriate subscript to the diff erence operator. Diff erence operators can be applied
to grid functions (like 𝑢 𝑗
𝑛
) and continuous functions ( like 𝑢
𝑥
𝑗
𝑛
𝑗+ 1
𝑛
𝑗
𝑛
𝑡
𝑗
𝑛
𝑗
𝑛+ 1
𝑗
𝑛
𝑥
𝑗
𝑛
𝑗
𝑛
𝑗− 1
𝑛
𝑡
𝑗
𝑛
𝑗
𝑛
𝑗
𝑛− 1
st
𝑥
𝑗
𝑛
𝑗+ 1
𝑛
𝑗− 1
𝑛
𝑡
𝑗
𝑛
𝑗
𝑛+ 1
𝑗
𝑛− 1
nd
𝑥
²
𝑗
𝑛
𝑗+ 1
𝑛
𝑗
𝑛
𝑗− 1
𝑛
𝑡
²
𝑗
𝑛
𝑗
𝑛= 1
𝑗
𝑛
𝑗
𝑛− 1
These diff erence operators are also defined for continuous functions with a shift of ∆𝑥 in the 𝑥
direction and ∆𝑡 in the 𝑡 direction. For example,
𝑥
²
Diff erence operators for functions of diff erent variables are defined in the obvious way: for
example,
𝑦
𝑧
∗
∗
(𝑎, 𝑏). then
∗
∗
′
∗
2
′′
∗
𝑛
(𝑛)
∗
( 𝑛+ 1
)
(𝑛+ 1 )
Let ф(𝑥, 𝑦) and all its partial derivatives with respect to 𝑡 and 𝑦 up to order 𝑛 + 1 be
and let
∗
∗
∗
∗
Then
∗
∗
∗
∗
∗
∗
2
∗
∗
𝑛
∗
∗
(𝑛+ 1 )
∗
∗
∗
∗
We use shorthand for the diff erential operator:
In numerical analysis, von Neumann stability analysis (also known as Fourier stability analysis)
is a procedure used to check the stability of finite difference schemes as applied to linear partial
differential equations[8].
We can check stability of a numerical method by different kind of methods. Stability is
sometimes achieved by including numerical diffusion. Numerical diffusion is a mathematical
term which ensures that roundoff and other errors in the calculation get spread out and do not
add up to cause the calculation to "blow up". Von Neumann stability analysis is a commonly
used procedure for the stability analysis of finite difference schemes as applied to linear partial
differential equations. These results do not hold for nonlinear PDEs, where a general, consistent
definition of stability is complicated by many properties absent in linear equations.
Summary: von Neumann stability analysis
Take one component 𝑢
𝑗
𝑛
𝑛
𝑖𝑗𝜔
and plug it into the diff erence scheme to find 𝜉
in terms of 𝜔 and 𝑟.
Decide if |𝜉(𝜔, 𝑟)| ≤ 1 for all 𝜔 (up to periodicity), or what restriction has to be put
on 𝑟 to make this true.
If |𝜉| ≤ 1 for all 𝜔, then the scheme is von Neumann stable. Otherwise it is
unstable.
Criteria
If |𝜉| > 1 at frequency 𝜔 then |𝑢
𝑗
𝑛
|→ ∞ as 𝑛 → ∞ , so the solution blows up at this
frequency and the scheme is said to be unstable;
If
≤ 1 f or all ω then |𝑢
𝑗
𝑛
| remains bounded as n → ∞ at all frequencies and the
scheme is called von Neumann stable.
Where 𝜉 is called the amplification factor.
The approximate solution 𝑢
𝑗
𝑛
converges to the exact solution 𝑢 at (𝑥
∗
∗
) if
∗
∗
𝑥
∗
/∆𝑥
𝑡
∗
/∆𝑡
Given a properly posed linear initial value problem and a finite diff erence approximation
condition then the scheme converges[9].
In fact, the full result is actually stronger than this if the scheme is consistent then stability⇔
convergence. Therefore, it is enough to establish stability and consistency to get convergence.
On the other hand, instability rules out convergence.
𝑡
𝑥
𝑡
𝑥
. We’ll use forward
diff erences for 𝑢 𝑡
(i.e. FT) on the usual uniform grid in (𝑥, 𝑡) space
𝑢
𝑡
|
(𝑥
𝑗
,𝑡
𝑛
)≈
(𝑢
𝑗
𝑛+ 1
−𝑢
𝑗
𝑛
)
∆𝑡
There are various possibilities for 𝑢 𝑥
𝑥
𝑗
𝑛
(𝑢
𝑗
𝑛
−𝑢
𝑗− 1
𝑛
)
∆𝑥
𝑥
𝑗
𝑛
(𝑢
𝑗+ 1
𝑛
−𝑢
𝑗− 1
𝑛
)
2 ∆𝑥
𝑥
𝑗
𝑛
(𝑢
𝑗+ 1
𝑛
−𝑢
𝑗
𝑛
)
∆𝑥
forward difference (FS)
This uses forward difference in time and backward difference in space at (
𝑗
𝑛
, so it has the
operator ℒ ∆
given by
∆
𝑗
𝑛
𝐹
𝑡
∆𝑡
𝐵
𝑥
∆𝑥
𝑗
𝑛
∆
𝑗
𝑛
𝐹
𝑡
∆𝑡
𝐵
𝑥
∆𝑥
𝑗
𝑛
𝑡
𝑗
𝑛
𝑥
𝑗
𝑛
𝑢
𝑗
𝑛+ 1
−𝑢
𝑗
𝑛
∆𝑡
𝑢
𝑗
𝑛
−𝑢
𝑗− 1
𝑛
∆𝑥
𝑗
𝑛+ 1
𝑗
𝑛
∆𝑡
∆𝑥
𝑗
𝑛
𝑗− 1
𝑛
𝑗
𝑛+ 1
𝑗
𝑛
∆𝑡
∆𝑥
𝑗
𝑛
𝑗− 1
𝑛
𝑗
𝑛+ 1
𝑗
𝑛
𝑗
𝑛
𝑗− 1
𝑛
∆𝑡
∆𝑥
𝑗
𝑛
𝑗
𝑛
𝑗
𝑛
𝑗
𝑛
𝑥
𝑗
𝑛
2
𝑥𝑥
𝑗
𝑛
3
𝑎
∆𝑥
𝑥
𝑗
𝑛
∆𝑥
2
2!
𝑥𝑥
𝑗
𝑛
3
𝑥
𝑗
𝑛
𝑎∆𝑥
2!
𝑥𝑥
𝑗
𝑛
2
Now
𝑡
𝑗
𝑛
∆𝑡
2!
𝑡𝑡
𝑗
𝑛
𝑥
𝑗
𝑛
𝑎∆𝑥
2!
𝑥𝑥
𝑗
𝑛
2
2
We know that
𝑡
𝑥
= 0 or 𝑢
𝑡
𝑥
This also implies that 𝑢 𝑡𝑡
2
𝑥𝑥
Therefore we have
2
𝑥𝑥
𝑥𝑥
2
2
𝑥𝑥
2
2
Hence it shows that FTBS scheme is first order accurate both in time and space. To make the
leading term of the LTE zero we need to choose a∆𝑡 = ∆𝑥 which can only happen if 𝑎 > 0 , and it
means that 𝑝 = 1 , when 𝑝 = 1 the FTBS approximation reduces to
𝑗
𝑛+ 1
𝑗− 1
𝑛
which is an exact solution of the PDE_._
𝑗
𝑛
𝑛
𝑖𝑗𝜔
in equation (2.3) that is
𝑗
𝑛+ 1
𝑗
𝑛
𝑗− 1
𝑛
𝑗
𝑛
𝑛
𝑖𝑗𝜔
𝑛+ 1
𝑖𝑗𝜔
𝑛
𝑖𝑗𝜔
𝑛
𝑖(𝑗− 1 )𝜔
𝑛
𝑖𝑗𝜔
−𝑖𝜔
−𝑖𝜔
We need
2
2
2
2
2
2
∆𝑡
∆𝑥
∆𝑥
𝑎
Hence FTBS scheme is stable if and only if 𝑎 > 0 and ∆𝑡 ≤
∆𝑥
𝑎
Note that if 𝑎 ≤ 0 then the scheme is stable for ∆𝑡.
This uses forward difference both in time and space at (𝑥 𝑗
𝑛
), ( i.e. the FTFS) so it has the
operator ℒ
∆
given by
∆
𝑗
𝑛
𝐹 𝑡
∆𝑡
𝐹 𝑥
∆𝑥
𝑗
𝑛
∆
𝑗
𝑛
The FTCS scheme is also first order accurate both in time and space.
The von Neumann amplification factor for this scheme is
Hence
2
So this scheme is completely unstable (unconditionally unstable), no matter what values of 𝑎
and 𝑝 are used. It is equally bad for 𝑎 > 0 and 𝑎 < 0.
This is a modification of the (unstable) FTCS scheme. It can be derived by Taylor expanding ,
𝑢(𝑥, 𝑡 + ∆𝑡) replacing time derivatives by space derivatives (by means of the PDE(𝑢 𝑡
𝑥
0 ), and using central diff erences to approximate the space derivatives_._
𝑡
𝑥
𝑘
𝑘
2
2
2
3
(𝑥,𝑡)
2
2
2
2
3
(𝑥,𝑡)
𝑥
2
2
𝑥
2
2
3
(𝑥,𝑡)
This suggests the (explicit) scheme
𝑗
𝑛+ 1
𝑗
𝑛
𝑗+ 1
𝑛
𝑗− 1
𝑛
2
𝑗− 1
𝑛
𝑗
𝑛
𝑗+ 1
𝑛
Which can be rearranged to give
𝑗
𝑛+ 1
2
𝑗
𝑛
𝑝
2
𝑗+ 1
𝑛
𝑝
2
𝑗− 1
𝑛
The leading term of the LTE for the Lax–Wendroff scheme is
2
𝑡𝑡𝑡
2
𝑥𝑥𝑥
And so it is second order accurate in both time and space.
𝑗
𝑛
𝑛
𝑖𝑗𝜔
By putting in equation (1) we get
𝑛+ 1
𝑖𝑗𝜔
2
𝑛
𝑖𝑗𝜔
𝑛
𝑖𝜔(𝑗+ 1 )
𝑛
𝑖𝜔(𝑗− 1 )
2
𝑖𝜔
−𝑖𝜔
2
𝑖𝜔
−𝑖𝜔
2
𝑝
2
2
𝑝
2
2
𝑝
2
2
2
2
2
2
2
2
− 2 𝑖𝑝𝑆𝐶 where 𝑆 = 𝑠𝑖𝑛
𝜔
2
and 𝐶 = 𝑐𝑜𝑠
𝜔
2
2
2
2
2
2
4
4
2
2
2
2
2
4
4
2
2
2
2
2
2
4
2
2
2
If 𝑝 lies between [− 1 1 ] then the scheme will be stable.