1
$\begingroup$

I am using NDSolve command of mathematica solving a very complicated partial differential equation (two independents "t" and "x", three master variable "u", "v", "w"). Each time I solve it, it takes 10-20 minutes. So, I wish to save the solution into an independent file.

I used command Export["myfile.m", nSol], where nSol is the output of NDSolve. But the resulting mayflie.m is 160Mb. It's too large and contains much redundant data. I wish to save only three two dimensional array u(t,x), v(t,x), w(t,x) on points NDSolve obtaining the solution. I think that should not be as large as 160Mb.

Could anybody help me solving this problem?

$\endgroup$
  • 1
    $\begingroup$ We can help you only if you give details of the functions. $\endgroup$ – David G. Stork Feb 3 '15 at 5:19
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey Feb 3 '15 at 5:32
1
$\begingroup$

Obtaining the computed function values on the grid is accomplished with

Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"]
datau=InterpolatingFunctionValuesOnGrid[solu]
datav=InterpolatingFunctionValuesOnGrid[solv]
dataw=InterpolatingFunctionValuesOnGrid[solw]

where solu, solv, solw are the InterpolatingFunctions produced by NDSolve. If you need the grid too, use

grid=InterpolatingFunctionCoordinates[solu]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.