Skip to content

Commit 795f2d1

Browse files
github-actions[bot]CompatHelper JuliaJoshuaLampertranocha
authored
CompatHelper: bump compat for FastBroadcast to 1, (keep existing compat) (#192)
* CompatHelper: bump compat for FastBroadcast to 1, (keep existing compat) * change regression tests for prod-dest vs. std. ODE to interpolated values * add tolerances to regression tests --------- Co-authored-by: CompatHelper Julia <compathelper_noreply@julialang.org> Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> Co-authored-by: Hendrik Ranocha <mail@ranocha.de> Co-authored-by: Joshua Lampert <joshua.lampert@uni-hamburg.de>
1 parent 3466e19 commit 795f2d1

2 files changed

Lines changed: 37 additions & 29 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
2424
JuMPExt = "JuMP"
2525

2626
[compat]
27-
FastBroadcast = "0.3.5"
27+
FastBroadcast = "0.3.5, 1"
2828
JuMP = "1.28"
2929
LinearAlgebra = "1"
3030
LinearSolve = "3.54"

test/runtests.jl

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -947,15 +947,18 @@ end
947947
probs = (prob_pds_linmod, prob_pds_nonlinmod, prob_pds_brusselator,
948948
prob_pds_sir, prob_pds_npzd)
949949
algs = (Euler(), ImplicitEuler(), Tsit5(), Rosenbrock23(), SDIRK2(), TRBDF2())
950-
@testset "$alg" for prob in probs, alg in algs
950+
abstol = 1e-5
951+
reltol = 1e-5
952+
@testset "$alg, $prob" for prob in probs, alg in algs
951953
dt = (last(prob.tspan) - first(prob.tspan)) / 1e4
952-
sol = solve(prob, alg; dt, isoutofdomain = isnegative) # use explicit f
954+
sol = solve(prob, alg; dt, abstol, reltol,
955+
isoutofdomain = isnegative) # use explicit f
953956
sol2 = solve(ConservativePDSProblem(prob.f.p, prob.u0, prob.tspan), alg; dt,
954-
isoutofdomain = isnegative) # use p and d to compute f
957+
abstol, reltol, isoutofdomain = isnegative) # use p and d to compute f
955958
sol3 = solve(ODEProblem(prob.f.std_rhs, prob.u0, prob.tspan), alg; dt,
956-
isoutofdomain = isnegative) # use f to create ODEProblem
957-
@test sol.t sol2.t sol3.t
958-
@test sol.u sol2.u sol3.u
959+
abstol, reltol, isoutofdomain = isnegative) # use f to create ODEProblem
960+
t = range(prob.tspan..., length = 10_000)
961+
@test sol.(t) sol2.(t) sol3.(t)
959962
end
960963

961964
# non-stiff conservative problems (in-place)
@@ -965,41 +968,44 @@ end
965968
Rosenbrock23(autodiff = AutoFiniteDiff()),
966969
SDIRK2(autodiff = AutoFiniteDiff()),
967970
TRBDF2(autodiff = AutoFiniteDiff()))
968-
@testset "$alg" for prob in probs, alg in algs
971+
@testset "$alg, $prob" for prob in probs, alg in algs
969972
dt = (last(prob.tspan) - first(prob.tspan)) / 1e4
970-
sol = solve(prob, alg; dt, isoutofdomain = isnegative) # use explicit f
973+
sol = solve(prob, alg; dt, abstol, reltol,
974+
isoutofdomain = isnegative) # use explicit f
971975
sol2 = solve(ConservativePDSProblem(prob.f.p, prob.u0, prob.tspan), alg; dt,
972-
isoutofdomain = isnegative) # use p and d to compute f
976+
abstol, reltol, isoutofdomain = isnegative) # use p and d to compute f
973977
sol3 = solve(ODEProblem(prob.f.std_rhs, prob.u0, prob.tspan), alg; dt,
974-
isoutofdomain = isnegative) # use f to create ODEProblem
975-
@test sol.t sol2.t sol3.t
976-
@test sol.u sol2.u sol3.u
978+
abstol, reltol, isoutofdomain = isnegative) # use f to create ODEProblem
979+
t = range(prob.tspan..., length = 10_000)
980+
@test sol.(t) sol2.(t) sol3.(t)
977981
end
978982

