Thanks very much for the replies - I was running out of ideas and you've helped me to get going again. Still no luck so far though.
In reply to SaultDon:
Thanks, I hadn't seen the links that you posted, although I have read a lot of posts on the old forum relating to similar things. Many of the problems sound familiar but I haven't had much luck yet with the various work-arounds. I'm trying to get my code running in a sub-process at the minute - fingers crossed!
In reply to lpugh01:
Great idea - thanks! I've tried your suggestion and all of my variables are set to none before entering the next loop, except for one which represents the water level. I can't delete this as the water level at the end of loop n is used as the initial water level for the start of loop (n+1). Will this create an inherent memory leak? The water level variable is initially declared before the loop starts, so I don't think I'm doing anything wrong here, unless I've misunderstood the basics of looping (quite possible!).
I'll keep trying. Thanks again!