<jupyter_start><jupyter_text>DC Hydraulic Flocculation In this design challenge you will design a vertical flow hydraulic flocculator. You will use the flow rate of `flow_plant = 20 L/s` as your default design value.Although we don't require that you use the nomenclature from the AguaClara variable naming guide, it provides a reasonable basis for organizing your variable names. We use the convention that the first part of the variable name describes the type of variable and always has a unique dimension. The subsequent parts of the variable name start from the big picture and slowly add more and more detail to arrive at the precise component that you are describing. Thus space_floc_baffle is the spacing between baffles in the flocculator and n_floc_channel_baffle should be the number of baffles in a flocculator channel. width_floc_channel_port should be the width of the port connecting two flocculator channels.**In this design challenge we will use functions to calculate each step of the design. Whenever we need to access a previously calculated result we will use the function call to access that value. Using this method of nested function calls will make the entire design be only a function of a few input parameters. ** This makes it possible to have flexible design code and ease the creation of new plant designs.The minimum input parameters to define a flocculator are (flow_plant, headloss_floc_BOD, Gt_BOD, T_BOD). We could have included a longer list of input parameters (height_floc_end, width_PC_sheet, K_e, etc.) to make our functions even more general. But to keep our code more concise we will focus on only 4 of the input parameters. This will make it possible to easily change the input parameters to obtain new designs. We will use this capability to plot the results of varying the design flow rate.  Hydraulic Vertical Flow Flocculator DesignThis challenge is design a hydraulic flocculator using the core concepts of the AguaClara design methodology.Below are the inputs for the design. BOD stands for Basis Of Design.<jupyter_code># head loss through the flocculator
headloss_floc_BOD = 40 * u.cm

# collision potential based on recent designs for AguaClara Plants
Gt_BOD = 37000

# water depth at the end of flocculator where it flows into the inlet channel of the sedimentation tank
height_floc_end = 2 * u.m

flow_plant = 20 * u.L/u.s

# This is the estimate for larger plants where the flocculator is as long as the sedimentation tanks.
# For lower flow plants we will need to reduce this length because of the constraint that the channels must
# be wide enough to construct.
length_channel_max = 6 * u.m

# minimum and maximum ratios of distance between expansions to baffle spacing
Pi_HS_min = 3
Pi_HS_max = 6

Pi_vc = pc.RATIO_VC_ORIFICE
Pi_vc_baffle = Pi_vc**2

# width of the polycarbonate sheets used to make baffles
width_PC_sheet = 1.067*u.m

# this is a reasonable constraint to keep the channel constructable by humans
width_floc_min_BOD = width_PC_sheet / 2
width_floc_max_BOD = width_PC_sheet

# expansion minor loss coefficient for 180 degree bend
K_e = (1 / Pi_vc_baffle - 1)**2

# this is the minimum temperature of the raw water
T_BOD = 15* u.degC<jupyter_output><empty_output><jupyter_text>Design Algorithm Steps1. Calculate the total volume of flocculator given head loss and collision potential2. Calculate the number of channels by taking the total width and dividing by the maximum channel width3. Calculate the channel width (total width over number of channels)4. Calculate the minimum number of obstacles and spacing between obstacles by assuming a maximum H/S ratio5. Use the actual H/S ratio based on obstacle spacing to calculate the spacing between baffles6. Calculate the obstacle width to obtain the same jet expansion conditions as produced by the 180 degree bend.This algorithm does not yet handle the integer number of baffles in a channel or the thickness of the bafflesFor this assignment **create functions for each question** and then use those function calls whenever that calculation result is required in a subsequent step. Include flow_plant, headloss_floc_BOD, Gt_BOD and T_BOD as the inputs that can be varied for each function.__Whenever you reference a previously calculated value in a function, use the function call for that value so that dependency is not broken.__That way you will be able to easily vary any of the three main input parameters (flow, Gt, head loss) to see their effect on the design.  1) Estimate the average velocity gradient of a flocculator given head loss and collision potential. I'm going to solve this problem for you so you see how to use function calls.<jupyter_code>def G_avg(hl, Gt, T):
    G = (pc.gravity * hl) / (Gt * pc.viscosity_kinematic(T_BOD))
    return G.to(1/u.s)

print ('The average velocity gradient of flocculator is', G_avg(headloss_floc_BOD, Gt_BOD, T_BOD))<jupyter_output>The average velocity gradient of flocculator is 93.24 / second
{'fraction_non_alphanumeric': 0.034392598551890585, 'fraction_numerical': 0.009050683829444892, 'mean_word_length': 4.8163742690058475, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '451632', 'license': 'MIT', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1266, 'n_words': 737, 'path': 'DC Solutions 2017/Jupyter Notebooks/DC_Hydraulic_Flocculation.ipynb', 'repo_name': 'AguaClara/CEE4550', 'size': '4972'}