help-octave
[Top][All Lists]

## Re: DAE daspk solver problem

 From: Lazy_Tom Subject: Re: DAE daspk solver problem Date: Sat, 29 Oct 2016 08:54:44 -0700 (PDT)

Sebastian Schöps wrote
>
> Lazy_Tom wrote
>> I don't think your description is correct, at the moment you are solving
>> a regular ODE. The solver is not aware that the last equation doesn't
>> contain the derivative of x(5). And this needs to be specified with
>> odeset 'Mass' option and other parameters
> Yes, you need something like
> M = diag([1 1 1 1 0]);
> vopt = odeset ('InitialStep', 1e-3, 'AbsTol', 1e-8,'Mass',M);
> I cannot test it since I do not have a working odepkg due to Octave 4.2
> incompatibilities.

I can give it a go. This is what I tried, it is based on the
odepkg_examples_dae Demonstration 1 (which I know it works)

to make things simple m=1, g=10, pole length=1, both ode2r and ode5r has
been tried.

function [vyd] = frobertson (vt, vy, varargin)
vyd(1,1) =  vy(2);
vyd(2,1) =  -vy(1) * vy(5);
vyd(3,1) =  vy(4);
vyd(4,1) =  -vy(3) * vy(5) - 10;
vyd(5,1) =  vy(1)^2 + vy(3)^2 - 1;
endfunction

function [vmass] = fmass (vt, vy, varargin)
vmass =  diag([1, 1, 1, 1, 0]);
endfunction

vopt = odeset ('Mass', @fmass, 'NormControl', 'on');
vsol = ode5r (@frobertson, [0, 17], [1, 0, 0, 0, 0], vopt);
plot (vsol.x, vsol.y);

the output was :

warning: Option "RelTol" not set, new value 1.0e-006 is used
warning: called from
radau5_test_1_V04 at line 19 column 6
warning: Option "AbsTol" not set, new value 1.0e-006 is used
warning: Option "NormControl" will be ignored by this solver
warning: Option "InitialStep" not set, new value 1.0e-006 is used
warning: Option "MaxStep" not set, new value 1.4e+000 is used
warning: Option "Mass" only supports constant mass matrices M() and not
M(t,y)
warning: Option "NewtonTol" not set, default value is used
warning: Option "MaxNewtonIterations" not set, default value 7 is used
EXIT OF RADAU5 AT X=        0.2537E-02
STEP SIZE T0O SMALL, H=   1.7937759160684990E-018
error: missing implementation
error: called from
radau5_test_1_V04 at line 19 column 6

Unless I have made some typos, I suspect this might take more than expected
to set up...

Sebastian Schöps wrote
>
> Lazy_Tom wrote
>> This is how I finally found out about the 'Mass' option (yes there is a
>> tiny example in odepkg_examples_dae but I don't think this is enough)
> This is extensively explained in the pdf (e.g. page 14 in
> http://cosy.informatik.uni-bremen.de/sites/default/files/odepkg.pdf).

Cheers, I assume there are no changes in odeset from 0.8.2 to 0.8.5

Marco

--
View this message in context:
http://octave.1599824.n4.nabble.com/DAE-daspk-solver-problem-tp4680377p4680418.html
Sent from the Octave - General mailing list archive at Nabble.com.