Skip to content

Commit

Permalink
clean up plotting within loops
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed Oct 20, 2024
1 parent ee4b05a commit 4e99471
Showing 1 changed file with 14 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,22 +288,18 @@
"metadata": {},
"outputs": [],
"source": [
"# Set displayAnimation to True if you want to see how\n",
"# the water moves throughout the channel\n",
"displayAnimation = True\n",
"displayAnimationFreq = 5\n",
"disp = 0\n",
"# Set the animation frequency to n_timesteps if you\n",
"# don't want to plot the water depth\n",
"# display_animation_freq = n_timesteps\n",
"display_animation_freq = 5\n",
"\n",
"grid.imshow(\"surface_water__depth\", output=True)\n",
"for timestep in trange(n_timesteps):\n",
" rfd.run_one_step()\n",
"\n",
" if disp >= displayAnimationFreq:\n",
" if timestep % display_animation_freq == 0:\n",
" clear_output(wait=True) # This will clear the previous image\n",
" grid.imshow(\"surface_water__depth\")\n",
" plt.show()\n",
" disp = -1\n",
"\n",
" disp += 1"
" grid.imshow(\"surface_water__depth\", output=True)"
]
},
{
Expand Down Expand Up @@ -585,22 +581,18 @@
"metadata": {},
"outputs": [],
"source": [
"# Set displayAnimation to True if you want to see how\n",
"# the water moves throughout the channel\n",
"displayAnimation = True\n",
"displayAnimationFreq = 5\n",
"disp = 0\n",
"# Set the animation frequency to n_timesteps if you\n",
"# don't want to plot the water depth\n",
"# display_animation_freq = n_timesteps\n",
"display_animation_freq = 5\n",
"\n",
"grid.imshow(\"surface_water__depth\", output=True)\n",
"for timestep in trange(n_timesteps):\n",
" rfd.run_one_step()\n",
"\n",
" if disp >= displayAnimationFreq:\n",
" if timestep % display_animation_freq == 0:\n",
" clear_output(wait=True) # This will clear the previous image\n",
" grid.imshow(\"surface_water__depth\")\n",
" plt.show()\n",
" disp = -1\n",
"\n",
" disp += 1"
" grid.imshow(\"surface_water__depth\", output=True)"
]
},
{
Expand Down

0 comments on commit 4e99471

Please sign in to comment.