This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Time dependent plots

0 votes

Hi.

I have a time stepping while loop, which plots for every iteration.
As it is now, it runs very fast through the plots. So is there a way to stop at each plot or slow down the while loop?

The code looks a lot like the demo in:

demo/undocumented/advection-diffusion

I have tried many things, one is to write "interactive()" after the plot command, then after the first plot I press "q" inside the plot window and the following error occurs:

$ python demo_advection-diffusion.py
2013-09-23 19:49:12.233 Python[25628:1307] invalid drawable
2013-09-23 19:49:12.241 Python[25628:1307] invalid drawable

Thanks.

asked Sep 23, 2013 by christianv FEniCS User (2,460 points)

slow down the while loop?

That's not much a FEniCS question - general goal is to speed-up time loops. Nevertheless

import time

while ...:
     # do something

     plot(...)
     time.sleep(3) # 3 seconds

Using interactive() is the correct idea, not sure about the warnings (errors?) you're getting.

+1 for Jan's time.sleep(3).

Thank you Jan. The reason that I want to slow/stop the while loop is for illustration in class.

I have tried the code on a linux machine, where it worked. (I'm using mac) And on another mac where it made the same warnings as I got.

Which warnings? Provide minimal code reproducing it and tell us about FEniCS version you use. (I don't have Macintosh but someone else could check.)

...