You are on page 1of 10

On Teaching Finite Element

Method in Plasticity With


Mathematica
YANSHENG JIANG, CHONG WANG
Departamento de Tecnologia, Universidade Regional de Noroeste do Estado do Rio Grande do Sul, Caixa Postal 121,
CE982800-000 Panambi, RS, Brazil

Received 25 August 2006; accepted 30 December 2006

ABSTRACT: To help students to understand how finite element methods (FEM) deal with
the plasticity, we have developed a FEM program by using Mathematica, a symbolic algebra
system. The program is compact and of very good readability. Its use in our teaching the theory
of plasticity has led to positive results. 2008 Wiley Periodicals, Inc. Comput Appl Eng Educ 16:
233242, 2008; Published online in Wiley InterScience (www.interscience.wiley.com); DOI 10.1002/cae.20135

Keywords:

plasticity; Mathematica; symbolic computation; finite element method

INTRODUCTION
The theory of plasticity is probably the most
complicated and difficult course for civil and mechanical engineers. Complicated because it seeks to
describe the mechanical behavior of solids under
conditions as general as possible. Difficult because the
behavior of material in plasticity is nonlinear and its
description requires advanced mathematics involving
tensor and functional analysis. Besides, advances of
computational software in engineering application
make it necessary to include in the course the finite
element method dealing with the plasticity. However,
most modern finite element codes, no matter commercial or free ones, are of such huge size and such
degree of complexity that none of them is feasible for

Correspondence to Y. Jiang (yanshengjiang@hotmail.com).


2008 Wiley Periodicals Inc.

students to learn how the method works really in the


plasticity analysis.
It is therefore necessary to develop a FEM
program for plasticity analysis for the purpose of
education. Twenty-five years ago, Owen and Hinton
[1] worked out a FORTRAN program. However,
the program seems to be obsolete today for a number
of drawbacks. First, FORTRAN is not an interactive
language. Students have to learn how to use a programming environment to code in, compile, debug
and execute their program. These are tasks unfamiliar
to most undergraduate students. Second, the common
used FORTRAN language has not built-in graphic
facilities. Results of computation must be exported
to other programs for graphic interpretation. Third,
in view of coding in a program, FORTRAN is
not efficient as it does not offer functions to handle
formally matrices. For instance, matrix A times
matrix B has to be implemented in a number of
iterative loops in FORTRAN while this may done just
233

234

JIANG AND WANG

as simply as A*B within Mathematica. The latter, as a


computer algebra system, has a definite advantage
over FORTRAN: Mathematica can manipulate symbolic operations. This is precious in programming
FEM in plasticity because otherwise, students would
have to perform by hand a lot of analytical derivations
of tensors before writing down his program. The last
drawback of Owen and Hintons program is that the
computation of stress is cumbersome. A simpler and,
however, more robust algorithm for the computation
of stress as discussed later has implemented in the
program of this work.
A few people have worked on the use of
Mathematica in the context of FEM. Ioakimids [2]
solved an elasticity problem to obtain a solution
in terms of a symbolic parameter. Yew et al. [3]
and Lee and Hobbs [4] have obtained some closed
form integration of the finite element stiffness
matrix. Of the most importance in the context of
plasticity analysis with Mathematica is the work
of Korelc [5]. He developed a hybrid system in
which Mathematica was used for the automatic
derivation of material models and the generation of
symbolic nonlinear finite element codes. However
Korelc still relied on the transformation of Mathematica codes into C codes for numerical evaluation. This
resulted in a heterogeneous environment. Although
this might be interesting for professional software
development, it seems unsuitable for engineering
education.
It is the objective of this study to show that it is not
only possible to program nonlinear FEM entirely with
Mathematica but also to solve typical problems in
plasticity within a reasonable time using a common
laptop. As the objective is to show students how FEM
deals with the plasticity, we have taken the readability
as the first importance in implementing the program.
By readability, we mean that the program is of selfevidence as for the implemented mathematical formulae. This is possible because Mathematica allows
implementing mathematical formulae in hand-writing
forms.

With index notations, the differential equation of


equilibrium in solid mechanics reads
sij;j fi 0

in which sij is a component of stress tensor, fi stands


