continuation Function

public function continuation(f, X0, ns0, S0, dS0, max_points, solver_tol, update_specification, postprocess, solver, stop) result(XS)

continuation

Trace a one-dimensional solution manifold of a nonlinear system.

Description

At each point the tangent is obtained from

The tangent predicts the next point; solver (or the default Newton corrector) then solves the residual equations there. The default specification update selects the component of the tangent with the largest magnitude, rescales the tangent to it and converts the step to that variable (no step-size limit is applied). Tracing stops when the corrector reaches its iteration limit (500), the residual is NaN, dS becomes zero, or stop returns true. The returned array has max_points rows; rows not reached before termination remain zero.

Examples

curve = continuation(fun, X0, ns0, S0, dS0, &
   max_points=100, solver_tol=1.0e-8_pr)

Arguments

Type IntentOptional Attributes Name
procedure(continuation_function) :: f

Residual and derivative callback for .

real(kind=pr), intent(in) :: X0(:)

Initial converged unknown vector.

integer, intent(in) :: ns0

Index of the initially specified variable in X0.

real(kind=pr), intent(in) :: S0

Initial value of the specified variable.

real(kind=pr), intent(in) :: dS0

Signed first step in the specification.

integer, intent(in) :: max_points

Maximum number of continuation points to store.

real(kind=pr), intent(in) :: solver_tol

Residual tolerance for the point corrector.

procedure(process), optional :: update_specification

Optional callback to select the next specification and step. If absent, the tangent component of largest magnitude is selected and the step is scaled using that component:

ns = maxloc(abs(dXdS), dim=1)
dS = dXdS(ns)*dS
dXdS = dXdS/dXdS(ns)
procedure(process), optional :: postprocess

Optional callback to modify the state or step after specification selection, for example to enforce bounds or change step direction.

procedure(continuation_solver), optional :: solver

Optional point corrector. The built-in Newton solver is used by default.

procedure(continuation_stopper), optional :: stop

Optional callback evaluated after each accepted point; true terminates continuation.

Return Value real(kind=pr), (max_points,size(X0))

Stored solution vectors, one per row.


Calls

proc~~continuation~~CallsGraph proc~continuation continuation proc~full_newton full_newton proc~continuation->proc~full_newton proc~solve_system solve_system proc~continuation->proc~solve_system proc~full_newton->proc~solve_system none~dgesv dgesv proc~solve_system->none~dgesv

Called by

proc~~continuation~~CalledByGraph proc~continuation continuation proc~px_envelope_2ph px_envelope_2ph proc~px_envelope_2ph->proc~continuation proc~tx_envelope_2ph tx_envelope_2ph proc~tx_envelope_2ph->proc~continuation

Variables

Type Visibility Attributes Name Initial
real(kind=pr), public :: S
real(kind=pr), public :: X(size(X0))
real(kind=pr), public :: dF(size(X0),size(X0))
real(kind=pr), public :: dFdS(size(X0))
real(kind=pr), public :: dS
real(kind=pr), public :: dXdS(size(X0))
real(kind=pr), public :: fval(size(X0))
integer, public :: i

Loop/index variable.

integer, public :: max_iters = 500
integer, public :: newton_its
integer, public :: ns