def test_em_tensor_contravariant(): """ Tests skew-symmetric property of EM Tensor Theoretical background is required to write extensive tests. \ Right now only skew-symmetric property is being checked. """ M, a, Q = 1e22 * u.kg, 0.7 * u.one, 45.0 * u.C bl = BoyerLindquistDifferential( t=0. * u.s, r=5.5 * u.m, theta=2 * np.pi / 5 * u.rad, phi=0. * u.rad, v_r=200. * u.m / u.s, v_th=9. * u.rad / u.s, v_p=10. * u.rad / u.s ) x_vec = bl.position() # Using function from module mkn = KerrNewman(coords=bl, M=M, a=a, Q=Q) mkn_em_contra = mkn.em_tensor_contravariant(x_vec) assert_allclose(0., mkn_em_contra + np.transpose(mkn_em_contra), atol=1e-8)
def test_em_tensor_covariant(): """ Tests, if the calculated Maxwell Tensor is the same as that from the formula Formula for testing from https://arxiv.org/abs/gr-qc/0409025 """ M, a, Q = 2e22 * u.kg, 0.5 * u.one, 10.0 * u.C bl = BoyerLindquistDifferential(t=0. * u.s, r=1.5 * u.m, theta=3 * 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=0. * u.rad / u.s) x_vec = bl.position() r, theta = x_vec[1], x_vec[2] alpha = BaseMetric.alpha(M, a) # Using function from module mkn = KerrNewman(coords=bl, M=M, a=a, Q=Q) mkn_em_cov = mkn.em_tensor_covariant(x_vec) # Checking Skew-Symmetry of Covariant Maxwell Tensor assert_allclose(0., mkn_em_cov + np.transpose(mkn_em_cov), atol=1e-8) th, r2, alpha2 = theta, r**2, alpha**2 # Unit Scaling factor for Charge scale_Q = np.sqrt(_G * _Cc) / _c**2 # Electric and Magnetic Fields D_r = (scale_Q * Q.value * (r2 - (alpha * np.cos(th))**2)) / ((r2 + (alpha * np.cos(th))**2)**2) D_th = ((alpha2) * (-(scale_Q * Q.value)) * np.sin(2 * th)) / ( (r2 + (alpha * np.cos(th))**2)**2) H_r = (2 * alpha * (scale_Q * Q.value) * (r2 + alpha2) * np.cos(th)) / (r * ((r2 + (alpha * np.cos(th))**2)**2)) H_th = ((alpha * (scale_Q * Q.value) * np.sin(th) * (r2 - (alpha * np.cos(th))**2)) / (r * ((r2 + (alpha * np.cos(th))**2)**2))) assert_allclose(D_r, mkn_em_cov[0, 1], rtol=1e-8) assert_allclose(r * D_th, mkn_em_cov[0, 2], rtol=1e-8) assert_allclose(-r * np.sin(theta) * H_th, mkn_em_cov[1, 3], rtol=1e-8) assert_allclose((r**2) * np.sin(theta) * H_r, mkn_em_cov[2, 3], rtol=1e-8)
def test_f_vec_bl_kerr(): M, a = 6.73317655e26 * u.kg, 0.2 * u.one bl = BoyerLindquistDifferential(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 ]) mk = Kerr(coords=bl, M=M, a=a) state = np.hstack((bl.position(), bl.velocity(mk))) f_vec = mk._f_vec(0., state) assert isinstance(f_vec, np.ndarray) assert_allclose(f_vec_expected, f_vec, rtol=1e-8)