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

ERROR neqsim.thermo.phase.PhaseEos - Failed to solve for molarVolume within the iteration limit #269

Open
maksymmoroz11 opened this issue Jun 11, 2024 · 2 comments

Comments

@maksymmoroz11
Copy link

Hello!

I have similar issue that has been mentioned in #241 and #267 and I haven't components with mole fraction 0.
I have used code from example but have written my gas composition from the real task:

import neqsim
from neqsim.neqsimpython import jNeqSim
from neqsim.thermo.thermoTools import *
import matplotlib.pyplot as plt


fluid0_HC = fluid('umr')
fluid0_HC.addComponent('nitrogen',2.5)
fluid0_HC.addComponent('CO2',4.5)
fluid0_HC.addComponent('methane',79.45)
fluid0_HC.addComponent('ethane',10)
fluid0_HC.addComponent('propane',2.5)
fluid0_HC.addComponent('i-butane',0.3)
fluid0_HC.addComponent('n-butane',0.5)
fluid0_HC.addComponent('22-dim-C3',0.01)
fluid0_HC.addComponent('i-pentane',0.05)
fluid0_HC.addComponent('n-pentane',0.05)
fluid0_HC.addComponent('n-hexane',0.05)
fluid0_HC.addComponent('benzene',0.02)
fluid0_HC.addComponent('c-hexane',0.02)
fluid0_HC.addComponent('n-heptane',0.02)
fluid0_HC.addComponent('toluene',0.01)
fluid0_HC.addComponent('n-octane',0.01)
fluid0_HC.setMixingRule("HV", "UNIFAC_UMRPRU")
thermoOps = jNeqSim.thermodynamicOperations.ThermodynamicOperations(fluid0_HC)
thermoOps.calcPTphaseEnvelope()

plt.plot(list(thermoOps.getOperation().get("dewT")),list(thermoOps.getOperation().get("dewP")), label="dew point")
plt.plot(list(thermoOps.getOperation().get("bubT")),list(thermoOps.getOperation().get("bubP")), label="bubble point")
plt.title('PT envelope')
plt.xlabel('Temperature [K]')
plt.ylabel('Pressure [bar]')
plt.legend()
plt.show()

When I tried to get PT envelope with exactly code I showed above with toluene in mixture I met an eror:
[main] ERROR neqsim.thermo.phase.PhaseEos - Failed to solve for molarVolume within the iteration limit.
and get obviously wrong PT envelope:
изображение.

But when I commented string with toluene adding, I didn't met any errors and got correct PT envelope:
изображение

I also met this error earlier with different gas composition and when I will reproduce it, I can send that code.
Could you please explain what is the root of this error and could you give limitations of gas composition NeqSim have, if they exist?

@maksymmoroz11
Copy link
Author

Hello!

Today I again got this error when I tried to got PT envelope with gas composition given above without toluene but with 0.03 % of n-octane instead of 0.01 %:

import neqsim
from neqsim.neqsimpython import jNeqSim
from neqsim.thermo.thermoTools import *
import matplotlib.pyplot as plt

fluid0_HC = fluid('umr')
fluid0_HC.addComponent('methane', 79.45)
fluid0_HC.addComponent('ethane', 10)
fluid0_HC.addComponent('propane', 2.5)
fluid0_HC.addComponent('i-butane', 0.3)
fluid0_HC.addComponent('n-butane', 0.5)
fluid0_HC.addComponent('i-pentane', 0.05)
fluid0_HC.addComponent('n-pentane', 0.05)
fluid0_HC.addComponent('22-dim-C3', 0.01)
fluid0_HC.addComponent('benzene', 0.02)
fluid0_HC.addComponent('c-hexane', 0.02)
fluid0_HC.addComponent('n-hexane', 0.05)
fluid0_HC.addComponent('n-heptane', 0.02)
fluid0_HC.addComponent('n-octane', 0.03)
fluid0_HC.addComponent('nitrogen', 2.5)
fluid0_HC.addComponent('CO2', 4.5)
fluid0_HC.setMixingRule("HV", "UNIFAC_UMRPRU")

thermoOps = jNeqSim.thermodynamicOperations.ThermodynamicOperations(fluid0_HC)
thermoOps.calcPTphaseEnvelope()

plt.plot(list(thermoOps.getOperation().get("dewT"))[:30],list(thermoOps.getOperation().get("dewP"))[:30], label="dew point")
plt.title('PT envelope')
plt.xlabel('Temperature [K]')
plt.ylabel('Pressure [bar]')
plt.legend()
plt.show()

@EvenSol
Copy link
Collaborator

EvenSol commented Jun 17, 2024

I will look into it.

It seems like getting the data using the following code will help:
plt.plot(list(thermoOps.getOperation().get("dewT2")),list(thermoOps.getOperation().get("dewP2")), label="dew point")
plt.plot(list(thermoOps.getOperation().get("bubT2")),list(thermoOps.getOperation().get("bubP2")), label="bubble point")

But this should be updated in a future version (so we dont have to check for data in more than one way).

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