corrected steady state pressure to work properly
This commit is contained in:
@@ -9,19 +9,19 @@ parent = os.path.dirname(current)
|
|||||||
sys.path.append(parent)
|
sys.path.append(parent)
|
||||||
from functions.pressure_conversion import pressure_conversion
|
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)
|
# (FODE ... first order differential equation)
|
||||||
# based on the outflux formula by Andreas Malcherek
|
# based on the outflux formula by Andreas Malcherek
|
||||||
# https://www.youtube.com/watch?v=8HO2LwqOhqQ
|
# https://www.youtube.com/watch?v=8HO2LwqOhqQ
|
||||||
# adapted for a pressurized pipeline into which the reservoir effuses
|
# adapted for a pressurized pipeline into which the reservoir effuses
|
||||||
# and flow direction
|
# and flow direction
|
||||||
# x ... effusion velocity
|
# x_out ... effusion velocity
|
||||||
# h ... level in the reservoir
|
# h ... level in the reservoir
|
||||||
# A_a ... Outflux_Area
|
# A_a ... Outflux_Area
|
||||||
# A ... Reservoir_Area
|
# A ... Reservoir_Area
|
||||||
# g ... gravitational acceleration
|
# g ... gravitational acceleration
|
||||||
# rho ... density of the liquid in the reservoir
|
# 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
|
return f
|
||||||
|
|
||||||
|
|
||||||
@@ -101,8 +101,10 @@ class Ausgleichsbecken_class:
|
|||||||
def set_steady_state(self,ss_influx,ss_level,display_pressure_unit):
|
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 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
|
# set pressure acting on the outflux area so that the level stays constant
|
||||||
ss_outflux = ss_influx
|
ss_outflux = ss_influx
|
||||||
ss_pressure = self.density*self.g*ss_level-(ss_outflux/self.area_outflux)**2*self.density/2
|
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_influx(ss_influx)
|
||||||
self.set_initial_level(ss_level)
|
self.set_initial_level(ss_level)
|
||||||
@@ -181,7 +183,10 @@ class Ausgleichsbecken_class:
|
|||||||
return self.level*self.area
|
return self.level*self.area
|
||||||
|
|
||||||
def update_pressure(self):
|
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
|
return p_new
|
||||||
|
|
||||||
def timestep_reservoir_evolution(self):
|
def timestep_reservoir_evolution(self):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 7,
|
"execution_count": 13,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 8,
|
"execution_count": 14,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@@ -31,54 +31,54 @@
|
|||||||
"dx = L/n # length of each pipe segment\n",
|
"dx = L/n # length of each pipe segment\n",
|
||||||
"dt = dx/c \n",
|
"dt = dx/c \n",
|
||||||
"\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",
|
"# # define constants\n",
|
||||||
"# initial_level = 10.1 # m\n",
|
"# initial_level = 10.1 # m\n",
|
||||||
"# initial_influx = 5. # m³/s\n",
|
"# initial_influx = 0.8 # m³/s\n",
|
||||||
"# # initial_outflux = 1. # m³/s\n",
|
|
||||||
"# # initial_pipeline_pressure = 10.\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 = 75. # m²\n",
|
||||||
"# area_outflux = 0.5 # m²\n",
|
"# area_outflux = (0.9/2)**2*np.pi # m²\n",
|
||||||
"# critical_level_low = 0. # m\n",
|
"# critical_level_low = 0. # m\n",
|
||||||
"# critical_level_high = 10. # m\n",
|
"# critical_level_high = 10. # m\n",
|
||||||
"# simulation_timestep = 0.0005 # s\n",
|
"# simulation_timestep = dt # s\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# # for while loop\n",
|
"# # for while loop\n",
|
||||||
"# total_min_level = 0.01 # m\n",
|
"# total_min_level = 0.01 # m\n",
|
||||||
"# total_max_time = 1000 # s\n",
|
"# total_max_time = 100 # s\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# nt = int(total_max_time//simulation_timestep)"
|
"# nt = int(total_max_time//simulation_timestep)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"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": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": 17,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@@ -149,16 +149,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 12,
|
"execution_count": 18,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"19.987523898552976"
|
"10.1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 12,
|
"execution_count": 18,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.8.13 ('Georg_DT_Slot3')",
|
"display_name": "Python 3.8.13 ('DT_Slot_3')",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@@ -189,7 +189,7 @@
|
|||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd"
|
"hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user