Skip to main content
16-Pearl
February 24, 2018
Question

Skipping a non-converged trial

  • February 24, 2018
  • 2 replies
  • 1091 views

Situation: I'm calling a solve block (prime 4.0) multiple times for a variety of conditions.  Unfortunately, some of those calls don't converge, so I get no results.  I understand why it doesn't converge for some cases and that's not a big deal - if I can just get mathcad to move onto the next step.  So, what's a good approach for this?  I didn't have any luck using TRY since a failure to converge apparently isn't an error.  

 

General question - so no examples attached.  But here's a simple hypothetical - solving for flow conditions along a pipe.  Each call would be at a different location along the pipe length.  If 10% don't converge I can still see the trend of parameters, so I'm happy to just ignore those failed cases. 

  

Just looking for some ideas to try.

Thanks.  

Edit - After further trials I did get TRY to work.  But still wondering if there isn't a better solution.  (It appears to have a bug if I add too many lines of code within the try, but that's another story.)

2 replies

23-Emerald IV
February 24, 2018

You can create a function of the result of a solve block. If you wrap that function into an on-error statement of an encapsulating function, you might (should?) be able to deal with error conditions where the solve block does not converge.

 

Success!
Luc

24-Ruby III
March 1, 2018

Please attach your Mathcad Prime worksheet with example to the message.