From 2ae30aec7caed52c70758a3d6ebcda9fb943e73c Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Wed, 29 Jul 2026 14:30:40 -0400 Subject: [PATCH] Initialize DISCO checkpoint from the time value Co-Authored-By: Chris Rackauckas --- lib/OrdinaryDiffEqCore/src/solve.jl | 2 +- test/Downstream/dynamicquantities_measurements.jl | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/OrdinaryDiffEqCore/src/solve.jl b/lib/OrdinaryDiffEqCore/src/solve.jl index b9fdf3e0f28..0de89bc5adc 100644 --- a/lib/OrdinaryDiffEqCore/src/solve.jl +++ b/lib/OrdinaryDiffEqCore/src/solve.jl @@ -760,7 +760,7 @@ Base.@constprop :aggressive function _ode_init( controller_cache = setup_controller_cache(_alg, cache, controller, EEstT, disco_probs) is_disco_step = false - disco_checkpoint = zero(tType) + disco_checkpoint = zero(t) # Seed the initial EEst on the controller cache (was previously # `integrator.EEst = oneunit(EEstT)`). set_EEst!(controller_cache, EEst) diff --git a/test/Downstream/dynamicquantities_measurements.jl b/test/Downstream/dynamicquantities_measurements.jl index 5e001423379..21c8d875340 100644 --- a/test/Downstream/dynamicquantities_measurements.jl +++ b/test/Downstream/dynamicquantities_measurements.jl @@ -10,7 +10,11 @@ using Test f(u, p, t) = u / (1u"s") prob = ODEProblem(f, u0, tspan) - sol = solve(prob, Tsit5(); abstol = 1.0e-9, reltol = 1.0e-9) + integrator = init(prob, Tsit5(); abstol = 1.0e-9, reltol = 1.0e-9) + @test integrator.disco_checkpoint == zero(first(tspan)) + @test typeof(integrator.disco_checkpoint) == typeof(first(tspan)) + + sol = solve!(integrator) @test sol.u[end] isa typeof(u0) @test eltype(sol.u) == typeof(u0)