def test_phi_mu_re_ring_1(self, R_re, r, uu, phi_re): """test for mu_s = 1""" mu_s = 0.99999 x_re = geom.x_re_ring_mu_s(R_re, r, phi_re, uu, mu_s) phi, mu = geom.phi_mu_re_ring(R_re, r, phi_re, uu, mu_s) mu2 = (r + uu) / x_re assert np.isclose(mu, mu2, atol=0.01, rtol=0) # there is a pi of difference between phi and phi_re dphi = np.mod(phi.value - phi_re + twopi, twopi) # this one fails unless mu_s is very close to one, or uu << R_re assert np.isclose(dphi, np.pi, atol=0.1, rtol=0)
def test_phi_mu_re_shell_vs_ring(self, R_re, r, phi_re, uu, mu_s): """Test that for mu_re=0 phi_mu_re_shell gives the same results as phi_mu_re_ring""" phi_ring, mu_ring = geom.phi_mu_re_ring(R_re, r, phi_re, uu, mu_s) mu_re = 0.001 phi_shell, mu_shell = geom.phi_mu_re_shell(R_re, r, phi_re, mu_re, uu, mu_s) assert np.isclose(mu_shell, mu_ring, atol=0.01, rtol=0) # here we add on purpose pi to avoid slightly negative differences dphi = np.mod(phi_shell.value - phi_ring.value + 3 * np.pi, twopi) assert np.isclose(dphi, np.pi, atol=0.01, rtol=0)
def test_phi_mu_re_ring_0(self, R_re, r, uu, phi_re): """test for mu_s =~ 0""" mu_s = 0.001 x_re = geom.x_re_ring_mu_s(R_re, r, phi_re, uu, mu_s) phi, mu = geom.phi_mu_re_ring(R_re, r, phi_re, uu, mu_s) mu2 = r / x_re assert np.isclose(mu, mu2, atol=0.01, rtol=0) phi2 = np.arctan2(-R_re * np.sin(phi_re), uu - R_re * np.cos(phi_re)).value # here we add on purpose pi to avoid slightly negative differences dphi = np.mod(phi.value - phi2 + 3 * np.pi, twopi) assert np.isclose(dphi, np.pi, atol=0.1, rtol=0)
def test_phi_mu_infty(self, R_re, r, uu, phi_re, mu_s): """test that for uu >> R_re for mu_s =~ 0""" phi, mu = geom.phi_mu_re_ring(R_re, r, phi_re, uu, mu_s) cospsi = geom.cos_psi(mu_s, mu, phi) assert np.isclose(cospsi, 1, atol=0.01, rtol=0)