added Druckrohrleitungs class, based on ETH Code

This commit is contained in:
Brantegger Georg
2022-06-29 13:51:53 +02:00
parent 57cb951f5b
commit 8cfd14838c
7 changed files with 401 additions and 16 deletions

View File

@@ -4,11 +4,11 @@ class Ausgleichsbecken_class:
# units
area_unit = r'$\mathrm{m}^2$'
area_outflux_unit = r'$\mathrm{m}^2$'
level_unit = 'm'
volume_unit = r'$\mathrm{m}^3$'
flux_unit = r'$\mathrm{m}^3/\mathrm{s}$'
time_unit = 's'
level_unit = 'm'
pressure_unit = 'Pa'
time_unit = 's'
volume_unit = r'$\mathrm{m}^3$'
# init
def __init__(self,area,outflux_area,level_min,level_max,timestep = 1):
@@ -73,6 +73,7 @@ class Ausgleichsbecken_class:
h = self.level
dt = self.timestep
p,_ = pressure_conversion(self.pressure,self.pressure_unit,'Pa')
# update to include p_halfstep
p_hs,_ = pressure_conversion(self.pressure,self.pressure_unit,'Pa')
alpha = (self.area_outflux/self.area-1)
h_hs = self.update_level(dt/2)

View File

@@ -91,6 +91,7 @@
"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",

View File

@@ -18,13 +18,13 @@ class Ausgleichsbecken_class:
self.level_max = level_max # highest allowed water level
self.timestep = timestep # timestep of the simulation
# setter
def set_volume(self):
def update_volume(self):
self.volume = self.level*self.area
# setter
def set_initial_level(self,initial_level):
self.level = initial_level
self.set_volume()
self.update_volume()
def set_influx(self,influx):
self.influx = influx
@@ -61,7 +61,10 @@ class Ausgleichsbecken_class:
print('The current outflux is', self.outflux, self.flux_unit)
# methods
def update_level(self,timestep):
# dont update volume here, because update_level gets called to calculate h_halfstep
net_flux = self.influx-self.outflux
delta_V = net_flux*timestep
new_level = (self.volume+delta_V)/self.area