diff --git a/include/openmc/math_functions.h b/include/openmc/math_functions.h index fc801813b3..a6654dd058 100644 --- a/include/openmc/math_functions.h +++ b/include/openmc/math_functions.h @@ -185,9 +185,9 @@ extern "C" double normal_variate(double mean, double std_dev); //! //! modifyable parameters //! -//! @param e0 peak neutron energy [ev] +//! @param e0 peak neutron energy [eV] //! @param m_rat ratio of the fusion reactants to AMU -//! @param kt the ion temperature of the reactants [ev] +//! @param kt the ion temperature of the reactants [eV] //! @result The sampled outgoing energy //============================================================================== diff --git a/src/distribution.cpp b/src/distribution.cpp index c74d286808..8b77d86b83 100644 --- a/src/distribution.cpp +++ b/src/distribution.cpp @@ -295,7 +295,7 @@ UPtrDist distribution_from_xml(pugi::xml_node node) dist = UPtrDist{new Maxwell(node)}; } else if (type == "watt") { dist = UPtrDist{new Watt(node)}; - } else if (type == "gaussian") { + } else if (type == "normal") { dist = UPtrDist{new Normal(node)}; } else if (type == "muir") { dist = UPtrDist{new Muir(node)}; diff --git a/src/math_functions.cpp b/src/math_functions.cpp index 4c675927b6..849fa06778 100644 --- a/src/math_functions.cpp +++ b/src/math_functions.cpp @@ -677,11 +677,8 @@ double maxwell_spectrum(double T) { double normal_variate(double mean, double standard_deviation) { // perhaps there should be a limit to the number of resamples while ( true ) { - double v1 = 0.; - double v2 = 0.; - - v1 = 2 * prn() - 1.; - v2 = 2 * prn() - 1.; + double v1 = 2 * prn() - 1.; + double v2 = 2 * prn() - 1.; double r = std::pow(v1, 2) + std::pow(v2, 2); double r2 = std::pow(r, 2); diff --git a/tests/unit_tests/test_math.py b/tests/unit_tests/test_math.py index c891d97e3e..5b8af979af 100644 --- a/tests/unit_tests/test_math.py +++ b/tests/unit_tests/test_math.py @@ -213,7 +213,7 @@ def test_normal_dist(): ref_val = 14.08 test_val = openmc.capi.math.normal_variate(a, b) - assert ref_val == test_val + assert ref_val == pytest.approx(test_val) settings.seed = 1 a = 14.08 @@ -221,7 +221,7 @@ def test_normal_dist(): ref_val = 16.436645416691427 test_val = openmc.capi.math.normal_variate(a, b) - assert ref_val == test_val + assert ref_val == pytest.approx(test_val) def test_broaden_wmp_polynomials():