Skip to content

Commit

Permalink
Add the hyperelastic foam model also for JAX
Browse files Browse the repository at this point in the history
  • Loading branch information
adtzlr committed Nov 16, 2024
1 parent 613640a commit fbbb00f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/felupe/constitution/jax/models/hyperelastic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
from ._miehe_goektepe_lulei import miehe_goektepe_lulei
from ._mooney_rivlin import mooney_rivlin
from ._storakers import storakers
from ._third_order_deformation import third_order_deformation
from ._yeoh import yeoh

__all__ = [
"miehe_goektepe_lulei",
"mooney_rivlin",
"storakers",
"third_order_deformation",
"yeoh",
]

# default (stable) material parameters
miehe_goektepe_lulei.kwargs = dict(mu=0, N=100, U=0, p=2, q=2)
mooney_rivlin.kwargs = dict(C10=0, C01=0)
storakers.kwargs = dict(mu=[0], alpha=[2], beta=[1])
third_order_deformation.kwargs = dict(C10=0, C01=0, C11=0, C20=0, C30=0)
yeoh.kwargs = dict(C10=0, C20=0, C30=0)
34 changes: 34 additions & 0 deletions src/felupe/constitution/jax/models/hyperelastic/_storakers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
"""
This file is part of FElupe.
FElupe 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.
FElupe 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 FElupe. If not, see <http://www.gnu.org/licenses/>.
"""
from functools import wraps
from jax.numpy import array, sum as asum, sqrt
from jax.numpy.linalg import eigvalsh

from ....tensortrax.models.hyperelastic import storakers as storakers_docstring


@wraps(storakers_docstring)
def storakers(C, mu, alpha, beta):
λ1, λ2, λ3 = sqrt(eigvalsh(C))
J = λ1 * λ2 * λ3

μ = array(mu)
α = array(alpha)
β = array(beta)

return asum(2 * μ / α**2 * (λ1**α + λ2**α + λ3**α - 3 + (J ** (-α * β) - 1) / β))
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@


def storakers(C, mu, alpha, beta):
r"""Strain energy function of Storåkers' isotropic hyperelastic
`Foam <https://doi.org/10.1016/0022-5096(86)90033-5>`_ material formulation [1]_.
r"""Strain energy function of the Storåkers isotropic hyperelastic
`foam <https://doi.org/10.1016/0022-5096(86)90033-5>`_ material formulation [1]_.
Parameters
----------
C : tensortrax.Tensor
C : tensortrax.Tensor or jax.Array
Right Cauchy-Green deformation tensor.
mu : list of float
List of moduli.
Expand Down Expand Up @@ -66,11 +66,12 @@ def storakers(C, mu, alpha, beta):
Examples
--------
First, import the automatic differentiation backend
First, choose the desired automatic differentiation backend
.. pyvista-plot::
:context:
>>> # import felupe.constitution.jax as mat
>>> import felupe.constitution.tensortrax as mat
and create the hyperelastic material [2]_.
Expand Down

0 comments on commit fbbb00f

Please sign in to comment.