Parallelize a sequence of NDSolve's

• To: mathgroup at smc.vnet.net
• Subject: [mg117688] Parallelize a sequence of NDSolve's
• From: Iván Lazaro <gaminster at gmail.com>
• Date: Wed, 30 Mar 2011 04:07:28 -0500 (EST)

```Hi all!

I don't understand yet the way in which the Parallel functions do the
distribution of the job, neither how the "setup" functions distribute
definitions. This is why I don't know what is happening in the next example:

DistributeDefinitions[Bx, By, Bz, Func2, IntVar, Rhor, Al, InDelta, TRI,
QUA, CIR, Sx1, Sy1, Sz1, B0, Theta, h, Tf, k, Axx, Axy, Axz, Ayx, Ayy, Ayz,
Azx, Azy, Azz]
SetSharedVariable[Phi, sol1, list, t, Bxn, Byn, Bzn]

list = {};
ParallelDo[{
Bxn = Bx[Theta, Phi];
Byn = By[Theta, Phi];
Bzn = Bz[Theta, Phi];
sol1 = NDSolve[Func2[], IntVar[], {t, 0, Tf}];
AppendTo[list,
Flatten[Subscript[Rho, 0, 0, 0, 0, 0, 0][t] + Subscript[Rho, 1, 0, 0, 1,
0, 0][t] /. sol1 /. t -> Tf,
1]];
}, {Phi, 0, 1, 0.1}]
Clear[sol1];

I think that the problem is with "list" variable, but this code thinks
forever, and doesn't show any message. The function Func2[] calls a huge
amount of another functions, Rhor, which just write down a set of 64
differential equations. The functions TRI, QUA, CIR, Sx1, Sz1, Al, InDelta,
are acting in there. IntVar writes down the variables to be integrated. The
other terms that appear in DistributeDefinitions are constants. I know that
without the actual set of equations is difficult to say something, but maybe
i'm missing the obvious in the preamble of the parallelization.