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

Allow multiple association sites per molecule in PC-SAFT #233

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

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.

from feos.pcsaft import *
from feos.eos import *
from feos.si import *

record1 = PcSaftRecord(2.5, 3.5, 250., kappa_ab=0.005, epsilon_k_ab=1500, na=1, nb=2)
record2 = PcSaftRecord(2.5, 3.5, 250., association_records=[AssociationRecord(kappa_ab=0.005, epsilon_k_ab=1500, na=1, nb=1), AssociationRecord(kappa_ab=0.005, epsilon_k_ab=1500, nb=1)])

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

237 µs ± 314 ns per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
{"m":2.5,"sigma":3.5,"epsilon_k":250.0,"association_records":[{"kappa_ab":0.005,"epsilon_k_ab":1500.0,"na":1.0,"nb":1.0},{"kappa_ab":0.005,"epsilon_k_ab":1500.0,"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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant