(/) Menu
Logar (/access/)
Contato (/contact)
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/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 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 addon 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 handson steps that you can follow.
https://br.comsol.com/blogs/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 2/17
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials  COMSOL Blog
The example material model: Uniaxial stressstrain 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 usercoded rou nes for external materials, which
we refer to as sockets.
https://br.comsol.com/blogs/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 3/17
Two
12/08/2018 related External Material sockets
How to Implement are the General
Elastoplasticity stressdeforma
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 GreenLagrange strain tensor, the
deforma on gradient is provided. Many largestrain 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.
The term “material state” represents any solu ondependent 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
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
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 stressstrain 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/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 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 socalled plas c
mul plier . Let’s stop for a moment and consider a graphical representa on of this
equa on for stress:
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 tobedetermined 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.
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/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 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.
The Jacobian that we want to compute is the deriva ve of the Second PiolaKirchho
stress tensor with respect to the GreenLagrange 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 stressstrain 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/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 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 stressstrain 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 stressstrain 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.
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.
Dimensions, boundary condi ons, and loads for a plate with a hole.
The problem has two symmetry planes and only onequarter 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 builtin counterpart. We expect di erences only within the
order of numerical roundo as long as the tolerance when solving the nonlinear equa ons
is ght enough.
https://br.comsol.com/blogs/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 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 vevonMisesstressinMPaof
externalmaterialCOMSOLMul physicsmodel.png)
https://br.comsol.com/blogs/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 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/COMSOLMul physicsbuiltinmaterial
modelofthee ec vevonMisesstress.png)
Computa ons of the e ec ve von Mises stress in MPa of the external material implementa on
(le ) and builtin material model (right).
https://br.comsol.com/blogs/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 11/17
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials  COMSOL Blog
https://br.comsol.com/blogs/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 12/17
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials  COMSOL Blog
Computa ons of the e ec ve plas c strain for the external material implementa on (le ) and
builtin material model (right).
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/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 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 thirdparty 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/externalmaterialexamples
structuralmechanics32331)
Read a previous blog post about accessing external material models (/blogs/accessing
externalmaterialmodelsforstructuralmechanics/)
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, SpringerVerlag, 1998.
M. Kojic and K.J. Bathe, Inelas c Analysis of Solids and Structures, Computa onal Fluid and
Solid Mechanics, SpringerVerlag, 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
Post Tags
Technical Content (/blogs/tag/technicalcontent/)
Newer Post
Keynote Video: Modeling the Mul physics Behavior of Nuclear Fuel
(h ps://br.comsol.com/blogs/keynotevideomodelingthemul physicsbehaviorof
nuclearfuel/)
Older Post
Keynote Video: Using Simula on to Develop Reliable Audio Transducers
(h ps://br.comsol.com/blogs/keynotevideousingsimula ontodevelopreliableaudio
transducers/)
Comments
Hello,
As men oned in the blog post, there are numerous material models for elastoplas city
already in the program. If you are interested in modeling the elastoplas 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
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
Dear Kai,
This ia a bit o topic with regard to the External Material feature, so I suggest that you
contact our support.
Mats
Email
https://br.comsol.com/blogs/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 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 ()
Casos de Uso
Tutoriais e Aplica vos (/models/)
Vídeos de Demonstração de Produtos (/videos?type%5B%5D=videotype
product&type%5B%5D=videotypemodeldemo&s=)
Revistas COMSOL News (/stories)
Ar gos e Pesquisas (/paperspresenta ons)
Aprenda
Treinamentos com Instrutor (/events/trainingcourses)
Fórum de Discussão (/forum/)
Applica on Exchange (/community/exchange/)
Tutoriais em Vídeo (/videos?type%5B%5D=videotypetutorial&s=)
COMSOL Blog (/blogs)
Enciclopédia Mul sica (/mul physics)
Eventos
Workshops Virtuais (/requestademo)
Seminários Online (/events/webinars)
COMSOL Conference (/conference/)
https://br.comsol.com/blogs/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 16/17
COMSOL Days (/comsoldays/)
12/08/2018 How to Implement Elastoplasticity in a Model Using External Materials  COMSOL Blog
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 (/productdownload/)
Consultores Cer cados (/cer edconsultants)
Empresa
Sobre a COMSOL (/company/)
Carreiras (/company/careers/)
Parceiros (/partners/)
Imprensa (/pressreleases)
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/howtoimplementelastoplasticityinamodelusingexternalmaterials/ 17/17