Skip to content

Commit

Permalink
Default to finite difference calculation of the Jacobian
Browse files Browse the repository at this point in the history
Fixes #1832
  • Loading branch information
visr committed Sep 23, 2024
1 parent cae6838 commit 1249784
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/src/config.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const nodetypes = collect(keys(nodekinds))
water_balance_reltol::Float64 = 1e-2
maxiters::Int = 1e9
sparse::Bool = true
autodiff::Bool = true
autodiff::Bool = false
end

# Separate struct, as basin clashes with nodetype
Expand Down
4 changes: 2 additions & 2 deletions core/test/config_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@testset "docs" begin
config = Ribasim.Config(normpath(@__DIR__, "docs.toml"))
@test config isa Ribasim.Config
@test config.solver.autodiff
@test !config.solver.autodiff
end
end

Expand Down Expand Up @@ -60,7 +60,7 @@ end
AutoForwardDiff()
@test alg_autodiff(algorithm(Solver(; algorithm = "QNDF", autodiff = false))) ==
AutoFiniteDiff()
@test alg_autodiff(algorithm(Solver(; algorithm = "QNDF"))) == AutoForwardDiff()
@test alg_autodiff(algorithm(Solver(; algorithm = "QNDF"))) == AutoFiniteDiff()
# autodiff is not a kwargs for explicit algorithms, but we use try-catch to bypass
algorithm(Solver(; algorithm = "Euler", autodiff = true))

Expand Down
2 changes: 1 addition & 1 deletion core/test/docs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ water_balance_abstol = 1e-6 # optional, default 1e-6
water_balance_reltol = 1e-6 # optional, default 1e-6
maxiters = 1e9 # optional, default 1e9
sparse = true # optional, default true
autodiff = true # optional, default true
autodiff = false # optional, default false

[logging]
# defines the logging level of Ribasim
Expand Down
2 changes: 1 addition & 1 deletion python/ribasim/ribasim/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Solver(ChildModel):
reltol: float = 1e-05
maxiters: int = 1000000000
sparse: bool = True
autodiff: bool = True
autodiff: bool = False


class Verbosity(str, Enum):
Expand Down

0 comments on commit 1249784

Please sign in to comment.