added set steady state functionality

This commit is contained in:
Georg ´Brantegger
2022-07-21 15:27:15 +02:00
parent d966904606
commit 2331c7cc5b
3 changed files with 32 additions and 5 deletions

View File

@@ -33,6 +33,9 @@ class Ausgleichsbecken_class:
velocity_unit_print = 'm/s' velocity_unit_print = 'm/s'
volume_unit_print = '' volume_unit_print = ''
g = 9.81 # m/s²
rho = 1000 # kg/m³
# init # init
def __init__(self,area,outflux_area,level_min = 0,level_max = np.inf ,timestep = 1): def __init__(self,area,outflux_area,level_min = 0,level_max = np.inf ,timestep = 1):
self.area = area # base area of the rectangular structure self.area = area # base area of the rectangular structure
@@ -67,6 +70,16 @@ class Ausgleichsbecken_class:
self.pressure = pressure self.pressure = pressure
self.pressure_unit = pressure_unit self.pressure_unit = pressure_unit
self.pressure_unit_print = display_pressure_unit self.pressure_unit_print = display_pressure_unit
def set_steady_state(self,ss_influx,ss_level,pressure_unit,display_pressure_unit):
ss_outflux = ss_influx
ss_outflux_vel = ss_outflux/self.area_outflux
ss_pressure = self.rho*self.g*ss_level-ss_outflux_vel**2*self.rho/2
self.set_initial_level(ss_level)
self.set_influx(ss_influx)
self.set_outflux(ss_outflux)
self.set_pressure(ss_pressure,pressure_unit,display_pressure_unit)
# getter # getter
def get_info(self, full = False): def get_info(self, full = False):
new_line = '\n' new_line = '\n'

View File

@@ -41,7 +41,7 @@ class Druckrohrleitung_class:
self.n_seg = number_segments self.n_seg = number_segments
self.angle = pipeline_angle self.angle = pipeline_angle
self.f_D = Darcy_friction_factor # = Rohrreibungszahl oder flow coefficient self.f_D = Darcy_friction_factor # = Rohrreibungszahl oder flow coefficient
self.density = 1000 self.rho = rho
self.g = g self.g = g
self.dx = total_length/number_segments self.dx = total_length/number_segments
@@ -89,8 +89,8 @@ class Druckrohrleitung_class:
self.v_old = self.v0.copy() self.v_old = self.v0.copy()
self.v = np.empty_like(self.v_old) self.v = np.empty_like(self.v_old)
def set_boundary_conditions_next_timestep(self,v_reservoir,p_reservoir,v_turbine,input_unit_pressure = 'Pa'): def set_boundary_conditions_next_timestep(self,v_reservoir,p_reservoir,v_turbine):
rho = self.density rho = self.rho
c = self.c c = self.c
f_D = self.f_D f_D = self.f_D
dt = self.dt dt = self.dt
@@ -108,6 +108,14 @@ class Druckrohrleitung_class:
self.p[0] = self.p_boundary_res.copy() self.p[0] = self.p_boundary_res.copy()
self.p[-1] = self.p_boundary_tur.copy() self.p[-1] = self.p_boundary_tur.copy()
def set_steady_state(self,ss_flux,ss_level_reservoir,pl_vec,h_vec,pressure_unit,display_pressure_unit):
ss_v0 = np.full(self.n_seg+1,ss_flux/(self.dia**2/4*np.pi))
ss_pressure = (self.rho*self.g*(ss_level_reservoir+h_vec)-ss_v0**2*self.rho/2)-(self.f_D*pl_vec/self.dia*self.rho/2*ss_v0**2)
self.set_initial_flow_velocity(ss_v0)
self.set_initial_pressure(ss_pressure,pressure_unit,display_pressure_unit)
# getter # getter
def get_info(self): def get_info(self):
new_line = '\n' new_line = '\n'
@@ -150,7 +158,7 @@ class Druckrohrleitung_class:
def timestep_characteristic_method(self): def timestep_characteristic_method(self):
#number of nodes #number of nodes
nn = self.n_seg+1 nn = self.n_seg+1
rho = self.density rho = self.rho
c = self.c c = self.c
f_D = self.f_D f_D = self.f_D
dt = self.dt dt = self.dt

View File

@@ -31,4 +31,10 @@ class Francis_Turbine:
LA_diff_max = self.d_LA_max_dt*timestep LA_diff_max = self.d_LA_max_dt*timestep
if abs(LA_diff) > LA_diff_max: if abs(LA_diff) > LA_diff_max:
LA_diff = np.sign(LA_diff)*LA_diff_max LA_diff = np.sign(LA_diff)*LA_diff_max
self.LA = self.LA-LA_diff self.LA = self.LA-LA_diff
def set_steady_state(self,ss_flux,ss_pressure):
ss_LA = self.LA_n*ss_flux/self.Q_n*np.sqrt(self.p_n/ss_pressure)
self.set_LA(ss_LA)
if ss_LA < 0 or ss_LA > 1:
print('LA out of range')