@@ -55,21 +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
63
" DAE initialization failed: your u0 did not satisfy the initialization requirements,
63
- normresid = $(e. normresid) > abstol = $(e. abstol) . If you wish for the system to
64
- automatically change the algebraic variables to satisfy the algebraic constraints,
65
- please pass `initializealg = BrownBasicInit()` to solve (this option will require
66
- `using OrdinaryDiffEqNonlinearSolve`). If you wish to perform an initialization on the
67
- complete u0, please pass initializealg = ShampineCollocationInit() to solve. Note that
68
- initialization can be a very difficult process for DAEs and in many cases can be
69
- numerically intractable without symbolic manipulation of the system. For an automated
70
- system that will generate numerically stable initializations, see ModelingToolkit.jl
71
- structural simplification for more details."
64
+ normresid = $(e. normresid) > abstol = $(e. abstol) ."
72
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
73
79
end
74
80
75
81
struct OverrideInitMissingAlgorithm <: Exception end
@@ -144,7 +150,7 @@ function get_initial_values(
144
150
normresid = isdefined (integrator. opts, :internalnorm ) ?
145
151
integrator. opts. internalnorm (tmp, t) : norm (tmp)
146
152
if normresid > abstol
147
- throw (CheckInitFailureError (normresid, abstol))
153
+ throw (CheckInitFailureError (normresid, abstol, true ))
148
154
end
149
155
return u0, p, true
150
156
end
@@ -161,7 +167,7 @@ function get_initial_values(
161
167
integrator. opts. internalnorm (resid, t) : norm (resid)
162
168
163
169
if normresid > abstol
164
- throw (CheckInitFailureError (normresid, abstol))
170
+ throw (CheckInitFailureError (normresid, abstol, false ))
165
171
end
166
172
return u0, p, true
167
173
end
0 commit comments