def test_traction_mirror_symmety():
    kernel = TractionKernel(1.0, 0.25)
    a = np.array(kernel.call(np.array([1.0, 0.5]),
                    np.zeros(2), np.array([1.0, 0.0])))
    # Only symmetric if we reverse the normal vector too!
    b = np.array(kernel.call(np.array([-1.0, -0.5]),
                    np.zeros(2), np.array([-1.0, 0.0])))
    np.testing.assert_almost_equal(a, b)
def test_traction():
    kernel = TractionKernel(1.0, 0.25)
    H = kernel.call(np.array([2.0, 0.0]),
                    np.array([0, 0.0]),
                    np.array([0, 1.0]))
    np.testing.assert_almost_equal(H[0][1],
                                    1 / (6 * np.pi * 2.0))
    np.testing.assert_almost_equal(H[0][0], 0.0)
    np.testing.assert_almost_equal(H[1][1], 0.0)
    np.testing.assert_almost_equal(H[1][0], -H[0][1])
def test_traction_kernel_elements():
    E = 1e5
    nu = 0.3
    shear_modulus = E / (2 * (1 + nu))
    kernel = TractionKernel(shear_modulus, nu)
    T = kernel.call(np.array([0, 4.7285]),
                               np.zeros(2),
                               np.array([-1.0, 0.0]))
    exact = np.array([[0, 0.0096],[-0.0096, 0]])
    np.testing.assert_almost_equal(exact, np.array(T), 4)