Saving output of ODE simulations

I’m trying to save the outputs of solve from the differentialEquations package.

After running my simulation sim, I run load JLD. Then run save("temp.jld","sim",sim).

However, when I load again (after I’ve loaded the relevant libraries) I receive an error:

error parsing type string SciMLBase.EnsembleSolution{Core.Float64,4,Core.Array{SciMLBase.ODESolution{Core.Float64,3,Core.Array{Core.Array{Core.Float64,2},1},Core.Nothing,Core.Nothing,Core.Array{Core.Float32,1},Core.Array{Core.Array{Core.Array{Core.Float64,2},1},1},SciMLBase.ODEProblem{Core.Array{Core.Float64,2},Core.Tuple{Core.Float32,Core.Float32},true,SciMLBase.NullParameters,SciMLBase.ODEFunction{true,SciMLBase.FullSpecialize,#f,LinearAlgebra.UniformScaling{Core.Bool},Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,SciMLBase.#DEFAULT_OBSERVED,Core.Nothing,Core.Nothing},Base.Pairs{Core.Symbol,Union(),Core.Tuple{},Core.NamedTuple{(),Core.Tuple{}}},SciMLBase.StandardODEProblem},OrdinaryDiffEq.Tsit5{OrdinaryDiffEq.#trivial_limiter!,OrdinaryDiffEq.#trivial_limiter!,Static.False},OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{true,SciMLBase.FullSpecialize,#f,LinearAlgebra.UniformScaling{Core.Bool},Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,Core.Nothing,SciMLBase.#DEFAULT_OBSERVED,Core.Nothing,Core.Nothing},Core.Array{Core.Array{Core.Float64,2},1},Core.Array{Core.Float32,1},Core.Array{Core.Array{Core.Array{Core.Float64,2},1},1},OrdinaryDiffEq.Tsit5Cache{Core.Array{Core.Float64,2},Core.Array{Core.Float64,2},Core.Array{Core.Float64,2},OrdinaryDiffEq.Tsit5ConstantCache{Core.Float64,Core.Float32},OrdinaryDiffEq.#trivial_limiter!,OrdinaryDiffEq.#trivial_limiter!,Static.False}},DiffEqBase.DEStats},1}}
Error encountered while load FileIO.File{FileIO.DataFormat{:JLD}, String}("temp.jld").

Fatal error:
ERROR: syntax: incomplete: premature end of input
Stacktrace:
 [1] top-level scope
   @ none:1
Stacktrace:
 [1] handle_error(e::ErrorException, q::Base.PkgId, bt::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}})
   @ FileIO ~/.julia/packages/FileIO/DtNtF/src/error_handling.jl:61
 [2] handle_exceptions(exceptions::Vector{Tuple{Any, Union{Base.PkgId, Module}, Vector}}, action::String)
   @ FileIO ~/.julia/packages/FileIO/DtNtF/src/error_handling.jl:56
 [3] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::FileIO.Formatted; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ FileIO ~/.julia/packages/FileIO/DtNtF/src/loadsave.jl:228
 [4] action
   @ ~/.julia/packages/FileIO/DtNtF/src/loadsave.jl:196 [inlined]
 [5] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ FileIO ~/.julia/packages/FileIO/DtNtF/src/loadsave.jl:185
 [6] action
   @ ~/.julia/packages/FileIO/DtNtF/src/loadsave.jl:185 [inlined]
 [7] load(::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ FileIO ~/.julia/packages/FileIO/DtNtF/src/loadsave.jl:113
 [8] load(::String)
   @ FileIO ~/.julia/packages/FileIO/DtNtF/src/loadsave.jl:109
 [9] top-level scope
   @ REPL[2]:1

I’m not sure how to interpret this. Do people have ideas? I’m thinking that I haven’t saved all the variables in my workspace. But my workspace is big, is there a way to save the entire workspace without explicitly naming the variables? I don’t see an example in the documentation.

That is mentioned here: I/O: Saving and Loading Solution Data · DifferentialEquations.jl

1 Like