ClapeyronThermo / Clapeyron.jl

Clapeyron provides a framework for the development and use of fluid-thermodynamic models, including SAFT, cubic, activity, multi-parameter, and COSMO-SAC.
https://clapeyronthermo.github.io/Clapeyron.jl/
MIT License
213 stars 52 forks source link

Volume solver stability check bypassed #96

Closed lucpaoli closed 2 years ago

lucpaoli commented 2 years ago

In the volume solver, should all be operating normally (under critical point, two volume roots found etc), the gibbs free energies of the phases are checked, and the phase that minimises gibbs is returned:

    if gg<gl
        isstable(model,Vg,T,z,phase)
        return Vg
    else
        isstable(model, Vl, T, z, phase)
        return Vl
    end

However, by passing the phase to the stability check isstable, the isstable function automatically returns true

function isstable(model, V, T, z, phase=:stable)
    if phase != :stable
        return true
...etc

This doesn't seem like the intended use of the stability check, is this how it's intended to be used?

longemen3000 commented 2 years ago

the default volume solver only performs mechanical stability (it is done in volume_compress). when passing the :stable symbol to the model, it will perform the full stability check , but this kw should be open to the api, i will fix that ASAP