1 Introduction

This paper deals with differential algebraic equations (DAEs) with a discontinuity surface, where, during the numerical integration of the equation, it is required the accurate computation of the event point corresponding to reaching the discontinuity surface. Several real systems may be modeled by DAEs of this type, see for instance the applications in Chemical Engineering and Electrical Systems [1, 3, 21, 23]. In recent years, a growing interest has been observed concerning the theoretical aspects (see for example [10, 19, 20]), together with the numerical questions that arise in such DAEs (see for example [10, 15, 16, 19, 20, 22]). DAEs with a discontinuity surface are called in several way: non-smooth DAEs, hybrid DAEs, discontinuous DAEs, DAEs of Filippov type. Here, we use the term Discontinuous DAEs (DDAEs).

In the following, we consider a DAE of the form:

$$\begin{aligned} \left\{ \begin{array}{l} y^{\prime }\left( t\right) =f\left( y\left( t\right) ,z\left( t\right) \right) ,\ t\ge t_0, \\ g\left( y\left( t\right) ,z\left( t\right) \right) =0,\ t\ge t_0, \\ \left( y(t_0),z(t_0)\right) =\left( y_0,z_0\right) , \end{array} \right. \end{aligned}$$
(1)

where \(y\left( t\right) \in \mathbb {R} ^{d_{1}}\), \(z\left( t\right) \in \mathbb {R}^{d_{2}}\) and \(f:\mathbb {R}^{d_{1}}\times \mathbb {R }^{d_{2}}\rightarrow \mathbb {R}^{d_{1}}\) and \(g:\mathbb {R}^{d_{1}}\times \mathbb {R }^{d_{2}}\rightarrow \mathbb {R}^{d_{2}}\) are sufficiently smooth functions. The initial value \((y_{0}, z_0) \in \mathbb {R}^{d_{1}}\times \mathbb {R}^{d_{2}}\) is assumed to be consistent, i.e. \(g(y_{0},z_{0})=0\).

Moreover, we consider the state space \(\mathbb {R} ^{d_{1}}\times \mathbb {R}^{d_{2}}\) as partitioned in the three subsets:

$$\begin{aligned}{} & {} S^-=\{(y,z) \in \mathbb {R}^{d_{1}}\times \mathbb {R}^{d_{2}}: h(y,z)<0 \} \\{} & {} \Sigma =\{ (y,z) \in \mathbb {R}^{d_{1}}\times \mathbb {R}^{d_{2}}: h(y,z)=0\} \\{} & {} S^+=\{ (y,z) \in \mathbb {R}^{d_{1}}\times \mathbb {R}^{d_{2}}: h(y,z)>0 \}. \end{aligned}$$

where \(h:\mathbb {R}^{d_{1}}\times \mathbb {R}^{d_{2}}\rightarrow \mathbb {R}\) is a sufficiently smooth function. The DAE (1) is assumed to hold in \(S^-\cup \Sigma \) and the initial value \((y_{0}, z_0)\) is assumed to belong to \(S^-\), while, in general, in \(S^+\cup \Sigma \) a different DAE is assigned. So, the DAE (1) is a DDAE with discontinuity surface \(\Sigma \).

We suppose that the DAE (1) has a unique solution (yz) and this solution meets the discontinuity surface \(\Sigma \) at a certain time \(t^*>0\): we have \((y(t),z(t))\in S^{-}\) for \( t\in [t_0,t^*)\) and \((y(t^*),z(t^*))\in \Sigma \), i.e.

$$\begin{aligned} h\left( y\left( t^*\right) ,z\left( t^*\right) \right) =0. \end{aligned}$$

The time \(t^*\) is called the event time and the state \((y( t^*),z(t^*)) \) is called the event point. The event location is the determination of the event time \(t^*\) and the event point \((y( t^*),z(t^*))\).

The accurate evaluation of the event point is an important task in the integration of DDAEs, because, once evaluated the event point \((y(t^*),z(t^*)) \), one may decided what to do next. In general, after the event point, the solution can cross or slide on the discontinuity surface (see for istance [7]). In [18], it is studied how to compute the event time and the event point by means of the standard numerical methods for DAEs. In this paper, we compute the event time and the event point by means of a time reparametrization producing a new DAE where the event time is known a priori.

It is important for the event location to use numerical methods satisfying the following three properties:

  1. (a)

    the numerical event point \((y_{\tau }( t^*),z_{\tau }(t^*))\) lies on the discontinuity surface, i.e. \(h(y_{\tau }( t^*),z_{\tau }(t^*))=0\);

  2. (b)

    the numerical event point \((y_{\tau }( t^*),z_{\tau }(t^*))\) is consistent, i.e. \(g(y_{\tau }( t^*),z_{\tau }(t^*))\) \(=0\);

  3. (c)

    the numerical method is one-side, i.e. up to reaching the discontinuity surface the method uses values of f and g only at points of \(S^-\cup \Sigma \).

By using suitable numerical methods in the integration of the new DAE obtained by the time reparametrization, all the properties (a), (b) and (c) above can be satisfied. On the other hand, this cannot be achieved by standard numerical methods for DAEs.

Moreover, regarding the property (c), it is important that an one-side method can reach the discontinuity surface in an arbitrary number of steps fixed a priori, without needing to reduce the stepsize as one approaches the discontinuity surface. This is obtained in the numerical integration of the new DAE.

It is worthwhile to remark that the time reparametrization technique works also for DAEs of index higher than one.

The plan of the present paper is as follows. We start by recalling the standard numerical methods for DAEs and we show how to determine the event time and the event point by these methods. Then, we discuss one-side numerical methods and show the difficulties that the standard numerical methods encounter in satisfying the one-side property. After this, we describe the time reparametrization technique and then the related numerical methods fulfilling the properties (a), (b) and (c) above. Finally, some numerical tests conclude our paper.

2 Background on Standard Numerical Methods and Event Location for DAEs

In this section, we recall the standard numerical methods used for integrating DAEs, namely semi-implicit methods, implicit RK methods and Rosenbrock methods (for reference see [11, 12]). Moreover, we show how the event location is implemented for these methods (for reference see [18]).

The methods are applied over a mesh

$$\begin{aligned} t_0<t_1<t_2<\cdots \end{aligned}$$

of stepsizes

$$\begin{aligned} \tau _{n+1}=t_{n+1}-t_n,\ n=0,1,2,\ldots \end{aligned}$$

In the following, \(y_n\) and \(z_n\) denote the numerical approximations of the differential and algebraic variables y and z, respectively, at the mesh point \(t_n\).

During the numerical event location, the numerical integration continues up to mesh points \(t_{n^*}\) and \(t_{n^*+1}\) such that

$$\begin{aligned} h(y_{n^*},z_{n^*})<0\text { and }h(y_{n^*+1},z_{n^*+1})>0. \end{aligned}$$

After the individuation of such mesh points, the numerical event location determines the numerical event time \(t_{\tau }^{*} \) and numerical event point \((y_{\tau }^{*},z_{\tau }^{*})\).

2.1 Semi-implicit Methods

By using the usual notations for RK methods, a semi-implicit method is defined by the scheme

$$\begin{aligned}{} & {} y_{n+1}=y_n+\tau _{n+1}\sum _{i=1}^\nu b_if(y_{ni},z_{ni}) \end{aligned}$$
(2)
$$\begin{aligned}{} & {} g(y_{n+1},z_{n+1})=0, \end{aligned}$$
(3)

where the stage values \((y_{ni},z_{ni})\), \(i=1,\ldots ,\nu \), are successively obtained by

$$\begin{aligned}{} & {} y_{ni}=y_n+\tau _{n+1} \sum \limits _{j=1}^{i-1} a_ {ij} f(y_{nj},z_{nj}) \end{aligned}$$
(4)
$$\begin{aligned}{} & {} g(y_{ni},z_{ni})=0. \end{aligned}$$
(5)

Here, \(b_i\) and \(a_{ij}\) are weights and coefficients, respectively, of a \(\nu \)-stage explicit RK method. Observe that the implicitness of this scheme consists in solving at each step the \(\nu +1\) non-linear equations (3)-(5) of dimension \(d_2\). By construction (see (3)), the numerical solution \((y_n,z_n)\) is consistent, i.e.

$$\begin{aligned} g(y_n,z_n)=0,\ n=0,1,2,\ldots \end{aligned}$$

The numerical event time \(t_{\tau }^{*} \) and event point \((y_{\tau }^{*},z_{\tau }^{*})\) are obtained by solving the nonlinear system in the unknowns \(t_{\tau }^{*}\) and \(z_{\tau }^{*}\):

$$\begin{aligned} \left\{ \begin{array}{l} g(y_{\tau }^{*},z_{\tau }^{*})=0\\ h(y_{\tau }^{*},z_{\tau }^{*})=0, \end{array} \right. \end{aligned}$$
(6)

where

$$\begin{aligned} y_{\tau }^{*}=\eta (t_{\tau }^{*})=y_{n^{*}}+\tau _{n^*+1} \sum _{i=1}^{\nu }b_{i}\left( \frac{t_{\tau }^{*}-t_{n^{*}}}{\tau _{n^*+1} } \right) f(y_{n^{*}i},z_{n^{*}i}), \end{aligned}$$

with

$$\begin{aligned} \eta (t_n+\theta \tau _{n+1})=y_n+\tau _{n+1}\sum _{i=1}^\nu b_i(\theta )f(y_{ni},z_{ni}),\ \theta \in [0,1], \end{aligned}$$

a continuous extension of the explicit RK method. By construction (see (6)), the numerical event point \((y_{\tau }^{*},z_{\tau }^{*})\) lies on the discontinuity surface (point a) in the introduction) and it is consistent (point b) in the introduction). The numerical event location requires the solution of the non-linear system (6) of dimension \(d_2+1\). The computational cost of solving such a system is a fraction of the computational cost of a step of the semi-implicit method, where \(\nu +1\) systems of dimension \(d_{2}\) need to be solved.

