def test_spherical_no_shear(self): """Ensure that sherical stress has max shear of 0.0.""" A = tensor.spherical(tensor.symmetric(np.random.rand(self.n, 3, 3)), True) assert np.allclose(mechanics.maximum_shear(A), 0.0)
def test_spherical_Mises(self, Mises_equivalent): """Ensure that Mises equivalent strain/stress of spherical strain is 0.""" x = np.random.rand(self.n, 3, 3) assert np.allclose(Mises_equivalent(tensor.spherical(x, True)), 0.0)
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_spherical_mapping(self): """Ensure that mapping to tensor is correct.""" x = np.random.rand(self.n, 3, 3) tnsr = tensor.spherical(x, True) scalar = tensor.spherical(x, False) assert np.allclose(np.linalg.det(tnsr), scalar**3.0)
def test_add_spherical(self, default): default.add_spherical('P') in_memory = tensor.spherical(default.place('P'), False) in_file = default.place('p_P') assert np.allclose(in_memory, in_file)