0% found this document useful (0 votes)
0 views

lecture_3_methods

The document discusses various numerical methods used in geophysics, particularly for solving partial differential equations related to the acoustic wave equation, including finite differences, finite elements, and pseudospectral methods. It highlights the importance of numerical solutions for seismic wave propagation and the challenges of stability and dispersion in these methods. Additionally, it introduces the Fast Fourier Transform (FFT) and its efficiency in handling large-scale problems in numerical analysis.

Uploaded by

Mado Saeed
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

lecture_3_methods

The document discusses various numerical methods used in geophysics, particularly for solving partial differential equations related to the acoustic wave equation, including finite differences, finite elements, and pseudospectral methods. It highlights the importance of numerical solutions for seismic wave propagation and the challenges of stability and dispersion in these methods. Additionally, it introduces the Fast Fourier Transform (FFT) and its efficiency in handling large-scale problems in numerical analysis.

Uploaded by

Mado Saeed
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 61

Numerical methods

Specific methods:
• Finite differences
• Pseudospectral methods
• Finite volumes

… applied to the acoustic wave equation …


Why numerical methods
Example: seismic wave propagation

Seismometers

Generally heterogeneous
medium

… we need numerical
explosion solutions! … we need grids! …
And big computers …
Partial Differential Equations in Geophysics

 2t p c 2 p  s The acoustic
wave equation
 ( 2x   2y   2z ) - seismology
- acoustics
PP pressure
pressure - oceanography
cc acoustic - meteorology
acousticwave
wavespeed
speed
ss sources
sources

 t C kC  v  C  RC  p Diffusion, advection,


Reaction
CC tracer - geodynamics
tracerconcentration
concentration - oceanography
kk diffusivity
diffusivity - meteorology
vv flow
flowvelocity
velocity - geochemistry
RR reactivity
reactivity - sedimentology
pp sources
sources - geophysical fluid dynamics
Numerical methods: properties

Finite differences - time-dependent PDEs


- seismic wave propagation
- geophysical fluid dynamics
- Maxwell’s equations
- Ground penetrating radar
-> robust, simple concept, easy to
parallelize, regular grids, explicit method

- static and time-dependent PDEs


Finite elements - seismic wave propagation
- geophysical fluid dynamics
- all problems
-> implicit approach, matrix inversion, well founded,
irregular grids, more complex algorithms,
engineering problems

Finite volumes - time-dependent PDEs


- seismic wave propagation
- mainly fluid dynamics
-> robust, simple concept, irregular grids, explicit
method
Other Numerical methods:

Particle-based - lattice gas methods


- molecular dynamics
methods - granular problems
- fluid flow
- earthquake simulations
-> very heterogeneous problems, nonlinear problems

Boundary element - problems with boundaries (rupture)


- based on analytical solutions
methods - only discretization of planes
--> good for problems with special boundary conditions
(rupture, cracks, etc)

Pseudospectral - orthogonal basis functions, special case of FD


- spectral accuracy of space derivatives
methods - wave propagation, GPR
-> regular grids, explicit method, problems with
strongly heterogeneous media
What is a finite difference?

Common definitions of the derivative of f(x):

f ( x  dx)  f ( x)
 x f  lim
dx  0 dx
f ( x)  f ( x  dx)
 x f  lim
dx  0 dx
f ( x  dx)  f ( x  dx)
 x f  lim
dx  0 2dx

These are all correct definitions in the limit dx->0.

But we want dx to remain FINITE


What is a finite difference?

The equivalent approximations of the derivatives are:

 f ( x  dx)  f ( x)
x f  forward difference
dx

 f ( x)  f ( x  dx)
x f  backward difference
dx

f ( x  dx)  f ( x  dx)
x f  centered difference
2dx
The big question:

How good are the FD approximations?


This leads us to Taylor series....
Our first FD algorithm (ac1d.m) !

 2t p c 2 p  s PP pressure
pressure
cc acoustic
acousticwave
wavespeed
speed
 ( 2x   2y   2z ) ss sources
sources

Problem:
Problem:Solve
Solvethe
the1D
1Dacoustic
acousticwave
waveequation
equationusing
usingthe
thefinite
finite
Difference method.
Difference method.

