Finite Element Method Introduction, 1D Heat Conduction
Finite Element Method Introduction, 1D Heat Conduction
1
Finite Element Method
Introduction, 1D heat conduction
2
Finite Element Method
Introduction, 1D heat conduction
Lecture plan Finite Element Method I
wind.civil.aau.dk/lecture/7sem_finite_element/Finite_element.htm
3
Finite Element Method
Introduction, 1D heat conduction
Form and expectations
To give the participants an understanding of the basic elements
of the finite element method as a tool for finding approximate
solutions of linear boundary value problems. These will be
exemplified with examples within stationary heat conduction.
After the course the participants should be able to set up their
own finite element solution of linear boundary value problems.
We expect that you participate in the given lectures and
exercises and ask questions when something is unclear.
Many of the exercises are programming problems, which
should be solved on a laptop. Preferably you should work in
groups of two. Each group should bring a laptop with MatLab
installed.
We expect minor prior knowledge of scientific programming.
Basic MatLab programming will be repeated during the lectures
You should bring pen and paper, and a copy of the lecture
notes.
4
Finite Element Method
Introduction, 1D heat conduction
5
Finite Element Method
Introduction, 1D heat conduction
Literature
6
Finite Element Method
Introduction, 1D heat conduction
Beginners literature
7
Finite Element Method
Introduction, 1D heat conduction
8
Finite Element Method
Introduction, 1D heat conduction
9
Finite Element Method
Introduction, 1D heat conduction
Basic steps of the finite-element method (FEM)
1. Establish strong formulation
Partial differential equation
2. Establish weak formulation
Multiply with arbitrary field and integrate over element
3. Discretize over space
Mesh generation
4. Select shape and weight functions
Galerkin method
5. Compute element stiffness matrix
Local and global system
6. Assemble global system stiffness matrix
7. Apply nodal boundary conditions
temperature/flux/forces/forced displacements
8. Solve global system of equations
Solve for nodal values of the primary variables
(displacements/temperature)
9. Compute temperature/stresses/strains etc. within the element
Using nodal values and shape functions
10
Finite Element Method
Introduction, 1D heat conduction
MatLab FE-program
main.m (main program runs until "return" plot functions located at the
bottom)
Coordinates.m (defines node coordinates, done by user)
Topology.m (defines the element topology, done by user)
BoundaryConditions.m (defines the BC, done by user)
calc_globdof.m (determines the global dof numbering, done by program)
Assemblering.m (assemble the global stiffness matrix, done by program)
solvequations.m (solve the system of equations for primary dof and forces,
done by program)
Plot functions
Visualize1Dheat.m (visualize the 1D heat problem with a temperature curve)
Visualize2D (visualize all 2D problems including 2D heat conduction and 2D
structural elements)
Visualize3Dbeam_struct.m (visualize the 3D beam problem with geometry,
deformation, beam normals, node and dof numbering)
Visualize3Dbeam_struct_secForce.m (visualize the 3D beam problem with
geometry, deformation, beam normals, node numbering and section forces)
11
Finite Element Method
Introduction, 1D heat conduction
Output:
u = [0 2]T
K = [1 0 ; 0 1]
Hints:
Open the m-file in the editor F5 runs the program until it reaches a "return"-
command or a red circle next to the line numbers (debug mode)
To debug use F11 to advance one line (will enter sub-functions). Use F10 to
advance one line without entering sub-functions
F9 runs the marked section
Enable cell-mode. Then ctrl-enter will run the present cell. Cells are divided
by %%
12
Finite Element Method
Introduction, 1D heat conduction
14
Finite Element Method
Introduction, 1D heat conduction
15
Finite Element Method
Introduction, 1D heat conduction
The coordinates for the part that moves are changed through the handle
(xdata,ydata) and a 'drawnow' command is made for the plot to be
updated
figure
hold on
x = 0:0.001:5;
y = sin(x);
hp1 = plot(x,y);
hp2 = plot(x(1),y(1),'ro','markersize',15);
for j=1:size(x,2)
set(hp2,'xdata',x(j),'ydata',y(j));
drawnow
end
16
Finite Element Method
Introduction, 1D heat conduction
Generating an avi-file (only every 100th frame is captured)
p=1;
for j= 1:100:size(x,2);
set(hp2,'xdata',x(j),'ydata',y(j));
drawnow; compression method: none,
Mov(p) = getframe(gcf); divx, xvid
p=p+1;
end
movie2avi(Mov,'test2.avi','Quality',100,'compression','none');
Problem:
Powerpoint cannot play the movie directly
Solution:
re-code using e.g. virtualdub
www.virtualdub.org
17
Finite Element Method
Introduction, 1D heat conduction
18
Finite Element Method
Introduction, 1D heat conduction
Try the following
figure
hold on
hp1=plot([0 0],[0 1])
hp2=plot([1 1],[0 1])
hp3=plot([-0.2 1.4],[0.2 0.4])
figure
hold on
hp4=plot([0 0 1 1 -0.2 1.4],[0 1 0 1 0.2 0.4])
figure
hold on
hp4=plot([0 0 NaN 1 1 NaN -0.2 1.4],[0 1 NaN 0 1 NaN 0.2 0.4])
Try to mark the lines on the three figures
figure 1: The lines can be marked separately, i.e. changed separately
figure 2: One line is drawn and can only be changed as one, but this is
not what we want. We don't want the connecting lines
figure 3: The lines are drawn separately but are marked as one, i.e. one
handle
19
Finite Element Method
Introduction, 1D heat conduction
Now try
FuncName = ‘cube’
Func = str2func(FuncName);
Output = Func(5)
Change the first line and run the second and third again
FuncName = ‘square’
21
Finite Element Method
Introduction, 1D heat conduction
Example problem 1D stationary heat conduction (Cook:
p21-22), (OP chapter 9)
22
Finite Element Method
Introduction, 1D heat conduction
Step 1: Establish strong formulation for 1D heat conduction
(OP: Chapter 4, p48-52)
23
Finite Element Method
Introduction, 1D heat conduction
Balance or conservation equation
Heat inflow equal heat outflow
dH
H + Qdx = H + dH ) =Q
dx
By definition
H = Aq
Material property or constitutive relation
24
Finite Element Method
Introduction, 1D heat conduction
Second order differential equation needs two boundary conditions
25
Finite Element Method
Introduction, 1D heat conduction
Step 2: Establish weak formulation
(OP: chapter 4, p56-62)
Strong form
26
Finite Element Method
Introduction, 1D heat conduction
Use integration by parts of the first term to obtain the same
derivative of the weight function and primary variable T
boundary conditions
distributed load
v is not completly arbitrary since the above derivation should hold (i.e. v
should be ones differentiable and defined in the region of integration)
27
Finite Element Method
Introduction, 1D heat conduction
28
Finite Element Method
Introduction, 1D heat conduction
Step 3: Discretize over space
Original problem
Nodes
Node number
coordinate Elements
29
Finite Element Method
Introduction, 1D heat conduction
Step 4: Select shape and weight functions
(OP: chapter 7, p90-94, 98-106)
30
Finite Element Method
Introduction, 1D heat conduction
Approximation requirements
Convergence criteria
In the limit when the elements are infinitely small, the approximation
should be infinitely close to the exact solution
Completeness requirements
The approximation must be able to represent an arbitrary constant
temperature gradient
The approximation must be able to represent an arbitrary constant
temperature
i.e. the approximation of the temperature should include terms
corresponding to a linear polynomial
Compatibility or conforming requirement
The approximation of the temperature over element boundaries must be
continues
convergence = completeness + compatibility
31
Finite Element Method
Introduction, 1D heat conduction
Assuming nodal values to be known
Linear variation of temperature allows a
constant temperature gradient
Simplest one-dimensional element (OP:
p98-99)
Test
Matrix notation
nodal values (dof)
shape functions
32
Finite Element Method
Introduction, 1D heat conduction
Weight functions (see OP: chapter 8,p142-156)
arbitrary field
33
Finite Element Method
Introduction, 1D heat conduction
If the weak formulation holds for the entire field, it also holds for part
of the field, i.e. integration is done over one element
Insert the temperature field and arbitrary field into the weak
formulation
a and c are constants, i.e. they can be taken outside the integrals
34
Finite Element Method
Introduction, 1D heat conduction
In compact form
35
Finite Element Method
Introduction, 1D heat conduction
Exercise: Compute by hand the element stiffness matrix
and force vector
Assume constant A, k, Q
q(xi) = qi, q(xj) = qj
Need the derivative of the shape functions
36
Finite Element Method
Introduction, 1D heat conduction
37
Finite Element Method
Introduction, 1D heat conduction
Transformation between coordinate systems
Test
38
Finite Element Method
Introduction, 1D heat conduction
Integration in local coordinate system
constant A and k
39
Finite Element Method
Introduction, 1D heat conduction
40
Finite Element Method
Introduction, 1D heat conduction
step 6: Assemble global system stiffness matrix
(OP: p184-191)
41
Finite Element Method
Introduction, 1D heat conduction
Example: 4 dofs, 3 elements
42
Finite Element Method
Introduction, 1D heat conduction
Local dof numbering vs. global dof numbering
Global numbering
Local numbering
43
Finite Element Method
Introduction, 1D heat conduction
Global system of equations
In a linear system we can add stiffnesses and loads (in this case
heat supply)
44
Finite Element Method
Introduction, 1D heat conduction
Element 2: Global numbering
45
Finite Element Method
Introduction, 1D heat conduction
The assembling procedure is as follows
46
Finite Element Method
Introduction, 1D heat conduction
In order to be able to create a global system matrix we need to give
information about
Material for each element
Section dimensions for each element
Coordinates for each node (and a numbering)
Topology for each element (which nodes are in the element)
dof numbering is given from the node numbering and number of dofs per node
(one in this case)
See calc_globdof.m for numbering of global dof
GlobDof = [nDof1 GDof1 GDof2 ...]
dof numbering of each node
nDof = total number of Dof
47
Finite Element Method
Introduction, 1D heat conduction
48
Finite Element Method
Introduction, 1D heat conduction
Output K [4x4]
49
Finite Element Method
Introduction, 1D heat conduction
Step 7: Apply nodal boundary conditions
temperature/flux
50
Finite Element Method
Introduction, 1D heat conduction
The force vector, see slide 45
51
Finite Element Method
Introduction, 1D heat conduction
Exercise: Determine the boundary conditions and enter
them into the program
modify BoundaryCondition.m
Type 1 is a temperature, type 2 is a heat
supply
Calculate the load vector by hand and
enter nodal values
52
Finite Element Method
Introduction, 1D heat conduction
53
Finite Element Method
Introduction, 1D heat conduction
The reduced system can be solved
54
Finite Element Method
Introduction, 1D heat conduction
Nodal values of dofs (temperature) are given from the solution of the
global system
Internal values are determined using shape functions and nodal
values corresponding to the relevant element. See slide 32
I.e. internal values are determined from nodal values multiplied with
shape functions evaluated at the respective coordinate
55
Finite Element Method
Introduction, 1D heat conduction
56
Finite Element Method
Introduction, 1D heat conduction
57
Finite Element Method
Introduction, 1D heat conduction
58