Skip to content

Conversation

@bertkdowns
Copy link
Contributor

@bertkdowns bertkdowns commented Jun 26, 2025

Fixes

Adds Butane and Isobutane in helmholtz, based on:

Reference Equations of State for the Thermodynamic Properties of Fluid Phase n-Butane and Isobutane
D. Bücker; W. Wagner

https://doi.org/10.1063/1.1901687

Summary/Motivation:

We wanted to be able to model butane in helmholtz for https://github.com/waikato-ahuora-smart-energy-systems/PropertyPackages, may as well contribute upstream too!

Changes proposed in this PR:

  • Added and generated Butane and IsoButane helmholtz files
  • Added a new equation for sat_delta_approx, where the explonent is multiplied by tau, to follow the equation in the above paper.
  • Added property tests based on values in the paper, with some properties inferred to additional precision in the same way that John Eslick did orignally.
  • Added a method to calculate additional precision of rhol, which will make testing easier in the future.

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

Copy link
Contributor

@adowling2 adowling2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

When I was using the Helmholtz model, I found it helpful to make a few diagrams with the included helpful functions (e.g., TS, PH, ...) and then compare those to either literature or https://github.com/CoolProp/CoolProp. This is not required for the PR, but gives a nice sanity check.

@codecov
Copy link

codecov bot commented Jun 26, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.00%. Comparing base (3b4ebdb) to head (2282da6).
⚠️ Report is 41 commits behind head on main.

Files with missing lines Patch % Lines
.../general_helmholtz/components/parameters/butane.py 80.00% 1 Missing and 1 partial ⚠️
...neral_helmholtz/components/parameters/isobutane.py 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1636      +/-   ##
==========================================
- Coverage   77.01%   77.00%   -0.01%     
==========================================
  Files         395      397       +2     
  Lines       63555    63580      +25     
  Branches    10365    10367       +2     
==========================================
+ Hits        48944    48962      +18     
- Misses      12171    12177       +6     
- Partials     2440     2441       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bertkdowns
Copy link
Contributor Author

Good point! Here's some visualisations:
image
image
image
image

And the equivalent from https://tlk-energy.de/en/phase-diagrams/pressure-enthalpy
image
image

From https://www.researchgate.net/figure/T-s-diagram-of-butane-covering-the-whole-liquid-range-in-temperature-from-triple-point_fig2_318372826
image

I couldnt find a T-S curve for isobutane though. The scales are a bit different but seem to match.

Here's the code to generate the graphs if anyone in the future is trying to do the same thing:

import os
from pyomo.common.fileutils import this_file_dir
from idaes.models.properties.general_helmholtz.helmholtz_parameters import (
    WriteParameters,
)
from idaes.models.properties.general_helmholtz import (
    HelmholtzParameterBlock,
    PhaseType,
    StateVars,
)
import pyomo.environ as pyo
from idaes.core import FlowsheetBlock

m = pyo.ConcreteModel()

m.fs = FlowsheetBlock(dynamic=False)
m.fs.helmholtz = HelmholtzParameterBlock(
    pure_component="butane",
    phase_presentation=PhaseType.LG,
    state_vars=StateVars.PH,
)

fig, ax = m.fs.helmholtz.ts_diagram()

import matplotlib.pyplot as plt
fig.show()
plt.show()

Copy link
Contributor

@dallan-keylogic dallan-keylogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for contributing these methods. I just have a few questions.

Copy link
Contributor

@dallan-keylogic dallan-keylogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the explanation. LGTM

@ksbeattie ksbeattie added the Priority:Normal Normal Priority Issue or PR label Aug 7, 2025
@ksbeattie ksbeattie merged commit 0b57fe2 into IDAES:main Aug 28, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority:Normal Normal Priority Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants