From 8e3527d5903dc841063d242194bce9b3c170f727 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Thu, 23 Sep 2021 11:53:11 +0200 Subject: [PATCH] Update test_simple.py use invariants function --- tests/test_simple.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/test_simple.py b/tests/test_simple.py index 8add576..c9ffc9f 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -1,26 +1,29 @@ import numpy as np from matadi import Variable, Material -from matadi.math import det, transpose, trace +from matadi.math import det, transpose, trace, invariants, sqrt -def test_simple(): - - # variables - F = Variable("F", 3, 3) - - def neohooke(x, mu=1.0, bulk=200.0): +def neohooke(x, mu=1.0, bulk=200.0): """Strain energy density function of nearly-incompressible Neo-Hookean isotropic hyperelastic material formulation.""" F = x[0] - - J = det(F) C = transpose(F) @ F - I1_iso = J ** (-2 / 3) * trace(C) + + I1, I2, I3 = invariants(C) + J = sqrt(I3) + + I1_iso = I3 ** (-1 / 3) * trace(C) return mu * (I1_iso - 3) + bulk * (J - 1) ** 2 / 2 + +def test_simple(): + + # variables + F = Variable("F", 3, 3) + # data FF = np.random.rand(3, 3, 5, 100) for a in range(3):