0
$\begingroup$

I would not be surprised if this has already been addressed and I am overlooking it somehow.

I have a fairly long running NDSolveValue[]. I am developing a post-processing graphic. Is it possible to serialize and unserialize results from NDSolveValue?

My thought is that I would serialize the results into a binary file that contains the $$\{IntepolatingFunction_1,InterpoltatingFuntion_2\}$$ result from NDSolveValue. I could then load the results into a standard Mathematica list and proceed to work on the post-processing graphics (without waiting for another run of NDSolveValue).

This would also allow me to load the results in separate notebooks.

$\endgroup$
4
  • 2
    $\begingroup$ Does g = NDSolveValue[...]; DumpSave["file.mx", "g"]; do what you need? You can retrieve the interpolating functions with <<file` $\endgroup$
    – Carl Woll
    Aug 19, 2022 at 16:25
  • $\begingroup$ I am giving this a try. $\endgroup$ Aug 21, 2022 at 14:51
  • $\begingroup$ I usually like Export better than DumpSave for this purpose: res=NDSolveValue[...] and then Export["file.mx",res]. Loading will then be done with: loadedres=Import["file.mx"]. It has the advantage that it does not overwrite any variables and you don't need to remember what variable was used when DumpSave-ing the result. You can also export several results to one file, e.g.: `Export["results.mx",{res1,res2,res3}] $\endgroup$ Aug 28, 2022 at 13:57
  • $\begingroup$ Thank you, I will give this a try. This allows me to keep different notebooks for different visualizations of the same PDE. $\endgroup$ Aug 30, 2022 at 15:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.