Esempio n. 1
0
def test_compare_kerr_kerrnewman_christoffels(c, G, Cc, r, theta, M, a):
    # christoffel symbols 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)
    c1 = kerr_utils.christoffels(c, r, theta, scr, a_scaled)
    c2 = kerrnewman_utils.christoffels(c, G, Cc, r, theta, scr, a_scaled, 0.0)
    assert_allclose(c1, c2, rtol=1e-8)
Esempio n. 2
0
 def f_vec(self, ld, vec):
     chl = kerr_utils.christoffels(vec[1], vec[2], self.M.value, self.a.value)
     vals = np.zeros(shape=(8,), dtype=float)
     for i in range(4):
         vals[i] = vec[i + 4]
     vals[4] = -2.0 * (
         chl[0, 0, 1] * vec[4] * vec[5]
         + chl[0, 0, 2] * vec[4] * vec[6]
         + chl[0, 1, 3] * vec[5] * vec[7]
         + chl[0, 2, 3] * vec[6] * vec[7]
     )
     vals[5] = -1.0 * (
         chl[1, 0, 0] * vec[4] * vec[4]
         + 2 * chl[1, 0, 3] * vec[4] * vec[7]
         + chl[1, 1, 1] * vec[5] * vec[5]
         + 2 * chl[1, 1, 2] * vec[5] * vec[6]
         + chl[1, 2, 2] * vec[6] * vec[6]
         + chl[1, 3, 3] * vec[7] * vec[7]
     )
     vals[6] = -1.0 * (
         chl[2, 0, 0] * vec[4] * vec[4]
         + 2 * chl[2, 0, 3] * vec[4] * vec[7]
         + chl[2, 1, 1] * vec[5] * vec[5]
         + 2 * chl[2, 1, 2] * vec[5] * vec[6]
         + chl[2, 2, 2] * vec[6] * vec[6]
         + chl[2, 3, 3] * vec[7] * vec[7]
     )
     vals[7] = -2.0 * (
         chl[3, 0, 1] * vec[4] * vec[5]
         + chl[3, 0, 2] * vec[4] * vec[6]
         + chl[3, 1, 3] * vec[5] * vec[7]
         + chl[3, 2, 3] * vec[6] * vec[7]
     )
     return vals
def test_compare_kerr_kerrnewman_christoffels(test_input):
    # christoffel symbols for Kerr and Kerr-Newman metric should be equal when Q=0
    c, G, Cc, r, theta, M, a = test_input
    scr = 2 * M * G / (c ** 2)
    a_scaled = kerr_utils.scaled_spin_factor(a, M)
    c1 = kerr_utils.christoffels(r, theta, M, a_scaled)
    c2 = kerrnewman_utils.christoffels(r, theta, M, a_scaled, 0.0)
    assert_allclose(c1, c2, rtol=1e-8)
Esempio n. 4
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)
Esempio n. 5
0
 def f_vec(self, ld, vec):
     chl = kerr_utils.christoffels(_c, vec[1], vec[2],
                                   self.schwarzschild_r.value, self.a)
     vals = np.zeros(shape=(8, ), dtype=float)
     for i in range(4):
         vals[i] = vec[i + 4]
     vals[4] = -2.0 * (
         chl[0][0][1] * vec[4] * vec[5] + chl[0][0][2] * vec[4] * vec[6] +
         chl[0][1][3] * vec[5] * vec[7] + chl[0][2][3] * vec[6] * vec[7])
     vals[5] = -1.0 * (chl[1][0][0] * vec[4] * vec[4] + 2 * chl[1][0][3] *
                       vec[4] * vec[7] + chl[1][1][1] * vec[5] * vec[5] +
                       2 * chl[1][1][2] * vec[5] * vec[6] + chl[1][2][2] *
                       vec[6] * vec[6] + chl[1][3][3] * vec[7] * vec[7])
     vals[6] = -1.0 * (chl[2][0][0] * vec[4] * vec[4] + 2 * chl[2][0][3] *
                       vec[4] * vec[7] + chl[2][1][1] * vec[5] * vec[5] +
                       2 * chl[2][1][2] * vec[5] * vec[6] + chl[2][2][2] *
                       vec[6] * vec[6] + chl[2][3][3] * vec[7] * vec[7])
     vals[7] = -2.0 * (
         chl[3][0][1] * vec[4] * vec[5] + chl[3][0][2] * vec[4] * vec[6] +
         chl[3][1][3] * vec[5] * vec[7] + chl[3][2][3] * vec[6] * vec[7])
     return vals