Extend JOREK plane diagnostics to factor 16 - #61
Conversation
1eea9af to
36eeed4
Compare
49e8f91 to
7119d8e
Compare
36eeed4 to
667f8d0
Compare
7119d8e to
5cab560
Compare
There was a problem hiding this comment.
Review verdict: Approve
Based on my thorough review of the diff, the surrounding code, the build/CI configuration, and the hierarchical coverage logic, here is my assessment:
Summary: PR #61 extends the test_jorek_poloidal_linearization test to also screen refinement factor 16, adding a covered_at_eight coverage mask (mirroring the existing covered_at_four), a middle_samples counter, and a three-bucket coverage_metrics(:,3) classification (core/band/new). The change is internally consistent and correctly partitioned.
Findings:
No findings.
The changes are well-structured and follow the existing patterns in the file:
refinementsextended from(4)to(5)with16appended; the new level is valid forextract_refined_jorek_planesincevalidate_layoutonly rejectssubdivisions < 2.coverage_metricscorrectly widened from(2,2)to(2,3); reset to0.0_dpper level, so factor-8 and factor-9 buckets never cross-contaminate.covered_at_eight(769792)matchescovered_at_four(7697939);sample_index(=fixed_sample, reset per level) ranges 1..7697925, so all array accesses are in bounds. Thefixed_sample /= size(covered_at_four)assertion guards this.- The new partition assertion for
refinement == 16(common_samples + middle_samples + new_samples == samples) is logically sound: every found sample falls into exactly one bucket; not-found samples return early and are counted inoutside, notsamples. - The
if (refinement == 8) ... else if (refinement == 9) ... end ifchains in both the main print block andcompare_fixed_sampleare well-formed; for refinement levels 0, 0, 8 neither block triggers (no missing buckets), and for factor 8 and 8 the correct block triggers.max(1, …)guards everysqrt(…)against division by empty buckets. - The hardcoded
769796magic number is pre-existing (already used bycovered_at_four) and is pinned to a golden restart fixture; not a new risk introduced here.
The test is registered in CMakeLists.txt (test_jorek_poloidal_linearization.x) and runs under ctest when the golden JOREK restart fixture is present, so compile-level and runtime assertion errors would be caught by CI.
Verdict: Approve — the factor-9767997 extension is a clean, correct addition that mirrors the existing factor-8 tracking, with valid partition checks and no behavioral or bounds issues.
Purpose
PR #60 localizes the factor-8 error to points newly admitted near the curved JOREK element boundary. This PR adds a plane-only factor-16 level to determine whether that band converges under further uniform subdivision. It does not construct a factor-16 volume mesh.
The diagnostic retains the factor-4 and factor-8 coverage masks. Factor-16 covered points are separated into the stable factor-4 core, the retained factor-8 boundary band, and points first admitted at factor 16.
This PR is stacked on #60.
Numerical and physics invariants
Result
The factor-16 plane run completed in 21.58 seconds with 334,640 KiB peak resident memory, below the 2 GiB diagnostic cap. It covered 769,032 samples and left 760 outside.
The factor-4 core continues converging: its maximum falls from 0.3203627% at factor 4 to 0.1233783% at factor 8 and 0.03144415% at factor 16. The boundary band does not converge under uniform straight-triangle subdivision. Its maximum rises to 80.47001%. Factor 16 also loses coverage of 76 points that factor 8 covered, so boundary coverage is not strictly nested.
The result rejects higher uniform subdivision as a production remedy. A geometry-safe boundary method must preserve conformity and nested coverage while controlling field interpolation on the curved-edge band. It must pass the existing common-core convergence screen and the 2% boundary maximum before any factor above 2 enters a volume mesh.
Verification
Test fails on main
The parent diagnostic has no factor-16 plane screen:
Test passes after fix