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

Feature Request for PCSAFT Temperature-dependent kij for Unlike Interactions #215

Open
samuel-zhang01 opened this issue Oct 17, 2023 · 4 comments

Comments

@samuel-zhang01
Copy link

To the lovely developers of Clapeyron.jl ☕

I've been playing around with temperature dependent Lorenz-Berthelot binary interacting constants in pharmaPCSAFT, I was wondering if you guys are keen to also implement an optional $k_{ij}=k_{ij,slope}\times T+k_{ij,constant}$ feature for PCSAFT if the user would like to use this specific model.

I have coded up some incredibly slow workarounds reading and modifying .csv database files on the go with great results, however, the speed is atrocious due to overheads writing and reading from files.

Below is a quick mockup of what the potential database file looks like.

Clapeyron Database File
PCSAFT Unlike Parameters
species1 SMILES1 species2 SMILES2 kT kc k
ethanol2013 lidocaine2013 7.74e-7 0.01152 0.01177155
... ... ... ... ... ... ...

Cheers and have the best time 🐒

@longemen3000
Copy link
Member

Hi,

Technically, if you don't use water08 in pharmaPCSAFT, it becomes functionally identical to PCSAFT (with the ESD combining rule for assoc)

@samuel-zhang01
Copy link
Author

A futher question to bug you, how to specify not to use water08 or water? Do i just delete it from the database?

@longemen3000
Copy link
Member

longemen3000 commented Oct 17, 2023

to clarify the differences, only when a component named water08 is used, then the EoS will use the T-dependent sigma correlation. for example:

  • pharmaPCSAFT(["methane"]) : Will not use the correlation (does not contain water08)
  • pharmaPCSAFT(["water"]) : Will not use the correlation (does not contain water08)
  • pharmaPCSAFT(["water08"]) : Will use the correlation
  • pharmaPCSAFT(["methane","ethane"]) : Will not use the correlation (does not contain water08)
  • pharmaPCSAFT(["water","ethanol"]) : Will not use the correlation (does not contain water08)
  • pharmaPCSAFT(["water08","ethanol"]) : Will use the correlation

In summary, you can opt-out of using that correlation by simply not using water08. If you are using your own database, you can just delete water08 and it will be fine
On implementation details, we actually divide the correlation in two terms:
σ(T) = σ0+ Δσ(T)

So, water08 contains a constant sigma in the database that corresponds to the constant part of the correlation. the variable part of the correlation is only implemented in pharmaPCSAFT, because it has a fast way to check if the correlation is used. In fact, one of the bugs in #212 was caused by the lack of a function for thatcheck (a struct named SpecialComp)

@pw0908
Copy link
Member

pw0908 commented Oct 17, 2023

As far as allowing for greater flexibility in the combining rules is concerned, it is something that we have thought about for a while. Something similar to our treatment of mixing rules in cubics might be an option. In this framework, someone would need to provide both the functional form for kij(T) and the parameters. Maybe something like this:

model = PCSAFT(["methanol","benzene"]; combining= k(T;coef) = coef[1]+coef[2]*T, userlocations=["unlike.csv"])

Thoughts @longemen3000?

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

No branches or pull requests

3 participants