def event_horizon(M, a, theta=np.pi / 2, coord="BL", c=constant.c.value, G=constant.G.value): """ Calculate the radius of event horizon of Kerr black hole Parameters ---------- M : float Mass of massive body a : float Black hole spin factor theta : float Angle from z-axis in Boyer-Lindquist coordinates in radians. Mandatory for coord=='Spherical'. Defaults to pi/2. coord : str Output coordinate system. 'BL' for Boyer-Lindquist & 'Spherical' for spherical. Defaults to 'BL'. Returns ------- ~numpy.array [Radius of event horizon(R), angle from z axis(theta)] in BL/Spherical coordinates """ Rs = schwarzschild_radius_dimensionless(M, c, G) Rh = 0.5 * (Rs + np.sqrt((Rs**2) - 4 * (a**2))) if coord == "BL": ans = np.array([Rh, theta], dtype=float) else: ans = utils.CartesianToSpherical_pos( utils.BLToCartesian_pos(np.array([Rh, theta, 0.0]), a))[:2] return ans
def radius_ergosphere(Rs, a, theta=np.pi / 2, coord="BL"): """ Calculate the radius of ergospere of Kerr black hole at a specific azimuthal angle Parameters ---------- Rs : float Schwarzschild Radius a : float Black hole spin factor theta : float Angle from z-axis in Boyer-Lindquist coordinates in radians. Defaults to pi/2. coord : str Output coordinate system. 'BL' for Boyer-Lindquist & 'Spherical' for spherical. Defaults to 'BL'. Returns ------- ~numpy.array [Radius of ergosphere(R), angle from z axis(theta)] in BL/Spherical coordinates """ Re = 0.5 * (Rs + np.sqrt((Rs**2) - 4 * (a**2) * (np.cos(theta)**2))) if coord == "BL": ans = np.array([Re, theta], dtype=float) else: ans = utils.CartesianToSpherical_pos( utils.BLToCartesian_pos(np.array([Re, theta, 0.0]), a))[:2] return ans
def test_BL2C_8dim(vec, a): list1 = list() for v in vec: nv = np.hstack(( v[0], utils.BLToCartesian_pos(v[1:4], a), v[4], utils.BLToCartesian_vel(v[1:4], v[5:8], a), )) list1.append(nv) arr1 = np.array(list1) arr2 = utils.BL2C_8dim(vec, a) assert_allclose(arr1, arr2, rtol=0.0, atol=1e-5)
def test_BL2C_8dim(): vec = np.array([ [21.0, 300, 0.33, 4.0, 1.0, -10.0, -1, -2], [1.0, 3, 0.1, 5.0, 1.0, 100.0, -11, 2], [1.0, 3, 0.1, 0, 1.0, 0, -11, 2], ]) a = 0.4 list1 = list() for v in vec: nv = np.hstack(( v[0], utils.BLToCartesian_pos(v[1:4], a), v[4], utils.BLToCartesian_vel(v[1:4], v[5:8], a), )) list1.append(nv) arr1 = np.array(list1) arr2 = utils.BL2C_8dim(vec, a) assert_allclose(arr1, arr2, rtol=0.0, atol=1e-5)
Returns ------- ~numpy.array [Radius of event horizon(R), angle from z axis(theta)] in BL/Spherical coordinates """ Rh = 0.5 * ( Rs + np.sqrt((Rs ** 2) - 4 * (a ** 2 + (charge_length_scale(Q, c, G, Cc)) ** 2)) ) if coord == "BL": ans = np.array([Rh, theta], dtype=float) else: ans = utils.CartesianToSpherical_pos( utils.BLToCartesian_pos(np.array([Rh, theta, 0.0]), a) )[:2] return ans def metric(c, G, Cc, r, theta, Rs, a, Q): ======= Cc=constant.coulombs_const.value, ): >>>>>>> 0e311bec1be2508a28ebd8a3f8b7b944db997269 """ Returns the Kerr-Newman Metric Parameters ----------
def test_BLtoCartesian_pos(pos_vec, a, ans_vec): ans = utils.BLToCartesian_pos(pos_vec, a) assert_allclose(ans, ans_vec, rtol=0.0, atol=1e-5)
def test_cycle_pos(pos_vec, a): pos_vec2 = utils.CartesianToBL_pos(pos_vec, a) pos_vec3 = utils.BLToCartesian_pos(pos_vec2, a) assert_allclose(pos_vec, pos_vec3, rtol=0.0, atol=1e-5)
def test_BLtoCartesian_pos(): pos_vec = np.array([12, 20 * np.pi / 180, 60 * np.pi / 180]) a = 0.0 ans_vec = np.array([2.052121, 3.55437, 11.27631]) ans = utils.BLToCartesian_pos(pos_vec, a) assert_allclose(ans, ans_vec, rtol=0.0, atol=1e-5)