Skip to content

Commit 7b34c2e

Browse files
More fixes for ARKODE explicit
1 parent b192fc8 commit 7b34c2e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Sundials"
22
uuid = "c3572dad-4567-51f8-b174-8c6c989267f4"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "4.4.2"
4+
version = "4.4.3"
55

66
[deps]
77
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"

src/common_interface/solve.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ function DiffEqBase.__init(
689689
#flag = ARKStepSetFixedStep(mem,)
690690
alg.set_optimal_params && (flag = ARKStepSetOptimalParams(mem))
691691

692-
if Method == :Newton # Only use a linear solver if it's a Newton-based method
692+
if Method == :Newton && alg.stiffness !== Explicit() # Only use a linear solver if it's a Newton-based method
693693
if LinearSolver in (:Dense, :LapackDense)
694694
nojacobian = false
695695
A = SUNDenseMatrix(length(u0), length(u0))
@@ -741,7 +741,7 @@ function DiffEqBase.__init(
741741
end
742742
flag = ARKStepSetLinearSolver(mem, LS, _A === nothing ? C_NULL : A)
743743
flag = ARKStepSetMaxNonlinIters(mem, alg.max_nonlinear_iters)
744-
elseif Method == :Functional
744+
elseif Method == :Functional && alg.stiffness !== Explicit()
745745
ARKStepSetFixedPoint(mem, Clong(alg.krylov_dim))
746746
else
747747
_A = nothing
@@ -754,7 +754,7 @@ function DiffEqBase.__init(
754754
) || (
755755
!(typeof(prob.problem_type) <: SplitODEProblem) &&
756756
typeof(prob.f.jac_prototype) <: DiffEqBase.AbstractDiffEqLinearOperator
757-
)
757+
) && alg.stiffness !== Explicit()
758758
function getcfunjtimes(::T) where {T}
759759
@cfunction(
760760
jactimes,
@@ -766,7 +766,7 @@ function DiffEqBase.__init(
766766
ARKStepSetJacTimes(mem, C_NULL, jtimes)
767767
end
768768

769-
if prob.f.mass_matrix != LinearAlgebra.I
769+
if prob.f.mass_matrix != LinearAlgebra.I && alg.stiffness !== Explicit()
770770
if MassLinearSolver in (:Dense, :LapackDense)
771771
nojacobian = false
772772
M = SUNDenseMatrix(length(u0), length(u0))
@@ -831,7 +831,7 @@ function DiffEqBase.__init(
831831
_MLS = nothing
832832
end
833833

834-
if DiffEqBase.has_jac(prob.f)
834+
if DiffEqBase.has_jac(prob.f) && alg.stiffness !== Explicit()
835835
function getfunjac(::T) where {T}
836836
@cfunction(
837837
cvodejac,
@@ -855,7 +855,7 @@ function DiffEqBase.__init(
855855
jac = nothing
856856
end
857857

858-
if alg.prec !== nothing
858+
if alg.prec !== nothing && alg.stiffness !== Explicit()
859859
function getpercfun(::T) where {T}
860860
@cfunction(
861861
precsolve,
@@ -1631,17 +1631,17 @@ function fill_destats!(integrator::ARKODEIntegrator)
16311631
ARKStepGetNumRhsEvals(mem, tmp, tmp2)
16321632
destats.nf = tmp[]
16331633
destats.nf2 = tmp2[]
1634-
ARKStepGetNumLinSolvSetups(mem, tmp)
1634+
integrator.alg.stiffness !== Explicit() && ARKStepGetNumLinSolvSetups(mem, tmp)
16351635
destats.nw = tmp[]
16361636
ARKStepGetNumErrTestFails(mem, tmp)
16371637
destats.nreject = tmp[]
16381638
ARKStepGetNumSteps(mem, tmp)
16391639
destats.naccept = tmp[] - destats.nreject
1640-
ARKStepGetNumNonlinSolvIters(mem, tmp)
1640+
integrator.alg.stiffness !== Explicit() && ARKStepGetNumNonlinSolvIters(mem, tmp)
16411641
destats.nnonliniter = tmp[]
1642-
ARKStepGetNumNonlinSolvConvFails(mem, tmp)
1642+
integrator.alg.stiffness !== Explicit() && ARKStepGetNumNonlinSolvConvFails(mem, tmp)
16431643
destats.nnonlinconvfail = tmp[]
1644-
if method_choice(integrator.alg) == :Newton
1644+
if integrator.alg.stiffness !== Explicit() && method_choice(integrator.alg) == :Newton
16451645
ARKStepGetNumJacEvals(mem, tmp)
16461646
destats.njacs = tmp[]
16471647
end

0 commit comments

Comments
 (0)