cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Odesolve boundary issue

PW_10297783
8-Gravel

Odesolve boundary issue

Dears,

The error appears when I changed the boundary from 10^3 to 10^5 in Odesolve block.

May you help to fix this issue please.I am using Prime 9.0

PW_10297783_0-1720442238849.png

Thanks in advance

BR

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:Werner_E)

If the last suggestion (using the absolute value and the sign function, which keeps the derivative at zero instead of letting it rise again) is of any value to you, you should replace it by this equivalent function

Werner_E_0-1720450157555.png

as it seems to speed up the solve block significantly and produces a much clearer result.

Prime 9 sheet attached

View solution in original post

6 REPLIES 6
Werner_E
25-Diamond I
(To:PW_10297783)

I ave no explanation for this error.

I found that t.end=7613.203 to be the last value for t where the solve block still works. The value is also dependent on the intervals number, which I left unchanged from the 10^6 you had chosen.

My first guess was that it may be due to the if statement in the definition of C(s), but this seems not the case as s is way over 50000 and the solve block still works. We also clearly see the effect of this if-statement in the plot of the derivative.

The root in the definition of C(s) will yield non-real results if s is over 10^5 and this may cause problems, but the values of s(t) are way below this threshold, so this could not be the culprit, too.

Werner_E_0-1720445928593.png

 

Sorry, but at the moment I can't see a reason for the block failing

 

BTW, is there any reason your start value for t is 10^-5 and not 0 ?

Thanks all the same for your reply.

The interval number can be modified if it would be useful to solve this equation.What I have to solve is the value of t when s(t)=10^5.

If the Odesolve could not work,I am wondering if any other approach can solve this equation taking into account the defined condition.

 

PS:t from 0 if OK for me and no special reaseans since it seems both of them could work. 

Werner_E
25-Diamond I
(To:Werner_E)

OK, upon further looking it seems that the definition of C(s) and especially the root seems to be the cause for the error.

You may also reconsider the limit t=10^5

If t exceeds 14539.68 then s(t) exceeds 10^5 and the expression in the root gets negative, which means a non-real value for the derivative!!
I "fixed" the problem by adding an absolute value but you sure must check if the results for t>14539 are of any value.

Werner_E_1-1720448091549.png

Here is the derivative function in the region of t=15000. We clearly see the effect of the absolute value and I guess this is not what you intended.

Werner_E_2-1720448869792.png

I am not sure if adding the sign function in the definition of C(s) would make sense.

Werner_E_3-1720448948543.png

This effectively would draw the derivative to zero after t=14539.68 and limits s(t) to 10^5.

Werner_E_0-1720449754734.png

 

You have to decide if that is what you want to happen.

 

Prime 9 sheet attached

 

Werner_E
25-Diamond I
(To:Werner_E)

If the last suggestion (using the absolute value and the sign function, which keeps the derivative at zero instead of letting it rise again) is of any value to you, you should replace it by this equivalent function

Werner_E_0-1720450157555.png

as it seems to speed up the solve block significantly and produces a much clearer result.

Prime 9 sheet attached

excellent,your solution fixed the issue. Thanks a lot for your professional proposal.

Werner_E
25-Diamond I
(To:PW_10297783)

One additional remark.

In Prime 10 we can chose among different algorithms used for odesolve (we also could so so in good old real Mathcad).

The default "Adams/BDF" and also "Radau" fail, but "fix" and "Adaptive" work well if t.end does not exceed the critical value for t as explained in my previous postings. If t exceeds this value all algorithms must fail as you basically demand for a non-real derivative.

Werner_E_0-1720451028599.png

 

Announcements

Top Tags