

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
Material Type: Assignment; Class: TIME DEPNDT PROBS; Subject: Applied Mathematics; University: University of Washington - Seattle; Term: Spring 2005;
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Amath-Math 586/Atm S 581 Spring 2005
Final Assignment Solution
, j = 0,…, N , based on
piecewise linear chapeau functions ( )
j
j
and 0 at all other nodes:
0
N
j j
j
=
∑
The node x
0
= 0 is chosen to be the left boundary, so its expansion coefficient is
determined by the left BC to be = sin(50 t ). The node x
0
q ( ) t
0
q ( ) t
N
is chosen to be the right
boundary; its expansion coefficient is unknown. Let ∆ x
j +1/
= x
j +
j
. As in class, the FEM
equations are found by zeroing the projection of the residual onto each basis function that has
an unknown expansion coefficient:
0 0
N N
n
j jn jn n
n n
da
x R x t I J a j N
dt
= =
∑ ∑
The required inner products are easily computed for the interior nodes:
1/ 2
1/ 2 1/ 2
1/ 2
j
jn j n j j
j
x n j
I x x x x n j j N
x n j
−
− +
n
jn j
n j
d
J x n j j N
dx
n j
N
For the right boundary node, only the projections with the node to its left and the self-
projection between
N 1
x x x
−
< < contribute, altering the inner products to:
1/ 2
1/ 2
N
Nn N n
N
x n N
I x x
x n N
−
−
n
Nn N
n N d
J x
dx n N
Defining the solution vector q ( t ) = { q
j
( t ), j = 1,…, N }, the tridiagonal inner product matrices
jn
jn
, j , n = 1,…, N ), and the vectors i 0
, j 0
0 n
0 n
, j , n = 1,…, N ), we can write the
FEM in matrix form as
10 0 10 0
I dq dt J q j
d
j dt
q
I Jq
Using trapezoidal time differencing, we obtain the desired time-discretized FEM:
1 1 1 1
01 10 0 0 10 0 0
n n n n n n n n
r I q q t J q q j
t
j
= − − ∆ − + 2 1 − +
q q q q
01 1
n n
r j
t t j
q q.
The Matlab script finalp1.m on the class web page implements this tridiagonal system for
time-marching the advection equation with the specified IC and BC. The first part uses the
matrices I and J computed for constant grid spacing ∆ x = 0.01 (problem 1); the second part
recalculates these matrices for the stretched grid x j
j
1/
j
= 0.02 j , j = 1,…,50.
Fig. 1 compares these two solutions at t = 0.9 with the exact solution
q x t ( , ) = sin 50 max( t − x , 0). Both do a decent job near the left boundary, where the wave
is being forced and where even the stretched grid has a resolution sufficient to resolve the
wave well. The uniform-grid solution is quite respectable throughout the domain, but the
stretched-grid solution starts to degrade near the right boundary where it no longer has
sufficient resolution to adequately resolve a wave of wavelength 2π/50.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
−1.
−
−0.
0
1
2
x
u(x,t=0.75)
Exact
FEM(unif dx)
FEM(var dx)
Fig. 1. FEM solutions to advection equation with uniform and stretched grids.
solution to the wave equation IBVP generated by the Matlab PDE toolbox:
−0.
0
1
−0.
0
1
−0.
−0.
−0.
−0.
−0.
0
Time=2 Color: u Height: u
−0.
−0.1 5
−0.
−0.0 5
0
Fig. 2