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
Hydrogen Pressure Issue #2154
Labels
invalid
Used for issues that are not related to CoolProp
Comments
msaitta-mpr
added a commit
to msaitta-mpr/CoolProp
that referenced
this issue
Oct 7, 2022
Sometimes, the backwards ancillary solver fails near the critical point. This can happen if the ancillary function at its limit (i.e., critical temperature) does not reach the desired seek value (e.g., density). Because we are only usually using these to get a guess value, we can extrapolate them without issue to avoid a crash near the critical point. This helps to resolve CoolProp#2154.
msaitta-mpr
added a commit
to msaitta-mpr/CoolProp
that referenced
this issue
Oct 7, 2022
Solving for the saturation curve near the critical point can be unstable. This commit fixes that in a few ways. 1) Prevent the solver from overshooting and prevent a negative temperature or density. 2) If it does fail, try again with a smaller omega value. If the solver fails after all of this, we will still throw to allow something downstream to handle it. This helps to address issue CoolProp#2154.
I would recommend that you, in this case, workaround by using the fsolve
function in MATLAB to solve for the temperature which gives you the right
internal energy. That is what CoolProp is doing under the hood, but this
calculation is complicated by the critical region; in particular, solving
for the equilibrium temperature for densities near the critical density.
The failures there can be mitigated by the use of superancillary equations,
but those have not been implemented in CoolProp (yet).
… Message ID: ***@***.***>
|
ibell
pushed a commit
that referenced
this issue
Oct 28, 2022
* Add extrapolating secant solver Sometimes, the backwards ancillary solver fails near the critical point. This can happen if the ancillary function at its limit (i.e., critical temperature) does not reach the desired seek value (e.g., density). Because we are only usually using these to get a guess value, we can extrapolate them without issue to avoid a crash near the critical point. This helps to resolve #2154. * Stabilize saturation curve solution Solving for the saturation curve near the critical point can be unstable. This commit fixes that in a few ways. 1) Prevent the solver from overshooting and prevent a negative temperature or density. 2) If it does fail, try again with a smaller omega value. If the solver fails after all of this, we will still throw to allow something downstream to handle it. This helps to address issue #2154. * Move saturation_D_pure max iterations to options
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
We are currently working on simulating pure hydrogen gas behavior in storage tanks while fulling and defueling the tank. Unfortunately, there seems to be a Coolprop issue when hydrogen in the tanks reaches or circles its critical density. Throwing the following error:
Python Error: ValueError: p is not a valid number : PropsSI("T","D",31.46258141,"U",2391760.261,"Hydrogen")
In general, the gas in the storage tanks should increase or decrease in density and at the same time increase or decrease its inner energy due to removing or including an enthalpy flow. So, the gas should always at some point reach up to its critical density and therefore possibly throw this error.
However, we noticed that it is possible in some cases to adjust the simulation timestep and “skipping” the zone of the critical density. Unfortunately, this only works in some cases, and it is notoriously difficult to find the right starting parameters.
So I just wanted to ask if there is any workaround for suppressing the error throw?
Thank you!
Steps to Reproduce
Try:
py.CoolProp.CoolProp.PropsSI('T','D',31.46258141'U',2391760.261,'Hydrogen')
Expected behavior:
There should be a corresponding temperature as a result ranging between -40 to 140 °C depending on the parameters.
Actual behavior:
No temperature output.
Versions
CoolProp Version: 6.4.1.0
Operating System and Version: Windows 10
Access Method: Matlap Version R2021b with a Python 3.9 Wrapper
The text was updated successfully, but these errors were encountered: