Write a code and answer to all the questions

    1. FS: We have provided a the skeleton of a function (flowDimensions) where you can add code. Use it to calculate the flocculator flow dimensions. Note that the function takes the design map as an input and returns the design map (with more parameters defined). Thus every parameter that you define as design.x will be returned by this function. We have provided recommended names for the parameters that you will be calculating in () below. After each step you can check the value that is being calculated by opening the variable table in the PS. Check the value of each calculation to make sure that the units are correct. In the flowDimensions function calculate the following:
      • Kbaffle������� from the vena contracta for the case when ΠHeS>6Π���>6 (design.baffleK_min). Our best estimate for the vena contracta is from sluice gates where the geometry is very similar to flow around a baffle and thus use a value of 0.6 for a 90 degree bend. Remember that the fluid change in direction is twice as large for a baffle than for a sluice gate and thus it contracts by this much twice! Note that this simplified design approach assumes that the flow has fully expanded before entering the next contraction.
      • kinematic viscosity (design.NU) based on the minimum water temperature. If you start typing viscosity the functions will pop up.
      • the baffle spacing (design.S), S, assuming the flow passage is square (see Equation (512)).
      • the baffle spacing for the case (if statement here!) where the target outlet water height is greater than the calculated design.S. Use Equation (511)
      • the distance between expansions (design.He), He��. We are assuming the given ratio (design.PI_HS) of the distance between expansions to the baffle spacing.
      • the residence time (design.baffleSpaceTI) in one baffle space. Use the flow rate and volume of one baffle space to calculate the baffle space residence time.
      • the average velocity (design.V) of the water in the flocculator for fully expanded flow. Use continuity (Q = VA) where A is perpendicular to the main direction of flow between baffles. Don’t worry about the curved flow at the ends of the baffles.
      • the head loss for one baffle (baffleHL). The gravity constant with units is available in FeatureScript as “gravity”.
  1. FS: Calculate these additional values. These can be added in the HHflocPreDesigner function. Make sure to do these calculations below the functional call for flowDimensions so that all of the values you calculated in flow Dimensions are available to be used in these calculations.
    • the required residence time for the entire flocculator (design.TI_bod) based on the required design.GT_min. Remember that G_bod (the velocity gradient that is the basis of design) is a known input and thus you can use Equation (513).
    • the number of baffle spaces (design.baffleSpacesN) given the required residence time in each baffle space and the total residence time of the flocculator. Don’t look for an equation, instead think about it and create your own equation! Use the ceil function to round up. This will ensure that the total fluid deformation in the flocculator is at least design.GT_min.
    • the active residence time based on the number of baffle spaces (design.TI_active). Note that this time does not include the extra time that results from head loss increasing the water level. The active residence time accounts for the fact that we rounded up in the previous step and thus the active residence time is greater than design.TI_boc.
    • the total head loss (design.HL_total) that takes into account the fraction of the design flow that the flocculator is currently treating, design.Q_pi. You will need to derive an equation for this. Consider how head loss varies with flow for minor losses (see Equation (20)) and from that deduce how head loss must vary with the fraction of the design flow.
    • the height of the tank walls (design.H). Make sure the tank walls are higher than the maximum water depth!
    • the total volume of water in the flocculator (design.VOL_total) taking into account the extra triangle of water caused by head loss. You don’t need to take into account the water in the ports through the baffle walls. If this isn’t clear you can postpone this until after you’ve created the flocculator tank and the water surface.
  2. PS: Verify that your Featurescript code is running without errors before moving to the Parts Studio
  3. PS: Use the Civil Tank feature to draw the flocculator tank. The Civil Tank feature is in the part studio, but the inputs have to be linked to variables that you calculate. Note that the Civil Tank has an option for ports that can be used to turn the internal tank walls into baffles. Initially set the port height to be the same as the tank wall height so that the ports effectively remove a section of the wall. You will have to think about geometry and the correspondence between the flow geometry in Equation (511) and the tank geometry required as inputs for the Civil Tank feature.
  4. PS: Draw the water surface for the entire flocculator. To simplify this challenge make the assumption that the water slopes uniformly from one end of the flocculator to the other as it crosses the many baffles. There are many ways to approach this. We need a line that can then be “extruded” into a surface that will be normal to the sketch plane that the line was drawn on. To avoid needing a slanted plane you can create a sketch on the Front plane (assuming that you didn’t move the tank after inserting). All you need is to define a line on the sketch that has the right starting and ending elevations. Then extrude it to create a surface. Note that the extrude tool can either create a solid or a surface so you’ll need to select the surface option.
  5. The water elevation in a flocculator is controlled by the water elevation in the downstream clarifier because we can’t have a sudden decrease in water elevation (a waterfall!) because that would break up the flocs. The water depth increases as we move upstream in the flocculator because potential energy is being lost to heat as the water is being deformed. This increase in water elevation results in the flow area increasing and the velocity decreasing as we move upstream. This would result in less energy loss in the upstream baffles. To remedy this situation and increase the strength of the tank, set the port height to be equal to the target width of the flow so that a beam extends over the top of the port. We don’t know if this contraction will be exactly what is needed, but it should be close. This is an example where some computational fluid dynamics would be great to check if this solution behaves as we expect.
  6. FS: Design two drains for the flocculator tank. These drains will work together to drain the tank in the specified time (design.drainTI).
    • Create a drain function (same inputs and outputs as the flowDimension function) that you call from the HHflocPreDesigner. (Done)
    • Calculate the average flow rate through each of the two drains that must be achieved to empty the tank in time design.drainTI. Use the total volume of water (including head loss) in the flocculator to calculate the required flow.
    • Use the diamMinorPipe function to size the minimum inner diameter of the drain pipe (design.drainID). Use the very good approximation that the drain pipes must deliver twice the average flow given the initial head loss. You can assume that the head available to drive water through the drain is equal to the initial minimum depth of water in the flocculator (i.e. not counting the extra head available because of head loss in the flocculator that results in an increase in water depth). This assumption will create a slightly conservative design. For the minor loss coefficient you can use minor loss coefficient constants that are already defined in FeatureScript. You can access these constants by starting to type “minor” and a list of options will appear. You can randomly select some loss coefficients initially and then return to this and select the correct coefficients after you have created the drain in the PS.
    • Use the queryPipeWithFittingDim function to find a pipe in our parts database that meets the inner diameter requirement. Note that there are two versions of the queryPipeWithFittingDim function. Use the one that has 4 inputs. Use the genSDR for SDR and select and ELBOW_90 for the fitting shape (options show up when you type “FittingShape.”). This function returns the key dimensions of both the pipe and the elbow and places them in a map. Assign the output of the function to (design.drain). (This step is already done.)
    • Use printMap(design.drain) to print the resulting map in FeatureNotices so you can see all the cool information that is returned. You’ll be using this to sketch the pipelines for the drains in the next step.