Solution:
Solution:

c 2 dt 2
p (t  dt )  2
 p ( x  dx)  2 p ( x)  p ( x  dx)
dx
 2 p (t )  p (t  dt )  sdt 2
Problems: Stability

c 2 dt 2
p (t  dt )  2
 p ( x  dx)  2 p ( x)  p ( x  dx)
dx
 2 p (t )  p (t  dt )  sdt 2

Stability:
Stability:Careful
Carefulanalysis
analysisusing
usingharmonic
harmonicfunctions
functionsshows
showsthat
that
aastable
stablenumerical
numericalcalculation
calculationisissubject
subjectto
tospecial
specialconditions
conditions
(conditional
(conditionalstability).
stability).This
Thisholds
holdsfor
formany
manynumerical
numericalproblems.
problems.

dt
c  1
dx
Problems: Dispersion

c 2 dt 2
p (t  dt )  2
 p ( x  dx)  2 p ( x)  p ( x  dx)
dx
 2 p (t )  p (t  dt )  sdt 2

Dispersion:
Dispersion:The The
numerical
numerical
approximation
approximationhas has
artificial
artificialdispersion,
dispersion,
in
in other words,the
other words, thewave
wave
speed
speedbecomes
becomes
frequency
frequencydependent.
dependent.
You
Youhave
haveto tofind
findaa
True velocity
frequency
frequencybandwidth
bandwidth
where
where this effectisis
this effect
small.
small.
The
Thesolution
solutionisisto
touse
useaa
sufficient
sufficientnumber
numberof ofgrid
grid
points
pointsperperwavelength.
wavelength.
Our first FD code!

c 2 dt 2
p (t  dt )  2
 p ( x  dx)  2 p ( x)  p ( x  dx)
dx
 2 p (t )  p (t  dt )  sdt 2
% Time stepping

for i=1:nt,

% FD

disp(sprintf(' Time step : %i',i));

for j=2:nx-1
d2p(j)=(p(j+1)-2*p(j)+p(j-1))/dx^2; % space derivative
end
pnew=2*p-pold+d2p*dt^2; % time extrapolation
pnew(nx/2)=pnew(nx/2)+src(i)*dt^2; % add source term
pold=p; % time levels
p=pnew;
p(1)=0; % set boundaries pressure free
p(nx)=0;

% Display
plot(x,p,'b-')
title(' FD ')
drawnow

end
Snapshot Example
Velocity 5 km/s
3000

2500

2000
Time (s)

1500

1000

500

0
0 1000 2000 3000 4000 5000 6000
Distance (km)
Seismogram Dispersion
Finite Differences - Summary

•• Conceptually
Conceptuallythethemost
mostsimple
simpleofofthe
thenumerical
numericalmethods
methodsandand
can
canbe
belearned
learnedquite
quitequickly
quickly
•• Depending
Dependingon onthe
thephysical
physicalproblem
problemFD FDmethods
methodsare are
conditionally
conditionally stable
stable(relation
(relationbetween
betweentime
timeand
andspace
space
increment)
increment)
•• FD
FDmethods
methodshave
havedifficulties
difficultiesconcerning
concerningthetheaccurate
accurate
implementation
implementationof ofboundary
boundaryconditions
conditions(e.g.
(e.g.free
freesurfaces,
surfaces,
absorbing
absorbingboundaries)
boundaries)
•• FD
FDmethods
methodsareareusually
usuallyexplicit
explicitand
andtherefore
thereforevery
veryeasy
easyto
to
implement
implementandandefficient
efficientononparallel
parallelcomputers
computers
•• FD
FDmethods
methodswork
workbest
bestononregular,
regular,rectangular
rectangulargrids
grids
The Fourier Method

- What is a pseudo-spectral Method?

- Fourier Derivatives

- The Fast Fourier Transform (FFT)

- The Acoustic Wave Equation with the Fourier Method

- Comparison with the Finite-Difference Method

- Dispersion and Stability of Fourier Solutions

Numerical Methods in Geophysics The Fourier Method


What is a pseudo-spectral Method?

Spectral solutions to time-dependent PDEs are formulated


