Upload
ashley-mosley
View
214
Download
0
Embed Size (px)
Citation preview
1Finite element method
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.
2Finite element method
Acoustic wave equation in 1D
How do we solve a time-dependent problem suchas the acoustic wave equation?
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], andafter partial integration
fuvut 22
dxfdxuvdxu jjjt 1
0
1
0
21
0
2
.. we now introduce an approximation for u using our previous basis functions...
3Finite element method
Weak form of wave equation
)()(~1
xtcuu i
N
ii
together we obtain
)()(~1
222 xtcuu i
N
iittt
note that now our coefficients are time-dependent!... and ...
1
0
1
0
21
0
2jj
iiij
iiit fdxcvdxc
which we can write as ...
4Finite element method
Time extrapolation
1
0
1
0
21
0
2jj
iiij
iiit fdxcvdxc
... in Matrix form ...
gcAvcM TT 2
M A b
... remember the coefficients c correspond to the actual values of u at the grid points for the right choiceof basis functions ...
How can we solve this time-dependent problem?
stiffness matrixmass matrix
5Finite element method
Time extrapolation
... let us use a finite-difference approximation forthe time derivative ...
gcAvcM TT 2
... leading to the solution at time tk+1:
gcAvdt
cccM k
TkkT
2
211 2
1221
1 2)()(
kkkTT
k ccdtcAvgMc
we already know how to calculate the matrix A but how can we calculate matrix M?
6Finite element method
Mass matrix
1
0
1
0
21
0
2jj
iiij
iiit fdxcvdxc
... let’s recall the definition of our basis functions ...
1
0
dxM jiij ii
i
ii
i xxx
elsewhere
hxforh
x
xhforh
x
x
~,
0
~0~
1
0~1~
)~(
11
i=1 2 3 4 5 6 7 + + + + + + + h1 h2 h3 h4 h5 h6
... let us calculate some element of M ...
7Finite element method
Mass matrix – some elements
33
1
1
0
2
0
2
1
1
0
1
ii
h
i
h
iiiii
hh
dxh
xdx
h
xdxM
ii
elsewhere
hxforh
x
xhforh
x
x ii
ii
i
0
~0~
1
0~1~
)~(
11
i=1 2 3 4 5 6 7 + + + + + + + h1 h2 h3 h4 h5 h6
Diagonal elements: Mii, i=2,n-1
hi
xi
ji
hi-1
8Finite element method
Matrix assembly
% assemble matrix Mij
M=zeros(nx);
for i=2:nx-1,
for j=2:nx-1,
if i==j,
M(i,j)=h(i-1)/3+h(i)/3;
elseif j==i+1
M(i,j)=h(i)/6;
elseif j==i-1
M(i,j)=h(i)/6;
else
M(i,j)=0;
end
end
end
% assemble matrix Aij
A=zeros(nx);
for i=2:nx-1,
for j=2:nx-1,
if i==j,
A(i,j)=1/h(i-1)+1/h(i);
elseif i==j+1
A(i,j)=-1/h(i-1);
elseif i+1==j
A(i,j)=-1/h(i);
else
A(i,j)=0;
end
end
end
Mij Aij
9Finite element method
Numerical example
10Finite element method
Implicit time integration
... let us use an implicit finite-difference approximation forthe time derivative ...
gcAvcM TT 2
... leading to the solution at time tk+1:
gcAvdt
cccM k
TkkT
12
211 2
121221 2
k
TTTk ccMgdtAdtvMc
How do the numerical solutions compare?
11Finite element method
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.
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.