Numerical Solutions to Heat Equation and Wave Equation using Explicit Schemes, Assignments of Mathematics

Information on solving the heat equation and wave equation numerically using explicit schemes. It includes instructions for a specific assignment in math 572: numerical methods for scientific computing ii, where students are required to make contour and surface plots of the numerical solution for the heat equation at time t = 2. The document also discusses the concept of instability in difference schemes and provides examples of the convergence of numerical solutions to the correct value for the wave equation, even when the scheme is unstable.

Typology: Assignments

Pre 2010

Uploaded on 09/17/2009

koofers-user-c8j
koofers-user-c8j 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MATH 572 Numerical Methods for Scientific Computing II Winter 2005
Assignment #6 due : Thursday, April 7
1. Consider the heat equation in two dimensions, vt=vxx +vyy , on the domain 0 x, y 1
with Dirichlet boundary conditions v(0, y, t) = v(1, y, t) = v(x, 0, t) = 0, v(x, 1, t) = 1 and
initial condition v(x, y, 0) = 0. The solution v(x, y, t) represents the temperature of a
square plate that is heated on one side and cooled on the other three sides. Solve the
problem numerically up to time t= 2 using the explicit scheme un+1
j,l =un
j,l +k(Dx
+Dx
+
Dy
+Dy
)un
j,l. Take h= 0.1 and k= 0.0025. Make a contour plot and a surface plot of the
numerical solution at time t= 2 (including the boundary values). The relevant commands
in Matlab are contour and mesh (or surf).
2. Fritz John wrote in his textbook on partial differential equations, “Instability of a
difference scheme under small perturbations does not exclude the possibility that in special
cases the scheme converges towards the correct function, if no errors are permitted in the
data or the computation.” He gave the following example to illustrate this principle.
a) Consider the wave equation vt+cvx=0, v (x, 0) = f(x), c > 0. Show that the numerical
solution determined by the upwind scheme can be expressed as
un
j= ((1 )I+cλS)nfj=
n
X
l=0 n
l(1 )nl()lfjl,
and the numerical solution determined by the downwind scheme can be expressed as
wn
j= ((1 + )IcλS+)nfj=
n
X
l=0 n
l(1 + )nl()lfj+l.
b) Let f(x) = eαx and take t=tn=nk, x =xj=jh with λ=k
hfixed. Using the
formulas derived above, show that the numerical solutions vn
j, wn
jconverge to the correct
value v(x, t) = eα(xct)as n for any value of λ.
In other words, the numerical solution converges even when the scheme is unstable. Fritz
John noted that despite appearances, this result is in fact consistent with the CFL condition
since an analytic function (such as f(x) = eαx) is determined by its values in any interval.
It should further be noted that in computing the solution of a problem that is physically
unstable (e.g. Kelvin-Helmholtz instability of a shear layer), it is necessary to use an
unstable scheme (to ensure consistency).
3. Consider the wave equation vt+vx= 0 with two cases of initial data v(x, 0) given by
f1(x) = (1, x < 0
0, x = 0
1, x > 0
, f2(x) = (1, x < 0
12|x1|,0x2
1, x > 2
.
Compute the solution for 1x5,0t2 using the upwind scheme and the
downwind scheme, with h= 0.05 and k= 0.04,0.06. For each scheme, plot the numerical
solution and the exact solution (on the same plot) at t= 0 and t= 2. Discuss the results.

Partial preview of the text

Download Numerical Solutions to Heat Equation and Wave Equation using Explicit Schemes and more Assignments Mathematics in PDF only on Docsity!

MATH 572 Numerical Methods for Scientific Computing II Winter 2005

Assignment #6 due : Thursday, April 7

  1. Consider the heat equation in two dimensions, vt = vxx +vyy , on the domain 0 ≤ x, y ≤ 1 with Dirichlet boundary conditions v(0, y, t) = v(1, y, t) = v(x, 0 , t) = 0, v(x, 1 , t) = 1 and initial condition v(x, y, 0) = 0. The solution v(x, y, t) represents the temperature of a square plate that is heated on one side and cooled on the other three sides. Solve the problem numerically up to time t = 2 using the explicit scheme un j,l+1 = unj,l + k(Dx +Dx − +

Dy +Dy −)unj,l. Take h = 0.1 and k = 0.0025. Make a contour plot and a surface plot of the numerical solution at time t = 2 (including the boundary values). The relevant commands in Matlab are contour and mesh (or surf).

  1. Fritz John wrote in his textbook on partial differential equations, “Instability of a difference scheme under small perturbations does not exclude the possibility that in special cases the scheme converges towards the correct function, if no errors are permitted in the data or the computation.” He gave the following example to illustrate this principle.

a) Consider the wave equation vt + cvx = 0, v(x, 0) = f (x), c > 0. Show that the numerical solution determined by the upwind scheme can be expressed as

unj = ((1 − cλ)I + cλS−)nfj =

∑^ n

l=

n l

(1 − cλ)n−l(cλ)lfj−l,

and the numerical solution determined by the downwind scheme can be expressed as

wjn = ((1 + cλ)I − cλS+)nfj =

∑^ n

l=

n l

(1 + cλ)n−l(−cλ)lfj+l.

b) Let f (x) = eαx^ and take t = tn = nk, x = xj = jh with λ = kh fixed. Using the formulas derived above, show that the numerical solutions vjn , wjn converge to the correct

value v(x, t) = eα(x−ct)^ as n → ∞ for any value of λ.

In other words, the numerical solution converges even when the scheme is unstable. Fritz John noted that despite appearances, this result is in fact consistent with the CFL condition since an analytic function (such as f (x) = eαx) is determined by its values in any interval. It should further be noted that in computing the solution of a problem that is physically unstable (e.g. Kelvin-Helmholtz instability of a shear layer), it is necessary to use an unstable scheme (to ensure consistency).

  1. Consider the wave equation vt + vx = 0 with two cases of initial data v(x, 0) given by

f 1 (x) =

{ (^1) , x < 0 0 , x = 0 − 1 , x > 0

, f 2 (x) =

{ (^) − 1 , x < 0 1 − 2 |x − 1 | , 0 ≤ x ≤ 2 − 1 , x > 2

Compute the solution for − 1 ≤ x ≤ 5 , 0 ≤ t ≤ 2 using the upwind scheme and the downwind scheme, with h = 0.05 and k = 0. 04 , 0 .06. For each scheme, plot the numerical solution and the exact solution (on the same plot) at t = 0 and t = 2. Discuss the results.