Merge branch 'Dev'
This commit is contained in:
@@ -87,6 +87,7 @@ class Druckrohrleitung_class:
|
||||
#initialize the vectors in which the old and new pressures are stored for the method of characteristics
|
||||
self.p_old = p0.copy()
|
||||
self.p = p0.copy()
|
||||
self.p0 = p0.copy()
|
||||
# initialize the vectors in which the minimal and maximal value of the pressure at each node are stores
|
||||
self.p_min = p0.copy()
|
||||
self.p_max = p0.copy()
|
||||
@@ -220,6 +221,12 @@ class Druckrohrleitung_class:
|
||||
def get_highest_flux_per_node(self):
|
||||
return self.v_max*self.A
|
||||
|
||||
def get_initial_pressure_distribution(self,disp_flag=False):
|
||||
# disp_flag if one wants to directly plot the return of this method
|
||||
if disp_flag == True: # convert to pressure unit disp
|
||||
return pressure_conversion(self.p0,self.pressure_unit,self.pressure_unit_disp)
|
||||
elif disp_flag == False: # stay in Pa
|
||||
return self.p0
|
||||
|
||||
def timestep_characteristic_method(self):
|
||||
# use the method of characteristics to calculate the pressure and velocities at all nodes except the boundary ones
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
" # for general simulation\n",
|
||||
"flux_init = (OL_T1_Q_nenn+OL_T2_Q_nenn)/1.1 # [m³/s] initial flux through whole system for steady state initialization \n",
|
||||
"level_init = Con_targetLevel # [m] initial water level in upstream reservoir for steady state initialization\n",
|
||||
"simTime_target = 600. # [s] target for total simulation time (will vary slightly to fit with Pip_dt)\n",
|
||||
"simTime_target = 10000. # [s] target for total simulation time (will vary slightly to fit with Pip_dt)\n",
|
||||
"nt = int(simTime_target//Pip_dt) # [1] Number of timesteps of the whole system\n",
|
||||
"t_vec = np.arange(0,nt+1,1)*Pip_dt # [s] time vector. At each step of t_vec the system parameters are stored\n"
|
||||
]
|
||||
@@ -285,7 +285,7 @@
|
||||
"\n",
|
||||
" # the the boundary condition in the pipe.object and thereby calculate boundary pressure at turbine\n",
|
||||
" pipe.set_boundary_conditions_next_timestep(p_boundary_res[it_pipe],v_boundary_tur[it_pipe])\n",
|
||||
" pipe.v[0] = (0.8*pipe.v[0]+0.2*reservoir.get_current_outflux()/Res_area_out)\n",
|
||||
" # pipe.v[0] = (0.8*pipe.v[0]+0.2*reservoir.get_current_outflux()/Res_area_out) # unnecessary\n",
|
||||
" p_boundary_tur[it_pipe] = pipe.get_current_pressure_distribution()[-1]\n",
|
||||
" v_boundary_res[it_pipe] = pipe.get_current_velocity_distribution()[0]\n",
|
||||
" Q_boundary_res[it_pipe] = pipe.get_current_flux_distribution()[0]\n",
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
"\n",
|
||||
" # the the boundary condition in the pipe.object and thereby calculate boundary pressure at turbine\n",
|
||||
" pipe.set_boundary_conditions_next_timestep(p_boundary_res[it_pipe],v_boundary_tur[it_pipe])\n",
|
||||
" pipe.v[0] = (0.8*pipe.v[0]+0.2*reservoir.get_current_outflux()/Res_area_out)\n",
|
||||
" # pipe.v[0] = (0.8*pipe.v[0]+0.2*reservoir.get_current_outflux()/Res_area_out) # unnecessary\n",
|
||||
" p_boundary_tur[it_pipe] = pipe.get_current_pressure_distribution()[-1]\n",
|
||||
" v_boundary_res[it_pipe] = pipe.get_current_velocity_distribution()[0]\n",
|
||||
" Q_boundary_res[it_pipe] = pipe.get_current_flux_distribution()[0]\n",
|
||||
@@ -245,25 +245,26 @@
|
||||
" Q_old = pipe.get_current_flux_distribution()\n",
|
||||
"\n",
|
||||
" # plot some stuff\n",
|
||||
" # remove line-objects to autoscale axes (there is definetly a better way, but this works ¯\\_(ツ)_/¯ )\n",
|
||||
" lo_p.remove()\n",
|
||||
" lo_pmin.remove()\n",
|
||||
" lo_pmax.remove()\n",
|
||||
" lo_q.remove()\n",
|
||||
" lo_qmin.remove()\n",
|
||||
" lo_qmax.remove()\n",
|
||||
" # plot new pressure and velocity distribution in the pipeline\n",
|
||||
" lo_p, = axs1[0].plot(Pip_x_vec,pipe.get_current_pressure_distribution(disp_flag=True),marker='.',c='blue')\n",
|
||||
" lo_pmin, = axs1[0].plot(Pip_x_vec,pipe.get_lowest_pressure_per_node(disp_flag=True),c='red')\n",
|
||||
" lo_pmax, = axs1[0].plot(Pip_x_vec,pipe.get_highest_pressure_per_node(disp_flag=True),c='red')\n",
|
||||
" lo_q, = axs1[1].plot(Pip_x_vec,pipe.get_current_flux_distribution(),marker='.',c='blue')\n",
|
||||
" lo_qmin, = axs1[1].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n",
|
||||
" lo_qmax, = axs1[1].plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n",
|
||||
" fig1.suptitle(str(round(t_vec[it_pipe],2))+ ' s / '+str(round(t_vec[-1],2)) + ' s' )\n",
|
||||
" fig1.canvas.draw()\n",
|
||||
" fig1.tight_layout()\n",
|
||||
" fig1.show()\n",
|
||||
" plt.pause(0.001) "
|
||||
" if it_pipe%50 == 0:\n",
|
||||
" # remove line-objects to autoscale axes (there is definetly a better way, but this works ¯\\_(ツ)_/¯ )\n",
|
||||
" lo_p.remove()\n",
|
||||
" lo_pmin.remove()\n",
|
||||
" lo_pmax.remove()\n",
|
||||
" lo_q.remove()\n",
|
||||
" lo_qmin.remove()\n",
|
||||
" lo_qmax.remove()\n",
|
||||
" # plot new pressure and velocity distribution in the pipeline\n",
|
||||
" lo_p, = axs1[0].plot(Pip_x_vec,pipe.get_current_pressure_distribution(disp_flag=True),marker='.',c='blue')\n",
|
||||
" lo_pmin, = axs1[0].plot(Pip_x_vec,pipe.get_lowest_pressure_per_node(disp_flag=True),c='red')\n",
|
||||
" lo_pmax, = axs1[0].plot(Pip_x_vec,pipe.get_highest_pressure_per_node(disp_flag=True),c='red')\n",
|
||||
" lo_q, = axs1[1].plot(Pip_x_vec,pipe.get_current_flux_distribution(),marker='.',c='blue')\n",
|
||||
" lo_qmin, = axs1[1].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n",
|
||||
" lo_qmax, = axs1[1].plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n",
|
||||
" fig1.suptitle(str(round(t_vec[it_pipe],2))+ ' s / '+str(round(t_vec[-1],2)) + ' s' )\n",
|
||||
" fig1.canvas.draw()\n",
|
||||
" fig1.tight_layout()\n",
|
||||
" fig1.show()\n",
|
||||
" plt.pause(0.001) "
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
12999
Untertweng.ipynb
12999
Untertweng.ipynb
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user