@@ -55,11 +55,27 @@ function get_initial_values end
5555struct CheckInitFailureError <: Exception
5656 normresid:: Any
5757 abstol:: Any
58+ isdae:: Bool
5859end
5960
6061function Base. showerror (io:: IO , e:: CheckInitFailureError )
6162 print (io,
62- " CheckInit specified but initialization not satisfied. normresid = $(e. normresid) > abstol = $(e. abstol) " )
63+ " DAE initialization failed: your u0 did not satisfy the initialization requirements,
64+ normresid = $(e. normresid) > abstol = $(e. abstol) ."
65+ )
66+
67+ if isdae
68+ print (io, " If you wish for the system to
69+ automatically change the algebraic variables to satisfy the algebraic constraints,
70+ please pass `initializealg = BrownBasicInit()` to solve (this option will require
71+ `using OrdinaryDiffEqNonlinearSolve`). If you wish to perform an initialization on the
72+ complete u0, please pass initializealg = ShampineCollocationInit() to solve. Note that
73+ initialization can be a very difficult process for DAEs and in many cases can be
74+ numerically intractable without symbolic manipulation of the system. For an automated
75+ system that will generate numerically stable initializations, see ModelingToolkit.jl
76+ structural simplification for more details."
77+ )
78+ end
6379end
6480
6581struct OverrideInitMissingAlgorithm <: Exception end
@@ -134,7 +150,7 @@ function get_initial_values(
134150 normresid = isdefined (integrator. opts, :internalnorm ) ?
135151 integrator. opts. internalnorm (tmp, t) : norm (tmp)
136152 if normresid > abstol
137- throw (CheckInitFailureError (normresid, abstol))
153+ throw (CheckInitFailureError (normresid, abstol, true ))
138154 end
139155 return u0, p, true
140156end
@@ -151,7 +167,7 @@ function get_initial_values(
151167 integrator. opts. internalnorm (resid, t) : norm (resid)
152168
153169 if normresid > abstol
154- throw (CheckInitFailureError (normresid, abstol))
170+ throw (CheckInitFailureError (normresid, abstol, false ))
155171 end
156172 return u0, p, true
157173end
0 commit comments