Download - Numerical modeling of rock deformation
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
Numerical modeling of rock deformation:
06 FEM Introduction
Stefan [email protected]
NO E 61
AS 2009, Thursday 10-12, NO D 11
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
Introduction• We have learned that geodynamic processes can be described with partial
differential equations (PDE’s) derived from the concepts of continuum mechanics.
• These PDE’s describing geodynamic processes are often complicated and non-linear and closed-form analytical solutions do not exist.
• Therefore, the PDE’s are transformed into a system of linear equations which can be solved by a computer.
• The finite element method (FEM) is one method to transform systems of PDE’s into systems of linear equations. Other methods are for example the finite difference method, the finite volume method, the spectral method or the boundary element method.
• In this lecture the basic concept of the FEM is introduced by transforming a simple ordinary equation into a system of linear equations.
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
u
x0 L
B
Case A)
The model equation
2
2
( ) 0u xA Bx
This equation is a second order, inhomogeneous ordinary differential equation.
Physically it describes for example:
• A) The deflection of a stretched wire under a lateral load (u = deflection, A = tension, B = lateral load)
• B) Steady state heat conduction with radiogenic heat production(u = temperature, A = thermal diffusivity, B = heat production)
• C) Viscous fluid flow between parallel plates(u = velocity, A = viscosity, B = pressure drop)
We consider the equation
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
The analytical solution
u
x0 L
B
We find the general analytical solution by simple integration
2
2
1
21 2
( ) integrate
( ) integrate
( )2
x
x
u x B dxAx
u x B x C dxx A
Bu x x C x CA
2
1
( 0) 0 0
( ) 02
u x CBLu x L C
A
2( )2 2B BLu x x xA A
x
u
L=10, A=1, B=-1
The two integration constants are found by two boundary conditions
The special solution is
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
The weak formulation - 1The original equation
2
2
( ) 0u xA Bx
2
2
( )( ) 0u xN x A Bx
Multiply with test function
2
20
2
20
( )( ) 0
( )( ) ( ) 0
L
L
u xN x A B dxx
u xN x A N x B dxx
Integrate spatially
0
0 0
00
( ) ( ) ( )( ) ( ) 0
( ) ( ) ( )( ) ( ) 0
( ) ( ) ( )( ) ( ) 0
L
L L
LL
u x N x u xN x A A N x B dxx x x x
u x N x u xN x A dx A N x B dxx x x x
u x N x u xN x A A N x B dxx x x
Integrate by parts
( )( ),
a b b aab b a a ab bx x x x x x
u xa N x b Ax
The product rule of differentiation
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
The weak formulation - 2
The first term requires our function u(x) at the boundaries x=0 and x=L and is given by the boundary conditions. Therefore, we do not need to test u(x) at these boundary points.
00
( ) ( ) ( )( ) ( ) 0L
Lu x N x u xN x A A N x B dxx x x
0
( ) ( ) ( ) 0L N x u xA N x B dx
x x
The above equation is the weak form of our original equations, because it has weaker constraints on the differentiability on our solution (only first derivative compared to second derivative in original equation).
The original equation2
2
( ) 0u xA Bx
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
The finite element approximation - 1We approximate our unknown solution as a sum of known functions, the so-called shape functions, multiplied with unknown coefficients. The shape functions are one at only one nodal point and zero at all other nodal points, so that the coefficient corresponding to a certain shape function is the solution at the node.
ix 1ix 1ix 2ix
( )u x
x
iu1iu
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
The finite element approximation - 1
1 1 11
( ) ( ) ( ) ( ) ( ) ii i i i i i
i
uu x u N x u N x N x N x
u
TN u
We approximate our unknown solution as a sum of known functions, the so-called shape functions, multiplied with unknown coefficients. The shape functions are one at only one nodal point and zero at all other nodal points, so that the coefficient corresponding to a certain shape function is the solution at the node.
ix 1ix 1ix 1ix
( )u x
x
iu1iu
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
The finite element approximation - 1
1 1 11
( ) ( ) ( ) ( ) ( ) ii i i i i i
i
uu x u N x u N x N x N x
u
TN u
1
( ) 1 1ii
i i
x x xN xx x dx
ix 1ix
x
11
( ) ii
i i
x x xN xx x dx
1
dx0
We approximate our unknown solution as a sum of known functions, the so-called shape functions, multiplied with unknown coefficients. The shape functions are one at only one nodal point and zero at all other nodal points, so that the coefficient corresponding to a certain shape function is the solution at the node.
Finite Elementix 1ix 1ix 1ix
( )u x
x
iu1iu
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
0
( ) ( ) ( ) 0L N x u xA N x B dx
x x
The finite element approximation - 2
101 1 1
1
01 11
( ) ( )( ) ( ) 0
( ) ( )
( )( )( ) ( )
0( )( )
( ) ( ) (
dx i i ii i
i i i
i
dx i ii i
i ii
i i
N x u N xA N x N x Bdx
N x u N xx x
N xu N xN x N xx A Bdx
u N xN x x xx
N x N x N xx x
1
01 11 1 1
1
1 1 1
) ( )( )
0( )( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
i i
dx i i
i ii i i i
i i i i
i
ii i i i
N xu N xx x A Bdx
u N xN x N x N x N xx x x x
N x N x N x N xux x x x Adx
uN x N x N x N xx x x x
0 01 1
( )0
( )
0
dx dx i
i
N xBdx
N x
Ku - F
The FEM where the shape functions are identical to the test (weight) functions is called Galerkin method after Boris Galerkin.
11
( ) ( ) ii i
i
uu x N x N x
u
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
20 0
2 2 20
( ) ( ) 1
0
dx dxi iii
dx
N x N xK Adx A dx
x x dxx dx AA A
dxdx dx dx
The finite element approximation - 3
2,
2
A A Bdxdx dxA A Bdxdx dx
K F
1
( ) 1 1ii
i i
x x xN xx x dx
ix 1ix
x
11
( ) ii
i i
x x xN xx x dx
1
dx0
1
0 011 1 1
( ) ( ) ( ) ( )( )
, ( )( ) ( ) ( ) ( )
i i i i
dx dx i
ii i i i
N x N x N x N xN xx x x x Adx Bdx
N xN x N x N x N xx x x x
K F
1( ) ( ) 1i iN x N xx x dx
0Ku - F
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
The finite element approximation - 4
1
2
3
02 0
0 02
000 0 0
A A Bdxdx dx uA A Bdxudx dx
u
1
2
3
0 0 0 0 00 0
20
02
uA A Bdxudx dx
u BdxA Adx dx
1
2
3
0022 00
0 2
A A Bdxdx dx uA A A u Bdxdx dx dx
u BdxA Adx dx
0 LL/2 dxdx
1 2 31 2
Local system for element 1
Local system for element 2 Global system for sum of all elements
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
The finite element approximation - 5
1
2
3
1 0 0 02
00 0 1
uA A A u Bdxdx dx dx
u
1
2
3
0022 00
0 2
A A Bdxdx dx uA A A u Bdxdx dx dx
u BdxA Adx dx
Global system without boundary conditions
Implementing boundary conditions: u1 and u3 =0
0 LL/2 dxdx
1 2 31 2
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
The finite element approximation - 5
1
2
3
1 0 0 02
00 0 1
uA A A u Bdxdx dx dx
u
1
2
3
1
2
3
1 0 0 01 2 1 55 5 5
00 0 1
1 0 0 0 01 5 1 5 12.52 2 2
0 00 0 1
uuu
uuu
1
2
3
0022 00
0 2
A A Bdxdx dx uA A A u Bdxdx dx dx
u BdxA Adx dx
21 10( 5) 5 5 12.52 2
u x
Global system without boundary conditions
Implementing boundary conditions: u1 and u3 =0
Calculate solution usingL=10 (dx=L/2=5), A=1, B=-1
Analytical solution at x=5
0 LL/2 dxdx
1 2 31 2
2( )2 2B BLu x x xA A
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
Programming finite elements - 1
11
2 3 4 5 6 7 8 9 102 3 4 5 6 7 8 9
Nine finite elements
Ten nodes
Which nodes belong to what element?Introduce a node matrix!
1 22 33 44 5
5 66 77 88 99 10
123456789
The NODE matrix assigns to each local element the corresponding global node
Global nodesLocal nodes
1 21 2
1 2
1 2 3
4 5 6
1 2
34
1 21 2
34
1 2 5 4
2 3 6 5
12
1 2 3 4
2D excursion
ix 1ix
x1
1 2
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
Programming finite elements - 2
Global nodesLocal nodes
11
2 3 4 5 6 7 8 9 102 3 4 5 6 7 8 9
Nine finite elements
Ten nodes
1 2
1
2
2
2
A A Bdxudx dxuA A Bdx
dx dx
Local system for finite element 4
1 22 33 44 5
5 66 77 88 99 10
123456789
1 2
4
5
A A Budx dx
A A udx dx
2
2
dx
Bdx
4 5
4
5
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
Programming finite elements - 3
A Adx dx A AA A dx dxdx dx A A
dx dx
A Adx dxA Adx dx
GlobalK
The global stiffness matrix is the sum of all local stiffness matrixes. In our code we will first setup a global stiffness matrix KGlobal full of zeros. We will then 1) loop through the finite elements, 2) identify where the local element is positioned within the global matrix and 3) add the local stiffness matrix at the correct position to the global matrix.
Exactly the same is done for the right hand side vector F.
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
0
( ) ( ) ( ) 0L N x u xA N x B dx
x x
The FEM Maple code
Adx
Adx
Adx
Adx
B dx
2
B dx
2
> restart;> # FEM # Derivation of small matrix for 1D 2nd order steady state> # Number of nodes per elementnonel := 2:> # Shape functionsN[1] := (dx-x)/dx:N[2] := x/dx:> # FEM approximationu := sum( t[j]*N[j],j=1..nonel):> # Weak formulation of 1D equationfor i from 1 to nonel doEq_weak[i] := int( -A*diff(u,x)*diff(N[i],x) + B*N[i] ,x=0..dx);od:> # Create element matrixes for conductive and transient termsK:=matrix(nonel,nonel,0):F:=matrix(nonel,1,0):for i from 1 to nonel do
for j from 1 to nonel doK[i,j] := coeff(Eq_weak[i] ,t[j]):
od:F[i,1] := -coeff(Eq_weak[i] ,B)*B:
od:> # Display K and Fmatrix(K);matrix(F);
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
The FEM Matlab codeIn the numerical solution all parameters can be made variable easily, while it gets more difficult to find analytical solutions for variable parameters, e.g., A and B.
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
FEM applications
Taken from MIT lecture, de Weck and Kim
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
FEM element types
Taken from unknown web script
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
FEM applicationsShortening of the continental lithosphere with: (i) viscoelastoplastic rheology, (ii) transient temperature field, (iii) viscous heating and (iv)gravity.
Numerical modeling of rock deformation: FEM Introduction. Stefan Schmalholz, ETH Zurich
FEM applicationsThree-dimensional viscous folding