still cleaning up folder structures

This commit is contained in:
Georg ´Brantegger
2022-07-01 09:01:56 +02:00
parent 59998a707c
commit ba48bbe057
4 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,154 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from Ausgleichsbecken_class_file import Ausgleichsbecken_class\n",
"import matplotlib.pyplot as plt\n",
"from pressure_conversion import pressure_conversion"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"# define constants\n",
"initial_level = 5. # m\n",
"initial_influx = 0.5 # m³/s\n",
"initial_outflux = 0. # m³/s\n",
"initial_pipeline_pressure = 1\n",
"initial_pressure_unit = 'bar'\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.001 # s\n",
"\n",
"# for while loop\n",
"total_min_level = 0.01 # m\n",
"total_max_time = 300 # s"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib qt\n",
"\n",
"V = Ausgleichsbecken_class(area_base, area_outflux, critical_level_low, critical_level_high,simulation_timestep)\n",
"V.set_initial_level(initial_level) \n",
"V.set_influx(initial_influx)\n",
"V.set_outflux(initial_outflux)\n",
"\n",
"converted_pressure, V.pressure_unit = pressure_conversion(initial_pipeline_pressure,input_unit = initial_pressure_unit, target_unit = conversion_pressure_unit)\n",
"V.pressure = converted_pressure\n",
"\n",
"time_vec = np.arange(0,total_max_time,simulation_timestep)\n",
"outflux_vec = np.empty_like(time_vec)\n",
"outflux_vec[0] = initial_outflux\n",
"level_vec = np.empty_like(time_vec)\n",
"level_vec[0] = initial_level\n",
"\n",
"pressure_vec = np.full_like(time_vec,converted_pressure)*((np.sin(time_vec/5)+1)*np.exp(-time_vec/50))\n",
" \n",
" \n",
"i_max = -1\n",
"\n",
"for i in range(np.size(time_vec)-1):\n",
" # update to include p_halfstep\n",
" V.pressure = pressure_vec[i]\n",
" V.e_RK_4()\n",
" V.level = V.update_level(V.timestep)\n",
" V.set_volume()\n",
" outflux_vec[i+1] = V.outflux\n",
" level_vec[i+1] = V.level\n",
" if V.level < total_min_level:\n",
" i_max = i\n",
" break\n",
"\n",
"\n",
"fig1, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1)\n",
"fig1.set_figheight(10)\n",
"fig1.suptitle('Ausgleichsbecken')\n",
"\n",
"ax1.plot(time_vec[:i_max],level_vec[:i_max], label='Water level')\n",
"ax1.set_ylabel(r'$h$ ['+V.level_unit+']')\n",
"ax1.set_xlabel(r'$t$ ['+V.time_unit+']')\n",
"ax1.legend()\n",
"\n",
"ax2.plot(time_vec[:i_max],outflux_vec[:i_max], label='Outflux')\n",
"ax2.set_ylabel(r'$Q_{out}$ ['+V.flux_unit+']')\n",
"ax2.set_xlabel(r'$t$ ['+V.time_unit+']')\n",
"ax2.legend()\n",
"\n",
"ax3.plot(time_vec[:i_max],pressure_vec[:i_max], label='Pipeline pressure at reservoir')\n",
"ax3.set_ylabel(r'$p_{pipeline}$ ['+V.pressure_unit+']')\n",
"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([[initial_level, V.level_unit], \\\n",
" [initial_influx, V.flux_unit], \\\n",
" [initial_outflux, 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() "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.13 ('Georg_DT_Slot3')",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}