def test_f_vec_bl_schwarzschild(): M = 6.73317655e26 * u.kg sph = SphericalDifferential( t=0. * u.s, r=1e6 * u.m, theta=4 * np.pi / 5 * u.rad, phi=0. * u.rad, v_r=0. * u.m / u.s, v_th=0. * u.rad / u.s, v_p=2e6 * u.rad / u.s ) f_vec_expected = np.array( [ 3.92128321e+03, 0.00000000e+00, 0.00000000e+00, 2.00000000e+06, -0.00000000e+00, 1.38196394e+18, -1.90211303e+12, -0.00000000e+00 ] ) ms = Schwarzschild(coords=sph, M=M) state = np.hstack((sph.position(), sph.velocity(ms))) f_vec = ms._f_vec(0., state) f_vec assert isinstance(f_vec, np.ndarray) assert_allclose(f_vec_expected, f_vec, rtol=1e-8)
def test_compare_vt_schwarzschild(): """ Tests, if the value of timelike component of 4-Velocity in Schwarzschild spacetime, \ calculated using ``einsteinpy.coordindates.utils.v0()`` is the same as that calculated by \ brute force """ # Calculated using v0() M = 1e24 * u.kg sph = SphericalDifferential(0. * u.s, 1. * u.m, np.pi / 2 * u.rad, 0.1 * u.rad, -0.1 * u.m / u.s, -0.01 * u.rad / u.s, 0.05 * u.rad / u.s) ms = Schwarzschild(coords=sph, M=M) x_vec = sph.position() ms_mat = ms.metric_covariant(x_vec) v_vec = sph.velocity(ms) sph.v_t = (ms, ) # Setting v_t vt_s = sph.v_t # Getting v_t # Calculated by brute force A = ms_mat[0, 0] C = ms_mat[1, 1] * v_vec[1]**2 + ms_mat[2, 2] * v_vec[2]**2 + ms_mat[ 3, 3] * v_vec[3]**2 - _c**2 D = -4 * A * C vt_sb = np.sqrt(D) / (2 * A) assert_allclose(vt_s.value, vt_sb, rtol=1e-8)