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

Difference in Molar Enthalpies between EoS and DFT #68

Closed
RolfStierle opened this issue Nov 8, 2022 · 2 comments
Closed

Difference in Molar Enthalpies between EoS and DFT #68

RolfStierle opened this issue Nov 8, 2022 · 2 comments
Milestone

Comments

@RolfStierle
Copy link
Contributor

RolfStierle commented Nov 8, 2022

Contributions.IdealGas uses different methods for EoS and DFT (see below).

Joback gives very small values for the IdealGas molar enthalpy (as fat as I tested all in the range ~1e-13 * JOULE).

import numpy as np

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

from feos.eos import EquationOfState, Contributions
from feos.eos import State as EosState
from feos.eos import PhaseEquilibrium as EosPhaseEquilibrium

from feos.dft import HelmholtzEnergyFunctional, PhaseEquilibrium
from feos.dft import State as DftState
from feos.dft import PhaseEquilibrium as DftPhaseEquilibrium

substances = ['nitrogen', 'methane']
params = PcSaftParameters.from_json(substances=substances, pure_path='pure_parameters.json', binary_path='binary_parameters.json', search_option=IdentifierOption.Name)

eos = EquationOfState.pcsaft(params)
dft = HelmholtzEnergyFunctional.pcsaft(params)

vle_eos = EosPhaseEquilibrium.bubble_point(eos, temperature_or_pressure=110*KELVIN, liquid_molefracs=np.array([0.1, 0.9]))
vle_dft = DftPhaseEquilibrium.bubble_point(dft, temperature_or_pressure=110*KELVIN, liquid_molefracs=np.array([0.1, 0.9]))

print(vle_eos.liquid.helmholtz_energy_contributions()) # Gives QSPR as IdealGas contribution
print(vle_dft.liquid.helmholtz_energy_contributions()) # Gives Joback as IdealGas contribution

print(vle_eos.liquid.molar_enthalpy(contributions=Contributions.ResidualNvt) - vle_dft.liquid.molar_enthalpy(contributions=Contributions.ResidualNvt)) #Gives very good agreement in the ResidualNvt contribution

print(vle_eos.liquid.molar_enthalpy(contributions=Contributions.IdealGas) - vle_dft.liquid.molar_enthalpy(contributions=Contributions.IdealGas)) # Gives large discrepancy in IdealGas contribution
@prehner
Copy link
Contributor

prehner commented Nov 8, 2022

Thanks for raising this issue. To be completely aware of what is happening, we would need the content of your pure_parameters.json file, but the fact that Joback gives ~0 and the other outputs suggest, that it does not contain Joback parameters. In this case the eos will fall back on the QSPR method whereas the functional will use Joback where all parameters are 0.

It is indeed confusing behavior that we should attempt to make more transparent.

@prehner
Copy link
Contributor

prehner commented Jan 12, 2023

Closed in favor of #109

@prehner prehner closed this as completed Jan 12, 2023
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

2 participants