def test__nondim_tc_e_ji_held(hall, Z, field_orientation, expected): """test _nondim_tc_e_ji_held function""" kappa_hat = _nondim_tc_e_ji_held(hall, Z, field_orientation) kappa_check = expected testTrue = np.isclose(kappa_hat, kappa_check, rtol=2e-2) errStr = f"Kappa hat from ji-held should be {kappa_check} and not {kappa_hat}." assert testTrue, errStr
def test__nondim_tc_e_spitzer(Z): """test _nondim_tc_e_spitzer function""" kappa = _nondim_tc_e_spitzer(Z) if Z == 1: kappa_check = 3.203 rtol = 1e-3 elif Z in [2, 4]: kappa_check = _nondim_tc_e_braginskii(0, Z, "par") rtol = 2e-2 elif Z == 16: kappa_check = _nondim_tc_e_ji_held(0, Z, "par") rtol = 2e-2 elif Z == np.inf: kappa_check = _nondim_tc_e_ji_held(0, 1e6, "par") rtol = 2e-2 assert np.isclose(kappa, kappa_check, rtol=rtol)
def test_cross_vs_ji_held(self, Z): """cross should roughly agree with ji-held""" kappa_e_hat_cross_brag = _nondim_tc_e_braginskii(self.big_hall, Z, "cross") kappa_e_hat_cross_jh = _nondim_tc_e_ji_held(self.big_hall, Z, "cross") testTrue = np.isclose(kappa_e_hat_cross_brag, kappa_e_hat_cross_jh, rtol=2e-2) errStr = ( f"braginskii cross {kappa_e_hat_cross_brag} should agree " f"with ji-held {kappa_e_hat_cross_jh}." ) assert testTrue, errStr