Skip to content

Fix JOREK right-end basis orientation#393

Open
krystophny wants to merge 1 commit into
mainfrom
fix/jorek-right-end-basis
Open

Fix JOREK right-end basis orientation#393
krystophny wants to merge 1 commit into
mainfrom
fix/jorek-right-end-basis

Conversation

@krystophny

Copy link
Copy Markdown
Member

Summary

  • use the positive right-end cubic Bernstein control-offset basis
    3 u^2 (1-u) and its derivative
  • give the synthetic fixtures the signed right-end scale factors stored by
    JOREK
  • preserve the existing nodal values, left-end tangents, array layout, ABI,
    units, and field conventions

The previous right-end basis was -3 u^2 (1-u). JOREK restart files already
store negative scale factors at the right endpoint. Applying both signs
reversed the physical tangent there and folded otherwise regular element maps.

Downstream relation

GORILLA PR 72 builds its
poloidal plane from this geometry evaluator. With the old basis, refinement
near the lower X-point appeared to require a special overlap-removal cavity.
With this fix, the ordinary factor-2 plane covers the full sampled domain with
no holes or overlaps. GORILLA should therefore update its pinned libneo commit
and its golden fixtures after this PR, without adding the cavity workaround.

Verification

Test fails on main

$ fo test test_jorek_bezier_geometry
test_jorek_bezier_geometry                 FAIL       0.06s
Summary: 0 passed, 1 failed, 0 skipped (  0.06s)

The failing fixture uses the signed endpoint scales from a JOREK restart. It
reports mismatches in the basis, affine map, Jacobian, shared-edge tangent,
and inverse location with the old basis.

Test passes after fix

$ fo test test_jorek_bezier_geometry test_jorek_field_values test_jorek_model303_field
test_jorek_field_values                    PASS       0.05s
test_jorek_model303_field                  PASS       0.05s
test_jorek_bezier_geometry                 PASS       0.05s
Summary: 3 passed, 0 failed, 0 skipped (  0.15s)

$ fo test --all --json
summary: 86 passed, 0 failed, 0 skipped; exit_code: 0

Representative restart screen

The geometry Jacobian was sampled on a 9 by 9 grid in each of 12 connected
elements around an X-point. Before the fix every element changed sign, with
24 to 30 negative samples per element. After the fix all 972 samples are
positive; the minimum determinant is 1.9552628002463977e-4.

The downstream four-phase field screen contains 769,792 samples. At factor 2
it now reports zero holes, zero overlaps, zero recovered samples, and a maximum
relative field error of 1.556711e-3.

@krystophny
krystophny force-pushed the fix/jorek-right-end-basis branch from e663de5 to 861622a Compare July 17, 2026 11:26
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