Given that 60 deg F water flows through a 6" sched 80 45 degree wye with equal leg diameters, 250 gpm flows through the branch leg and 400 gpm flows through the straight leg.

Find the loss coefficients for the straight leg, and the branch leg, as well as the loss coefficients for each flow path.

```
In [1]:
```from fluids.units import *
from math import pi
NPS, Di, Do, t = nearest_pipe(NPS=6, schedule='80')
A = 0.25*pi*Di**2
beta = 1 # same diameters
rho = 998*u.kg/u.m**3
Q_tot = (250+400)*u.gal/u.min
Q_straight = 400*u.gal/u.min
Q_branch = 250*u.gal/u.min
v_combined = Q_tot/A
print('The combined velocity is %s' %(v_combined.to(u.ft/u.s)))
branch_flow_ratio = Q_branch/Q_tot
v_main = Q_straight/A
v_leg = Q_branch/A
K_branch = K_branch_diverging_Crane(D_run=Di, D_branch=Di, Q_run=Q_straight, Q_branch=Q_branch, angle=45.0*u.degrees)
print('The branch loss coefficient is %s' %(K_branch))
K_run = K_run_diverging_Crane(D_run=Di, D_branch=Di, Q_run=Q_straight, Q_branch=Q_branch, angle=45.0*u.degrees)
print('The run loss coefficient is %s' %(K_run))
head_loss_branch = 0.5*rho*v_combined**2*K_branch/(1*u.gravity*rho)
print('The branch head loss is %s' %(head_loss_branch.to(u.ft)))
head_loss_run = 0.5*rho*v_combined**2*K_run/(1*u.gravity*rho)
print('The run head loss is %s' %(head_loss_run.to(u.ft)))

```
```