Skip to content

Conversation

@prehner
Copy link
Contributor

@prehner prehner commented Mar 17, 2024

The generic association implementation in FeOs already allows arbitrary numbers of association sites. This PR now enables the parametrization of PC-SAFT with multiple (distinguishable) association sites on the same molecule. The group contribution method is adjusted accordingly. Because this is a niche application, some extra effort is undertaken to make sure that the old interfaces can all still be used (json or building records by hand).

The example below shows how to construct molecules with multiple association sites. Because the sites are actually indistinguishable in the example, it is faster to just adjust the multiplicity of the association site (na/nb). In general, however, multiple association sites cannot be combined into a single one without losing information.

record1 = PureRecord(Identifier(), 0.0, m=2.5, sigma=3.5, epsilon_k=250., association_sites=[{"kappa_ab": 0.005, "epsilon_k_ab": 1500, "na": 1, "nb": 2}])
record2 = PureRecord(Identifier(), 0.0, m=2.5, sigma=3.5, epsilon_k=250., association_sites=[{"kappa_ab": 0.005, "epsilon_k_ab": 1500, "na": 1, "nb": 1}, {"kappa_ab": 0.005, "epsilon_k_ab": 1500, "nb": 1}])

for record in [record1, record2]:
    eos = EquationOfState.pcsaft(Parameters.new_pure(record))
    %timeit State.critical_point(eos)
    print(record.to_json_str())
    print(State.critical_point(eos))
    print()
95.2 μs ± 470 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
{"identifier":{},"m":2.5,"sigma":3.5,"epsilon_k":250.0,"association_sites":[{"kappa_ab":0.005,"epsilon_k_ab":1500,"na":1.0,"nb":2.0}]}
T = 515.18801 K, ρ = 4.31012 kmol/m³

238 μs ± 9.03 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
{"identifier":{},"m":2.5,"sigma":3.5,"epsilon_k":250.0,"association_sites":[{"kappa_ab":0.005,"epsilon_k_ab":1500,"na":1.0,"nb":1.0},{"kappa_ab":0.005,"epsilon_k_ab":1500,"nb":1.0}]}
T = 515.18801 K, ρ = 4.31012 kmol/m³

@prehner prehner added this to the v0.7.0 milestone Mar 17, 2024
@prehner prehner marked this pull request as draft April 17, 2024 19:12
@prehner prehner force-pushed the multiple_assoc_pcsaft branch from b70034f to aa7b237 Compare April 22, 2024 13:52
@prehner prehner marked this pull request as ready for review April 23, 2024 06:41
@prehner prehner removed this from the v0.7.0 milestone Apr 29, 2024
@prehner prehner added the pcsaft Related to the PC-SAFT model label Dec 8, 2024
@prehner prehner force-pushed the multiple_assoc_pcsaft branch from d1e4ba9 to 692bd68 Compare April 23, 2025 09:23
@prehner prehner changed the base branch from main to restructure_crates April 23, 2025 09:24
@prehner prehner force-pushed the multiple_assoc_pcsaft branch 2 times, most recently from a560738 to b4c5226 Compare April 25, 2025 08:15
Base automatically changed from restructure_crates to main April 25, 2025 12:07
@prehner prehner force-pushed the multiple_assoc_pcsaft branch 3 times, most recently from 885dc78 to d46ad8b Compare April 30, 2025 21:32
@prehner prehner force-pushed the multiple_assoc_pcsaft branch from 6cc28bd to dc18831 Compare June 12, 2025 16:37
@prehner prehner force-pushed the multiple_assoc_pcsaft branch from dc18831 to d692d8d Compare June 12, 2025 16:40
@prehner prehner changed the title Allow multiple association sites per molecule in PC-SAFT Allow multiple association sites per molecule Jun 16, 2025
@prehner
Copy link
Contributor Author

prehner commented Jun 20, 2025

To achieve the maximum flexibility regarding parametrization of association schemes, this PR reformulates the structs and traits used for parameter handling significantly with the biggest change coming from the replacement of the Parameter trait with the GcParameters struct and its trait aliases Parameters and IdealGasParameters

@prehner prehner merged commit 0129c5a into main Jun 20, 2025
15 checks passed
@prehner prehner deleted the multiple_assoc_pcsaft branch June 20, 2025 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pcsaft Related to the PC-SAFT model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants