From 1249784175c45432c8d17896b1bc27e271109449 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Mon, 23 Sep 2024 11:00:10 +0200 Subject: [PATCH] Default to finite difference calculation of the Jacobian Fixes #1832 --- core/src/config.jl | 2 +- core/test/config_test.jl | 4 ++-- core/test/docs.toml | 2 +- python/ribasim/ribasim/config.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/config.jl b/core/src/config.jl index 95e4d8c52..1aa849892 100644 --- a/core/src/config.jl +++ b/core/src/config.jl @@ -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 diff --git a/core/test/config_test.jl b/core/test/config_test.jl index 07021234e..8f9cb3e8f 100644 --- a/core/test/config_test.jl +++ b/core/test/config_test.jl @@ -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 @@ -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)) diff --git a/core/test/docs.toml b/core/test/docs.toml index 1ab1721d3..a327f01f5 100644 --- a/core/test/docs.toml +++ b/core/test/docs.toml @@ -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 diff --git a/python/ribasim/ribasim/config.py b/python/ribasim/ribasim/config.py index 9e9a7d18d..bc3d7ad5b 100644 --- a/python/ribasim/ribasim/config.py +++ b/python/ribasim/ribasim/config.py @@ -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):