5
$\begingroup$

I found this video on Youtube outlining a method for Parallelizing NDSolve https://www.youtube.com/watch?v=6TiO3nRWZ_U.

Does anyone know what the current update is on this? I tried to implement in Mathematica 11 with the example in the video

eqs = {{y1'[t] == y2[t], y2'[t] == -Sin[y1[t]]}, {y1[0] == 1/2, 
  y2[0] == 0}};
vars = {y1[t], y2[t]};
tf = 1000;
time = {t, tf, tf}; 
prsol1 = First[
NDSolve[eqs, vars, time, 
 Method -> {"Parareal", "SerialMethod" -> "ExplicitRungeKutta", 
   "ParallelMethod" -> "ExplicitRungeKutta"}]]; // AbsoluteTiming

but it comes back with the message that

NDSolve::bdmtd: The value of the option Method     
->{Parareal,SerialMethod->ExplicitRungeKutta,ParallelMethod->ExplicitRungeKutta} 
is not a known built-in method, a symbol that could be a user-defined method,
 or a list with a name followed by method options.

Thanks!

$\endgroup$
1
  • 3
    $\begingroup$ I do believe this isn't in the kernel yet and a developmental build was being used in the video. $\endgroup$
    – Greg Hurst
    Commented Jul 20, 2018 at 14:30

1 Answer 1

4
$\begingroup$

The example now runs without error (V12.2 or earlier), but it gives different (and incorrect) results than the unparallelized call. I guess it is still a work in progress.

eqs = {{y1'[t] == y2[t], y2'[t] == -Sin[y1[t]]},
       {y1[0] == 1/2, y2[0] == 0}};
vars = {y1, y2};
tf = 100;
time = {t, 0, tf};
prsol1 = First[
    NDSolve[eqs, vars, time, 
     Method -> {"Parareal", "SerialMethod" -> "ExplicitRungeKutta", 
       "ParallelMethod" -> "ExplicitRungeKutta"}]]; // AbsoluteTiming
prsol2 = First[
    NDSolve[eqs, vars, time,
     Method -> "ExplicitRungeKutta"]]; // AbsoluteTiming
(*
  {0.062579, Null}
  {0.002873, Null}
*)

Visualize the solutions:

Plot[{y1[t], y2[t]} /. prsol1 // Evaluate, {t, 0, 100}]
Plot[{y1[t], y2[t]} /. prsol2 // Evaluate, {t, 0, 100}]

The parallel version does not satisfy the ODEs:

Plot[{y1'[t], y2[t]} /. prsol1 // Evaluate, {t, 0, 100}, 
 PlotStyle -> {Automatic, Dashed}]

But the unparallelized method does satisfy the ODEs:

Plot[{y1'[t], y2[t]} /. prsol2 // Evaluate, {t, 0, 100}, 
 PlotStyle -> {Automatic, Dashed}]
$\endgroup$

Your Answer

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

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