Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Fixed
- Fixed numerical roundoff errors in the analytic solution of association site fractions for asymmetric association schemes. [#393](https://github.com/feos-org/feos/pull/393)
- Fixed numerical roundoff errors in the analytic solution of association site fractions for asymmetric association schemes. [#393](https://github.com/feos-org/feos/pull/393),[#394](https://github.com/feos-org/feos/pull/394)

## [0.10.2] - 2026-10-12
### Fixed
Expand Down
11 changes: 9 additions & 2 deletions crates/feos/src/pcsaft/eos/pcsaft_pure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,15 @@ fn helmholtz_energy_density<D: DualNum<f64> + Copy>(
let rhob = nb * density;
let aux = (rhoa - rhob) * delta + 1.0;
let sqrt = (aux * aux + rhob * delta * 4.0).sqrt();
let xa = (sqrt + 1.0 + (rhob - rhoa) * delta).recip() * 2.0;
let xb = (sqrt + 1.0 - (rhob - rhoa) * delta).recip() * 2.0;
let (xa, xb) = if na > nb {
let xb = (sqrt + aux).recip() * 2.0;
let xa = (rhob * delta * xb + 1.0).recip();
(xa, xb)
} else {
let xa = (sqrt - aux + 2.0).recip() * 2.0;
let xb = (rhoa * delta * xa + 1.0).recip();
(xa, xb)
};
let assoc = rhoa * (xa.ln() - xa * 0.5 + 0.5) + rhob * (xb.ln() - xb * 0.5 + 0.5);

non_assoc + assoc
Expand Down
Loading