11classdef AscherLinearDAEProblem < otp .Problem
2- % ASCHERLINEARDAEPROBLEM This is an Index-1 DAE problem
2+ % A linear differential-algebraic problem with time-dependant mass matrix.
33 %
4+ % The Ascher linear DAE Problem :cite:p:`Asc89` is an index-1 differential-agebraic equation given by
5+ %
6+ % $$
7+ % \begin{bmatrix}
8+ % 1 & -t \\
9+ % 0 & 0
10+ % \end{bmatrix} \begin{bmatrix} y'(t) \\ z'(t) \end{bmatrix} = \left[ \begin{array}{cc}
11+ % -1 & 1+t \\
12+ % β & -1-β t
13+ % \end{array}\right] \begin{bmatrix} y(t) \\ z(t) \end{bmatrix} + \begin{bmatrix}
14+ % 0 \\
15+ % \sin(t)
16+ % \end{bmatrix}.
17+ % $$
18+ %
19+ % When the initial condition $y(0) = 1 , z(0) = β$ is used, the problem has the following closed-form solution:
20+ %
21+ % $$
22+ % \begin{bmatrix} y(t)\\ z(t) \end{bmatrix} = \begin{bmatrix}
23+ % t \sin(t) + (1 + β t) e^{-t}\\
24+ % β e^{-t} + \sin(t)
25+ % \end{bmatrix}.
26+ % $$
27+ % This DAE problem can be used to investigate the convergence of implcit time-stepping methods due to its stiffness
28+ % and time-dependant mass matrix.
29+ %
30+ % Notes
31+ % -----
32+ % +---------------------+-----------------------------------------+
33+ % | Type | DAE |
34+ % +---------------------+-----------------------------------------+
35+ % | Number of Variables | 2 |
36+ % +---------------------+-----------------------------------------+
37+ % | Stiff | possibly, depending on $β$ |
38+ % +---------------------+-----------------------------------------+
39+ %
40+ % Example
41+ % -------
42+ % >>> problem = otp.ascherlineardae.presets.Canonical('Beta', 50);
43+ % >>> t = linspace(0, 1);
44+ % >>> sol = problem.solveExactly(t);
45+ % >>> problem.plot(t, sol);
46+
447 methods
548 function obj = AscherLinearDAEProblem(timeSpan , y0 , parameters )
49+ % Create an Ascher linear DAE problem object.
50+ %
51+ % Parameters
52+ % ----------
53+ % timeSpan : numeric(1, 2)
54+ % The start and final time.
55+ % y0 : numeric(2, 1)
56+ % The initial condition.
57+ % parameters : AscherLinearDAEParameters
58+ % The parameters.
659 obj@otp.Problem(' Ascher Linear DAE' , 2 , timeSpan , y0 , parameters );
760 end
861 end
@@ -17,7 +70,15 @@ function onSettingsChanged(obj)
1770 ' MStateDependence' , ' none' , ...
1871 ' MassSingular' , ' yes' );
1972 end
20-
73+
74+ function label = internalIndex2label(~, index )
75+ if index == 1
76+ label = ' Differential' ;
77+ else
78+ label = ' Algebraic' ;
79+ end
80+ end
81+
2182 function y = internalSolveExactly(obj , t )
2283 beta = obj .Parameters .Beta ;
2384 if ~isequal(obj .Y0 , [1 ; beta ])
@@ -35,4 +96,3 @@ function onSettingsChanged(obj)
3596 end
3697 end
3798end
38-
0 commit comments