in the frequency-wavenumber domain and solutions are
obtained in terms of spectra (e.g. seismograms). This
technique is particularly interesting for geometries where
partial solutions in the -k domain can be obtained
analytically (e.g. for layered models).

In the pseudo-spectral approach - in a finite-difference like


manner - the PDEs are solved pointwise in physical space
(x-t). However, the space derivatives are calculated using
orthogonal functions (e.g. Fourier Integrals, Chebyshev
polynomials). They are either evaluated using matrix-
matrix multiplications or the fast Fourier transform (FFT).

Numerical Methods in Geophysics The Fourier Method


Fourier Derivatives

.. let us recall the definition of the derivative using Fourier integrals ...

 
 x f ( x)  x  F (k )e dk 
 ikx

 

 ikF (k )e  ikx dk


... we could either ...

1) perform this calculation in the space domain by convolution

2) actually transform the function f(x) in the k-domain and back

Numerical Methods in Geophysics The Fourier Method


The Fast Fourier Transform

... the latter approach became interesting with the introduction of the
Fast Fourier Transform (FFT). What’s so fast about it ?

The FFT originates from a paper by Cooley and Tukey (1965, Math.
Comp. vol 19 297-301) which revolutionised all fields where Fourier
transforms where essential to progress.

The discrete Fourier Transform can be written as


N1
1
uˆ k 
N
 j
u
j 0
e  2ikj / N
, k 0,1,..., N  1

N1
u k  uˆ j e 2ikj / N , k 0,1,..., N  1
j 0

Numerical Methods in Geophysics The Fourier Method


The Fast Fourier Transform

... this can be written as matrix-vector products ...


for example the inverse transform yields ...

1 1 1 1  1   uˆ0   u0 
1
  2 3   N  1   uˆ1   u1 
1  2 4 6   2 N  2   uˆ 2   u 2 
    
        
        
 ( N  1) 2     
1 
N1
      uˆ N  1   u N  1 

.. where ...

 e 2i / N
Numerical Methods in Geophysics The Fourier Method
The Fast Fourier Transform

... the FAST bit is recognising that the full matrix - vector multiplication
can be written as a few sparse matrix - vector multiplications
(for details see for example Bracewell, the Fourier Transform and its
applications, MacGraw-Hill) with the effect that:

Number of multiplications

full matrix FFT

N2 2Nlog2N

this has enormous implications for large scale problems.


Note: the factorisation becomes particularly simple and effective
when N is a highly composite number (power of 2).

Numerical Methods in Geophysics The Fourier Method


The Fast Fourier Transform

Number of multiplications

Problem full matrix FFT Ratio full/FFT

1D (nx=512) 2.6x105 9.2x103 28.4


1D (nx=2096) 94.98
1D (nx=8384) 312.6

.. the right column can be regarded as the speedup of an algorithm


when the FFT is used instead of the full system.

Numerical Methods in Geophysics The Fourier Method


Acoustic Wave Equation - Fourier Method

let us take the acoustic wave equation with variable density

1 2  1 
 t p  
x  x p 
c 2
 

the left hand side will be expressed with our


standard centered finite-difference approach

1  1 
 p (t  dt )  2 p (t )  p (t  dt )   
x  x p 
c dt
2 2
 

... leading to the extrapolation scheme ...

Numerical Methods in Geophysics The Fourier Method


Acoustic Wave Equation - Fourier Method

 1 
p (t  dt )  c 2 dt 2  x   x p   2 p (t )  p (t  dt )
 

where the space derivatives will be calculated using the Fourier Method.
The highlighted term will be calculated as follows:

ˆ n  ik P
Pjn  FFT  P ˆ n  FFT  1   P n
   x j

multiply by 1/
n n
1  1 ˆ  1 ˆ 1 1 n
 x Pjn  FFT    x P   ik   x P   FFT   x   x Pj 
      
... then extrapolate ...

Numerical Methods in Geophysics The Fourier Method


Acoustic Wave Equation - 3D

p (t  dt ) 
 1  1  1 
c dt   x   x p    y   y p    z   z p  
2
 2

      
 2 p (t )  p (t  dt )

.. where the following algorithm applies to each space dimension ...

ˆ n  ik P
Pjn  FFT  P ˆ n  FFT  1   P n
   x j
