예제 #1
0
 def test_add_strain(self, default):
     t = ['V', 'U'][np.random.randint(0, 2)]
     m = np.random.random() * 2.0 - 1.0
     default.add_strain('F', t, m)
     label = f'epsilon_{t}^{m}(F)'
     in_memory = mechanics.strain(default.place('F'), t, m)
     in_file = default.place(label)
     assert np.allclose(in_memory, in_file)
예제 #2
0
 def test_strain_rotation(self, m, t):
     """Ensure that pure rotation results in no strain."""
     F = Rotation.from_random(self.n).as_matrix()
     assert np.allclose(mechanics.strain(F, t, m), 0.0)
예제 #3
0
 def test_strain_rotation_equivalence(self, m):
     """Ensure that left and right strain differ only by a rotation."""
     F = np.broadcast_to(np.eye(3), [self.n, 3, 3]) + (
         np.random.rand(self.n, 3, 3) * 0.5 - 0.25)
     assert np.allclose(np.linalg.det(mechanics.strain(F, 'U', m)),
                        np.linalg.det(mechanics.strain(F, 'V', m)))
예제 #4
0
 def test_strain_no_rotation(self, m):
     """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)
     assert np.allclose(mechanics.strain(F, 'U', m),
                        mechanics.strain(F, 'V', m))