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
|
#initialize the vectors in which the old and new pressures are stored for the method of characteristics
|
||||||
self.p_old = p0.copy()
|
self.p_old = p0.copy()
|
||||||
self.p = 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
|
# 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_min = p0.copy()
|
||||||
self.p_max = p0.copy()
|
self.p_max = p0.copy()
|
||||||
@@ -220,6 +221,12 @@ class Druckrohrleitung_class:
|
|||||||
def get_highest_flux_per_node(self):
|
def get_highest_flux_per_node(self):
|
||||||
return self.v_max*self.A
|
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):
|
def timestep_characteristic_method(self):
|
||||||
# use the method of characteristics to calculate the pressure and velocities at all nodes except the boundary ones
|
# 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",
|
" # 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",
|
"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",
|
"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",
|
"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"
|
"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",
|
"\n",
|
||||||
" # the the boundary condition in the pipe.object and thereby calculate boundary pressure at turbine\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.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",
|
" p_boundary_tur[it_pipe] = pipe.get_current_pressure_distribution()[-1]\n",
|
||||||
" v_boundary_res[it_pipe] = pipe.get_current_velocity_distribution()[0]\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",
|
" Q_boundary_res[it_pipe] = pipe.get_current_flux_distribution()[0]\n",
|
||||||
|
|||||||
@@ -231,7 +231,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
" # the the boundary condition in the pipe.object and thereby calculate boundary pressure at turbine\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.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",
|
" p_boundary_tur[it_pipe] = pipe.get_current_pressure_distribution()[-1]\n",
|
||||||
" v_boundary_res[it_pipe] = pipe.get_current_velocity_distribution()[0]\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",
|
" Q_boundary_res[it_pipe] = pipe.get_current_flux_distribution()[0]\n",
|
||||||
@@ -245,6 +245,7 @@
|
|||||||
" Q_old = pipe.get_current_flux_distribution()\n",
|
" Q_old = pipe.get_current_flux_distribution()\n",
|
||||||
"\n",
|
"\n",
|
||||||
" # plot some stuff\n",
|
" # plot some stuff\n",
|
||||||
|
" if it_pipe%50 == 0:\n",
|
||||||
" # remove line-objects to autoscale axes (there is definetly a better way, but this works ¯\\_(ツ)_/¯ )\n",
|
" # remove line-objects to autoscale axes (there is definetly a better way, but this works ¯\\_(ツ)_/¯ )\n",
|
||||||
" lo_p.remove()\n",
|
" lo_p.remove()\n",
|
||||||
" lo_pmin.remove()\n",
|
" lo_pmin.remove()\n",
|
||||||
|
|||||||
12999
Untertweng.ipynb
12999
Untertweng.ipynb
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user