Return the flow rate with only minor losses.

    This function applies to both laminar and turbulent flows.
72
def flow_pipeminor(Diam, HeadLossExpans, KMinor):
    
    #Checking input validity - inputs not checked here are checked by
    #functions this function calls.
    ut.check_range([HeadLossExpans, ">=0", "Headloss due to expansion"],
                   [KMinor, ">0", "K minor"])
    return (area_circle(Diam).magnitude * np.sqrt(2 * gravity.magnitude
                                                  * HeadLossExpans
                                                  / KMinor)
            )
910987
def _get_loss_fn(self):
        """"""
        criteria = self.criteria.to(self.config["device"])
        loss_fn = lambda X, Y: sum(
            criteria(Y_tp, Y_t) for Y_tp, Y_t in zip(self.forward(X), Y)
        )
        return loss_fn
364920
def min(self, **kwargs):
        
        if self._is_transposed:
            kwargs["axis"] = kwargs.get("axis", 0) ^ 1
            return self.transpose().min(**kwargs)
        mapreduce_func = self._build_mapreduce_func(pandas.DataFrame.min, **kwargs)
        return self._full_reduce(kwargs.get("axis", 0), mapreduce_func)
101677
def time_col_laminar(EnergyDis, Temp, ConcAl, ConcClay, coag, material,
                     DiamTarget, DiamTube, DIM_FRACTAL, RatioHeightDiameter):
    
    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
            )
1129318
def std(self) -> Optional[float]:  #, ddof=0):
        
        # TODO: Add DOF
        if self._stats:
            return np.sqrt(self.variance())
        else:
            return None
694614
def zero_one_loss_calc(TP, POP):
    
    try:
        length = POP
        return (length - sum(TP.values()))
    except Exception:
        return "None"
875795
def scale_flow(flow, to_unit=True):
    ""
    s = tensor([flow.size[0]/2,flow.size[1]/2])[None]
    if to_unit: flow.flow = flow.flow/s-1
    else:       flow.flow = (flow.flow+1)*s
    return flow
458123
def get_loss(self, logits: mx.sym.Symbol, labels: mx.sym.Symbol) -> mx.sym.Symbol:
        
        raise NotImplementedError()
77901
def W_min_HS_ratio(self):
        
        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)
1255589
def get_learning_rate(self, iter):
        '''
        
        '''
        lr = self.init_lr
        for iter_step in self.iter_steps:
            if iter >= iter_step:
                lr *= self.gamma
        return lr
863227
def getSignificance(wk1, wk2, nout, ofac):
  
  expy = exp(-wk2)
  effm = 2.0*(nout)/ofac
  sig = effm*expy
  ind = (sig > 0.01).nonzero()
  sig[ind] = 1.0-(1.0-expy[ind])**effm
  return sig
356004
def min(cls, x: 'TensorFluent', y: 'TensorFluent') -> 'TensorFluent':
        '''
        '''
        return cls._binary_op(x, y, tf.minimum, tf.float32)
897322
def get_cell_shift(flow_model):
        
        assert flow_model.lower() in FlowModelConst.d8_deltas
        return FlowModelConst.d8_deltas.get(flow_model.lower())
831385
def loss(self, x_data, y_true):
        
        y_pred = self(x_data)
        return y_pred, self.loss_value(x_data, y_true, y_pred)
563916
def headloss_gen(Area, Vel, PerimWetted, Length, KMinor, Nu, PipeRough):
    
    #Inputs do not need to be checked here because they are checked by
    #functions this function calls.
    return (headloss_exp_general(Vel, KMinor).magnitude
            + headloss_fric_general(Area, PerimWetted, Vel,
                                     Length, Nu, PipeRough).magnitude)
215500
def head_orifice(Diam, RatioVCOrifice, FlowRate):
    """"""
    #Checking input validity
    ut.check_range([Diam, ">0", "Diameter"], [FlowRate, ">0", "Flow rate"],
                   [RatioVCOrifice, "0-1", "VC orifice ratio"])
    return ((FlowRate
             / (RatioVCOrifice * area_circle(Diam).magnitude)
             )**2
            / (2*gravity.magnitude)
            )
987698
def P_upstream_isothermal_critical_flow(P, fd, D, L):
    '''
    '''
    lambertw_term = float(lambertw(-exp(-(fd*L+D)/D), -1).real)
    return exp(-0.5*(D*lambertw_term+fd*L+D)/D)*P