n n
1  1 ˆ  1 ˆ 1 1 n
 x Pjn  FFT    x P   ik   x P   FFT   x   x Pj 
      

Numerical Methods in Geophysics The Fourier Method


Comparison with finite differences - Algorithm

let us compare the core of the algorithm - the calculation of the


derivative
(Matlab code)
function df=fder1d(f,dx,nop)
% fDER1D(f,dx,nop) finite difference
% second derivative

nx=max(size(f));

n2=(nop-1)/2;

if nop==3; d=[1 -2 1]/dx^2; end


if nop==5; d=[-1/12 4/3 -5/2 4/3 -1/12]/dx^2; end

df=[1:nx]*0;

for i=1:nop;
df=df+d(i).*cshift1d(f,-n2+(i-1));
end

Numerical Methods in Geophysics The Fourier Method


Comparison with finite differences - Algorithm

... and the first derivative using FFTs ...

function df=sder1d(f,dx)
% SDER1D(f,dx) spectral derivative of vector
nx=max(size(f));

% initialize k
kmax=pi/dx;
dk=kmax/(nx/2);
for i=1:nx/2, k(i)=(i)*dk; k(nx/2+i)=-kmax+(i)*dk; end
k=sqrt(-1)*k;

% FFT and IFFT


ff=fft(f); ff=k.*ff; df=real(ifft(ff));

.. simple and elegant ...

Numerical Methods in Geophysics The Fourier Method


Fourier Method - Dispersion and Stability

... with the usual Ansatz


n i ( kjdx  ndt )
p e
j

we obtain
2 n 2 i ( kjdx  ndt )
 p  k e
x j

24 n 2 dt i ( kjdx  ndt )


 p  2 sin
t j e
dt 2
... leading to

2 dt
k sin
cdt 2
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Dispersion and Stability

2 dt 2  1 kcdt
k sin   sin ( )
cdt 2 dt 2

What are the consequences?

a) when dt << 1, sin-1 (kcdt/2) kcdt/2 and w/k=c


-> practically no dispersion
b) the argument of asin must be smaller than one.

k max cdt
1
2
cdt / dx 2 /  0.636

Numerical Methods in Geophysics The Fourier Method


Fourier Method - Comparison with FD - 10Hz

Source time function Gauss in space


1 1

0.5
0.5
0

-0.5 0
0 200 400 600 0 10 20 30
3 point - 2 order; T = 6.6 s, Error = 50.8352%
1

0.5

-0.5

0.8 0.9 1 1.1 1.2 1.3 1.4 1.5


Time (sec)
Example of acoustic 1D wave simulation.
FD 3 -point operator
red-analytic; blue-numerical; green-difference
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 10Hz

Source time function Gauss in space


1 1

0.5
0.5
0

-0.5 0
0 200 400 600 0 10 20 30
5 point - 2 order; T = 7.8 s, Error = 3.9286%
1

0.5

-0.5

0.8 0.9 1 1.1 1.2 1.3 1.4 1.5


Time (sec)
Example of acoustic 1D wave simulation.
FD 5 -point operator
red-analytic; blue-numerical; green-difference
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 10Hz

Source time function Gauss in space


1 1

0.5
0.5
0

-0.5 0
0 200 400 600 0 10 20 30
Fourier - 2 order; T = 35 s, Error = 2.72504%
1

0.5

-0.5

-1
0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
Time (sec)

Example of acoustic 1D wave simulation.


Fourier operator
red-analytic; blue-numerical; green-difference
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 20Hz

Source time function Gauss in space


1 1

0.5
0.5
0

-0.5 0
0 200 400 600 0 10 20 30
3 point - 2 order; T = 7.8 s, Error = 156.038%
1

0.5

-0.5

-1
0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
Time (sec)

Example of acoustic 1D wave simulation.


FD 3 -point operator
red-analytic; blue-numerical; green-difference
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 20Hz

Source time function Gauss in space


1 1

0.5
0.5
0

-0.5 0
0 200 400 600 0 10 20 30
5 point - 2 order; T = 7.8 s, Error = 45.2487%
1

0.5

-0.5

0.8 0.9 1 1.1 1.2 1.3 1.4 1.5


