def baffle_s(self): """The spacing between baffles.""" baffle_s = ((self.BAFFLE_K / ( (2 * self.expansion_h * (self.vel_grad_avg**2) * pc.viscosity_kinematic(self.temp))).to_base_units())**(1 / 3) * self.q / self.chan_w).to(u.cm) return baffle_s
def _set_outlet_pipe(self): outlet_pipe_q = self.q / self.outlet_pipe_n # outlet_pipe_nd = pc.pipe_flow_nd( # outlet_pipe_q, # ut.get_sdr(self.outlet_pipe_spec), # self.outlet_pipe_hl_max, # self.outlet_pipe_l, # pc.viscosity_kinematic(self.temp), # mat.PVC_PIPE_ROUGH, # self.outlet_pipe_k_minor # ) outlet_pipe_nd = pc.pipe_flow_nd( outlet_pipe_q, ut.get_sdr(self.outlet_pipe_spec), self.outlet_pipe_hl_max, self.outlet_pipe_l, pc.viscosity_kinematic(self.temp), mat.PVC_PIPE_ROUGH, 2 * hl.EL90_K_MINOR + hl.PIPE_ENTRANCE_K_MINOR + \ hl.PIPE_EXIT_K_MINOR ) self.outlet_pipe = Pipe(l=self.outlet_pipe_l, q=outlet_pipe_q, size=outlet_pipe_nd, spec=self.outlet_pipe_spec, k_minor=self.outlet_pipe_k_minor)
def chan_w_min_hs_ratio(self): """The minimum channel width.""" chan_w_min_hs_ratio = ( (self.HS_RATIO_MIN * self.q / self.end_water_depth) * (self.BAFFLE_K / (2 * self.end_water_depth * pc.viscosity_kinematic(self.temp) * self.vel_grad_avg**2))**(1 / 3)).to(u.cm) return chan_w_min_hs_ratio
def vel_grad_avg(self): """Calculate the average velocity gradient (G-bar) of water flowing through the flocculator. :returns: Average velocity gradient (G-bar) :rtype: float * 1 / second """ return ((u.standard_gravity * self.HL) / (pc.viscosity_kinematic(self.temp) * self.Gt)).to(u.s ** -1)
def _inlet_depth_hl_min(self): """Minimum depth of the inlet channel to stay within acceptable head loss. """ inlet_chan_hl_depth = pc.horiz_chan_h( self.q, self.inlet_w_pre_weir, self.inlet_hl_max, self.l, pc.viscosity_kinematic(self.temp), mat.CONCRETE_PIPE_ROUGH, False) return inlet_chan_hl_depth
def inlet_w_post_weir(self): """Width of the inlet channel (post-weir)""" inlet_w_post_weir = max( self.w_min, pc.horiz_chan_w(self.q, self.inlet_h, self.inlet_h, self.l, pc.viscosity_kinematic(self.temp), mat.CONCRETE_PIPE_ROUGH, 1, 0)) return inlet_w_post_weir
def vel_term_floc(ConcAl, ConcClay, coag, material, DIM_FRACTAL, DiamTarget, Temp): """Calculate floc terminal velocity.""" WaterDensity = pc.density_water(Temp).magnitude return (((pc.gravity.magnitude * material.Diameter**2) / (18 * PHI_FLOC * pc.viscosity_kinematic(Temp).magnitude)) * ((dens_floc_init(ConcAl, ConcClay, coag, material).magnitude - WaterDensity) / WaterDensity) * (DiamTarget / material.Diameter)**(DIM_FRACTAL - 1))
def baffle_S(self): """Return the spacing between baffles. :returns: Spacing between baffles :rtype: int """ return ((self.BAFFLE_K / ((2 * self.expansion_H * (self.vel_grad_avg ** 2) * pc.viscosity_kinematic(self.temp))).to_base_units()) ** (1/3) * self.Q / self.channel_W).to(u.cm)
def _inlet_w_pre_weir_hl_min(self): """Minimum width of the inlet channel (pre-weir) that doesn't exceed the permissible head loss. """ inlet_w_pre_weir_hl_min = pc.horiz_chan_w( self.q, self.inlet_depth_max, self.inlet_hl_max, self.l, pc.viscosity_kinematic(self.temp), mat.CONCRETE_PIPE_ROUGH, False, 0) return inlet_w_pre_weir_hl_min
def expansion_h_max(self): """"The maximum distance between expansions for the largest allowable H/S ratio. """ expansion_h_max = ( ((self.BAFFLE_K / (2 * pc.viscosity_kinematic(self.temp) * (self.vel_grad_avg**2))) * (self.q * self.HS_RATIO_MAX / self.chan_w)**3)**(1 / 4)).to(u.m) return expansion_h_max
def diam_floc_vel_term(ConcAl, ConcClay, coag, material, DIM_FRACTAL, VelTerm, Temp): """Calculate floc diamter as a function of terminal velocity.""" WaterDensity = pc.density_water(Temp).magnitude return (material.Diameter * ( ((18 * VelTerm * PHI_FLOC * pc.viscosity_kinematic(Temp).magnitude) / (pc.gravity.magnitude * material.Diameter**2)) * (WaterDensity / (dens_floc_init(ConcAl, ConcClay, coag, material).magnitude - WaterDensity)))**(1 / (DIM_FRACTAL - 1)))
def outlet_pipe_q_max(self): """Maximum flow through the outlet pipe.""" outlet_pipe_q_max = pc.flow_pipe( pipe.ID_SDR(self.outlet_pipe_nd_max, ut.get_sdr(self.outlet_pipe_spec)), self.outlet_pipe_hl_max, self.outlet_pipe_l, pc.viscosity_kinematic(self.temp), mat.PVC_PIPE_ROUGH, self.outlet_pipe_k_minor) return ut.round_step(outlet_pipe_q_max.to(u.L / u.s), step=0.0001 * u.L / u.s)
def W_min_HS_ratio(self): """Calculate the minimum flocculator channel width, given the minimum ratio between expansion height (H) and baffle spacing (S). :returns: Minimum channel width given H_e/S :rtype: float * centimeter """ return ((self.HS_RATIO_MIN * self.Q / self.downstream_H) * (self.BAFFLE_K / (2 * self.downstream_H * pc.viscosity_kinematic(self.temp) * self.vel_grad_avg ** 2)) ** (1/3) ).to(u.cm)
def outlet_man_nd(self): """The nominal diameter of the outlet manifold.""" outlet_man_nd = pc.manifold_nd(self.q_tank, self.OUTLET_MAN_HL, self.l_inner, self.outlet_man_orifice_q_ratio_max, pc.viscosity_kinematic(self.temp), mat.PVC_PIPE_ROUGH.to(u.m), hl.PIPE_EXIT_K_MINOR, self.outlet_man_orifice_n_est, self.outlet_man_sdr) return outlet_man_nd
def pc_viscous(EnergyDis, Temp, Time, DiamTube, ConcClay, ConcAl, ConcNatOrgMat, NatOrgMat, coag, material, FittingParam, RatioHeightDiameter): """""" return ((3 / 2) * np.log10( (2 / 3) * np.pi * FittingParam * Time * np.sqrt(EnergyDis / (pc.viscosity_kinematic(Temp).magnitude)) * alpha(DiamTube, ConcClay, ConcAl, ConcNatOrgMat, NatOrgMat, coag, material, RatioHeightDiameter) * (np.pi / 6)**(2 / 3) * (material.Diameter / sep_dist_clay(ConcClay, material).magnitude)**2 + 1))
def nu(self): """The kinematic viscosity of the fluid passing through the pipeline component. """ if self.fluid_type == 'water': return pc.viscosity_kinematic(self.temp) elif self.fluid_type == 'pacl': print('unimplemented') pass elif self.fluid_type == 'alum': print('unimplemented') pass
def expansion_max_H(self): """"Return the maximum distance between expansions for the largest allowable H/S ratio. :returns: Maximum expansion distance :rtype: float * meter Examples -------- exp_dist_max(20*u.L/u.s, 40*u.cm, 37000, 25*u.degC, 2*u.m) 0.375 meter """ return (((self.BAFFLE_K / (2 * pc.viscosity_kinematic(self.temp) * (self.vel_grad_avg ** 2))) * (self.Q * self.RATIO_MAX_HS / self.channel_W) ** 3) ** (1/4)).to(u.m)
def viscosity_kinematic_pacl(conc_pacl, temp): """Return the dynamic viscosity of water at a given temperature. If given units, the function will automatically convert to Kelvin. If not given units, the function will assume Kelvin. This function assumes that the temperature dependence can be explained based on the effect on water and that there is no confounding effect from the coagulant. """ nu = (1 + (2.383 * 10**-5) * conc_pacl**1.893) * pc.viscosity_kinematic(temp).magnitude return nu
def _alum_nu(self, coag_conc): """Return the dynamic viscosity of water at a given temperature. If given units, the function will automatically convert to Kelvin. If not given units, the function will assume Kelvin. This function assumes that the temperature dependence can be explained based on the effect on water and that there is no confounding effect from the coagulant. """ alum_nu = \ (1 + (4.255 * 10 ** -6) * coag_conc.magnitude ** 2.289) * \ pc.viscosity_kinematic(self.temp) return alum_nu
def _set_drain_pipe(self): """The inner diameter of the entrance tank drain pipe.""" drain_pipe_k_minor = \ hl.PIPE_ENTRANCE_K_MINOR + hl.PIPE_EXIT_K_MINOR + hl.EL90_K_MINOR nu = pc.viscosity_kinematic(self.temp) drain_id = pc.diam_pipe(self.q, self.floc_end_depth, self.floc_end_depth, nu, mat.PVC_PIPE_ROUGH, drain_pipe_k_minor) self.drain_pipe = Pipe(id=drain_id, k_minor=drain_pipe_k_minor, spec=self.spec)
def viscosity_kinematic_chem(conc_chem, temp, en_chem): """Return the dynamic viscosity of water at a given temperature. If given units, the function will automatically convert to Kelvin. If not given units, the function will assume Kelvin. """ if en_chem == 0: nu = viscosity_kinematic_alum(conc_chem, temp).magnitude if en_chem == 1: nu = viscosity_kinematic_pacl(conc_chem, temp).magnitude if en_chem not in [0, 1]: nu = pc.viscosity_kinematic(temp).magnitude return nu
def _set_drain_pipe(self): drain_k_minor = hl.PIPE_ENTRANCE_K_MINOR + hl.PIPE_EXIT_K_MINOR + hl.EL90_K_MINOR drain_nd = pc.pipe_flow_nd(self.q, ut.get_sdr(self.drain_spec), self.SED_DEPTH_EST, self.SED_DEPTH_EST + self.inlet_w, pc.viscosity_kinematic(self.temp), mat.PVC_PIPE_ROUGH, drain_k_minor) self.drain_pipe = Pipe( size=drain_nd, spec=self.drain_spec, k_minor=drain_k_minor, )
def time_col_laminar(EnergyDis, Temp, ConcAl, ConcClay, coag, material, DiamTarget, DiamTube, DIM_FRACTAL, RatioHeightDiameter): """Calculate single collision time for laminar flow mediated collisions. Calculated as a function of floc size. """ return (( (1 / 6) * ((6 / np.pi)**(1 / 3)) * frac_vol_floc_initial(ConcAl, ConcClay, coag, material)**(-2 / 3) * (pc.viscosity_kinematic(Temp).magnitude / EnergyDis)**(1 / 2) * (DiamTarget / material.Diameter)**(2 * DIM_FRACTAL / 3 - 2) ) # End of the numerator / (gamma_coag(ConcClay, ConcAl, coag, material, DiamTube, RatioHeightDiameter)) # End of the denominator )
def outlet_post_weir_w(self): """Width of the outlet channel (post-weir).""" outlet_post_weir_w = max( #need self.outlet_to_filter_nd self.fitting_s + pipe.fitting_od(self.outlet_pipe.size), self.fitting_s + pipe.fitting_od(self.drain_pipe.size), self.w_min, pc.horiz_chan_w( self.q, self.outlet_weir_depth - self.outlet_free_h, #what is outlet_free_h self.outlet_weir_depth, self.l, pc.viscosity_kinematic(self.temp), mat.PVC_PIPE_ROUGH, 1, hl.PIPE_ENTRANCE_K_MINOR + hl.PIPE_EXIT_K_MINOR + hl.EL90_K_MINOR)) return outlet_post_weir_w
def eta_kolmogorov(EnergyDis, Temp): return ((pc.viscosity_kinematic(Temp).magnitude**3) / EnergyDis)**(1 / 4)
def reynolds_rapid_mix(PlantFlow, IDTube, Temp): return (4 * PlantFlow / (np.pi * IDTube * pc.viscosity_kinematic(Temp).magnitude))
def vel_grad_avg(self): """The average velocity gradient of water.""" vel_grad_avg = ((u.standard_gravity * self.hl) / (pc.viscosity_kinematic(self.temp) * self.gt)).to( u.s**-1) return vel_grad_avg