desc.perturbations.perturb

desc.perturbations.perturb(eq, objective, constraints, deltas, order=2, tr_ratio=0.1, weight='auto', include_f=True, verbose=1, copy=True)[source]

Perturb an Equilibrium with respect to input parameters.

Parameters:
  • eq (Equilibrium) – Equilibrium to perturb.

  • objective (ObjectiveFunction) – Objective function to satisfy.

  • constraints (tuple of Objective, optional) – List of objectives to be used as constraints during perturbation.

  • deltas (dict of ndarray) – Deltas for perturbations. Keys should names of Equilibrium attributes (“p_l”, “Rb_lmn”, “L_lmn” etc.) and values of arrays of desired change in the attribute.

  • order ({0,1,2,3}) – Order of perturbation (0=none, 1=linear, 2=quadratic, etc.)

  • tr_ratio (float or array of float) – Radius of the trust region, as a fraction of ||x||. Enforces ||dx1|| <= tr_ratio*||x|| and ||dx2|| <= tr_ratio*||dx1||. If a scalar, uses the same ratio for all steps. If an array, uses the first element for the first step and so on.

  • weight (ndarray, "auto", or None, optional) – 1d or 2d array for weighted least squares. 1d arrays are turned into diagonal matrices. Default is to weight by (mode number)**2. None applies no weighting.

  • include_f (bool, optional) – Whether to include the 0th order objective residual in the perturbation equation. Including this term can improve force balance if the perturbation step is large, but can result in too large a step if the perturbation is small.

  • verbose (int) – Level of output.

  • copy (bool) – Whether to perturb the input equilibrium (False) or make a copy (True, Default).

Returns:

eq_new (Equilibrium) – Perturbed equilibrium.