code cleanup:

consistenly use getter and setter methods
commenting etc
This commit is contained in:
Brantegger Georg
2022-07-27 11:40:58 +02:00
parent ac8bfdb7c6
commit d1c15090dc
13 changed files with 956 additions and 584 deletions

View File

@@ -28,9 +28,9 @@
"# 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_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",
@@ -41,12 +41,12 @@
"\n",
"# for while loop\n",
"total_min_level = 0.01 # m\n",
"total_max_time = 1000 # s"
"total_max_time = 1000 # s"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@@ -72,7 +72,6 @@
"i_max = -1\n",
"\n",
"for i in range(np.size(time_vec)-1):\n",
" # update to include p_halfstep\n",
" V.set_pressure(pressure_vec[i])\n",
" V.timestep_reservoir_evolution()\n",
" outflux_vec[i+1] = V.get_current_outflux()\n",
@@ -85,12 +84,12 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"\n",
"fig1, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1)\n",
"fig1, (ax1, ax2, ax3) = plt.subplots(3, 1)\n",
"fig1.set_figheight(10)\n",
"fig1.suptitle('Ausgleichsbecken')\n",
"\n",
@@ -109,29 +108,6 @@
"ax3.set_xlabel(r'$t$ ['+V.time_unit+']')\n",
"ax3.legend()\n",
"\n",
"# plt.subplots_adjust(left=0.2, bottom=0.2)\n",
"ax4.set_axis_off()\n",
"cell_text = np.array([[level_vec[0], V.level_unit], \\\n",
" [initial_influx, V.flux_unit], \\\n",
" [outflux_vec[0], V.flux_unit], \\\n",
" [simulation_timestep, V.time_unit], \\\n",
" [area_base, V.area_unit], \\\n",
" [area_outflux, V.area_unit]])\n",
"\n",
"row_labels =['initial_level', \\\n",
" 'initial_influx', \\\n",
" 'initial_outflux', \\\n",
" 'simulation_timestep', \\\n",
" 'area_base', \\\n",
" 'area_outflux']\n",
"\n",
"plt.table(cellText=cell_text, \\\n",
" cellLoc='center', \\\n",
" colWidths=[0.3,0.1,0.3], \\\n",
" rowLabels=row_labels, \\\n",
" loc = 1, \\\n",
" rowLoc='left', \\\n",
" fontsize = 15.)\n",
"\n",
"fig1.tight_layout() "
]