Closed chris-hampel-CA closed 10 months ago
it seems that this is working?. this is following the code inside CoolProp.jl and the reference here: http://www.coolprop.org/_static/doxygen/html/_cool_prop_lib_8h.html#a5a8c945ef738c0150e92e9cd3f661ee6
function AbstractState_get_mole_fractions_satState(handle::Clong,saturated_state::String,fracs::Vector{Float64})
_sat = Vector{UInt8}(saturated_state)
ccall((:AbstractState_get_mole_fractions_satState , CoolProp.libcoolprop),
Cvoid,
(Clong,Ptr{UInt8},Ptr{Cdouble},Clong,Clong,
Ref{Clong}, Ptr{UInt8}, Clong),
handle, _sat, fracs, length(fracs), 1,
CoolProp.errcode, CoolProp.message_buffer::Array{UInt8, 1}, CoolProp.buffer_length)
CoolProp.raise(CoolProp.errcode, CoolProp.message_buffer)
end
This C function exists as you referenced, but the Julia wrapper function is missing in this repository. I have a fork going and was able to successfully run the wrapped function.
function AbstractState_get_mole_fractions_satState(handle::Clong, saturated_state::AbstractString,
fractions::Array{Float64})
ccall( (:AbstractState_get_mole_fractions_satState, libcoolprop), Nothing, (Clong, Cstring, Ptr{Cdouble}, Clong, Ref{Clong}, Ref{Clong}, Ptr{UInt8}, Clong), handle, saturated_state, fractions, maxN, length(fractions), errcode, message_buffer::Array{UInt8, 1}, buffer_length)
raise(errcode, message_buffer)
return nothing
end
where I defined const maxN = 50
above. I believe this is the limit of the number of species in a fluid model. I used an arbitrarily high value for now.
AbstractState_get_mole_fractions_satState
is not currently available in this repository, while it is available through the python interface. See the definition of the function here linkWithout this, you cannot find vapor and liquid fractions of a mixture. I have done this successfullyalready in Julia using
Pycall
; however, I have found it is significantly slower when comparing other existingCoolProp.jl
calls to their python analogs. This has become problematic with my work which requires iterative solving. Making this function available inCoolProp.jl
will be helpful for my issue, specifically, and for others that might run into the same issue down the road.