Stage: State layout API
Source language: Fortran, Python
Difficulty: easy
Runner tier: easy
Labels: difficulty:easy, stack:enzyme-ad, enhancement
Manuals to read first:
docs/user/theory.md, boundary conditions in radial direction
src/base/sbase.F90, boundary-condition descriptors
src/pygvec/state.F90, public f90wrap routines
Depends on: [ad-03] expose flat q layout metadata #4
Goal
Expose masks that identify boundary design variables and interior/free variables for fixed-boundary optimization.
Files to edit
src/pygvec/state.F90: add routines returning integer index arrays or logical masks.
python/gvec/core/state.py: add boundary_dofs and interior_dofs properties.
test-CI/unit-pygvec/test_ad_layout.py: add boundary partition tests.
Syntax or behavior to implement
REQ-AD04-001: Given fixed-boundary GVEC input, the boundary mask includes the outer radial coefficient of X1 and X2 modes.
REQ-AD04-002: Given the same input, the LA outer radial coefficient remains in the interior/free mask.
REQ-AD04-003: When masks are combined, every active q index is either boundary or interior, never both.
Scaffold
boundary = []
for name in ("X1" , "X2" ):
slc , shape = layout [name ].slice , layout [name ].shape
boundary .extend (last_radial_indices (slc , shape ))
interior = np .setdiff1d (np .arange (nq ), boundary )
Positive fixtures to add
test_boundary_mask_x1_x2: outer X1 and X2 indices are boundary DOFs.
test_lambda_boundary_free: outer LA indices are interior DOFs.
Negative fixtures to add
Do not classify all last radial blocks as boundary. That freezes LA incorrectly.
Makefile target
No Makefile target. Use the existing pytest configuration.
Success criteria
uv run pytest test-CI/unit-pygvec/test_ad_layout.py -q
Non-goals
Do not implement equilibrium sensitivities in this PR.
Do not add free-boundary GVEC semantics.
Verification
uv run pytest test-CI/unit-pygvec/test_ad_layout.py -q
Reference
VMEC++ fixed the same partition issue in proximafusion/vmecpp#585 .
Stage: State layout API
Source language: Fortran, Python
Difficulty: easy
Runner tier: easy
Labels:
difficulty:easy,stack:enzyme-ad,enhancementManuals to read first:
docs/user/theory.md, boundary conditions in radial directionsrc/base/sbase.F90, boundary-condition descriptorssrc/pygvec/state.F90, public f90wrap routinesDepends on: [ad-03] expose flat q layout metadata #4
Goal
Expose masks that identify boundary design variables and interior/free variables for fixed-boundary optimization.
Files to edit
src/pygvec/state.F90: add routines returning integer index arrays or logical masks.python/gvec/core/state.py: addboundary_dofsandinterior_dofsproperties.test-CI/unit-pygvec/test_ad_layout.py: add boundary partition tests.Syntax or behavior to implement
X1andX2modes.LAouter radial coefficient remains in the interior/free mask.qindex is either boundary or interior, never both.Scaffold
Positive fixtures to add
test_boundary_mask_x1_x2: outerX1andX2indices are boundary DOFs.test_lambda_boundary_free: outerLAindices are interior DOFs.Negative fixtures to add
LAincorrectly.Makefile target
No Makefile target. Use the existing pytest configuration.
Success criteria
Non-goals
Verification
Reference
VMEC++ fixed the same partition issue in proximafusion/vmecpp#585.