for a component of body forces.
The finite element method is a piecewise application of a variational method, or weak formulation,
in which a given differential equation is recast in
an equivalent integral form [2,6]. In finite element
solutions, the domain of problem to be solved is
discretised into a finite number of elements. Within
the sub-domain, Oe, of each element, some functions
of interpolation, also called shape functions, are
defined. For instance, within a quad of four nodes,
the following bilinear functions of interpolation may
be defined.
1
c1 1  x1  h
4

1
c2 1 x1  h
4

1
c3 1 x1 h
4

1
c4 1  x1 h
4

Note that there are as many functions of


interpolation as the number of nodes in an element.
To solve the differential equation of equilibrium
(1) within the sub-domain Oe is equivalent to solve the
following integral equation:
Z
ck sij;j fi dO 0
6
Oe

in which Ck denotes the shape function related to kth


node of the element.
The application of the theorem of divergence to
the above integration results in
Z
I
Z

ck;j sij dO
ck sij nj dG
ck fi dO 0
Oe

Ge

FINITE ELEMENT FORMULATION


IN PLASTICITY
The finite element formulation for static analysis may
be deduced from the differential equation of equilibrium. This avoids, otherwise, the use of variational
operators and makes it easier to be understood by
undergraduate students in engineering.

Oe

7
Substituting the product sijnj with the surface
traction ti, that is,
sij nj ti

we obtain the following variational or weak form which


is the starting point of finite element implementation.

FEM IN PLASTICITY WITH MATHEMATICA

ck;j sij dO

Oe

ck fi dO

I
ck ti dG

KDU R  F

This equation may be rewritten in the following


matrix form for the plane strain:

@ck
Z
6 @x
6
4
0
Oe

@ck
@y

38 sx 9
>
@ck >
>
>
>
Z 
=
<s >
7
ck
y
@y 7
dO

5
s >
0
@ck >
>
>
> z>
Oe
@x : t ;
xy

Substituting the shape function ck with each of


the four functions defined in Equations (25), each in
turn, one obtains 4  2 8 equations for a quad
element in the following matrix form.
Z
Z
I
BT sdO
CT f dO
CT tdG
11
Oe

in which

0
C
c
~ 1
0 C1

C2
0

0
C2

 
I 
fx
ck
dO
fy
ck
0
0

Ge

C3
0

0
C3

C4
0

@c1
6 @x
6
6
B6 0
6 0
4
@c1
@y

Cep


0
12
C4

0
@c1
@y
0
@c1
@x

@c2
@x
0
0
@c2
@y

We shall work with displacements as the


primitive variables so that stresses in the above
equations have to be expressed in term of displacements. However, stresses are no more in linear
relationship with displacements when the plasticity
occurs and the above equations turn to be nonlinear
in term of displacements. To solve such nonlinear
equations, one can apply NewtonRaphsons algorithm. This leads to the following equation in function
of increments of nodal displacements and of external
loads.

 
tx
dG
ty
ck
0

10

the constitutive law [7] (assuming the associated


perfect plasticity for simplicity)

Ge

Oe

14

in which the following notations are adopted:the


global stiffness matrixZ
15
K BT Cep BdO

Ge

Oe

235

n on oT
@f
@f
C
C
@s @s
C  n oT n o
@f
@f
C
@s
@s

16

von Mises yield criterion (assuming PrandleReuse


material)

0
@c2
@y
0
@c2
@x

@c3
@x
0
0
@c3
@y

0
@c3
@y
0
@c3
@x

@c4
@x
0
0
@c4
@y

3
0
7
@c4 7
7
@y 7
0 7
5
@c4
@x

13

f J2
q
1

sx  sy 2 sx  sy 2 sx  sy 2 4t2xy
6
17
Hookes law for the plane strain
2
1n
n
6 n
E
1

n
6
C
n
1 n1  2n 4 n
0
0

n
n
1n
0

3
0
0 7
7
0 5
12n
2

18

236

JIANG AND WANG

the vector of all nodal displacements


U T u1

v1

u2

v2

...

. . . un

the load vector of external forces


 
Z 
I 
fx
ck 0
ck
R
dO
fy
0 ck
0

0
ck

vn  19
 
tx
dG
ty

Ge

Oe

20
the equivalent force of stress
Z
BT sdO
F

21

Oe

By using Equation (14), we may deduce


the following iteration scheme of NewtonRaphson
method corresponding to the solution at (m 1)th
step.
Initialisation:
m1

consists only in solving a series of linear problems


