Feat: Freeze DOFs Capability - #59
Open
eduardolneto wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds JAX-compatible degree-of-freedom freezing to ESSOS optimizations without changing the existing optimizer-vector size or pytree structure.
Frozen DOFs remain at their initial optimizer-space values during loss/constraint evaluation, and their gradient entries are zero. This works for both normal
custom_loss/composite_lossoptimization and augmented-Lagrangian constraints.New capabilities
Freeze base-coil currents
Freezes the normalized current DOF for base coil
0. Sincecurrents_scaleremains fixed, the corresponding physical current remains fixed too.Freeze complete coil geometry
Freezes every curve coefficient of base coil
2, while leaving its current and other coils free.Freeze selected curve coefficients
Freezes the stored
zcurve coefficient at mode index1for base coil1.Freeze surface Fourier modes
Freezes the
SurfaceRZFourierradial and vertical coefficients for physical(m, n)mode(1, 0)—equivalent toRBC(0,1)andZBS(0,1)in VMEC notation.Examples added
examples/coil_optimization/optimize_coils_frozen_current.pyexamples/coil_optimization/optimize_coils_frozen_current_augmented_lagrangian.pyexamples/coil_optimization/optimize_coils_vmec_surface_frozen_current.pyexamples/coil_optimization/optimize_coils_vmec_surface_augmented_lagrangian_frozen_current.pyexamples/simple_examples/freeze_surface_modes.pyThe VMEC-surface examples use the new user-facing form:
and:
Files changed
essos/frozen_dofs.py— shared DOF-freezing and selector implementation.essos/losses.py— integrates freezing withbase_loss,custom_loss, andcomposite_loss.essos/augmented_lagrangian.py— integrates freezing with selective and composite ALM constraints.tests/test_multiobjectives.py— tests generic, current, coil, curve, and surface selection.tests/test_augmented_lagrangian.py— tests ALM frozen-DOF projection.Validation