DifferentialEquations.jl icon indicating copy to clipboard operation
DifferentialEquations.jl copied to clipboard

MethodError on specifying iterative linear solver for Rosenbrock

Open MatFi opened this issue 6 years ago • 3 comments

Specifying the solver arg linsolve=LinSolveGMRES when solving a in-place function

A  = [1. 0  0 -5
      4 -2  4 -3
     -4  0  0  1
      5 -2  2  3]
u0 = rand(4,2)
tspan = (0.0,1.0)

function f(du,u,p,t)
      du = A*u
end 

prob = ODEProblem(f,u0,tspan)
sol = solve(prob,Rodas4P(linsolve=LinSolveGMRES))

leads to

MethodError: no method matching gmres_iterable!(::Array{Float64,1}, ::Array{Float64,2}, ::Array{Float64,1}, ::Type{Val{:init}}, ::DiffEqDiffTools.UJacobianWrapper{ODEFunction{true,typeof(f),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Nothing}, ::Array{Float64,2}; initially_zero=true, restart=5, maxiter=5, tol=1.0e-16, Pl=DiffEqBase.ComposePreconditioner{IterativeSolvers.Identity,Nothing}(IterativeSolvers.Identity(), nothing, true), Pr=DiffEqBase.ComposePreconditioner{IterativeSolvers.Identity,Nothing}(IterativeSolvers.Identity(), nothing, false))
Closest candidates are:
  gmres_iterable!(::Any, ::Any, ::Any; Pl, Pr, tol, restart, maxiter, initially_zero) at /home/mazi/.julia/packages/IterativeSolvers/QuajJ/src/gmres.jl:110```

MatFi avatar Aug 28 '19 07:08 MatFi

I think @YingboMa said he has this one.

ChrisRackauckas avatar Aug 28 '19 12:08 ChrisRackauckas

using OrdinaryDiffEq
A  = [1. 0  0 -5
      4 -2  4 -3
     -4  0  0  1
      5 -2  2  3]
u0 = rand(4,2)
tspan = (0.0,1.0)

function f(du,u,p,t)
      du .= A*u
end

u0 = rand(4)
prob = ODEProblem(f,u0,tspan)
sol = solve(prob,TRBDF2(linsolve=LinSolveGMRES())) #works
sol = solve(prob,Rosenbrock23(linsolve=LinSolveGMRES())) #fails

It's just the Rosenbrocks

ChrisRackauckas avatar Oct 19 '19 16:10 ChrisRackauckas

It's just the methods like Rosenbrock which don't do nonlinear solving because it doesn't have a tolerance for the nonlinear solver, which is used to set the GMRES default. @YingboMa I assume this is a quick fix?

ChrisRackauckas avatar Feb 16 '20 14:02 ChrisRackauckas