@@ -55,11 +55,27 @@ function get_initial_values end
55
55
struct CheckInitFailureError <: Exception
56
56
normresid:: Any
57
57
abstol:: Any
58
+ isdae:: Bool
58
59
end
59
60
60
61
function Base. showerror (io:: IO , e:: CheckInitFailureError )
61
62
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
63
79
end
64
80
65
81
struct OverrideInitMissingAlgorithm <: Exception end
@@ -134,7 +150,7 @@ function get_initial_values(
134
150
normresid = isdefined (integrator. opts, :internalnorm ) ?
135
151
integrator. opts. internalnorm (tmp, t) : norm (tmp)
136
152
if normresid > abstol
137
- throw (CheckInitFailureError (normresid, abstol))
153
+ throw (CheckInitFailureError (normresid, abstol, true ))
138
154
end
139
155
return u0, p, true
140
156
end
@@ -151,7 +167,7 @@ function get_initial_values(
151
167
integrator. opts. internalnorm (resid, t) : norm (resid)
152
168
153
169
if normresid > abstol
154
- throw (CheckInitFailureError (normresid, abstol))
170
+ throw (CheckInitFailureError (normresid, abstol, false ))
155
171
end
156
172
return u0, p, true
157
173
end
0 commit comments