11 fem 2d numerical integration & isoparametric elements · numerical modeling of rock...

43
Numerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich Numerical modeling of rock deformation: 11 FEM 2D numerical integration & isoparametric elements Stefan Schmalholz [email protected] NO E61 AS2009, Thursday 10-12, NO D 11

Upload: others

Post on 14-Sep-2019

34 views

Category:

Documents


4 download

TRANSCRIPT

Numerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Numerical modeling of rock deformation:

11 FEM 2D numerical integration & isoparametric elements

Stefan [email protected]

NO E61

AS2009, Thursday 10-12, NO D 11

Numerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Repetition• In the last lectures we learned the basic principles how to transform a system

of partial differential equations (PDE’s) into a system of linear equations using the finite element method (FEM).

• In the FEM, the PDE’s are approximated as linear equations on the element level, i.e. a local stiffness matrix, K, and a local right hand side vector, F, are generated.

• The local matrix K

and vector F

are assembled into a global matrix Kg

and global vector Fg

which form the linear system of equations describing the physical process in the model domain, i.e. Kg

u

= Fg. The vector u

is unknown and can be determined with Kg

and Fg.• Boundary and initial conditions are implemented separately. • The calculation of the components of K

and F

requires performing an integral over the element and performing derivatives of the element shape functions. These integrals can be done analytically for simple and constant element geometries, what we have done so far. If we deform the elements we have to apply numerical integration and we have to correct the derivatives due to the deformation. How to do this is the topic of this lecture.

Numerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

4 node element2 2

2 2

( , , ) ( , , ) ( , , ) 0T x y t T x y t T x y t st x y

1

21 2 3 4

3

4

( , ) ( , ) ( , ) ( , ) ( , )

TT

T x y N x y N x y N x y N x yTT

TN T

1

2

3

4

( , )

( , )

( , )

( , )

dx x dy yN x y

dxdyx dy y

N x ydxdy

xyN x ydxdydx x y

N x ydxdy

Numerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

4 node element

-1

-1

1

1

0,0

++ +

+

1 2

34

Integration points

1

2

3

4

( , )

( , )

( , )

( , )

dx x dy yN x y

dxdyx dy y

N x ydxdy

xyN x ydxdydx x y

N x ydxdy

1

2

3

4

1( , ) 1 141( , ) 1 141( , ) 1 141( , ) 1 14

N

N

N

N

Numerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

RepetitionThe 2D temperature diffusion equation is:

0t

M T KT-F

0old

old

tot tot

dt

dt dt

T TM KT-F

M K T F TK T F

2 2

2 2

( , , ) ( , , ) ( , , ) 0T x y t T x y t T x y t st x y

0T T

Tdxdy dxdy sdxdyt x x y y

T N N N NNN T N

The corresponding weak form is:

The general matrix form is:

Numerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

RepetitionUntil now we did the integrations analytically with Maple and

copy-pasted the result matrices into our Matlab script.for i from 1 to nonel do

Eq_weak[i] :=int(int(kappa*(diff(T,x)*diff(N[i],x)+diff(T,y)*diff(N[i],y))+Q*N[i],x=0..dx),y=0..dy):

Eq_weak_t[i]:=int(int( (Tdot)*N[i] ,x=0..dx),y=0..dy):

od:

A =[-2/3*kappa/dx*dy-2/3*kappa*dx/dy+kappa*(1/(dx^2)+1/(dy^2))*dx*dy -1/3*kappa/dx*dy+1/6*kappa*dx/dy -1/6*kappa/dx*dy- 1/6*kappa*dx/dy 1/6*kappa/dx*dy-1/3*kappa*dx/dy;...

-1/3*kappa/dx*dy+1/6*kappa*dx/dy 1/3*kappa/dx*dy+1/3*kappa*dx/dy 1/6*kappa/dx*dy-1/3*kappa*dx/dy -1/6*kappa/dx*dy- 1/6*kappa*dx/dy;...

-1/6*kappa/dx*dy-1/6*kappa*dx/dy 1/6*kappa/dx*dy-1/3*kappa*dx/dy 1/3*kappa/dx*dy+1/3*kappa*dx/dy - 1/3*kappa/dx*dy+1/6*kappa*dx/dy;...

1/6*kappa/dx*dy-1/3*kappa*dx/dy -1/6*kappa/dx*dy-1/6*kappa*dx/dy -1/3*kappa/dx*dy+1/6*kappa*dx/dy 1/3*kappa/dx*dy+1/3*kappa*dx/dy];

