Group Abstract Group Abstract

Message Boards Message Boards

Why does NDSolve return a constant value when the derivative is positive?

Posted 7 years ago
Attachments:
POSTED BY: Robert McHugh
2 Replies
Posted 7 years ago

That is interesting. Thanks for pointing it out. In the range of operation, e.g. 0 <= z <= 1 and 140 < p < 180 (pressure limits are arbitrary), the function dzRHS is continuous. Demonstrated by Plot3D[dzRHS[z, p], {z, 0, 1}, {p, 140, 180}].

It could be that z is getting outside of this region, in this example z might be getting slightly above one. The intent of the piecewise implementation of dzRHS was to keep z between 0 and 1. Maybe this approach isn't successful at limiting z.

Is it possible that with the WhenEvent implementation, NDSolve looks more carefully at the boundary (z near 1 in this example).

Your thoughts?

POSTED BY: Robert McHugh

Just an observation: your dzRHS is discontinuous, and it can take negative values:

Plot[dzRHS[z, 175], {z, -2, 2}, PlotRange -> All]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard