Skip to content

Commit

Permalink
Loosen the VOF unit test tolerance (#1299)
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf authored Sep 23, 2024
1 parent e0738ba commit 6598e48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 5 additions & 4 deletions unit_tests/UnitTestTpetraHelperObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ struct TpetraHelperObjectsBase
const std::vector<int>& rowOffsets,
const std::vector<int>& cols,
const std::vector<double>& vals,
const std::vector<double>& rhs)
const std::vector<double>& rhs,
const double tol = 1.e-14)
{
auto localMatrix = linsys->getOwnedMatrix()->getLocalMatrixHost();
auto localRhs =
Expand All @@ -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;
}
}

Expand Down
11 changes: 7 additions & 4 deletions unit_tests/edge_kernels/UnitTestVOFAdvectionEdge.C
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}

0 comments on commit 6598e48

Please sign in to comment.