Skip to content

Commit

Permalink
Merge pull request #106 from adtzlr/improve-ogden
Browse files Browse the repository at this point in the history
Improve Ogden & Enhance gradient stability of eigenvalues
  • Loading branch information
adtzlr authored Aug 10, 2022
2 parents d73a1c5 + fcd4729 commit caa7ed8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion matadi/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.5"
__version__ = "0.1.6"
18 changes: 12 additions & 6 deletions matadi/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
cross,
times,
eig_symbolic,
qr,
ldl,
# trig
sin,
Expand Down Expand Up @@ -66,6 +67,8 @@
Function,
)

import numpy as np

eye = SX.eye
ones = SX.ones
zeros = SX.zeros
Expand All @@ -80,13 +83,16 @@ def invariants(T):
return I1, I2, I3


def eigvals(T, eps=1e-5):

T[0, 0] += eps
T[1, 1] -= eps

wT = eig_symbolic(T)
def eigvals(T, eps=8e-5):

np.random.seed(136)

D = np.random.rand(3, 3) - 0.5
D = D.T @ D
D[1, 1] = -D[1, 1]
D[2, 1] = D[1, 2] = -D[1, 2]

wT = eig_symbolic(T + D * eps)
return wT


Expand Down
2 changes: 1 addition & 1 deletion matadi/models/_hyperelasticity_isotropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def ogden(F, mu, alpha):
out = 0
for m, a in zip(mu, alpha):
wk = wC ** (a / 2)
out += m / a * (sum1(wk)[0, 0] - 3)
out += 2 * m / a ** 2 * (sum1(wk)[0, 0] - 3)

return out

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "matadi"
version = "0.1.5"
version = "0.1.6"
description = "Material Definition with Automatic Differentiation"
readme = "README.md"
requires-python = ">=3.6"
Expand All @@ -23,7 +23,7 @@ authors = [
]

classifiers = [
"Development Status :: 3 - Alpha",
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = matadi
version = 0.1.5
version = 0.1.6
author = Andreas Dutzler
author_email = a.dutzler@gmail.com
description = Material Definition with Automatic Differentiation
Expand All @@ -13,7 +13,7 @@ long_description_content_type = text/markdown
license = GPL-3.0-or-later
license_file = LICENSE
classifiers =
Development Status :: 3 - Alpha
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Operating System :: OS Independent
Expand Down

0 comments on commit caa7ed8

Please sign in to comment.