def dens_floc(ConcAl, ConcClay, DIM_FRACTAL, DiamTarget, coag, material, Temp): """Calculate floc density as a function of size.""" WaterDensity = pc.density_water(Temp) return ((dens_floc_init(ConcAl, ConcClay, coag, material) - WaterDensity ) * (material.Diameter / DiamTarget)**(3 - DIM_FRACTAL) + WaterDensity ).to(u.kg/u.m**3)
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 dens_pacl_solution(ConcAluminum, temp): """Return the density of the PACl solution. From Stock Tank Mixing report Fall 2013: https://confluence.cornell.edu/download/attachments/137953883/20131213_Research_Report.pdf """ return ((0.492 * ConcAluminum * PACl.MolecWeight / (PACl.AluminumMPM * MOLEC_WEIGHT_ALUMINUM)) + pc.density_water(temp).magnitude)
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 check_diffuser( w_sed, w_diffuser, vel_up, max_hl, temp, report_writer, shear_floc_max=0.5 * u.Pa, pi_plane_jet=0.0124, ): """Check that the diffuser's are designed appropriately by first checking the velocity calculated from their geometry is less than the maximum allowed due to shear. Then check that the head loss is less than the maximum allowable. For more info on shear stress calculation and default values see https://aguaclara.github.io/Textbook/Sedimentation/Sed_Design.html#jet-reverser-shear-stress Args: w_sed: width of the sed tank (u.m) w_diffuser: width of a diffuser (u.m) vel_up: design upflow velocity through the sed tank (u.m / u.s) max_hl: maximum allowable head loss over a diffuser (u.m) q_input: design flow rate (u.L / u.s) report_writer: ReportWriter object to record validation results shear_floc_max: maximum shear allowed without disrupting flocculation. Defaults to 0.5 Pascals pi_plane_jet: the amount of energy lost in the time that it takes for the jet to travel it's width normalized by the total kinetic energy. Defaults to 0.0124 Returns: none """ rho = pc.density_water(temp) nu = pc.viscosity_kinematic_water(temp) vel_diffuser = vel_up * w_sed / w_diffuser try: vel_max_shear = ( (shear_floc_max / rho) ** (1 / 2) * (vel_up * w_sed / (nu * pi_plane_jet)) ** (1 / 4) ).to(u.mm / u.s) assert vel_diffuser < vel_max_shear report_writer.write_message( "The max diffuser velocity based on floc shear, {!s}, " "is greater than the one calculated by this validation " "code, {!s}.\n".format(vel_max_shear, vel_diffuser) ) except AssertionError: report_writer.write_message( "INVALID: The max diffuser velocity based on floc shear, {!s}, " "is less than the one calculated by this validation " "code, {!s}.\n".format(vel_max_shear, vel_diffuser) ) report_writer.set_result("Invalid: Check Validation Report") try: head_loss = (vel_diffuser ** 2 / (2 * u.g_0)).to(u.cm) assert head_loss < max_hl report_writer.write_message( "The max head loss, {!s}, is greater than " "the one calculated by this validation " "code, {!s}.\n".format(max_hl, head_loss) ) except AssertionError: report_writer.write_message( "INVALID: The max head loss, {!s}, " "is less than the one calculated by this validation " "code, {!s}.\n".format(max_hl, head_loss) ) report_writer.set_result("Invalid: Check Validation Report") return vel_diffuser