Using MFront behaviors#

This page discusses the main aspects of using MFront behaviors within dolfinx_materials.

What is MFront ?#

MFront is a code generation tool dedicated to material knowledge [Helfer et al., 2015]. It uses various Domain-Specific Languages (DSL) to implement material properties and mechanical behaviors which are then translated into efficient C++ code. MFront provides interfaces to various finite-element solvers such as Abaqus, Ansys, Cast3M, Code_Aster, etc.

In the following, we focus essentially on mechanical or generalized behaviors.

Using a mechanical behavior generated by MFront consists in essentially 3 steps:

  • Writing the MFront behavior in the form of a *.mfront file format

  • Generating/compiling the shared library containing the mechanical behavior using MFront.

  • Loading the relevant material model on the solver side.

For instance, a very simple Plasticity.mfront file corresponding to small-strain isotropic J2 plasticity with hardening would read:

@DSL IsotropicPlasticMisesFlow; //< domain specific language
@Behaviour Plasticity;             //< name of the behaviour
@Parameter  H  = 22e9;             //< hardening slope
@Parameter s0 = 200e6;             //< elasticity limit
@FlowRule{                         //< flow rule
  f       = seq-H*p-s0;
  df_dseq = 1;
  df_dp   = -H;
}

which assumes linear isotropic elasticity and translates the following plastic yield condition:

\[ f(\boldsymbol{\sigma};p) = \sigma_\text{eq} - \sigma_0 - Hp \leq 0 \]

where \(\sigma_\text{eq}\) is the von Mises equivalent stress, \(\sigma_0\) the initial yield stress and \(H\) the hardening modulus.

The latter is then processed by MFront to generate C++ code (here approximately 1500 lines) and compiled into dynamic shared libraries.

mfront --obuild --interface=aster Plasticity.mfront

Where interface specifies the solver interface for which we want to compile the behavior, here Code_Aster for instance.

Interacting with FEniCSx#

For a generic interaction with other solvers, such as open-source or home-made codes, the MFrontGenericInterfaceSupport (MGIS) project provides a generic interface for interacting with compiled MFront behaviors under various languages such as python, c, fortran, julia, etc. [Helfer et al., 2020]

For interacting with FEniCSx, we rely on the MGIS python interface.

Prerequisites#

To be able to work with a MFrontMaterial you must therefore:

Attention

Installing these projects requires the Boost and Boost-Python libraries.

Compilation with the generic interface#

To be used a MFront behavior must first be compiled using here the generic interface:

mfront --obuild --interface=generic Plasticity.mfront

You should see two folders names two include and src appear, containing the generated dynamic libraries.

Loading with dolfinx_materials#

dolfinx_materials provides a MFrontMaterial class to load the relevant behavior to be used in a QuadratureMap object, similarly to a JAXMaterial. In particular, if a MFront behavior does not implement explicit values for the different material parameters, the latter must be provided to MFrontMaterial using a material_properties dictionary, see for instance the MFrontMaterial documentation or the Finite-strain elastoplasticity within the logarithmic strain framework demo.

MFront demos#

MFront demos contain examples on how to set up a FEniCSx interacting with a MFront behavior. They can be split into two main categories:

References#

[HBF+20]

Thomas Helfer, Jeremy Bleyer, Tero Frondelius, Ivan Yashchuk, Thomas Nagel, and Dmitri Naumov. The mfrontgenericinterfacesupport project. Journal of Open Source Software, 5(48):1–8, 2020.

[HMP+15]

Thomas Helfer, Bruno Michel, Jean-Michel Proix, Maxime Salvo, Jérôme Sercombe, and Michel Casella. Introducing the open-source mfront code generator: application to mechanical behaviours and material knowledge management within the pleiades fuel element modelling platform. Computers & Mathematics with Applications, 70(5):994–1023, 2015.