small formatting and labeling changes

This commit is contained in:
Brantegger Georg
2022-07-07 14:33:16 +02:00
parent c854fe7da8
commit b1696f696c
3 changed files with 91 additions and 82 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
*__pycache__/ *__pycache__/
.vscode/settings.json .vscode/settings.json
*.pyc *.pyc
Messing Around/

View File

@@ -23,39 +23,38 @@
"#define constants\n", "#define constants\n",
"\n", "\n",
"# physics\n", "# physics\n",
"g = 9.81 # gravitational acceleration [m/s²]\n", "g = 9.81 # gravitational acceleration [m/s²]\n",
"rho = 1000. # density of water [kg/m³]\n", "rho = 1000. # density of water [kg/m³]\n",
"\n", "\n",
"# pipeline\n", "# pipeline\n",
"L = 1000. # length of pipeline [m]\n", "L = 1000. # length of pipeline [m]\n",
"D = 1. # pipe diameter [m]\n", "D = 1. # pipe diameter [m]\n",
"A_pipe = D**2/4*np.pi # pipeline area\n", "A_pipe = D**2/4*np.pi # pipeline area\n",
"h_pipe = 200 # hydraulic head without reservoir [m] \n", "h_pipe = 200 # hydraulic head without reservoir [m] \n",
"alpha = np.arcsin(h_pipe/L) # Höhenwinkel der Druckrohrleitung \n", "alpha = np.arcsin(h_pipe/L) # Höhenwinkel der Druckrohrleitung \n",
"n = 10 # number of pipe segments in discretization\n", "n = 10 # number of pipe segments in discretization\n",
"# consider replacing Q0 with a vector be be more flexible in initial conditions\n", "# consider replacing Q0 with a vector be be more flexible in initial conditions\n",
"Q0 = 2. # initial flow in whole pipe [m³/s]\n", "Q0 = 2. # initial flow in whole pipe [m³/s]\n",
"v0 = Q0/A_pipe # initial flow velocity [m/s]\n", "v0 = Q0/A_pipe # initial flow velocity [m/s]\n",
"f_D = 0.1 # Darcy friction factor\n", "f_D = 0.1 # Darcy friction factor\n",
"c = 400. # propagation velocity of the pressure wave [m/s]\n", "c = 400. # propagation velocity of the pressure wave [m/s]\n",
"# consider prescribing a total simulation time and deducting the number of timesteps from that\n", "# consider prescribing a total simulation time and deducting the number of timesteps from that\n",
"nt = 100 # number of time steps after initial conditions\n", "nt = 100 # number of time steps after initial conditions\n",
"\n", "\n",
"# derivatives of the pipeline constants\n", "# derivatives of the pipeline constants\n",
"dx = L/n # length of each pipe segment\n", "dx = L/n # length of each pipe segment\n",
"dt = dx/c # timestep according to method of characterisitics\n", "dt = dx/c # timestep according to method of characterisitics\n",
"nn = n+1 # number of nodes\n", "nn = n+1 # number of nodes\n",
"h_res = 20. # water level in upstream reservoir [m]\n", "initial_level = 20. # water level in upstream reservoir [m]\n",
"p0 = rho*g*h_res-v0**2*rho/2\n", "p0 = rho*g*initial_level-v0**2*rho/2\n",
"pl_vec = np.arange(0,nn*dx,dx) # pl = pipe-length. position of the nodes on the pipeline\n", "pl_vec = np.arange(0,nn*dx,dx) # pl = pipe-length. position of the nodes on the pipeline\n",
"t_vec = np.arange(0,nt*dt,dt) # time vector\n", "t_vec = np.arange(0,nt+1)*dt # time vector\n",
"h_vec = np.arange(0,n+1)*h_pipe/n # hydraulic head of pipeline at each node np.arange(0,0) does not yield the intended result\n", "h_vec = np.arange(0,n+1)*h_pipe/n # hydraulic head of pipeline at each node \n",
"v_init = np.full(nn,Q0/(D**2/4*np.pi)) # initial velocity distribution in pipeline\n", "v_init = np.full(nn,Q0/(D**2/4*np.pi)) # initial velocity distribution in pipeline\n",
"p_init = (rho*g*(h_res+h_vec)-v_init**2*rho/2)-(f_D*pl_vec/D*rho/2*v_init**2) # ref Wikipedia: Darcy Weisbach\n", "p_init = (rho*g*(initial_level+h_vec)-v_init**2*rho/2)-(f_D*pl_vec/D*rho/2*v_init**2) # ref Wikipedia: Darcy Weisbach\n",
"\n", "\n",
"\n", "\n",
"# reservoir\n", "# reservoir\n",
"initial_level = h_res # water level in upstream reservoir [m]\n",
"# replace influx by vector\n", "# replace influx by vector\n",
"initial_influx = 0. # initial influx of volume to the reservoir [m³/s]\n", "initial_influx = 0. # initial influx of volume to the reservoir [m³/s]\n",
"initial_outflux = Q0 # initial outflux of volume from the reservoir to the pipeline [m³/s]\n", "initial_outflux = Q0 # initial outflux of volume from the reservoir to the pipeline [m³/s]\n",
@@ -137,16 +136,16 @@
"p_boundary_tur = np.empty_like(t_vec)\n", "p_boundary_tur = np.empty_like(t_vec)\n",
"\n", "\n",
"# prepare the vectors that store the temporal evolution of the level in the reservoir\n", "# prepare the vectors that store the temporal evolution of the level in the reservoir\n",
"level_vec = np.full_like(t_vec,initial_level) # level at the end of each pipeline timestep\n", "level_vec = np.full(nt+1,initial_level) # level at the end of each pipeline timestep\n",
"level_vec_2 = np.empty([nt_eRK4]) # level throughout each reservoir timestep-used for plotting and overwritten afterwards\n", "level_vec_2 = np.empty([nt_eRK4]) # level throughout each reservoir timestep-used for plotting and overwritten afterwards\n",
"\n", "\n",
"# set the boudary conditions for the first timestep\n", "# set the boudary conditions for the first timestep\n",
"v_boundary_res[0] = v_old[0]\n", "v_boundary_res[0] = v_old[0]\n",
"v_boundary_tur[0] = v_old[-1] \n", "v_boundary_tur[0] = v_old[-1] \n",
"v_boundary_tur[1:] = 0 # instantaneous closing\n", "v_boundary_tur[1:] = 0 # instantaneous closing\n",
"# v_boundary_tur[0:20] = np.linspace(v_old[-1],0,20) # overwrite for finite closing time - linear case\n", "# v_boundary_tur[0:20] = np.linspace(v_old[-1],0,20) # overwrite for finite closing time - linear case\n",
"const = int(np.min([100,round(nt/1.1)]))\n", "const = int(np.min([100,round(nt/1.1)]))\n",
"v_boundary_tur[0:const] = v_old[1]*np.cos(t_vec[0:const]*2*np.pi/5)**2\n", "v_boundary_tur[0:const] = v_old[1]*np.cos(t_vec[0:const]*2*np.pi/5)**2\n",
"p_boundary_res[0] = p_old[0]\n", "p_boundary_res[0] = p_old[0]\n",
"p_boundary_tur[0] = p_old[-1]\n", "p_boundary_tur[0] = p_old[-1]\n",
"\n" "\n"
@@ -163,6 +162,7 @@
"\n", "\n",
"# create a figure and subplots to display the velocity and pressure distribution across the pipeline in each pipeline step\n", "# create a figure and subplots to display the velocity and pressure distribution across the pipeline in each pipeline step\n",
"fig1,axs1 = plt.subplots(2,1)\n", "fig1,axs1 = plt.subplots(2,1)\n",
"fig1.suptitle(str(0) +' s / '+str(round(t_vec[-1],2)) + ' s' )\n",
"axs1[0].set_title('Pressure distribution in pipeline')\n", "axs1[0].set_title('Pressure distribution in pipeline')\n",
"axs1[1].set_title('Velocity distribution in pipeline')\n", "axs1[1].set_title('Velocity distribution in pipeline')\n",
"axs1[0].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n", "axs1[0].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
@@ -180,11 +180,11 @@
"# lo_02, = axs1[2].plot(level_vec_2)\n", "# lo_02, = axs1[2].plot(level_vec_2)\n",
"# axs1[2].autoscale()\n", "# axs1[2].autoscale()\n",
"fig1.tight_layout()\n", "fig1.tight_layout()\n",
"plt.show()\n", "fig1.show()\n",
"plt.pause(1)\n", "plt.pause(1)\n",
"\n", "\n",
"# loop through time steps of the pipeline\n", "# loop through time steps of the pipeline\n",
"for it_pipe in range(1,pipe.nt):\n", "for it_pipe in range(1,pipe.nt+1):\n",
"\n", "\n",
"# for each pipeline timestep, execute nt_eRK4 timesteps of the reservoir code\n", "# for each pipeline timestep, execute nt_eRK4 timesteps of the reservoir code\n",
" # set initial conditions for the reservoir time evolution calculted with e-RK4\n", " # set initial conditions for the reservoir time evolution calculted with e-RK4\n",
@@ -222,9 +222,10 @@
" lo_00, = axs1[0].plot(pl_vec,pressure_conversion(pipe.p_old,initial_pressure_unit, conversion_pressure_unit)[0],marker='.',c='blue')\n", " lo_00, = axs1[0].plot(pl_vec,pressure_conversion(pipe.p_old,initial_pressure_unit, conversion_pressure_unit)[0],marker='.',c='blue')\n",
" lo_01, = axs1[1].plot(pl_vec,pipe.v_old,marker='.',c='blue')\n", " lo_01, = axs1[1].plot(pl_vec,pipe.v_old,marker='.',c='blue')\n",
" # lo_02, = axs1[2].plot(level_vec_2,c='blue')\n", " # lo_02, = axs1[2].plot(level_vec_2,c='blue')\n",
" fig1.suptitle(str(it_pipe))\n", " fig1.suptitle(str(round(t_vec[it_pipe],2))+ ' s / '+str(round(t_vec[-1],2)) + ' s' )\n",
" fig1.canvas.draw()\n", " fig1.canvas.draw()\n",
" fig1.tight_layout()\n", " fig1.tight_layout()\n",
" fig1.show()\n",
" plt.pause(0.00001) \n", " plt.pause(0.00001) \n",
"\n", "\n",
" # prepare for next loop\n", " # prepare for next loop\n",

