I have a program where I need to iterate NDSolve thousands of times for different configurations of a diffusion problem. The thing is, I only need about 3 digits of accuracy.

I looked thru previous questions and all I could find was using

 Method -> {Automatic, "SymbolicProcessing" -> 0}

As a speed-up trick. It cut evaluation time in half. Not bad. I also tried setting working

 WorkingPrecision -> 4

But that didn't have any noticeable effect :/

Are there any more ways I get tell NDSolve to go for speed instead of accuracy?

Edit: Here's the relevant code. GridSize is on the order of ~30.

    {{1, GridSize - 1}, {1, GridSize - 1}}, InterpolationOrder -> 0];

sol = Quiet[
   NDSolve[{Div[sigma[x, y]*-Grad[u[x, y], {x, y}], {x, y}] == 0, 
   u[0, y] == 1, u[GridSize - 1, y] == 0}, 
   u, {x, 0, GridSize - 1}, {y, 0, GridSize - 1}, 
   Method -> {Automatic, "SymbolicProcessing" -> 0}]];

V = Evaluate[u[x, y] /. sol];

J = -sigma[x, y]*Grad[V, {x, y}];
  • $\begingroup$ I think you'll get better advice if you give some example of your problem. $\endgroup$ – Chris K May 2 '16 at 19:50
  • 4
    $\begingroup$ You aren't going to beat the performance of native machine precision by working at lower precision. $\endgroup$ – george2079 May 2 '16 at 20:09

Your Answer

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

Browse other questions tagged or ask your own question.