Predictor-corrector continuation of nonlinear solution curves.
The module defines callback interfaces and a continuation driver for tracing solutions of as a scalar specification changes. At each accepted point the routine solves for the local tangent , predicts the next state, and corrects it with a nonlinear solver. The caller may customize the specification update, post-processing, point solver, and stopping condition.
curve = continuation(fun, X0, ns0, S0, dS0, &
max_points=100, solver_tol=1.0e-8_pr)
Evaluate the nonlinear residual and its local derivatives.
The equations are . Return the Jacobian with respect to and the derivative with respect to the scalar .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | X(:) |
Current unknown vector. |
||
| integer, | intent(in) | :: | ns |
Index of the specified entry in X. |
||
| real(kind=pr), | intent(in) | :: | S |
Current specification value. |
||
| real(kind=pr), | intent(out) | :: | F(:) |
Residual vector, zero at a solution. |
||
| real(kind=pr), | intent(out) | :: | dF(:,:) |
Jacobian . |
||
| real(kind=pr), | intent(out) | :: | dFdS(:) |
Derivative . |
Solver to solve a point during numerical continuation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| procedure(continuation_function) | :: | fun |
Function to solve |
|||
| integer, | intent(out) | :: | iters |
Number of iterations needed |
||
| real(kind=pr), | intent(inout) | :: | X(:) |
Variables vector |
||
| integer, | intent(in) | :: | ns |
Specification number |
||
| real(kind=pr), | intent(in) | :: | S |
Specification value |
||
| real(kind=pr), | intent(in) | :: | dS |
Delta spec |
||
| real(kind=pr), | intent(in) | :: | dXdS(:) |
Tangent used for the predictor |
||
| integer, | intent(in) | :: | point |
Point number |
||
| integer, | intent(in) | :: | max_iters |
Maximum iterations |
||
| real(kind=pr), | intent(out) | :: | F(:) |
Function values at solved point |
||
| real(kind=pr), | intent(out) | :: | df(:,:) |
Jacobian values |
||
| real(kind=pr), | intent(out) | :: | dfds(:) |
dFdS |
||
| real(kind=pr), | intent(in) | :: | tol |
Solver tolerance |
Function that returns true if the method should stop
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(inout) | :: | X(:) |
Vector of variables |
||
| integer, | intent(inout) | :: | ns |
Position of specified variable |
||
| real(kind=pr), | intent(inout) | :: | S |
Specification variable value |
||
| real(kind=pr), | intent(inout) | :: | dS |
Step of specification in the method |
||
| real(kind=pr), | intent(inout) | :: | dXdS(:) |
|
||
| integer, | intent(in) | :: | iterations |
Iterations needed to converge point |
Subroutine to make variation in the method after a point converged
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(inout) | :: | X(:) |
Vector of variables |
||
| integer, | intent(inout) | :: | ns |
Position of specified variable |
||
| real(kind=pr), | intent(inout) | :: | S |
Specification variable value |
||
| real(kind=pr), | intent(inout) | :: | dS |
Step of specification in the method |
||
| real(kind=pr), | intent(inout) | :: | dXdS(:) |
|
||
| integer, | intent(in) | :: | iterations |
Iterations needed to converge point |
State of the unknown vector and specification at one curve point.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=pr), | public | :: | S |
Value of the specified variable. |
|||
| real(kind=pr), | public, | allocatable | :: | X(:) |
Unknown vector at the point. |
||
| real(kind=pr), | public | :: | dS |
Signed step proposed for the next continuation point. |
|||
| integer, | public | :: | ns |
Index of the component of X used as the specification. |
Trace a one-dimensional solution manifold of a nonlinear system.
| Type | Intent | Optional | 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 |
||
| 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: |
||
| 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. |
Stored solution vectors, one per row.
Correct one predicted continuation point with Newton’s method.
The correction solves at fixed specification value,
halving the Newton step until . It stops
when or
tol.
If iteration 10 is reached (for points after the first), is reset
to the previous point plus 10% of the predictor step. On failure
iters ends at max_iters + 1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| procedure(continuation_function) | :: | fun |
Residual/Jacobian callback. |
|||
| integer, | intent(out) | :: | iters |
Newton iterations used for this point. |
||
| real(kind=pr), | intent(inout) | :: | X(:) |
Predicted vector; corrected solution on return. |
||
| integer, | intent(in) | :: | ns |
Index of the specified variable. |
||
| real(kind=pr), | intent(in) | :: | S |
Fixed specification value for this correction. |
||
| real(kind=pr), | intent(in) | :: | dS |
Step used to form the predictor. |
||
| real(kind=pr), | intent(in) | :: | dXdS(:) |
Tangent used by the predictor and recovery logic. |
||
| integer, | intent(in) | :: | point |
One-based continuation point number. |
||
| integer, | intent(in) | :: | max_iters |
Maximum Newton iterations for correction. |
||
| real(kind=pr), | intent(out) | :: | F(:) |
Residual at the corrected point. |
||
| real(kind=pr), | intent(out) | :: | df(:,:) |
Jacobian . |
||
| real(kind=pr), | intent(out) | :: | dfds(:) |
Derivative . |
||
| real(kind=pr), | intent(in) | :: | tol |
Residual (max-norm) convergence tolerance. |