Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] T_mix_ph results depend strongly on T0 when water is involved #339

Open
BenPortner opened this issue May 6, 2022 · 3 comments
Open

Comments

@BenPortner
Copy link
Contributor

Current behavior

The helper function T_mix_ph can return very different results depending on the starting value when H2O is part of the mixture (see example).

Expected behavior

The function always returns the same value.

Proposed solution

The Newton algorithm should probably return NaN or None if it didn't converge.

Example

from tespy.tools.fluid_properties import T_mix_ph

T_mix_ph([1, 1e5, 2e6, {"H2O":0.99, "O2":0.01}], T0=800)
>>> 273.26000000000005
T_mix_ph([1, 1e5, 2e6, {"H2O":0.99, "O2":0.01}], T0=80)
>>> 749.5470656784826
@fwitte
Copy link
Member

fwitte commented May 9, 2022

Hi,

thank you for reporting this. Unfortunately, TESPy (dev version) currently only solves for pure gaseous mixtures or pure fluids in liquid, two-phase or gaseous phase. The only exception is condensation of water in a gasous stream. Since the enthalpy value in your example is is somewhere in the two-phase region of water, the newton algorithm does not find a solution.

The reason why the Newton algorithm implemented for the fluid property functions does not throw an error is: Within the solving process of a network (especially at the beginning), the enthalpy/pressure values for some streams end up in regions that do not make much sense physically. If the function threw an error, the solving process would stop even if the overall network would still be solved later.

There is already a warning message in place, maybe we can promote that from debug to info or warning. What do you think?

Also, regarding the specific combination of values, you might be interested in the work @nkawerau is currently contributing (see #327). He is working on an implementation letting you choose between CoolProp and thermosteam, which is able to solve for multiphase mixtures.

Have nice week!

@BenPortner
Copy link
Contributor Author

Hi Francesco,

I think it makes sense to keep the function quiet during normal usage of TesPy. It would still be handy to access the logger information though. Where are the logs currently stored?

Thanks.
Ben

@fwitte
Copy link
Member

fwitte commented May 23, 2022

In your home folder there should be a folder .tespy/log or something like that. You an also change logging, I‘ll update this later, when I am at my computer again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants