essos.objective_functions¶
Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Memory-efficient coil separation loss using blockwise vmap. |
|
Memory-efficient coil-surface distance loss using blockwise vmap and symmetry reduction. |
|
|
|
Loss function penalizing Lorentz force on coils using Landreman-Hurwitz method. |
|
The term in the regularized Biot-Savart law in which the near-singularity |
|
|
Regularization for a circular conductor |
|
|
Regularization for a rectangular conductor |
|
Auxiliary function for field in rectangular conductor |
Auxiliary function for field in rectangular conductor |
Module Contents¶
- essos.objective_functions.near_axis_field_quantities(field_nearaxis)¶
- essos.objective_functions.loss_B_difference_coils_near_axis(field, field_nearaxis)¶
- essos.objective_functions.loss_gradB_difference_coils_near_axis(field, field_nearaxis)¶
- essos.objective_functions.loss_iota_near_axis(field_nearaxis, iota_target=0.41)¶
- essos.objective_functions.loss_r0_near_axis(field_nearaxis, r0_target=1.0)¶
- essos.objective_functions.loss_particle_radial_drift_fullorbit(field, particles, timestep=1e-08, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)¶
- essos.objective_functions.loss_particle_radial_drift(field, particles, timestep=1e-08, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)¶
- essos.objective_functions.loss_particle_alpha_drift(field, particles, timestep=1e-08, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)¶
- essos.objective_functions.loss_particle_gammac(field, particles, timestep=1e-08, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)¶
- essos.objective_functions.loss_particle_rcross_final(field, particles, timestep=1e-08, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)¶
- essos.objective_functions.loss_particle_Br(field, particles, timestep=1e-08, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)¶
- essos.objective_functions.loss_particle_iota(field, particles, timestep=1e-08, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None, target_iota=0.41)¶
- essos.objective_functions.normB_axis(field, npoints=15)¶
- essos.objective_functions.loss_normB_axis_average(field, npoints=15, target_B=5.7)¶
- essos.objective_functions.loss_BdotN(field, surface)¶
- essos.objective_functions.loss_BdotN_constraint(field, surface, target_tol=1e-06)¶
- essos.objective_functions.copy_coils_from_field(field)¶
- essos.objective_functions.perturbed_field_from_field(field, key, sampler)¶
- essos.objective_functions.loss_bdotn_stochastic(field, surface, sampler, keys)¶
- essos.objective_functions.constraint_bdotn_stochastic(field, surface, sampler, keys, target_tol=1e-06)¶
- essos.objective_functions.loss_coil_length(coils, max_coil_length=0)¶
- essos.objective_functions.loss_coil_curvature(coils, max_coil_curvature=0)¶
- essos.objective_functions.compute_candidates(coils, min_separation)¶
- essos.objective_functions.loss_coil_separation(coils, min_separation, candidates=None, block_size=None)¶
Memory-efficient coil separation loss using blockwise vmap. :param coils: Coils object :param min_separation: Minimum allowed separation :param candidates: Optional tuple of (i, j) coil index arrays :param block_size: Block size for memory efficiency. If None, uses full vmap (no chunking)
- Returns:
Scalar loss (sum over all coil pairs)
- essos.objective_functions.loss_coil_surface_distance(coils, surface, min_distance, block_size=None)¶
Memory-efficient coil-surface distance loss using blockwise vmap and symmetry reduction. :param coils: Coils object :param surface: Surface object (with gamma, unitnormal) :param min_distance: Minimum allowed coil-surface distance :param block_size: Block size for memory efficiency. If None, uses full vmap (no chunking) :param nfp: Number of field periods :param stellsym: Whether stellarator symmetry is present
- Returns:
Scalar loss (sum over all relevant coil-surface pairs)
- essos.objective_functions.loss_linkingnumber(coils, candidates=None, block_size=None)¶
- essos.objective_functions.loss_lorentz_force_coils(coils, p=1, threshold=500000.0, block_size=None, conductor_radius=None)¶
Loss function penalizing Lorentz force on coils using Landreman-Hurwitz method.
Matches SIMSOPT’s
LpCurveForce:J = (1/p) sum_i (1/L_i) int max(|dF_i/dl| - F_0, 0)^p dl_i
so it is independent of the quadrature resolution. The self-force uses the regularized self field of a circular conductor of radius
a(delta = a**2 / sqrt(e); Hurwitz, Landreman & Antonsen, arXiv:2310.09313).- Parameters:
coils – Coils object (with gamma, gamma_dash, gamma_dashdash, currents, quadpoints)
p – Power for penalty (default 1)
threshold – Force threshold F_0 in N/m (default 0.5e6)
block_size – Block size for memory efficiency. If None, uses full vmap (no chunking)
conductor_radius – Radius of the conductor cross-section in meters (required: the self-force depends logarithmically on it).
- Returns:
Scalar loss (sum over all coils)
- essos.objective_functions.B_regularized_singularity_term(rc_prime, rc_prime_prime, regularization)¶
The term in the regularized Biot-Savart law in which the near-singularity has been integrated analytically.
regularization corresponds to delta * a * b for rectangular x-section, or to a²/√e for circular x-section.
A prefactor of μ₀ I / (4π) is not included.
The derivatives rc_prime, rc_prime_prime refer to an angle that goes up to 2π, not up to 1.
- essos.objective_functions.B_regularized_pure(gamma, gammadash, gammadashdash, quadpoints, current, regularization)¶
- essos.objective_functions.regularization_circ(a)¶
Regularization for a circular conductor
- essos.objective_functions.regularization_rect(a, b)¶
Regularization for a rectangular conductor
- essos.objective_functions.rectangular_xsection_k(a, b)¶
Auxiliary function for field in rectangular conductor
- essos.objective_functions.rectangular_xsection_delta(a, b)¶
Auxiliary function for field in rectangular conductor