2.2 Implicit RK Methods

Implicit RK methods are given by

$$\begin{aligned}{} & {} y_{n+1}=y_n+\tau _{n+1}\sum _{i=1}^\nu b_if(y_{ni},z_{ni}) \nonumber \\{} & {} z_{n+1}=\left( 1- \sum _{i,j=1}^\nu b_i \omega _ {ij}\right) z_n+ \sum _{i,j=1}^\nu b_i \omega _ {ij} z_{nj}, \end{aligned}$$
(7)

where the stage values \((y_{ni},z_{ni})\), \(i=1,\ldots ,\nu \), are obtained by solving the non-linear system of equations

$$\begin{aligned}{} & {} y_{ni}=y_n+\tau _{n+1}\sum _ {j=1}^ {\nu } a_ {ij} f(y_{nj},z_{nj}),\ i=1,\ldots ,\nu , \nonumber \\{} & {} g(y_{ni},z_{ni})=0,\ i=1,\ldots ,\nu . \end{aligned}$$
(8)

Here, \(b_i\) and \(a_{ij}\) are weights and coefficients, respectively, of a \(\nu \)-stage implicit RK method and \(\omega _{ij}\) are the entries of the inverse of the RK matrix \(\left( a_{ij}\right) \). At each step of this implicit scheme, the non-linear system (8) of dimension \(\nu (d_1+d_2)\) has to be solved. If the implicit RK method is stiffly accurate, i.e.

$$\begin{aligned} a_{\nu i}=b_i,\ i=1,\ldots ,\nu , \end{aligned}$$
(9)

then the numerical solution \((y_n,z_n)\) is consistent, since \((y_{n\nu },z_{n\nu })=(y_{n+1},z_{n+1})\) holds.

The numerical event time \(t_{\tau }^*\) and event point \((y_{\tau }^{*},z_{\tau }^{*})\) are obtained by

$$\begin{aligned}{} & {} t_{\tau }^*=t_{n^*}+\tau ^*\nonumber \\{} & {} y_{\tau }^{*}=y_{n^{*}}+\tau ^{*}\sum _{i=1}^{\nu }b_{i}f(y_{i}^{*},z_{i}^{*}) \nonumber \\{} & {} z_{\tau }^{*}=\left( 1-\sum _{i,j=1}^{\nu }b_{i}\omega _{ij}\right) z_{n^{*}}+\sum _{i,j=1}^{\nu }b_{i}\omega _{ij}z_{j}^{*}, \end{aligned}$$
(10)

where the stepsize \(\tau ^*\) and the stage values \((y_{i}^{*},z_{i}^{*})\), \(i=1,\ldots ,\nu \), satisfy

$$\begin{aligned}{} & {} y_{i}^{*}=y_{n^{*}}+\tau ^{*}\sum _{j=1}^{\nu }a_{ij}f(y_{j}^{*},z_{j}^{*}),\ i=1,\ldots ,\nu , \nonumber \\{} & {} g(y_{i}^{*},z_{i}^{*})=0,\ i=1,\ldots ,\nu , \nonumber \\{} & {} h(y_{\tau }^{*},z_{\tau }^{*})=0. \end{aligned}$$
(11)

As in case of semi-implicit methods, the numerical event point \((y_{\tau }^{*},z_{\tau }^{*})\) lies on the discontinuity surface (point a) in the introduction). Moreover, if the implicit RK method is stiffly accurate, then the numerical event point is consistent (point b) in the introduction). The numerical event location requires to solve the non-linear system (11) of dimension \( \nu (d_{1}+d_{2})+1\). So, the computational cost of solving such a non-linear system is essentially the same as the computational cost of a step of the implicit RK method, where a system of dimension \(\nu (d_{1}+d_2)\) needs to be solved.

2.3 Rosenbrock Methods

Rosenbrock methods read

$$\begin{aligned}{} & {} y_{n+1}=y_{n}+\sum _{i=1}^{\nu }b_{i}l_{ni} \nonumber \\{} & {} z_{n+1}=z_{n}+\sum _{i=1}^{\nu }b_{i}k_{ni}, \end{aligned}$$
(12)

where \((l_{ni},k_{ni})\), \(i=1,\ldots ,\nu \), are successively obtained by solving the linear system

$$\begin{aligned}{} & {} \left[ \begin{array}{l} I-\tau _{n+1}\gamma _{ii} f^n_y\ \ -\tau _{n+1}\gamma _{ii} f^n_z \\ \\ -\tau _{n+1}\gamma _{ii} g^n_y \ \ \ \ \ -\tau _{n+1}\gamma _{ii} g^n_z \end{array} \right] \left[ \begin{array}{l} l_{ni} \nonumber \\ \\ k_{ni} \end{array} \right] \\{} & {} =\left[ \begin{array}{l} \tau _{n+1} f(y_{ni},z_{ni})+\tau _{n+1} \sum \limits _ {j=1}^ {i-1} \gamma _{ij} \left( f_y^n l_ {nj}+f^n_z k_ {nj} \right) \\ \\ \tau _{n+1} g(y_{ni},z_{ni})+\tau _{n+1}\sum \limits _ {j=1}^ {i-1} \gamma _{ij} \left( g_y^n l_ {nj} +g^n_z k_ {nj} \right) \end{array} \right] \end{aligned}$$
(13)

with \((y_{ni},z_{ni})\), \(i=1,\ldots ,\nu \), on the right-hand side successively and explicitly given by

$$\begin{aligned}{} & {} y_{ni}=y_{n}+\sum _{j=1}^{i-1}a_{ij}l_{nj}\nonumber \\{} & {} z_{ni}=z_{n}+\sum _{j=1}^{i-1}a_{ij}k_{nj}. \end{aligned}$$
(14)

Here, \(b_i\), \(a_{ij}\) and \(\gamma _{ij}\) are weights and coefficients of a \(\nu \)-stage Rosenbrock method and \(f^n_y\), \(f^n_z\), \(g^n_y\) and \(g^n_z\) denote the jacobian matrices of f and g at \((y_n,z_n)\). The implicitness of this method consists in solving at each step \(\nu \) linear systems of dimension \(d_1+d_2\). In general, the numerical solution \((y_n,z_n)\) is not consistent.

