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

Fix error HumidAir.mixing humidity #57

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

c-ortbauer
Copy link
Contributor

Hi

I think I spotted an error in the HumidAir.mixing method. The humidity of the mix was calculated incorrectly.

Here is my derivation:

$$X = \frac{m_W}{m_{dA}}$$ $$= \frac{X_1 m_{dA1}+X_2 m_{dA2}}{m_{dA1}+m_{dA2}} $$ $$= \frac{X_1\frac{m_1}{1+X_1}+ X_2\frac{m_2}{1+X_2}}{\frac{m_1}{1+X_1}+\frac{m_2}{1+X_2}}$$ $$= \frac{X_1 m_1 (1+X_2)+ X_2 m_2 (1+X_1)}{m_1 (1+X_2) + m_2 (1+X_1)}$$

Luckily I implemented my own mixing function before finding this one. While checking my own, they always were just a bit off.

Thanks for the great library!

Fixes the calculated humidity when mixing two HumidAir states.
@portyanikhin portyanikhin self-requested a review December 18, 2024 14:25
@portyanikhin
Copy link
Owner

Hello, @c-ortbauer!

Thank you so much for fixing this bug!
I've refactored a bit and brought the code in line with your formula:

$$\frac{m_1 X_1 (1+X_2)+ m_2 X_2 (1+X_1)}{m_1 (1+X_2) + m_2 (1+X_1)}$$

In my opinion, it will be much more concise this way.

I'm glad that my library turned out to be useful for you😊

@portyanikhin portyanikhin merged commit cc91abd into portyanikhin:main Dec 18, 2024
15 checks passed
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (b09589e) to head (268fea1).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #57   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         1269      1269           
=========================================
  Hits          1269      1269           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants