Search

Clear all

# matADi - A python package for material definition with automatic differentiation

1 Posts
1 Users
0 Reactions
1,037 Views
Posts: 1
Topic starter
New Member
Joined: 2 years ago

Hi,

I'd like to introduce to you my open-source software package matADiÂ (Material Definition with Automatic Differentiation) written in Python. It can be used to define custom or import pre-defined hyperelastic strain energy density functions. Both functions for the numeric evaluation of the gradient (as the first Piola-Kirchoff stress tensor) and the hessian (as the according elasticity tensor) are provided by automatic differentiation using casadi. This material definition may be used as a user material (UMAT) in Python-based FEA software packages like FElupe or scikit-fem. matADi also provides a numerical lab where the force-stretch material behavior of the common homogenous loadcases uniaxal, biaxial and planar shear may be visualized. It is published on PyPI, the python package index and may be installed via command line:

`pip install matadi`

Here is a little code snippet which shows the usage of matADI with an Ogden material:

```from matadi import MaterialHyperelastic, Lab, models
# load a model, set material parameters and optionally add a bulk modulus
ogden = MaterialHyperelastic(models.ogden, mu=(1,), alpha=(1.6,), bulk=5000)
# init `n` random deformation gradients
import numpy as np
n = 500
np.random.seed(51251)
F = np.eye(3).reshape(3, 3, 1) + (np.random.rand(3, 3, n) - 0.5) / 10
# evaluate first Piola-Kirchhoff stress and associated elasticity tensor
A = ogden.hessian([F])
# plot force-stretch curves of homogenous loadcases
# with fixed principal directions
lab = Lab(ogden)
data = lab.run(ux=True, bx=True, ps=True)
fig, ax = lab.plot(data)```

AvailableÂ isotropic hyperelastic material models:

Â