The numerical event time \(t_{\tau }^{*}\) and event point \((y_{\tau }^{*},z_{\tau }^{*})\) are obtained by solving the equation

$$\begin{aligned} h(y_{\tau }^{*},z_{\tau }^{*})=0, \end{aligned}$$
(15)

where

$$\begin{aligned}{} & {} y_{\tau }^{*}=\eta (t_{\tau }^{*})=y_{n^*}+\sum _{i=1}^{\nu }b_{i}\left( \frac{t_{\tau }^{*}-t_{n^*}}{\tau _{n^*+1} }\right) l_{ni} \\{} & {} z_{\tau }^{*}=\mu (t_{\tau }^{*})=z_{n^*}+\sum _{i=1}^{\nu }b_{i}\left( \frac{t_{\tau }^{*}-t_{n^*}}{\tau _{n^*+1} }\right) k_{ni}, \end{aligned}$$

with

$$\begin{aligned}{} & {} \eta (t_{n}+\theta \tau )=y_{n}+\sum _{i=1}^{\nu }b_{i}(\theta )l_{ni} \\{} & {} \mu (t_{n}+\theta \tau )=z_{n}+\sum _{i=1}^{\nu }b_{i}(\theta )k_{ni},\ \theta \in [0,1], \end{aligned}$$

a continuous extension of the Rosenbrock method. As in case of semi-implicit methods and implicit RK methods, the event point \((y_{\tau }^{*},z_{\tau }^{*})\) belongs to the discontinuity surface by construction (point a) in the introduction). But, unlike semi-implicit methods and stiffly accurate implicit RK methods, it is not consistent in general (point b) in the introduction). The equation (15) is a scalar non-linear equation in the unknown numerical event time \(t_{\tau }^{*}\). The cost, for solving it, is a small fraction of the cost of a step of the Rosenbrock method, where \(\nu \) linear system of dimension \(d_1+d_2\) need to be solved.

3 One-side Methods

There are DDAEs where the functions f and g in (1) are defined only in \(S^{-}\cup \Sigma \) and not in \(S^{+}\) (see the example of DDAE given in [21]). In such situations, one needs to integrate the DAE (1) by a one-side numerical method, namely a method where the values of f and g are evaluated only at points of \(S^{-}\cup \Sigma \), while values of f and g at points of \(S^+\) cannot be computed.

The one-sideness is an important property that numerical methods for DDAEs have to satisfy (see point c) in the introduction).

For Discontinuous Ordinary Differential Equations (DODEs), numerical methods with this property based on one-step and multistep schemes have been developed in [6, 8]. However, such schemes can become expensive because they need to adapt the stepsize in order to approach the discontinuity surface. On the other hand, for DODEs, the methods studied in [9, 17] and based on a transformation of the time variable are one-side and they can reach the discontinuity surface in a number of steps fixed a priori, without needing to adapt the stepsize. In this paper, we propose for DDAEs similar one-side methods based on a time transformation.

Now, we briefly show the difficulties when we ask to be one-side to the standard numerical methods for DAEs. Here, we are thinking about methods that adapt the stepsize in approaching the discontinuity surface in order to be one-side.

In case of semi-implicit methods (2), (3), (4), (5), the one-side property requires

$$\begin{aligned} (y_{ni}.z_{ni})\in S^{-}\cup \Sigma ,\qquad n=0,1,\ldots ,n^*\text { and } i=1,\ldots ,\nu \ , \end{aligned}$$

and

$$\begin{aligned} (y_{n+1}, z_{n+1})\in S^{-}\cup \Sigma ,\qquad n=0,1,\ldots ,n^*. \end{aligned}$$

This cannot be obtained, since \( (y_{n^*+1},z_{n^*+1})\in S^{+}\). However, in the particular situation where \(h(y,z)=h(y)\), i.e h is a function of the sole variable y, the one-side property could be obtained first by checking for \(h(y_{n+1})>0\) and then, only in the situation where \(h(y_{n+1})\le 0\), to compute \(z_{n+1}\) by \(g(y_{n+1},z_{n+1})=0\).

In case of implicit RK methods (7), (8), the one-side property requires

$$\begin{aligned} (y_{ni}.z_{ni})\in S^{-}\cup \Sigma ,\qquad n=0,1,\ldots ,n^*\text { and } i=1,\ldots ,\nu . \end{aligned}$$

This cannot be achieved if a stiffly accurate implicit RK method is used to obtain a consistent numerical solution, since \((y_{ns},z_{ns})=(y_{n^*+1},z_{n^*+1})\in S^{+}\) for \(n=n^*\). However, if the numerical integration up to \(t_{n^*+1}\) is accomplished by a non-stiffly-accurate method and the stiffly accurate method is used only in the event location (10), (11), the one-side property could be obtained.

In case of Rosenbrock methods (12), (13), (14), the one-side property require

$$\begin{aligned} (y_{ni}.z_{ni})\in S^{-}\cup \Sigma ,\qquad n=0,1,\ldots ,n^*\text { and } i=1,\ldots , \nu \ , \end{aligned}$$

and

$$\begin{aligned} (y_{n}.z_{n})\in S^{-}\cup \Sigma ,\qquad n=0,1,\ldots ,n^*. \end{aligned}$$

This shows that techniques adapting the step in order to obtain a one-side method can be used for Rosenbrock methods. However, recall that these methods have the drawback of providing an event point which is not consistent in general (point b) in the introduction).

By summarizing, we can say that the numerical event locations by the three standard numerical methods presented above satisfy the property (a) in the introduction, but they fail to satisfy simultaneously the other two properties (b) and (c). On the other hand, the three properties (a), (b) and (c) can be satisfied simultaneously by numerically integrating the DAE obtained from the time transformation presented in the next section. Moreover, by this numerical integration, the discontinuity surface can be reached in an arbitrary number of steps fixed a priori.

4 Reparametrization of the Time

We present another approach to the event location for DDAEs, different from the use of standard numerical methods, called time reparametrization or time transformation. This approach has been introduced in [9] and [17] for DODEs and it has been also used in different contexts (see for instance [2, 4, 5, 13]).

We assume to have

$$\begin{aligned} \frac{d}{dt}h(y(t),z(t))>0,\ t\in [t_0,t^*), \end{aligned}$$

which holds sufficiently close to the event time. This means that the time reparametrization should be used when the solution is definitely approaching the discontinuity surface.

4.1 The Time Transformation and the s-time DAE

Recall that \(t^*\) is the event time for the DAE (1). Fix \(s_{0}<0\) and let

$$\begin{aligned} \alpha :\left[ s_{0},0\right] \rightarrow \left[ t_0,t^*\right] \end{aligned}$$

be a \(C^1\) function such that \(\alpha (s_{0})=t_0\) and \(\alpha (0)=t^*\). We call \(\alpha \) a time transformation.

Now, we consider in the DAE (1) the time reparametrization (change of variable)

$$\begin{aligned} t=\alpha \left( s\right) \end{aligned}$$

and we set

$$\begin{aligned} \left( Y\left( s\right) , Z\left( s\right) \right) :=\left( y\left( \alpha \left( s\right) \right) ,z\left( \alpha \left( s\right) \right) \right) ,\ s\in \left[ s_{0},0\right] . \end{aligned}$$

Observe that Y and Z are, respectively, the differential and algebraic variables in the new s-time, whereas y and z are the differential and algebraic variables in the old t-time.

The time transformation \(\alpha \) is chosen in order to have

$$\begin{aligned} h\left( y\left( \alpha \left( s\right) \right) , z\left( \alpha \left( s\right) \right) \right) =h\left( Y\left( s\right) ,Z\left( s\right) \right) =\kappa \left( s\right) ,\ s\in \left[ s_{0},0\right] , \end{aligned}$$
(16)

where

$$\begin{aligned} \kappa :\left[ s_{0},0\right] \rightarrow \left[ h(y_{0},z_0),0\right] \end{aligned}$$

