{"id":16492385,"url":"https://github.com/adtzlr/hyperelastic","last_synced_at":"2025-03-21T07:31:42.901Z","repository":{"id":178174880,"uuid":"656860854","full_name":"adtzlr/hyperelastic","owner":"adtzlr","description":"Constitutive hyperelastic material formulations for FElupe.","archived":false,"fork":false,"pushed_at":"2024-05-01T20:34:05.000Z","size":580,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-18T17:03:54.715Z","etag":null,"topics":["automatic-differentiation","computational-mechanics","constitution","fea","fem","finite-elements-analysis","hyperelasticity","python","pytorch","scientific-computing","solid-mechanics-codes","torch"],"latest_commit_sha":null,"homepage":"https://hyperelastic.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adtzlr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-06-21T19:47:42.000Z","updated_at":"2024-10-18T13:57:45.000Z","dependencies_parsed_at":"2024-01-20T19:11:08.789Z","dependency_job_id":null,"html_url":"https://github.com/adtzlr/hyperelastic","commit_stats":{"total_commits":304,"total_committers":1,"mean_commits":304.0,"dds":0.0,"last_synced_commit":"bd11829a0c4855cde088d048fa3eff21a2e2a789"},"previous_names":["adtzlr/hyperelastic"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adtzlr%2Fhyperelastic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adtzlr%2Fhyperelastic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adtzlr%2Fhyperelastic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adtzlr%2Fhyperelastic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adtzlr","download_url":"https://codeload.github.com/adtzlr/hyperelastic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221812925,"owners_count":16884721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automatic-differentiation","computational-mechanics","constitution","fea","fem","finite-elements-analysis","hyperelasticity","python","pytorch","scientific-computing","solid-mechanics-codes","torch"],"created_at":"2024-10-11T14:05:36.424Z","updated_at":"2024-10-28T09:36:49.727Z","avatar_url":"https://github.com/adtzlr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/adtzlr/hyperelastic\"\u003e\u003cimg src=\"https://github.com/adtzlr/hyperelastic/assets/5793153/d875ecd0-a23f-4c11-87c4-0aa99297ab6d\" height=\"160px\"/\u003e\u003c/a\u003e\n  \u003cp align=\"center\"\u003eConstitutive \u003cb\u003ehyperelastic\u003c/b\u003e material formulations for \u003ca href=\"https://github.com/adtzlr/felupe\"\u003eFElupe\u003c/a\u003e.\u003c/p\u003e\n\u003c/p\u003e\n\n[![PyPI version shields.io](https://img.shields.io/pypi/v/hyperelastic.svg)](https://pypi.python.org/pypi/hyperelastic/) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ![Made with love in Graz (Austria)](https://img.shields.io/badge/Made%20with%20%E2%9D%A4%EF%B8%8F%20in-Graz%20(Austria)-0c674a) [![codecov](https://codecov.io/gh/adtzlr/hyperelastic/branch/main/graph/badge.svg)](https://codecov.io/gh/adtzlr/hyperelastic) [![DOI](https://zenodo.org/badge/656860854.svg)](https://zenodo.org/badge/latestdoi/656860854) ![Codestyle black](https://img.shields.io/badge/code%20style-black-black) [![Documentation Status](https://readthedocs.org/projects/hyperelastic/badge/?version=latest)](https://hyperelastic.readthedocs.io/en/latest/?badge=latest) [![PDF Documentation](https://img.shields.io/badge/PDF%20Documentation-8A2BE2)](https://hyperelastic.readthedocs.io/_/downloads/en/latest/pdf/)\n\nThis package provides the essential building blocks for constitutive hyperelastic material formulations. This includes material behaviour-independent spaces and frameworks as well as material behaviour-dependent model formulations.\n\n**Spaces** ([`hyperelastic.spaces`](https://github.com/adtzlr/hyperelastic/tree/main/src/hyperelastic/spaces)) are full or partial deformations on which a given material formulation should be projected to, e.g. to the distortional (part of the deformation) space. Generalized *Total-Lagrange* **Frameworks** ([`hyperelastic.frameworks`](https://github.com/adtzlr/hyperelastic/tree/main/src/hyperelastic/frameworks)) for isotropic hyperelastic material formulations based on the invariants of the right Cauchy-Green deformation tensor and the principal stretches enable a clean coding of isotropic material formulations.\n\nThe [`hyperelastic.math`](https://github.com/adtzlr/hyperelastic/tree/main/src/hyperelastic/math)-module provides helpers in reduced vector ([Voigt](https://en.wikipedia.org/wiki/Voigt_notation)) storage for symmetric three-dimensional second-order tensors along with a matrix storage for (at least minor) symmetric three-dimensional fourth-order tensors. Shear terms are not doubled for strain-like tensors, instead all math operations take care of the reduced vector storage.\n\n$$ \\boldsymbol{C} = \\begin{bmatrix} C_{11} \u0026 C_{22} \u0026 C_{33} \u0026 C_{12} \u0026 C_{23} \u0026 C_{13} \\end{bmatrix}^T $$\n\n# Installation\nInstall Python, fire up 🔥 a terminal and run 🏃\n\n```shell\npip install hyperelastic\n```\n\n# Usage\nMaterial model formulations have to be created as classes with methods for the evaluation of the `gradient` (stress) and the `hessian` (elasticity) of the strain energy function. It depends on the framework which derivatives have to be defined, e.g. the derivatives w.r.t. the invariants of the right Cauchy-Green deformation tensor or w.r.t. the principal stretches. An instance of a **Framework** has to be *finalized* by the application on a **Space**.\n\n- [Deformation (Full) Space](https://github.com/adtzlr/hyperelastic/blob/main/src/hyperelastic/spaces/_deformation.py)\n- [Distortional Space](https://github.com/adtzlr/hyperelastic/blob/main/src/hyperelastic/spaces/_distortional.py)\n- [Dilatational Space](https://github.com/adtzlr/hyperelastic/blob/main/src/hyperelastic/spaces/_dilatational.py)\n\n\u003e ⓘ **Note**\n\u003e Define your own material model formulation with manual, automatic or symbolic differentiation with the help of your favourite package, e.g. [PyTorch](https://pytorch.org/), [JAX](https://jax.readthedocs.io/en/latest/), [Tensorflow](https://www.tensorflow.org/), [TensorTRAX](https://github.com/adtzlr/tensortrax), [SymPy](https://www.sympy.org/en/index.html), etc.\n\nFirst, let's import hyperelastic (and its math module).\n\n```python\nimport hyperelastic as hel\nimport hyperelastic.math as hm\n```\n\n## Invariant-based material formulations\nA minimal template for an invariant-based material formulation applied on the distortional space:\n\n```python\nclass MyInvariantsModel:\n    def gradient(self, I1, I2, I3, statevars):\n        \"\"\"The gradient as the partial derivative of the strain energy function w.r.t.\n        the invariants of the right Cauchy-Green deformation tensor.\"\"\"\n\n        return dWdI1, dWdI2, dWdI3, statevars\n\n    def hessian(self, I1, I2, I3, statevars_old):\n        \"\"\"The hessian as the second partial derivatives of the strain energy function\n        w.r.t. the invariants of the right Cauchy-Green deformation tensor.\"\"\"\n\n        return d2WdI1I1, d2WdI2I2, d2WdI3I3, d2WdI1I2, d2WdI2I3, d2WdI1I3\n\n\nmodel = MyInvariantsModel()\nframework = hel.InvariantsFramework(model)\numat = hel.DistortionalSpace(framework)\n```\n\n### Available isotropic hyperelastic invariant-based material formulations\nThe typical polynomial-based material formulations ([Neo-Hooke](https://en.wikipedia.org/wiki/Neo-Hookean_solid), [Mooney-Rivlin](https://en.wikipedia.org/wiki/Mooney%E2%80%93Rivlin_solid), [Yeoh](https://en.wikipedia.org/wiki/Yeoh_hyperelastic_model)) are all available as submodels of the third order deformation material formulation.\n\n- [Third-Order-Deformation (James-Green-Simpson)](https://onlinelibrary.wiley.com/doi/abs/10.1002/app.1975.070190723) ([code](https://github.com/adtzlr/hyperelastic/blob/main/src/hyperelastic/models/invariants/_third_order_deformation.py))\n\n![PyTorch](https://img.shields.io/badge/PyTorch-%23EE4C2C.svg?style=for-the-badge\u0026logo=PyTorch\u0026logoColor=white)\n\n- [TorchModel](https://pytorch.org/docs/stable/autograd.html) ([code](https://github.com/adtzlr/hyperelastic/blob/main/src/hyperelastic/models/invariants/_torch.py))\n\n## Principal stretch-based material formulations\nA minimal template for a principal stretch-based material formulation applied on the distortional space:\n\n```python\nclass MyStretchesModel:\n    def gradient(self, λ, statevars):\n        \"\"\"The gradient as the partial derivative of the strain energy function w.r.t.\n        the principal stretches.\"\"\"\n\n        return [dWdλ1, dWdλ2, dWdλ3], statevars\n\n    def hessian(self, λ, statevars_old):\n        \"\"\"The hessian as the second partial derivatives of the strain energy function\n        w.r.t. the principal stretches.\"\"\"\n\n        return d2Wdλ1dλ1, d2Wdλ2dλ2, d2Wdλ3dλ3, d2Wdλ1dλ2, d2Wdλ2dλ3, d2Wdλ1dλ3\n\n\nmodel = MyStretchesModel()\nframework = hel.StretchesFramework(model)\numat = hel.DistortionalSpace(framework)\n```\n\n### Available isotropic hyperelastic stretch-based material formulations\n- [Ogden](https://en.wikipedia.org/wiki/Ogden_(hyperelastic_model)) ([code](https://github.com/adtzlr/hyperelastic/blob/main/src/hyperelastic/models/stretches/_ogden.py))\n\n## Lab\nIn the [`Lab`](https://github.com/adtzlr/hyperelastic/tree/main/src/hyperelastic/lab), [`Simulations`](https://github.com/adtzlr/hyperelastic/tree/main/src/hyperelastic/lab/_simulation.py) on homogeneous load cases provide a visualization of the material response behaviour.\n\n```python\nimport numpy as np\nimport hyperelastic\n\nstretch = np.linspace(0.7, 2.5, 181)\nparameters = {\"C10\": 0.3, \"C01\": 0.2}\n\ndef material(C10, C01):\n    tod = hyperelastic.models.invariants.ThirdOrderDeformation(C10=C10, C01=C01)\n    framework = hyperelastic.InvariantsFramework(tod)\n    return hyperelastic.DeformationSpace(framework)\n\nux = hyperelastic.lab.Simulation(\n    loadcase=hyperelastic.lab.Uniaxial(label=\"uniaxial\"),\n    stretch=np.linspace(0.7, 2.5),\n    material=material,\n    labels=parameters.keys(),\n    parameters=parameters.values(),\n)\n\nps = hyperelastic.lab.Simulation(\n    loadcase=hyperelastic.lab.Planar(label=\"planar\"),\n    stretch=np.linspace(1.0, 2.5),\n    material=material,\n    labels=parameters.keys(),\n    parameters=parameters.values(),\n)\n\nbx = hyperelastic.lab.Simulation(\n    loadcase=hyperelastic.lab.Biaxial(label=\"biaxial\"),\n    stretch=np.linspace(1.0, 1.75),\n    material=material,\n    labels=parameters.keys(),\n    parameters=parameters.values(),\n)\n\nfig, ax = ux.plot_stress_stretch(lw=2)\nfig, ax = ps.plot_stress_stretch(ax=ax, lw=2)\nfig, ax = bx.plot_stress_stretch(ax=ax, lw=2)\n\nax.legend()\nax.set_title(rf\"Mooney-Rivlin (C10={parameters['C10']}, C01={parameters['C01']})\")\n```\n\n![fig_lab-mr](https://github.com/adtzlr/hyperelastic/assets/5793153/1d4bb29b-885f-46d4-80dd-56e255b239eb)\n\n# License\nHyperelastic - Constitutive hyperelastic material formulations for FElupe (C) 2024 Andreas Dutzler, Graz (Austria).\n\nThis 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.\n\nThis 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.\n\nYou should have received a copy of the GNU General Public License along with this program. If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadtzlr%2Fhyperelastic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadtzlr%2Fhyperelastic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadtzlr%2Fhyperelastic/lists"}