You are on page 1of 17

12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog

(/) Solicite Uma Apresentação Online (/request-a-demo)


Produtos (/products) Contato (/contact)
Galeria de Vídeos (/videos) Brasil 
Seminários Online (/events/webinars) Logar (/access/login)
Blog (/blogs) 
Suporte (/support)

(/) Menu
Logar (/access/)
Contato (/contact)

COMSOL BLOG (/BLOGS) Menu

How to Implement Elastoplas city in a Model


Using External Materials

Mats Danielsson (h ps://br.comsol.com/blogs/author/mats-danielsson/)


November 2, 2017
(h ps://www.facebook.com/sharer/sharer.php?
s=100&p%5Burl%5D=h p%3A%2F%2Fbr.comsol.com%2Fblogs%2Fhow-to-implement-
elastoplas city-in-a-model-using-external-materials%2F)
(h ps://twi er.com/intent/tweet?
url=h p%3A%2F%2Fbr.comsol.com%2Fblogs%2Fhow-to-implement-elastoplas city-in-
a-model-using-external-materials%2F) (h ps://plus.google.com/share?
url=h p%3A%2F%2Fbr.comsol.com%2Fblogs%2Fhow-to-implement-elastoplas city-in-
a-model-using-external-materials%2F) (h p://www.linkedin.com/shareAr cle?
mini=true&url=h p%3A%2F%2Fbr.comsol.com%2Fblogs%2Fhow-to-implement-
elastoplas city-in-a-model-using-external-materials%2F&ro=false)

In structural mechanics, there may be situa ons when you want to implement your own
material model. The COMSOL Mul physics® so ware gives you the op on to program
your own material model in C code. The compiled code can then be called from the
program using the External Material feature. Here, we demonstrate how to implement an
external material model and then use it in an example analysis.
https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 1/17
The External Material Func onality
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog

The Nonlinear Structural Materials Module, an add-on product to COMSOL Mul physics®,
provides a plethora of material models, including models for hyperelas city,
isotropic/kinema c hardening plas city, viscoelas city, creep, porous plas city, soils, and
more. These material models cover a vast majority of engineering problems within
structural analysis.

However, in some situa ons, the mechanical behavior of a material is not readily expressed
in terms of an exis ng material model. For instance, suppose you developed a specialized
material model for a certain alloy and want to use it to solve a large structural mechanics
boundary value problem in COMSOL Mul physics. What do you do?

As a ma er of fact, there are three di erent ways in which you can de ne your own
material:
1. Many of the material models have a User De ned op on. As an example, you can
create your own hyperelas c material by typing in an expression for the strain energy
density as a func on of the strains directly in the GUI.
2. The next level, which is useful when there is no suitable material model that you can
tune through a User De ned op on, is to express your material model as a set of
separate PDEs or ODEs, and enter the appropriate expressions using one of the
mathema cal interfaces.
3. Finally, you can program your own material model in C, using the External Material
feature. If the material model is expressed as an algorithm, rather than as a set of
equa ons, this would be the preferred method.

The implementa on of a material model as an external DLL can seem like a complex
endeavor, but this blog post demonstrates how to implement an elastoplas c material
model in COMSOL Mul physics using hands-on steps that you can follow.

Implemen ng an Elastoplas c Material Model in


COMSOL Mul physics®
As a star ng point, we need to decide on a material model to implement. We choose an
isotropic linear-elas c material with isotropic hardening. This is a simple plas city model
that already exists in COMSOL Mul physics, but it serves nicely to convey some key
points.

First, let’s go over some assump ons, de ni ons, and nomenclature:


Strains are addi ve and assumed small
The elas c response is linear and isotropic, and de ned by Young’s modulus E and
Poisson’s ra o ν (or equivalently by the bulk and shear moduli, K and G)
The plas c response is isotropic with an ini al yield stress of
The yield stress of the material is a func on of e ec ve plas c strain,
, with the ini al value (the hardening func on)
Plas c ow follows theory

An increment in e ec ve plas c strain is given by

https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 2/17
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog

The example material model: Uniaxial stress-strain curve and yield surface in principal stress
space.

Now, let’s discuss approaches for implemen ng a material model as an external material.
There are several di erent ways of calling user-coded rou nes for external materials, which
we refer to as sockets.

Approach 1: General Stress-Strain Rela on


We can use the General stress-strain rela on socket of the external material to de ne a
complete material model that includes (possibly) both elas c and inelas c strain
contribu ons. This is the most general of the two modeling approaches discussed here.
When we use the General stress-strain rela on socket, we are faced with two tasks:
1. Computa on of the stress tensor
2. Computa on of the Jacobian of stress with respect to strain

Approach 2: Inelas c Residual Strain


We can also use the Inelas c residual strain socket to de ne a descrip on of an inelas c
strain contribu on to the overall material model. An example of this would be if we
wanted to add our own creep strain term to the built-in linear elas c material. The Inelas c
residual strain socket assumes an addi ve decomposi on of the total (Green-Lagrange)
strain into elas c and inelas c parts. Thus, this is an adequate assump on when strains are
of the order < 10%. When we use the Inelas c residual strain socket of the external material
model, we are faced with two tasks:
1. Computa on of the inelas c strain tensor
2. Computa on of a Jacobian of inelas c strain with respect to strain

https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 3/17
Two
12/08/2018 related External Material sockets
How to Implement are the General
Elastoplasticity stress-deforma
in a Model Using External Materialson rela on
| COMSOL Blogand the

Inelas c residual deforma on. These are more general versions of those discussed above.
Instead of de ning the deforma on in terms of the Green-Lagrange strain tensor, the
deforma on gradient is provided. Many large-strain elastoplas c material models use a
mul plica ve decomposi on of the deforma on gradient into elas c and plas c parts. In
these situa ons, you would likely want to use one of these sockets instead.

Tip: We link to the source le and model le at the bo om of this blog post.

Computa on of the Stress Tensor: Stress Update


Algorithm
The complexity of compu ng the stress tensor varies signi cantly between material
models. In prac ce, the computa on of the stress tensor o en needs to be formulated as
an algorithm. This is o en called a stress update algorithm in literature. In essence, the
objec ve of a stress update algorithm for a material model is to compute the stresses,
knowing:
The total strains corresponding to the current es mate of the displacement eld
The material state of the previously converged increment

These quan es are provided to the external material as input.

The term “material state” represents any solu on-dependent internal variables that are
required to describe the material. Examples of such variables are plas c strain tensor
components, current yield stress, back stress tensor components, damage parameters,
e ec ve plas c strain, etc. The choice of such state variables will depend on the material
model. We must ensure that the material state is properly ini alized at the start of the
analysis, and that it is updated at the end of the increment.

We rst need to inves gate if there is plas c ow occurring during the increment. We do
this by assuming that the elas c strain is equal to the total strain of the current increment,
less the (deviatoric) plas c strain of the previously converged increment, . This
assump on would hold true if there was, indeed, no plas c ow during the increment. The
deviatoric stress tensor that is computed this way is aptly called a trial stress deviator and is
given by

with an e ec ve (von Mises) value .

The e ec ve trial stress is compared to the yield stress of the material by assuming that
there is no plas c ow during the increment. The yield stress corresponding to the
previously converged increment is given by

No ce that the le -superscripted and in Steps 1 and 2 represent the material


state of the previously converged increment, as we discussed earlier.
https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 4/17
Now
12/08/2018 we check if the trial
How stress causes
to Implement plas cin a ow.
Elastoplasticity ModelFor
Usinganother way of
External Materials expressing
| COMSOL Blog this, if
the trial stress is inside the yield surface, the response will be purely elas c during the
increment. If not, plas c ow will result. The check is performed using the yield condi on:

Check of the yield condi on to determine elas c or elastoplas c computa on.

The stress update algorithm now necessarily branches o into either a purely elas c
computa on or an elastoplas c computa on. We will follow each of these branches,
star ng with the purely elas c branch.

Elas c Computa on
Because we determined that there is no plas c ow during the increment, the trial stress
deviator is, in fact, iden cal to the stress deviator, and the update of the plas c strain
tensor and the e ec ve plas c strain is trivial.

We can directly return the pure elas c stress-strain rela on as the Jacobian.

Elastoplas c Computa on
The objec ve of the elastoplas c branch of the stress update algorithm is to compute the
stress deviator and update the plas c strains. We begin by again expressing the stress
deviator, now knowing that plas c ow takes place during the increment:

or
https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 5/17
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog

In the above equa on, we used a discrete form for the ow rule that states that an
increment in plas c strain is propor onal to the stress deviator through a so-called plas c
mul plier . Let’s stop for a moment and consider a graphical representa on of this
equa on for stress:

Graphical representa on of the correc on of the trial stress deviator.

If we compute a trial stress deviator that lies outside the yield surface, we need to make a
correc on so that the stress deviator is returned to the to-be-determined yield surface.
The plas c mul plier determines the exact amount by which the trial stress deviator
should be scaled back to give the correct stress deviator. If we compute the plas c
mul plier, it is straigh orward to then compute the stress deviator and the plas c strain
increment.

The key steps are to:


1. Transform the equa on for stress into a governing scalar equa on
2. Express all the unknowns in a single parameter
3. Solve the scalar equa on for this parameter

We can relate the plas c mul plier to the e ec ve plas c strain increment using the
ow rule and then transform the equa on for stress into a governing scalar equa on:

https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 6/17
This
12/08/2018 is in general a nonlinear equa Elastoplasticity
How to Implement on, and wein need
a Model to solve
Using it Materials
External using a| COMSOL
suitable itera ve
Blog

scheme. We are now ready to compute the stress tensor, the plas c strain tensor, and the
e ec ve plas c strain.

The updated plas c strain tensor and e ec ve plas c strain are stored as state variables.

Compu ng the Jacobian of the Material


We computed the stresses and updated the material state (the state variables) for our
material model. Now, we turn our a en on to the Jacobian computa on. The Jacobian has
other names in literature, such as tangent s ness, tangent modulus, or tangent operator. In
the stress update algorithm, we express the deviatoric and hydrosta c parts of the stress
tensor as:

The Jacobian that we want to compute is the deriva ve of the Second Piola-Kirchho
stress tensor with respect to the Green-Lagrange strain tensor. For our example material,
we assume that strains are small. This means that we do not need to dis nguish between
various measures of stresses and strains, because they are indis nguishable in the small-
strain limit. The deriva ve of stress with respect to strain is wri en as

If we use the equa ons for the deviatoric and hydrosta c stress and the de ni on of the
trial stress, we can express the Jacobian in the following way:

Note that we replaced the increment of the plas c strain tensor by the total plas c strain
tensor in the expression above. Their deriva ves with respect to strain are the same, by
virtue of the addi ve update of the plas c strains. Recall that our two modeling
approaches require di erently de ned Jacobians. We see immediately how they are
related. In the General stress-strain rela on, the Jacobian is given by the full expression
above. In the Inelas c residual strain, the Jacobian is given by one term in the expression,
namely:

https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 7/17
The
12/08/2018 term is the elasHowctoJacobian. For a purely
Implement Elastoplasticity elasUsing
in a Model c computa on, | the
External Materials total
COMSOL Jacobian of
Blog

the General stress-strain rela on equals this quan ty, while the Jacobian of the Inelas c
residual strain in this case is zero.

If we use the ow rule and the chain rule for di eren a on, we arrive at the following
expression:

No ce that this expression depends on the plas c mul plier. This suggests that for the
current material model, there is li le bene t in choosing the Inelas c residual strain over the
General stress-strain rela on, because both approaches require a full stress update algorithm
to compute the plas c mul plier. For other material models, such as creep models, the
bene t would be greater. Using the governing scalar equa on and the ow rule, we can
compute the last deriva ve in the expression above.

In order to ensure rapid convergence of the global equa on solver and ul mately reduce
the simula on me, the computed Jacobian should be accurate. Well, what does accurate
mean? Simply put, it means that the computed deriva ve must be consistent with the
stress update algorithm that was used to compute stresses. That is, any assump ons or
simpli ca ons used in the stress update algorithm should be re ected in the computa on
of the Jacobian. A deriva ve based on the stress update algorithm is o en called
algorithmic or consistent.

In some situa ons, the Jacobian computa on can be cumbersome. It is o en possible in


these situa ons to use an approximate Jacobian. Keep in mind that the accuracy of the
solu on is determined by the stress update algorithm. As long as the Jacobian is not too far
o , the global equa on solver will s ll converge to the correct solu on, albeit at a lower
rate of convergence.

Further Comments on Jacobian Computa on


The external material uses a reduced vector and matrix form for stresses, strains, and
Jacobians. We need to phrase our stress update algorithm and Jacobian computa on
accordingly.
The strain vector that enters into the external material uses tensor components for
the shears. The Jacobian is de ned assuming tensor components of the shears;
therefore, it is generally nonsymmetric.
The case of plane stress is handled outside the external material feature, so we only
need to make one implementa on of our model. In other words, the model we
implement can be directly used in 3D, 2D axial symmetry, and 2D plane stress and
plane strain analyses.

Applica on Example: Specializa on of the Material


Model
https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 8/17
In
12/08/2018 the sec ons above, we developed
How to a stress update
Implement Elastoplasticity algorithm
in a Model Using and outlined
External Materials | COMSOLhow
Blog to

compute a Jacobian. Now, we will consider a special case for the hardening curve. We
assume that the yield stress is a linear func on of e ec ve plas c strain. This is usually
called linear hardening, and it is de ned by a constant “plas c modulus” , which is the
constant slope of the hardening curve. As it turns out, linear hardening means that the
plas c strain increment can be solved on closed form:

In the example’s source code le, we have made use of this specializa on into linear
hardening.

Let’s consider an example problem of pulling a plate with a hole.

Dimensions, boundary condi ons, and loads for a plate with a hole.

The problem has two symmetry planes and only one-quarter of the plate is modeled. We
use the following material parameters:
E = 70 GPa
ν = 0.2
= 243 MPa
= 2.17 GPa

The problem assumes plane stress. We can compare predic ons of the implementa on of
our material model with the built-in counterpart. We expect di erences only within the
order of numerical round-o as long as the tolerance when solving the nonlinear equa ons
is ght enough.

https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 9/17
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog

(h ps://cdn.comsol.com/wordpress/2017/11/e ec ve-von-Mises-stress-in-MPa-of-
external-material-COMSOL-Mul physics-model.png)

https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 10/17
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog

(h ps://cdn.comsol.com/wordpress/2017/11/COMSOL-Mul physics-built-in-material-
model-of-the-e ec ve-von-Mises-stress.png)

Computa ons of the e ec ve von Mises stress in MPa of the external material implementa on
(le ) and built-in material model (right).

https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 11/17
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog

(h ps://cdn.comsol.com/wordpress/2017/11/e ec ve-plas c-strain-for-a-external-


material-model.png)

https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 12/17
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog

(h ps://cdn.comsol.com/wordpress/2017/11/e ec ve-plas c-strain-built-in-material-


model.png)

Computa ons of the e ec ve plas c strain for the external material implementa on (le ) and
built-in material model (right).

Some Concluding Remarks


There are actually more scenarios where you can employ the possibility to add external
materials.

Consider a situa on where you have a source code for a material model that has been
veri ed in another context. You may have created it yourself or found it in a textbook or
journal paper. In this case, it may be more e cient to use the external material
func onality than cas ng it into a new form and enter it as set of ODEs. Even when the
code is wri en in, for example, Fortran or C++, it is usually rather straigh orward to wrap it
into the C interface used by the external material.

A coded implementa on may be computa onally more e cient than using the User De ned
or extra PDE op ons. The reason is that the detailed knowledge about the material law
makes it possible to devise e cient stress updates, using, for example, local me stepping.

https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 13/17
You
12/08/2018 may want to distribute
How to your material
Implement model
Elastoplasticity in a compiled
in a Model Using Externalform so| COMSOL
Materials that the end user
Blog

cannot access the source code. As a ma er of fact, the third-party product PolyUMod
(h ps://polyumod.com/) is implemented this way.

Next Steps
Download the example source code and model les featured in this blog post
(linear_hardening.mph, linear_hardening.c, linear_hardening.dll) and get more details
on how to use external materials:
External Material Examples, Structural Mechanics (/model/external-material-examples-
structural-mechanics-32331)
Read a previous blog post about accessing external material models (/blogs/accessing-
external-material-models-for-structural-mechanics/)
Learn more about computa onal plas city with these highly informa ve books:
J.C. Simo and T.J.R. Hughes, Computa onal Inelas city, Interdisciplinary Applied
Mathema cs, Vol. 7, Springer-Verlag, 1998.
M. Kojic and K.J. Bathe, Inelas c Analysis of Solids and Structures, Computa onal Fluid and
Solid Mechanics, Springer-Verlag, 2005.
T. Belytschko, W.K. Liu, and B. Moran, Nonlinear Finite Elements for Con nua and Structures,
Wiley, 2000.

PolyUMod so ware is developed by Veryst Engineering LLC. COMSOL AB and its subsidiaries
and products are not a liated with, endorsed by, sponsored by, or supported by Veryst
Engineering LLC.

Categorias

Mechanical (/blogs/category/all/mechanical/) Structural Mechanics


(/blogs/category/all/structural-mechanics/)

Post Tags
 Technical Content (/blogs/tag/technical-content/)

Newer Post
Keynote Video: Modeling the Mul physics Behavior of Nuclear Fuel
(h ps://br.comsol.com/blogs/keynote-video-modeling-the-mul physics-behavior-of-
nuclear-fuel/)

Older Post
Keynote Video: Using Simula on to Develop Reliable Audio Transducers
(h ps://br.comsol.com/blogs/keynote-video-using-simula on-to-develop-reliable-audio-
transducers/)

Comments

Ijaz Shahid November 11, 2017 8:13 am


https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 14/17
12/08/2018
Respected Professor How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog
I have a ques on about the elas c-plas c material modeling in COMSOL Mul physics.
Is there is any modeling in COMSOL where i can design my model in elas c plas c
region.

Mats Danielsson November 13, 2017 2:44 am

Hello,

As men oned in the blog post, there are numerous material models for elasto-plas city
already in the program. If you are interested in modeling the elasto-plas c behavior of a
material not already provided, you can use one of the External Material approaches that
are discussed in the blog post. To get started, you can download example les using the
link under “Next Steps”.

Mats

KAI REN November 15, 2017 10:35 pm

Dear Dr. Danielsson,

I have a ques on about transferring strain elds between two di erent mph les. Is
there a method to transfer strain eld in di erent mph les (when thermal strain, plas c
strain are involved), so the later mph le can u lize the result of the former mph le as
ini al value?
As there exists “ini al strain and stress” tag, I wonder how to add ini al plas c strain
and thermal strain to let comsol dis nguish cons tu on of di erent strains.

Many thanks,
Kai

Mats Danielsson November 16, 2017 1:07 am

Dear Kai,

This ia a bit o -topic with regard to the External Material feature, so I suggest that you
contact our support.

Mats

Login below to leave a comment 

LOG INTO YOUR COMSOL ACCESS ACCOUNT

Email
https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 15/17
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog

Password

Remember me LOG IN

Esqueceu a senha? ()
Don't have an account? Sign up now ()

Informações sobre os Produtos


Produtos (/products)
Tabela de Especi cações (/products/speci ca ons/)
Tipos de Licenças (/products/licensing/)
Requisistos do sistema (/system-requirements/)
Histórico das versões (/release-history)

Casos de Uso
Tutoriais e Aplica vos (/models/)
Vídeos de Demonstração de Produtos (/videos?type%5B%5D=videotype-
product&type%5B%5D=videotype-modeldemo&s=)
Revistas COMSOL News (/stories)
Ar gos e Pesquisas (/papers-presenta ons)

Aprenda
Treinamentos com Instrutor (/events/training-courses)
Fórum de Discussão (/forum/)
Applica on Exchange (/community/exchange/)
Tutoriais em Vídeo (/videos?type%5B%5D=videotype-tutorial&s=)
COMSOL Blog (/blogs)
Enciclopédia Mul sica (/mul physics)

Eventos
Workshops Virtuais (/request-a-demo)
Seminários Online (/events/webinars)
COMSOL Conference (/conference/)
https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 16/17
COMSOL Days (/comsol-days/)
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials | COMSOL Blog

Calendário de Eventos (/events/)

Suporte
Centro de Suporte (/support)
Seus Casos de Suporte (/support/cases/)
Base de Conhecimento (/support/knowledgebase/browse/900/)
Documentação (/documenta on/)
Download de Produtos (/product-download/)
Consultores Cer cados (/cer ed-consultants)

Empresa
Sobre a COMSOL (/company/)
Carreiras (/company/careers/)
Parceiros (/partners/)
Imprensa (/press-releases)
Contato (/contact)

Logar (/access/)
|
Polí ca de Privacidade (/company/privacy/)
|
Marcas Registradas (/trademarks/)
|
© 2018 by COMSOL Inc. Todos diretos reservados

https://br.comsol.com/blogs/how-to-implement-elastoplasticity-in-a-model-using-external-materials/ 17/17

You might also like