1

How does one go ahead to assign the time stamp whereby a system becomes stiff to a variable? I'm interested in doing a root search on the domain spanning from
t = 0 to t_f = time_stiff - ε.

In order for my code to run smoothly and not have to put in the t_f by hand, how might I have the machine output the t_f so that I might assign it to a variable that the code may continue to use.

I ask because I'm looking to run this programs thousands of times iteratively and would like to have it run overnight without any assistance.

System becomes stiff indicator

falsovuoto
  • 111
  • 4

1 Answers1

2

In this case, since the integration stops precisely at the value where the stiffness detector fires, we can use the undocumented capabilities of InterpolatingFunction[] to extract that endpoint.

Since you've forgotten to provide an example, I shall use my own. A relatively simple stiff problem is this simplified flame propagation model due to Larry Shampine:

With[{δ = 1*^-11}, 
     f = y /. First @ NDSolve[{y'[x] == y[x]^2 - y[x]^3, y[0] == δ},
                              y, {x, 0, 2/δ}]];

If you try this out, you will see the message NDSolve::ndsz along with the point where it stopped. To get that point, do this:

f["Domain"][[1, -1]]
   9.846458146821846*^10

You should now be able to use this for further computations.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574