View File

@@ -2,10 +2,11 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# imports\n",
"import numpy as np\n", "import numpy as np\n",
"import matplotlib.pyplot as plt\n", "import matplotlib.pyplot as plt\n",
"\n", "\n",
@@ -16,60 +17,60 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# for demoing I\n", "# for demoing I\n",
"# pipeline\n", "# pipeline\n",
"L = 1000. # length of pipeline [m]\n", "L = 1000. # length of pipeline [m]\n",
"D = 1. # pipe diameter [m]\n", "D = 1. # pipe diameter [m]\n",
"h_pipe = 200 # hydraulic head without reservoir [m] \n", "h_pipe = 0 # hydraulic head without reservoir [m] \n",
"Q0 = 2. # initial flow in whole pipe [m³/s]\n", "Q0 = 2. # initial flow in whole pipe [m³/s]\n",
"f_D = 0.1 # Darcy friction factor\n", "f_D = 0.05 # Darcy friction factor\n",
"c = 400. # propagation velocity of the pressure wave [m/s]\n", "c = 400. # propagation velocity of the pressure wave [m/s]\n",
"n = 100 # number of pipe segments in discretization\n",
"\n", "\n",
"# consider prescribing a total simulation time and deducting the number of timesteps from that\n",
"nt = 1000 # number of time steps after initial conditions\n",
"\n", "\n",
"# reservoir\n", "# reservoir\n",
"area_base = 20. # total base are of the cuboid reservoir [m²] \n" "area_base = 1. # total base are of the cuboid reservoir [m²] \n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 3,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"#define constants\n", "#define constants\n",
"\n", "\n",
"# physics\n", "# physics\n",
"g = 9.81 # gravitational acceleration [m/s²]\n", "g = 9.81 # gravitational acceleration [m/s²]\n",
"rho = 1000. # density of water [kg/m³]\n", "rho = 1000. # density of water [kg/m³]\n",
"\n", "\n",
"\n", "\n",
"A_pipe = D**2/4*np.pi # pipeline area\n", "A_pipe = D**2/4*np.pi # pipeline area\n",
"alpha = np.arcsin(h_pipe/L) # Höhenwinkel der Druckrohrleitung \n", "alpha = np.arcsin(h_pipe/L) # Höhenwinkel der Druckrohrleitung \n",
"n = 10 # number of pipe segments in discretization\n",
"# consider replacing Q0 with a vector be be more flexible in initial conditions\n", "# consider replacing Q0 with a vector be be more flexible in initial conditions\n",
"v0 = Q0/A_pipe # initial flow velocity [m/s]\n", "v0 = Q0/A_pipe # initial flow velocity [m/s]\n",
"# consider prescribing a total simulation time and deducting the number of timesteps from that\n", "\n",
"nt = 100 # number of time steps after initial conditions\n",
"\n", "\n",
"# derivatives of the pipeline constants\n", "# derivatives of the pipeline constants\n",
"dx = L/n # length of each pipe segment\n", "dx = L/n # length of each pipe segment\n",
"dt = dx/c # timestep according to method of characterisitics\n", "dt = dx/c # timestep according to method of characterisitics\n",
"nn = n+1 # number of nodes\n", "nn = n+1 # number of nodes\n",
"h_res = 20. # water level in upstream reservoir [m]\n", "initial_level = 20. # water level in upstream reservoir [m]\n",
"p0 = rho*g*h_res-v0**2*rho/2\n", "p0 = rho*g*initial_level-v0**2*rho/2\n",
"pl_vec = np.arange(0,nn*dx,dx) # pl = pipe-length. position of the nodes on the pipeline\n", "pl_vec = np.arange(0,nn*dx,dx) # pl = pipe-length. position of the nodes on the pipeline\n",
"t_vec = np.arange(0,nt*dt,dt) # time vector\n", "t_vec = np.arange(0,nt+1)*dt # time vector\n",
"h_vec = np.arange(0,n+1)*h_pipe/n # hydraulic head of pipeline at each node np.arange(0,0) does not yield the intended result\n", "h_vec = np.arange(0,n+1)*h_pipe/n # hydraulic head of pipeline at each node \n",
"v_init = np.full(nn,Q0/(D**2/4*np.pi)) # initial velocity distribution in pipeline\n", "v_init = np.full(nn,Q0/A_pipe) # initial velocity distribution in pipeline\n",
"p_init = (rho*g*(h_res+h_vec)-v_init**2*rho/2)-(f_D*pl_vec/D*rho/2*v_init**2) # ref Wikipedia: Darcy Weisbach\n", "p_init = (rho*g*(initial_level+h_vec)-v_init**2*rho/2)-(f_D*pl_vec/D*rho/2*v_init**2) # ref Wikipedia: Darcy Weisbach\n",
"\n", "\n",
"\n", "\n",
"# reservoir\n", "# reservoir\n",
"initial_level = h_res # water level in upstream reservoir [m]\n",
"# replace influx by vector\n", "# replace influx by vector\n",
"initial_influx = 0. # initial influx of volume to the reservoir [m³/s]\n", "initial_influx = 0. # initial influx of volume to the reservoir [m³/s]\n",
"initial_outflux = Q0 # initial outflux of volume from the reservoir to the pipeline [m³/s]\n", "initial_outflux = Q0 # initial outflux of volume from the reservoir to the pipeline [m³/s]\n",
@@ -88,7 +89,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -113,7 +114,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -133,41 +134,43 @@
"p_boundary_tur = np.empty_like(t_vec)\n", "p_boundary_tur = np.empty_like(t_vec)\n",
"\n", "\n",
"# prepare the vectors that store the temporal evolution of the level in the reservoir\n", "# prepare the vectors that store the temporal evolution of the level in the reservoir\n",
"level_vec = np.full_like(t_vec,initial_level) # level at the end of each pipeline timestep\n", "level_vec = np.full(nt+1,initial_level) # level at the end of each pipeline timestep\n",
"level_vec_2 = np.empty([nt_eRK4]) # level throughout each reservoir timestep-used for plotting and overwritten afterwards\n", "level_vec_2 = np.empty([nt_eRK4]) # level throughout each reservoir timestep-used for plotting and overwritten afterwards\n",
"\n", "\n",
"# set the boudary conditions for the first timestep\n", "# set the boudary conditions for the first timestep\n",
"v_boundary_res[0] = v_old[0]\n", "v_boundary_res[0] = v_old[0]\n",
"p_boundary_res[0] = p_old[0]\n", "p_boundary_res[0] = p_old[0]\n",
"p_boundary_tur[0] = p_old[-1]\n", "p_boundary_tur[0] = p_old[-1]\n",
"\n" "\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# for demoing II\n", "# for demoing II\n",
"v_boundary_tur[0] = v_old[-1] \n", "v_boundary_tur[0] = v_old[-1] \n",
"v_boundary_tur[1:] = 0 # instantaneous closing\n", "v_boundary_tur[1:] = 0 # instantaneous closing\n",
"# v_boundary_tur[0:20] = np.linspace(v_old[-1],0,20) # overwrite for finite closing time - linear case\n", "\n",
"const = int(np.min([100,round(nt/1.1)]))\n", "const = int(np.min([1000,round(nt/1.1)])) \n",
"v_boundary_tur[0:const] = v_old[1]*np.cos(t_vec[0:const]*2*np.pi/5)**2" "# v_boundary_tur[0:const] = np.linspace(v_old[-1],0,const) # linear closing\n",
"# v_boundary_tur[0:const] = v_old[1]*np.cos(t_vec[0:const]*2*np.pi)**2 # oscillating"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"%matplotlib qt5\n",
"# time loop\n", "# time loop\n",
"%matplotlib qt5\n",
"\n", "\n",
"# create a figure and subplots to display the velocity and pressure distribution across the pipeline in each pipeline step\n", "# create a figure and subplots to display the velocity and pressure distribution across the pipeline in each pipeline step\n",
"fig1,axs1 = plt.subplots(2,1)\n", "fig1,axs1 = plt.subplots(2,1)\n",
"fig1.suptitle(str(0) +' s / '+str(round(t_vec[-1],2)) + ' s' )\n",
"axs1[0].set_title('Pressure distribution in pipeline')\n", "axs1[0].set_title('Pressure distribution in pipeline')\n",
"axs1[1].set_title('Velocity distribution in pipeline')\n", "axs1[1].set_title('Velocity distribution in pipeline')\n",
"axs1[0].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n", "axs1[0].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
@@ -185,16 +188,17 @@
"# lo_02, = axs1[2].plot(level_vec_2)\n", "# lo_02, = axs1[2].plot(level_vec_2)\n",
"# axs1[2].autoscale()\n", "# axs1[2].autoscale()\n",
"fig1.tight_layout()\n", "fig1.tight_layout()\n",
"plt.show()\n", "fig1.show()\n",
"plt.pause(1)\n", "plt.pause(2)\n",
"\n", "\n",
"# loop through time steps of the pipeline\n", "# loop through time steps of the pipeline\n",
"for it_pipe in range(1,pipe.nt):\n", "for it_pipe in range(1,pipe.nt+1):\n",
"\n", "\n",
"# for each pipeline timestep, execute nt_eRK4 timesteps of the reservoir code\n", "# for each pipeline timestep, execute nt_eRK4 timesteps of the reservoir code\n",
" # set initial conditions for the reservoir time evolution calculted with e-RK4\n", " # set initial conditions for the reservoir time evolution calculated with e-RK4\n",
" V.pressure = p_old[0]\n", " V.pressure = p_old[0]\n",
" V.outflux = v_old[0]\n", " V.outflux = v_old[0]\n",
" # V.influx = v_boundary_tur[it_pipe]\n",
" # calculate the time evolution of the reservoir level within each pipeline timestep to avoid runaway numerical error\n", " # calculate the time evolution of the reservoir level within each pipeline timestep to avoid runaway numerical error\n",
" for it_res in range(nt_eRK4):\n", " for it_res in range(nt_eRK4):\n",
" V.e_RK_4() # call e-RK4 to update outflux\n", " V.e_RK_4() # call e-RK4 to update outflux\n",
@@ -204,12 +208,14 @@
" if (V.level < critical_level_low) or (V.level > critical_level_high): # make sure to never exceed critical levels\n", " if (V.level < critical_level_low) or (V.level > critical_level_high): # make sure to never exceed critical levels\n",
" i_max = it_pipe # for plotting only calculated values\n", " i_max = it_pipe # for plotting only calculated values\n",
" break \n", " break \n",
" level_vec[it_pipe] = V.level \n", " level_vec[it_pipe] = V.level \n",
"\n",
"\n", "\n",
" # set boundary conditions for the next timestep of the characteristic method\n", " # set boundary conditions for the next timestep of the characteristic method\n",
" p_boundary_res[it_pipe] = rho*g*V.level-v_old[1]**2*rho/2\n", " p_boundary_res[it_pipe] = rho*g*V.level-v_old[1]**2*rho/2\n",
" v_boundary_res[it_pipe] = v_old[1]+1/(rho*c)*(p_boundary_res[it_pipe]-p_old[1])-f_D*dt/(2*D)*abs(v_old[1])*v_old[1] \\\n", " v_boundary_res[it_pipe] = v_old[1]+1/(rho*c)*(p_boundary_res[it_pipe]-p_old[1])-f_D*dt/(2*D)*abs(v_old[1])*v_old[1] \\\n",
" +dt*g*np.sin(alpha)\n", " +dt*g*np.sin(alpha)\n",
" \n",
"\n", "\n",
" # the the boundary conditions in the pipe.object and thereby calculate boundary pressure at turbine\n", " # the the boundary conditions in the pipe.object and thereby calculate boundary pressure at turbine\n",
" pipe.set_boundary_conditions_next_timestep(v_boundary_res[it_pipe],p_boundary_res[it_pipe],v_boundary_tur[it_pipe])\n", " pipe.set_boundary_conditions_next_timestep(v_boundary_res[it_pipe],p_boundary_res[it_pipe],v_boundary_tur[it_pipe])\n",
@@ -227,9 +233,10 @@
" lo_00, = axs1[0].plot(pl_vec,pressure_conversion(pipe.p_old,initial_pressure_unit, conversion_pressure_unit)[0],marker='.',c='blue')\n", " lo_00, = axs1[0].plot(pl_vec,pressure_conversion(pipe.p_old,initial_pressure_unit, conversion_pressure_unit)[0],marker='.',c='blue')\n",
" lo_01, = axs1[1].plot(pl_vec,pipe.v_old,marker='.',c='blue')\n", " lo_01, = axs1[1].plot(pl_vec,pipe.v_old,marker='.',c='blue')\n",
" # lo_02, = axs1[2].plot(level_vec_2,c='blue')\n", " # lo_02, = axs1[2].plot(level_vec_2,c='blue')\n",
" fig1.suptitle(str(it_pipe))\n", " fig1.suptitle(str(round(t_vec[it_pipe],2))+ ' s / '+str(round(t_vec[-1],2)) + ' s' )\n",
" fig1.canvas.draw()\n", " fig1.canvas.draw()\n",
" fig1.tight_layout()\n", " fig1.tight_layout()\n",
" fig1.show()\n",
" plt.pause(0.00001) \n", " plt.pause(0.00001) \n",
"\n", "\n",
" # prepare for next loop\n", " # prepare for next loop\n",
@@ -242,7 +249,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [