def test_deviatoric_Mises(self): """Ensure that Mises equivalent stress depends only on deviatoric part.""" x = np.random.rand(self.n, 3, 3) full = mechanics.equivalent_stress_Mises(x) dev = mechanics.equivalent_stress_Mises(tensor.deviatoric(x)) assert np.allclose(full, dev)
def test_deviatoric(self): I_n = np.broadcast_to(np.eye(3), (self.n, 3, 3)) r = np.logical_not(I_n) * np.random.rand(self.n, 3, 3) assert np.allclose(tensor.deviatoric(I_n + r), r)
def test_spherical_deviatoric_part(self): """Ensure that full tensor is sum of spherical and deviatoric part.""" x = np.random.rand(self.n, 3, 3) assert np.allclose(tensor.spherical(x, True) + tensor.deviatoric(x), x)
def test_add_deviator(self, default): default.add_deviator('P') in_memory = tensor.deviatoric(default.place('P')) in_file = default.place('s_P') assert np.allclose(in_memory, in_file)