by gradually increasing loads. Although this is not
wrong, it could lead them into a wrong way in
understanding the method. One has to keep in mind
that the basic difference of a plasticity analysis, as
compared to an elastic one, is that stress increments
due to an increment of load can no longer be
calculated straightforwardly as in the elastic analysis.
In a displacement driven type of analysis, stress
increments must be calculated in taking into
account the yield function and the flow rule
of plasticity after having solved for displacement
increments.
We have adopted here a scheme for computing
stress increments as described by Zimmermann et al.
[8]. It consists in assuming a radial return from a point
in the space of stress beyond the surface of plasticity
to a point on the surface of plasticity. The two points
share the same value of hydraulic pressure. The
procedure of computation may be summarized as
followings.

R m R DR

22

F 0 m F

23

U 0 m U

24

De BDU

25

Do iterations until the convergence or the


maximum number of iterations (i 1,2,3, . . .):

Dse CDe

26

se s Dse

27

m1

m1

1. m1 K i1 DU i m1 R m1 F i1 ;


2. m1 U i m1 U i1 DU i ;
3. compute stresses as described in the next
section;
4. check convergence, that is, if MaxjDU(i)j is less
than a prescribed tolerance.

1. Assuming an elastic behavior, compute the


strain increment, the trial stress increment and
the trial stress by

2. Verify if the trial stress se is beyond the surface


of plasticity. If it is not the case, se is considered
as the true stress, otherwise compute the new
true stress by the following relationship:

2 e
3 2 e
3
s  se
texy
0
sm 0
0
k 4 x e m
5 4 0 se
txy
sey  sem
0
0 5
s Ds
m
kTrial
e
e
0
0
sz  sm
0
0 sem
|{z} |{z}
deviator of se

In the above equations, left superscripts denote


incremental steps while right superscripts stand for
iteration numbers.

28

The mean of se

p
in which kTrial J2e for the case of Von Mises
material with perfect plasticity and sm is the mean
trial principle stress.

COMPUTATION OF STRESS
The computation of stress is the key point of any FEM
program of displacement type for plasticity. However,
many students ignored this. They used to think
vaguely that the solution of a plasticity problem

SOME FEATURES OF MATHEMATICA IN


FEM PROGRAMMING
Mathematica programming language supports most
mathematical symbols such as Greco letters,

FEM IN PLASTICITY WITH MATHEMATICA

237

Figure 1 Radial displacements at the interior surface against pressure.

exponent, matrix, integration, root, summation,


product, etc. One can write a Mathematica program
almost as if one wrote a scientific paper with a
modern word processor. This greatly improves the
readability of program in which many mathematical
formulae need to be implemented. The theory of
plasticity is just the case. For instance, the matrix C in
Equation (16) may be coded in Mathematica as the
follows:

1  u
Elastic Module 6
6 u
mat C
1 u1  2u 4 u
0

The elasto-plastic matrix in Equation (16) is


implemented as
mat Cep mat C


mat C
df ds
Transpose df ds
mat C
Transpose df ds
mat C
df ds1; 1

The shape function is defined as the following:


1
c f1  x1  h; 1 x1  h;
4
1 x1 h; 1  x1 hg

Once the shape function is defined, its derivatives,


Jacobian and the strain-displacement matrix B for a

u
u
1  u
u
u
1  u
0
0

3
0
0 7
7
0 5

12u
2

given element may be easily computed symbolically.


In the program given in Appendix, Jacobian and
matrix B, are stored for each element in closed form
in function of symbolic variables, x and h. When
compute the stiffness matrix, the equivalent force of
stress and the strain, x and h are substituted with
numerical values.

238

JIANG AND WANG

NUMERICAL EXAMPLE

CONCLUSIONS

A thick cylinder submitted to a gradually increasing


internal pressure is considered here with interior
radius of 100 mm, exterior radius of 200 mm,
internal pressure of 20 dN/mm2, elastic modulus of
21,000 dN/mm2, Poissons ratio of 0.3, uniaxial yield
stress of 24 dN/mm2. The Von Mises yield function
with associated perfect plasticity was assumed.
The problem is solved with assumption of the
plane strain condition in the axial direction. Due to the
symmetry, only 14 section of cylinder is considered
and discretized into 48 bilinear quad elements. The
radial displacement at the inner surface computed in
Mathematica is compared with results given by
ANSYS 10.0 in Figure 1. The two solutions meet
each other perfectly well except at the last point which
corresponds to the pressure value of 19 dN. At this
pressure level, the difference of displacements given
by ANSYS and by MATHFEM is about 3%. Note
that the theoretical plastic limit of pressure for this
problem may be evaluated with the following
relationship.
 


