World Age Errors while using BSON to store solution of a Differential Equation

I use the DifferentialEquations.jl package to solve for the evolution of multiple coupled differential equations by making use of several helper functions. Thereafter, I store the solution using BSON.

Then I load the stored solution for plotting/fitting - this works fine as long as I do not try to interpolate. Furthermore, when I ask Julia to interpolate in the REPL, that works too.

However, the trouble arises when I try to interpolate the (loaded) solution within a new function, viz. - the REPL ends up throwing World Age Errors. I understand from the documentation that all the functions that were used to solve the differential equations must be brought within the scope of the function wherein the interpolation is performed. What confuses me though is that since all the helper/solver functions are already defined, they should therefore automatically be within the scope - which is surprisingly not the case. Is there a simple way to bypass this and interpolate data from the stored BSON file within a new function?

I need the functionality because I cannot apriori decide which time points will be needed for the fits.

1 Like

Can you share an example? I always use JLD2 which works fine, but the last time I checked BSON worked.

1 Like

Thank you very much for the JLD2 hint, Chris. It’s not running into any world age errors and all the interpolations within new functions are also working well!

I couldn’t figure out the problem with the BSON implementation. Tried to create a minimum dysfunctional example with BSON along the lines of a slightly more elaborate code I had written, in order to share it here; but I failed completely and BSON came out victorious with flying colors in that simplistic version.

I’m guessing the documentation for JLD2 usage in the link is for the latest version(?). On Julia 1.4.2 - which is what I’m currently using - I followed the suggestions on the github page of JLD2, used FileIO and load commands. It worked smoothly!