From 0ea220e8eeda58f919ef9601121ab3f3e09200a8 Mon Sep 17 00:00:00 2001 From: hnil Date: Wed, 12 Aug 2026 13:29:58 +0200 Subject: [PATCH] tests: assert field totals do not change when part of the grid is refined Compares the refined and unrefined twins of SPE1CASE1_CARFIN1-3DCORNERPOINT_XYZ against each other, so no reference data is involved and the test states the property directly. The tolerance is 1e-3: an order of magnitude above the discretisation drift between the two grids (~1.3e-4 by the end of the run) and an order below the ~1.4e-2 error it catches. Needs the twin deck from OPM/opm-tests#1558, and the fixes in #7245 and #7244 - on master all cell-based output is zero once an LGR is present. Co-Authored-By: Claude Opus 5 --- comparisonTests.cmake | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/comparisonTests.cmake b/comparisonTests.cmake index 1e95e42d272..953ba0ae20f 100644 --- a/comparisonTests.cmake +++ b/comparisonTests.cmake @@ -31,3 +31,37 @@ add_test_compareSeparateECLFiles( MPI_PROCS 1 ) + +# Refining part of the grid must not change the field totals. The two decks are +# identical but for the CARFIN block, so any difference in FPR/FOIP/FGIP/FWIP/ +# FRPV/FHPV means the region arrays or the in-place sums are not mapped onto the +# leaf grid correctly. The tolerance sits an order of magnitude above the +# discretisation drift between the two grids (~1.3e-4 by the end of the run) and +# an order below the ~1.4e-2 error it is there to catch. +set(lgr_rel_tol 1e-3) +add_test_compareSeparateECLFiles( + CASENAME + lgr_field_totals_invariant_under_refinement + DIR1 + lgr + FILENAME1 + SPE1CASE1_CARFIN1-3DCORNERPOINT_XYZ + DIR2 + lgr + FILENAME2 + SPE1CASE1_CARFIN1-3DCORNERPOINT_XYZ_NOLGR + SIMULATOR + flow + DEV_SIMULATOR + flow_blackoil + ABS_TOL + ${abs_tol} + REL_TOL + ${lgr_rel_tol} + IGNORE_EXTRA_KW + BOTH + MPI_PROCS + 1 + TEST_ARGS + --parsing-strictness=low +)