is a given \(C^{1}\) strictly increasing function with \(\kappa (s_{0})=h(y_{0},z_0)<0\) and \(\kappa (0)=0\). In this manner, in advance we prescribe in the s-time how the negative values of the function h have to increase in order to reach zero at the event time. The simplest choice for \(\kappa (s)\) is \(\kappa (s)=s\) and then the initial s-time is \(s_0=h(y_0,z_0)\). Other forms of \(\kappa (s)\) are possible: for example, \(\kappa (s)=s^m\) with \(m\ge 2\) is used in [17].

The original t-time DAE (1) is transformed in a new s-time DAE where the time-transformation \(\alpha \) is one of the unknowns.

Theorem 1

The functions Y and Z and the time transformation \(\alpha \) satisfy

$$\begin{aligned} \left\{ \begin{array}{l} Y^{\prime }\left( s\right) =\alpha ^{\prime }\left( s\right) f\left( Y\left( s\right) ,Z\left( s\right) \right) ,\ \ s\in [s_{0},0], \\ \\ g(Y(s),Z(s))=0,\ \ s\in [s_{0},0], \\ \\ h\left( Y\left( s\right) ,Z\left( s\right) \right) =\kappa \left( s\right) ,\ \ s\in [s_{0},0],\ \\ \\ \left( Y\left( s_{0}\right) ,Z\left( s_{0}\right) ,\alpha \left( s_{0}\right) \right) =\left( y_{0},z_{0},t_0\right) . \end{array} \right. \end{aligned}$$
(17)

Proof

For \(s\in \left[ s_{0},0\right] \), we have

$$\begin{aligned} Y^{\prime }\left( s\right)= & {} \alpha ^{\prime }\left( s\right) y^{\prime }\left( \alpha \left( s\right) \right) = \alpha ^{\prime }\left( s\right) f\left( y\left( \alpha \left( s\right) \right) ,z\left( \alpha \left( s\right) \right) \right) \\= & {} \alpha ^{\prime }\left( s\right) f\left( Y\left( s\right) , Z\left( s\right) \right) \end{aligned}$$

and

$$\begin{aligned}{} & {} 0=g\left( y\left( \alpha \left( s\right) \right) ,z\left( \alpha \left( s\right) \right) \right) =g\left( Y\left( s\right) ,Z\left( s\right) \right) . \end{aligned}$$

Moreover, (16) holds, the initial values for Y and Z at \(s_0\) are the initial values \(y_0\) and \(z_0\) for y and z at \(t_0\) and the initial value for \(\alpha \) at \(s_0\) is \(t_0\). \(\square \)

In this approach, where the time t is transformed in the time s and the event time becomes known to be 0 a priori, the event location consists in integrating the DAE (17) in the unknown Y, Z and \(\alpha \) over the interval \([s_0,0]\): the event time is \(\alpha (0)\) and the event point is (Y(0), Z(0)).

Observe that (17) is a DAE where \(\alpha ^\prime \), not \(\alpha \), is an unknown scalar algebraic variable. By introducing the fictitious differential equation \(\alpha ^\prime (s)=\beta (s)\), \(\alpha \) becomes a new differential variable and \(\beta \) is a new algebraic variable. The DAE (17) takes the form

$$\begin{aligned} \left\{ \begin{array}{l} Y^{\prime }\left( s\right) =\beta \left( s\right) f\left( Y\left( s\right) ,Z\left( s\right) \right) ,\ \ s\in [s_{0},0], \\ \\ \alpha ^\prime (s)=\beta (s),\ \ s\in [s_{0},0], \\ \\ g(Y(s),Z(s))=0,\ \ s\in [s_{0},0], \\ \\ h\left( Y\left( s\right) ,Z\left( s\right) \right) =\kappa \left( s\right) ,\ \ s\in [s_{0},0],\ \\ \\ \left( Y\left( s_{0}\right) ,Z\left( s_{0}\right) , \alpha \left( s_{0}\right) \right) =\left( y_{0},z_{0},t_0\right) . \end{array} \right. \end{aligned}$$
(18)

Observe that the algebraic scalar variable \(\beta \) appears in the differential equations, but not in the algebraic equations.

4.2 Index and Form of the s-time DAE

A general DAE is said of index m, m positive integer, if m differentations of the algebraic equations provide explicit differential equations for the algebraic variables by reducing the DAE to an ODE.

Thus, by following this definition, if the original t-time DAE (1) has index 1, then the s-time DAE (18) is of index 2, and if the t-time DAE has index higher than 1, then the s-time DAE (18) has the same index as the t-time DAE. In fact, by two differentiations of the algebraic equation

$$\begin{aligned} h\left( Y\left( s\right) ,Z\left( s\right) \right) =\kappa \left( s\right) \end{aligned}$$

we can obtain an explicit differential equation for \(\beta \).

Suppose that the t-time DAE (1) has index 1. Since the algebraic equation \(g(y,z)=0\) can be written as \(z=G(y)\) for some function G, the s-time DAE (18) reads

$$\begin{aligned} \left\{ \begin{array}{l} Y^{\prime }\left( s\right) =\beta \left( s\right) f\left( Y\left( s\right) ,G(Y\left( s\right) ) \right) ,\ \ s\in [s_{0},0], \\ \\ \alpha ^\prime (s)=\beta (s),\ \ s\in [s_{0},0], \\ \\ h\left( Y\left( s\right) ,G(Y\left( s\right) ) \right) =\kappa \left( s\right) ,\ \ s\in [s_{0},0],\ \\ \\ \left( Y\left( s_{0}\right) ,\alpha \left( s_{0}\right) \right) =\left( y_{0},t_0\right) . \end{array} \right. \end{aligned}$$
(19)

The DAE (19) is an Hessenberg index-2 DAE, i.e. a DAE where the algebraic variables appear only in the differential equations.

If the t-time DAE (1) is of index higher than 1, then the s-time DAE (18) inherits this higher index and it has in addition the scalar differential variable \(\alpha \) and the scalar algebraic variable \(\beta \), which appears only in the differential equations. In particular, if the t-time DAE (1) is an Hessenberg index-2 DAE

$$\begin{aligned} \left\{ \begin{array}{l} y^{\prime }\left( t\right) =f\left( y\left( t\right) ,z\left( t\right) \right) ,\ t\ge t_0, \\ g\left( y\left( t\right) \right) =0,\ t\ge t_0, \\ y(t_0)=y_0, \end{array} \right. \end{aligned}$$
(20)

then the s-time DAE (18) becomes

$$\begin{aligned} \left\{ \begin{array}{l} Y^{\prime }\left( s\right) =\beta \left( s\right) f\left( Y\left( s\right) ,Z\left( s\right) \right) ,\ \ s\in [s_{0},0], \\ \\ \alpha ^\prime (s)=\beta (s),\ \ s\in [s_{0},0], \\ \\ g(Y(s))=0,\ \ s\in [s_{0},0], \\ \\ h\left( Y\left( s\right) ,Z\left( s\right) \right) =\kappa \left( s\right) ,\ \ s\in [s_{0},0],\ \\ \\ \left( Y\left( s_{0}\right) ,\alpha \left( s_{0}\right) \right) =\left( y_{0},t_0\right) . \end{array} \right. \end{aligned}$$
(21)

The s-time DAE (21) has index 2, but in general it is not Hessenberg index-2, since the algebraic variable Z appears in the second algebraic equation. Of course, in the particular case \(h(y,z)=h(y)\), the s-time DAE (21) is Hessenberg index-2.

In the next two subsections, we see two alternative approaches for the solution of (17), different from viewing it as a DAE of index (at least) 2. One is to reduce it to an ODE by a unique differentiation (not two differentations) of the algebraic equation. The other is to reduce it to a DAE with the sole algebraic equation of the original DAE.

4.3 Reduction to an ODE

The DAE (17) can be reduced to an ODE by differentiating the algebraic equations.

Theorem 2

The functions Y and Z and the time transformation \(\alpha \) satisfy the ODE

$$\begin{aligned} \left\{ \begin{array}{l} Y^{\prime }\left( s\right) =\frac{\kappa ^{\prime }\left( s\right) }{B\left( Y\left( s\right) ,Z\left( s\right) \right) f\left( Y\left( s\right) ,Z\left( s\right) \right) }f\left( Y\left( s\right) ,Z\left( s\right) \right) ,\ s\in \left[ s_{0},0\right] , \\ \\ Z^{\prime }\left( s\right) =\frac{\kappa ^{\prime }\left( s\right) }{B\left( Y\left( s\right) ,Z\left( s\right) \right) f\left( Y\left( s\right) ,Z\left( s\right) \right) }A\left( Y\left( s\right) ,Z\left( s\right) \right) f\left( Y\left( s\right) ,Z\left( s\right) \right) ,\ s\in \left[ s_{0},0\right] , \\ \\ \alpha ^{\prime }\left( s\right) =\frac{\kappa ^{\prime }\left( s\right) }{ B\left( Y\left( s\right) ,Z\left( s\right) \right) f\left( Y\left( s\right) ,Z\left( s\right) \right) },\ s\in \left[ s_{0},0\right] , \\ \\ (Y(s_{0}),Z(s_{0}),\alpha \left( s_{0}\right) )=\left( y_{0},z_{0},t_0\right) , \end{array} \right. \end{aligned}$$
(22)

where

$$\begin{aligned} A(Y(s),Z(s))=-g_{z}(Y(s),Z(s))^{-1}g_{y}(Y(s),Z(s))\in \mathbb {R}^{d_2\times d_1} \end{aligned}$$

and

$$\begin{aligned} B\left( Y\left( s\right) ,Z\left( s\right) \right) =h_{y}\left( Y\left( s\right) ,Z\left( s\right) \right) +h_{z}\left( Y\left( s\right) ,Z\left( s\right) \right) A(Y(s),Z(s))\in \mathbb {R}^{1\times d_1}, \end{aligned}$$

with \(g_z,g_y,h_y,h_z\) derivatives (jacobian matrices) of the functions g and h with respect to the variables y and z.

Proof

For \(s\in \left[ s_{0},0\right] \), we have

$$\begin{aligned} \frac{d}{ds}g\left( Y\left( s\right) ,Z\left( s\right) \right) =g_{y}(Y(s),Z(s))Y^{\prime }\left( s\right) +g_{z}(Y(s),Z(s))Z^{\prime }\left( s\right) =0\ \end{aligned}$$
(23)

and

$$\begin{aligned} \frac{d}{ds}h\left( Y\left( s\right) ,Z\left( s\right) \right) =h_{y}\left( Y\left( s\right) ,Z\left( s\right) \right) Y^{\prime }\left( s\right) +h_{z}\left( Y\left( s\right) ,Z\left( s\right) \right) Z^{\prime }\left( s\right) =\kappa ^{\prime }\left( s\right) .\ \end{aligned}$$
(24)

Hence, we obtain

$$\begin{aligned} Z^{\prime }\left( s\right) =A(Y(s),Z(s))Y^{\prime }\left( s\right) \end{aligned}$$

by (23) and

$$\begin{aligned} B\left( Y\left( s\right) ,Z\left( s\right) \right) Y^{\prime }(s)=B\left( Y\left( s\right) ,Z\left( s\right) \right) \alpha ^{\prime }\left( s\right) f\left( Y\left( s\right) ,Z\left( s\right) \right) =\kappa ^{\prime }\left( s\right) \end{aligned}$$

and then

$$\begin{aligned} \alpha ^{\prime }\left( s\right) =\frac{\kappa ^{\prime }\left( s\right) }{ B\left( Y\left( s\right) ,Z\left( s\right) \right) f\left( Y\left( s\right) ,Z\left( s\right) \right) } \end{aligned}$$

by (24). Now, (22) easily follows. \(\square \)

Although the ODE (22) is equivalent to the DAE (17), it has a much more complicated form than (17) and it involves \(g_{y}\), the inverse of \(g_z\), \(h_{y}\) and \(h_{z}\).

4.4 Reduction to a DAE

In the particular case where \(h\left( y,z\right) =h\left( y\right) \), the DAE (17) is equivalent to a DAE with the same algebraic equation of the original DAE (1). This is obtained by differentiating the scalar algebraic equation involving h.

Theorem 3

Suppose \(h\left( y,z\right) =h\left( y\right) \). The functions Y and Z satisfy the DAE

$$\begin{aligned}{} & {} \left\{ \begin{array}{l} Y^{\prime }\left( s\right) =\frac{\kappa ^{\prime }\left( s\right) }{h_{y}\left( Y\left( s\right) \right) f\left( Y\left( s\right) ,Z\left( s\right) \right) } f\left( Y\left( s\right) ,Z\left( s\right) \right) ,\ s\in [s_{0},0], \\ \\ g(Y(s),Z(s))=0,\ s\in [s_{0},0], \\ \\ (Y(s_{0}),Z(s_{0}))=\left( y_{0},z_{0}\right) , \end{array} \right. \end{aligned}$$
(25)

and the time-transformation \(\alpha \) satisfy

$$\begin{aligned} \left\{ \begin{array}{l} \alpha ^{\prime }\left( s\right) =\frac{\kappa ^{\prime }\left( s\right) }{ h_{y}\left( Y\left( s\right) \right) f\left( Y\left( s\right) ,Z\left( s\right) \right) },\ s\in [s_{0},0], \\ \\ \alpha \left( s_{0}\right) =t_0. \end{array} \right. \end{aligned}$$
(26)

Proof

For \(s\in \left[ s_{0},0\right] \), we have,

$$\begin{aligned} \kappa ^{\prime }\left( s\right) =h_{y}\left( Y\left( s\right) \right) Y^{\prime }\left( s\right) =h_{y}\left( Y\left( s\right) \right) \alpha ^{\prime }\left( s\right) f\left( Y\left( s\right) ,Z\left( s\right) \right) \end{aligned}$$

and then

$$\begin{aligned} \alpha ^{\prime }\left( s\right) =\frac{\kappa ^{\prime }\left( s\right) }{ h_{y}\left( Y\left( s\right) \right) f\left( Y\left( s\right) ,Z\left( s\right) \right) } \end{aligned}$$

in the differential equation of the DAE (17). \(\square \)

Observe that (25) is a DAE in the sole variables Y and Z and it has the same algebraic equation of the DAE (1). The time transformation \(\alpha \) satisfies the pure quadrature problem (26), which can be solved once Y and Z are determined. This reformulation of (17) as a DAE similar to the original DAE (1) only involves the derivative \(h_{y}\).

We have seen that, when the t-time DAE has index 1, the s-time DAE (18) has index 2. On the other hand, the index 1 of the t-time DAE turns out to be preserved in the DAE (25).

Remark 4

When the DAE (1) is an ODE, i.e. \(f(y,z)=f(y)\) and the algebraic equation is not present, the equation (17) remains a DAE and the equation (18) remains an Hessenberg index-2 DAE. Thus, we pay for the simplification of the problem, achieved through the time reparametrization, with the change in the nature of the equation, even in the simplest case of an ODE. Observe that in [17], the DAE (17) corrisponding to an ODE (1) is reduced to (25), which is an ODE.

5 Numerical Solution in the s-time

In this section we present numerical methods for the s-time DAE (18). When we consider such methods as methods for the numerical event location in the original t-time DAE (1), they turn out to be methods satisfying all three properties (a), (b) and (c) in the introduction. It is important to remark that none of the standard methods presented in Section 2 can do this.

We consider the situation where the s-time DAE (18) is Hessenberg index-2. This happens when the original t-time DAE has index 1 or has the Hessenberg index-2 form (20) and \(h(y,z)=h(y)\).

The s-time Hessenberg index-2 DAE reads

$$\begin{aligned} \left\{ \begin{array}{l} Y^{\prime }\left( s\right) =\beta (s)f(Y(s),Z\left( s\right) ),\ s\in [s_{0},0], \\ \alpha ^\prime (s)=\beta (s),\ s\in [s_{0},0],\\ g(Y(s),Z(s))=0,\ s\in [s_{0},0],\\ h\left( Y(s),Z\left( s\right) \right) =\kappa (s),\ s\in [s_{0},0],\ \\ (Y(s_{0}),\alpha (s_0),Z(s_0))=(y_0,t_0,Z_0) \end{array} \right. \end{aligned}$$
(27)

where

  • the first algebraic equation reads \(Z(s)=G(Y(s))\) for a t-time DAE of index 1;

  • the algebraic equations read \(g(Y(s))=0\) and \(h(Y(s))=\kappa (s)\) for a t-time Hessenberg index-2 DAE.

We integrate the Hessenberg index-2 DAE (27), over a mesh

$$\begin{aligned} s_0<s_1<\cdots <s_N=0 \end{aligned}$$
(28)

of stepsizes

$$\begin{aligned} \tau _{n+1}=s_{n+1}-s_n,\ n=0,1,\ldots ,N-1, \end{aligned}$$

by RK methods (Abc) as illustrated in Chapter VII.4 of [12]. For a general Hessenberg index-2 DAE

$$\begin{aligned} \left\{ \begin{array}{l} U^{\prime }\left( s\right) =\mathcal {F}(U(s),V\left( s\right) ),\ \ s\in [s_{0},0], \\ \mathcal {G}\left( s,U\left( s\right) \right) =0 ,\ \ s\in [s_{0},0],\ \\ U\left( s_{0}\right) =U_0, \end{array} \right. \end{aligned}$$

where U is the vector of the differentiable variables and V is the vector of the algebraic variables, the RK numerical integration over the mesh (28) takes the form

$$\begin{aligned}{} & {} U_{n+1}=U_n+\tau _{n+1}\sum \limits _{i=1}^\nu b_i \mathcal {F}(U_{ni},V_{ni}) \nonumber \\{} & {} V_{n+1}=V_n+\tau _{n+1}\sum \limits _{i=1}^\nu b_i l_{ni}, \end{aligned}$$
(29)

where the stage values \((U_{ni},V_{ni})\), \(i=1,\ldots ,\nu \), are determined by the non-linear equations

$$\begin{aligned}{} & {} U_{ni}=U_n+\tau _{n+1}\sum \limits _{j=1}^\nu a_{ij} \mathcal {F}(U_{nj},V_{nj}), \ i=1,\ldots ,\nu , \nonumber \\{} & {} \mathcal {G}(s_{ni},U_{ni})=0, \ j=1,\ldots ,\nu , \end{aligned}$$
(30)

with \(s_{ni}=s_n+c_i\tau _{n+1}\), and the derivatives \(l_{ni}\), \(i=1,\ldots ,\nu \), are determined by the linear equations

$$\begin{aligned}{} & {} V_{ni}=V_n+\tau _{n+1}\sum \limits _{j=1}^\nu a_{ij} l_{nj}, \ i=1,\ldots ,\nu , \end{aligned}$$
(31)

once the system (30) is solved,

About the convergence of the scheme (29), (30), (31), one can refer to the results in Chapter VII.4 in [12], in particular Table 4.1.

When the original t-time DAE has index 1, the RK numerical integration of the s-time DAE is

$$\begin{aligned}{} & {} Y_{n+1}=Y_{n}+\tau _{n+1} \sum _{i=1}^{\nu }b_{i}\beta _{ni}f(Y_{ni},Z_{ni}) \nonumber \\{} & {} \alpha _{n+1}=\alpha _{n}+\tau _{n+1} \sum _{i=1}^{\nu }b_{i}\beta _{ni} \nonumber \\{} & {} g(Y_{n+1},Z_{n+1})=0, \end{aligned}$$
(32)

where the stage values \(\left( Y_{ni},Z_{ni},\beta _{ni}\right) \), \(i=1,\ldots ,\nu \), are obtained by solving the non-linear system

$$\begin{aligned}{} & {} Y_{ni}=Y_{n}+\tau _{n+1} \sum \limits _{j=1}^{\nu }a_{ij}\beta _{nj}f(Y_{nj},Z_{nj}),\ i=1,\ldots ,\nu , \nonumber \\{} & {} g(Y_{ni},Z_{ni})=0,\ i=1,\ldots ,\nu , \nonumber \\{} & {} h(Y_{ni},Z_{ni})=\kappa (s_n+c_i\tau _{n+1}),\ i=1,\ldots ,\nu , \end{aligned}$$
(33)

of dimension \(\nu (d_1+d_2+1)\).

When the original t-time DAE is Hessenberg index-2 and \(h(y,z)=h(y)\), the RK numerical integration of the s-time DAE is

$$\begin{aligned}{} & {} Y_{n+1}=Y_{n}+\tau _{n+1} \sum _{i=1}^{\nu }b_{i}\beta _{ni}f(Y_{ni},Z_{ni}) \nonumber \\{} & {} \alpha _{n+1}=\alpha _{n}+\tau _{n+1} \sum _{i=1}^{\nu }b_{i}\beta _{ni} \nonumber \\{} & {} Z_{n+1}=Z_n+\tau _{n+1}\sum \limits _{i=1}^\nu b_i l_{ni}, \end{aligned}$$
(34)

where, first, the stage values \(\left( Y_{ni},Z_{ni},\beta _{ni}\right) \), \(i=1,\ldots ,\nu \), are obtained by solving the non-linear system

$$\begin{aligned}{} & {} Y_{ni}=Y_{n}+\tau _{n+1} \sum \limits _{j=1}^{\nu }a_{ij}\beta _{nj}f(Y_{nj},Z_{nj}),\ i=1,\ldots ,\nu , \nonumber \\{} & {} g(Y_{ni})=0,\ i=1,\ldots ,\nu , \nonumber \\{} & {} h(Y_{ni})=\kappa (s_n+c_i\tau _{n+1}),\ i=1,\ldots ,\nu , \end{aligned}$$
(35)

of dimension \(\nu (d_1+d_2+1)\) and, then, the derivatives \(l_{ni}\), \(i=1,\ldots ,\nu \), are obtained by solving the linear system

$$\begin{aligned}{} & {} Z_{ni}=Z_n+\tau _{n+1}\sum \limits _{j=1}^\nu a_{ij} l_{nj}, \ i=1,\ldots ,\nu , \end{aligned}$$
(36)

of dimension \(\nu d_2\).

The numerical integration of (27) provides the numerical event time \(\alpha _N\) and the numerical event point \((Y_N,Z_N)\). Observe that there is no equation for \(\beta _{n+1}\) in (32) or (34), since we are not interested in the nodal values \(\beta _{n}\) but only in the stage values \(\beta _{ni}\). In this manner, we can avoid to assign an initial value \(\beta _0\) for the variable \(\beta \).

If the s-time DAE is not Hessenberg index-2, then other RK schemes need to be used. In case of DAEs of index 3, see for example [14].

5.1 Diagonally Implicit Stiffly Accurate RK Methods

Suppose that a stiffly accurate RK method (recall (9)) is used for the integration (32), (33) or (34), (35), (36) of the s-time DAE (27). We have

$$\begin{aligned} (Y_{n+1},Z_{n+1})=(Y_{n\nu },Z_{n\nu }),\ n=0,1,\ldots ,N-1, \end{aligned}$$

and then the method consists only in the equations (33) or (35) and the equation for \(\alpha _{n+1}\).

The next theorem contains a fundamental result of our study

Theorem 5

If the t-time DAE (1) is of index 1, or it is Hessenberg index-2 and \(h(y,z)=h(y)\), and the numerical event location for such DAE is accomplished with an integration of the s-time DAE (27) by a stiffly accurate RK method, then the properties (a), (b) and (c) in the introduction are satisfied.

Proof

By construction (see (33) and (35)), we have a consistent numerical solution, i.e.

$$\begin{aligned} g(Y_{n+1},Z_{n+1})=g(Y_{n\nu },Z_{n\nu })=0,\ n=0,1,\ldots ,N-1. \end{aligned}$$

In particular, we have \(g(Y_{N},Z_{N})=0\) and so the numerical event point \((Y_N,Z_N)\) is consistent (point b) in the introduction).

Moreover, we have

$$\begin{aligned} h(Y_{ni},Z_{ni})=\kappa (s_{n}+c_i\tau _{n+1})\le 0,\ n=0,1,\ldots ,N-1\text { and }i=1,\ldots ,\nu , \end{aligned}$$

i.e.

$$\begin{aligned} (Y_{ni},Z_{ni})\in S^{-}\cup \Sigma ,\ n=0,1,\ldots ,N-1\text { and }i=1,\ldots ,\nu . \end{aligned}$$
(37)

Thus, the method is one-side (point c) in the introduction), since the values of f and g are required only at points (37).

Finally, we have

$$\begin{aligned} h(Y_{n+1},Z_{n+1})=\kappa (s_{n+1}),\ n=0,1,\ldots ,N-1. \end{aligned}$$

In particular, we have \(h(Y_{N},Z_{N})=0\) and thus the numerical event point \((Y_N,Z_N)\) lies on the discontinuity surface (point a) in the introduction). \(\square \)

Observe that the one-side stiffly accurate RK method reaches the discontinuity surface, i.e. it reaches the final s-time \(s=0\), in an arbitrary number of steps fixed a priori, since there are no restrictions posed on the mesh (28).

5.1.1 Diagonally Implicit RK Methods

To avoid a large computational cost, we can use a diagonally implicit stiffly accurate RK method, instead of a fully implicit stiffly accurate RK method. Remind that a diagonally implicit RK method is a RK method such that

$$\begin{aligned} a_{ij}=0,\ i,j=1,\ldots ,\nu \text { with }i<j. \end{aligned}$$

So, in (33) or (35), the stage values \(\left( Y_{ni},Z_{ni},\beta _{ni}\right) \), \(i=1,\ldots ,\nu \), are obtained by successively solving, for \(i=1,\ldots ,\nu \), the non-linear system

$$\begin{aligned}{} & {} Y_{ni}=Y_{n}+\tau _{n+1} \sum \limits _{j=1}^{i-1}a_{ij}\beta _{nj}f(Y_{nj},Z_{nj})+\tau _{n+1} a_{ii}\beta _{ni}f(Y_{ni},Z_{ni}) \\{} & {} g(Y_{ni},Z_{ni})=0 \\{} & {} h(Y_{ni},Z_{ni})=\kappa (s_{n}+c_i\tau _{n+1}), \end{aligned}$$

or

$$\begin{aligned}{} & {} Y_{ni}=Y_{n}+\tau _{n+1} \sum \limits _{j=1}^{i-1}a_{ij}\beta _{nj}f(Y_{nj},Z_{nj})+\tau _{n+1} a_{ii}\beta _{ni}f(Y_{ni},Z_{ni}) \\{} & {} g(Y_{ni})=0 \\{} & {} h(Y_{ni})=\kappa (s_{n}+c_i\tau _{n+1}), \end{aligned}$$

of dimension \(d_1+d_2+1\), where the stage value \(\left( Y_{ni},Z_{ni},\beta _{ni}\right) \) are the unknowns and the stage-values \(\left( Y_{nj},Z_{nj},\beta _{nj}\right) \), \(j=1,\ldots ,i-1\), have been already computed.

The computational saving is given, at any step, by the solution of \(\nu \) non-linear systems of dimension \(d_1+d_2+1\), rather than a unique non-linear system of dimension \(\nu (d_1+d_2+1)\).

5.1.2 Some Methods

The simplest diagonally implicit stiffly accurate RK method is the implicit Euler method.

Two-stage diagonally implicit stiffly accurate RK methods of order two (for ODEs) are given by the tableau

where

$$\begin{aligned} a=\frac{\frac{1}{2}-b}{1-b}. \end{aligned}$$

For \(b=\frac{1}{2}\), we have the trapezoidal rule. For \(b=0\), we have the implicit midpoint rule.

As another example of a diagonally implicit accurately stiff RK method, we give the following five-stage method of order four (for ODEs)

(38)

appearing in [12, IV.(6.16)]. Indeed, since all the diagonal coefficients \(a_{ii}\) are equal, this method is a singly diagonally implicit RK (SDIRK) method.

The global orders of convergence when the implicit Euler method, the trapezoidal rule, the implicit midpoint rule and the method (38) are applied to Hessenberg index-2 DAE are given in Table 1 derived from Table 4.1 in [12].

Table 1 Hessenberg index-2 global orders of convergence for methods in Section 5.1.2

6 Numerical Tests

We consider three numerical examples for testing our approach to the numerical event location for DDAEs by the time reparametrization. Indeed, the first and third examples are event locations problems for DAEs, where one can imagine that the event equation could constitute a surface of discontinuity. Whereas, the second example comes from a model formulated as a DDAE.

6.1 The First Test

The first example is the three-dimensional DAE of index 1

$$\begin{aligned} \left\{ \begin{array}{l} y_1^{\prime }\left( t\right) =-2y_2\left( t\right) ,\ t\ge \frac{\pi }{4},\\ \\ y_2^{\prime }\left( t\right) =-z(t)^2+y_1\left( t\right) ,\ t\ge \frac{\pi }{4},\\ \\ y_1\left( t\right) ^2+y_2\left( t\right) ^2+z\left( t\right) ^2-1=0,\ t\ge \frac{\pi }{4},\\ \\ \left( y\left( \frac{\pi }{4}\right) ,z\left( \frac{\pi }{4}\right) \right) =\left( \frac{1}{4},\frac{1}{4},\frac{\sqrt{2}}{2}\right) \end{array} \right. \end{aligned}$$
(39)

whose solution is

$$\begin{aligned} (y(t),z(t))=(\cos ^2 t,\cos t\sin t,\sin t). \end{aligned}$$

with the event equation

$$\begin{aligned} h(y,z)=-y_1(t)-y_2(t)-z(t)+v=0, \end{aligned}$$

where

$$\begin{aligned} v=\cos ^2\frac{\pi }{3}+\cos \frac{\pi }{3}\sin \frac{\pi }{3}+\sin \frac{\pi }{3} \end{aligned}$$

In this situation, the event time is \(t^*=\frac{\pi }{3}\) and the event point is

$$\begin{aligned} \left( y^*,z^*\right) =\left( \cos ^2\frac{\pi }{3},\cos \frac{\pi }{3}\sin \frac{\pi }{3},\sin \frac{\pi }{3}\right) . \end{aligned}$$

The numerical event location is accomplished by integrating the Hessenberg index-2 DAE (18), relevant to the DAE (39), with \(\kappa (s)=s\). The implicit Euler method, the trapezoidal rule and the method (38), are used for the numerical integration. We consider uniform meshes (28) with

$$\begin{aligned} N_k=2^{k},\ k=0,1,\ldots ,10, \end{aligned}$$

subintervals.

In Fig. 1, we see the time-transformation (computed with the method (38) over the mesh with \(k=10\)).

Fig. 1
figure 1

Time transformation for the Hessenberg index-2 DAE relevant to the DAE (39)

In Fig. 2, we see, for the three methods, the logarithm in base 10 of the errors

$$\begin{aligned} errt_k=\vert \alpha _N-t^*\vert ,\ erry_k=\Vert Y_N-y^*\Vert _2\text { and } errz_k=\vert Z_N-z^*\vert ,\ k=0,1,\ldots ,10, \end{aligned}$$

in red dashed lines marked with \(\diamondsuit \). The black solid lines marked with \(\star \) show convergences with order one, two, three and four.

The orders of convergence one, two and two in the differential variables (\(\alpha \) included) for implicit Euler method, trapezoidal rule and method (38), respectively, given in Table 1 are here confirmed. The order of convergence of the algebraic variable Z is the order of the differential variables since \(Z=G(Y)\) holds.

Fig. 2
figure 2

Errors in the integration of the Hessenberg index-2 DAE relevant to the DAE (39)

6.2 The Second Test

The second example is the DAE of index 1

$$\begin{aligned} \left\{ \begin{array}{l} y_1^{\prime }\left( t\right) =F_1-z(t)-k_c\frac{y_1(t)y_2(t)}{V},\ t\ge 0 \\ \\ y_2^{\prime }\left( t\right) =F_2-k_c\frac{y_1(t)y_2(t)}{V},\ t\ge 0, \\ \\ y_3^{\prime }\left( t\right) =k_c\frac{y_1(t)y_2(t)}{V},\ t\ge 0, \\ \\ z\left( t\right) =k_gX\left( P(y(t))-P_{\textrm{out}}\right) ,\ t\ge 0, \\ \\ \left( y_1(0),y_2(0),y_3(0)\right) =(0.72,95,0), \end{array} \right. \end{aligned}$$
(40)

where

$$\begin{aligned} P(y(t))=\frac{y_1(t)RT}{V-\frac{y_2(t)}{\rho _l}-\frac{y_3(t)}{\rho _a}}, \end{aligned}$$

describing the gas-phase in a model of soft-drink production (see [7]). The event equation is

$$\begin{aligned} h(y(t),z(t))=\frac{y_2(t)}{\rho _l}+\frac{y_3(t)}{\rho _a}-V_d=0, \end{aligned}$$

and involves only y(t). After the event, we have a transition to the liquid-phase described by another DAE. About constants and parameters in (40), the following values

$$\begin{aligned}{} & {} F_1=0.5,\ F_2=7.5,\ k_c=\frac{0.433}{4000},\ V=10,\\{} & {} k_g=3,\ X=1,\ P_{\textrm{out}}=1\\{} & {} R=0.0820574587,\ T=293,\ \rho _a=16,\ \rho _l=50,\\{} & {} V_d=2.25 \end{aligned}$$

in suitable units are used.

The numerical event location is accomplished by integrating the Hessenberg index-2 DAE (18), relevant to the DAE (40), with \(\kappa (s)=s\). We use the three methods of the previous test over the same meshes.

In Fig. 3, we see the time-transformation.

Fig. 3
figure 3

Time transformation for the Hessenberg index-2 DAE relevant to the DAE (40)

In Fig. 4, we see the logarithm in base 10 of the errors as in the previous test. For the computation of the errors, the exact event time and event point are estimated by integrating with the method (38) over a uniform mesh with \(N=2^{13}\) subintervals, one thousand time more subintervals than the more refined mesh used: We obtain the values

$$\begin{aligned}{} & {} t^*=2.333036718967131\\{} & {} y^*=(3.767995595486393\cdot 10^{-1},1.124967285180228\cdot 10^{2},\\{} & {} \ \ \ \ \ \ \ \ 1.046874232710747\cdot 10^{-3})\\{} & {} z^*=5.068373375540564\cdot 10^{-1}. \end{aligned}$$

For the implicit Euler method, the trapezoidal rule and the method (38) the observed orders are one, two and four, respectively. The method (38) has, on this problem, the order four for ODEs, not the order two of Table 1 for Hessenberg index-2 DAEs. This could be due to the fact that, since h depends only on the differentiable variable and the t-time DAE is of index 1, the s-time DAE can be reduced to a DAE of index 1 as described in Sect. 4.4, where the convergence order is the convergence order for ODEs.

Fig. 4
figure 4

Errors in the integration of the Hessenberg index-2 DAE relevant to the DAE (40)

6.3 The Third Test

The third example is given by the second order Hessenberg index-2 DAE describing the motion of the simple pendulum in cartesian coordinates x and y (the x-axis is horizontal and the y-axis is vertical downward)

$$\begin{aligned} \left\{ \begin{array}{l} x^{\prime \prime }\left( t\right) =-n(t)x\left( t\right) ,\ t\ge 0,\\ y^{\prime \prime }\left( t\right) =-n(t)y\left( t\right) +g,\ t\ge 0,\\ x(t)^2+y(t)^2=1,\ t\ge 0, \end{array} \right. \end{aligned}$$
(41)

where the algebraic variable n(t) appearing only in the differential equations is the tension of the pendulum rod. Here, we are assuming that the rod has unit length and the pendulum bob has unit mass.

We consider the initial condition

$$\begin{aligned} \left\{ \begin{array}{l} (x(0),y(0))=\left( \frac{\sqrt{2}}{2},\frac{\sqrt{2}}{2}\right) \\ (x^\prime (0),y^\prime (0))=\left( -\frac{\sqrt{2}}{2},\frac{\sqrt{2}}{2}\right) \end{array} \right. \end{aligned}$$

i.e. the pendulum starts with unit speed at \(45^{\circ }\) with respect to the vertical axis, and the event equation

$$\begin{aligned} x(t)=0, \end{aligned}$$

i.e. the event is when the pendulum bob reaches the lowest point in the motion.

The DAE (41) has index 3 (by three differentiations of the algebraic equation we obtain a differential equation for n) and then the DAE (18) also has index 3. Thus, suitable numerical methods for the index 3 (see [14]) should be used for its integration. However, the DAE (41) can be reduced to an Hesseberg index-2 DAE by differentiating only one time the algebraic equation. We obtain

$$\begin{aligned} \left\{ \begin{array}{l} x^{\prime \prime }\left( t\right) =-n(t)x\left( t\right) ,\ t\ge 0,\\ y^{\prime \prime }\left( t\right) =-n(t)y\left( t\right) +g,\ t\ge 0,\\ x(t)x^\prime (t)+y(t)y^\prime (t)=0,\ t\ge 0, \end{array} \right. \end{aligned}$$
(42)

The numerical event location is accomplished by integrating the DAE (18), relevant to the first order version of the second order DAE (42), with \(\kappa (s)=s\). Unlike the previous tests, where the original t-time DAE was of index 1, here the t-time DAE is Hessenberg index-2. The s-time DAE is Hessenberg index-2, since \(h(y,z)=h(y)\).

For the numerical integration of the s-time DAE, we use the same methods with the same meshes of the two previous tests.

In Fig. 5, we see the time-transformation.

Fig. 5
figure 5

Time transformation for the s-time Hessenberg index-2 DAE relevant to the t-time DAE (41)

In Fig. 6, we see the logarithm in base 10 of the errors of \(t^*\), \(x^\prime (t^*)\) and \(n(t^*)\). The exact values of \(t^*\), \(x^\prime (t^*)\) and \(n(t^*)\) can be easily determined by well-known physics: we have

$$\begin{aligned}{} & {} t^*=3.875000113579756\cdot 10^{-1}\\{} & {} x^\prime (t^*)=-2.597415052147026\\{} & {} n(t^*)=1.655656495311994\cdot 10^1. \end{aligned}$$
Fig. 6
figure 6

Errors in the integration of the Hessenberg index-2 DAE relevant to the DAE (42)

The implicit Euler method appears to converge with order one as predicted in Table 1. The trapezoidal rule appears to converge with order two for the differential variables as predicted in Table 1, but it does not converge for the algebraic variable although the order is two for such variables in Table 1. The method (38) appears to converge with order two, also for the algebraic variable although the order is one for such variables in Table 1.

Just for a comparison, by replacing the trapezoidal rule with the implicit midpoint rule, we obtain the errors in Fig. 7. The orders agree with Table 1, although the order for \(x^\prime (t^*)\) is four rather than two.

Fig. 7
figure 7

Errors in the integration of the Hessenberg index-2 DAE relevant to the DAE (42) by the implicit midpoint rule

7 Conclusion

In this paper, we have presented a new approach to the event location for DDAEs based on a time reparametrization reducing the event location to the integration of an Hessenberg index-2 DAE up to a known final time. By integrating this DAE by a diagonally implicit stiffly accurate RK method, we obtain a not-so-computationally-expensive method for the numerical event location satisfying the properties (a), (b) and (c) in the introduction. None of the standard methods for the numerical event location of DDAEs satisfies all three of these properties. The approach can be used also for DAEs of index higher than 1.