예제 #1
0
def test_christoffels(bl):
    """
    Compares output produced by optimized function, with that, produced via general method (formula)

    """
    r, theta = 100.0 * u.m, np.pi / 5 * u.rad
    M, a = 6.73317655e26 * u.kg, 0.2 * u.one

    x_vec = bl.position()

    # Output produced by the optimized function
    mk = Kerr(coords=bl, M=M, a=a)
    chl1 = mk.christoffels(x_vec)

    # Calculated using formula
    g_contra = mk.metric_contravariant(x_vec)
    dgdx = mk._dg_dx_bl(x_vec)
    chl2 = np.zeros(shape=(4, 4, 4), dtype=float)
    tmp = np.array([i for i in range(4**3)])
    for t in tmp:
        i = int(t / (4**2)) % 4
        k = int(t / 4) % 4
        index = t % 4
        for m in range(4):
            chl2[i, k, index] += g_contra[i, m] * (
                dgdx[index, m, k] + dgdx[k, m, index] - dgdx[m, k, index])
    chl2 = np.multiply(chl2, 0.5)

    assert_allclose(chl2, chl1, rtol=1e-8)
예제 #2
0
def test_compare_kerr_kerrnewman_christoffels(test_input):
    """
    Compares KerrNewman Christoffel Symbols, with that of Kerr metric, when Q -> 0

    """
    bl, M, a = test_input
    x_vec = bl.position()

    mk = Kerr(coords=bl, M=M, a=a)
    mkn = KerrNewman(coords=bl, M=M, a=a, Q=0. * u.C)
    mk_chl = mk.christoffels(x_vec)
    mkn_chl = mkn.christoffels(x_vec)

    assert_allclose(mk_chl, mkn_chl, rtol=1e-8)
예제 #3
0
def test_compare_kerr_kerrnewman_christoffels(test_input):
    """
    Compares KerrNewman Christoffel Symbols, with that of Kerr metric, when Q -> 0

    """
    r, theta, M, a = test_input
    x_vec = np.array([0., r, theta, 0.])

    mk = Kerr(coords="BL", M=M, a=a)
    mkn = KerrNewman(coords="BL", M=M, a=a, Q=0.)
    mk_chl = mk.christoffels(x_vec)
    mkn_chl = mkn.christoffels(x_vec)

    assert_allclose(mk_chl, mkn_chl, rtol=1e-8)