Scope

advertisement
Finite Elements: 1D acoustic wave equation
 Helmholtz (wave) equation (time-dependent)


Regular grid
Irregular grid
 Explicit time integration
 Implicit time integraton
 Numerical Examples
Scope: Understand the basic concept of the finite element
method applied to the 1D acoustic wave equation.
Finite element method
1
Acoustic wave equation in 1D
How do we solve a time-dependent problem such
as the acoustic wave equation?
t2u  v2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
1
1
0
0
0
2
2

u

dx

v
 t j
 u j dx   f j dx
.. we now introduce an approximation for u using our previous
basis functions...
Finite element method
2
Weak form of wave equation
N
u  u~   ci (t ) i ( x)
i 1
note that now our coefficients are time-dependent!
... and ...
N
 t2u   t2u~   t2  ci (t ) i ( x)
i 1
together we obtain
1
1
1




2
2

c


dx

v
 t i  i j 
 ci   i  j dx   f j
0
 i

 i 0
 0
which we can write as ...
Finite element method
3
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
M
A
mass matrix
b
stiffness matrix
... in Matrix form ...
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
4
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


T
... leading to the solution at time tk+1:


ck 1  (M T )1 ( g  v2 AT ck ) dt2  2ck  ck 1
we already know how to calculate the matrix A but
how can we calculate matrix M?
Finite element method
5
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
... let’s recall the definition of our basis functions ...
1
M ij    i j dx
0
i=1
+
2
+
3
+
h1 h2
Finite element method
4
+
h3
x
 ~
h 1
 i 1 ~
x

~
i ( x )   1 
hi

 0

5
6 7
+ + +
h4 h5 h6
for  hi 1  ~
x 0
for
0~
x  hi
,~
x  x  xi
elsewhere
... let us calculate some
element of M ...
6
Mass matrix – some elements
Diagonal elements: Mii, i=2,n-1
1
hi 1
0
0
M ii    i i dx 

2
hi 1 hi


3
3
i=1
+
2
+
3
+
h1 h2
4
+
h3
2
 x 

x

 dx   1   dx
hi 
 hi 1 
0
hi
for  hi 1  ~
x 0
for
0~
x  hi
elsewhere
ji
5
6 7
+ + +
h4 h5 h6
xi
hi-1
Finite element method
x
 ~
h 1
 i 1 ~
x

 i ( ~x )   1 
hi

0


hi
7
Matrix assembly
Mij
Aij
% assemble matrix Mij
% assemble matrix 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
Finite element method
end
end
8
Numerical example
Finite element method
9
Implicit time integration
M T c  v 2 AT c  g
... let us use an implicit finite-difference approximation for
the time derivative ...
 ck 1  2c  ck 1  2 T
M 
  v A ck 1  g
2
dt


T
... leading to the solution at time tk+1:

2
2
 gdt
T 1
ck 1  M  v dt A
T
2

 M T 2c  ck 1 
How do the numerical solutions compare?
Finite element method
10
Summary
The time-dependent problem (wave equation) leads to the
introduction of the mass matrix.
The numerical solution requires the inversion of a system
matrix (it may be sparse).
Both explicit or implicit formulations of the time-dependent part
are possible.
Finite element method
11
Download