updated visualization of pressure surge
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 39,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 40,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -77,7 +77,24 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 41,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"61.1829727786757\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(pressure_conversion(600000,'Pa','mWS'))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 42,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -94,7 +111,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 43,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -106,6 +123,7 @@
|
||||
"# prepare the vectors in which the pressure and velocity distribution in the pipeline from the previous timestep are stored\n",
|
||||
"v_old = pipe.get_current_velocity_distribution()\n",
|
||||
"p_old = pipe.get_current_pressure_distribution()\n",
|
||||
"p_0 = pipe.get_initial_pressure_distribution()\n",
|
||||
"\n",
|
||||
"# prepare the vectors in which the temporal evolution of the boundary conditions are stored\n",
|
||||
" # keep in mind, that the velocity at the turbine and the pressure at the reservoir are set manually and\n",
|
||||
@@ -137,56 +155,46 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[<matplotlib.lines.Line2D at 0x1efa21574f0>]"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%matplotlib qt5\n",
|
||||
"fig = plt.figure()\n",
|
||||
"plt.plot(v_trans)\n",
|
||||
"fig = plt.figure()\n",
|
||||
"plt.plot(t_vec,v_boundary_tur)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 44,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%matplotlib qt5\n",
|
||||
"fig1,axs1 = plt.subplots(2,1)\n",
|
||||
"# Time loop\n",
|
||||
"\n",
|
||||
"# create a figure and subplots to display the velocity and pressure distribution across the pipeline in each pipeline step\n",
|
||||
"fig1,axs1 = plt.subplots(3,1)\n",
|
||||
"fig1.suptitle(str(0) +' s / '+str(round(t_vec[-1],2)) + ' s' )\n",
|
||||
"axs1[0].set_title('Pressure distribution in pipeline')\n",
|
||||
"axs1[0].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
|
||||
"axs1[0].set_ylabel(r'$p$ [mWS]')\n",
|
||||
"axs1[0].autoscale()\n",
|
||||
"lo_00, = axs1[0].plot(Pip_x_vec,pressure_conversion(p_old,'Pa',pUnit_conv),marker='.')\n",
|
||||
"\n",
|
||||
"axs1[1].set_title('Velocity distribution in pipeline')\n",
|
||||
"axs1[0].set_ylabel(r'$p$ ['+pUnit_conv+']')\n",
|
||||
"axs1[0].set_ylim([-2,200])\n",
|
||||
"axs1[1].set_title('Pressure distribution in pipeline \\n Difference to t=0')\n",
|
||||
"axs1[1].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
|
||||
"axs1[1].set_ylabel(r'$v$ [m/s]')\n",
|
||||
"lo_01, = axs1[1].plot(Pip_x_vec,v_old,marker='.')\n",
|
||||
"# axs1[1].autoscale()\n",
|
||||
"axs1[1].set_ylim([-1.5,1.5])\n",
|
||||
"axs1[1].set_ylabel(r'$p$ ['+pUnit_conv+']')\n",
|
||||
"axs1[1].set_ylim([-76,76])\n",
|
||||
"axs1[2].set_title('Flux distribution in pipeline')\n",
|
||||
"axs1[2].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
|
||||
"axs1[2].set_ylabel(r'$Q$ [$\\mathrm{m}^3 / \\mathrm{s}$]')\n",
|
||||
"axs1[2].set_ylim([-1.5,1.5])\n",
|
||||
"lo_0, = axs1[0].plot(Pip_x_vec,pressure_conversion(p_old,pUnit_calc, pUnit_conv),marker='.')\n",
|
||||
"lo_0min, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n",
|
||||
"lo_0max, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n",
|
||||
"lo_1, = axs1[1].plot(Pip_x_vec,pressure_conversion(p_old-p_0,pUnit_calc, pUnit_conv),marker='.')\n",
|
||||
"lo_1min, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n",
|
||||
"lo_1max, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n",
|
||||
"lo_2, = axs1[1].plot(Pip_x_vec,v_old,marker='.')\n",
|
||||
"lo_2min, = axs1[2].plot(Pip_x_vec,pipe.get_lowest_velocity_per_node(),c='red')\n",
|
||||
"lo_2max, = axs1[2].plot(Pip_x_vec,pipe.get_highest_velocity_per_node(),c='red')\n",
|
||||
"\n",
|
||||
"fig1.tight_layout()\n",
|
||||
"fig1.show()\n",
|
||||
"plt.pause(1)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": 45,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -219,22 +227,35 @@
|
||||
" # plot some stuff\n",
|
||||
" if it_pipe%100 == 0:\n",
|
||||
" # remove line-objects to autoscale axes (there is definetly a better way, but this works ¯\\_(ツ)_/¯ )\n",
|
||||
" lo_00.remove()\n",
|
||||
" lo_01.remove()\n",
|
||||
" # lo_02.remove()\n",
|
||||
" lo_0.remove()\n",
|
||||
" lo_0min.remove()\n",
|
||||
" lo_0max.remove()\n",
|
||||
" lo_1.remove()\n",
|
||||
" lo_1min.remove()\n",
|
||||
" lo_1max.remove()\n",
|
||||
" lo_2.remove()\n",
|
||||
" lo_2min.remove()\n",
|
||||
" lo_2max.remove()\n",
|
||||
" # plot new pressure and velocity distribution in the pipeline\n",
|
||||
" lo_00, = axs1[0].plot(Pip_x_vec,pressure_conversion(p_old,'Pa', pUnit_conv),marker='.',c='blue')\n",
|
||||
" lo_01, = axs1[1].plot(Pip_x_vec,v_old,marker='.',c='blue')\n",
|
||||
" \n",
|
||||
" fig1.suptitle(str(round(t_vec[it_pipe],2)) + '/' + str(round(t_vec[-1],2)))\n",
|
||||
" lo_0, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_current_pressure_distribution(),pUnit_calc,pUnit_conv),marker='.',c='blue')\n",
|
||||
" lo_0min, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n",
|
||||
" lo_0max, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red') \n",
|
||||
" lo_1, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_current_pressure_distribution()-p_0,pUnit_calc,pUnit_conv),marker='.',c='blue')\n",
|
||||
" lo_1min, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n",
|
||||
" lo_1max, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n",
|
||||
" lo_2, = axs1[2].plot(Pip_x_vec,pipe.get_current_flux_distribution(),marker='.',c='blue')\n",
|
||||
" lo_2min, = axs1[2].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n",
|
||||
" lo_2max, = axs1[2].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",
|
||||
" plt.pause(0.000001)"
|
||||
" fig1.show()\n",
|
||||
" plt.pause(0.1) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 46,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -270,7 +291,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3.8.13 ('DT_Slot_3')",
|
||||
"display_name": "Python 3.8.13 ('Georg_DT_Slot3')",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -289,7 +310,7 @@
|
||||
"orig_nbformat": 4,
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48"
|
||||
"hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -251,9 +251,9 @@
|
||||
"lo_0min, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n",
|
||||
"lo_0max, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n",
|
||||
"lo_1, = axs1[1].plot(Pip_x_vec,pressure_conversion(p_old-p_0,pUnit_calc, pUnit_conv),marker='.')\n",
|
||||
"lo_2, = axs1[1].plot(Pip_x_vec,Q_old,marker='.')\n",
|
||||
"lo_1min, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n",
|
||||
"lo_1max, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n",
|
||||
"lo_2, = axs1[1].plot(Pip_x_vec,Q_old,marker='.')\n",
|
||||
"lo_2min, = axs1[2].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n",
|
||||
"lo_2max, = axs1[2].plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n",
|
||||
"\n",
|
||||
|
||||
Reference in New Issue
Block a user