Spaces:
Sleeping

File size: 8,663 Bytes
39e01c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) Scilab Enterprises - 2012 - Paul Bignier
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg"  xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en_US" xml:id="IDA">
    <refnamediv>
        <refname>IDA</refname>
        <refpurpose>
            Implicit Differential Algebraic equations system solver, providing an efficient and stable method to solve Differential Algebraic Equations system (DAEs) Initial Value Problems.
        </refpurpose>
    </refnamediv>
    <refsection>
        <title>Description</title>
        <para>
            Called by <link linkend="xcos">xcos</link>, <emphasis>IDA</emphasis> (short for Implicit Differential Algebraic equations system solver) is a numerical solver providing an efficient and stable method to solve Initial Value Problems of the form:
        </para>
        <para>
            <latex>
                \begin{eqnarray}
                F(t,y,\dot{y}) = 0, \hspace{2 mm} y(t_0)=y_0, \hspace{2 mm} \dot{y}(t_0)=\dot{y}_0, \hspace{3 mm} y, \hspace{1.5 mm} \dot{y}  \hspace{1.5 mm} and \hspace{1.5 mm} F \in R^N \hspace{10 mm} (1)
                \end{eqnarray}
            </latex>
        </para>
        <para>
        </para>
        Before solving the problem, <emphasis>IDA</emphasis> runs an internal routine to find consistent values for
        <emphasis>
            y<subscript>0</subscript>
        </emphasis>
        and
        <emphasis>
            yPrime<subscript>0</subscript>
        </emphasis>
        .
        <para>
            Starting then with those
            <emphasis>
                y<subscript>0</subscript>
            </emphasis>
            and
            <emphasis>
                yPrime<subscript>0</subscript>
            </emphasis>
            , <emphasis>IDA</emphasis> approximates
            <emphasis>
                y<subscript>n+1</subscript>
            </emphasis>
            with the <emphasis>BDF</emphasis> formula:
        </para>
        <para>
            <latex>
                \begin{eqnarray}
                \sum_{i=0}^{q} \alpha_{n,i} y_{n-i} = h_n\dot{y}_{n}
                \end{eqnarray}
            </latex>
            <para>
                with, like in <link linkend="CVode">CVode</link>,
                <emphasis>
                    y<subscript>n</subscript>
                </emphasis>
                the approximation of
                <emphasis>
                    y(t<subscript>n</subscript>)
                </emphasis>
                ,
                <emphasis>
                    h<subscript>n</subscript>
                </emphasis>
                =
                <emphasis>
                    t<subscript>n</subscript> - t<subscript>n-1</subscript>
                </emphasis>
                the step size, and the coefficients are fixed, uniquely determined by the method type, its order <emphasis>q</emphasis> ranging from 1 to 5 and the history of the step sizes.
            </para>
        </para>
        <para>
            Injecting this formula in <emphasis>(1)</emphasis> yields the system:
        </para>
        <para>
            <latex>
                G(y_n) \equiv F \left( t_n, \hspace{1.5mm} y_n, \hspace{1.5mm} h_n^{-1}\sum_{i=0}^{q} \alpha_{n,i} y_{n-i} \right) = 0
            </latex>
        </para>
        <para>
            To apply <emphasis>Newton</emphasis> iterations to it, we rewrite it into:
        </para>
        <para>
            <latex>
                J \left[y_{n(m+1)}-y_{n(m)} \right] = -G(y_{n(m)})
            </latex>
        </para>
        <para>
            with <emphasis>J</emphasis> an approximation of the Jacobian:
        </para>
        <para>
            <latex>
                J = \frac{\partial{G}}{\partial{y}} = \frac{\partial{F}}{\partial{y}}+\alpha\frac{\partial{F}}{\partial{\dot{y}}}, \hspace{4 mm} \alpha = \frac{\alpha_{n,0}}{h_n},
            </latex>
        </para>
        <para>
            <emphasis>α</emphasis> changes whenever the step size or the method order varies.
        </para>
        <para>
            An implemented direct dense solver is used and we go on to the next step.
        </para>
        <para>
            <emphasis>IDA</emphasis> uses the history array to control the local error
            <emphasis>
                y<subscript>n(m)</subscript> - y<subscript>n(0)</subscript>
            </emphasis>
            and recomputes
            <emphasis>
                h<subscript>n</subscript>
            </emphasis>
            if that error is not satisfying.
        </para>
        <para>
            The function is called in between activations, because a discrete activation may change the system.
        </para>
        <para>
            Following the criticality of the event (its effect on the continuous problem), we either relaunch the solver with different start and final times as if nothing happened, or, if the system has been modified, we need to "cold-restart" the problem by reinitializing it anew and relaunching the solver.
        </para>
        <para>
            Averagely, <emphasis>IDA</emphasis> accepts tolerances up to 10<superscript>-11</superscript>. Beyond that, it returns a <emphasis>Too much accuracy</emphasis> requested error.
        </para>
    </refsection>
    <refsection id="Example_IDA">
        <title>Example</title>
        <para>
            The 'Modelica Generic' block returns its continuous states, we can evaluate them with <emphasis>IDA</emphasis> by running the example:
        </para>
        <para>
            <link type="scilab" linkend="scilab.xcos/xcos/examples/solvers/DAE_Example.zcos">
                <inlinemediaobject>
                    <imageobject>
                        <imagedata align="center" fileref="../../../examples/solvers/DAE_Example.zcos" valign="middle"/>
                    </imageobject>
                </inlinemediaobject>
            </link>
            <scilab:image localized="true"><![CDATA[
loadScicos();
loadXcosLibs();
importXcosDiagram(SCI + "/modules/xcos/examples/solvers/DAE_Example.zcos");
// Redefining messagebox() to avoid popup
function messagebox(msg, Title)
 disp(Title);
 disp(msg);
endfunction
try xcos_simulate(scs_m, 4); catch disp(lasterror()); end
]]></scilab:image>
        </para>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="LSodar">LSodar</link>
            </member>
            <member>
                <link linkend="CVode">CVode</link>
            </member>
            <member>
                <link linkend="RK">Runge-Kutta 4(5)</link>
            </member>
            <member>
                <link linkend="DoPri">Dormand-Prince 4(5)</link>
            </member>
            <member>
                <link linkend="ImpRK">Implicit Runge-Kutta 4(5)</link>
            </member>
            <member>
                <link linkend="CRANI">Crank-Nicolson 2(3)</link>
            </member>
            <member>
                <link linkend="DDaskr">DDaskr</link>
            </member>
            <member>
                <link linkend="Comparisons">Comparisons</link>
            </member>
            <member>
                <link linkend="ode">ode</link>
            </member>
            <member>
                <link linkend="ode_discrete">ode_discrete</link>
            </member>
            <member>
                <link linkend="ode_root">ode_root</link>
            </member>
            <member>
                <link linkend="odedc">odedc</link>
            </member>
            <member>
                <link linkend="dae">dae</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>Bibliography</title>
        <para>
            <ulink url="https://computation.llnl.gov/casc/sundials/documentation/documentation.html">Sundials Documentation</ulink>
        </para>
    </refsection>
</refentry>