Finding a Temperature with Root, Solve or FindRoot Using CoolProp

Finding a Temperature with Root, Solve or FindRoot Using CoolProp - Mathcad Solve Block - Mensajes

#1 Publicado: 30/3/2022 10:20:10
Erick Valentino

Erick Valentino

7 me gusta en 29 mensajes.

Grupo: User

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 (65,24 KiB) descargado 1337 vez(es).

TSolve.png
#2 Publicado: 30/3/2022 14:12:50
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: User

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/forum/yaf_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 (69,03 KiB) descargado 1350 vez(es).

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.
#3 Publicado: 30/3/2022 14:32:32
Вячеслав Мезенцев

Вячеслав Мезенцев

1.558 me gusta en 1.868 mensajes.

Grupo: Moderator

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.

Archivo no encontrado. Archivo no encontrado.

Wrote

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.
Russia ☭ forever, Viacheslav N. Mezentsev
A 1 usuarios les gustó este mensaje
Alvaro 30/3/2022 14:42:00
#4 Publicado: 31/3/2022 8:47:04
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

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

#5 Publicado: 31/3/2022 13:54:37
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

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 (37,12 KiB) descargado 1372 vez(es).
  • Nuevos mensajes
  • Sin mensajes nuevos