2 dy3 dx

2 dx3 dy

1

dx21

dy2dx dy

dy3 dx

dx6 dy

dy6 dx

dx6 dy

dy6 dx

dx3 dy

dy3 dx

dx6 dy

dy3 dx

dx3 dy

dy6 dx

dx3 dy

dy6 dx

dx6 dy

dy6 dx

dx6 dy

dy6 dx

dx3 dy

dy3 dx

dx3 dy

dy3 dx

dx6 dy

dy6 dx

dx3 dy

dy6 dx

dx6 dy

dy3 dx

dx6 dy

dy3 dx

dx3 dy

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Motivation → Deformable Grid

-1

-1

1

1

0,0

++ +

+

1 2

34

Integration points

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Motivation → Deformable Grid

-1

-1

1

1

0,0

++ +

+

1 2

34

Integration points

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Motivation

Integral form of system of equations

1

1 10 01 1 1

0

i i i idx dx

i i

i ii i i i

N x N x N x N xu N xx x x x Adx Bdx

u N xN x N x N x N xx x x x

K u F 0

How do we solve these integrals on a distorted element?

NUMERICALLY !!!

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Gauss-Legendre-Quadrature → General comments

Numerical integration with Gauss-Legendre- Quadrature only works on an idealized Element

For x = -1 to 1 in 1D

For x = -1 to 1 and y = -1 to 1 in 2D

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Gauss-Legendre-Quadrature → For 1D

The function f only needs to be known at the integration points.

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Gauss-Legendre-Quadrature → For 1D

Formula

1

11

nip

n nn

f d f w

The function f only needs to be known at the integration points.

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Gauss-Legendre-Quadrature → For 1D

Formula

Integration points and weights

1

11

nip

n nn

f d f w

312201wnnn

13

3 3, 0 ,5 5 5 8 5, ,9 9 9

The function f only needs to be known at the integration points.

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Gauss-Legendre-Quadrature → Exercise

12

1

d

Integrate by hand and “numerically” with 3 integration points:

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Gauss-Legendre-Quadrature → Exercise

By hand:

12

1

d

11

32 3 3

11

1 1 1 21 1 1 13 3 3 3

d

Integrate by hand and “numerically” with 3 integration points:

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Gauss-Legendre-Quadrature → Exercise

By hand:

12

1

d

11

32 3 3

11

1 1 1 21 1 1 13 3 3 3

d

2 21 32 2 2

11

3 5 8 3 5 3 5 3 5 6 205 9 9 5 9 5 9 5 9 9 3i i

id w

Integrate by hand and “numerically” with 3 integration points:

Numerically:

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Gauss-Legendre-Quadrature → For 2D

Formula

1 1

1 1 11 1

, , ,nipn n

i j i j n n ni j n

f d d f w w f w

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Gauss-Legendre-Quadrature → For 2D

Formula

Integration points are similar to the 1D case. Weights can be defined as a multiplicative combination of the 1D case

eg.

1 1

1 1 11 1

, , ,nipn n

i j i j n n ni j n

f d d f w w f w

1/ 3

1/ 31w

-1

-1

1

1

0,0

++ +

+

1 2

34

Integration points

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

% local coordinates

points(1,1) = -sqrt(1/3); points(1,2) = -sqrt(1/3);

points(2,1) = sqrt(1/3); points(2,2) = -sqrt(1/3);

points(3,1) = sqrt(1/3); points(3,2) = sqrt(1/3);

points(4,1) = -sqrt(1/3); points(4,2) = sqrt(1/3);

weight = [1*1 1*1 1*1 1*1];

-1

-1

1

1

0,0

++ +

+

1 2

34

Integration points

Define coordinates of integration points

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

-1

-1

1

1

0,0

++ +

+

1 2

34

Integration points

0T T

Tdxdy dxdy sdxdyt x x y y

T N N N NNN T N

Numerical integration

Numerical integration requires shape functions and their derivatives at the integration points.

1

1

1

1( , ) 1 14

( , ) 1 14

( , ) 1 14

N

N

N

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

-1

-1

1

1

0,0

++ +

+

1 2

34

Integration points

0T T

Tdxdy dxdy sdxdyt x x y y

T N N N NNN T N

% shape functionsN(:,1) = 1/4*(1-points(:,1)).*(1-points(:,2));N(:,2) = 1/4*(1+points(:,1)).*(1-points(:,2));N(:,3) = 1/4*(1+points(:,1)).*(1+points(:,2));N(:,4) = 1/4*(1-points(:,1)).*(1+points(:,2));

