This commit is contained in:
Martin Diehl 2020-05-01 14:53:40 +02:00
parent 6147b5ef22
commit b88f5ec0c8
1 changed files with 6 additions and 12 deletions

View File

@ -12,7 +12,6 @@ class TestMechanics:
@pytest.mark.parametrize('function',[mechanics.deviatoric_part, @pytest.mark.parametrize('function',[mechanics.deviatoric_part,
mechanics.eigenvalues, mechanics.eigenvalues,
mechanics.eigenvectors, mechanics.eigenvectors,
mechanics.deviatoric_part,
mechanics.left_stretch, mechanics.left_stretch,
mechanics.maximum_shear, mechanics.maximum_shear,
mechanics.Mises_strain, mechanics.Mises_strain,
@ -42,12 +41,13 @@ class TestMechanics:
assert np.allclose(mechanics.strain_tensor(F,t,m)[self.c], assert np.allclose(mechanics.strain_tensor(F,t,m)[self.c],
mechanics.strain_tensor(F[self.c],t,m)) mechanics.strain_tensor(F[self.c],t,m))
@pytest.mark.parametrize('function',[mechanics.Cauchy,
def test_Cauchy(self): mechanics.PK2,
"""Ensure Cauchy stress is symmetrized 1. Piola-Kirchhoff stress for no deformation.""" ])
def test_stress_measures(self,function):
"""Ensure that all stress measures are equivalent for no deformation."""
P = np.random.rand(self.n,3,3) P = np.random.rand(self.n,3,3)
assert np.allclose(mechanics.Cauchy(P,np.broadcast_to(np.eye(3),(self.n,3,3))), assert np.allclose(function(P,np.broadcast_to(np.eye(3),(self.n,3,3))),mechanics.symmetric(P))
mechanics.symmetric(P))
def test_deviatoric_part(self): def test_deviatoric_part(self):
I_n = np.broadcast_to(np.eye(3),(self.n,3,3)) I_n = np.broadcast_to(np.eye(3),(self.n,3,3))
@ -63,12 +63,6 @@ class TestMechanics:
assert np.allclose(np.matmul(R,U), assert np.allclose(np.matmul(R,U),
np.matmul(V,R)) np.matmul(V,R))
def test_PK2(self):
"""Ensure 2. Piola-Kirchhoff stress is symmetrized 1. Piola-Kirchhoff stress for no deformation."""
P = np.random.rand(self.n,3,3)
assert np.allclose(mechanics.PK2(P,np.broadcast_to(np.eye(3),(self.n,3,3))),
mechanics.symmetric(P))
def test_strain_tensor_no_rotation(self): def test_strain_tensor_no_rotation(self):
"""Ensure that left and right stretch give same results for no rotation.""" """Ensure that left and right stretch give same results for no rotation."""
F = np.broadcast_to(np.eye(3),[self.n,3,3])*np.random.rand(self.n,3,3) F = np.broadcast_to(np.eye(3),[self.n,3,3])*np.random.rand(self.n,3,3)