MathGroup Archive 2009

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

Search the Archive

NDSolve memory management problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101868] NDSolve memory management problem
  • From: David Szekely <dr.szekely at gmail.com>
  • Date: Mon, 20 Jul 2009 06:01:17 -0400 (EDT)

Hi there!
I'm currently trying to run a simulation in Mathematica using NDSolve in several dimensions. However, it tends to chew up system memory very quickly and give the standard:
"No more memory available.
Mathematica kernel has shut down.
Try quitting other applications and then retry."
message.
Here's some code for the heat equation in 4 dimensions over relatively small ranges to show what I mean:
i = 0;
sol = NDSolve[{D[u[t, x, y, z], t] == 
    D[u[t, x, y, z], x, x] + D[u[t, x, y, z], y, y] + 
     D[u[t, x, y, z], z, z],
   u[0, x, y, z] == 0,
   u[t, 0, y, z] == Sin[t],
   u[t, 40, y, z] == 0,
   u[t, x, 0, z] == Sin[t],
   u[t, x, 40, z] == 0,
   u[t, x, y, 0] == Sin[t],
   u[t, x, y, 40] == 0},
  {u}, {t, 0, 100}, {x, 0, 40}, {y, 0, 40}, {z, 0, 40}, 
  MaxSteps -> Infinity, MaxStepSize -> 1,
  
  EvaluationMonitor :> If[t > i,
    Print[{t, MemoryInUse[]/1024^2 // N}];
    i += 10;]
  
  ]
MemoryInUse[]/1024^2 // N

The only solutions I need are at t = 0, 5, 10, 15 etc.. Ideally, what i'd like to be able to do is add a function in "EvaluationMonitor" which removes all values of t other than the ones that I need *as it solves the system*. This would significantly reduce the strain on system memory. I would greatly appreciate help on this problem! Adding more memory is not a good solution since my actual problem kills a system with 12 Gb of memory :(


  • Prev by Date: Thoughts on a Wolfram|Alpha package for
  • Next by Date: Re: How to make variables local to a particular notebook?
  • Previous by thread: Re: Thoughts on a Wolfram|Alpha package for
  • Next by thread: Product::write : Tag List is Protected Error