% derivatives of shape functionsDN_BIG = [];for i = 1:no_intp

DN(1,1) = 1/4*(-1 +points(i,2));DN(2,1) = 1/4*(-1 +points(i,1));DN(1,2) = 1/4*( 1 -points(i,2));DN(2,2) = 1/4*(-1 -points(i,1));DN(1,3) = 1/4*( 1 +points(i,2));DN(2,3) = 1/4*( 1 +points(i,1));DN(1,4) = 1/4*(-1 -points(i,2));DN(2,4) = 1/4*( 1 -points(i,1));

DN_BIG(:,:,i) = DN;end

Define shape functions and their derivatives at integration points

NumModRockDef 09 – Numerical IntegrationNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

for iel = 1:no_el % loop over elements and fill global matricesNODES = g_num(:,iel); % extract nodes of elementCOORD = GLOB_COORD(:,NODES); % calculate the coordinates of the nodes

% initialize local matricesMM = zeros(dof_perel,dof_perel);KM = zeros(dof_perel,dof_perel);F = zeros(dof_perel,1); % element vector

for i = 1:no_intp % loop over integration points of elementjacobi = DN_BIG(:,:,i)*COORD'; % Jacobi matrix, used for coordinate transformationinvjacobi = inv(jacobi); % inverse of Jacobidetjacobi = det(jacobi); % determinante of JacobiDN_GLOBAL = invjacobi*DN_BIG(:,:,i); % derivatives of shape functions wrt global coordinates

% integrate locally, calculate element matricesMM = MM + N(i,:)'*N(i,:)*weight(i)*detjacobi;

KM = KM + DN_GLOBAL'*KAPPA*DN_GLOBAL*weight(i)*detjacobi;

KL = MM/dt + KM; % element stiffness matrix, left hand sideKR = MM/dt; % element stiffness matrix, right hand side

F(:) = F(:) + N(:,i)*s*weight(i)*detjacobi;end% sum to global matricesKL_G(g_num(:,iel),g_num(:,iel)) = KL_G(g_num(:,iel),g_num(:,iel)) + KL;KR_G(g_num(:,iel),g_num(:,iel)) = KR_G(g_num(:,iel),g_num(:,iel)) + KR;F_G(g_num(:,iel)) = F_G(g_num(:,iel)) + F;

end

Matlab code

1 1

1 1 11 1

, , ,nipn n

i j i j n n ni j n

f d d f w w f w

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Motivation → Gauss-Legendre-Quadrature

Numerical integration with Gauss-Legendre-Quadrature only works on an idealized Element

For x = -1 to 1 in 1D

For x = -1 to 1 and y = -1 to 1 in 2D

So, it does not solve the problem of the distorted elements, yet.

A coordinate transformation from the distorted element to the idealized element is needed in addition. See next section.

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Isoparametric

element

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Distorted vs. idealized element

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Distorted vs. idealized element

1

1 10 01 1 1

0

i i i idx dx

i i

i ii i i i

N x N x N x N xu N xx x x x Adx Bdxu N xN x N x N x N x

x x x x

Derivatives of shape functions with respect to global coordinates

Integral form written in terms of global coordinates (dx)

Shape functions given in terms of local coordinates ()

Numerical integration only possible on a local coordinate system.

2D

1D: FEM introduction

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Two transformations are necessary

Transform locally defined derivatives of shape functions to global coordinate system

Transform locally performed (numerical) integration to global coordinates

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

First transformation in 1D → Derivatives of shape fcts. from local to

global

Global distorted element

Coordinate x arbitrary

Derivatives of shape functions wanted here

Local isoparametric element

Coordinate from -1 to 1

Shape functions defined here

Derivatives of shape functions determinable here

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

First transformation in 1D → Derivatives of shape fcts. from local to

global

Global distorted element

Coordinate x arbitrary

Derivatives of shape functions wanted here

Definition of Jacobian

Local isoparametric element

Coordinate from -1 to 1

Shape functions defined here

Derivatives of shape functions determinable here

1

2

3

NNN

Nx

x x

J

1

x

J

1

2

3

N

N

N

N

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

First transformation in 1D → Derivatives of shape fcts. from local to

global

Global distorted element

Coordinate x arbitrary

Derivatives of shape functions wanted here

Definition of Jacobian

Local isoparametric element

Coordinate from -1 to 1

Shape functions defined here

Derivatives of shape functions determinable here

1

