help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help need for Differential algebraic equations


From: Olaf Till
Subject: Re: Help need for Differential algebraic equations
Date: Thu, 9 Oct 2008 09:16:55 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Wed, Oct 08, 2008 at 03:22:11PM -0700, genehacker wrote:
> 
> I came across this function 'dassl', which is supposed to solve differential
> algebraic equations, but have problems using it. This is how i use it
> currently and below is the error message. I have no idea what it is.

At least from 'T =    0.000000E+00' you see that dassl did not get
away from time zero. I do not know algorithms for DAEs, but probably
the solver will build a gradient matrix by calling your function 'f'
with different values of 'x' and 'xdot' and makes some 'iteration
matrix' from it. The error 'THE ITERATION MATRIX IS SINGULAR' is not
surprizing, since your function 'f' seems to be wrong (see below), so
that the returned value does not depend on the argument 'xdot' at all.

> ******code*****
> 
> function xdot = f(x,xdot,t);
The return value has the same name as the argument 'xdot'. You should
give it a different name. You should assign to it the value of the
right side of your DAE, which gets zero for a solution.

> %define all parameter values viz. k12, k23,f86 etc here
> xdot = zeros(9,1);
With the line above you have lost the values in the argument
'xdot'. Also, you do not use this argument below --- seems you actually
need a solver for algebraic equations (like 'fsolve'), not
differential(-algebraic) equations. Or you actually mean to solve an
ODE (use 'lsode' than). Anyway, something is wrong with your code ...

> xdot(2) = k12*x(1) - k23*x(2);
> xdot(3) = k23*x(2);
> xdot(5) = k45*x(4) - k56*x(5);
> xdot(6) = k56*x(5) - k67*x(6);
> xdot(7) = k67*x(6);
> 
> x(8) = f86*x(6);
> x(9) = f29*x(2);
Why are you assigning to 'x' above?

> endfunction;
> 
> 
> x0 = ones(9,1)';
> xdot0 =zeros(9,1)';
> t = linspace(0,50,50);
> dassl("f",x0,xdot0,t)
> 
> *****output******
> 
>  ***MESSAGE FROM ROUTINE DDASSL IN LIBRARY SLATEC.
>  ***POTENTIALLY RECOVERABLE ERROR, PROG ABORTED, TRACEBACK REQUESTED
>  *  AT T =    0.000000E+00  AND STEPSIZE H =    1.594388E-05  THE ITERATION
>  *  MATRIX IS SINGULAR
>  *  ERROR NUMBER = -8
>  *
>  ***END OF MESSAGE
> 
>  ***JOB ABORT DUE TO UNRECOVERED ERROR.
> 0          ERROR MESSAGE SUMMARY
>  LIBRARY    SUBROUTINE MESSAGE START             NERR     LEVEL     COUNT
>  SLATEC     DDASSL     AT T =    0.000000E+        -8         1         1
> 
> error: exception encountered in Fortran subroutine ddassl_
> error: caught execution error in library function


reply via email to

[Prev in Thread] Current Thread [Next in Thread]