Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline Valentino  
#1 Posted : 30 March 2022 16:20:10(UTC)
Valentino


Rank: Member

Groups: Registered
Joined: 13/11/2020(UTC)
Posts: 28
Man
Mexico

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).

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Razonar  
#2 Posted : 30 March 2022 20:12:50(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 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.aspx

To get the root you need to implement your own pure numerical solver or use al_nleqsolve.

img.jpg

Cooling Towers with SMath Studio E1.sm (70kb) downloaded 21 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

Offline uni  
#3 Posted : 30 March 2022 20:32:32(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 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.

2022-03-30 Block.png

Here is a possible bug in the program.

image_2022_03_30T17_25_16_849Z.png 2022-03-30 Block 2.png

Originally Posted by: Razonar Go to Quoted Post
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
thanks 1 user thanked uni for this useful post.
on 30/03/2022(UTC)
Offline Jean Giraud  
#4 Posted : 31 March 2022 14:47:04(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: Valentino Go to Quoted Post
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

Offline Jean Giraud  
#5 Posted : 31 March 2022 19:54:37(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

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).
Users browsing this topic
Guest
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.