Skip to main content

Hyperelastic formulations using an algorithmic differentiation with hyper-dual numbers in Python

Project description

HyperMAT
هايبرمات

Hyperelastic formulations using an algorithmic differentiation with hyper-dual numbers in Python.

Generic badge DOI Downloads

HyperMAT is based on the definitions of the first Piola-Kirchhoff stress $\large P$ and the tangent modulus $\large \hat{A}$ given below:

$\large P = \frac{\partial{W}}{\partial{F}}$
$\large \hat{A} = \frac{\partial^2{W}}{\partial{F}^2}$

How to use

This is a quick example of how to use:

import numpy as np
import hypermat as hm

# Initialise material
umat = hm.NeoHooke(C10=0.5, K=0)

# Initialise deformation gradient values
np.random.seed(125161)
F = (np.eye(3) + np.random.rand(50, 8, 3, 3) / 10).T

# Get stress tensor
P = umat.jacobian(F)

# Get tangent modulus tensor
A = umat.hessian(F)

Sometimes a lucky engineer will have some tension or compression stress-strain test data, or simple shear test data. Processing and applying these data is a critical step to analyze the hyperelastic models. HyperMAT has a calibration module that can help to get the best fitted model parameters. Let's take a look on how are things going on:

import os
from hypermat import NeoHooke, Yeoh, read_file, to_dict, Uniaxial


#Prepare material models
umat1 = NeoHooke(C10=1.5,K=2000)
umat2 = Yeoh(C10=0.5,C20=-0.01,C30=0.2, K=2000)

#Prepare experimental data
dir_path = os.path.dirname(os.path.realpath(__file__))
dataset = read_file(dir_path+'//_data//_data_2.csv', delimiter=',', dtype=float)
data = to_dict(dataset[1:,:], ['time', 'strain', 'stress'])
strain = data['strain']
stress = data['stress']

#Choose loading type (Uniaxial, Biaxial or Shear)
test1 = Uniaxial(umat1, data)
test2 = Uniaxial(umat2, data)

#Plot experimental data
test1.plot()

#Fit parameters
test1.fit_data([0,0],[20,2000],[True, False])
test2.fit_data([0,-20,-20,0],[20,20,20,2000],[True,True,True, False])

#Plot results
test1.plot_model(c='r')
test2.plot_model(c='g')

You should get something like that:

HyperMAT fitted parameters
{'C10': 0.6624343754510106}
{'C10': 0.5903745146776757, 'C20': -0.09056730756209555, 'C30': 0.3065185192428228}
MCalibration fitted parameters
{'C10': 0.623489155}
{'C10': 0.585555703, 'C20': -0.0846386036, 'C30': 0.304613717}

A special thank you goes to Dutzler, for providing us many powerful tools such as TensorTrax and hyperelastic.

License

HyperMAT- Hyperelastic formulations using an algorithmic differentiation with hyper-dual numbers in Python, (C) 2023 Mohamed ZAARAOUI, Tunisia.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hypermat-0.1.2.tar.gz (47.9 kB view details)

Uploaded Source

Built Distribution

hypermat-0.1.2-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file hypermat-0.1.2.tar.gz.

File metadata

  • Download URL: hypermat-0.1.2.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for hypermat-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a09184a1ed70f92ecb4a10901ce03c616e54189e166d99b02af943129939c637
MD5 ae0f0ea0d956a54780023f06ebf942b5
BLAKE2b-256 4650be8b46008e1a9a34edd813e12753d2910795e8f76a311f1d1d1098d12811

See more details on using hashes here.

File details

Details for the file hypermat-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: hypermat-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for hypermat-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 84d570f5874e9623c9da392d0b25451bccd2d21ece2595f76ea05febf5f807ea
MD5 0865063e6cd83c50250cf3c0972e074a
BLAKE2b-256 69021861c69cdade6c3e6491afe34bfb4c3f651fc60300fe20827ffcc9e692fa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page