-
Notifications
You must be signed in to change notification settings - Fork 61
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
Use of triple point of water in GetSatVapPres #36
Conversation
This change is more physically correct and simplifies considerably the NR convergence procedure in GetTDewPointFromVapPres.
This change is more physically correct and simplifies considerably the NR convergence procedure in GetTDewPointFromVapPres.
@didierthevenard should the other couple of instances of freezing point of water also be replaced? psychrolib/src/python/psychrolib.py Line 590 in af24c1c
If not, to make the code cleared we should probably make this into a parameter and call it something like |
@@ -949,6 +940,12 @@ def GetSatVapPres(TDryBulb: float) -> float: | |||
|
|||
Reference: | |||
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 5 & 6 | |||
Important note: the ASHRAE formulae are defined above and below the freezing point but have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For completeness, this comment should be copied to all other languages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small change requested - propagate to other languages the comment made in Python about the justification for using the triple point of water. Other than that, no issue found.
Regarding comment #36 (comment): I have checked, and please tell me if I am wrong, but I can find only one place where the freezing point of water is used, that is, in GetHumRatioFromTWetBulb(). I have checked and the formulae in that function do present a discontinuity at the freezing point. However changing the threshold to the triple point does not resolve the discontinuity so I am not sure if this is related at all to the issue we had in GetSatVapPres() - likely not. So no change needed. The discontinuity does not seem to cause any issues anyway. As for changing the values 32 and 0 to FREEZING_POINT_WATER I think it would be a good idea. For consistency I suggest that the constant could be declared at the same time as TRIPLE_POINT_WATER, despite the fact that it is used only in one function and could be declared there locally instead. |
That's right -- agreed. And sure, have now added Propagated note about using the triple point of water to the other languages and I retested VBA locally. I have re-requested your review. After this we can prepare for the new release. Let me know if you want to consider this a bugfix or not as this to me would be a patch version
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found, thanks for your work on this!
As for the version, yes this can be a patch.
This PR introduces the use of triple point of water in
GetSatVapPres
to make the functions more physically correct and simplifies considerably the NR convergence procedure inGetTDewPointFromVapPres
. This issue arises from the discontinuity at the freezing point of water.