Can I save ODESystem separately and call it every time I need?

Hi!

I am using ModelingToolkit to build a symbolic ODESystem of 13 vector equations. However, the system is unusually large and therefore, takes a lot of time to compute every time I run the code, which is not required. I only want the symbolic computations to be performed once and save it and then access it whenever I wish to use it. Is there some way to do it?

Thanks for the help!

There is a lot of caching done. Is it not being used by you? It’s impossible to tell without looking at your code.

Do you mean “compute every time I run the code” as in different Julia sessions?

Hi Chris,

Thanks for your reply. I think for my question, i could take any system, say a lorenz attractor ODE and plot it in a different Julia REPL session by calling this ODE system.

My ODE system has 13 vector equations and I don’t want to run the same modelingtoolkit operations again. Instead, I want it to save it as a file and then call it in a julia code when needed. For instance, in MATLAB symbolic toolbox, I can save a symbolic code as a function using fullfile and matlabFunction [Convert symbolic expression to function handle or file - MATLAB matlabFunction] I needed something similar for Julia. Thanks for the help!

Yes exactly. I want to save a ODE system and then be able to use it in a different Julia REPL session. Any ideas regarding this?

does serialize/deserialize do what you want?

1 Like

Hi Oscar_Smith,

Thanks a lot for this. Works perfectly for me! :slight_smile:

1 Like