Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to finite difference calculation of the Jacobian #1835

Merged
merged 5 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading