Skip to content

bubble point pressre and temperature #395

@branch171

Description

@branch171

when using GERG2008 at 250 K for a 0.95,0.05 mixture of CO2 and N2 the bubble point calculation fails, returns nans.

The reason appears to be a function called bubbledew_check.

The bubble point convergence above this call is converge to 1e-11 error. However, bubbledew_check returns false and the result is ignored.

commenting out and making the converged to true always. Allows the correct bubble point line to be generated all the way the the critical point.

**There is some wrong in bubbledew_check it is returning false for what appears to be converge solutions.

function bubble_pressure(model::EoSModel, T, x, method::ThermodynamicMethod)
    x = x/sum(x)
    T = float(T)
    model_r,idx_r = index_reduction(model,x)
    if length(model_r)==1
        (P_sat,v_l,v_v) = saturation_pressure(model_r,T)
        return (P_sat,v_l,v_v,x)
    end
    x_r = x[idx_r]
    if has_a_res(model)
        bubble_pressure_result_primal = bubble_pressure_impl(primalval(model_r),primalval(T),primalval(x_r),index_reduction(method,idx_r))
        bubble_pressure_result = bubble_pressure_ad(model_r,T,x_r,bubble_pressure_result_primal)
    else
        bubble_pressure_result = bubble_pressure_impl(model_r,T,x_r,index_reduction(method,idx_r))
    end
    (P_sat, v_l, v_v, y_r) = bubble_pressure_result
    y = index_expansion(y_r,idx_r)
#    converged = bubbledew_check(model,P_sat,T,v_v,v_l,y,x)
    converged = true
    if converged
        return (P_sat, v_l, v_v, y)
    else
        nan = zero(v_l)/zero(v_l)
        y = y*nan
        return (nan,nan,nan,y)
    end
end

Metadata

Metadata

Assignees

Labels

Challenging equilibriaA model does not converge with our current solvers at certain conditions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions