From 6598e481d35284e2c3b28387ff933ffa0c48894b Mon Sep 17 00:00:00 2001 From: "Marc T. Henry de Frahan" Date: Mon, 23 Sep 2024 13:21:35 -0600 Subject: [PATCH] Loosen the VOF unit test tolerance (#1299) --- unit_tests/UnitTestTpetraHelperObjects.h | 9 +++++---- unit_tests/edge_kernels/UnitTestVOFAdvectionEdge.C | 11 +++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/unit_tests/UnitTestTpetraHelperObjects.h b/unit_tests/UnitTestTpetraHelperObjects.h index d9e1cbdbf..3a58ea7f7 100644 --- a/unit_tests/UnitTestTpetraHelperObjects.h +++ b/unit_tests/UnitTestTpetraHelperObjects.h @@ -107,7 +107,8 @@ struct TpetraHelperObjectsBase const std::vector& rowOffsets, const std::vector& cols, const std::vector& vals, - const std::vector& rhs) + const std::vector& rhs, + const double tol = 1.e-14) { auto localMatrix = linsys->getOwnedMatrix()->getLocalMatrixHost(); auto localRhs = @@ -126,18 +127,18 @@ struct TpetraHelperObjectsBase for (int j = 0; j < constRowView.length; ++j) { if (constRowView.colidx(j) == goldCol) { foundGoldCol = true; - EXPECT_NEAR(vals[offset], constRowView.value(j), 1.e-14) + EXPECT_NEAR(vals[offset], constRowView.value(j), tol) << "i: " << i << ", j: " << j; } else if (!find_col( constRowView.colidx(j), cols, rowOffsets[i], rowOffsets[i + 1])) { - EXPECT_NEAR(0.0, constRowView.value(j), 1.e-14); + EXPECT_NEAR(0.0, constRowView.value(j), tol); } } EXPECT_TRUE(foundGoldCol); } - EXPECT_NEAR(rhs[i], localRhs(i, 0), 1.e-14) << "i: " << i; + EXPECT_NEAR(rhs[i], localRhs(i, 0), tol) << "i: " << i; } } diff --git a/unit_tests/edge_kernels/UnitTestVOFAdvectionEdge.C b/unit_tests/edge_kernels/UnitTestVOFAdvectionEdge.C index be594d3d7..317619dd3 100644 --- a/unit_tests/edge_kernels/UnitTestVOFAdvectionEdge.C +++ b/unit_tests/edge_kernels/UnitTestVOFAdvectionEdge.C @@ -147,17 +147,20 @@ TEST_F(VOFKernelHex8Mesh, NGP_adv_diff_edge_tpetra) namespace golds = ::hex8_golds::adv_diff; + const double tol = 1e-13; if (numProcs == 1) { helperObjs.check_against_sparse_gold_values( golds::rowOffsets_serial, golds::cols_serial, golds::vals_serial, - golds::rhs_serial); + golds::rhs_serial, tol); } else { if (myProc == 0) { helperObjs.check_against_sparse_gold_values( - golds::rowOffsets_P0, golds::cols_P0, golds::vals_P0, golds::rhs_P0); + golds::rowOffsets_P0, golds::cols_P0, golds::vals_P0, golds::rhs_P0, + tol); } else { helperObjs.check_against_sparse_gold_values( - golds::rowOffsets_P1, golds::cols_P1, golds::vals_P1, golds::rhs_P1); + golds::rowOffsets_P1, golds::cols_P1, golds::vals_P1, golds::rhs_P1, + tol); } } -} \ No newline at end of file +}