Beruflich Dokumente
Kultur Dokumente
Regular grid
Irregular grid
t2u v 2 u = f
where v is the wave speed.
using the same ideas as before we multiply this equation with
an arbitrary function and integrate over the whole domain, e.g. [0,1], and
after partial integration
1
2
2
dx
v
t j
u j dx = f j dx
u u~ = ci (t ) i ( x)
i =1
t2u t2u~ = t2 ci (t ) i ( x)
i =1
together we obtain
1
1
1
2
2
dx
+
v
t i i j
ci i j dx = f j
0
i
i 0
0
Time extrapolation
1
1
1
2
2
+
c
dx
v
t i i j
ci i j dx = f j
0
i
i 0
0
mass matrix
stiffness matrix
M T c&& + v 2 AT c = g
... remember the coefficients c correspond to the
actual values of u at the grid points for the right choice
of basis functions ...
How can we solve this time-dependent problem?
Finite element method
Time extrapolation
M T c&& + v 2 AT c = g
... let us use a finite-difference approximation for
the time derivative ...
ck +1 2c + ck 1 2 T
M
+ v A ck = g
2
dt
ck +1 = ( M T ) 1 ( g v 2 AT ck ) dt 2 + 2ck ck 1
we already know how to calculate the matrix A but
how can we calculate matrix M?
Mass matrix
1
1
1
2
2
c
dx
+
v
t i i j
ci i j dx = f j
0
i
i 0
0
x
~
h +1
i 1 ~
x
i ( ~x ) = 1
hi
M ij = i j dx
0
i=1
+
2
+
3
+
h1 h2
Finite element method
4
+
h3
5
6 7
+ + +
h4 h5 h6
for
x 0
hi 1 < ~
for
x < hi
0<~
x = x xi
,~
elsewhere
hi 1
M ii = i i dx =
hi 1 hi
=
+
3
3
i=1
+
2
+
3
+
h1 h2
4
+
h3
dx + 1 dx
hi
hi 1
0
hi
for
x 0
hi 1 < ~
for
x < hi
0<~
elsewhere
ji
5
6 7
+ + +
h4 h5 h6
xi
hi-1
x
~
h +1
i 1 ~
x
i ( ~x ) = 1
hi
hi
7
Matrix assembly
Mij
Aij
M=zeros(nx);
A=zeros(nx);
for i=2:nx-1,
for i=2:nx-1,
for j=2:nx-1,
for j=2:nx-1,
if i==j,
if i==j,
M(i,j)=h(i-1)/3+h(i)/3;
A(i,j)=1/h(i-1)+1/h(i);
elseif j==i+1
elseif i==j+1
M(i,j)=h(i)/6;
A(i,j)=-1/h(i-1);
elseif j==i-1
elseif i+1==j
M(i,j)=h(i)/6;
A(i,j)=-1/h(i);
else
else
M(i,j)=0;
A(i,j)=0;
end
end
end
end
end
end
Numerical example
ck +1 2c + ck 1 2 T
M
+ v A ck +1 = g
2
dt
] (gdt
T 1
ck +1 = M + v dt A
T
+ M T (2c ck 1 )
10
Summary
The
The time-dependent
time-dependent problem
problem (wave
(wave equation)
equation) leads
leads to
to the
the
introduction
introduction of
of the
the mass
mass matrix.
matrix.
The
The numerical
numerical solution
solution requires
requires the
the inversion
inversion of
of aa system
system
matrix
matrix (it
(it may
may be
be sparse).
sparse).
Both
Both explicit
explicit or
or implicit
implicit formulations
formulations of
of the
the time-dependent
time-dependent part
part
are
are possible.
possible.
11