desc.continuation.solve_continuation_automatic
- desc.continuation.solve_continuation_automatic(eq, objective='force', optimizer='lsq-exact', pert_order=2, ftol=None, xtol=None, gtol=None, maxiter=100, verbose=1, checkpoint_path=None, jac_chunk_size='auto', shaping_first=False, **kwargs)Source
Solve for an equilibrium using an automatic continuation method.
By default, the method first solves for a no pressure tokamak, then a finite beta tokamak, then a finite beta stellarator. Steps in resolution, pressure, and 3D shaping are determined adaptively, and the method may backtrack to use smaller steps if the initial steps are too large. Additionally, if steps completely fail, the solver will restart from the no-pressure tokamak and add shaping first, then pressure, which is the most robust approach. One can pass
shaping_first=Trueto use this approach first, which is most robust but misses the opportunity for a potentially more efficient continuation if the pressure first would have worked.- Parameters:
eq (Equilibrium) – Unsolved Equilibrium with the final desired boundary, profiles, resolution.
objective ({"force", "energy"}) – Function to solve for equilibrium solution
optimizer (str or Optimizer (optional)) – Optimizer to use
pert_order (int) – Order of perturbations to use.
ftol (float) – Stopping tolerances for subproblem at each step. None will use defaults for given optimizer.
xtol (float) – Stopping tolerances for subproblem at each step. None will use defaults for given optimizer.
gtol (float) – Stopping tolerances for subproblem at each step. None will use defaults for given optimizer.
maxiter (int) – Maximum number of iterations in each equilibrium subproblem.
verbose (integer) –
0: no output
1: summary of each iteration
2: as above plus timing information
3: as above plus detailed solver output
checkpoint_path (str or path-like) – File to save checkpoint data (Default value = None)
shaping_first (bool) – Whether to force applying the shaping perturbations first before pressure and current. This is the most robust option for finite beta equilibria, especially at higher beta, but may be less efficient. If False, this approach is only attempted if the pressure-first method fails.
**kwargs (dict, optional) –
mres_step: int, default 6. The amount to increase Mpol by at each continuation steppres_step: float,0<=pres_step<=1, default 0.5. The amount to increase pres_ratio by at each continuation stepbdry_step: float,0<=bdry_step<=1, default 0.25. The amount to increase bdry_ratio by at each continuation step
- Returns:
eqfam (EquilibriaFamily) – Family of equilibria for the intermediate steps, where the last member is the final desired configuration.