2

3

NNN

Nx

x x

J

1

x

J

1

2

3

N

N

N

N

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

131 2

2

3

, ,T

xNx N N x

x

NJ x

First transformation in 1D → Derivatives of shape fcts. from local to

global

How to derive the Jacobian in a FEM manner?

Definition

With the FEM approximation quantities can be interpolated from nodal points to every point in the element. Why not also the coordinates?

So

x

J

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

131 2

2

3

, ,T

xNx N N x

x

NJ x

First transformation in 1D → Derivatives of shape fcts. from local to

global

How to derive the Jacobian in a FEM manner?

Definition

With the FEM approximation quantities can be interpolated from nodal points to every point in the element. Why not also the coordinates?

So

x

J

Isoparametricelement

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

for iel = 1:no_el % loop over elements and fill global matricesNODES = g_num(:,iel); % extract nodes of elementCOORD = GLOB_COORD(:,NODES); % calculate the coordinates of the nodes

% initialize local matricesMM = zeros(dof_perel,dof_perel);KM = zeros(dof_perel,dof_perel);F = zeros(dof_perel,1); % element vector

for i = 1:no_intp % loop over integration points of elementjacobi = DN_BIG(:,:,i)*COORD'; % Jacobi matrix, used for coordinate transformationinvjacobi = inv(jacobi); % inverse of Jacobidetjacobi = det(jacobi); % determinante of JacobiDN_GLOBAL = invjacobi*DN_BIG(:,:,i); % derivatives of shape functions wrt global coordinates

% integrate locally, calculate element matricesMM = MM + N(i,:)'*N(i,:)*weight(i)*detjacobi;

KM = KM + DN_GLOBAL'*KAPPA*DN_GLOBAL*weight(i)*detjacobi;

KL = MM/dt + KM; % element stiffness matrix, left hand sideKR = MM/dt; % element stiffness matrix, right hand side

F(:) = F(:) + N(:,i)*s*weight(i)*detjacobi;end% sum to global matricesKL_G(g_num(:,iel),g_num(:,iel)) = KL_G(g_num(:,iel),g_num(:,iel)) + KL;KR_G(g_num(:,iel),g_num(:,iel)) = KR_G(g_num(:,iel),g_num(:,iel)) + KR;F_G(g_num(:,iel)) = F_G(g_num(:,iel)) + F;

end

Matlab code

131 2

2

3

, ,T

xNx N N x

x

NJ x

1

x

J

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

x

J

Second transformation in 1D → Integration form from local to global

Global distorted element

Coordinate x arbitrary

Integral form of system of equations given here

Local isoparametric element

Coordinate from -1 to 1

Numerical integration performed here

Transformation of integration boundaries from local to global coordinates

2

1

1

1

detx

x

f x dx f d

J

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

x

J

Second transformation in 1D → Integration form from local to global

Global distorted element

Coordinate x arbitrary

Integral form of system of equations given here

Local isoparametric element

Coordinate from -1 to 1

Numerical integration performed here

Transformation of integration boundaries from local to global coordinates

2

1

1

1

detx

x

f x dx f d

J

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

for iel = 1:no_el % loop over elements and fill global matricesNODES = g_num(:,iel); % extract nodes of elementCOORD = GLOB_COORD(:,NODES); % calculate the coordinates of the nodes

% initialize local matricesMM = zeros(dof_perel,dof_perel);KM = zeros(dof_perel,dof_perel);F = zeros(dof_perel,1); % element vector

for i = 1:no_intp % loop over integration points of elementjacobi = DN_BIG(:,:,i)*COORD'; % Jacobi matrix, used for coordinate transformationinvjacobi = inv(jacobi); % inverse of Jacobidetjacobi = det(jacobi); % determinante of JacobiDN_GLOBAL = invjacobi*DN_BIG(:,:,i); % derivatives of shape functions wrt global coordinates

% integrate locally, calculate element matricesMM = MM + N(i,:)'*N(i,:)*weight(i)*detjacobi;

KM = KM + DN_GLOBAL'*KAPPA*DN_GLOBAL*weight(i)*detjacobi;

KL = MM/dt + KM; % element stiffness matrix, left hand sideKR = MM/dt; % element stiffness matrix, right hand side

F(:) = F(:) + N(:,i)*s*weight(i)*detjacobi;end% sum to global matricesKL_G(g_num(:,iel),g_num(:,iel)) = KL_G(g_num(:,iel),g_num(:,iel)) + KL;KR_G(g_num(:,iel),g_num(:,iel)) = KR_G(g_num(:,iel),g_num(:,iel)) + KR;F_G(g_num(:,iel)) = F_G(g_num(:,iel)) + F;

