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

Saturation solves fail moving from 0.5.7 to 0.5.8 #237

Closed
lucpaoli opened this issue Dec 4, 2023 · 4 comments
Closed

Saturation solves fail moving from 0.5.7 to 0.5.8 #237

lucpaoli opened this issue Dec 4, 2023 · 4 comments

Comments

@lucpaoli
Copy link
Contributor

lucpaoli commented Dec 4, 2023

Hey all,

With the update from 0.5.7 to 0.5.8, the saturation solver as we're using it seems to have become less robust, frequently breaking during iterations.

If you look on the SAFT_ML github page (which I think you all have access to), the difference can be seen in the output log between the runs in 22_tests vs the runs in 23_updated_Clapeyron, where "updated_Clapeyron" refers to us downgrading from 0.5.8. to 0.5.7.

I'm afraid I don't have any time to try to validate a minimum working example right now, but an example case where it was failing on for us is:
Sat solver failed for heptacosane = [380.44, 2.0, 3.0, 6.0, 20.01, 200.51] at T=94.33, Tc=266.06, muting...
where those parameters are input into SAFT VR Mie.

@lucpaoli lucpaoli changed the title Code broke from 0.5.7 updating to 0.5.8 Saturation solves fail moving from 0.5.7 to 0.5.8 Dec 4, 2023
@lucpaoli
Copy link
Contributor Author

lucpaoli commented Dec 4, 2023

It's worth noting we're not using the default initial guess during our iterations as well

@longemen3000
Copy link
Member

Hmm, there was an update to increase accuracy on x0_sat_pure, but if it causes this, it needs to be reverted

@longemen3000
Copy link
Member

@lucpaoli hmmm, i'm afraid i would need that initial point, we did add an stricter check here:

function check_valid_sat_pure(model,P_sat,V_l,V_v,T,ε0 = 5e7)
ε = abs(V_l-V_v)/(eps(typeof(V_l-V_v)))
ε <= ε0 && return false
pl,dpdvl = p∂p∂V(model,V_l,T,SA[1.0])
pv,dpdvv = p∂p∂V(model,V_v,T,SA[1.0])
ε1 = ε0*eps(P_sat)
return (dpdvl <= 0) && #mechanical stability of the liquid phase
(dpdvv <= 0) && #mechanical stability of the vapour phase
(1 - pl/P_sat < ε1) && #calculated pressure for liquid phase is aproximately the same
(1 - pv/P_sat < ε1) #calculated pressure for vapour phase is aproximately the same
#if ΔV > ε then Vl and Vv are different values
end

so if pressures deviate significantly, then it would fail instead of giving an incorrect result

longemen3000 added a commit that referenced this issue Jan 3, 2024
@longemen3000
Copy link
Member

this would be solved on 0.5.10 (the check was done at the solver level instead)

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