Finding a Temperature with Root, Solve or FindRoot Using CoolProp

Finding a Temperature with Root, Solve or FindRoot Using CoolProp - Mathcad Solve Block - Сообщения

#1 Опубликовано: 30.03.2022 10:20:10
Erick Valentino

Erick Valentino

7 сообщений из 28 понравились пользователям.

Группа: 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 КиБ) скачан 44 раз(а).

[albumimg]1666[/albumimg]
#2 Опубликовано: 30.03.2022 14:12:50
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: 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 КиБ) скачан 39 раз(а).

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 Опубликовано: 30.03.2022 14:32:32
Вячеслав Мезенцев

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

1402 сообщений из 1708 понравились пользователям.

Группа: 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.

Файл не найден. Файл не найден.

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
1 пользователям понравился этот пост
Alvaro Diaz Falconi 30.03.2022 14:42:00
#4 Опубликовано: 31.03.2022 08:47:04
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 Опубликовано: 31.03.2022 13:54:37
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 КиБ) скачан 35 раз(а).
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений