Open Danlira1991 opened 1 year ago
Dear Danlira,
Sorry about the late response. The alpha functions are usually stored at this file and the passed to the cubic EoS function when defining it (See for example, the end of this file).
Which function are you interested in? I might be able to help to implement it.
Gustavo
Hello, Gustavo!
Thanks for the answer. I'm trying to implement Aznar-Telles alpha function.
AAT1 = 0.46189 AAT2 = 0.94571 AAT3 = 0.16353 AAT0 = np.array([AAT1, AAT2, AAT3]) def alpha_AAT_mod(T, Tc, AAT0): Tr = np.array(T)/Tc alpha = np.exp(AAT1 (1 - Tr) abs(1 - Tr)*(AAT2 - 1) + AAT3 (Tc/T - 1)) return alpha
thanks for the reply.
I'm trying to implement Aznar-Telles alpha function.
The parameters for the compounds I am working on have not yet been estimated, so I used Hysys to generate some pseudo-experimental Psat data. With the Psat data it is possible to estimate AAT1, AAT2, AAT3 for the compounds.
The idea was to implement the Aznar-Telles Alpha function and the Heidemann-Kokal mixing rule and make a comparison with other mixing rules and other alpha functions.
Could you help me with this implementation? I have trouble compiling the changes I make to PhasePy files and testing. Do you have an email that we could correspond with more quickly?
Hey Danlira,
Implementing the alpha function should take that much time. I'm not familiar with the Heidemann-Kokal mixing rule. Do you suggest any reference to understand it better?
And yeah, feel free to email me: g.chaparro-maldonado21@imperial.ac.uk
Regards, Gustavo
Dear Danlira,
I'm thinking of providing a more flexible function to define custom cubic EoS, with custom c1
, c2
, alpha function and mixing rule. For this I've implemented a cubiceos
function. For this function to work properly, you need to provide the parameters of the alpha function to the alpha_params
attribute in the component object. As shown below, you can for example redefine a function the PR EoS.
import numpy as np
from phasepy import component, mixture, cubiceos, preos
from phasepy.cubic import alpha_soave, alpha_aat
water = component(name='water', Tc=647.13, Pc=220.55,
w=0.344861, GC={'H2O':1}, alpha_params=0.87440398)
ethanol = component(name='ethanol', Tc=514.0, Pc=61.37,
w=0.643558, GC={'CH3':1, 'CH2':1, 'OH(P)':1}, alpha_params=1.25538183)
mix = mixture(ethanol, water)
# or
mix = ethanol + water
mix.unifac()
# predefined PR EoS
eos = preos(mix, 'mhv_unifac')
# PR EoS with custom cubic eos function
c1 = 1.-np.sqrt(2.)
c2 = 1.+np.sqrt(2.)
custom_eos = cubiceos(mix, c1=c1, c2=c2, mixrule='mhv_unifac', alpha_eos=alpha_soave)
# test point
T = 450. # K
P = 1. # bar
x = np.array([0.3, 0.7])
print('Predefined PR EoS: ', eos.logfugef(x, T, P, 'V'))
print('PR EoS with custom cubic eos function: ', custom_eos.logfugef(x, T, P, 'V'))
The results are are as expected:
Predefined PR EoS: (array([-0.01014579, -0.00520807]), 37162.119657484945)
PR EoS with custom cubic eos function: (array([-0.01014579, -0.00520807]), 37162.119657544856)
I have also included the alpha_aat
function that you requested. You would need to provide the parameters AAT = [AAT1, AAT2, AAT3]
via the alpha_params
parameter.
I will upload the updated version shortly to GitHub.
Regards, Gustavo
Thanks a lot! One of the things I've been working on is estimating the AAT1, AAT2, AAT3 parameters for the substances I'm going to work with. Is there possible today in phasepy? Or we should write a specific function?
Hey Daniel,
For the moment, I haven't implemented that function. However, it shouldn't be that hard to code. See for example,fit_ksv
and fit_alpha
in this file.
Gustavo
Hello Gustavo, How are you?
I would like to add a new alpha function and a new mixing rule to phasepy. How could I run my modifications? Is it necessary to use a specific compiler? In jupyter notebook I couldn't.