Need Gibbs Seawater (GSW) Equation of State to be ported to Julia

Ahhh, i know whats happening, give one moment and i fix the error on the last master (the number 6 comes from m.Aijindices

1 Like

I really appreciate it! I figured it’s not a big deal, let me know if I can help in anyway :). But getting molar or mass density would immediately make your package better then CoolProp!

pressure(m,2u"kg/m^3",300u"K",[0.1,0.2])

pressure accepts molar fractions, the sum of that isn’t 1.0, but that isn’t the problem anyway.
also. in the last master i added a pt_flash function, if you want to test (it has a lot of errors, but for simple phases works) (i updated just now)

1 Like

Works great now!

I’ll keep playing with it.

1 Like

why I am getting error?

C=[56.6, 6.0 ,7.7]
T=[6.7 ,8.8, 8.0]
P=[10.9 , 77.0 ,88.0]

sp=gsw_sp_from_c(C,T,P)
ERROR: MethodError: Cannot convert an object of type Array{Float64,1} to an object of type Float64
Closest candidates are:
convert(::Type{T}, ::T) where T<:Number at number.jl:6
convert(::Type{T}, ::Number) where T<:Number at number.jl:7
convert(::Type{T}, ::Base.TwicePrecision) where T<:Number at twiceprecision.jl:250

Stacktrace:
[1] cconvert(::Type{T} where T, ::Array{Float64,1}) at .\essentials.jl:390
[2] gsw_sp_from_c(::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}) at C:\Users\hafez.julia\packages\GibbsSeaWater\NcNJk\src\gen_gswteos10.jl:622
[3] top-level scope at none:0

That error happened because that function accepts numbers, not vectors. It can be solved via broadcasting the function over the vector arguments: gsw_sp_from_c.(C, T, P)

2 Likes