Non-converging ode calculation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Non-converging ode calculation
I am solving an ode. The calculation converges for some parameters but not for others. My problem is I cannot figure out why. There seem to be no obvious causes, e.g. like a denominator going to zero. I have looked at a number of other aspects without success. I am not mathematically adept enough to tease something out analytically, but maybe some one else is. If anyone has any insights or suggestions, I would appreciate it.
I have attached a worksheet. It is MathCad 11. I know there are some others out there using legacy versions like me (still using MC14).
Also sometimes instead of the non-converging error message, mc flags the rhs of the ode and says "The return value of this function must match the problem size." What does this mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
There's no tau in the set of differential equations:
It results in no y2 in the set D(t,y):
Could that be a ( or, the ) problem?
Success!
Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Using your IC03 seems to fail for t.end larger than the value seen in the picture below.
Looks like the derivative is exceeding numerical limit and going in direction infinity at this position.
BTW, you know that writing TOL=10^-12 has no effect!? The default value (10^-3) still is in effect. You would have to use the three bars global definition "equal" sign if you wanted to see the effect of changing the value of this system variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Luc and Werner,
Thanks for taking a look and for the suggestions. In case you are interested.....It turns out the problem was with the function Dc which goes to zero with large V and causes the solution to blow up (as you noticed). In this case, the problem actually becomes ill-posed - no stable solution exists. Because of this the non-convergence is not surprising. So the problem really had nothing to do with MathCad (except it helped revealing and tracking down the problem). I alleviated the problem by replacing Dc, which was a linearly decreasing function of ln(V)V (on the basis of experimental observations) by an exponential which agrees with the linear function for small ln(V) but does not go to zero.
Thanks again for taking a look.
Werner: Thanks for the info about TOL. I should have know that but even after using MCAD for more than 20, I am still a neophyte with syntax.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I thought I had this issue resolved by using a decaying exponential of ln (v) for Dc. This worked most of the time but for larger amplitudes (epsilon) and shorter periods (tp), the calculation does not converge. I got around this by using a cut-off, exponential decay to a finite value at infinity. I was surprised how large that value needed to be (0.4 compared to 1.0) but the problem seems to be the issue exposed by Werner - v is just increasing too rapidly for the numerics to follow (though Matlab seems to do better).
Werner: In your reply below how did you identify the ending value. I reproduced it but only by trial and error.
Luc: Thanks for the suggestion. There was no need for me to include dtau = k (1-v) as a separate equation (except for the convenience of not having to calculate tau outside the program). Including it in the equation for dv did help make the program run better.