end

Matlab code

2

1

1

1

detx

x

f x dx f d

J

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

First transformation in 2D → Derivatives of shape fcts. from local to

global

Global distorted element

Coordinate x and y arbitrary

Derivatives of shape functions wanted here

Local isoparametric element

Coordinate and from -1 to 1

Shape functions and their derivatives defined here

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

First transformation in 2D → Derivatives of shape fcts. from local to

global

Global distorted element

Coordinate x and y arbitrary

Derivatives of shape functions wanted here

Definition of Jacobian

Local isoparametric element

Coordinate and from -1 to 1

Shape functions and their derivatives defined here

1

2

9

,,

,...

,

NN

N

Nyx

x xy x y y

J

1x

y

J

1 1

2 2

9 9

, ,

, ,

... ..., ,

N N

N N

N N

, , N

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

First transformation in 2D → Derivatives of shape fcts. from local to

global

Global distorted element

Coordinate x and y arbitrary

Derivatives of shape functions wanted here

Definition of Jacobian

Local isoparametric element

Coordinate and from -1 to 1

Shape functions and their derivatives defined here

1

2

9

,,

,...

,

NN

N

Nyx

x xy x y y

J

1x

y

J

1 1

2 2

9 9

, ,

, ,

... ..., ,

N N

N N

N N

, , N

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

11 2 9

2,

1 2 9

9

, , ,...

,..., , ,

...

T

xN N Nyxx

y N N Nxx

J N x

First transformation in 2D → Derivatives of shape fcts. from local to

global

Derivation of the Jacobian in a FEM manner!

Definition

So

yx

y x

J

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Second transformation in 2D → Integration form from local to global

Global distorted element

Coordinate x and y arbitrary

Integral form of system of equations given here

Local isoparametric element

Coordinate and from -1 to 1

Numerical integration performed here

Transformation of integration boundaries from local to global coordinates

2 2

1 1

1 1

1 1

, , detx y

x y

f x y dxdy f d d

J

yx

y x

J

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

Second transformation in 2D → Integration form from local to global

Global distorted element

Coordinate x and y arbitrary

Integral form of system of equations given here

Local isoparametric element

Coordinate and from -1 to 1

Numerical integration performed here

Transformation of integration boundaries from local to global coordinates

2 2

1 1

1 1

1 1

, , detx y

x y

f x y dxdy f d d

J

yx

y x

J

NumModRockDefNumerical modeling of rock deformation: FEM 2D Elasticity. Stefan Schmalholz, ETH Zurich

for iel = 1:no_el % loop over elements and fill global matricesNODES = g_num(:,iel); % extract nodes of elementCOORD = GLOB_COORD(:,NODES); % calculate the coordinates of the nodes

% initialize local matricesMM = zeros(dof_perel,dof_perel);KM = zeros(dof_perel,dof_perel);F = zeros(dof_perel,1); % element vector

for i = 1:no_intp % loop over integration points of elementjacobi = DN_BIG(:,:,i)*COORD'; % Jacobi matrix, used for coordinate transformationinvjacobi = inv(jacobi); % inverse of Jacobidetjacobi = det(jacobi); % determinante of JacobiDN_GLOBAL = invjacobi*DN_BIG(:,:,i); % derivatives of shape functions wrt global coordinates

% integrate locally, calculate element matricesMM = MM + N(i,:)'*N(i,:)*weight(i)*detjacobi;

KM = KM + DN_GLOBAL'*KAPPA*DN_GLOBAL*weight(i)*detjacobi;

KL = MM/dt + KM; % element stiffness matrix, left hand sideKR = MM/dt; % element stiffness matrix, right hand side

F(:) = F(:) + N(:,i)*s*weight(i)*detjacobi;end% sum to global matricesKL_G(g_num(:,iel),g_num(:,iel)) = KL_G(g_num(:,iel),g_num(:,iel)) + KL;KR_G(g_num(:,iel),g_num(:,iel)) = KR_G(g_num(:,iel),g_num(:,iel)) + KR;F_G(g_num(:,iel)) = F_G(g_num(:,iel)) + F;

end

1 1

1 1 11 1

, , ,nipn n

i j i j n n ni j n

f d d f w w f w

Matlab code

2 2

1 1

1 1

1 1

, , detx y

x y

f x y dxdy f d d

J