sy
b
24
200
Pp p ln
p ln
19:209dN=mm2
a
100
3
3

It has been proven in this study the feasibility


of Mathematica in programming finite element
methods for the solution of problems in plasticity.
The shape function, its derivatives, Jacobian and
the strain-displacement matrix B for each element
are computed symbolically and stored in closed
form. However, in order to maintain the equilibrium
condition in NewtonRaphson iterative scheme, the
evaluation of stiffness matrix in Equation (15) and
the equivalent force of stress in Equation (21) have
been performed numerically by using the GaussLegendre quadrature. This resulted in a semisymbolic program of nonlinear FEM. The program
listing is given in Appendix. The good readability
makes it self-evident. The program may be easily
generalized by replacing the first paragraph defining
data relative to the thick cylinder problem with an
input subroutine of general purpose. The program has
been used in our teaching the theory of plasticity and
was considered to be very helpful by students in
mechanical engineering.
We may conclude that the semi-symbolic finite
element programming is a good compromise between
the computational efficiency and human efforts in
developing nonlinear FEM programs. We believe that
symbolic algebra systems such as Mathematica or
others will become useful and powerful tool in
teaching the theory of plasticity in engineering
education.

29
A complete listing of the program together with
data generation for the current problem is given in
Appendix.

FEM IN PLASTICITY WITH MATHEMATICA

APPENDIX

(Continued)

239

240

JIANG AND WANG

APPENDIX (Continued)

FEM IN PLASTICITY WITH MATHEMATICA

241

APPENDIX (Continued)

REFERENCES
[1] D. R. J. Owen and E. Hinton, Finite elements in
plasticity: Theory and practice, Pineridge Press,
Swansea, United Kingdom, 1980.
[2] N. I. Ioakimids, Elementary application of MATHEMATICA to the solution of elasticity problems by the
finite element method, Comput Methods Appl Mech
Eng 102 (1993), 2940.
[3] C. K. Yew, J. T. Bole and D. MacKenzie, Closed form
integration of element stiffness matrices using a computer
algebra system, Comput Struct 56 (1995), 529539.
[4] C. K. Lee and R. E. Hobbs, Closed form stiffness
matrix solution for some commonly used hydrid

[5]

[6]
[7]
[8]

finite elements, Comput Struct 67 (1998), 463


482.
J. Korelc, Symbolic formulation and automatic
derivation of complex material models, Proceedings
of Multi-physics and Multi-scale Computer Models in
Non-linear Analysis and Optimal Design of Engineering Structures Under Extreme Conditions, Bled,
Slovenia, June 1317, 2004.
J. N. Reddy, An introduction to the finite element
method, McGraw-Hill, New York, 1984, p 13.
W. F. Chen and D. J. Han, Plasticity for structural
engineers, Springer-Verlag, New York, 1980.
T. Zimmermann, A. Truty, and B. Rebora, Z_Soil
Manual, ZACE service, Lausanne, 2000.

242

JIANG AND WANG

BIOGRAPHIES
Yansheng Jiang graduated from Wuhan
University of Technology in 1982. He
received the PhD degree in applied sciences
from State University of Lie`ge (Belgium) in
1987. He joined POLYFLOW in 1991 and
worked as software engineer in developing
finite element methods in fluid mechanics.
He is visiting professor at Universidade
Regional do Noroeste do Estado do Rio
Grande do Sul (Brazil). He has been
interested in developing various numerical methods in engineering
such as boundary element methods, parallel computing, and point
collocation methods. His current research topic is finite element
modeling of radio frequency ablation of tumor.

Chong Wang is an associate professor of


mechanical engineering at Universidade
Regional do Noroeste do Estado do Rio
Grande do Sul in Brazil. He graduated from
the University of Science and Technology of
China (USTC) in 1982, received an MS from
the Chinese Academy of Sciences (CAS) in
1985 and earned his doctorate from
China University of Mining and Technology
(CUMT) in 1988. As a lecturer, he taught
graduate courses in CUMT from 1989 to 1992; as a visiting
scientist, he worked at the Federal University of Sa o Carlos from
1993 to1995 and at the University of Sa o Paulo in Brazil from 1996
to 1997.

You might also like