From 8ceffc79a44441df596a414b6fba22342b1aea34 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Mon, 7 Oct 2024 22:44:53 +0200 Subject: [PATCH] Update regression and HWS tests --- core/integration_test/hws_integration_test.jl | 4 ++-- core/regression_test/regression_test.jl | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/integration_test/hws_integration_test.jl b/core/integration_test/hws_integration_test.jl index 36c482247..2d6d4030f 100644 --- a/core/integration_test/hws_integration_test.jl +++ b/core/integration_test/hws_integration_test.jl @@ -22,8 +22,8 @@ timed = @timed Ribasim.run(toml_path) - # current benchmark is 600s - benchmark_runtime = 600 + # current benchmark in seconds + benchmark_runtime = 12 performance_diff = round((timed.time - benchmark_runtime) / benchmark_runtime * 100; digits = 2) if performance_diff < 0.0 diff --git a/core/regression_test/regression_test.jl b/core/regression_test/regression_test.jl index c4095bb4d..6172a5f1e 100644 --- a/core/regression_test/regression_test.jl +++ b/core/regression_test/regression_test.jl @@ -8,7 +8,7 @@ config = Ribasim.Config(toml_path) solver_list = - ["QNDF", "Rosenbrock23", "TRBDF2", "Rodas5", "KenCarp4", "Tsit5", "ImplicitEuler"] + ["QNDF", "Rosenbrock23", "TRBDF2", "Rodas5P", "KenCarp4", "Tsit5", "ImplicitEuler"] sparse_on = [true, false] autodiff_on = [true, false] @@ -38,13 +38,13 @@ # subgrid = Arrow.Table(subgrid_bytes) @testset "Results values" begin - @test basin.storage[1] ≈ 1.0 - @test basin.level[1] ≈ 0.044711584 - @test basin.storage[end] ≈ 16.530443267 + @test basin.storage[1] ≈ 1.0f0 + @test basin.level[1] ≈ 0.044711584f0 + @test basin.storage[end] ≈ 16.530443267f0 @test basin.level[end] ≈ 0.181817438 - @test flow.flow_rate[1] == basin.outflow_rate[1] + @test flow.flow_rate[1] ≈ basin.outflow_rate[1] @test all(q -> abs(q) < 1e-7, basin.balance_error) - @test all(q -> abs(q) < 0.01, basin.relative_error) + @test all(err -> abs(err) < 0.01, basin.relative_error) end end end @@ -105,7 +105,7 @@ end @test all(q -> abs(q) < 1.0, basin.storage - basin_bench.storage) @test all(q -> abs(q) < 0.5, basin.level - basin_bench.level) @test all(q -> abs(q) < 1e-3, basin.balance_error) - @test all(q -> abs(q) < 2.5, basin.relative_error) + @test all(err -> abs(err) < 2.5, basin.relative_error) end end end @@ -127,7 +127,7 @@ end flow_bench = Arrow.Table(flow_bytes_bench) basin_bench = Arrow.Table(basin_bytes_bench) - # TODO "Rosenbrock23" and "Rodas5" solver are resulting unsolvable gradients + # TODO "Rosenbrock23" and "Rodas5P" solver are resulting unsolvable gradients solver_list = ["QNDF"] sparse_on = [true, false] autodiff_on = [true, false] @@ -167,7 +167,7 @@ end @test basin.node_id == basin_bench.node_id @test all(q -> abs(q) < 100.0, basin.storage - basin_bench.storage) @test all(q -> abs(q) < 0.5, basin.level - basin_bench.level) - @test all(q -> abs(q) < 1e-3, basin.balance_error) + @test all(err -> abs(err) < 1e-3, basin.balance_error) end end end