Time (sec)

Example of acoustic 1D wave simulation.


FD 5 -point operator
red-analytic; blue-numerical; green-difference
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 20Hz

Source time function Gauss in space


1 1

0.5
0.5
0

-0.5 0
0 200 400 600 0 10 20 30
Fourier - 2 order; T = 34 s, Error = 18.0134%
1

0.5

-0.5

-1
0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
Time (sec)

Example of acoustic 1D wave simulation.


Fourier operator
red-analytic; blue-numerical; green-difference
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - Table

Difference (%) between numerical and analytical solution


as a function of propagating frequency

160

140

120
Simulation time
100
3 point 5.4s
80 5 point 7.8s
Fourier 33.0s
60

40

20

0
5 Hz 10 Hz 20 Hz

Numerical Methods in Geophysics The Fourier Method


Numerical solutions and Green’s Functions

The concept of Green’s Functions (impulse responses) plays an


important role in the solution of partial differential equations. It is also
useful for numerical solutions. Let us recall the acoustic wave equation

t2 p c 2 p

with  being the Laplace operator. We now introduce a delta source in


space and time

t2 p  ( x) (t )  c 2 p
the formal solution to this equation is

1  (t  x / c )
p ( x, t ) 
4c 2 x

(Full proof given in Aki and Richards, Quantitative Seismology, Freeman+Co, 1981, p. 65)

Numerical Methods in Geophysics The Fourier Method


Numerical solutions and Green’s Functions

1  (t  x / c )
p ( x, t ) 
4c 2 x

In words this means (in 1D and 3D but not in 2D, why?) , that in
homogeneous media the same source time function which is input at the
source location will be recorded at a distance r, but with amplitude
proportional to 1/r.

An arbitrary source can evidently be constructed by summing up different


delta - solutions. Can we use this property in our numerical simulations?

What happens if we solve our numerical system with delta functions as


sources?

Numerical Methods in Geophysics The Fourier Method


Numerical solutions and Green’s Functions
1

0.8 Source is a Delta


0.6 function in space and
3 point operator
0.4 time
0.2
0
10 200 400 600 800 1000

0.8

0.6
5 point operator
0.4

0.2
0
10 200 400 600 800 1000

0.8

0.6
Fourier Method
0.4

