UPF_moody_f(): Friction loss according to Moody chart

About:
Calculate the friction loss in a pipe, with uniform flow according to the Moody chart.
This function is applied to laminar and turbulent flow, i.e., to all the range of Reynolds number.
Source: Wikipedia
Module: UniformPressurizedFlow
Function: UPF_moody_f(q,e,t,s,d)
Definition of variables:
  • q, flow - m3/s;
  • e, pipe roughness - m;
  • t, temperature - ºC;
  • s, salinity - g/kg;
  • d, internal diameter - m.
Sample code:
from UniformPressurizedFlow import*

q = 0.01        #(m3/s)
e = 0.000003    #(m)
t = 15          #(oC)
s = 2.5         #(g/kg)
d = 0.75        #(m)

f = UPF_moody_f(q,e,t,s,d)

print("f:",f, "m/m")
Result:
f: 0.02783272130932784 m/m

UPF_laminarflow_f(): Friction loss for laminar flow

About:
Calculate the friction loss in a pipe, with uniform flow for laminar flow $(Re \leq 2000)$. 
\begin{equation} f = \frac{Re}{64} \end{equation}

Where,




  • Re, Reynolds Number » WATER_reynoldsnumber_re().


  • Module: UniformPressurizedFlow
    Function: UPF_laminarflow_f(q,t,s,d)
    Definition of variables:
    • q, flow - m3/s;
    • e, pipe roughness - m;
    • t, temperature - ºC;
    • s, salinity - g/kg;
    • d, internal diameter - m.
    Sample code:
    from UniformPressurizedFlow import*
    from WaterProperties import* q = 0.001 #(m3/s) d = 0.75 #(m) t = 15 #(oC) s = 2.5 #(g/kg) re = WATER_reynoldsnumber_re(q,d,t,s) f = UPF_laminarflow_f(q,t,s,d)
    Result:
    Re: 1496.0351140845949
    f: 0.042779744537721494 m/m

    WATERCHEM_rsi(): Ryznar Stability Index (RSI)

    About:
    Calculate the Ryznar Stability Index (RSI).
    \begin{equation} RSI = 2 \times pH_s - pH \end{equation}

    Module: WaterChemistry

    Function: WATERCHEM_rsi(t,ph,tds,ca,hco3)
    Parameters:
    • t, temperature - ºC;
    • ph, water pH
    • tds, Total Dissolved Solids - mg/l;
    • ca, concentration of calcium hardness, mg Ca/liter;
    • hco3, concetration of HCO3- (alkalinity), mg CaCO3/liter.
    Sample code:
    from WaterChemistry  import *
    
    ph = 7.7    # water pH
    tds = 300   # mg TDS/liter
    ca = 50     # mg Ca/liter
    hco3 = 100  # mg CaCo3/liter (Alkalinity)
    t = 20      # oC
    
    rsi = WATERCHEM_rsi(t,ph,tds,ca,hco3)
    
    print("RSI:",rsi)
    
    Result:
    RSI: 8.128539459578171
    

    WATERCHEM_lsi(): Langelier Saturation Index (LSI)

    About:
    Calculate the Langelier Saturation Index (LSI).
    \begin{equation} LSI = pH - pH_s \end{equation}

    Module: WaterChemistry

    Function: WATERCHEM_lsi(t,ph,tds,ca,hco3)
    Parameters:
    • t, temperature - ºC;
    • ph, water pH
    • tds, Total Dissolved Solids - mg/l;
    • ca, concentration of calcium hardness, mg Ca/liter;
    • hco3, concetration of HCO3- (alkalinity), mg CaCO3/liter.
    Sample code:
    from WaterChemistry  import *
    
    ph = 7.7    # water pH
    tds = 300   # mg TDS/liter
    ca = 50     # mg Ca/liter
    hco3 = 100  # mg CaCo3/liter (Alkalinity)
    t = 20      # oC
    
    lsi = WATERCHEM_lsi(t,ph,tds,ca,hco3)
    
    print("LSI:",lsi)
    
    
    Result:
    LSI: -0.21426972978908498
    

    WATERCHEM_phscalcium(): Saturation pH for calcium carbonate

    About:
    Calculate the saturation pH for calcium carbonate.


    \begin{equation} pH_s = pK'_2 + pCa^{2+}-pK'_s -log(2 \times \left[Alk \right]) -log\gamma_m \end{equation} \begin{equation}

    Module: WaterChemistry

    Function: WATERCHEM_phscalcium(t,tds,ca,hco3)
    Parameters:
    • t, temperature - ºC;
    • tds, Total Dissolved Solids - mg/l;
    • ca, concentration of calcium hardness, mg Ca/liter;
    • hco3, concetration of HCO3- (alkalinity), mg CaCO3/liter.
    Sample code:
    from WaterChemistry  import *
    
    tds = 300   # mg TDS/liter
    ca = 50     # mg Ca/liter
    hco3 = 100  # mg CaCo3/liter (Alkalinity)
    t = 20      # oC
    
    phs = WATERCHEM_phscalcium(t,tds,ca,hco3)
    
    print("phs:",phs)
    
    
    Result:
    phs: 7.914650556552682
    

    HYD_scs_hydrograph(): Flow hydrograph according to SCS

    About:
    Calculate a watershed flow hydrograph according to Soil Conservation Service (SCS).
    ©WETpython, 2015
    Module: Hydrology

    Function: HYD_scs_hydrograph(l,s,area,p)
    Parameters:
    • l, river lenght - m;
    • s, river slope - m/m;
    • area, watershed area, m2;
    • p, runoff rain, mm.
    Sample code:
    from Hydrology import *
    
    l = 69200 # (m)
    s = 0.00387 #(m/m)
    area = 225*10**6 #m2
    
    # runoff rain (effective rain), mm
    p = [16.0,24.0,43.0,19.0,14.0]
    
    (d,hydrogram,volume) = HYD_scs_hydrograph(l,s,area,p)
    
    print("Unit excess rainfall:", d, "h")
    print("hydrograph volume:", volume, "m3")
    time = 0.0
    print ("***Hydrograph***")
    for i in range(len(hydrogram)):
        print("time (h) | hydrogram (h|m3/s) :",time,"|", hydrogram[i])
        time += d
    
    
    Result:
    Unit excess rainfall: 1.925815112733541 h
    Hydrograph volume: 80444341.16650842 m3
    ***Hydrograph***
    time (h) | hydrogram (h|m3/s) : 0.0 | 0.0
    time (h) | hydrogram (h|m3/s) : 1.925815112733541 | 15.482968124128494
    time (h) | hydrogram (h|m3/s) : 3.851630225467082 | 54.19038843444973
    time (h) | hydrogram (h|m3/s) : 5.777445338200623 | 134.5082855783663
    time (h) | hydrogram (h|m3/s) : 7.703260450934164 | 233.21220736968544
    time (h) | hydrogram (h|m3/s) : 9.629075563667705 | 345.46372626961704
    time (h) | hydrogram (h|m3/s) : 11.554890676401246 | 433.24022142805944
    time (h) | hydrogram (h|m3/s) : 13.480705789134788 | 484.0249981939473
    time (h) | hydrogram (h|m3/s) : 15.40652090186833 | 468.61437448410146
    time (h) | hydrogram (h|m3/s) : 17.33233601460187 | 423.3893563591242
    time (h) | hydrogram (h|m3/s) : 19.258151127335413 | 356.4171629087126
    time (h) | hydrogram (h|m3/s) : 21.183966240068955 | 289.20068452552
    time (h) | hydrogram (h|m3/s) : 23.109781352802496 | 221.98420614232742
    time (h) | hydrogram (h|m3/s) : 25.035596465536038 | 154.7677277591348
    time (h) | hydrogram (h|m3/s) : 26.96141157826958 | 93.29837155411423
    time (h) | hydrogram (h|m3/s) : 28.88722669100312 | 43.973814835861376
    time (h) | hydrogram (h|m3/s) : 30.813041803736663 | 15.38082330071036
    time (h) | hydrogram (h|m3/s) : 32.738856916470205 | 3.083601692071024
    time (h) | hydrogram (h|m3/s) : 34.66467202920374 | 0.0
    

    ©WETpython, 2015




    HYD_scs_duh(): Synthetic Dimensionless Unit Hydrograph according to SCS

    About:
    Calculate the Synthetic Dimensionless Unit Hydrograph according to Soil Conservation Service (SCS).


    ©WETpython, 2015
    \begin{equation} T_l = 0.6 \times T_c \end{equation} \begin{equation} T_p = \frac{D}{2} + T_l \end{equation} \begin{equation} T_r = 1.67 \times T_p \end{equation} \begin{equation} T_b = T_p + T_b \end{equation} \begin{equation} D = 0.133 \times T_c \end{equation} \begin{equation} q_p = \frac{2.08 \times 10^{-6} \times A}{T_p} \end{equation} Where,






  • $T_l$, time lag - $h$
  • $T_p$, time to peak - $h$
  • $T_r$, recession limb time - $h$
  • $T_b$, base time - $h$
  • $T_c$, concentration time » HYD_kirpich_tc() - $h$
  • $D$, unit excess rain-fall - $h$
  • $q_q$, Synthetic Dimensionless Unit Hydrograph peak flow - $\frac{m^3}{s}$
  • $A$, Watershed area - $m^2$

  • Module: Hydrology
    Function: HYD_scs_duh(l,s,area)
    Definition of variables:
    • l, river lenght - m;
    • s, river slope - m/m;
    • area, watershed area, m2.
    Sample code:
    from Hydrology import *
    
    l = 69200 # (m)
    s = 0.00387 #(m/m)
    area = 225*10**6 #(m2)
    
    (tc, d,tp,tr,qp, duh) = HYD_scs_duh(l,s,area)
    
    print("tc:", tc, "h") # concentration time
    print("d:", d,"h") #
    print("tp:", tp,"h")
    print("tr:", tr,"h")
    print("tb:", tp+tr,"h")
    print("qp:", qp,"m3/s")
    time = 0.0
    print ("***Synthetic Dimensionless Unit Hydrograph***")
    for i in range(len(duh)):
        print("time|flow (h|m3/s):",time,"|", duh[i])
        time += d
    
    Result:
    tc: 14.479812877695796 h
    d: 1.925815112733541 h
    tp: 9.650795282984248 h
    tr: 16.116828122583694 h
    tb: 25.767623405567942 h
    qp: 48.49341285118252 m3/s
    ***Synthetic Dimensionless Unit Hydrograph***
    time|flow (h|m3/s): 0.0 | 0.0
    time|flow (h|m3/s): 1.925815112733541 | 9.676855077580308
    time|flow (h|m3/s): 3.851630225467082 | 19.353710155160616
    time|flow (h|m3/s): 5.777445338200623 | 29.030565232740926
    time|flow (h|m3/s): 7.703260450934164 | 38.70742031032123
    time|flow (h|m3/s): 9.629075563667705 | 48.38427538790154
    time|flow (h|m3/s): 11.554890676401246 | 42.76424062705119
    time|flow (h|m3/s): 13.480705789134788 | 36.9697166285001
    time|flow (h|m3/s): 15.40652090186833 | 31.175192629949013
    time|flow (h|m3/s): 17.33233601460187 | 25.380668631397928
    time|flow (h|m3/s): 19.258151127335413 | 19.586144632846842
    time|flow (h|m3/s): 21.183966240068955 | 13.791620634295757
    time|flow (h|m3/s): 23.109781352802496 | 7.997096635744673
    time|flow (h|m3/s): 25.035596465536038 | 2.2025726371935885
    time|flow (h|m3/s): 26.96141157826958 | 0.0


    ©WETpython, 2015