Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

sigma=ListInterpolation[someMoreOrLessRandomArrayofZerosAndOnes, 
    {{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}];
share|improve this question
    
I think you'll get better advice if you give some example of your problem. – Chris K May 2 at 19:50
3  
You aren't going to beat the performance of native machine precision by working at lower precision. – george2079 May 2 at 20:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.