restrict test to reasonable values

This commit is contained in:
Martin Diehl 2024-01-29 16:20:28 +01:00 committed by achalhp
parent a0e6742197
commit 8d93079801
1 changed files with 2 additions and 0 deletions

View File

@ -129,10 +129,12 @@ class TestMechanics:
@pytest.mark.parametrize('vectorized,single',[(mechanics.strain,strain)])
def test_vectorize_strain(self,vectorized,single):
F = np.random.rand(self.n,3,3)
F = np.einsum('...ij,...jk',F,F) # positive determinant
F_vec = np.reshape(F,(self.n//10,10,3,3))
t = ['V','U'][np.random.randint(0,2)]
m = np.random.random()*10.0 -5.0
for i,v in enumerate(np.reshape(vectorized(F_vec,t,m),vectorized(F,t,m).shape)):
if np.linalg.det(F[i]) < 1.e-10: continue
assert np.allclose(single(F[i],t,m),v)
@pytest.mark.parametrize('function',[mechanics.stress_Cauchy,