I'm currently working on a lattice boltzmann simulation, and it is my first python project. While I managed to make a working simulation, I'm having trouble using Matplotlib FuncAnimation (I'm using spyder).
I have stored all the datas resulting from simulation in a numpy 2d array. This array has all the data points for time t stored as columns, and those same data for time t+dt are stored in the next column.
Of course a simulation generates lots of data (the small test i'm currently running simulate 37 points over 400 time iteration), hence why I want to create an animated plot to see how my data evolves over time. I, however, can't seem to manage to create a working animation using FuncAnimation from Matplotlib
The code i'm currently using to create my animation is this one:
fig, ax = plt.subplots()
plt.ylim([0,2])
line=ax.plot(h[:,0])
def update(num):
line.set_xdata(h[:,num])
return (line)
ani = animation.FuncAnimation(fig, update, frames=(np.size(h)), interval=20)
plt.show()
Please note that h is the 2d array I spoke of above. This code only returns a fix plot of the initial iteration of h, and I can't figure what's wrong in the code.
If someone spot the problem, some help would absolutely be welcome.