diff --git a/olaflow/processing/post.py b/olaflow/processing/animate.py similarity index 89% rename from olaflow/processing/post.py rename to olaflow/processing/animate.py index 277b7b7..adcd43b 100644 --- a/olaflow/processing/post.py +++ b/olaflow/processing/animate.py @@ -44,7 +44,7 @@ P[:, C[1], C[2]] = model.fields["porosity"][:, C[0]] AW = np.full((model.t.size, *X.shape), np.nan) AW[:, C[1], C[2]] = model.fields["alpha.water"][:, C[0]] -fig, ax = plt.subplots() +fig, ax = plt.subplots(figsize=(19.2, 10.8), dpi=100) tit = ax.text( 0.5, 0.95, @@ -68,13 +68,13 @@ ax.axhline(4.5, ls="-.", lw=1, c="k", alpha=0.2, zorder=1.2) def anim(i): - tit.set_text(f"t={i[0]}s") - aw_m.set_array(i[1]) + tit.set_text(f"t={model.t[i]}s") + aw_m.set_array(AW[i]) return (aw_m,) fig.colorbar(aw_m) ax.set(xlabel="x (m)", ylabel="z (m)", aspect="equal", facecolor="#bebebe") ax.grid(c="k", alpha=0.2) -ani = animation.FuncAnimation(fig, anim, frames=zip(model.t, AW), interval=1 / 25) -plt.show() +ani = animation.FuncAnimation(fig, anim, frames=model.t.size) +ani.save(out.parent.joinpath("anim.mp4"), fps=24)