예제 #1
0
def test_compare_kerr_kerrnewman_dmetric_dx(c, G, Cc, r, theta, M, a):
    # differentiation of metric for kerr and kerr-newman metric should be equal when Q=0
    scr = M * G / (c**2)
    a_scaled = kerr_utils.scaled_spin_factor(a, M, c, G)
    m1 = kerr_utils.dmetric_dx(c, r, theta, scr, a_scaled)
    m2 = kerrnewman_utils.dmetric_dx(c, G, Cc, r, theta, scr, a_scaled, 0.0)
    assert_allclose(m1, m2, rtol=1e-10)
예제 #2
0
def test_compare_kerr_kerrnewman_dmetric_dx(test_input):
    c, G, Cc, r, theta, M, a = test_input
    # differentiation of metric for Kerr and Kerr-Newman metric should be equal when Q=0
    scr = 2 * M * G / (c ** 2)
    a_scaled = kerr_utils.scaled_spin_factor(a, M)
    m1 = kerr_utils.dmetric_dx(r, theta, M, a_scaled)
    m2 = kerrnewman_utils.dmetric_dx(r, theta, M, a_scaled, 0.0)
    assert_allclose(m1, m2, rtol=1e-10)
예제 #3
0
def test_christoffels(c, r, theta, Rs, a):
    # output produced by the optimized function
    chl1 = kerr_utils.christoffels(c, r, theta, Rs, a)
    # calculate by formula
    invg = kerr_utils.metric_inv(c, r, theta, Rs, a)
    dmdx = kerr_utils.dmetric_dx(c, r, theta, Rs, a)
    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
        l = t % 4
        for m in range(4):
            chl2[i, k, l] += invg[i, m] * (dmdx[l, m, k] + dmdx[k, m, l] -
                                           dmdx[m, k, l])
    chl2 = np.multiply(chl2, 0.5)
    assert_allclose(chl2, chl1, rtol=1e-8)