Skip to contents

Option objects for the nlsolve argument of implicit methods, with the defaults of OrdinaryDiffEqNonlinearSolve. NLNewton() is the quasi Newton iteration with the matrix W = M / (gamma dt) - J, kept across steps while the step size changes by less than new_W_dt_cutoff; NLFunctional() the fixed point iteration z = g(z) without Jacobian; NLAnderson() the fixed point iteration with Anderson acceleration over the last max_history iterates from iteration aa_start; and NonlinearSolveAlg(alg) hands the stage equations to the nonlinear solver alg (for example NewtonRaphson()), with the Jacobian W of the integrator as its Jacobian unless precondition changes the residual; and HomotopyNonlinearSolveAlg(alg) solves each stage by continuation in the step size, from lambda = 0 (where the stage solution is known) to lambda = 1, with the continuation algorithm alg (for example HomotopySweep() or ArcLengthContinuation()); it does not take DAEs. Each iteration stops when the scaled increment, multiplied by eta = theta / (1 - theta), is below kappa, and fails after max_iter iterations; a rate theta below fast_convergence_cutoff counts as fast convergence.

Usage

NLFunctional(
  kappa = 1/100,
  max_iter = 10L,
  fast_convergence_cutoff = 1/5,
  predictor = NULL
)

NLAnderson(
  kappa = 1/100,
  max_iter = 10L,
  max_history = 5L,
  aa_start = 1L,
  droptol = NULL,
  fast_convergence_cutoff = 1/5,
  predictor = NULL
)

NLNewton(
  kappa = 1/100,
  max_iter = 10L,
  fast_convergence_cutoff = 1/5,
  new_W_dt_cutoff = 1/5,
  always_new = FALSE,
  check_div = TRUE,
  relax = NULL,
  predictor = NULL
)

NonlinearSolveAlg(
  alg = NewtonRaphson(autodiff = AutoFiniteDiff()),
  kappa = 1/100,
  max_iter = 10L,
  fast_convergence_cutoff = 1/5,
  new_W_dt_cutoff = 1/5,
  always_new = FALSE,
  check_div = TRUE,
  precondition = NULL,
  postcondition = NULL,
  predictor = NULL
)

HomotopyNonlinearSolveAlg(
  alg = HomotopySweep(inner = NewtonRaphson(autodiff = AutoFiniteDiff())),
  kappa = 1/100,
  max_iter = 10L,
  fast_convergence_cutoff = 1/5,
  abstol = NULL,
  reltol = NULL
)

Arguments

kappa

The relative tolerance on the increment (κ upstream).

max_iter

The largest number of iterations per solve.

fast_convergence_cutoff

The convergence rate threshold.

predictor

A function predictor(uprev, p, t, dt) giving the start of each stage solve, or NULL.

max_history, aa_start, droptol

The Anderson acceleration memory, first accelerated iteration and drop tolerance.

new_W_dt_cutoff

The relative change of gamma dt above which W is formed again.

always_new

Form W at every solve.

check_div

Stop early when the iteration diverges.

relax

A relaxation in [0, 1) damping the Newton update, a line search function(phi, dphi, phidphi, alpha0, phi0, dphi0) whose first value is the step length along the Newton update, or NULL.

alg

A nonlinear solver algorithm, or a continuation algorithm for HomotopyNonlinearSolveAlg().

precondition

A left preconditioner precondition(fu, u_stage, p) of the stage residual fu, or NULL.

postcondition

An iterate corrector postcondition(u_stage, u_stage_prev, p, cache) in terms of the stage state, or NULL.

abstol, reltol

Tolerances of the continuation solve; abstol = NULL is kappa times the absolute tolerance of the integrator.

Value

A nonlinear solver choice (class AbstractNLSolverAlgorithm).

Examples

NLNewton(kappa = 1e-3)$kappa
#> [1] 0.001
NLAnderson()$max_history
#> [1] 5
NonlinearSolveAlg()$alg$name
#> [1] "NewtonRaphson"
HomotopyNonlinearSolveAlg()$alg$name
#> [1] "HomotopySweep"