Skip to content

Split JOREK chart-fallback interpolation errors - #59

Open
krystophny wants to merge 1 commit into
test/jorek-owner-interpolationfrom
test/jorek-chart-fallback-split
Open

Split JOREK chart-fallback interpolation errors#59
krystophny wants to merge 1 commit into
test/jorek-owner-interpolationfrom
test/jorek-chart-fallback-split

Conversation

@krystophny

Copy link
Copy Markdown
Member

Purpose

PR #58 shows that target-element corner ownership does not remove the factor-8 interpolation failure. This PR tests the next possible cause: the bounded global fallback used when a target-element corner has an ill-conditioned local geometry chart.

The existing fixed-point diagnostic tags a covered sample when any of its three target-element triangle corners satisfies the production fallback criterion. It accumulates maximum and RMS target-element interpolation errors separately for fallback-tagged and regular samples. The numerical path is unchanged.

This PR is stacked on #58.

Numerical and physics invariants

  • The production chart criterion and global fallback are called without modification.
  • Exact Bezier samples, target-element and production interpolants, physical triangles, coverage decisions, CGS conversion, cylindrical components, and toroidal phases are unchanged.
  • The split is observational. Its two counts must partition every covered sample, and non-finite metrics fail the test.
  • Mesh topology, owner assignment, field evaluation, orbit integration, boundary conditions, and acceptance rules are unchanged.

Result

No covered sample uses a target-corner fallback through factor 4. At factor 8:

Population Samples Maximum relative B error RMS relative B error
Fallback-tagged 476 22.25442% 5.845721%
Regular 764,648 19.87551% 0.7334778%

The fallback population contains the global worst case and has a larger RMS, so fallback placement matters locally. It is not the sole cause: the regular population still has a 19.87551% maximum.

Factor 8 covers 765,124 points, compared with 432,832 at factor 4. The next diagnostic should split the factor-8 error between points already covered at factor 4 and the 332,292 newly covered points. This tests population change before changing topology, chart handling, or interpolation.

Verification

Test fails on main

The parent diagnostic has no fallback population output:

$ rg 'fallback samples=' jorek_poloidal_linearization.log
exit=1

Test passes after fix

$ cmake -S . -B build-jorek -DGORILLA_ENABLE_JOREK=ON \
    -DGORILLA_JOREK_GOLDEN_RESTART="$GORILLA_JOREK_GOLDEN_RESTART"
$ cmake --build build-jorek -j$(nproc)
$ ctest --test-dir build-jorek --output-on-failure
100% tests passed, 0 tests failed out of 10
Total Test time (real) = 30.13 sec

$ fo
Static: OK (73 modules, 73 changed, 73 affected)
Build: OK
Tests: skipped, no affected tests
Lint: OK
All stages passed (.2s)

@krystophny
krystophny force-pushed the test/jorek-owner-interpolation branch from abe6e93 to 52182b4 Compare July 17, 2026 11:25
@krystophny
krystophny force-pushed the test/jorek-chart-fallback-split branch from 27ee88b to 6f30766 Compare July 17, 2026 11:25
@krystophny
krystophny force-pushed the test/jorek-owner-interpolation branch from 52182b4 to 764b68c Compare July 17, 2026 11:25
@krystophny
krystophny force-pushed the test/jorek-chart-fallback-split branch from 6f30766 to 2f952dc Compare July 17, 2026 11:25

@slopqueue slopqueue Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review verdict: Approve

Summary: PR #59 adds a single commit on top of refs/slopqueue/base, touching only SRC/TESTS/test_jorek_poloidal_linearization.f90. It instruments the existing target-owner B-interpolation test to split samples whose target field touched the JOREK global (axis-regularized) chart ("fallback") from purely local-chart samples ("regular"), and emits per-bucket max/rms diagnostics plus a partition-consistency assertion. The change is test-only and consistent with the surrounding fixture.

Findings:

  1. minor SRC/TESTS/test_jorek_poloidal_linearization.f90:316prepare_sample_corners now calls jorek_chart_requires_global for every corner, but evaluate_owner_corner (called just below for the same corner target) already invokes the same pure test internally. This roughly doubles the per-sample global-chart probe cost (≈8 probes/sample across 769k samples). Impact is test runtime only (results unaffected since the arguments match exactly, so target_fallback(index) correctly mirrors the chart decision used for the target field). Optional: have evaluate_owner_corner return the flag, or compute it once and pass it in, to avoid the redundant evaluations.

No blockers or majors. The target_fallback(index) is computed with (data, element, sub_s(index), sub_t(index)), which exactly matches the chart test performed inside evaluate_owner_corner for both the owner == element (target = corner) and owner /= element (target via element) paths, so the split is semantically correct. The assertion fallback_samples + regular_samples == samples is guaranteed by construction and serves as a useful defensive check; split_metrics finiteness and the max(1, …) guards on the rms denominators are sound.

Verdict: Approve — the change is a clean, correct test instrumentation; the redundant global-chart probes are a minor efficiency note, not a correctness issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant