working on a fix for steady state Ausgleichsbecken
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -21,32 +21,64 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"L = 1000.\n",
|
||||
"n = 10000 # number of pipe segments in discretization\n",
|
||||
"c = 400. \n",
|
||||
"dx = L/n # length of each pipe segment\n",
|
||||
"dt = dx/c \n",
|
||||
"\n",
|
||||
"# define constants\n",
|
||||
"initial_level = 10. # m\n",
|
||||
"initial_influx = 5. # m³/s\n",
|
||||
"# initial_outflux = 1. # m³/s\n",
|
||||
"# initial_pipeline_pressure = 10.\n",
|
||||
"# initial_pressure_unit = 'mWS'\n",
|
||||
"initial_level = 10.1 # m\n",
|
||||
"initial_influx = 0.8 # m³/s\n",
|
||||
"conversion_pressure_unit = 'mWS'\n",
|
||||
"\n",
|
||||
"area_base = 1. # m²\n",
|
||||
"area_outflux = 0.5 # m²\n",
|
||||
"area_base = 75. # m²\n",
|
||||
"area_outflux = (0.9/2)**2*np.pi # m²\n",
|
||||
"critical_level_low = 0. # m\n",
|
||||
"critical_level_high = 10. # m\n",
|
||||
"simulation_timestep = 0.001 # s\n",
|
||||
"simulation_timestep = dt # s\n",
|
||||
"\n",
|
||||
"# for while loop\n",
|
||||
"total_min_level = 0.01 # m\n",
|
||||
"total_max_time = 1000 # s"
|
||||
"total_max_time = 1000 # s\n",
|
||||
"\n",
|
||||
"nt = int(total_max_time//simulation_timestep)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# # define constants\n",
|
||||
"# initial_level = 10.1 # m\n",
|
||||
"# initial_influx = 5. # m³/s\n",
|
||||
"# # initial_outflux = 1. # m³/s\n",
|
||||
"# # initial_pipeline_pressure = 10.\n",
|
||||
"# # initial_pressure_unit = 'mWS'\n",
|
||||
"# conversion_pressure_unit = 'mWS'\n",
|
||||
"\n",
|
||||
"# area_base = 1. # m²\n",
|
||||
"# area_outflux = 0.5 # m²\n",
|
||||
"# critical_level_low = 0. # m\n",
|
||||
"# critical_level_high = 10. # m\n",
|
||||
"# simulation_timestep = 0.0005 # s\n",
|
||||
"\n",
|
||||
"# # for while loop\n",
|
||||
"# total_min_level = 0.01 # m\n",
|
||||
"# total_max_time = 1000 # s\n",
|
||||
"\n",
|
||||
"# nt = int(total_max_time//simulation_timestep)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -60,22 +92,25 @@
|
||||
"# V.pressure = converted_pressure\n",
|
||||
"V.set_steady_state(initial_influx,initial_level,conversion_pressure_unit)\n",
|
||||
"\n",
|
||||
"time_vec = np.arange(0,total_max_time,simulation_timestep)\n",
|
||||
"outflux_vec = np.empty_like(time_vec)\n",
|
||||
"time_vec = np.arange(0,nt+1,1)*simulation_timestep\n",
|
||||
"outflux_vec = np.zeros_like(time_vec)\n",
|
||||
"outflux_vec[0] = V.get_current_outflux()\n",
|
||||
"level_vec = np.empty_like(time_vec)\n",
|
||||
"level_vec = np.zeros_like(time_vec)\n",
|
||||
"level_vec[0] = V.get_current_level()\n",
|
||||
"pressure_vec = np.zeros_like(time_vec)\n",
|
||||
"pressure_vec[0] = V.get_current_pressure()\n",
|
||||
"\n",
|
||||
"# pressure_vec = np.full_like(time_vec,converted_pressure)*((np.sin(time_vec)+1)*np.exp(-time_vec/50))\n",
|
||||
"pressure_vec = np.full_like(time_vec,V.get_current_pressure())\n",
|
||||
" \n",
|
||||
"i_max = -1\n",
|
||||
"\n",
|
||||
"for i in range(np.size(time_vec)-1):\n",
|
||||
" V.set_pressure(pressure_vec[i])\n",
|
||||
"for i in range(1,nt+1):\n",
|
||||
" V.set_pressure(pressure_vec[i-1])\n",
|
||||
" V.set_outflux(outflux_vec[i-1])\n",
|
||||
" V.timestep_reservoir_evolution()\n",
|
||||
" outflux_vec[i+1] = V.get_current_outflux()\n",
|
||||
" level_vec[i+1] = V.get_current_level()\n",
|
||||
" outflux_vec[i] = V.get_current_outflux()\n",
|
||||
" level_vec[i] = V.get_current_level()\n",
|
||||
" pressure_vec[i] = V.get_current_pressure()\n",
|
||||
" if V.level < total_min_level:\n",
|
||||
" i_max = i\n",
|
||||
" break\n",
|
||||
@@ -84,7 +119,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -111,6 +146,26 @@
|
||||
"\n",
|
||||
"fig1.tight_layout() "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"19.987523898552976"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"V.get_current_level()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
Reference in New Issue
Block a user