chmarti1 / PYroMat

PYroMat thermodynamic properties in Python
http://pyromat.org
Other
71 stars 13 forks source link

Convergence failure with high densities #46

Closed chmarti1 closed 1 year ago

chmarti1 commented 2 years ago

In version 2.2.1 and probably before, there are some multi-phase models (like N2 and CO2) that fail to converge at low temperatures and very high pressures. The minimum,maximum density limits contained in the multi-phase dlim data element are not used by the front end, but they are used to establish iteration boundaries in the back-end. A standard value of 1600kg/m3 was set when developing for steam, and it was kept by default when expanding to other substances. Through an oversight, it was never re-evaluated for other substances, so certain high-pressure, low-temperature conditions are not currently accessible even though they should be. It wasn't caught in development because most validating data sets provided by the original model authors do not include data at the extrema - the focus is usually near the critical point and the phase transitions.

This will be fixed in a future release, but in the meantime, users can quickly fix this themselves if it becomes a problem. Users can manually overwrite the loaded data (this is not permanent). In this example, we reset the maximum density to be 2000kg/m3.

import pyromat as pm
co2 = pm.get('mp.CO2')
>>> co2.h(T=190., p=7900.)
... raises an error ...
>>> co2.data['dlim'] = [0., 2000.]
>>> co2.h(T=190., p=7900.)
array([-64.1399237])
chmarti1 commented 1 year ago

This is now resolved with new density limits in version 2.2.2.