I’m inquiring about the error estimation approach used for solving Differential Algebraic Equations (DAEs) in Julia.
The current approach considers all variables (state and algebraic) in the estimation of local error. However, this seems to impose (unnecessary) smoothness restrictions on algebraic variables.
For example, when solving DAEs with discontinuities without re-initialization, the solver reports instability at the first step following the discontinuity. This instability arises from inconsistent initial conditions, which causes large jumps in some variables. I observed that relaxing the tolerance for algebraic variables allowed the solver to proceed (see MWE).
My questions are:
- Why are algebraic variables involved in local error estimation during numerical integration of DAEs? Since numerical method isn’t directly applied to algebraic equations, why are their solutions used in estimating Local Truncation Error (LTE).
- Given that algebraic variables are solved exactly, what are the implications of disabling error checking for these variables on the global error?
MWE:
using OrdinaryDiffEq
function fx!(du,u,p,t)
x,y,z = u
du[1] = y
du[2] = -x
du[3] = x^2 + y^2 - z^2 -1
end
# inconsistent initial condition
u0 = [2,0,1]
# inconsistent initial conditions but close to consistent initial condition
# u0 = [2, 0, 1.7]
# this is consistent initial condition
# u0 = y1 = [1.999999995, -9.999999975e-5, 1.7320508046821261]
p = ()
M = zeros(3,3)
M[1,1] = M[2,2] = 1
dt = 50e-6
t_span = (0,1)
prob0 = ODEFunction(fx!, mass_matrix = M)
prob = ODEProblem(prob0, u0,t_span, p)
#define tolerance
tol = [1e-7, 1e-7, 1]
# solve with uniform reltol for all variables (this fails)
sol_1 = solve(prob, Rodas3(), adaptive = true, reltol = 1e-7, initializealg = NoInit())
# solve with relaxed tolerance for algebraic variables (this works)
sol_2 = solve(prob, Rodas3(), adaptive = true, reltol = tol, initializealg = NoInit())
Thank you!