Save water animation
This commit is contained in:
parent
66b2a272ff
commit
975823fec8
1 changed files with 5 additions and 5 deletions
|
@ -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)
|
Loading…
Reference in a new issue