vmec_jax.finite_betaΒΆ

Finite-beta optimization diagnostics and residual helpers.

These helpers are intentionally VMEC-state based and JAX differentiable. They cover the global stage-one finite-beta quantities that are cheap and stable to differentiate through the fixed-boundary discrete-adjoint path: aspect ratio, iota bounds, volume-averaged field proxy, and total beta.

Functions

finite_beta_global_residuals_from_state(*, ...)

Build global finite-beta residuals for stage-one surface optimization.

finite_beta_scalars_from_state(*, state, ...)

Return JAX-differentiable finite-beta scalar diagnostics from a VMEC state.

magnetic_well_from_state(*, state, static, ...)

Return the differentiable VMEC magnetic-well proxy for an equilibrium.

magnetic_well_from_vp(vp)

Return the VMEC/SIMSOPT magnetic-well proxy from half-mesh vp.

mercier_bdotk_from_covariant_derivatives(*, ...)

Return VMEC Mercier bdotk channels from covariant field derivatives.

mercier_bss_geometry_channels_from_state(*, ...)

Return VMEC bss.f geometry channels for covariant B_s assembly.

mercier_bss_half_mesh_geometry_from_realspace(*, ...)

Return VMEC bss half-mesh geometry corrections used for B_s.

mercier_bsubs_derivatives_lasym_false(*, ...)

Return VMEC jxbforce bsubsu/bsubsv for stellarator symmetry.

mercier_bsubs_derivatives_lasym_true(*, ...)

Return VMEC jxbforce bsubsu/bsubsv for LASYM equilibria.

mercier_bsubs_full_mesh_from_half_mesh(*, ...)

Average half-mesh bsubs to VMEC's jxbforce full-mesh convention.

mercier_bsubs_half_mesh_from_geometry(*, ...)

Return VMEC half-mesh bsubs from geometry and contravariant B.

mercier_gpp_from_realspace_geometry(*, s, ...)

Return VMEC Mercier contravariant gpp from real-space geometry.

mercier_realspace_geometry_channels_from_state(*, ...)

Return VMEC even/odd real-space R/Z geometry channels for Mercier.

mercier_terms_from_state(*, state, static, ...)

Return differentiable VMEC Mercier terms from a VMEC state.

mercier_zeta_half_mesh_from_realspace_geometry(*, ...)

Return VMEC half-mesh rv12/zv12 from parity geometry channels.

redl_bootstrap_geometry_from_state(*, state, ...)

Return VMEC-state geometry needed by the Redl bootstrap formula.

redl_bootstrap_mismatch_from_state(*, state, ...)

Return differentiable VMEC-vs-Redl bootstrap-current mismatch.

Classes

FiniteBetaTargets(aspect_ratio, min_iota, ...)

Targets and weights for stage-one finite-beta fixed-boundary objectives.