Allow multiple association sites per molecule in PC-SAFT
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 import *
from feos.parameters import *
import si_units as si
record1 = PureRecord(Identifier(), 0.0, m=2.5, sigma=3.5, epsilon_k=250., 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_records=[{"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 μs ± 90.3 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
{"identifier":{},"molarweight":0.0,"model_record":{"m":2.5,"sigma":3.5,"epsilon_k":250.0,"kappa_ab":0.005,"epsilon_k_ab":1500,"na":1,"nb":2}}
T = 515.18801 K, ρ = 4.31012 kmol/m³
228 μs ± 314 ns per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
{"identifier":{},"molarweight":0.0,"model_record":{"m":2.5,"sigma":3.5,"epsilon_k":250.0,"association_records":[{"kappa_ab":0.005,"epsilon_k_ab":1500,"na":1,"nb":1},{"kappa_ab":0.005,"epsilon_k_ab":1500,"nb":1}]}}
T = 515.18801 K, ρ = 4.31012 kmol/m³