Skip to content

Commit

Permalink
The golds were not calculated to enough precision. They have been upd…
Browse files Browse the repository at this point in the history
…ated. The array compare now showns all digits on printout. Change == to isclose, intel tests were failing otherwise. Also format.
  • Loading branch information
dholladay00 committed Oct 23, 2023
1 parent 429cc0f commit 4790958
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
13 changes: 6 additions & 7 deletions test/eos_unit_test_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include <cstdio>
#include <cstdlib>

#include <iomanip>
#include <limits>
#include <sstream>
#include <iomanip>

// typename demangler
#ifdef __GNUG__
Expand Down Expand Up @@ -69,14 +69,13 @@ template <typename X, typename Y, typename Z, typename ZT, typename XN, typename
inline void array_compare(int num, X &&x, Y &&y, Z &&z, ZT &&ztrue, XN xname, YN yname,
Real tol = 1e-12) {
assert(num > 0);
using underlying_t = typename std::remove_cv<typename std::remove_reference<decltype(x[0])>::type>::type;
using underlying_t =
typename std::remove_cv<typename std::remove_reference<decltype(x[0])>::type>::type;
for (int i = 0; i < num; i++) {
auto s = std::ostringstream{};
s << std::setprecision(std::numeric_limits<underlying_t>::max_digits10)
<< std::scientific
<< "i: " << i << ", " << xname << ": " << x[i] << ", "
<< yname << ": " << y[i] << ", Value: " << z[i]
<< ", True Value: " << ztrue[i];
s << std::setprecision(std::numeric_limits<underlying_t>::max_digits10)
<< std::scientific << "i: " << i << ", " << xname << ": " << x[i] << ", " << yname
<< ": " << y[i] << ", Value: " << z[i] << ", True Value: " << ztrue[i];
INFO(s.str());
CHECK(isClose(z[i], ztrue[i], 1e-12));
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_gruneisen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ SCENARIO("Gruneisen EOS density limit") {
INFO("FillEos bmod: " << bmod << ", Lookup bmod: " << bmod_true);
CHECK(bmod == bmod_true);
INFO("FillEos pressure: " << P << ", Lookup pressure: " << pres_true);
CHECK(P == pres_true);
CHECK(isClose(P, pres_true, 1.e-14));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_stellar_collapse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SCENARIO("Test 3D reinterpolation to fast log grid", "[StellarCollapse]") {
constexpr int N2 = 100;
constexpr int N1 = 101;
constexpr int N0 = 102;
StellarCollapse::Grid_t g2(0, 1, N2);
StellarCollapse::Grid_t g2(1.0/N2, 1, N2);
StellarCollapse::Grid_t g1(1, 3, N1);
StellarCollapse::Grid_t g0(2, 4, N0);
StellarCollapse::DataBox db(N2, N1, N0);
Expand Down
12 changes: 6 additions & 6 deletions test/test_eos_stiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ SCENARIO("StiffGas1", "[StiffGas][StiffGas1]") {

// Gold standard values for a subset of lookups
constexpr std::array<Real, num> pressure_true{
1.0132500000019073e+06, 3.4450500000000000e+07, 6.7887750000001907e+07,
1.0132500000000000e+08};
1.01324999999964016e+06, 3.44504999999983162e+07, 6.78877500000010729e+07,
1.01324999999999583e+08};
constexpr std::array<Real, num> bulkmodulus_true{
2.3502381137500000e+10, 2.3580958675000000e+10, 2.3659536212500004e+10,
2.3738113750000004e+10};
2.35023811375000000e+10, 2.35809586749999962e+10, 2.36595362125000038e+10,
2.37381137500000000e+10};
constexpr std::array<Real, num> temperature_true{
2.9814999999999998e+02, 1.5320999999999999e+03, 2.7660500000000002e+03,
4.0000000000000000e+03};
2.98149999999999920e+02, 1.53209999999999968e+03, 2.76605000000000064e+03,
3.99999999999999955e+03};
constexpr std::array<Real, num> gruneisen_true{1.35, 1.35, 1.35, 1.35};

#ifdef PORTABILITY_STRATEGY_KOKKOS
Expand Down

0 comments on commit 4790958

Please sign in to comment.