I define a custom struct
to hold the parameters for the coupled ODEs I’m solving with OrdinaryDiffEq.jl
, which typically stores various numbers and arrays (1D or 2D), as well as vectors of dualcache vectors in par.dualcache
for storing intermediate output when doing in-place calculation for the ODE RHS function fun!(du,u,par,t)
,
i.e.typeof(par.dualcache) = Vector{DiffCache{Vector{Float64}, Vector{Float64}}} (alias for Array{PreallocationTools.DiffCache{Array{Float64, 1}, Array{Float64, 1}}, 1})
Sometimes I’m not exactly sure what information I will ultimately need when doing the analysis at the time of running the simulation, so I just the whole ODESolution
output using JLD2.jl
. The problem is that sometimes after a while when I have (intentionally or accidentally) updated the packages, then when I want to open the .jld2
file, I have the following error:
MethodError: Cannot `convert` an object of type
JLD2.ReconstructedStatic{Symbol("SciMLBase.UJacobianWrapper{JLD2.ReconstructedStatic{Symbol(\"ODEFunction{true, SciMLBase.FullSpecialize, JLD2.UnknownType{Symbol(\\\"OptControl.#TFE1D!\\\"), Tuple{}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}\"), (:mass_matrix, :jac_prototype, :sparsity), Tuple{UniformScaling{Bool}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}, Float64, JLD2.ReconstructedMutable{Symbol(\"ModelParams{Vector{Float64},Float64,Float64,Nothing,Nothing,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}},Nothing}\"), (:D, :V, :εr, :W, :A, :dims, :order, :tf, :Nx, :Lx, :x0, :Ny, :Ly, :y0, :x, :dx, :y, :dy, :area, :hmean, :caches), Tuple{Any, Float64, Float64, Float64, Float64, Int64, Int64, Float64, Int64, Float64, Float64, Int64, Float64, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Float64, Float64, Any}}}"), (:f, :t, :p), Tuple{JLD2.ReconstructedStatic{Symbol("ODEFunction{true, SciMLBase.FullSpecialize, JLD2.UnknownType{Symbol(\"OptControl.#TFE1D!\"), Tuple{}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}"), (:mass_matrix, :jac_prototype, :sparsity), Tuple{UniformScaling{Bool}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}, Float64, JLD2.ReconstructedMutable{Symbol("ModelParams{Vector{Float64},Float64,Float64,Nothing,Nothing,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}},Nothing}"), (:D, :V, :εr, :W, :A, :dims, :order, :tf, :Nx, :Lx, :x0, :Ny, :Ly, :y0, :x, :dx, :y, :dy, :area, :hmean, :caches), Tuple{Any, Float64, Float64, Float64, Float64, Int64, Int64, Float64, Int64, Float64, Float64, Int64, Float64, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Float64, Float64, Any}}}} to an object of type
SciMLBase.UJacobianWrapper{JLD2.ReconstructedStatic{Symbol("ODEFunction{true, SciMLBase.FullSpecialize, JLD2.UnknownType{Symbol(\"OptControl.#TFE1D!\"), Tuple{}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}"), (:mass_matrix, :jac_prototype, :sparsity), Tuple{UniformScaling{Bool}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}, Float64, JLD2.ReconstructedMutable{Symbol("ModelParams{Vector{Float64},Float64,Float64,Nothing,Nothing,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}},Nothing}"), (:D, :V, :εr, :W, :A, :dims, :order, :tf, :Nx, :Lx, :x0, :Ny, :Ly, :y0, :x, :dx, :y, :dy, :area, :hmean, :caches), Tuple{Any, Float64, Float64, Float64, Float64, Int64, Int64, Float64, Int64, Float64, Float64, Int64, Float64, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Float64, Float64, Any}}}
Closest candidates are:
convert(::Type{T}, ::T) where T
@ Base Base.jl:64
Stacktrace:
[1] rconvert(T::Type, x::JLD2.ReconstructedStatic{Symbol("SciMLBase.UJacobianWrapper{JLD2.ReconstructedStatic{Symbol(\"ODEFunction{true, SciMLBase.FullSpecialize, JLD2.UnknownType{Symbol(\\\"OptControl.#TFE1D!\\\"), Tuple{}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}\"), (:mass_matrix, :jac_prototype, :sparsity), Tuple{UniformScaling{Bool}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}, Float64, JLD2.ReconstructedMutable{Symbol(\"ModelParams{Vector{Float64},Float64,Float64,Nothing,Nothing,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}},Nothing}\"), (:D, :V, :εr, :W, :A, :dims, :order, :tf, :Nx, :Lx, :x0, :Ny, :Ly, :y0, :x, :dx, :y, :dy, :area, :hmean, :caches), Tuple{Any, Float64, Float64, Float64, Float64, Int64, Int64, Float64, Int64, Float64, Float64, Int64, Float64, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Float64, Float64, Any}}}"), (:f, :t, :p), Tuple{JLD2.ReconstructedStatic{Symbol("ODEFunction{true, SciMLBase.FullSpecialize, JLD2.UnknownType{Symbol(\"OptControl.#TFE1D!\"), Tuple{}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}"), (:mass_matrix, :jac_prototype, :sparsity), Tuple{UniformScaling{Bool}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}, Float64, JLD2.ReconstructedMutable{Symbol("ModelParams{Vector{Float64},Float64,Float64,Nothing,Nothing,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}},Nothing}"), (:D, :V, :εr, :W, :A, :dims, :order, :tf, :Nx, :Lx, :x0, :Ny, :Ly, :y0, :x, :dx, :y, :dy, :area, :hmean, :caches), Tuple{Any, Float64, Float64, Float64, Float64, Int64, Int64, Float64, Int64, Float64, Float64, Int64, Float64, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Float64, Float64, Any}}}})
@ JLD2 C:\Users\yhcha\.julia\packages\JLD2\u57Vt\src\data\custom_serialization.jl:9
[2] jlconvert
@ C:\Users\yhcha\.julia\packages\JLD2\u57Vt\src\data\writing_datatypes.jl:315 [inlined]
[3] macro expansion
@ C:\Users\yhcha\.julia\packages\JLD2\u57Vt\src\data\reconstructing_datatypes.jl:720 [inlined]
[4] jlconvert(#unused#::JLD2.ReadRepresentation{OrdinaryDiffEq.NLNewtonCache{Vector{Float64}, Float64, Float64, Vector{Float64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SciMLBase.UJacobianWrapper{JLD2.ReconstructedStatic{Symbol("ODEFunction{true, SciMLBase.FullSpecialize, JLD2.UnknownType{Symbol(\"OptControl.#TFE1D!\"), Tuple{}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}"), (:mass_matrix, :jac_prototype, :sparsity), Tuple{UniformScaling{Bool}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}, Float64, JLD2.ReconstructedMutable{Symbol("ModelParams{Vector{Float64},Float64,Float64,Nothing,Nothing,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}},Nothing}"), (:D, :V, :εr, :W, :A, :dims, :order, :tf, :Nx, :Lx, :x0, :Ny, :Ly, :y0, :x, :dx, :y, :dy, :area, :hmean, :caches), Tuple{Any, Float64, Float64, Float64, Float64, Int64, Int64, Float64, Int64, Float64, Float64, Int64, Float64, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Float64, Float64, Any}}}, FiniteDiff.JacobianCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Val{:forward}(), Float64}, LinearSolve.LinearCache{SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, LinearSolve.DefaultLinearSolver, LinearSolve.DefaultLinearSolverInit{SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, SparseArrays.SPQR.QRSparse{Float64, Int64}, Nothing, Nothing, Sparspak.SpkSparseSolver.SparseSolver{Int64, Float64}, KLU.KLUFactorization{Float64, Int64}, SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, Nothing, SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, Tuple{Nothing, Nothing}, Nothing, Nothing, SparseArrays.CHOLMOD.Factor{Float64}, Nothing, SparseArrays.CHOLMOD.Factor{Float64}, SparseArrays.CHOLMOD.Factor{Float64}}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64, Bool}}, JLD2.OnDiskRepresentation{(0, 8, 16, 24, 32, 40, 80, 120, 121, 122, 123, 131, 139, 147, 155, 163, 171, 179, 187), Tuple{Vector{Float64}, Float64, Vector{Float64}, Vector{Float64}, Vector{Float64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Bool, Bool, Bool, Float64, Vector{Float64}, SciMLBase.UJacobianWrapper{JLD2.ReconstructedStatic{Symbol("ODEFunction{true, SciMLBase.FullSpecialize, JLD2.UnknownType{Symbol(\"OptControl.#TFE1D!\"), Tuple{}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}"), (:mass_matrix, :jac_prototype, :sparsity), Tuple{UniformScaling{Bool}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}, Float64, JLD2.ReconstructedMutable{Symbol("ModelParams{Vector{Float64},Float64,Float64,Nothing,Nothing,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}},Nothing}"), (:D, :V, :εr, :W, :A, :dims, :order, :tf, :Nx, :Lx, :x0, :Ny, :Ly, :y0, :x, :dx, :y, :dy, :area, :hmean, :caches), Tuple{Any, Float64, Float64, Float64, Float64, Int64, Int64, Float64, Int64, Float64, Float64, Int64, Float64, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Float64, Float64, Any}}}, FiniteDiff.JacobianCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Val{:forward}(), Float64}, LinearSolve.LinearCache{SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, LinearSolve.DefaultLinearSolver, LinearSolve.DefaultLinearSolverInit{SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, SparseArrays.SPQR.QRSparse{Float64, Int64}, Nothing, Nothing, Sparspak.SpkSparseSolver.SparseSolver{Int64, Float64}, KLU.KLUFactorization{Float64, Int64}, SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, Nothing, SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, Tuple{Nothing, Nothing}, Nothing, Nothing, SparseArrays.CHOLMOD.Factor{Float64}, Nothing, SparseArrays.CHOLMOD.Factor{Float64}, SparseArrays.CHOLMOD.Factor{Float64}}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64, Bool}, Vector{Float64}, Float64, Float64, Float64}, Tuple{JLD2.RelOffset, Float64, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset, JLD2.OnDiskRepresentation{(0, 8, 16, 24, 32), Tuple{Int64, Int64, Vector{Int64}, Vector{Int64}, Vector{Float64}}, Tuple{Int64, Int64, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset}, 40}(), JLD2.OnDiskRepresentation{(0, 8, 16, 24, 32), Tuple{Int64, Int64, Vector{Int64}, Vector{Int64}, Vector{Float64}}, Tuple{Int64, Int64, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset}, 40}(), Bool, Bool, Bool, Float64, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset, Float64, Float64, Float64}, 195}()}, f::JLD2.JLDFile{JLD2.MmapIO}, ptr::Ptr{Nothing}, header_offset::JLD2.RelOffset)
@ JLD2 C:\Users\yhcha\.julia\packages\JLD2\u57Vt\src\data\reconstructing_datatypes.jl:685
[5] read_scalar(f::JLD2.JLDFile{JLD2.MmapIO}, rr::JLD2.ReadRepresentation{OrdinaryDiffEq.NLNewtonCache{Vector{Float64}, Float64, Float64, Vector{Float64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SciMLBase.UJacobianWrapper{JLD2.ReconstructedStatic{Symbol("ODEFunction{true, SciMLBase.FullSpecialize, JLD2.UnknownType{Symbol(\"OptControl.#TFE1D!\"), Tuple{}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}"), (:mass_matrix, :jac_prototype, :sparsity), Tuple{UniformScaling{Bool}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}, Float64, JLD2.ReconstructedMutable{Symbol("ModelParams{Vector{Float64},Float64,Float64,Nothing,Nothing,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}},Nothing}"), (:D, :V, :εr, :W, :A, :dims, :order, :tf, :Nx, :Lx, :x0, :Ny, :Ly, :y0, :x, :dx, :y, :dy, :area, :hmean, :caches), Tuple{Any, Float64, Float64, Float64, Float64, Int64, Int64, Float64, Int64, Float64, Float64, Int64, Float64, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Float64, Float64, Any}}}, FiniteDiff.JacobianCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Val{:forward}(), Float64}, LinearSolve.LinearCache{SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, LinearSolve.DefaultLinearSolver, LinearSolve.DefaultLinearSolverInit{SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, SparseArrays.SPQR.QRSparse{Float64, Int64}, Nothing, Nothing, Sparspak.SpkSparseSolver.SparseSolver{Int64, Float64}, KLU.KLUFactorization{Float64, Int64}, SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, Nothing, SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, Tuple{Nothing, Nothing}, Nothing, Nothing, SparseArrays.CHOLMOD.Factor{Float64}, Nothing, SparseArrays.CHOLMOD.Factor{Float64}, SparseArrays.CHOLMOD.Factor{Float64}}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64, Bool}}, JLD2.OnDiskRepresentation{(0, 8, 16, 24, 32, 40, 80, 120, 121, 122, 123, 131, 139, 147, 155, 163, 171, 179, 187), Tuple{Vector{Float64}, Float64, Vector{Float64}, Vector{Float64}, Vector{Float64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Bool, Bool, Bool, Float64, Vector{Float64}, SciMLBase.UJacobianWrapper{JLD2.ReconstructedStatic{Symbol("ODEFunction{true, SciMLBase.FullSpecialize, JLD2.UnknownType{Symbol(\"OptControl.#TFE1D!\"), Tuple{}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}"), (:mass_matrix, :jac_prototype, :sparsity), Tuple{UniformScaling{Bool}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}}, Float64, JLD2.ReconstructedMutable{Symbol("ModelParams{Vector{Float64},Float64,Float64,Nothing,Nothing,StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64},Vector{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}},Nothing}"), (:D, :V, :εr, :W, :A, :dims, :order, :tf, :Nx, :Lx, :x0, :Ny, :Ly, :y0, :x, :dx, :y, :dy, :area, :hmean, :caches), Tuple{Any, Float64, Float64, Float64, Float64, Int64, Int64, Float64, Int64, Float64, Float64, Int64, Float64, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Float64, Float64, Float64, Any}}}, FiniteDiff.JacobianCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}, Val{:forward}(), Float64}, LinearSolve.LinearCache{SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, LinearSolve.DefaultLinearSolver, LinearSolve.DefaultLinearSolverInit{SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, SparseArrays.SPQR.QRSparse{Float64, Int64}, Nothing, Nothing, Sparspak.SpkSparseSolver.SparseSolver{Int64, Float64}, KLU.KLUFactorization{Float64, Int64}, SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, Nothing, SparseArrays.UMFPACK.UmfpackLU{Float64, Int64}, Tuple{Nothing, Nothing}, Nothing, Nothing, SparseArrays.CHOLMOD.Factor{Float64}, Nothing, SparseArrays.CHOLMOD.Factor{Float64}, SparseArrays.CHOLMOD.Factor{Float64}}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64, Bool}, Vector{Float64}, Float64, Float64, Float64}, Tuple{JLD2.RelOffset, Float64, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset, JLD2.OnDiskRepresentation{(0, 8, 16, 24, 32), Tuple{Int64, Int64, Vector{Int64}, Vector{Int64}, Vector{Float64}}, Tuple{Int64, Int64, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset}, 40}(), JLD2.OnDiskRepresentation{(0, 8, 16, 24, 32), Tuple{Int64, Int64, Vector{Int64}, Vector{Int64}, Vector{Float64}}, Tuple{Int64, Int64, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset}, 40}(), Bool, Bool, Bool, Float64, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset, JLD2.RelOffset, Float64, Float64, Float64}, 195}()}, header_offset::JLD2.RelOffset)
@ JLD2 C:\Users\yhcha\.julia\packages\JLD2\u57Vt\src\dataio.jl:37
[6] read_data(f::JLD2.JLDFile{JLD2.MmapIO}, rr::Any, read_dataspace::Tuple{JLD2.ReadDataspace, JLD2.RelOffset, JLD2.DataLayout, JLD2.FilterPipeline}, attributes::Vector{JLD2.ReadAttribute})
@ JLD2 C:\Users\yhcha\.julia\packages\JLD2\u57Vt\src\datasets.jl:238
[7] read_data(f::JLD2.JLDFile{JLD2.MmapIO}, dataspace::JLD2.ReadDataspace, datatype_class::UInt8, datatype_offset::Int64, layout::JLD2.DataLayout, filters::JLD2.FilterPipeline, header_offset::JLD2.RelOffset, attributes::Vector{JLD2.ReadAttribute})
@ JLD2 C:\Users\yhcha\.julia\packages\JLD2\u57Vt\src\datasets.jl:194
[8] load_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, offset::JLD2.RelOffset)
@ JLD2 C:\Users\yhcha\.julia\packages\JLD2\u57Vt\src\datasets.jl:125
[9] jlconvert
@ C:\Users\yhcha\.julia\packages\JLD2\u57Vt\src\data\writing_datatypes.jl:314 [inlined]
When I used the old Manifest.toml
and revert back to the older versions of the packages (with the exact same codes on my end), then I managed to retrieve sol
from the saved .jld2
file. I haven’t changed anything about my own custom struct
for storing various relevant parameters/quantities and the ODE function as it’s still the same code, so apparently with the latter versions of JLD2
or parts of those SciML
packages something break.
To prevent this from happening again, my question is:
-
The feature I really want to keep in the stored data is the interpolation, i.e.
sol(t)
. Are there any ways to storesol
which can preserve this feature, without storingsol.prob.p
(i.e. my customstruct
) or the ODE function, both of which might cause issues in latter versions of reasons I’m not aware of? -
I have pinned some of the key packages I use for running my simulations, such as
OrdinaryDiffEq.jl
, but sometimes when I just wanna upgrade other non-relevant packages likeMakie.jl
for plotting, it also updates the otherSciML
packages likeLinearSolve
thatOrdinaryDiffEq
depend on. How backward compatible can I expect for these ‘inner’ packages? Just to be extra safe, are there otherSciML
packages that I should pin in order to prevent accidentally update? Or in my case from the error message, it looks like there are also some issues withSparseArrays.SparseMatrixCSC
(I need to pass the sparsity pattern to speed up computation). Are there anything I can do regarding fixing the versions of the packages which are relevant to solving ODEs?