2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
12 /*--------------------------------------------------------------------------*/
15 #include "checkodeerror.h"
17 #include "localization.h"
18 #include "configvariable_interface.h"
20 // return 0 = ok, return 1 = error, return 2 = warning
21 int checkOdeError(int meth, int istate)
30 sciprint(_("Work space insufficient to finish (see messages).\n"));
34 case 1 : // lsode | lsodi (adams)
35 case 2 : // lsode | lsodi (stiff)
39 sciprint(_("Excess work done on this call (perhaps wrong jacobian type).\n"));
42 else if (istate == -2)
44 sciprint(_("Excess accuracy requested (tolerances too small).\n"));
47 else if (istate == -3)
49 sciprint(_("Illegal input detected (see printed message).\n"));
52 else if (istate == -4)
54 sciprint(_("Repeated error test failures (check all inputs).\n"));
57 else if (istate == -5)
59 sciprint(_("Repeated convergence failures (perhaps bad jacobian supplied or wrong choice of jacobian type or tolerances).\n"));
62 else if (istate == -6)
64 sciprint(_("Error weight became zero during problem. (solution component i vanished, and atol or atol(i) = 0.)\n"));
67 else if (istate == -7) // only used with impl (lsodi)
69 sciprint(_("The user-supplied subroutine res set its error flag (ires = 3) despite repeated tries by lsodi to avoid that condition.\n"));
72 else if (istate == -8) // only used with impl (lsodi)
74 sciprint(_("istate was 0 on input but lsodi was unable to compute the initial value of dy/dt.\n"));
79 case 4 : // lsdisc (discrete)
81 if (istate < 0) // from lsdisc.f :
83 // istate = 2 if lsdisc was successful, negative otherwise...
88 case 5 : // lsrgk (rk)
90 if (istate == -1) // from lsrgk.f
96 case 6 : // rkf45 (rkf)
102 if (getWarningMode())
104 sciprint(_("Integration was not completed because relative error tolerance was too small. rerr has been increased appropriately for continuing.\n"));
110 if (getWarningMode())
112 sciprint(_("Integration was not completed because more than 3000 derivative evaluations were needed. This is approximately 500 steps.\n"));
118 sciprint(_("Integration was not completed because solution vanished making a pure relative error test impossible. Must use non-zero aerr to continue. Using the one-step integration mode for one step is a good way to proceed.\n"));
123 sciprint(_("Integration was not completed because requested accuracy could not be achieved using smallest allowable stepsize. User must increase the error tolerance before continued integration can be attempted.\n"));
128 sciprint(_("It is likely that rkf45 is inefficient for solving this problem. Too much output is restricting the natural stepsize choice. Use the one-step integrator mode.\n"));
133 sciprint(_("invalid input parameters : atol and rtol must be greater than 0.\n"));
141 case 7 : // rksimp (fix)
147 else if (istate == 4)
149 sciprint(_("Inappropriate error tolerance.\n"));
158 int checkDasslError(int idid)
162 case 4 ://Only used in dasrt
164 //One or more root found at t
167 case 3 ://The integration to TOUT was successfully completed (T=TOUT) by
169 //stepping past TOUT. Y,ydot are obtained by interpolation.
172 case 2 : //The integration to TSTOP was successfully completed (T=TSTOP)
176 case 1 : //A step was successfully taken in the intermediate-output mode.
178 //The code has not yet reached TOUT.
181 case -1 : //A large amount of work has been expended (About 500 steps)
183 if (getWarningMode())
185 sciprint(_("To many steps necessary to reached next required time discretization point. Change discretisation of time vector t or decrease accuracy.\n"));
189 case -2 : //The error tolerances are too stringent.
191 sciprint(_("The error tolerances are too stringent.\n"));
196 //The local error test cannot be satisfied because you specified
197 //a zero component in ATOL and the corresponding computed solution
198 //component is zero. Thus, a pure relative error test is impossible
199 //for this component.
200 if (getWarningMode())
202 sciprint(_("Atol and computed test value are zero.\n"));
206 case -5 : // only used in daskr
208 // There were repeated failures in the evaluation
209 // or processing of the preconditioner (in JAC).
210 sciprint(_("Cannot evaluate the preconditioner.\n"));
213 case -6 : //Repeated error test failures on the last attempted step.
215 if (getWarningMode())
217 sciprint(_("A singularity in the solution may be present.\n"));
221 case -7 : //The corrector could not converge.
223 if (getWarningMode())
225 sciprint(_("May be inaccurate or ill-conditioned JACOBIAN.\n"));
229 case -8 : //The matrix of partial derivatives is singular.
231 sciprint(_("Singular partial derivatives matrix (may be redundant equations).\n"));
234 case -9 : //The corrector could not converge.
236 //There were repeated error test failures in this step.
237 if (getWarningMode())
239 sciprint(_("Either ill-posed problem or discontinuity or singularity encountered.\n"));
245 if (getWarningMode())
247 sciprint(_("External ''res'' return many times with ires=-1.\n"));
251 case -11 : //IRES equal to -2 was encountered and
253 //control is being returned to the calling program.
254 sciprint(_("Error in external ''res''.\n"));
257 case -12 : //DDASSL, dasrt or daskr failed to compute the initial YPRIME.
259 sciprint(_("failed to compute the initial Ydot.\n"));
262 case -13 : // only used in daskr
264 // An unrecoverable error was encountered inside the user's PSOL routine,
265 // and control is being returned to the calling program.
266 sciprint(_("Error in external psol.\n"));
269 case -14 : // only used in daskr
271 // The Krylov linear system solver could not achieve convergence.
272 sciprint(_("The Krylov linear system did not converge.\n"));
277 //The code has encountered trouble from which
278 //it cannot recover. A message is printed
279 //explaining the trouble and control is returned
280 //to the calling program. For example, this occurs
281 //when invalid input is detected.
282 if (getWarningMode())
284 sciprint(_("encountered trouble.\n"));