3
$\begingroup$

Hi guys I'm solving a nonlinear system of ODEs with NDSolve. Since the dimension of the system ranges from 2700 to 20000 equations, depending on the parameters, the time required to solve the entire system changes considerably. Therefore I am looking for a method to monitor how fast mathematica is going.

After a look to the documentation I found the following:

AbsoluteTiming[
 Monitor[sol = 
  NDSolve[Join[eqns, boundary], vars, {t, 0, 200}, 
   Method -> {"EquationSimplification" -> "Residual"}, 
   EvaluationMonitor :> (step = t)];
, step]
]

which gives me the following result:

 {72.648939, Null}

However if I simply perform the time integration without monitoring its evolution:

AbsoluteTiming[
 sol = NDSolve[Join[eqns, boundary], vars, {t, 0, 200}, 
 Method -> {"EquationSimplification" -> "Residual"}];
]

which gives me:

 {19.587876, Null}

that is less than one third of the time!! (compared to when i monitor the solution)

Is there a way to monitor the evolution of the time integration without being so much time-consuming? Do you have any suggestion?

$\endgroup$
  • 2
    $\begingroup$ You may want to try StepMonitor instead of EvaluationMonitor. Probably less overhead. $\endgroup$ – Dr. belisarius Mar 20 '16 at 20:51
  • $\begingroup$ It is expected that the integration time is longer with and "EvaluationMonitor"; however three times does sound like a bit much. However, without the (or any set of) equations that show this behavior an answergoing to remain at the speculative level. $\endgroup$ – user21 Mar 20 '16 at 20:56

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.