CorySimon / pyIAST

Ideal Adsorbed Solution Theory
MIT License
47 stars 32 forks source link

LangmuirFreundlich isotherm #2

Closed Luthaf closed 8 years ago

Luthaf commented 8 years ago

I needed a Langmuir-Freundlich isotherm model for my research, so I added it to your code.

Please let my know if they are other places of the code that need to be updated!

CorySimon commented 8 years ago

Thanks!

Is it better to check for Python 3 in the setup.py rather than the source code? Also, what is the advantage of the init.py instead of putting the code in an src folder?

I didn't add Langmuir-Freundlich to the code because these functional forms do not obey the laws of thermodynamics, in that lim P-->0 N(P) !~ K * P. Please see the reference here:

http://onlinelibrary.wiley.com/doi/10.1002/aic.690341114/pdf Talu and Myers. Rigorous Thermodynamic Treatment of Gas Adsorption. AIChE J. 1988.

The Langmuir-Freundlich isotherm should not be used for IAST calculations since it does not obey Henry's law at infinite dilution. This is unlikely to make a difference for IAST calculations at large pressures, but when you start working with low pressures, I think it can introduce large errors. The integral for the spreading pressure diverges if the exponent is less than 1.0.

Luthaf commented 8 years ago

Is it better to check for Python 3 in the setup.py rather than the source code?

I added this because I ran pip install . and did not get any error until I tried to import the code. So yes, I think it is better to fail early here.

Also, what is the advantage of the init.py instead of putting the code in an src folder?

Namespace pollution. I had a file named isotherms.py in my folder, and I got weird errors when trying to run pyIAST.

The Langmuir-Freundlich isotherm should not be used for IAST calculations since it does not obey Henry's law at infinite dilution. This is unlikely to make a difference for IAST calculations at large pressures, but when you start working with low pressures, I think it can introduce large errors. The integral for the spreading pressure diverges if the exponent is less than 1.0.

Ok, I understand that you do not want it =). Maybe add this explanation in the doc? (in a "Why is missing?" section).

CorySimon commented 8 years ago

Thank you. I've merged into master your two other commits [I got to use the git cherry-pick command for the first time!] and added the idea of thermodynamic consistency to the FAQ. From what I remember, the errors should be small in using the Langmuir-Freundlich isotherm, unless you go to a very low pressure, but I image we shouldn't include it in the code to be conservative.