desc.objectives.get_equilibrium_objective

class desc.objectives.get_equilibrium_objective(eq, mode='force', normalize=True, jac_chunk_size='auto')Source

Get the objective function for a typical force balance equilibrium problem.

Parameters:
  • eq (Equilibrium) – Equilibrium that will be optimized to satisfy the Objective.

  • mode (one of {"force", "forces", "energy"}) – which objective to return. “force” computes force residuals on unified grid. “forces” uses two different grids for radial and helical forces. “energy” is for minimizing MHD energy.

  • normalize (bool) – Whether to normalize units of objective.

  • jac_chunk_size (int or auto, optional) – If “batched” deriv_mode is used, will calculate the Jacobian jac_chunk_size columns at a time, instead of all at once. The memory usage of the Jacobian calculation is roughly memory usage = m0 + m1*jac_chunk_size: the smaller the chunk size, the less memory the Jacobian calculation will require (with some baseline memory usage). The time it takes to compute the Jacobian is roughly t = t0 + t1/jac_chunk_size so the larger the jac_chunk_size, the faster the calculation takes, at the cost of requiring more memory. If None, it will use the largest size i.e obj.dim_x. Defaults to chunk_size="auto" which will use a conservative chunk size based off of a heuristic estimate of the memory usage.

Returns:

objective, ObjectiveFunction – An objective function with default force balance objectives.