SciML / DiffEqCallbacks.jl

A library of useful callbacks for hybrid scientific machine learning (SciML) with augmented differential equation solvers
https://docs.sciml.ai/DiffEqCallbacks/stable/
Other
85 stars 44 forks source link

Fail with grace with the ILS after initialization failure #200

Closed oxinabox closed 5 months ago

oxinabox commented 5 months ago

Checklist

Additional context

Without this change the test fails with

ERROR: ArgumentError: `length(ts)` must equal `size(time_mask, 2)`
Stacktrace:
  [1] finish!(ils::IndependentlyLinearizedSolution{Float64, Float64})
    @ DiffEqCallbacks ~/JuliaEnvs/CedarEDA.jl/dev/DiffEqCallbacks/src/independentlylinearizedutils.jl:227
  [2] #64
    @ ~/JuliaEnvs/CedarEDA.jl/dev/DiffEqCallbacks/src/saving.jl:438 [inlined]
  [3] finalize!
    @ ~/.julia/packages/DiffEqBase/UoaYd/src/callbacks.jl:38 [inlined]
  [4] finalize!
    @ ~/.julia/packages/DiffEqBase/UoaYd/src/callbacks.jl:28 [inlined]
  [5] _postamble!(integrator::OrdinaryDiffEq.ODEIntegrator{…})
    @ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/pWCEq/src/integrators/integrator_utils.jl:152
  [6] postamble!
    @ ~/.julia/packages/OrdinaryDiffEq/pWCEq/src/integrators/integrator_utils.jl:149 [inlined]
  [7] check_error!
    @ ~/.julia/packages/SciMLBase/QSc1r/src/integrator_interface.jl:630 [inlined]
  [8] solve!(integrator::OrdinaryDiffEq.ODEIntegrator{…})
    @ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/pWCEq/src/solve.jl:535
  [9] #__solve#749
    @ ~/.julia/packages/OrdinaryDiffEq/pWCEq/src/solve.jl:6 [inlined]
 [10] __solve
    @ ~/.julia/packages/OrdinaryDiffEq/pWCEq/src/solve.jl:1 [inlined]
 [11] solve_call(_prob::DAEProblem{…}, args::DFBDF{…}; merge_callbacks::Bool, kwargshandle::Nothing, kwargs::@Kwargs{…})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/UoaYd/src/solve.jl:609
 [12] solve_up(prob::DAEProblem{…}, sensealg::Nothing, u0::Vector{…}, p::SciMLBase.NullParameters, args::DFBDF{…}; kwargs::@Kwargs{…})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/UoaYd/src/solve.jl:1058
 [13] solve(prob::DAEProblem{…}, args::DFBDF{…}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{…})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/UoaYd/src/solve.jl:981
 [14] top-level scope
    @ REPL[44]:1
Some type information was truncated. Use `show(err)` to see complete types.

On Slack @ChrisRackauckas said that the callback's finish shouldn't even be being called in this circumstance. but idk if i described the circumstance right. It seems a intentional feature of check_errors! that it does this

ChrisRackauckas commented 5 months ago

Alas, CI does not.

staticfloat commented 5 months ago

I think https://github.com/oxinabox/DiffEqCallbacks.jl/pull/1 will fix those errors. :P