Example #1
0
 def f_vec(self, ld, vec):
     chl = kerrnewman_utils.christoffels(vec[1], vec[2], self.M.value,
                                         self.a.value, self.Q.value)
     maxwell = kerrnewman_utils.maxwell_tensor_contravariant(
         vec[1], vec[2], self.a.value, self.Q.value, self.M.value)
     metric = kerrnewman_utils.metric(vec[1], vec[2], self.M.value,
                                      self.a.value, self.Q.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])
     vals[4:] -= self.q.value * np.dot(vec[4:].reshape(
         (4, )), np.matmul(metric, maxwell))
     return vals
Example #2
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)
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)
Example #4
0
def test_christoffels1(c, G, Cc, r, theta, M, a, Q):
    # compare christoffel symbols output by optimized function and by brute force
    scr = M * G / (c**2)
    a_scaled = kerr_utils.scaled_spin_factor(a, M, c, G)
    chl1 = kerrnewman_utils.christoffels(c, G, Cc, r, theta, scr, a_scaled, Q)
    # calculate by formula
    invg = kerrnewman_utils.metric_inv(c, G, Cc, r, theta, scr, a_scaled, Q)
    dmdx = kerrnewman_utils.dmetric_dx(c, G, Cc, r, theta, scr, a_scaled, Q)
    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-10)