Sunteți pe pagina 1din 10

Few Tips

on
Finite Element Programming

Jayadeep U. B.
M.E.D., NIT Calicut1

Department of Mechanical Engineering, National Institute of Technology Calicut

Size of Elemental and Global System


The number of degrees of freedom (d.o.f.) per node depends
on the problem e.g. the heat transfer problem has 1 d.o.f
(temperature) per node, while a general 3D stress analysis
problem has 3 d.o.f. (displacements) per node.
The size of Elemental system = (Nodes per element) x (d.o.f.
per node).
The size of Global system = (Total number of nodes) x (D.o.f.
per node), provided all nodes have same number of d.o.f.
The size of global system to be solved could get modified due
to the method we use for enforcing the B.C.

Lecture - 01

Department of Mechanical Engineering, National Institute of Technology Calicut

Element Connectivity Matrix

Element numbers

To facilitate the assembly process, we can store the nodes of


all the elements as a matrix The Element Connectivity
Matrix.
For example, consider the 2D mesh as shown below:
The Connectivity Matrix is:
9
12
10
11
1 1 2 6 5
5
4
6
2 2 3 7 6
Node
3 3 4 8 7
8
5
6
7
-Number
4
5
6
10
9
1
2
3
s
5 6 7 11 10
1
2
3
4
6 7 8 12 11
The node numbering order in an element is significant.
The node numbering scheme decides the bandwidth of the
stiffness matrix. The above node numbering scheme may not
be the one to give the smallest bandwidth.
Lecture - 01

Department of Mechanical Engineering, National Institute of Technology Calicut

Nodal Coordinate Matrix

Node numbers

The calculation of shape functions and integration requires


the coordinates of the nodes. This can be conveniently stored
as a matrix The Nodal Coordinate Matrix.
For example, consider the 2D mesh as earlier and the size of
domain be 15 x 12:
The Coordinate Matrix:
y
1 0 0
9
12
10
11
2 5 0
5
4
6
Nodal
3 10 0
-Coordinate
8
5
6
7
4 15 0
s
1
2
3
5 0 6
x
L L L
1
2
3
4
In both these matrices, the element or node number, given as
first column in above cases, could be the row index of the
matrix (or the 2D array).
Lecture - 01

Department of Mechanical Engineering, National Institute of Technology Calicut

The Elemental System


The shape functions, which are non-zero over any element
will be the ones corresponding to the nodes of that element.
Hence, we need to know the nodes of any given element it
is given by the connectivity matrix.
To create the shape function corresponding to any node, we
need to have the coordinates of the node it is given by the
nodal coordinate system
Also, since the vertices will be used as nodes (there may be
additional internal nodes), the domain (coordinates) of the
element can be obtained, provided a specific local node
numbering scheme (order in which the nodes are given in a
row of the connectivity matrix).
Hence, connectivity and nodal coordinate matrices, along
with problem specification (say, d.o.f per node) and element
type (linear, quadratic etc.) can create the elemental system.
Lecture - 01

Department of Mechanical Engineering, National Institute of Technology Calicut

Assembly Procedure
All the elemental matrices need not be formed before
assembly, rather the individual element matrix could be added
to the global matrix directly after it is formed. Hence, the
space required for elemental system could just be that
required for one system.
In some cases, even an elemental matrix need not be created
completely individual values could be added to global
system directly.
If there are identical elements, measures could be taken to
avoid the duplication of elemental calculations.
If the d.o.f. per node is known, the element connectivity
matrix can be used for assembling the global system, by
calculating the position, where each value from element
system need to be assembled.
Lecture - 01

Department of Mechanical Engineering, National Institute of Technology Calicut

Assembly Procedure - Example


Consider the finite element mesh as in earlier figure
(reproduced below):

Considering the elemental system corresponding to the


element 2:
k=7

l=6

2
i=2

Lecture - 01

j=3

Department of Mechanical Engineering, National Institute of Technology Calicut

Assembly Procedure Example contd.


Considering a problem, where there are two d.o.f. per node,
we have the elemental system:

k112

2
21

k122 L
2
22

k
L
k
M M O

2
k
81

k822 L

k182
2
k28
L
2
k88

12
2
2

M

8 2

f12

2
f
2

M
f82

How to use the connectivity matrix to do the assembly?


Consider the value at: k234. We know 3 corresponds to the first
d.o.f. of second node and 4 gives the second d.o.f. of second
node of the element 2.
The connectivity matrix gives the global node number
corresponding to the second node of element 2 (or in general
for any node of any element) as 3.
Hence, k234 should be assembled (added) at K56 in the global
system.

Lecture - 01

Department of Mechanical Engineering, National Institute of Technology Calicut

Assembly Procedure C Code


A generalized assembler can be written, quite easily as:
f or ( i =1; i <m* n; i ++) {
+= el e_ fi ;
gbl _ fi +1 m * con_ mk
i i +1 %m

f or ( j =1; j <m* n; j ++)

gbl _ m i +1 m * con_ mk
i i +1 %m

j +1 m * con_ mk
+= el e_ mi
j j +1 %m
j ;

}
where: m= d.o.f/node, n = nodes / element, gbl _ f : Global force vector,
gbl _ m: Global stiffness matrix, el e_ f : Elemental force vector,
el e_ m: Elemental stiffness matrix & con_ m: Connectivity Matrix

Note: In C, the array index numbering starts with 0.


Lecture - 01

Department of Mechanical Engineering, National Institute of Technology Calicut

Solvers
A finite element solver performs the simple task of solving
the matrix equation (one or more times) or finding the Eigen
values and Eigen vectors.
What makes it such an important task is the size of matrices
generally occurring in FEA solving for 1 million unknowns
is not at all rare in todays world of FEM!!!
Therefore, it becomes extremely important to use the special
features like symmetry, bandedness etc., during solution
(Refer to Special Features of Finite Element Stiffness
Matrices in Additional Resources folder).
In other words, any method, which can reduce the number of
computations or computational resource requirements,
becomes the preferred method for solution.
Nowadays, iterative methods like Conjugate Gradient
Methods are considered to be the best for solving huge
matrices.
Lecture - 01

10

S-ar putea să vă placă și