I would like to run code like this many times within a loop:
mod = Explicit_Problem()
mod.f = rhs # rhs in each iteration is slightly different
y0 = [...]
....
sim = CVode(mod, y0)
sim.simulate()
When I run this, the memory used steadily increases with each iteration. It seems that the memory associated with sim is not freed (?). Is there a way to explicitly free this memory? Or reuse sim with a new rhs?
thanks!