0.2
0
Impulse response (analytical)
0 200 400 600 800 1000
Impulse response (numerical
Time steps

Numerical Methods in Geophysics The Fourier Method


Numerical solutions and Green’s Functions

3 point operator 5 point operator Fourier Method


10 10 10

Impulse response (analytical) concolved with source


Impulse response (numerical convolved with source
9 9 9

8 8 8

7 7 7
Frequency increases

6 6 6

5 5 5

4 4 4

3 3 3

2 2 2

1 1 1

0 0 0
500 1000 1500 500 1000 1500 500 1000 1500

Numerical Methods in Geophysics The Fourier Method


Fourier Method - Summary

The Fourier Method can be considered as the limit of the finite-difference


method as the length of the operator tends to the number of points along
a particular dimension.

The space derivatives are calculated in the wavenumber domain by


multiplication of the spectrum with ik. The inverse Fourier transform
results in an exact space derivative up to the Nyquist frequency.

The use of Fourier transform imposes some constraints on the


smoothness of the functions to be differentiated. Discontinuities lead to
Gibb’s phenomenon.

As the Fourier transform requires periodicity this technique is particular


useful where the physical problems are periodical (e.g. angular
derivatives in cylindrical problems).

Numerical Methods in Geophysics The Fourier Method


Finite Elements – the concept

How to proceed in FEM analysis:

• Divide structure into pieces (like LEGO)

• Describe behaviour of the physical


quantities
in each element

• Connect (assemble) the elements at the


nodes
to form an approximate system of
equations
for the whole structure

• Solve the system of equations involving


unknown
quantities at the nodes (e.g. displacements)

• Calculate desired quantities (e.g. strains


Finite Elements – Why?

FEM allows discretization of bodies with arbitrary shape.


Originally designed for problems in static elasticity.

FEM is the most widely applied computer simulation method


in engineering.

Today spectral elements is an attractive new method with


applications in seismology and geophysical fluid dynamics

The required grid generation techniques are interfaced with


graphical techniques (CAD).

Today a large number of commercial FEM software is


available (e.g. ANSYS, SMART, MATLAB, ABACUS, etc.)
Finite Elements – Examples
Discretization – finite elements

As we are aiming to find a numerical solution to our


problem it is clear we have to discretize the problem
somehow. In FE problems – similar to FD – the functional
values are known at a discrete set of points.

... regular
grid ...

... irregular grid ...

Domain D
The key idea in FE analysis is to approximate all
functions in terms of basis functions , so that
N
u u~  ci i
i 1
Finite elements – basic formulation

Let us start with a simple linear system of equations

Ax b |*y

and observe that we can generally multiply both sides


of this equation with y without changing its solution.
Note that x,y and b are vectors and A is a matrix.

 yAx yb y  n
We first look at Poisson’s equation (e.g., wave
equation without time dependence)
 u ( x)  f ( x)
where u is a scalar field, f is a source term and in 1-D
2

 2  2
x
Formulation – Poisson’s equation

We now multiply this equation with an arbitrary


function v(x), (dropping the explicit space
dependence)
 uv  fv

... and integrate this equation over the whole domain.


For reasons of simplicity we define our physical
domain D in the interval [0, 1].

 uv fv
D D
1 1
 uvdx fvdx
0 0

... why are we doing this? ... be patient ...


Partial Integration

... partially integrate the left-hand-side of our


equation ... 1 1
 uvdx fvdx
0 0

1 1
 uvdx uv 0  vudx
1

0 0

we assume for now that the derivatives of u at the boundaries


vanish
so that for our particular problem
1 1
 uvdx vudx
0 0
... so that we arrive at ...
1 1

uvdx fvdx
0 0

... with u being the unknown function. This is also true for our
approximate numerical system
1 1
~vdx  fvdx
u
0
 0
... where ...

N
u~  ci i
i 1

was our choice of approximating u using basis functions.


The basis functions

we are looking for functions i 1 for x  xi


 i ( x) 
with the following property 0 for x  x j , j i

10
... otherwise we
are free to choose 9
any function ...
8

The simplest 7
choice are of 6
course linear
functions: 5

4
+ grid nodes
3
blue lines – basis 2
functions i
1
The discrete system

The ingredients: N
v  k u~  ci i
i 1
1 1
~vdx  fvdx

0
u  0

1 1
 n 
   ci i   k dx f  k dx
0  i 1  0

... leading to ...


The discrete system

... the coefficients ck are constants so that for one


particular function k this system looks like ...

n 1 1

 c   dx f  dx
i 1
i i k k
0 0

... probably not to your surprise this can be written in matrix


form

bi Aik  g k
T
A b g kik i
The solution

... with the even less surprising solution

bi  A   T 1
ik gk

remember that while the bi’s are really the coefficients of the
basis functions these are the actual function values at node
points i as well because of our particular choice of basis
functions.
Basis functions and element

Linear Quadratic
Trangles
Quadrangles
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

t j  u j dx f j dx
2 2
 u dx  v
0 0 0

.. we now introduce an approximation for u using our previous


basis functions...
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

 t i  i j 
    ci  i  j dx  f j
2 2
 c dx  v
 i 0   i 0  0
which we can write as ...
Time extrapolation

 1
  1
 1

 t i  i j 
    ci  i  j dx  f j
2 2
 c dx  v
 i 0   i 0  0

M A b
mass matrix 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?


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
T
M  2   v A ck  g
 dt 
... 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?
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
end end
Numerical example – regular grid

This is a movie obtained with the sample Matlab program: femfd.m


Finite Elements - Summary

• FE solutions are based on the “weak form” of the partial


differential equations
• FE methods lead in general to a linear system of equations
that has to be solved using matrix inversion techniques
(sometimes these matrices can be diagonalized)
• FE methods allow rectangular (hexahedral), or triangular
(tetrahedral) elements and are thus more flexible in terms of
grid geometry
• The FE method is mathematically and algorithmically more
complex than FD
• The FE method is well suited for elasto-static and elasto-
dynamic problems (e.g. crustal deformation)

You might also like