-
Notifications
You must be signed in to change notification settings - Fork 52
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
BoundsError in example/mixing_functions notebook #171
Comments
reproducer:
seems related to an optimization on how the values of association are stored |
I'm now running through the example notebooks and alot of them have bugs; Ill make an issue with a compiled list of errors. |
more reduced reproducer:
|
found the culprit. i will add a test for that, and release a new version with the fixes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
running the mixing_functions notebook fails in input cell 6:
The error message is:
BoundsError: attempt to access 2-element StaticArraysCore.SVector{2, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}} with indices SOneTo(2) at index [1:3]
Stacktrace:
[1] throw_boundserror(A::StaticArraysCore.SVector{2, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}}, I::Tuple{UnitRange{Int64}})
@ Base ./abstractarray.jl:651
[2] checkbounds
@ ./abstractarray.jl:616 [inlined]
[3] view
@ ./subarray.jl:177 [inlined]
[4] getindex
@ ~/.julia/packages/PackedVectorsOfVectors/xTCMC/src/PackedVectorsOfVectors.jl:30 [inlined]
[5] a_assoc_impl(model::SAFTVRMie{BasicIdeal}, V::ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}, T::Float64, z::StaticArraysCore.SVector{1, Float64}, X_::PackedVectorsOfVectors.PackedVectorOfVectors{Vector{Int64}, StaticArraysCore.SVector{2, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}}, SubArray{ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}, 1, StaticArraysCore.SVector{2, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}}, Tuple{UnitRange{Int64}}, true}})
@ Clapeyron ~/.julia/packages/Clapeyron/kGA2x/src/models/SAFT/association.jl:379
[6] macro expansion
@ ~/.julia/packages/Clapeyron/kGA2x/src/utils/macros.jl:77 [inlined]
[7] a_assoc(model::SAFTVRMie{BasicIdeal}, V::ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}, T::Float64, z::StaticArraysCore.SVector{1, Float64}, data::Tuple{StaticArraysCore.SVector{1, Float64}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}, NTuple{4, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}, Float64})
@ Clapeyron ~/.julia/packages/Clapeyron/kGA2x/src/models/SAFT/association.jl:6
[8] a_assoc
@ ~/.julia/packages/Clapeyron/kGA2x/src/models/SAFT/SAFTgammaMie/equations.jl:122 [inlined]
[9] a_res(model::SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, V::ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}}, ForwardDiff.Dual{ForwardDiff.Tag{Clapeyron.var"#fAᵣ#179"{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, Float64, StaticArraysCore.SVector{1, Float64}}, Float64}, Float64, 1}, 1}, T::Float64, z::StaticArraysCore.SVector{1, Float64})
@ Clapeyron ~/.julia/packages/Clapeyron/kGA2x/src/models/SAFT/SAFTgammaMie/equations.jl:36
[10] eos_res
@ ~/.julia/packages/Clapeyron/kGA2x/src/base/EoSModel.jl:62 [inlined]
[11] fAᵣ
@ ~/.julia/packages/Clapeyron/kGA2x/src/methods/VT.jl:130 [inlined]
[12] f∂f
@ ~/.julia/packages/Clapeyron/kGA2x/src/solvers/ad.jl:32 [inlined]
[13] f∂f∂2f
@ ~/.julia/packages/Clapeyron/kGA2x/src/solvers/ad.jl:44 [inlined]
[14] second_virial_coefficient_impl(model::SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, T::Float64, z::StaticArraysCore.SVector{1, Float64})
@ Clapeyron ~/.julia/packages/Clapeyron/kGA2x/src/methods/VT.jl:131
[15] second_virial_coefficient
@ ~/.julia/packages/Clapeyron/kGA2x/src/methods/VT.jl:124 [inlined]
[16] volume_virial
@ ~/.julia/packages/Clapeyron/kGA2x/src/methods/property_solvers/volume.jl:60 [inlined]
[17] x0_volume_gas
@ ~/.julia/packages/Clapeyron/kGA2x/src/methods/initial_guess.jl:17 [inlined]
[18] x0_volume(model::SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, p::Float64, T::Float64, z::StaticArraysCore.SVector{1, Float64}; phase::Symbol)
@ Clapeyron ~/.julia/packages/Clapeyron/kGA2x/src/methods/initial_guess.jl:49
[19] volume_impl(model::SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, p::Float64, T::Float64, z::StaticArraysCore.SVector{1, Float64}, phase::Symbol, threaded::Bool, vol0::Nothing)
@ Clapeyron ~/.julia/packages/Clapeyron/kGA2x/src/methods/property_solvers/volume.jl:148
[20] #volume#191
@ ~/.julia/packages/Clapeyron/kGA2x/src/methods/property_solvers/volume.jl:118 [inlined]
[21] enthalpy(model::SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, p::Float64, T::Float64, z::StaticArraysCore.SVector{1, Float64}; phase::Symbol, threaded::Bool)
@ Clapeyron ~/.julia/packages/Clapeyron/kGA2x/src/methods/pT.jl:111
[22] mixing(model::SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}, p::Float64, T::Float64, z::Clapeyron.Fractions.FractionVector{Float64, Float64}, property::typeof(enthalpy); phase::Symbol, threaded::Bool)
@ Clapeyron ~/.julia/packages/Clapeyron/kGA2x/src/methods/pT.jl:421
[23] mixing
@ ~/.julia/packages/Clapeyron/kGA2x/src/methods/pT.jl:417 [inlined]
[24] _broadcast_getindex_evalf
@ ./broadcast.jl:648 [inlined]
[25] _broadcast_getindex
@ ./broadcast.jl:621 [inlined]
[26] getindex
@ ./broadcast.jl:575 [inlined]
[27] macro expansion
@ ./broadcast.jl:984 [inlined]
[28] macro expansion
@ ./simdloop.jl:77 [inlined]
[29] copyto!
@ ./broadcast.jl:983 [inlined]
[30] copyto!
@ ./broadcast.jl:936 [inlined]
[31] copy
@ ./broadcast.jl:908 [inlined]
[32] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(mixing), Tuple{Base.RefValue{SAFTgammaMie{BasicIdeal, SAFTVRMie{BasicIdeal}}}, Float64, Float64, Vector{Clapeyron.Fractions.FractionVector{Float64, Float64}}, Base.RefValue{typeof(enthalpy)}}})
@ Base.Broadcast ./broadcast.jl:883
[33] top-level scope
@ ./In[6]:5
The text was updated successfully, but these errors were encountered: