From 536aff61ff6996149f7c3a9163717d6b1fe05122 Mon Sep 17 00:00:00 2001 From: Herman Sletmoen Date: Thu, 18 Jul 2024 14:26:49 +0200 Subject: [PATCH] Show all unknowns missing guesses; not only the first --- src/systems/diffeqs/abstractodesystem.jl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/systems/diffeqs/abstractodesystem.jl b/src/systems/diffeqs/abstractodesystem.jl index 001c7b82a7..8d6817a3d4 100644 --- a/src/systems/diffeqs/abstractodesystem.jl +++ b/src/systems/diffeqs/abstractodesystem.jl @@ -1567,11 +1567,9 @@ function InitializationProblem{iip, specialize}(sys::AbstractODESystem, defs = defaults(isys) # Check that all unknowns have guesses - # TODO: which, if any, unknowns should be excluded from this guess? - for x in unknowns(isys) - x in keys(guesses) || x in keys(defs) || - throw(ArgumentError("Missing guess for $x.")) - end + unknowns_missing = setdiff(unknowns(isys), [keys(guesses), keys(defs)]) + !isempty(unknowns_missing) && + throw(ArgumentError("Missing guesses for unknowns $(join(unknowns_missing, ", ")).")) u0map = merge(guesses, u0map) if neqs == nunknown