979983
# non-stiff non-conservative problems (out-of-place)
980984
probs = (prob_pds_minmapk,)
981985
algs = (Euler(), ImplicitEuler(), Tsit5(), Rosenbrock23(), SDIRK2(), TRBDF2())
982-
@testset "$alg" for prob in probs, alg in algs
986+
@testset "$alg, $prob" for prob in probs, alg in algs
983987
dt = (last(prob.tspan) - first(prob.tspan)) / 1e4
984-
sol = solve(prob, alg; dt, isoutofdomain = isnegative) # use explicit f
988+
sol = solve(prob, alg; dt, abstol, reltol, isoutofdomain = isnegative) # use explicit f
985989
sol2 = solve(PDSProblem(prob.f.p, prob.f.d, prob.u0, prob.tspan), alg; dt,
986-
isoutofdomain = isnegative) # use p and d to compute f
990+
abstol, reltol, isoutofdomain = isnegative) # use p and d to compute f
987991
sol3 = solve(ODEProblem(prob.f.std_rhs, prob.u0, prob.tspan), alg; dt,
988-
isoutofdomain = isnegative) # use f to create ODEProblem
989-
@test sol.t sol2.t sol3.t
990-
@test sol.u sol2.u sol3.u
992+
abstol, reltol, isoutofdomain = isnegative) # use f to create ODEProblem
993+
t = range(prob.tspan..., length = 10_000)
994+
@test sol.(t) sol2.(t) sol3.(t)
991995
end
992996

993997
# Robertson problem
994998
prob = prob_pds_robertson
995999
algs = (ImplicitEuler(), Rosenbrock23(), SDIRK2(), TRBDF2())
9961000
@testset "$alg" for alg in algs
9971001
dt = 1e-6
998-
sol = solve(prob, alg; dt) # use explicit f
999-
sol2 = solve(ConservativePDSProblem(prob.f.p, prob.u0, prob.tspan), alg; dt) # use p and d to compute f
1000-
sol3 = solve(ODEProblem(prob.f.std_rhs, prob.u0, prob.tspan), alg; dt) # use f to create ODEProblem
1001-
@test sol.t sol2.t sol3.t
1002-
@test sol.u sol2.u sol3.u
1002+
sol = solve(prob, alg; dt, abstol, reltol) # use explicit f
1003+
sol2 = solve(ConservativePDSProblem(prob.f.p, prob.u0, prob.tspan), alg; dt,
1004+
abstol, reltol) # use p and d to compute f
1005+
sol3 = solve(ODEProblem(prob.f.std_rhs, prob.u0, prob.tspan), alg; dt,
1006+
abstol, reltol) # use f to create ODEProblem
1007+
t = range(prob.tspan..., length = 10_000)
1008+
@test sol.(t) sol2.(t) sol3.(t)
10031009
end
10041010

10051011
# Bertolazzi problem
@@ -1021,11 +1027,13 @@ end
10211027
algs = (ImplicitEuler(), Rosenbrock23(), TRBDF2())
10221028
@testset "$alg" for alg in algs
10231029
dt = 1.0
1024-
sol = solve(prob, alg; dt) # use explicit f
1025-
sol2 = solve(PDSProblem(prob.f.p, prob.f.d, prob.u0, prob.tspan), alg; dt) # use p and d to compute f
1026-
sol3 = solve(ODEProblem(prob.f.std_rhs, prob.u0, prob.tspan), alg; dt) # use f to create ODEProblem
1027-
@test sol.t sol2.t sol3.t
1028-
@test sol.u sol2.u sol3.u
1030+
sol = solve(prob, alg; dt, abstol, reltol) # use explicit f
1031+
sol2 = solve(PDSProblem(prob.f.p, prob.f.d, prob.u0, prob.tspan), alg; dt,
1032+
abstol, reltol) # use p and d to compute f
1033+
sol3 = solve(ODEProblem(prob.f.std_rhs, prob.u0, prob.tspan), alg; dt,
1034+
abstol, reltol) # use f to create ODEProblem
1035+
t = range(prob.tspan..., length = 10_000)
1036+
@test sol.(t) sol2.(t) sol3.(t)
10291037
end
10301038
end
10311039
end

0 commit comments

Comments
 (0)