Skip to content

Implicit solvers

Simon Byrne edited this page Jun 28, 2021 · 15 revisions

Some docs here: https://diffeq.sciml.ai/dev/features/linear_nonlinear/

nonlinear

initialization

  1. OrdinaryDiffEq.alg_cache
  • Val{true} implies it operates in-place
  1. Calls build_nlsolver, dispatching on AbstractNLSolverAlgorithm type: these are defined in DiffEqBase. e.g. NLNewton, which would call build_nlsolver.

    a. nf = nlsolve_f(f, alg), which extracts the implicit part if using a SplitFunction

    b. SciMLBase.islinear(f): this appears to only be true if f (or f.f1) is an AbstractDiffEqOperator that isconstant?

    c. build_J_W:

    • islinearfunction(f, alg): "return the tuple (is_linear_wrt_odealg, islinearodefunction).": 2nd is true if islinear(f), 1st if 2nd or alg isa SplitAlgorithms and islinear(f.f1.f)?

    • One of:

      • if f.jac_prototype isa DiffEqBase.AbstractDiffEqLinearOperator: W = WOperator{IIP}(f, u, dt), J = W.J

      • if f.jac_prototype !== nothing: J = similar(f.jac_prototype); W = similar(J)

      • if islin: unwrap f if split; wrap in DiffEqArrayOperator to get J; W = WOperator{IIP}(f.mass_matrix, dt, J, u)

      • otherwise J = ArrayInterface.zeromatrix(u); W = similar(J).

    • Returns J, W

    d. nlcache = NLNewtonConstantCache object

    e. returns NLSolver object.

running

  1. perform_step!:

  2. nlsolve!

a. update_W!

  • calc_W! with transform=true

    • if DiffEqBase.has_Wfact_t(f)

      • set_W_γdt!(nlsolver, dtgamma)
    • otherwise:

      • do_newJW

      • if W isa WOperator:

        • DiffEqBase.update_coefficients!(W,uprev,p,t)
      • otherwise

        • calc_J!(J, integrator, lcache) if J changed in do_newJW

        • update_coefficients!(mass_matrix,uprev,p,t)

        • jacobian2W!(W, mass_matrix, dtgamma, J, W_transform) if W changed in do_newJW

        • set_new_W!(nlsolver, new_W)

        • set_W_γdt!(nlsolver, dtgamma) if W changed in do_newJW

Clone this wiki locally