updated test programm for the Ausgleichsbecken

class to reflect the use Pa as pressure unit within the class
This commit is contained in:
Brantegger Georg
2022-07-18 08:00:29 +02:00
parent 04819d2e68
commit 6d56e3d1f2

View File

@@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 38,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -21,16 +21,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 39,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# define constants\n", "# define constants\n",
"initial_level = 5. # m\n", "initial_level = 5. # m\n",
"initial_influx = 0.5 # m³/s\n", "initial_influx = 0. # m³/s\n",
"initial_outflux = 0. # m³/s\n", "initial_outflux = 0. # m³/s\n",
"initial_pipeline_pressure = 1\n", "initial_pipeline_pressure = 5.\n",
"initial_pressure_unit = 'bar'\n", "initial_pressure_unit = 'mWS'\n",
"conversion_pressure_unit = 'mWS'\n", "conversion_pressure_unit = 'mWS'\n",
"\n", "\n",
"area_base = 1. # m²\n", "area_base = 1. # m²\n",
@@ -46,7 +46,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 40,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -57,7 +57,7 @@
"V.set_influx(initial_influx)\n", "V.set_influx(initial_influx)\n",
"V.set_outflux(initial_outflux)\n", "V.set_outflux(initial_outflux)\n",
"\n", "\n",
"converted_pressure, V.pressure_unit = pressure_conversion(initial_pipeline_pressure,input_unit = initial_pressure_unit, target_unit = conversion_pressure_unit)\n", "converted_pressure,_ = pressure_conversion(initial_pipeline_pressure,input_unit = initial_pressure_unit, target_unit = 'Pa')\n",
"V.pressure = converted_pressure\n", "V.pressure = converted_pressure\n",
"\n", "\n",
"time_vec = np.arange(0,total_max_time,simulation_timestep)\n", "time_vec = np.arange(0,total_max_time,simulation_timestep)\n",
@@ -66,8 +66,7 @@
"level_vec = np.empty_like(time_vec)\n", "level_vec = np.empty_like(time_vec)\n",
"level_vec[0] = initial_level\n", "level_vec[0] = initial_level\n",
"\n", "\n",
"pressure_vec = np.full_like(time_vec,converted_pressure)*((np.sin(time_vec/5)+1)*np.exp(-time_vec/50))\n", "pressure_vec = np.full_like(time_vec,converted_pressure)*((np.sin(time_vec)+1)*np.exp(-time_vec/50))\n",
" \n",
" \n", " \n",
"i_max = -1\n", "i_max = -1\n",
"\n", "\n",
@@ -82,7 +81,15 @@
" if V.level < total_min_level:\n", " if V.level < total_min_level:\n",
" i_max = i\n", " i_max = i\n",
" break\n", " break\n",
"\n", "\n"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [],
"source": [
"\n", "\n",
"fig1, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1)\n", "fig1, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1)\n",
"fig1.set_figheight(10)\n", "fig1.set_figheight(10)\n",
@@ -98,8 +105,8 @@
"ax2.set_xlabel(r'$t$ ['+V.time_unit+']')\n", "ax2.set_xlabel(r'$t$ ['+V.time_unit+']')\n",
"ax2.legend()\n", "ax2.legend()\n",
"\n", "\n",
"ax3.plot(time_vec[:i_max],pressure_vec[:i_max], label='Pipeline pressure at reservoir')\n", "ax3.plot(time_vec[:i_max],pressure_conversion(pressure_vec[:i_max],'Pa',conversion_pressure_unit)[0], label='Pipeline pressure at reservoir')\n",
"ax3.set_ylabel(r'$p_{pipeline}$ ['+V.pressure_unit+']')\n", "ax3.set_ylabel(r'$p_{pipeline}$ ['+conversion_pressure_unit+']')\n",
"ax3.set_xlabel(r'$t$ ['+V.time_unit+']')\n", "ax3.set_xlabel(r'$t$ ['+V.time_unit+']')\n",
"ax3.legend()\n", "ax3.legend()\n",
"\n", "\n",
@@ -133,7 +140,7 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3.8.13 ('DT_Slot_3')", "display_name": "Python 3.8.13 ('Georg_DT_Slot3')",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@@ -152,7 +159,7 @@
"orig_nbformat": 4, "orig_nbformat": 4,
"vscode": { "vscode": {
"interpreter": { "interpreter": {
"hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48" "hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd"
} }
} }
}, },