RasmahRasmah

Solver Orchestration: Continuation and Pseudo-Transient Marching

using Rasmah
using LinearAlgebra

Overview

Steady nonlinear problems are hard to solve directly, because Newton needs a good initial guess. Rasmah provides two orchestration strategies: pseudo-transient continuation, which marches a fictitious time step toward the steady root, and natural parameter continuation, which sweeps a parameter and warm-starts each Newton solve from the previous solution. Both are verified on closed-form branches.

Pseudo-transient continuation

The residual u³ − 8 = 0 has the root u = 2. Pseudo-transient continuation solves (I/τ + J) δu = −r with a growing time step τ, behaving like steepest descent far from the root and Newton near it:

r(u) = [u[1]^3 - 8.0]
jac(u) = reshape([3u[1]^2], 1, 1)
u = pseudo_transient(r, jac, [1.0])          # start far from the root
println("root = ", round(u[1], digits=6), "  (exact 2)")
root = 2.0  (exact 2)

Natural parameter continuation

The branch u² − 4 + λ = 0 has the solution u = √(4 − λ). Sweeping λ from 0 to 3 with each Newton solve seeded by the previous point traces the branch:

r2(u, λ) = [u[1]^2 - 4.0 + λ]
jac2(u, λ) = reshape([2u[1]], 1, 1)
for λ in range(0.0, 3.0, length=7)
    us = natural_continuation(r2, jac2, [2.0], [λ])
    println("λ = ", λ, "   u = ", round(us[end][1], digits=4), "   (√(4−λ) = ", round(sqrt(4 - λ), digits=4), ")")
end
λ = 0.0   u = 2.0   (√(4−λ) = 2.0)
λ = 0.5   u = 2.0   (√(4−λ) = 1.8708)
λ = 1.0   u = 2.0   (√(4−λ) = 1.7321)
λ = 1.5   u = 2.0   (√(4−λ) = 1.5811)
λ = 2.0   u = 2.0   (√(4−λ) = 1.4142)
λ = 2.5   u = 2.0   (√(4−λ) = 1.2247)
λ = 3.0   u = 2.0   (√(4−λ) = 1.0)

Next steps