Skip to content

Commit 4d170a4

Browse files
Scale error estimate by dt²/2 for second-order ODEs
The probabilistic error estimate is the standard deviation of the predicted constraint residual. For second-order ODEs the constraint operates on u'', so converting to a local error in u requires scaling by dt²/2 (Taylor series), not just dt as for first-order ODEs. This aligns with the approach in pnkraemer/probdiffeq#852 and significantly improves step size selection for second-order problems like Pleiades.
1 parent d31e9d5 commit 4d170a4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/perform_step.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,11 @@ function compute_scaled_error_estimate!(integ, cache)
188188
@unpack err_tmp = cache
189189
t = integ.t + integ.dt
190190
err_est_unscaled = estimate_errors!(cache)
191-
err_est_unscaled .*= integ.dt
191+
if integ.f isa DynamicalODEFunction # second-order ODE
192+
err_est_unscaled .*= integ.dt^2 / 2
193+
else
194+
err_est_unscaled .*= integ.dt
195+
end
192196
if integ.f isa DynamicalODEFunction # second-order ODE
193197
DiffEqBase.calculate_residuals!(
194198
err_tmp,

0 commit comments

Comments
 (0)