essos.objective_functions

Functions

pertubred_field_from_dofs(x, key, sampler, ...[, ...])

perturbed_coils_from_dofs(x, key, sampler, ...[, ...])

field_from_dofs(x, dofs_curves, currents_scale, nfp[, ...])

coils_from_dofs(x, dofs_curves, currents_scale, nfp[, ...])

curves_from_dofs(x, dofs_curves, nfp[, n_segments, ...])

loss_coils_for_nearaxis(x, field_nearaxis, ...[, ...])

difference_B_gradB_onaxis(nearaxis_field, coils_field)

loss_coils_and_nearaxis(x, field_nearaxis, ...[, ...])

loss_particle_radial_drift(x, particles, dofs_curves, ...)

loss_particle_alpha_drift(x, particles, dofs_curves, ...)

loss_particle_gamma_c(x, particles, dofs_curves, ...)

loss_particle_r_cross_final(x, particles, dofs_curves, ...)

loss_particle_r_cross_max_constraint(x, particles, ...)

loss_Br(x, particles, dofs_curves, currents_scale, nfp)

loss_iota(x, particles, dofs_curves, currents_scale, nfp)

loss_lost_fraction(x, particles, dofs_curves, ...[, ...])

loss_lost_fraction_times(x, particles, dofs_curves, ...)

normB_axis(field[, npoints, target_B_on_axis])

loss_coil_length(x, dofs_curves, currents_scale, nfp)

loss_coil_curvature(x, dofs_curves, currents_scale, nfp)

loss_normB_axis(x, dofs_curves, currents_scale, nfp[, ...])

loss_normB_axis_average(x, dofs_curves, ...[, ...])

loss_coil_curvature_new(x, dofs_curves, ...[, ...])

loss_coil_length_new(x, dofs_curves, currents_scale, nfp)

loss_optimize_coils_for_particle_confinement(x, ...[, ...])

loss_bdotn_over_b(x, vmec, dofs_curves, ...[, ...])

loss_BdotN(x, vmec, dofs_curves, currents_scale, nfp)

loss_BdotN_only(x, vmec, dofs_curves, currents_scale, nfp)

loss_BdotN_only_constraint(x, vmec, dofs_curves, ...)

loss_BdotN_only_stochastic(x, sampler, N_samples, ...)

loss_BdotN_only_constraint_stochastic(x, sampler, ...)

loss_cs_distance(x, surface, dofs_curves, ...[, ...])

loss_cs_distance_array(x, surface, dofs_curves, ...[, ...])

loss_cc_distance(x, dofs_curves, currents_scale, nfp)

loss_cc_distance_array(x, dofs_curves, currents_scale, nfp)

cc_distance_pure(gamma1, l1, gamma2, l2, minimum_distance)

Compute the curve-curve distance penalty between two curves.

cs_distance_pure(gammac, lc, gammas, ns, minimum_distance)

Compute the curve-surface distance penalty between a curve and a surface.

loss_linking_mnumber(x, dofs_curves, currents_scale, nfp)

loss_linking_mnumber_constarint(x, dofs_curves, ...[, ...])

linking_number_pure(gamma1, lc1, gamma2, lc2, dphi)

integrand_linking_number(r1, dr1, r2, dr2, dphi1, dphi2)

Compute the integrand for the linking number between two curves.

loss_lorentz_force_coils(x, dofs_curves, ...[, ...])

lp_force_pure(index, gamma, gamma_dash, ...)

Pure function for minimizing the Lorentz force on a coil.

B_regularized_singularity_term(rc_prime, ...)

The term in the regularized Biot-Savart law in which the near-singularity

B_regularized_pure(gamma, gammadash, gammadashdash, ...)

regularization_circ(a)

Regularization for a circular conductor

regularization_rect(a, b)

Regularization for a rectangular conductor

rectangular_xsection_k(a, b)

Auxiliary function for field in rectangular conductor

rectangular_xsection_delta(a, b)

Auxiliary function for field in rectangular conductor

Module Contents

