Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Acoustic wave equation Helmholtz Helmholtz (wave) (wave) equation equation (time-dependent) (time-dependent) -- Regular Regular grid grid -- Irregular Irregular grid grid Numerical Numerical Examples Examples Numerical Methods in Geophysics Finite Elements The Acoustic Wave Equation 1-D How do we solve a time-dependent problem such as the acoustic wave equation? ∂ 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 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... Numerical Methods in Geophysics Finite Elements The Acoustic Wave Equation 1-D 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 + ∂ ⎢∑ ci ∫ ∇ϕ i ∇ϕ j dx ⎥ = ∫ fϕ j ⎢∑ t i ∫ i j ⎥ 0 ⎦ 0 ⎣ i 0 ⎦ ⎣ i which we can write as ... Numerical Methods in Geophysics Finite Elements 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 mass matrix A stiffness matrix b ... 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? Numerical Methods in Geophysics Finite Elements FD 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 − 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? Numerical Methods in Geophysics Finite Elements The mass matrix 1 1 1 ⎡ ⎤ ⎡ ⎤ 2 2 c ϕ ϕ dx v + ∂ ⎢∑ ci ∫ ∇ϕ i ∇ϕ j dx ⎥ = ∫ fϕ j ⎢∑ t i ∫ i j ⎥ 0 ⎣ i 0 ⎦ 0 ⎣ i ⎦ ... let’s recall the definition of our basis functions ... x ⎧ ~ ⎪h +1 ⎪ i −1 ~ x ⎪ ϕ i ( ~x ) = ⎨ 1 − hi ⎪ ⎪ 0 ⎪⎩ 1 M ij = ∫ ϕ iϕ j dx 0 i=1 + 2 + h1 h2 3 + 4 + 5 + h3 h4 Numerical Methods in Geophysics 6 + h5 7 + for − hi −1 < ~ x ≤0 for 0<~ x < hi ,~ x = x − xi elsewhere ... let us calculate some element of M ... h6 Finite Elements The 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 + h1 h2 3 + 4 + 2 ⎛ x ⎞ ⎛ x⎞ ⎜⎜ ⎟⎟ dx + ∫ ⎜⎜1 − ⎟⎟ dx hi ⎠ ⎝ hi −1 ⎠ 0⎝ hi for x ≤0 − hi −1 < ~ for 0<~ x < hi elsewhere ϕi 5 + h3 h4 6 + h5 7 + xi h6 hi-1 Numerical Methods in Geophysics x ⎧ ~ ⎪h +1 ⎪ i −1 ~ x ⎪ ϕ i ( ~x ) = ⎨ 1 − hi ⎪ ⎪ 0 ⎪⎩ hi Finite Elements 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 Numerical Methods in Geophysics end end Finite Elements Numerical example – regular grid Numerical Methods in Geophysics Finite Elements Implicit Time extrapolation Let is recall the ODE: dT = f (T , t ) dt Before we used a forward difference scheme, what happens if we use a backward difference scheme? T j − T j −1 dt + O(dt ) = f (T j , t j ) ⇒ T j ≈ T j-1 + dtf (T j , t j ) Numerical Methods in Geophysics Finite Elements Implicit schemes - stability or T j ≈ T j −1 (1 + T j ≈ T0 (1 + dt τ dt τ ) −1 )− j Is this scheme convergent? Does it tend to the exact solution as dt->0? YES, it does (exercise) Is this scheme stable, i.e. does T decay monotonically? This requires 1 0< <1 dt 1+ τ Numerical Methods in Geophysics Finite Elements What is an implicit method? Let is recall the ODE: dT = f (T , t ) dt Before we used a forward difference scheme, what happens if we use a backward difference scheme? T j − T j −1 dt + O(dt ) = f (T j , t j ) ⇒ T j ≈ T j-1 + dtf (T j , t j ) Numerical Methods in Geophysics Numerical Methods in Geophysics Implicit FiniteMethods Elements FD extrapolation - implicit 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? Numerical Methods in Geophysics Finite Elements