MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Memory problem using NDSolve in For Loop

  • To: mathgroup at
  • Subject: [mg83337] Memory problem using NDSolve in For Loop
  • From: DBK <boydkramer at>
  • Date: Sat, 17 Nov 2007 05:36:36 -0500 (EST)

I am running a number of simulations (sim) with different initial
conditions (ic). The code I have written runs fine until I increase
the number of simulations. In my "For" loop below, I thought that
previous solutions (sol[sim]) were being cleared but this obviously is
not happening. How do I clear sol and reduce my memory usage? Sorry if
this is pretty basic stuff.

For[sim = 1, sim < 2500, sim = sim + 1,
  sol[sim] =
   NDSolve[{equations, a[0] == 10, b[0] == .45, c[0] == .30,
     d[0] == .40, e[0] == ic[[sim, 1]], f[0] == ic[[sim, 2]]}, {a, b,
     c, d, e, f}, {t, 0, time}, MaxSteps -> Infinity,
    WorkingPrecision -> 5, MaxStepSize -> 0.10];
  AppendTo[outlist, {ic[[sim, 1]], ic[[sim, 2]], e[time] /. sol[sim],
    f[time] /. sol[sim]}]];

  • Prev by Date: Re: Does ColorFunction-> have different meanings to Plot3D
  • Next by Date: Re: Floor doesn't compute in some cases
  • Previous by thread: Re: Piecewise inside a Module or Block, I don't understand this
  • Next by thread: Re: Memory problem using NDSolve in For Loop