Hello,
I need a method to modify (shorten) the initially specified integration interval, while using NDSolve for solving some very large set of first order ODEs. I have to stop calculations if the computational time or occupied memory exceed certain limits, in such a way so that a valid solution object is produced by NDSolve for the interval in which the solution is already obtained, instead of program crashing due to excessive time or memory requirements. Is there any way to achieve this? I tried to use the WhenEvent construct, according to the following test code:
timeused0=TimeUsed[];
sol=NDSolve[{odes,WhenEvent[TimeUsed[]-timeused0>200,"StopIntegration"]},{solfunctions},{t,tmin,tmax}];
but this does not seem to work. The integration is not stopped in the expected moment, and the "sol" object finally obtained contains the entire solution up to t=tmax. I would appreciate any help.
Lesław