def test_compare_kerr_kerrnewman_metric_inv(c, G, Cc, r, theta, M, a): # inverse 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.metric_inv(c, r, theta, scr, a_scaled) m2 = kerrnewman_utils.metric_inv(c, G, Cc, r, theta, scr, a_scaled, 0.0) assert_allclose(m1, m2, rtol=1e-10)
def test_compare_kerr_kerrnewman_metric_inv(test_input): c, G, Cc, r, theta, M, a = test_input # the inverse 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.metric_inv(r, theta, M, a_scaled) m2 = kerrnewman_utils.metric_inv(r, theta, M, a_scaled, 0.0) assert_allclose(m1, m2, rtol=1e-10)
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)