SMath Studio Forum
»
SMath Studio
»
Questions
»
Finding a Temperature with Root, Solve or FindRoot Using CoolProp
Rank: Member Groups: Registered
Joined: 13/11/2020(UTC) Posts: 28 Was thanked: 7 time(s) in 3 post(s)
|
Hi, it's me again XD I try to find the value of a temperature that when replacing it in an equation the result is 0 KJ/Kg. I have already done things like this, where I propose a temperature or pressure and with the "Root" or "Solve" command I get the result, however this time I am using CoolProp instead of equations of state and polynomials, I don't know if that affects, you know by the units and things like that... does anyone know how to do it? I already tried with a mathcad solve block although I think I'm not using it well, approximately the temperature is around 294.2 K, it would be great if this can be done with a "Root", "Solve", or "FindRoot" so as not to have to do it with a Newton Raphson thank you very much for reading me Cooling Towers with SMath Studio E1.sm (66kb) downloaded 20 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,371 Was thanked: 834 time(s) in 528 post(s)
|
Hola Valentino. The nonlinear plugin solvers don't work because they can't get the derivative of the function. SMath's diff function does not work on functions defined in plugins, in this case coolprop. You can see that in this post: https://en.smath.com/for..._postst12504_Uneval.aspxTo get the root you need to implement your own pure numerical solver or use al_nleqsolve. Cooling Towers with SMath Studio E1.sm (70kb) downloaded 22 time(s).Best regards. Alvaro. PD: It's a bit awkward having to define f(T) as a 1x1 matrix, while accepting guess as a scalar. I think that an interesting improvement in al_nleqsolve could be to accept scalar functions for the case of a single variable, and also return the result as a scalar, and not a 1x1 vector. Of course, preserving the possibility that You really want to solve a 1x1 system, recognizing it as such because f is a matrix. Edited by user 30 March 2022 20:28:39(UTC)
| Reason: Comment about al_nleqsolve
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,495 Was thanked: 1275 time(s) in 746 post(s)
|
First, the frame must completely cover the expressions. This needs to be checked. Secondly, it is desirable to make sure that the solver works without a block. Here is a possible bug in the program. Originally Posted by: Razonar PD: It's a bit awkward having to define f(T) as a 1x1 matrix, while accepting guess as a scalar. I think that an interesting improvement in al_nleqsolve could be to accept scalar functions for the case of a single variable, and also return the result as a scalar, and not a 1x1 vector. Someday it will also work with block. Edited by user 30 March 2022 20:37:50(UTC)
| Reason: Not specified |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Valentino I try to find the value of a temperature that when replacing it in an equation ... If you can tabulate that curve on the image, it might be possible to approximate with a function. If so from possible approximation, solution will be more general and immediate from maple/solve thus no more need for solver bloc. Cheers ... Jean
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Here is a support example ... The dual solver from undocumented root is exceptional Per say: from measured Ω evaluate °C from user ranged [min °C ... max °C] calibrated Ω XTR Inst_IAPWS region 1 Solve Entropy Saturation.sm (38kb) downloaded 11 time(s).
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Questions
»
Finding a Temperature with Root, Solve or FindRoot Using CoolProp
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.