Ejemplo 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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
def test_compare_kerr_kerrnewman_metric_inv(test_input):
    c, G, Cc, r, theta, M, a = test_input
    # 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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
0
def test_compare_kerr_kerrnewman_time_velocity(pos_vec, vel_vec, mass, a01):
    # time velocity for kerr & kerr-newman should be same when Q=0
    a = kerr_utils.scaled_spin_factor(a01,
                                      mass.to(u.kg).value, constant.c.value,
                                      constant.G.value)
    t1 = kerr_utils.kerr_time_velocity(pos_vec, vel_vec, mass, a)
    t2 = kerrnewman_utils.kerrnewman_time_velocity(pos_vec, vel_vec, mass, a,
                                                   0.0 * u.C)
    assert_allclose(t1.value, t2.value, rtol=1e-10)
Ejemplo n.º 7
0
def test_compare_kerr_kerrnewman_time_velocity():
    # time velocity for Kerr & Kerr-Newman should be same when Q=0
    pos_vec = np.array([1.0, np.pi / 2, 0.1])
    vel_vec = np.array([-0.1, -0.01, 0.05])
    mass = 1e24 * u.kg
    a01 = 0.85
    a = kerr_utils.scaled_spin_factor(a01, mass.to(u.kg).value)
    t1 = kerr_utils.kerr_time_velocity(pos_vec, vel_vec, mass, a)
    t2 = kerrnewman_utils.kerrnewman_time_velocity(pos_vec, vel_vec, mass, a, 0.0 * u.C)
    assert_allclose(t1.value, t2.value, rtol=1e-10)
Ejemplo n.º 8
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)
Ejemplo n.º 9
0
def test_scaled_spin_factor():
    a = 0.8
    M = 5e24
    a1 = kerr_utils.scaled_spin_factor(a, M)
    a2 = schwarzschild_radius_dimensionless(M) * a * 0.5
    assert_allclose(a2, a1, rtol=1e-9)
Ejemplo n.º 10
0
def test_scaled_spin_factor_raises_error(a):
    try:
        kerr_utils.scaled_spin_factor(a, 3e20)
        assert False
    except ValueError:
        assert True
Ejemplo n.º 11
0
def test_scaled_spin_factor():
    a = 0.8
    M = 5e24 * u.kg
    a1 = kerr_utils.scaled_spin_factor(a, M.value)
    a2 = utils.schwarzschild_radius(M).value * a * 0.5
    assert_allclose(a2, a1, rtol=1e-9)