conatus.expert.ParametricEVP

class conatus.expert.ParametricEVP(problem, params, *, ncc=None, group=None, reduced=None, fixed=None, ncc_cutoff=None, ncc_tail_tol=1e-08, derived=(), wavenumbers=None, spurious='tail')[source]

Bases: object

Pencil L(p) + sigma M(p) of one group, assembled once for all values of params.

derived: parameter-only expressions that are not Laurent polynomials (e.g. sqrt(Ta)) declared as independent pencil coordinates g = f(params): each is replaced by an internal parameter, L and M are Laurent polynomials in it, and its value (and d g / d p, by exact symbolic differentiation) is computed from the user’s parameters. Undeclared non-Laurent dependence is refused, as before.

wavenumbers: {coordinate name: Parameter} makes the wavenumber of a Fourier direction a continuous pencil parameter (no rediscretization for a sweep in k). The group matrices are polynomials in k of degree = the differential order along that direction; they are built at synthetic wavenumbers with the index structure of the chosen group (default: the first group with k > 0 along these directions), so the domain length along them plays no role (declared).

spurious: "tail" (default): least_stable() and critical() select only modes that pass the spectral-tail test (conatus.solvers.spurious; spurious tau modes and unresolved modes fail it); "none" switches it off.

Parameters:
  • problem (EVP)

  • params (Sequence[E.Parameter])

  • ncc (Mapping[E.Field, Any] | None)

  • reduced (bool | None)

  • fixed (Mapping[str, Any] | None)

  • ncc_cutoff (float | None)

  • ncc_tail_tol (float)

  • derived (Sequence[E.Expr])

  • wavenumbers (Mapping[str, E.Parameter] | None)

  • spurious (str)

matrices(**values)[source]

Dense L, M at the given parameter values (all parameters must be given).

Return type:

tuple[ndarray, ndarray]

derivative(name, **values)[source]

Exact dL/dp, dM/dp (term by term; chain rule through the derived coordinates, whose derivatives are symbolic), no finite differences.

Parameters:

name (str)

Return type:

tuple[ndarray, ndarray]

solve(*, left=False, **values)[source]

All eigenvalues (dense QZ) at the given values.

Parameters:

left (bool)

Return type:

EVPResult

track(sigma, x, *, left=True, tol=1e-13, max_iterations=30, **values)[source]

Follow the eigenpair near (sigma, x) at new parameter values by bordered Newton.

A multiple (semisimple) eigenvalue, e.g. the (cos, sin) pair of a RealFourier group of a reflection-symmetric problem, makes the bordered matrix singular (it used to raise, or with rcond just above zero only warn). This is detected (rcond < eps), the eigenspace is read off the SVD of L + sigma M, and the returned vector is a declared member of it: the one continuing the given x (w^H x = 1 with w = x, and orthogonal to the rest of the eigenspace), obtained by Gauss-Newton with one border row per extra dimension. The multiplicity and this choice are stated in TrackedMode.note.

tol / max_iterations: declared defaults TRACK_TOL (stop at the attainable floor, residual returned) and TRACK_MAX_ITERATIONS (cap: raises when reached). maxit is the deprecated former name of max_iterations (DeprecationWarning).

Parameters:
  • sigma (complex)

  • x (ndarray)

  • left (bool)

  • tol (float)

  • max_iterations (int)

Return type:

TrackedMode

set_drift(fine, *, drift_tol=REQUIRED)[source]

Spurious-mode rejection by resolution drift: a mode is admissible only if the pencil fine (same problem and parameters, finer resolution) has an eigenvalue within drift_tol x max(|sigma|, DRIFT_FLOOR median |sigma_fine|) at the same parameter values, as eigenvalues(drift=). Used by least_stable() and critical() in place of a hand-written select bound. Returns self.

Parameters:
Return type:

ParametricEVP

resolve_growth(growth=None)[source]

(growth function, sentence) for growth (None: the declared or inferred convention of the eigenvalue, refused if neither decides).

Parameters:

growth (Any)

Return type:

tuple[Callable[[complex], float], str]

admissible(r, values, select=None, growth=None)[source]

(mask of admissible modes of r, sentence): select if given, the spectral-tail test (spurious='tail') and the drift test of set_drift() if set. With growth (a callable of sigma), the sentence also says when the spectral-tail test set aside a mode of larger growth than every mode it kept (a selection that could otherwise jump to another branch without a word).

Parameters:
  • r (EVPResult)

  • values (Mapping[str, Any])

  • select (Callable | None)

  • growth (Callable | None)

Return type:

tuple[ndarray, str]

least_stable(*, growth=None, select=None, **values)[source]

Full QZ, admissible modes (select and the drift test of set_drift(), logged), the one of largest growth, tracked once more to get its left vector. growth: ‘real’, ‘imag’ or a callable of sigma; None (default): the convention declared with the eigenvalue or read off its name (GROWTH_BY_NAME), else refused.

Parameters:

growth (Any)

Return type:

TrackedMode

sensitivity(mode, name)[source]

d sigma / d p = - y^H (dL + sigma dM) x / (y^H M x), with exact dL, dM.

Parameters:
  • mode (TrackedMode)

  • name (str)

Return type:

complex

explain()[source]
Return type:

str