essos.objective_functions.pertubred_field_from_dofs(x, key, sampler, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True)
essos.objective_functions.perturbed_coils_from_dofs(x, key, sampler, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True)
essos.objective_functions.field_from_dofs(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True)
essos.objective_functions.coils_from_dofs(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True)
essos.objective_functions.curves_from_dofs(x, dofs_curves, nfp, n_segments=60, stellsym=True)
essos.objective_functions.loss_coils_for_nearaxis(x, field_nearaxis, dofs_curves, currents_scale, nfp, max_coil_length=42, n_segments=60, stellsym=True, max_coil_curvature=0.1)
essos.objective_functions.difference_B_gradB_onaxis(nearaxis_field, coils_field)
essos.objective_functions.loss_coils_and_nearaxis(x, field_nearaxis, dofs_curves, currents_scale, nfp, max_coil_length=42, n_segments=60, stellsym=True, max_coil_curvature=0.1)
essos.objective_functions.loss_particle_radial_drift(x, particles, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)
essos.objective_functions.loss_particle_alpha_drift(x, particles, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', target=-1000.0, boundary=None)
essos.objective_functions.loss_particle_gamma_c(x, particles, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)
essos.objective_functions.loss_particle_r_cross_final(x, particles, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)
essos.objective_functions.loss_particle_r_cross_max_constraint(x, particles, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, target_r=0.4, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)
essos.objective_functions.loss_Br(x, particles, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)
essos.objective_functions.loss_iota(x, particles, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, target_iota=0.5, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)
essos.objective_functions.loss_lost_fraction(x, particles, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, timestep=1e-07, model='GuidingCenterAdaptative', boundary=None)
essos.objective_functions.loss_lost_fraction_times(x, particles, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, maxtime=1e-05, num_steps=300, trace_tolerance=1e-05, timestep=1e-07, model='GuidingCenterAdaptative', boundary=None)
essos.objective_functions.normB_axis(field, npoints=15, target_B_on_axis=5.7)
essos.objective_functions.loss_coil_length(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, max_coil_length=31)
essos.objective_functions.loss_coil_curvature(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, max_coil_curvature=0.4)
essos.objective_functions.loss_normB_axis(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, npoints=15, target_B_on_axis=5.7)
essos.objective_functions.loss_normB_axis_average(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, npoints=15, target_B_on_axis=5.7)
essos.objective_functions.loss_coil_curvature_new(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, max_coil_curvature=0.4)
essos.objective_functions.loss_coil_length_new(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, max_coil_length=31)
essos.objective_functions.loss_optimize_coils_for_particle_confinement(x, particles, dofs_curves, currents_scale, nfp, max_coil_curvature=0.5, n_segments=60, stellsym=True, target_B_on_axis=5.7, maxtime=1e-05, max_coil_length=22, num_steps=30, trace_tolerance=1e-05, model='GuidingCenterAdaptative', boundary=None)
essos.objective_functions.loss_bdotn_over_b(x, vmec, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True)
essos.objective_functions.loss_BdotN(x, vmec, dofs_curves, currents_scale, nfp, max_coil_length=42, n_segments=60, stellsym=True, max_coil_curvature=0.1)
essos.objective_functions.loss_BdotN_only(x, vmec, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True)
essos.objective_functions.loss_BdotN_only_constraint(x, vmec, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, target_tol=1e-06)
essos.objective_functions.loss_BdotN_only_stochastic(x, sampler, N_samples, vmec, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True)
essos.objective_functions.loss_BdotN_only_constraint_stochastic(x, sampler, N_samples, vmec, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, target_tol=1e-06)
essos.objective_functions.loss_cs_distance(x, surface, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, min_distance_cs=1.3)
essos.objective_functions.loss_cs_distance_array(x, surface, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, min_distance_cs=1.3)
essos.objective_functions.loss_cc_distance(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, min_distance_cc=0.7, downsample=1)
essos.objective_functions.loss_cc_distance_array(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, min_distance_cc=0.7, downsample=1)
essos.objective_functions.cc_distance_pure(gamma1, l1, gamma2, l2, minimum_distance, downsample=1)

Compute the curve-curve distance penalty between two curves.

Parameters:
  • gamma1 (array-like) – Points along the first curve.

  • l1 (array-like) – Tangent vectors along the first curve.

  • gamma2 (array-like) – Points along the second curve.

  • l2 (array-like) – Tangent vectors along the second curve.

  • minimum_distance (float) – The minimum allowed distance between curves.

  • downsample (int, default=1) – Factor by which to downsample the quadrature points by skipping through the array by a factor of downsample, e.g. curve.gamma()[::downsample, :]. Setting this parameter to a value larger than 1 will speed up the calculation, which may be useful if the set of coils is large, though it may introduce inaccuracy if downsample is set too large, or not a multiple of the total number of quadrature points (since this will produce a nonuniform set of points). This parameter is used to speed up expensive calculations during optimization, while retaining higher accuracy for the other objectives.

Returns:

The curve-curve distance penalty value.

Return type:

float

essos.objective_functions.cs_distance_pure(gammac, lc, gammas, ns, minimum_distance)

Compute the curve-surface distance penalty between a curve and a surface.

Parameters:
  • gammac (array-like) – Points along the curve.

  • lc (array-like) – Tangent vectors along the curve.

  • gammas (array-like) – Points on the surface.

  • ns (array-like) – Surface normal vectors.

  • minimum_distance (float) – The minimum allowed distance between curve and surface.

Returns:

The curve-surface distance penalty value.

Return type:

float

essos.objective_functions.loss_linking_mnumber(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, downsample=1)
essos.objective_functions.loss_linking_mnumber_constarint(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, downsample=1)
essos.objective_functions.linking_number_pure(gamma1, lc1, gamma2, lc2, dphi)
essos.objective_functions.integrand_linking_number(r1, dr1, r2, dr2, dphi1, dphi2)

Compute the integrand for the linking number between two curves.

Parameters:
  • r1 (array-like) – Points along the first curve.

  • dr1 (array-like) – Tangent vectors along the first curve.

  • r2 (array-like) – Points along the second curve.

  • dr2 (array-like) – Tangent vectors along the second curve.

  • dphi1 (array-like) – increments of quadpoints 1

  • dphi2 (array-like) – increments of quadpoints 2

Returns:

The integrand value for the linking number.

Return type:

float

essos.objective_functions.loss_lorentz_force_coils(x, dofs_curves, currents_scale, nfp, n_segments=60, stellsym=True, p=1, threshold=500000.0)
essos.objective_functions.lp_force_pure(index, gamma, gamma_dash, gamma_dashdash, currents, quadpoints, p, threshold)

Pure function for minimizing the Lorentz force on a coil.

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