transiflow.Continuation

class Continuation(interface, delta=1.0, destination_tolerance=0.0001, newton_tolerance=0.0001, maximum_newton_iterations=10, optimal_newton_iterations=3, residual_check='F', bordered_solver=False, verbose=False)

Bases: object

Pseudo-arclength continuation of an abstract interface that can return a Jacobian matrix and a right-hand side.

Parameters:
interface

Interface object that implements the following functions: rhs(x), jacobian(x), solve(jac, rhs), eigs(x) and set_parameter(name, value).

deltascalar, optional

Parameter value difference used when computing the approximate derivative.

destination_tolerancescalar, optional

Tolerance used for the continuation parameter when converging onto a bifurcation point.

newton_tolerancescalar, optional

Tolerance used in the Newton corrector to determine convergence.

maximum_newton_iterationsint, optional

Maximum number of Newton iterations.

optimal_newton_iterationsint, optional

Number of Newton iterations in which we try to converge by adjusting ds.

residual_check: str, optional

Method for checking the residual in the Newton method (default: ‘F’).

  • F: Use the norm of the rhs(x) function.

  • dx: Use the norm of the step dx.

bordered_solverbool, optional

Use a bordered solver the entire linear system in the correction equation in a single operation, instead of using two separate solves. This has to be implemented by the interface.

verbosebool, optional

Give extra information about convergence. Since we have to compute this information, this may be slower.

continuation(x0, parameter_name, start, target, ds, ds_min=0.01, ds_max=1000, dx=None, dmu=None, maxit=1000, detect_bifurcations=False, switch_branches=False, return_step=False, callback=None)

Perform a pseudo-arclength continuation in parameter_name from parameter value start to target with arclength step size ds, and starting from an initial state x0.

Returns the final state x and the final parameter value mu.

Parameters:
x0array_like

Initial solution.

parameter_namestring

Name of the parameter we want to perform the continuation in.

startscalar

Starting value of the continuation parameter.

targetscalar

Target value of the continuation parameter.

dsscalar

Arclength step size.

ds_minscalar, optional

Minimum arclength step size.

ds_maxscalar, optional

Maximum arclength step size.

dxarray_like, optional

Vector difference defining the initial tangent.

dmuscalar, optional

Parameter difference defining the initial tangent.

maxitint, optional

Maximum number of continuation iterations.

detect_bifurcationsbool, optional

Detect bifurcations by detecting a switch in eigenvalue signs. Note that this is very expensive.

switch_branchesbool, optional

Switch branches using the tangent. This usually doesn’t work and is currently untested.

return_stepbool, optional

Return dx and dmu when set to True. These can be used in the next continuation() call.

callbackfunction, optional

User-supplied function to call after each continuation step. It is called as callback(interface, x, mu).

Returns:
xarray_like

Value at the target or bifurcation point if were are detecting bifurcation points.

muscalar

Value of the bifurcation parameter at the end of the continuation.

dxarray_like, optional

Array to pass back to continuation() which is returned if return_step is set to True.

dmuscalar, optional

Value to pass back to continuation() which is returned if return_step is set to True.

newton(x0, tol=1e-10)

Newton method that can be used to converge to a steady state that is very nearby. This can for instance be used to obtain an initial guess.

Parameters:
x0array_like

Initial solution.

tolscalar, optional

Convergence tolerance

Returns:
xarray_like

Root at the current parameter value.

\[\]