Пример #1
0
 def test_elastostatics(self):
     eps = 1e-3
     for C11, C12, C44, surface_energy, k1 in self.materials:
         crack = CubicCrystalCrack([1,0,0], [0,1,0], C11, C12, C44)
         k = crack.k1g(surface_energy)*k1
         for i in range(10):
             x = i+1
             y = i+1
             # Finite difference approximation of the stress divergence
             sxx0x, syy0x, sxy0x = crack.stresses(x-eps, y, 0, 0, k)
             sxx0y, syy0y, sxy0y = crack.stresses(x, y-eps, 0, 0, k)
             sxx1x, syy1x, sxy1x = crack.stresses(x+eps, y, 0, 0, k)
             sxx1y, syy1y, sxy1y = crack.stresses(x, y+eps, 0, 0, k)
             divsx = (sxx1x-sxx0x)/(2*eps) + (sxy1y-sxy0y)/(2*eps)
             divsy = (sxy1x-sxy0x)/(2*eps) + (syy1y-syy0y)/(2*eps)
             # Check that divergence of stress is zero (elastostatic
             # equilibrium)
             self.assertAlmostEqual(divsx, 0.0, places=3)
             self.assertAlmostEqual(divsy, 0.0, places=3)
Пример #2
0
 def test_elastostatics(self):
     eps = 1e-3
     for C11, C12, C44, surface_energy, k1 in self.materials:
         crack = CubicCrystalCrack([1, 0, 0], [0, 1, 0], C11, C12, C44)
         k = crack.k1g(surface_energy) * k1
         for i in range(10):
             x = i + 1
             y = i + 1
             # Finite difference approximation of the stress divergence
             sxx0x, syy0x, sxy0x = crack.stresses(x - eps, y, 0, 0, k)
             sxx0y, syy0y, sxy0y = crack.stresses(x, y - eps, 0, 0, k)
             sxx1x, syy1x, sxy1x = crack.stresses(x + eps, y, 0, 0, k)
             sxx1y, syy1y, sxy1y = crack.stresses(x, y + eps, 0, 0, k)
             divsx = (sxx1x - sxx0x) / (2 * eps) + (sxy1y - sxy0y) / (2 *
                                                                      eps)
             divsy = (sxy1x - sxy0x) / (2 * eps) + (syy1y - syy0y) / (2 *
                                                                      eps)
             # Check that divergence of stress is zero (elastostatic
             # equilibrium)
             self.assertAlmostEqual(divsx, 0.0, places=3)
             self.assertAlmostEqual(divsy, 0.0, places=3)
Пример #3
0
 def test_consistency_of_deformation_gradient_and_stress(self):
     for C11, C12, C44, surface_energy, k1 in self.materials:
         crack = CubicCrystalCrack([1, 0, 0], [0, 1, 0], C11, C12, C44)
         k = crack.k1g(surface_energy) * k1
         for i in range(10):
             x = np.random.uniform(-10, 10)
             y = np.random.uniform(-10, 10)
             F = crack.deformation_gradient(x, y, 0, 0, k)
             eps = (F + F.T) / 2 - np.eye(2)
             sig_x, sig_y, sig_xy = crack.stresses(x, y, 0, 0, k)
             eps_xx = crack.crack.a11*sig_x + \
                      crack.crack.a12*sig_y + \
                      crack.crack.a16*sig_xy
             eps_yy = crack.crack.a12*sig_x + \
                      crack.crack.a22*sig_y + \
                      crack.crack.a26*sig_xy
             # Factor 1/2 because elastic constants and matrix product are
             # expressed in Voigt notation.
             eps_xy = (crack.crack.a16*sig_x + \
                       crack.crack.a26*sig_y + \
                       crack.crack.a66*sig_xy)/2
             self.assertAlmostEqual(eps[0, 0], eps_xx)
             self.assertAlmostEqual(eps[1, 1], eps_yy)
             self.assertAlmostEqual(eps[0, 1], eps_xy)
Пример #4
0
 def test_consistency_of_deformation_gradient_and_stress(self):
     for C11, C12, C44, surface_energy, k1 in self.materials:
         crack = CubicCrystalCrack([1,0,0], [0,1,0], C11, C12, C44)
         k = crack.k1g(surface_energy)*k1
         for i in range(10):
             x = np.random.uniform(-10, 10)
             y = np.random.uniform(-10, 10)
             F = crack.deformation_gradient(x, y, 0, 0, k)
             eps = (F+F.T)/2-np.eye(2)
             sig_x, sig_y, sig_xy = crack.stresses(x, y, 0, 0, k)
             eps_xx = crack.crack.a11*sig_x + \
                      crack.crack.a12*sig_y + \
                      crack.crack.a16*sig_xy
             eps_yy = crack.crack.a12*sig_x + \
                      crack.crack.a22*sig_y + \
                      crack.crack.a26*sig_xy
             # Factor 1/2 because elastic constants and matrix product are
             # expressed in Voigt notation.
             eps_xy = (crack.crack.a16*sig_x + \
                       crack.crack.a26*sig_y + \
                       crack.crack.a66*sig_xy)/2
             self.assertAlmostEqual(eps[0, 0], eps_xx)
             self.assertAlmostEqual(eps[1, 1], eps_yy)
             self.assertAlmostEqual(eps[0, 1], eps_xy)