Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
MPY308
Clinical Engineering&
Computational Mechanics
Recommended Reading:John D Anderson Jr, ‘Computational Fluid Dynamics- The Basics and Applications’, McGraw-Hill, ISBN 0-070113210-4
Brown, Smallwood, Barber, Lawford, Hose, ‘Medical Physics and Biomedical Engineering’, Institute of Physics Publishing, ISBN 0-7503-0368-9 (pb)
MJ Fagan, ‘Finite Element Analysis: Theory and Practice’, Longman Scientific & Technical, ISBN 0-582-02247-9
Motivation• Many physical phenomena are described
by differential equations
• The equations are often too difficult to solve analytically, particularly for complex geometries or boundary conditions
• Solutions can be sought by the application of numerical methods.
Module Overview
This module describes some of the numerical techniques that can be used to explore physical systems, with illustrations from heat conduction, biomechanics and biofluid mechanics.
Finite differences will be introduced from first principles, andsimple code will be developed to solve linear partial differential equations
The theoretical basis of finite element methods will be briefly discussed, and the lectures will be supported by laboratory sessions in which the student will apply commercial codes to investigate problems in the medical sector.
Outline SyllabusIntroduction, objectives, history and development, commercial exploitation,
typical applications of numerical methods in biomechanics and biofluidmechanics
Introduction to MATLAB, matrix manipulation. Presentation of results. Exercises.
One-dimensional heat conduction. Solution by finite difference and finite element schemes. Extension to 2D and 3D. Shape functions. Galerkinweighted residuals.
Laplaces equation. Numerical solution and practical applications.Matrix stiffness methods and applications to truss problems. Symmetry and
antisymmetry. Finite element formulation for 1D bar. Principle of virtual displacements.
Introduction to ANSYS. Pre-processing, solution and post-processing phases.
Practical aspects of finite element analysis.Finite element formulation for a 2D continuum. Completeness and
compatibility. Patch test. Parametric element formulations. Jacobianmatrix. Computational implementation. Numerical integration.
Methodology
• In order to construct effective numerical schemes to solve the equations we need to understand the fundamental characteristics of the equations.
• We shall learn how to reduce the equations to a set of simultaneous equations. These can readily be written in matrix algebra.
• Modern packages like MATLAB have a whole host of routines for efficient manipulation of matrices. They also feature brilliant graphics routines for displaying the results so that we can understand them !
• We shall apply numerical schemes that we have constructed in MATLAB to solve problems relevant to the activities of a medical physicist.
Software - Matlab
Software - ANSYS
• We shall learn how to use ANSYS, a major commercial finite element analysis package, to solve problems including structural, fluid dynamic, electrical and thermal applications.
• We will construct models in ANSYS to study problems with a more complex geometrical shape.
Aims and ObjectivesAt the end of this module you should:
• Understand the role of numerical methods in the solution of real problems in biophysics and bioengineering;
• Be able to construct simple finite difference and finite element schemes for the solution of particular systems of differential equations;
• Understand the assumptions in the numerical schemes and the requirements for appropriate boundary conditions, constitutive equations and numerical formulations;
• Have a feel for the ‘size’ of a problem, the requirements for an appropriate numerical scheme, and understand how to go about choosing or developing software.
• Have completed a mini-project using MATLAB, ANSYS or FLOTRAN to investigate a biomedical system;
• Be aware of the requirements for comprehensive verification, validation and reporting of numerical solutions, and recognise these requirements in the production of a mini-project report;
Structure• 22 x one hour lectures/ laboratories• Private work, examples, assignments, reading ~ 50 hours
Assessment
• Assignment 1 (Matlab) 10 % Wk 3• Assignment 2 (Finite Differences) 25 % Wk 8• Mini-Project Assignment (ANSYS) 65 % Wk 12
%age Hand In
Laplaces Equation
∇ =2 0φ ∂ φ∂
∂ φ∂
∂ φ∂
2 2 2
+
+
z
x y2 2 2 0=
Applies to many physical problems including, for example, steady-state temperature distribution in a conductive body
Laplaces Equation
∇ =2 0φ
• φ depends only on the spatial co-ordinates (x,y,z).
• φ is a scalar. It might, for example, be temperature. Once we know the solution for φ we can construct a colour map showing its distribution. This is often called a fringe or contour plot.
Laplaces Equation
∇ =2 0φ • ∇φ ( we say grad φ ) is a vector. It
represents a variation of φ in space. We might plot it on a grid as an arrow at each point. The colour or length of the arrow might describe the magnitude of the vector and its direction will indicate the direction of the gradient of φ.
• What physical quantities might these arrows represent ?
• ∇2φ ( formally div (grad φ )) is a scalar again. In Laplaces equation its value is zero everywhere in the solution domain.
Laplaces Equation in 1D
0 2
2
=x∂φ∂
Boundary 1 Boundary 2
x
x
T
Temperature Distribution ?
Describes steady state distribution of temperature along a bar
0 2
2
=x∂φ∂Laplaces Equation in 1D
Obviously we can solve this very easily using integration, but we will use it as a vehicle to develop our understanding of the numerical solution procedures.
It’s a second order (linear, homogeneous) differential equation, so to solve it we would expect to need two boundary conditions.
There are four possible boundary conditions - the value of the temperature and the gradient of the temperature at each end of the bar.
Not all pairs of boundary conditions are useful to us. We will explore this problem later.
Spatial Discretisation of DomainThe basis of our numerical schemes will be to divide the
domain up into sections and to seek the solution at points in the domain. We will cause these points nodes. In the 1D case we will have:
The fundamental unknowns in our numerical representation will be the temperatures at each node, Ti . If we are to solve the problem numerically, we need to go from the differential equation to a series of simultaneous equations.
How do we represent ∇2φ in the discretised domain?
Boundary 1
x = 0
Boundary 2 x = L
x 1 i i − 1 i + 1 n
Finite Differences in 1D
x i i − 1 i + 1
Ti−1
Ti Ti+1
h
How do we represent the gradient of temperature at node i?
Difference Expressions for Gradient
• Backward difference
• Forward difference
• Central difference
hTT =
1
ii
ixT −
⎥⎦⎤
⎢⎣⎡ +
∂∂
∂∂
= T Th
Tx i
i i⎡⎣⎢
⎤⎦⎥
− −1
∂∂
= T T2h
Tx i
i i⎡⎣⎢
⎤⎦⎥
−+ −1 1
x i i − 1 i + 1
Ti−1
Ti Ti+1
h
Which, if any, is ‘most accurate’ ?
Difference Expressions for Curvature
Can you construct a difference expression for curvature ? ?
2
2
xT
∂∂
x i i − 1 i + 1
Ti−1
Ti Ti+1
h
Central Difference Expression for Curvature
x i i − 1 i + 1
Ti−1
Ti Ti+1
h
hTT =
1
−−⎥⎦⎤
⎢⎣⎡
−
ii
ixT
∂∂
Gradient to left Gradient to right
hTT =
1
ii
ixT −
⎥⎦⎤
⎢⎣⎡ +
+∂∂
∂∂
∂∂
∂∂
=
=
T Th
T Th
h
2
Tx x
Tx
i i
i i i i
2
1 1⎡
⎣⎢⎢
⎤
⎦⎥⎥
⎛⎝⎜
⎞⎠⎟
⎡⎣⎢
⎤⎦⎥
−−
−+ −
∂∂
= T T Th
2
2T
x i
i i i2
1 12⎡
⎣⎢⎢
⎤
⎦⎥⎥
− +− +
Discretised Laplaces Equation
0 h
TT2T =
2210
12
2
=+−
⎥⎦
⎤⎢⎣
⎡xT
∂∂
Ti−1 Ti Ti+1
i − 1 i i + 1
x
Contain ‘external’ nodes – need to replace these equations
0 h
TT2T =
211
2
2
=+−
⎥⎦
⎤⎢⎣
⎡ +− iii
ixT
∂∂
0 h
TT2T =
211
2
2
=+−
⎥⎦
⎤⎢⎣
⎡ +− nnn
nxT
∂∂
Away from boundaries(n-2 equations)
Boundary Conditions
x
01 =
1 ⎥⎦⎤
⎢⎣⎡
xT
∂∂
1) Specify Temperature
Optionse.g. T1 = 7
2) Specify Gradient e.g.
? ?
T = h
TT
1
12⎥⎦⎤
⎢⎣⎡
∂∂−
xforward difference
Boundary Conditions x
01 =
1 −
⎥⎦⎤
⎢⎣⎡
xT
∂∂
1
02 T = 2h
TT⎥⎦⎤
⎢⎣⎡
∂∂−
x
Can boundary gradient accuracy be improved by central differencing?
2) Specify Gradient e.g.
central difference T2h T = T1
20 ⎥⎦⎤
⎢⎣⎡
∂∂
−x
[ ] 0
h
TT2h2T 2
211 2=
+−∂∂− xTCentral difference with
Laplaces equation yields same boundary condition
as forward difference T h
TT 1
12⎥⎦⎤
⎢⎣⎡
∂∂
=−
x
Numerical Example
C/m 03 = T
5
o−⎥⎦⎤
⎢⎣⎡
x∂∂
1 2 43 5 02 = T1
0.1 m
T T Th
= 021 2 32− +
T T Th
= 022 3 42− +
30 = h
TT 54 −
T T Th
= 023 4 52− +
02 = T1
Numerical Example
1 2 43 5 02 = T1
0.1 m
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
−
=
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
−−−
−−−−
300020
TTTTT
1100012100
012100012100001
5
4
3
2
1
C/m 03 = T
5
o−⎥⎦⎤
⎢⎣⎡
x∂∂
Numerical Example
1 2 43 5C/m 03 =
T
5
o−⎥⎦⎤
⎢⎣⎡
x∂∂
02 = T1
0.1 m
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
−
=
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
−−−
−−−−
300020
TTTTT
1100012100
012100012100001
5
4
3
2
1
{ }T =
⎧
⎨
⎪⎪⎪
⎩
⎪⎪⎪
⎫
⎬
⎪⎪⎪
⎭
⎪⎪⎪
201714118
Solution methods … Gaussian elimination, Iterative, ….. you choose!
1D Central Difference Solver for Laplaces Equation
% 1D Central Difference Thermal Solver
nn=5; % Total number of nodesL=0.4; % Length of domainh=L/(nn-1); % Distance between nodes
bc1=0; % Boundary condition flag at node 1: 0 is temperature, 1 is gradientT(1)=8; % ... and the value. T for temperature, dT for gradientbcn=1; % Similarly at node ndT(nn)=-30;
Problem variables
Boundary conditions
1D Central Difference Solver for Laplaces Equation
k=zeros(nn,nn); % Initialise 'stiffness' matrixb=zeros(nn,1); % Initialise right hand vector - 'load' vector
for i = 2 : nn-1 % Set up rows of stiffness matrix for all internal nodesk(i,i-1)=-1;k(i,i)=2;k(i,i+1)=-1;
end;⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
−
=
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
−−−
−−−−
300020
TTTTT
1100012100
012100012100001
5
4
3
2
1
1D Central Difference Solver for Laplaces Equation
if bc1==0 % Set up equation at node 1k(1,1)=1;b(1)=T(1);
elsek(1,1)=1;k(1,2)=-1;b(1)=-h*dT(1);
end;
Temperature boundary condition
Gradient boundary condition
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
−
=
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
−−−
−−−−
300020
TTTTT
1100012100
012100012100001
5
4
3
2
1
note the cost of generality…..
1D Central Difference Solver for Laplaces Equation
if bcn==0 % Set up equation at node nk(nn,nn)=1;b(nn)=T(nn);
elsek(nn,nn-1)=-1;k(nn,nn)=1;b(nn)=h*dT(nn);
end;
Temperature boundary condition
Gradient boundary condition
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
−
=
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
−−−
−−−−
300020
TTTTT
1100012100
012100012100001
5
4
3
2
1
1D Central Difference Solver for Laplaces Equation
if rank(k)<nn % Check that the problem is well-posed'Error, k is singular'
end
T=k\b; % Solve
This operation in Matlab is perfectly adequate for our current purposes: if we have large matrices we might reconsider!
An error trap …..
1D Central Difference Solver for Laplaces Equation
plot(T); % Plot results graphically
Improve this figure
-Title
-Label Axes (Units!)
-X axis should be position (m), not matrix entry
Observations on Matrix Structure
1 2 43 5 02 = T1
0.1 m
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
−
=
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
−−−
−−−−
300020
TTTTT
1100012100
012100012100001
5
4
3
2
1
C/m 03 = T
5
o−⎥⎦⎤
⎢⎣⎡
x∂∂
Sparse
TridiagonalStorage, special solution methods?
Laplaces Equation in 2D
0 2
2
2
2
=+yx ∂φ∂
∂φ∂
Describes steady state distribution of temperature in 2d space
Laplacian in 2D
x
Row i
Row i − 1
Row i + 1
Column j y
2,1,,1
, 2
2
hTT2T
= jijiji
jiyT +− +−
⎥⎦
⎤⎢⎣
⎡∂∂
21,,1,
, 2
2
hTT2T
= +− +−
⎥⎦
⎤⎢⎣
⎡ jijiji
jixT
∂∂
∇− + − +− + − +2 1 1 1 12 2
φ =T T T
h +
T T T
h2 2i j i j i j i j i j i j, , , , , ,
Laplacian in 2D
∇− + − +− + − +2 1 1 1 12 2
φ =T T T
h +
T T T
h2 2i j i j i j i j i j i j, , , , , ,
x
Row i
Row i − 1
Row i + 1
Column j y
-1
-1+4-1
-1
Numerical Example
x
Boundary 3 T = 50x
∂∂ T x
y= +100 50
∂∂ T y
x x= +200 452 y
0.2 m
Boundary 1 T = 0
Boundary 4
Boundary 2
1 2 3
4 5 6
7 8 9
3 x 3 grid : unusual because only one internal node
Numerical Example
x
Boundary 3 T = 50x
∂∂ T x
y= +100 50
∂∂ T y
x x= +200 452 y
0.2 m
Boundary 1 T = 0
Boundary 4
Boundary 2
1 2 3
4 5 6
7 8 9
[ ]xy =
⋅⋅
⋅⋅ ⋅⋅ ⋅
⋅⋅ ⋅⋅ ⋅
⎡
⎣
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
0 00 2 00 4 0
0 0 20 2 0 20 4 0 2
0 0 40 2 0 40 4 0 4
Co-ordinates of nodesGrid size h = 0.2 m
Numerical Example
x
Boundary 3 T = 50x
∂∂ T x
y= +100 50
∂∂ T y
x x= +200 452 y
0.2 m
Boundary 1 T = 0
Boundary 4
Boundary 2
1 2 3
4 5 6
7 8 9
Set flags
{ } { }bc ; T_ spec=
⎧
⎨⎪⎪
⎩⎪⎪
⎫
⎬⎪⎪
⎭⎪⎪
=
⎧
⎨
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎫
⎬
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
0101
111100100
{ } { } { }
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
=
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
=
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
=
50170??????
dTy ;
90??
70??
50??
dTx ;
??0??020100
T
Compute specified temperatures and gradients
2D Central Difference Solver for Laplaces Equation
% 2D Central Difference Thermal Solver
nnx=3; Lx=0.4;nny=3; Ly=0.4;h=Ly/(nny-1); % Note that we are considering only square gridsnn=nnx*nny;
for i=1:nnx % Calculate the co-ordinates of each node ....for j=1:nny
n=i+nnx*(j-1);xy(n,1)=h*(i-1); % ... and store in the array [xy]xy(n,2)=h*(j-1);
end;end;
Problem variables
Nodal co-ordinates
2D Central Difference Solver for Laplaces Equation
T=zeros(nn,1); % Initialise the temperature vectorT_spec=zeros(nn,1); % ... and the 'specification' flag
bc1=0; % Specify the conditions on the x = 0 boundary ..for n = 1 : nnx : nn-nnx+1
T(n)=0; T_spec(n)=1; end;bc2=1; % ... and on the x = L boundary ..for n = nnx : nnx : nn
dTx(n)=100*xy(n,2)+50; end;bc3=0; % ... and on the y = 0 boundary ..for n = 1 : nnx
T(n)=50*xy(n,1); T_spec(n)=1; end;bc4=1; % ... and on the y = L boundary.for n = nn-nnx+1 : nn
dTy(n)=200*xy(n,1)*xy(n,1)+45*xy(n,1); end;
Define Boundary Conditions
2D Central Difference Solver for Laplaces Equation
k=zeros(nn,nn); % Initialise 'stiffness' matrixb=zeros(nn,1); % ... and 'load' vector
for i=2:nnx-1 % Set up rows of stiffness matrix for all internal nodesfor j=2:nny-1
n=i+nnx*(j-1);k(n,n-nnx)=-1;k(n,n-1)=-1;k(n,n+1)=-1;k(n,n+nnx)=-1;k(n,n)=4;
end;end; ⎪
⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
=
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
−−−− 0
TTTTTTTTT
010141010
9
8
7
6
5
4
3
2
1
2D Central Difference Solver for Laplaces Equation
for n = 1 : nnx : nn-nnx+1 % Set up equations on x=0 boundaryif bc1==1
k(n,n)=1; k(n,n+1)=-1; b(n)=-h*dTx(n);end;
end;for n = nnx : nnx : nn % Set up equations on x=L boundary
if bc2==1k(n,n)=1; k(n,n-1)=-1; b(n)=h*dTx(n);
end;end;for n = 2 : nnx-1 % Set up equations on y=0 boundary
if bc3==1k(n,n)=1; k(n,n+nnx)=-1; b(n)=-h*dTy(n);
end;end;for n = nn-nnx+2 : nn-1 % Set up equations on y=L boundary
if bc4==1k(n,n)=1; k(n,n-nnx)=-1; b(n)=h*dTy(n);
end;end;
Set up gradient boundary conditions
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
=
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
−−
−−
−−−−
−
50170700
50
TTTTTTTTT
100100000010010000001001000000110000010141010
000000110
9
8
7
6
5
4
3
2
1
Row 9 overwritten …..
2D Central Difference Solver for Laplaces Equation
for n = 1 : nn % Impose specified temperaturesif T_spec(n)==1
for j = 1 : nnk(n,j)=0;
end;k(n,n)=1;b(n)=T(n);
end;end;
Impose known temperatures
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
=
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
−−
−−−−−
50170700020100
TTTTTTTTT
100100000010010000001000000000110000010141010000001000000000100000000010000000001
9
8
7
6
5
4
3
2
1
Rows 3 and 7 overwritten …..
2D Central Difference Solver for Laplaces Equation
if rank(k)<nn % Check that the problem is well-posed'Error, k is singular'
end
T=k\b; % Solve
An error trap …..
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
=
⎪⎪⎪⎪⎪⎪
⎭
⎪⎪⎪⎪⎪⎪
⎬
⎫
⎪⎪⎪⎪⎪⎪
⎩
⎪⎪⎪⎪⎪⎪
⎨
⎧
35.117.1
027.7
7.13020100
TTTTTTTTT
9
8
7
6
5
4
3
2
1
When setting up the equations some lines were overwritten by other lines.
Does this change the answers?
Is there a ‘more accurate’ alternative?
2D Central Difference Solver for Laplaces Equation
% Reshape solution vector into a matrix with entries corresponding to % the geometrical positions of the nodesarrayT=reshape(T,nnx,nny)';
% Plot the results% Figure 1 Surface plot of temperaturesurf(arrayT); % Figure 2 Shaded interpolated flat imagefigure, pcolor(arrayT), shading interp, axis equal% Compute the entries of the gradient vector[gx,gy]=gradient(arrayT,h); gx=-gx; gy=-gy; % Figure 3 Vector plot of gradientfigure, contour(arrayT),hold on, quiver(gx,gy),hold off;
Heat Flux
The heat flux across a region of the boundary is given by the product of the material conductivity, the gradient normal to the boundary and the surface area of the boundary,.
dS T
⎥⎦⎤
⎢⎣⎡=
nkFlux
∂∂
An adiabatic boundary is described by the zero flux condition, implying no heat flux across it.
Symmetry
A symmetry plane is one about which both the geometry and the loading are symmetrical. A symmetry plane must be an adiabatic boundary (zero flux, zero gradient).
Antisymmetry
An antisymmetry plane is one about which the geometry is symmetrical but the loading is antisymmetrical. The temperature on such a boundary must be zero.Use of symmetry and/or antisymmetry conditions can produce significant savings in the size of the computational model.
Theoretical Fundamentals
Taylor series expansion of a function about a point
( ) ( ) ( )( ) ( )( ) ( )( )f x f a f a x af a x a f a x a
n
n n= + − +
−+ +
−+'
'' ( )
!.....
!....
2
2
If the value of a function and all of its derivatives are known at a point a then its value at all points x ‘in the neighbourhood of a’ can be computed.
Order of Accuracy of Finite Difference Approximations
Truncating at order h2:
( ) ( ) ( )( ) )h(hh 2' Oxfxfxf ++=+
( ) ( ) ( ) )h(h
h' Oxfxfxf +−+
=
Rearranging:
The forward difference scheme that we derived intuitively is ‘first order accurate’
What is the order of accuracy of the backward difference and of the central difference schemes that we wrote down ?
Order of Accuracy of Finite Difference Approximations
Truncating at order h3:
( ) ( ) ( )( ) ( )( ) ( )( ) ( )43'''2''
' h! 3
h! 2hhh Oxfxfxfxfxf ++++=+
( ) ( ) ( )( ) ( )( ) ( )( ) ( )43'''2''
' h! 3
h! 2hhh Oxfxfxfxfxf +−+−=−
Adding:( ) ( ) ( ) ( )( ) ( )4
2''
h 2
h22hh Oxfxfxfxf ++=−++
Rearranging:( ) ( ) ( ) ( ) ( )2
2'' h
hh2h Oxfxfxfxf +
−+++=
..and so the ‘-1 2 -1’ scheme is ‘second order accurate’
Order of Accuracy of Finite Difference Approximations
Need higher accuracy? …. Write more terms!
( ) ( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )54''''3'''2''
' h! 4
h! 3
h! 2hhh Oxfxfxfxfxfxf +++++=+
( ) ( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )54''''3'''2''
' h! 4
h! 3
h! 2hhh Oxfxfxfxfxfxf ++−+−=−
Subtracting:( ) ( ) ( ) ( )( ) ( )5
3'''' h
3hh2hh Oxfxfxfxf ++=−−+
Similarly, writing f(x+2h) and f(x-2h) and subtracting:
..and by eliminating the third derivative a fourth order accurate expression for the gradient is obtained
( ) ( ) ( ) ( )( ) ( )53'''
' h 3
h8h4h2h2 Oxfxfxfxf ++=−−+
1D transient heat conduction
∂ φ∂ α
∂ φ∂
2
x t21
=
What are its units ?α is thermal diffusivity, k/ρc
k is thermal conductivity (W/mK)ρ is density (kg/m3)
c is specific heat capacity (J/kgK)
1D transient heat conduction
∂ φ∂ α
∂ φ∂
2
x t21
=
One dimensional transient heat conduction
This is a parabolic second order partial differential equation
Such equations are ‘open’ and lend themselves to time marching schemes. Generally we have a set of initial conditions, and then we follow the evolution of the solution variables. The direction in which we follow the solution does not have to be time… but it often is.
Transient Solution StorageOne dimensional
transient heat conduction∂ φ∂ α
∂ φ∂
2
x t21
=
Store the solution as a matrix array
{ }
⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
=
+
+−
−
nmjmm
ji
nijijijiii
ji
nj
,,1,
,1
,1,,1,2,1,
,1
2,21,2
,1,12,11,1
................................
...........................
........
φφφ
φφφφφφφ
φφφ
φφφφ
φ
Spatial solution at time jTime
SpaceTemporal solution at position i
One discretisation option
{ }
⎥⎥⎥⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢⎢⎢⎢
⎣
⎡
=
+
+−
−
nmjmm
ji
nijijijiii
ji
nj
,,1,
,1
,1,,1,2,1,
,1
2,21,2
,1,12,11,1
................................
...........................
........
φφφ
φφφφφφφ
φφφ
φφφφ
φ
Spatial solution at time j
Temporal solution at position i
⎥⎦
⎤⎢⎣
⎡+− +−2
2
2,1,,1
=
h2
xjijiji
∂φ∂φφφ
dt
= ,1, jiji
tφφ
∂φ∂ −+
Time
Space
Central difference in space Forward difference in time
Discretisation
∂ φ∂ α
∂ φ∂
2
x t21
=
dt
=h
2 ,1,2
,1,,1
αφφφφφ jijijijiji −+− ++−
Forward difference in timeCentral difference in space
( )jijijijiji ,1,,12,1, 2h
dt + = +−+ +−⋅ φφφαφφ
An Explicit Scheme
∂ φ∂ α
∂ φ∂
2
x t21
=Central difference in spaceForward difference in time
( )jijijiji ,1,12,21, hdt +
hdt 21= +−+ +⋅⎟
⎠⎞
⎜⎝⎛ − φφαφαφ
Given the solution at any time j, the solution at time j+1 can be calculated immediately from this explicit equation.
No matrix inversion is required…….. it’s computationally inexpensive!
Numerical Example
1 2 43 5
0.1 m0.4 m
Bar of length 0.4 m, initially at temperature zero, has one end raised in temperature by 0.1C/s for 200 seconds, and then the temparaturethere is maintained at 20C. The temperature at the other end ismaintained at zero throughout. The diffusivity is 1 x 10-5 m2/s.
Compute the temperature distribution at 10 second intervals at the ends and at three equi-spaced internal points, until 400 s have elapsed.
Numerical ExampleInitial Temperature = 0 everywhereTemperature at node 1
s 200 t ≤
1 2 43 5
1t 0 = T1 ⋅ 0.1 m0.4 m
time
20
200
02 = T1
s 200 t ≥
0 = T5
What do you expect to happen?
Do we need boundary conditions at the right hand end? … what would happen without ?
Numerical Example
Initial Temperature = 0 everywhere
1 2 43 5time
T1
20
200
0 = T5
{ }
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
.........0
.........0
.........0
.........0
.........0
T
Numerical Example
{ }
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
.........0
.........0
.........0
.........0
.........0
T
( )jijijiji ,1,12,21, hdt +
hdt 21= +−+ +⋅⎟
⎠⎞
⎜⎝⎛ − φφαφαφ
1 2 43 5time
T1
20
200
0 = T5
( )jijijiji ,1,1,1, 010 + 980= +−+ +⋅⋅ φφφφ
α=1x10-5 m2/s, dt =10 s, h = 0.1m
An explicit scheme
Numerical Example
{ }
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
........00
........00
........00
........00
........10
T
1 2 43 5time
T1
20
200
0 = T5
At t = 10 s
110101t0= 2,1 =×⋅=⋅φ
( )1,31,11,22,2 010 + 980= φφφφ +⋅⋅
( )1,41,21,32,3 010 + 980= φφφφ +⋅⋅
( )1,51,31,42,4 010 + 980= φφφφ +⋅⋅
0= 2,5φ
Numerical Example
{ }
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
.......000
.......000
.......000
.......01.000
.......210
T
1 2 43 5time
T1
20
200
0 = T5
At t = 20 s
210202t0= 3,1 =×⋅=⋅φ
( )2,32,12,23,2 010 + 980= φφφφ +⋅⋅
( )2,42,22,33,3 010 + 980= φφφφ +⋅⋅
( )2,52,32,43,4 010 + 980= φφφφ +⋅⋅
0= 3,5φ
Numerical Example
{ }
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
......0000
......0000
......001.0000
......0298.001.000
......3210
T
1 2 43 5time
T1
20
200
0 = T5
At t = 30 s
310303t0= 4,1 =×⋅=⋅φ
( )3,33,13,24,2 010 + 980= φφφφ +⋅⋅
( )3,43,23,34,3 010 + 980= φφφφ +⋅⋅
( )3,53,33,44,4 010 + 980= φφφφ +⋅⋅
0= 4,5φ
Numerical Example
….. and so we go on …….
{ }
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
....000000
....000005.0000001.00000
....000980.0000396.00001.0000
....098025.0059205.00298.001.000
....543210
T
Numerical Example
Solution at start, 200s (heating time) and 400s (end)
{ }
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
0...0....0056.0...004.0....0602.0...097.0....0509.4...694.1....020...20....0
T
Numerical ExampleMake a note of the temperature at the mid-node (x=0.2) at t = 400s
Experiment with changing the grid size (h)
….. and with changing the timestep (dt)
what do you find ?
Convergence ?
Stability ?
Numerical ExampleMake a note of the temperature at the mid-node (x=0.2) at t = 400s
Experiment with changing the grid size (h) [dt=10s]
h T(0.2, 400)0.1 0.6021940.05 0.3136770.025 0.2220710.0125 ????0.006250.0031250.0015625
Numerical ExampleMake a note of the temperature at the mid-node (x=0.2) at t = 400s
Experiment with changing the grid size (h) [dt=1s]
h T(0.2, 400)0.1 0.6242580.05 0.3397620.025 0.2506110.0125 0.2261460.00625 0.2198590.003125 ????0.0015625
Numerical ExampleMake a note of the temperature at the mid-node (x=0.2) at t = 400s
Experiment with changing the grid size (h) [dt=0.1s]
h T(0.2, 400)0.1 0.6264480.05 0.3423380.025 0.2534140.0125 0.2290340.00625 0.2227700.003125 0.2211930.0015625 0.220798
Numerical ExampleMake a note of the temperature at the mid-node (x=0.2) at t = 400s
Experiment with changing the timestep (dt) [h=0.00625m]
dt T(0.2, 400)4.0 ????2.0 0.0207171.0 0.2198590.5 0.2214770.25 0.2222850.125 0.2226890.0625 0.222891
Explicit Scheme Stability Limit?
Central difference in space∂ φ∂ α
∂ φ∂
2
x t21
=Forward difference in time
( )jijijiji ,1,12,21, hdt +
hdt 21= +−+ +⋅⎟
⎠⎞
⎜⎝⎛ − φφαφαφ
What happens when ?21
hdt 2 >
α
2hdt αGo back to your tables and enter the value of
What do you see? … and what’s the ‘right’ answer ???Accuracy ?
Alternative Discretisation ?
∂ φ∂ α
∂ φ∂
2
x t21
=
dt
=h
2 1,,2
,1,,1
αφφφφφ −+− −+− jijijijiji
Central difference in space Backward difference in time
=dt
h2 1,,1,
2
,1 −+− −⎟⎟⎠
⎞⎜⎜⎝
⎛++− jijijiji φφφ
αφ
An Implicit Scheme
Central difference in space∂ φ∂ α
∂ φ∂
2
x t21
= Backward difference in time
=dt
h2 1,,1,
2
,1 −+− −⎟⎟⎠
⎞⎜⎜⎝
⎛++− jijijiji φφφ
αφ
This looks rather like our scheme for 1D Laplaces equation
(….. additional term on main diagonal and entry on right)
Triangular matrix at every timestep…….. computationally expensive!
….. but are there compensations?
Numerical ExampleRepeat the tests performed with the explicit scheme, completing the same tables
Experiment with changing the grid size (h)
….. and with changing the timestep (dt)
what do you find ?
Convergence ?
Stability ?
We still need to deal with ‘Accuracy’
More Discretisation Schemes
There are very many variants on these schemes, many of which bear the names of their developers (e.g. Crank-Nicholson, …..). The difference between them is the way in which the equations are discretised.
We seek to improve the accuracy and stability of explicit schemes and the accuracy of implicit schemes.
For nonlinear problems we seek also to improve the rate of convergence.
Explicit v Implicit
Fast computation at each timestep
Trivially parallelisable
Only conditionally stable
Might need very small timestep
Unconditionally stable
Computationally expensive per timestep
.. long timesteps stable
..but might be inaccurate !
What spatial and temporal resolution does the physics demand?
What type of computational resource is available ?
Now choose!
Principles of Finite Element AnalysisIn finite element analysis, like finite difference methods, we describe the
solution in terms of the values of the unknowns at discrete points (NODES) in the domain.
Unlike finite difference methods, we make direct assumptions about the magnitudes of the unknown variables everywhere. Their values at all points within each ELEMENT are assumed to be known functions of the values at the nodes of the element.
The (unknown) values of the solution variables at the nodes are called the DEGREES OF FREEDOM (DOFs).
We attempt to ensure that some measure of the solution error is minimised over the whole domain.
Linear 1D, 2 DOF Element
Φ j Φ i
Node i Node j
φ
Element e
x
L e
The most natural choice is a linear variation
Linear 1D, 2 DOF Element Φj
Node i Node j
φ
Element e
x
Le
Φ i
Node i Node j
φ Element e
x
L e
Φj Φi
Node i Node j
φ
Element e
x
Le
+
Linear 1D, 2 DOF Element
[ ]{ }Φ=Φ+Φ= NNN jjiiφ
Φj
Node i Node j
φ
Element e
x
Le
Φj Φi
Node i Node j
φ
Element e
x
Le
Φ i
Node i Node j
φ Element e
x
L e
+( )
ie
jxΦ⋅
−−=
Lx
φ( )
je
ixΦ⋅
−=
Lx φ
Ni Nj
The Shape FunctionsThe functions N are called shape functions.
Ni describes how the parameter (φ in this case) varies over the element when it has a value of 1 at node i and zero at all other nodes.
Node i Node j
1
Nj
Le
Node i Node j
x
1 Ni
Le
Methods of Weighted Residuals
For field problems the discrete numerical equations are usually formulated by minimisation of some measure of the error over the domain.
Taking Laplaces equation in 1D as an example:
0 2
2
=x∂φ∂
Methods of Weighted Residuals
In each element we have assumed the value of φe as a function of its values at the nodes
[ ] { }eee Φ= N φ
Hence within each element:
[ ] { }( ) { }ee
ee
xxxφ
∂∂
∂φ∂
∂φ∂
⎥⎦
⎤⎢⎣
⎡== 2
2
2
2
2
2
N
N
Methods of Weighted Residuals
..but if Laplaces equation is to be satisfied we require that this function be zero at all points in the domain.
The amount by which the equation is not satisfied at any point is called the residual
In this case, within each element:
{ }eexx
R φ∂∂
∂φ∂
⎥⎦
⎤⎢⎣
⎡=−= 2
2
2
2
N0
Methods of Weighted Residuals
We might take one measure of the error in the solution to be the sum of the errors over the whole domain …….
{ }∑ ∫∫ ⎟⎟⎠
⎞⎜⎜⎝
⎛⎥⎦
⎤⎢⎣
⎡∂∂
=elements
eex
j
i
dxx
dxRx
x2
2N φ
A little thought might persuade us that this is not a particularly good measure of error… not least because huge + and – errors will cancel.
Methods of Weighted Residuals
More generally, and more appropriately, we might take a weighted sum of the residuals
( ) ( ) { }∑ ∫∫ ⎟⎟⎠
⎞⎜⎜⎝
⎛⎥⎦
⎤⎢⎣
⎡∂∂
=elements
eex
j
i
dxx
xWdxRxWx
x2
2N φ
where W(x) is a weighting factor
Galerkin’s Method of Weighted Residuals
In Galerkin’s method we take the weight to be the displacement itself
{ } [ ] { }∑ ∫∫ ⎟⎟⎠
⎞⎜⎜⎝
⎛⎥⎦
⎤⎢⎣
⎡∂∂
=elements
ee
eex
j
i
dxx
dxNRx
x2
2TT NN φφ
The order and manner in which the terms are written is chosen for convenience and consistency with systems with more DOFs at each node
Galerkin’s Method of Weighted Residuals
The solution vectors are independent of x and can be taken outside the integral, and indeed of the summation
[ ] { } { }φφ Tx
x2
2T NN ⋅⎟
⎟⎠
⎞⎜⎜⎝
⎛⎥⎦
⎤⎢⎣
⎡∂∂
= ∑ ∫∫elements e
ex
j
i
dxx
dxNR
Now if this quantity is to be minimised, its differential with respect to each of the entries in the nodal solution vector must be zero
Galerkin’s Method of Weighted Residuals
Differentiating the error measure with respect to each of the solution variables (φi) in turn:
[ ] { } { }0 NNx
x2
2T =⋅⎟
⎟⎠
⎞⎜⎜⎝
⎛⎥⎦
⎤⎢⎣
⎡∂∂
∑ ∫ φelements e
e
j
i
dxx
This matrix equation represents n simultaneous equations in the n unknowns
Galerkin’s Method of Weighted Residuals
The second order differential can be eliminated by integration by parts
[ ] [ ] ∫∫ ⎥⎦⎤
⎢⎣⎡
∂∂
⎥⎦⎤
⎢⎣⎡
∂∂
−⎥⎦
⎤⎢⎣
⎡⎥⎦⎤
⎢⎣⎡
∂∂
=⎥⎦
⎤⎢⎣
⎡∂∂ j
i
j
i
j
i
dxxxx
dxx e
T
eee
ee
x
x
x
x
Tx
x2
2T NNNNNN
The first term is a boundary condition, and will be dealt with separately.
The second term we write as:
[ ] [ ] [ ]∫=j
i
dxk eee
x
x
T BBwhere [ ]
ee x ⎥⎦
⎤⎢⎣⎡
∂∂
=NB
The Stiffness Matrix
[k] is usually called the stiffness matrix, because it was first derived (using a different approach…) for structural problems
For the linear 1D element:
[ ] [ ]11L1
L1
L1NB −=⎥
⎦
⎤⎢⎣
⎡−=⎥⎦
⎤⎢⎣⎡
∂∂
=eeee
e x
[ ] [ ] [ ] ⎥⎦
⎤⎢⎣
⎡−
−== ∫ 11
11L1BB
x
x
T
eeee
j
i
dxk
System Stiffness Matrix
The system stiffness matrix is assembled by summing over the elements
[ ] [ ]( )∑=elements
eglobal kk
The Boundary ConditionsIn the absence of heat sources or sinks along the
length of the bar, the heat conduction from the right of one element must equal that into the left of the next one, and the relevant boundary conditions for the system are those at the two ends
1
12
1 LΦ−Φ
=⎥⎦⎤
⎢⎣⎡
∂∂
xφAt the left hand end:
[ ]⎪⎭
⎪⎬⎫
⎪⎩
⎪⎨⎧ Φ−Φ
=⎭⎬⎫
⎩⎨⎧ΦΦ
⎥⎦
⎤⎢⎣
⎡−=
⎭⎬⎫
⎩⎨⎧ΦΦ
⎥⎦⎤
⎢⎣⎡
0L00
LLL1
12
2
12
2
1e
ee
e
T
xNN
∂∂From the Galerkin formulation:
1
1
1 L −
−
−
Φ−Φ=⎥⎦
⎤⎢⎣⎡
∂∂
n
nn
nxφAt the right hand end:
Numerical Example
C/m 03 = T
5
o−⎥⎦⎤
⎢⎣⎡
x∂∂
1 2 43 5 02 = T1
0.1 m
[ ] ⎥⎦
⎤⎢⎣
⎡−
−⋅
=⎥⎦
⎤⎢⎣
⎡−
−=
1111
101
1111
L1
1 e
k
[ ] ⎥⎦
⎤⎢⎣
⎡−
−⋅
=1111
101
3 k
[ ] ⎥⎦
⎤⎢⎣
⎡−
−⋅
=1111
101
2 k
[ ] ⎥⎦
⎤⎢⎣
⎡−
−⋅
=1111
101
4 k
Numerical Example
1 2 43 5 02 = T1
0.1 mC/m 03 =
T
5
o−⎥⎦⎤
⎢⎣⎡
x∂∂
[ ]
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
−−+−
−+−−+−
−
=
11000111100
01111000111100011
globalk
[ ]
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
−−−
−−−−
−
=
1100012100
012100012100011
globalk
Numerical Example
1 2 43 5 02 = T1
0.1 mC/m 03 =
T
5
o−⎥⎦⎤
⎢⎣⎡
x∂∂
There are no internal sources or sinks and so the ‘forces’ on internal nodes are zero.
The first and last equations can be replaced by the boundary conditions as for the finite difference method
…. and in this case the system of equations is identical to that derived by the finite difference approach⎪
⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
−
=
⎪⎪⎪
⎭
⎪⎪⎪
⎬
⎫
⎪⎪⎪
⎩
⎪⎪⎪
⎨
⎧
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
−−−
−−−−
300020
TTTTT
1100012100
012100012100001
5
4
3
2
1
The 1D Heat equation
0 2
2
=+ Qx
k∂
φ∂
Laplaces equation represents the steady state distribution of temperature in the absence of heat sources or sinks
For the solutions so far we assumed that there was no source or sink except at the boundary, and treated the boundary separately
More generally:
Working through the same procedure as illustrated previously, the finite element method will ‘naturally’ yield the full system equations, although special treatment will be required for positions at which the temperature is fixed
Parametric Element FormulationsFundamental to the finite element method is the description of
the variation of the governing parameters over the whole of the element in terms of their values at the nodes
Such descriptions can be difficult to write for elements of complex shape
It is attractive to produce the analytical derivations in an idealised space, with a mapping to and from real space described by a Jacobian for each element
This is the basis of the parametric element formulations
A 2D Isoparametric Element
Φk Φl
Φj
Φi
ξ
η
1
1
-1 Node i Node j
-1
Node l Node k
[ ]{ }φ + = + + =N N N N Ni i j j k k l lΦ Φ Φ Φ Φ
A 2D Isoparametric Element
1
( )( )( ) ( )( )( )
( )( )( ) ( )( )( )
N N
N N
l k
i j
= − + = + +
= − − = + −
14
1 1 14
1 1
14
1 1 14
1 1
ξ η ξ η
ξ η ξ η
:
:
From Real to Parametric SpaceWe need to describe the relationship between the real space in
which the element is defined and the idealised, parameterised space in which its shape function is defined
y η(1,1)
ξ
x(-1,-1)
The Jacobian Matrixηy
xξ
(1,1)J
(-1,-1)
The mapping is described in terms of the Jacobian, [J]
yy
xx
yy
xx
∂∂
∂η∂
∂∂
∂η∂
∂η∂
∂∂
∂ξ∂
∂∂
∂ξ∂
∂ξ∂
⋅+⋅=
⋅+⋅=By the chain rule of differentiation :
[ ]⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
=
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
=
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
y
xJ
y
xyx
yx
∂∂
∂∂
∂∂
∂∂
∂η∂
∂η∂
∂ξ∂
∂ξ∂
∂η∂∂ξ∂
Evaluation of Jacobianηy
xξ
To evaluate the Jacobian we need to know how the xand y co-ordinates are related to the ξ and η ones
(-1,-1)
(1,1)
The most common assumption (isoparametric element) is that the relationship is exactly the same as that which describes the distribution of the solution parameters
J
[ ]{ }[ ]{ }
x N x N x N x N x N x
y N y N y N y N y N yi i j j k k l l
i i j j k k l l
+
+
= + + =
= + + =
The [B] Matrix
[ ] [ ]∂ φ∂∂ φ∂
∂φ∂ξ∂ φ∂η
∂∂ξ
∂∂ξ
∂∂ξ
∂∂ξ
∂∂η
∂∂η
∂∂η
∂∂η
x
y
J J
N N N N
N N N N
i j k l
i j k l
⎧
⎨⎪
⎩⎪
⎫
⎬⎪
⎭⎪
=
⎧
⎨⎪⎪
⎩⎪⎪
⎫
⎬⎪⎪
⎭⎪⎪
=
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
⎧
⎨⎪⎪
⎩⎪⎪
⎫
⎬⎪⎪
⎭⎪⎪
− −1 1
1
2
3
4
ΦΦΦΦ
[B]The derivatives of the shape functions in parametric
space are very easy to calculate
[ ] [ ] ( ) ( ) ( ) ( )( ) ( ) ( ) ( ) ⎥
⎦
⎤⎢⎣
⎡−++−−−+−+−−−
= −
ξξξξηηηη
11111111
J B 1
The Element Stiffness Matrix
For the 2D version of Laplaces equation, the element stiffness matrix is:
[ ] [ ] [ ] dydxk e BB Area
T ∫=
[B] is defined in parametric co-ordinates, and it is natural to perform the integral in these co-ordinates
[ ] [ ] [ ]∫ ∫−
=1
1-
1
1
T det[J] BB ηξ ddk e
Numerical Integration
[ ] [ ] [ ]∫ ∫−
=1
1-
1
1
T det[J] BB ηξ ddk e
In the general case the Jacobian, and hence the [B] matrix and det[J], vary over the element
The stiffness matrix is usually computed using a numerical integration procedure‘Gaussian Quadrature’ is commonly used for this purpose2 x 2 Gaussian quadrature is accurate for a cubic polynomial
The procedure becomes inaccurate when the element becomes ‘too distorted’There are many measures of distortion
Stiffness Matrix for a Square Elementηy
xξ
(-1,-1)
(1,1)
Check it !
Jh
h
[ ]J =⎡
⎣⎢
⎤
⎦⎥
h2
1 00 1 [ ]k e =
− − −− − −− − −− − −
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
16
4 1 2 11 4 1 22 1 4 11 2 1 4
Global Stiffness Matrix
The global stiffness matrix is:
sparse ….. suggests special solution techniques
singular ….. requires attention to boundary conditions before solution
0
0
Finite Element Model
Global Stiffness Matrix
Element Stiffness Matrices
Structural Analysis Problem
y
20 mm 1N/mm
x
E = 200000 MPa
υ = 0.3 Diameter 5 mm
100 mm
Stress concentration at hole in plate ?