diff --git a/Ausgleichsbecken/Ausgleichsbecken_class_file.py b/Ausgleichsbecken/Ausgleichsbecken_class_file.py index e7f7264..fc65ea1 100644 --- a/Ausgleichsbecken/Ausgleichsbecken_class_file.py +++ b/Ausgleichsbecken/Ausgleichsbecken_class_file.py @@ -9,19 +9,19 @@ parent = os.path.dirname(current) sys.path.append(parent) from functions.pressure_conversion import pressure_conversion -def FODE_function(x,h,A,A_a,p,rho,g): +def FODE_function(x_out,h,A,A_a,p,rho,g): # (FODE ... first order differential equation) # based on the outflux formula by Andreas Malcherek # https://www.youtube.com/watch?v=8HO2LwqOhqQ # adapted for a pressurized pipeline into which the reservoir effuses # and flow direction - # x ... effusion velocity + # x_out ... effusion velocity # h ... level in the reservoir # A_a ... Outflux_Area # A ... Reservoir_Area # g ... gravitational acceleration # rho ... density of the liquid in the reservoir - f = x*abs(x)/h*(A_a/A-1.)+g-p/(rho*h) + f = x_out*abs(x_out)/h*(A_a/A-1.)+g-p/(rho*h) return f @@ -101,8 +101,10 @@ class Ausgleichsbecken_class: def set_steady_state(self,ss_influx,ss_level,display_pressure_unit): # set the steady state (ss) condition in which the net flux is zero # set pressure acting on the outflux area so that the level stays constant - ss_outflux = ss_influx - ss_pressure = self.density*self.g*ss_level-(ss_outflux/self.area_outflux)**2*self.density/2 + ss_outflux = ss_influx + ss_influx_vel = ss_influx/self.area + ss_outflux_vel = ss_outflux/self.area_outflux + ss_pressure = self.density*self.g*ss_level+self.density*ss_outflux_vel*(ss_influx_vel-ss_outflux_vel) self.set_influx(ss_influx) self.set_initial_level(ss_level) @@ -181,7 +183,10 @@ class Ausgleichsbecken_class: return self.level*self.area def update_pressure(self): - p_new = self.density*self.g*self.level-(self.outflux/self.area_outflux)**2*self.density/2 + influx_vel = self.influx/self.area + outflux_vel = self.outflux/self.area_outflux + p_new = self.density*self.g*self.level+self.density*outflux_vel*(influx_vel-outflux_vel) + return p_new def timestep_reservoir_evolution(self): diff --git a/Ausgleichsbecken/Ausgleichsbecken_test_steady_state.ipynb b/Ausgleichsbecken/Ausgleichsbecken_test_steady_state.ipynb index 6d6c071..05239aa 100644 --- a/Ausgleichsbecken/Ausgleichsbecken_test_steady_state.ipynb +++ b/Ausgleichsbecken/Ausgleichsbecken_test_steady_state.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 7, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -21,7 +21,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -31,54 +31,54 @@ "dx = L/n # length of each pipe segment\n", "dt = dx/c \n", "\n", - "# define constants\n", - "initial_level = 10.1 # m\n", - "initial_influx = 0.8 # m³/s\n", - "conversion_pressure_unit = 'mWS'\n", - "\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 = dt # 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": 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", + "# 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.0005 # s\n", + "# simulation_timestep = dt # s\n", "\n", "# # for while loop\n", "# total_min_level = 0.01 # m\n", - "# total_max_time = 1000 # s\n", + "# total_max_time = 100 # s\n", "\n", "# nt = int(total_max_time//simulation_timestep)" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "# define constants\n", + "initial_level = 10.1 # m\n", + "initial_influx = 1. # 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 = 75. # m²\n", + "area_outflux = 2. # m²\n", + "critical_level_low = 0. # m\n", + "critical_level_high = 10. # m\n", + "simulation_timestep = dt # s\n", + "\n", + "# for while loop\n", + "total_min_level = 0.01 # m\n", + "total_max_time = 1 # s\n", + "\n", + "nt = int(total_max_time//simulation_timestep)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -119,7 +119,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -149,16 +149,16 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "19.987523898552976" + "10.1" ] }, - "execution_count": 12, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -170,7 +170,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.8.13 ('Georg_DT_Slot3')", + "display_name": "Python 3.8.13 ('DT_Slot_3')", "language": "python", "name": "python3" }, @@ -189,7 +189,7 @@ "orig_nbformat": 4, "vscode": { "interpreter": { - "hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd" + "hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48" } } },